From 8aa3fcfb638f1dfda7e55408090eb273865f49f7 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 19 May 2015 15:05:02 -0700 Subject: [PATCH] =?UTF-8?q?chore(build):=20don=E2=80=99t=20include=20`expo?= =?UTF-8?q?rt=20var=20=5F=5FesModule=20=3D=20true`=20in=20every=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- modules/angular2/change_detection.ts | 5 -- modules/angular2/di.ts | 5 -- modules/angular2/{globals.ts => globals.d.ts} | 4 +- modules/angular2/globals.dart | 3 - .../abstract_change_detector.ts | 5 -- .../src/change_detection/binding_record.ts | 5 -- .../src/change_detection/change_detection.ts | 5 -- .../change_detection_jit_generator.ts | 5 -- .../change_detection/change_detection_util.ts | 5 -- .../change_detection/change_detector_ref.ts | 5 -- .../angular2/src/change_detection/coalesce.ts | 5 -- .../src/change_detection/constants.ts | 5 -- .../src/change_detection/directive_record.ts | 5 -- .../dynamic_change_detector.ts | 5 -- .../src/change_detection/exceptions.ts | 6 -- .../src/change_detection/interfaces.ts | 5 -- .../src/change_detection/parser/ast.ts | 5 -- .../src/change_detection/parser/lexer.ts | 5 -- .../src/change_detection/parser/locals.ts | 5 -- .../src/change_detection/parser/parser.ts | 5 -- .../pipes/iterable_changes.ts | 5 -- .../src/change_detection/pipes/json_pipe.ts | 6 -- .../pipes/keyvalue_changes.ts | 5 -- .../change_detection/pipes/lowercase_pipe.ts | 5 -- .../src/change_detection/pipes/null_pipe.ts | 5 -- .../change_detection/pipes/observable_pipe.ts | 6 -- .../src/change_detection/pipes/pipe.ts | 5 -- .../change_detection/pipes/pipe_registry.ts | 5 -- .../change_detection/pipes/promise_pipe.ts | 5 -- .../change_detection/pipes/uppercase_pipe.ts | 5 -- .../change_detection/proto_change_detector.ts | 6 -- .../src/change_detection/proto_record.ts | 5 -- modules/angular2/src/core/zone/ng_zone.ts | 12 ++-- modules/angular2/src/di/annotations_impl.ts | 5 -- modules/angular2/src/dom/browser_adapter.ts | 5 -- modules/angular2/src/dom/dom_adapter.ts | 9 ++- modules/angular2/src/facade/async.ts | 5 -- modules/angular2/src/facade/browser.ts | 5 -- modules/angular2/src/facade/collection.ts | 5 -- modules/angular2/src/facade/lang.ts | 5 -- modules/angular2/src/facade/math.ts | 5 -- modules/angular2/src/reflection/reflection.ts | 5 -- .../src/reflection/reflection_capabilities.ts | 5 -- modules/angular2/src/reflection/reflector.ts | 5 -- modules/angular2/src/reflection/types.ts | 5 -- .../src/render/dom/compiler/selector.ts | 11 ++-- modules/angular2/src/util/decorators.ts | 2 - tools/broccoli/trees/node_tree.ts | 58 ++++++++++++------- 48 files changed, 56 insertions(+), 252 deletions(-) rename modules/angular2/{globals.ts => globals.d.ts} (88%) delete mode 100644 modules/angular2/globals.dart diff --git a/modules/angular2/change_detection.ts b/modules/angular2/change_detection.ts index da822bc62b..e0f8e31d59 100644 --- a/modules/angular2/change_detection.ts +++ b/modules/angular2/change_detection.ts @@ -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; diff --git a/modules/angular2/di.ts b/modules/angular2/di.ts index aedb78c01e..9ad6bb11c7 100644 --- a/modules/angular2/di.ts +++ b/modules/angular2/di.ts @@ -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; diff --git a/modules/angular2/globals.ts b/modules/angular2/globals.d.ts similarity index 88% rename from modules/angular2/globals.ts rename to modules/angular2/globals.d.ts index 781d3e03b1..56e1ed6751 100644 --- a/modules/angular2/globals.ts +++ b/modules/angular2/globals.d.ts @@ -7,11 +7,11 @@ declare var assert: any; declare var global: Window; -type int = number; +declare type int = number; interface List extends Array {} -interface StringMap extends Object {} +interface StringMap extends Object {} interface Window { Object: typeof Object; diff --git a/modules/angular2/globals.dart b/modules/angular2/globals.dart deleted file mode 100644 index f82dcc2f5d..0000000000 --- a/modules/angular2/globals.dart +++ /dev/null @@ -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; diff --git a/modules/angular2/src/change_detection/abstract_change_detector.ts b/modules/angular2/src/change_detection/abstract_change_detector.ts index 542b222144..fdcee50351 100644 --- a/modules/angular2/src/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/change_detection/abstract_change_detector.ts @@ -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; shadowDomChildren: List; diff --git a/modules/angular2/src/change_detection/binding_record.ts b/modules/angular2/src/change_detection/binding_record.ts index 3362191ff5..01130b9c77 100644 --- a/modules/angular2/src/change_detection/binding_record.ts +++ b/modules/angular2/src/change_detection/binding_record.ts @@ -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"; diff --git a/modules/angular2/src/change_detection/change_detection.ts b/modules/angular2/src/change_detection/change_detection.ts index e2428d253c..fa5662617d 100644 --- a/modules/angular2/src/change_detection/change_detection.ts +++ b/modules/angular2/src/change_detection/change_detection.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/change_detection_jit_generator.ts b/modules/angular2/src/change_detection/change_detection_jit_generator.ts index 02a2c36f84..5bc2c0fa51 100644 --- a/modules/angular2/src/change_detection/change_detection_jit_generator.ts +++ b/modules/angular2/src/change_detection/change_detection_jit_generator.ts @@ -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 diff --git a/modules/angular2/src/change_detection/change_detection_util.ts b/modules/angular2/src/change_detection/change_detection_util.ts index 57bb669e2a..71c6508e28 100644 --- a/modules/angular2/src/change_detection/change_detection_util.ts +++ b/modules/angular2/src/change_detection/change_detection_util.ts @@ -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 { diff --git a/modules/angular2/src/change_detection/change_detector_ref.ts b/modules/angular2/src/change_detection/change_detector_ref.ts index 75d2e4429b..735e319d54 100644 --- a/modules/angular2/src/change_detection/change_detector_ref.ts +++ b/modules/angular2/src/change_detection/change_detector_ref.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/coalesce.ts b/modules/angular2/src/change_detection/coalesce.ts index 2f89d8790a..77d9baefa8 100644 --- a/modules/angular2/src/change_detection/coalesce.ts +++ b/modules/angular2/src/change_detection/coalesce.ts @@ -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. diff --git a/modules/angular2/src/change_detection/constants.ts b/modules/angular2/src/change_detection/constants.ts index 03e057e71b..7ecea3295b 100644 --- a/modules/angular2/src/change_detection/constants.ts +++ b/modules/angular2/src/change_detection/constants.ts @@ -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. diff --git a/modules/angular2/src/change_detection/directive_record.ts b/modules/angular2/src/change_detection/directive_record.ts index a91bebea7b..7f8cd0bceb 100644 --- a/modules/angular2/src/change_detection/directive_record.ts +++ b/modules/angular2/src/change_detection/directive_record.ts @@ -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) {} diff --git a/modules/angular2/src/change_detection/dynamic_change_detector.ts b/modules/angular2/src/change_detection/dynamic_change_detector.ts index 47a78b83aa..91e5001e06 100644 --- a/modules/angular2/src/change_detection/dynamic_change_detector.ts +++ b/modules/angular2/src/change_detection/dynamic_change_detector.ts @@ -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; diff --git a/modules/angular2/src/change_detection/exceptions.ts b/modules/angular2/src/change_detection/exceptions.ts index 7796ae69df..09fe1a9425 100644 --- a/modules/angular2/src/change_detection/exceptions.ts +++ b/modules/angular2/src/change_detection/exceptions.ts @@ -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; diff --git a/modules/angular2/src/change_detection/interfaces.ts b/modules/angular2/src/change_detection/interfaces.ts index 4e0ed1a082..d719358027 100644 --- a/modules/angular2/src/change_detection/interfaces.ts +++ b/modules/angular2/src/change_detection/interfaces.ts @@ -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; } } diff --git a/modules/angular2/src/change_detection/parser/ast.ts b/modules/angular2/src/change_detection/parser/ast.ts index d91fbc35b4..891e46507b 100644 --- a/modules/angular2/src/change_detection/parser/ast.ts +++ b/modules/angular2/src/change_detection/parser/ast.ts @@ -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"); } diff --git a/modules/angular2/src/change_detection/parser/lexer.ts b/modules/angular2/src/change_detection/parser/lexer.ts index 71770876c2..c45745d40d 100644 --- a/modules/angular2/src/change_detection/parser/lexer.ts +++ b/modules/angular2/src/change_detection/parser/lexer.ts @@ -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; diff --git a/modules/angular2/src/change_detection/parser/locals.ts b/modules/angular2/src/change_detection/parser/locals.ts index d2a9771200..6a262b362f 100644 --- a/modules/angular2/src/change_detection/parser/locals.ts +++ b/modules/angular2/src/change_detection/parser/locals.ts @@ -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) {} diff --git a/modules/angular2/src/change_detection/parser/parser.ts b/modules/angular2/src/change_detection/parser/parser.ts index b42b1d9bdf..2998da0458 100644 --- a/modules/angular2/src/change_detection/parser/parser.ts +++ b/modules/angular2/src/change_detection/parser/parser.ts @@ -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('\\{\\{(.*?)\\}\\}'); diff --git a/modules/angular2/src/change_detection/pipes/iterable_changes.ts b/modules/angular2/src/change_detection/pipes/iterable_changes.ts index 9433b691d4..996322560a 100644 --- a/modules/angular2/src/change_detection/pipes/iterable_changes.ts +++ b/modules/angular2/src/change_detection/pipes/iterable_changes.ts @@ -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(); } diff --git a/modules/angular2/src/change_detection/pipes/json_pipe.ts b/modules/angular2/src/change_detection/pipes/json_pipe.ts index 9a5e8049a2..9ac164cf2e 100644 --- a/modules/angular2/src/change_detection/pipes/json_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/json_pipe.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts index abb0afeb6c..602da82bc4 100644 --- a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts +++ b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts @@ -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 */ diff --git a/modules/angular2/src/change_detection/pipes/lowercase_pipe.ts b/modules/angular2/src/change_detection/pipes/lowercase_pipe.ts index 9bc37b49a2..5df0190f15 100644 --- a/modules/angular2/src/change_detection/pipes/lowercase_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/lowercase_pipe.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/pipes/null_pipe.ts b/modules/angular2/src/change_detection/pipes/null_pipe.ts index b87da8b40e..bebb3c86fe 100644 --- a/modules/angular2/src/change_detection/pipes/null_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/null_pipe.ts @@ -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 */ diff --git a/modules/angular2/src/change_detection/pipes/observable_pipe.ts b/modules/angular2/src/change_detection/pipes/observable_pipe.ts index 461a635834..3d871f7fdc 100644 --- a/modules/angular2/src/change_detection/pipes/observable_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/observable_pipe.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/pipes/pipe.ts b/modules/angular2/src/change_detection/pipes/pipe.ts index 243e6b5bc4..9593ef6829 100644 --- a/modules/angular2/src/change_detection/pipes/pipe.ts +++ b/modules/angular2/src/change_detection/pipes/pipe.ts @@ -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. diff --git a/modules/angular2/src/change_detection/pipes/pipe_registry.ts b/modules/angular2/src/change_detection/pipes/pipe_registry.ts index 9811e95b3c..da54a6add2 100644 --- a/modules/angular2/src/change_detection/pipes/pipe_registry.ts +++ b/modules/angular2/src/change_detection/pipes/pipe_registry.ts @@ -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) {} diff --git a/modules/angular2/src/change_detection/pipes/promise_pipe.ts b/modules/angular2/src/change_detection/pipes/promise_pipe.ts index 929951ae9d..159426386d 100644 --- a/modules/angular2/src/change_detection/pipes/promise_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/promise_pipe.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/pipes/uppercase_pipe.ts b/modules/angular2/src/change_detection/pipes/uppercase_pipe.ts index c1d62f6867..63b99365a5 100644 --- a/modules/angular2/src/change_detection/pipes/uppercase_pipe.ts +++ b/modules/angular2/src/change_detection/pipes/uppercase_pipe.ts @@ -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. * diff --git a/modules/angular2/src/change_detection/proto_change_detector.ts b/modules/angular2/src/change_detection/proto_change_detector.ts index ff2451ddf2..689bd9b949 100644 --- a/modules/angular2/src/change_detection/proto_change_detector.ts +++ b/modules/angular2/src/change_detection/proto_change_detector.ts @@ -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; diff --git a/modules/angular2/src/change_detection/proto_record.ts b/modules/angular2/src/change_detection/proto_record.ts index 2bcf3033bf..32d781bde8 100644 --- a/modules/angular2/src/change_detection/proto_record.ts +++ b/modules/angular2/src/change_detection/proto_record.ts @@ -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; diff --git a/modules/angular2/src/core/zone/ng_zone.ts b/modules/angular2/src/core/zone/ng_zone.ts index dfbd3131e4..9b835f2902 100644 --- a/modules/angular2/src/core/zone/ng_zone.ts +++ b/modules/angular2/src/core/zone/ng_zone.ts @@ -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) { diff --git a/modules/angular2/src/di/annotations_impl.ts b/modules/angular2/src/di/annotations_impl.ts index 6210437a24..44aaf6ff96 100644 --- a/modules/angular2/src/di/annotations_impl.ts +++ b/modules/angular2/src/di/annotations_impl.ts @@ -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. * diff --git a/modules/angular2/src/dom/browser_adapter.ts b/modules/angular2/src/dom/browser_adapter.ts index 11da0887df..a53920fd67 100644 --- a/modules/angular2/src/dom/browser_adapter.ts +++ b/modules/angular2/src/dom/browser_adapter.ts @@ -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; diff --git a/modules/angular2/src/dom/dom_adapter.ts b/modules/angular2/src/dom/dom_adapter.ts index 4e3ea3a0a9..4d203e46f4 100644 --- a/modules/angular2/src/dom/dom_adapter.ts +++ b/modules/angular2/src/dom/dom_adapter.ts @@ -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() { diff --git a/modules/angular2/src/facade/async.ts b/modules/angular2/src/facade/async.ts index bbda7d0b96..68b1e77a87 100644 --- a/modules/angular2/src/facade/async.ts +++ b/modules/angular2/src/facade/async.ts @@ -1,11 +1,6 @@ /// /// -// 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'; diff --git a/modules/angular2/src/facade/browser.ts b/modules/angular2/src/facade/browser.ts index 0d93c042d6..51ef45ef2b 100644 --- a/modules/angular2/src/facade/browser.ts +++ b/modules/angular2/src/facade/browser.ts @@ -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}; diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index d5047efb7a..90264f0b69 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -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; diff --git a/modules/angular2/src/facade/lang.ts b/modules/angular2/src/facade/lang.ts index 9c299e10c3..a9d868855f 100644 --- a/modules/angular2/src/facade/lang.ts +++ b/modules/angular2/src/facade/lang.ts @@ -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; diff --git a/modules/angular2/src/facade/math.ts b/modules/angular2/src/facade/math.ts index 4c15bf1e3e..2a6a9eab8e 100644 --- a/modules/angular2/src/facade/math.ts +++ b/modules/angular2/src/facade/math.ts @@ -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; diff --git a/modules/angular2/src/reflection/reflection.ts b/modules/angular2/src/reflection/reflection.ts index 9db2e73a9c..1a6aa03921 100644 --- a/modules/angular2/src/reflection/reflection.ts +++ b/modules/angular2/src/reflection/reflection.ts @@ -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()); diff --git a/modules/angular2/src/reflection/reflection_capabilities.ts b/modules/angular2/src/reflection/reflection_capabilities.ts index 31d401614c..722e1acba7 100644 --- a/modules/angular2/src/reflection/reflection_capabilities.ts +++ b/modules/angular2/src/reflection/reflection_capabilities.ts @@ -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; diff --git a/modules/angular2/src/reflection/reflector.ts b/modules/angular2/src/reflection/reflector.ts index ed36e8d525..78712ca82f 100644 --- a/modules/angular2/src/reflection/reflector.ts +++ b/modules/angular2/src/reflection/reflector.ts @@ -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; _getters: Map; diff --git a/modules/angular2/src/reflection/types.ts b/modules/angular2/src/reflection/types.ts index 1a7f4e83da..c5445a2379 100644 --- a/modules/angular2/src/reflection/types.ts +++ b/modules/angular2/src/reflection/types.ts @@ -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}; diff --git a/modules/angular2/src/render/dom/compiler/selector.ts b/modules/angular2/src/render/dom/compiler/selector.ts index 8823524a44..31f92a9735 100644 --- a/modules/angular2/src/render/dom/compiler/selector.ts +++ b/modules/angular2/src/render/dom/compiler/selector.ts @@ -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; private _elementPartialMap: Map; private _classMap: Map; @@ -147,7 +147,7 @@ export class SelectorMatcher { private _attrValueMap: Map; private _attrValuePartialMap: Map; private _listContexts: List; - + 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; diff --git a/modules/angular2/src/util/decorators.ts b/modules/angular2/src/util/decorators.ts index 0f24c998e5..7a7d5a02a3 100644 --- a/modules/angular2/src/util/decorators.ts +++ b/modules/angular2/src/util/decorators.ts @@ -1,5 +1,3 @@ -export var __esModule = true; - import {global} from 'angular2/src/facade/lang'; export function makeDecorator(annotationCls) { diff --git a/tools/broccoli/trees/node_tree.ts b/tools/broccoli/trees/node_tree.ts index 0cfcb93d17..31fcd811b4 100644 --- a/tools/broccoli/trees/node_tree.ts +++ b/tools/broccoli/trees/node_tree.ts @@ -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); +} +;