fix(build): support transpile to commonjs
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {List, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {normalizeBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
import {normalizeBlank, isPresent, global} from 'angular2/src/facade/lang';
|
||||
|
||||
export class VmTurnZone {
|
||||
_outerZone;
|
||||
@ -17,7 +17,7 @@ export class VmTurnZone {
|
||||
this._onTurnDone = null;
|
||||
this._onErrorHandler = null;
|
||||
|
||||
this._outerZone = window.zone;
|
||||
this._outerZone = global.zone;
|
||||
this._innerZone = this._createInnerZone(this._outerZone, enableLongStackTrace);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {int} from 'angular2/src/facade/lang';
|
||||
import {int, global} from 'angular2/src/facade/lang';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
export var Promise = window.Promise;
|
||||
|
||||
export var Promise = global.Promise;
|
||||
|
||||
export class PromiseWrapper {
|
||||
static resolve(obj):Promise {
|
||||
@ -37,7 +38,7 @@ export class PromiseWrapper {
|
||||
}
|
||||
|
||||
static setTimeout(fn:Function, millis:int) {
|
||||
window.setTimeout(fn, millis);
|
||||
global.setTimeout(fn, millis);
|
||||
}
|
||||
|
||||
static isPromise(maybePromise):boolean {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {int, isJsObject} from 'angular2/src/facade/lang';
|
||||
import {int, isJsObject, global} from 'angular2/src/facade/lang';
|
||||
|
||||
export var List = window.Array;
|
||||
export var Map = window.Map;
|
||||
export var Set = window.Set;
|
||||
export var List = global.Array;
|
||||
export var Map = global.Map;
|
||||
export var Set = global.Set;
|
||||
|
||||
export class MapWrapper {
|
||||
static create():Map { return new Map(); }
|
||||
|
@ -1,3 +1,5 @@
|
||||
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
export var window = frames.window;
|
||||
export var DocumentFragment = window.DocumentFragment;
|
||||
export var Node = window.Node;
|
||||
@ -10,8 +12,6 @@ export var document = window.document;
|
||||
export var location = window.location;
|
||||
export var gc = window.gc ? () => window.gc() : () => null;
|
||||
|
||||
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
export class DOM {
|
||||
static query(selector) {
|
||||
return document.querySelector(selector);
|
||||
|
@ -1,6 +1,6 @@
|
||||
library angular.core.facade.lang;
|
||||
|
||||
export 'dart:core' show Type, RegExp;
|
||||
export 'dart:core' show Type, RegExp, print;
|
||||
import 'dart:math' as math;
|
||||
|
||||
class Math {
|
||||
|
@ -1,7 +1,10 @@
|
||||
export {proxy} from 'rtts_assert/rtts_assert';
|
||||
|
||||
var _global = typeof window === 'undefined' ? global : window;
|
||||
export {_global as global};
|
||||
|
||||
export var Type = Function;
|
||||
export var Math = window.Math;
|
||||
export var Math = _global.Math;
|
||||
|
||||
var assertionsEnabled_ = typeof assert !== 'undefined';
|
||||
|
||||
@ -9,14 +12,14 @@ var int;
|
||||
// global assert support, as Dart has it...
|
||||
// TODO: `assert` calls need to be removed in production code!
|
||||
if (assertionsEnabled_) {
|
||||
window.assert = assert;
|
||||
_global.assert = assert;
|
||||
// `int` is not a valid JS type
|
||||
int = assert.define('int', function(value) {
|
||||
return typeof value === 'number' && value%1 === 0;
|
||||
});
|
||||
} else {
|
||||
int = {};
|
||||
window.assert = function() {};
|
||||
_global.assert = function() {};
|
||||
}
|
||||
export {int};
|
||||
|
||||
@ -173,8 +176,8 @@ var RegExp;
|
||||
if (assertionsEnabled_) {
|
||||
RegExp = assert.define('RegExp', function(obj) {
|
||||
assert(obj).is(assert.structure({
|
||||
single: window.RegExp,
|
||||
multiple: window.RegExp
|
||||
single: _global.RegExp,
|
||||
multiple: _global.RegExp
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
@ -185,8 +188,8 @@ export class RegExpWrapper {
|
||||
static create(regExpStr, flags:string = ''):RegExp {
|
||||
flags = flags.replace(/g/g, '');
|
||||
return {
|
||||
multiple: new window.RegExp(regExpStr, flags + 'g'),
|
||||
single: new window.RegExp(regExpStr, flags)
|
||||
multiple: new _global.RegExp(regExpStr, flags + 'g'),
|
||||
single: new _global.RegExp(regExpStr, flags)
|
||||
};
|
||||
}
|
||||
static firstMatch(regExp, input) {
|
||||
|
@ -1 +1,3 @@
|
||||
export var Math = window.Math;
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
|
||||
export var Math = global.Math;
|
Reference in New Issue
Block a user