chore(build): don’t include export var __esModule = true in every file

But do it during the build process for cjs.
Right now we only need this when we transpile from ts
directly to es5. This is only the case in our
cis build, as for our browser build we only transpile
from ts to es6 via ts and then use traceur to do
the rest.
This commit is contained in:
Tobias Bosch 2015-05-19 15:05:02 -07:00
parent 1beadb8607
commit 8aa3fcfb63
48 changed files with 56 additions and 252 deletions

View File

@ -57,8 +57,3 @@ export {
preGeneratedProtoDetectors,
defaultPipeRegistry
} from './src/change_detection/change_detection';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;

View File

@ -21,8 +21,3 @@ export {
NoAnnotationError
} from './src/di/exceptions';
export {OpaqueToken} from './src/di/opaque_token';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;

View File

@ -7,11 +7,11 @@
declare var assert: any;
declare var global: Window;
type int = number;
declare type int = number;
interface List<T> extends Array<T> {}
interface StringMap<K,V> extends Object {}
interface StringMap<K, V> extends Object {}
interface Window {
Object: typeof Object;

View File

@ -1,3 +0,0 @@
// Globals are provided by lang.dart in Dart.
// This file exists to prevent global.ts from being transpiled.
library angular2.globals;

View File

@ -4,11 +4,6 @@ import {ChangeDetectorRef} from './change_detector_ref';
import {ChangeDetector} from './interfaces';
import {CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED, ON_PUSH} from './constants';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class AbstractChangeDetector extends ChangeDetector {
lightDomChildren: List<any>;
shadowDomChildren: List<any>;

View File

@ -3,11 +3,6 @@ import {SetterFn} from 'angular2/src/reflection/types';
import {AST} from './parser/ast';
import {DirectiveIndex, DirectiveRecord} from './directive_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
const DIRECTIVE = "directive";
const ELEMENT = "element";
const TEXT_NODE = "textNode";

View File

@ -14,11 +14,6 @@ import {Injectable} from 'angular2/src/di/decorators';
import {List, StringMapWrapper} from 'angular2/src/facade/collection';
import {isPresent, BaseException} from 'angular2/src/facade/lang';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Structural diffing for `Object`s and `Map`s.
*

View File

@ -20,11 +20,6 @@ import {
RECORD_TYPE_INTERPOLATE
} from './proto_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* The code generator takes a list of proto records and creates a function/class

View File

@ -5,11 +5,6 @@ import {ExpressionChangedAfterItHasBeenChecked} from './exceptions';
import {WrappedValue} from './pipes/pipe';
import {CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED, ON_PUSH} from './constants';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export var uninitialized = new Object();
export class SimpleChange {

View File

@ -1,11 +1,6 @@
import {ChangeDetector} from './interfaces';
import {CHECK_ONCE, DETACHED, CHECK_ALWAYS} from './constants';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Controls change detection.
*

View File

@ -2,11 +2,6 @@ import {isPresent} from 'angular2/src/facade/lang';
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
import {RECORD_TYPE_SELF, ProtoRecord} from './proto_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Removes "duplicate" records. It assuming that record evaluation does not
* have side-effects.

View File

@ -1,10 +1,5 @@
// TODO:vsavkin Use enums after switching to TypeScript
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* CHECK_ONCE means that after calling detectChanges the mode of the change detector
* will become CHECKED.

View File

@ -1,11 +1,6 @@
import {ON_PUSH} from './constants';
import {StringWrapper} from 'angular2/src/facade/lang';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class DirectiveIndex {
constructor(public elementIndex: number, public directiveIndex: number) {}

View File

@ -24,11 +24,6 @@ import {
import {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './exceptions';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class DynamicChangeDetector extends AbstractChangeDetector {
locals: any;
values: List<any>;

View File

@ -1,12 +1,6 @@
import {ProtoRecord} from './proto_record';
import {BaseException} from "angular2/src/facade/lang";
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class ExpressionChangedAfterItHasBeenChecked extends BaseException {
message: string;

View File

@ -3,11 +3,6 @@ import {Locals} from './parser/locals';
import {BindingRecord} from './binding_record';
import {DirectiveRecord} from './directive_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class ProtoChangeDetector {
instantiate(dispatcher: any): ChangeDetector { return null; }
}

View File

@ -1,11 +1,6 @@
import {isBlank, isPresent, FunctionWrapper, BaseException} from "angular2/src/facade/lang";
import {List, Map, ListWrapper, StringMapWrapper} from "angular2/src/facade/collection";
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class AST {
eval(context, locals) { throw new BaseException("Not supported"); }

View File

@ -8,11 +8,6 @@ import {
BaseException
} from "angular2/src/facade/lang";
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export const TOKEN_TYPE_CHARACTER = 1;
export const TOKEN_TYPE_IDENTIFIER = 2;
export const TOKEN_TYPE_KEYWORD = 3;

View File

@ -1,11 +1,6 @@
import {isPresent, BaseException} from 'angular2/src/facade/lang';
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class Locals {
constructor(public parent: Locals, public current: Map<any, any>) {}

View File

@ -47,11 +47,6 @@ import {
} from './ast';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
var _implicitReceiver = new ImplicitReceiver();
// TODO(tbosch): Cannot make this const/final right now because of the transpiler...
var INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');

View File

@ -17,11 +17,6 @@ import {
import {WrappedValue, Pipe, PipeFactory} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
@CONST()
export class IterableChangesFactory extends PipeFactory {
constructor() { super(); }

View File

@ -1,12 +1,6 @@
import {isBlank, isPresent, CONST, Json} from 'angular2/src/facade/lang';
import {Pipe, PipeFactory} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Implements json transforms to any object.
*

View File

@ -3,11 +3,6 @@ import {stringify, looseIdentical, isJsObject, CONST} from 'angular2/src/facade/
import {WrappedValue, Pipe, PipeFactory} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* @exportedAs angular2/pipes
*/

View File

@ -1,11 +1,6 @@
import {isString, StringWrapper} from 'angular2/src/facade/lang';
import {Pipe} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Implements lowercase transforms to text.
*

View File

@ -1,11 +1,6 @@
import {isBlank, CONST} from 'angular2/src/facade/lang';
import {Pipe, WrappedValue, PipeFactory} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* @exportedAs angular2/pipes
*/

View File

@ -3,12 +3,6 @@ import {isBlank, isPresent, CONST} from 'angular2/src/facade/lang';
import {Pipe, WrappedValue, PipeFactory} from './pipe';
import {ChangeDetectorRef} from '../change_detector_ref';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Implements async bindings to Observable.
*

View File

@ -1,10 +1,5 @@
import {ABSTRACT, BaseException, CONST} from 'angular2/src/facade/lang';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Indicates that the result of a {@link Pipe} transformation has changed even though the reference
*has not changed.

View File

@ -4,11 +4,6 @@ import {Pipe} from './pipe';
import {Injectable} from 'angular2/src/di/decorators';
import {ChangeDetectorRef} from '../change_detector_ref';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
@Injectable()
export class PipeRegistry {
constructor(public config) {}

View File

@ -3,11 +3,6 @@ import {isBlank, isPresent} from 'angular2/src/facade/lang';
import {Pipe, WrappedValue} from './pipe';
import {ChangeDetectorRef} from '../change_detector_ref';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Implements async bindings to Promise.
*

View File

@ -1,11 +1,6 @@
import {isString, StringWrapper} from 'angular2/src/facade/lang';
import {Pipe} from './pipe';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* Implements uppercase transforms to text.
*

View File

@ -52,12 +52,6 @@ import {
RECORD_TYPE_INTERPOLATE
} from './proto_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class DynamicProtoChangeDetector extends ProtoChangeDetector {
_records: List<ProtoRecord>;

View File

@ -2,11 +2,6 @@ import {List} from 'angular2/src/facade/collection';
import {BindingRecord} from './binding_record';
import {DirectiveIndex} from './directive_record';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export const RECORD_TYPE_SELF = 0;
export const RECORD_TYPE_CONST = 1;
export const RECORD_TYPE_PRIMITIVE_OP = 2;

View File

@ -32,7 +32,7 @@ export class NgZone {
// zone.run(() => {}); // nested call -> in-turn
// });
_nestedRun: number;
// TODO(vicb): implement this class properly for node.js environment
// This disabled flag is only here to please cjs tests
_disabled: boolean;
@ -54,7 +54,7 @@ export class NgZone {
this._pendingMicrotasks = 0;
this._hasExecutedCodeInInnerZone = false;
this._nestedRun = 0;
if (global.zone) {
this._disabled = false;
this._mountZone = global.zone;
@ -99,11 +99,11 @@ export class NgZone {
* });
* ```
*/
run(fn) {
run(fn) {
if (this._disabled) {
return fn();
} else {
return this._innerZone.run(fn);
return this._innerZone.run(fn);
}
}
@ -123,12 +123,12 @@ export class NgZone {
* });
* ```
*/
runOutsideAngular(fn) {
runOutsideAngular(fn) {
if (this._disabled) {
return fn();
} else {
return this._mountZone.run(fn);
}
}
}
_createInnerZone(zone, enableLongStackTrace) {

View File

@ -1,10 +1,5 @@
import {CONST} from "angular2/src/facade/lang";
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
/**
* A parameter annotation that specifies a dependency.
*

View File

@ -3,11 +3,6 @@ import {isBlank, isPresent} from 'angular2/src/facade/lang';
import {setRootDomAdapter} from './dom_adapter';
import {GenericBrowserDomAdapter} from './generic_browser_adapter';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
var _attrToPropMap = {'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex'};
const DOM_KEY_LOCATION_NUMPAD = 3;

View File

@ -1,12 +1,11 @@
import {BaseException} from 'angular2/src/facade/lang';
// TODO: remove this when we no longer use traceur
export var __esModule = true;
import {BaseException, isBlank} from 'angular2/src/facade/lang';
export var DOM: DomAdapter;
export function setRootDomAdapter(adapter: DomAdapter) {
DOM = adapter;
if (isBlank(DOM)) {
DOM = adapter;
}
}
function _abstract() {

View File

@ -1,11 +1,6 @@
/// <reference path="../../typings/es6-promise/es6-promise.d.ts" />
/// <reference path="../../typings/rx/rx.all.d.ts" />
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
import {int, global, isPresent} from 'angular2/src/facade/lang';
import {List} from 'angular2/src/facade/collection';
import * as Rx from 'rx';

View File

@ -1,11 +1,6 @@
/**
* JS version of browser APIs. This library can only run in the browser.
*/
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
var win = window;
export {win as window};

View File

@ -1,10 +1,5 @@
import {int, isJsObject, global} from 'angular2/src/facade/lang';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export var List = global.Array;
export var Map = global.Map;
export var Set = global.Set;

View File

@ -1,11 +1,6 @@
var _global = typeof window === 'undefined' ? global : window;
export {_global as global};
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export var Type = Function;
export type Type = typeof Function;

View File

@ -1,9 +1,4 @@
import {global} from 'angular2/src/facade/lang';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export var Math = global.Math;
export var NaN = typeof NaN;

View File

@ -4,9 +4,4 @@ import {Reflector} from './reflector';
export {Reflector} from './reflector';
import {ReflectionCapabilities} from './reflection_capabilities';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export var reflector = new Reflector(new ReflectionCapabilities());

View File

@ -2,11 +2,6 @@ import {Type, isPresent, global} from 'angular2/src/facade/lang';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {GetterFn, SetterFn, MethodFn} from './types';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class ReflectionCapabilities {
private _reflect: any;

View File

@ -3,11 +3,6 @@ import {List, ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src
import {SetterFn, GetterFn, MethodFn} from './types';
export {SetterFn, GetterFn, MethodFn} from './types';
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export class Reflector {
_typeInfo: Map<Type, any>;
_getters: Map<string, GetterFn>;

View File

@ -1,8 +1,3 @@
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
export var __esModule = true;
export {Function as SetterFn};
export {Function as GetterFn};
export {Function as MethodFn};

View File

@ -134,12 +134,12 @@ toString(): string {
* are contained in a given CssSelector.
*/
export class SelectorMatcher {
static createNotMatcher(notSelector:CssSelector) {
static createNotMatcher(notSelector: CssSelector) {
var notMatcher = new SelectorMatcher();
notMatcher._addSelectable(notSelector, null, null);
return notMatcher;
return notMatcher;
}
private _elementMap: Map<string, string>;
private _elementPartialMap: Map<string, string>;
private _classMap: Map<string, string>;
@ -147,7 +147,7 @@ export class SelectorMatcher {
private _attrValueMap: Map<string, string>;
private _attrValuePartialMap: Map<string, string>;
private _listContexts: List<SelectorListContext>;
constructor() {
this._elementMap = MapWrapper.create();
this._elementPartialMap = MapWrapper.create();
@ -177,7 +177,8 @@ export class SelectorMatcher {
* @param cssSelector A css selector
* @param callbackCtxt An opaque object that will be given to the callback of the `match` function
*/
private _addSelectable(cssSelector: CssSelector, callbackCtxt: any, listContext: SelectorListContext) {
private _addSelectable(cssSelector: CssSelector, callbackCtxt: any,
listContext: SelectorListContext) {
var matcher = this;
var element = cssSelector.element;
var classNames = cssSelector.classNames;

View File

@ -1,5 +1,3 @@
export var __esModule = true;
import {global} from 'angular2/src/facade/lang';
export function makeDecorator(annotationCls) {

View File

@ -96,28 +96,46 @@ module.exports = function makeNodeTree(destinationPath) {
packageJsons = renderLodashTemplate(
packageJsons, {files: ["**/**"], context: {'packageJson': COMMON_PACKAGE_JSON}});
// HACK: workaround for Traceur behavior.
// It expects all transpiled modules to contain this marker.
// TODO: remove this when we no longer use traceur
var traceurCompatibleTsModulesTree = replace(modulesTree, {
files: ['**/*.ts'],
patterns: [{
// Empty replacement needed so that replaceWithPath gets triggered...
match: /$/g,
replacement: ""
}],
replaceWithPath: (path, content) => {
if (!path.endsWith('.d.ts')) {
content += '\r\nexport var __esModule = true;\n';
}
return content;
}
});
var typescriptTree = compileWithTypescript(modulesTree, {
allowNonTsExtensions: false,
emitDecoratorMetadata: true,
declaration: true,
mapRoot: '', /* force sourcemaps to use relative path */
module: 'commonjs',
noEmitOnError: true,
rootDir: '.',
rootFilePaths: ['angular2/traceur-runtime.d.ts'],
sourceMap: true,
sourceRoot: '.',
target: 'ES5'
});
var typescriptTree = compileWithTypescript(traceurCompatibleTsModulesTree, {
allowNonTsExtensions: false,
emitDecoratorMetadata: true,
declaration: true,
mapRoot: '', /* force sourcemaps to use relative path */
module: 'commonjs',
noEmitOnError: true,
rootDir: '.',
rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'],
sourceMap: true,
sourceRoot: '.',
target: 'ES5'
});
nodeTree = mergeTrees([nodeTree, typescriptTree, docs, packageJsons]);
nodeTree = mergeTrees([nodeTree, typescriptTree, docs, packageJsons]);
// TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
// ENOENT error is thrown while doing fs.readdirSync on inputRoot
// in the meantime, we just do noop mv to create a new tree
nodeTree = stew.mv(nodeTree, '');
// TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
// ENOENT error is thrown while doing fs.readdirSync on inputRoot
// in the meantime, we just do noop mv to create a new tree
nodeTree = stew.mv(nodeTree, '');
return destCopy(nodeTree, destinationPath);
};
return destCopy(nodeTree, destinationPath);
}
;