Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit e24f3ea

Browse files
committed
release build
1 parent 1e684d4 commit e24f3ea

6 files changed

+85
-50
lines changed

dist/es6-module-loader-sans-promises.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader-sans-promises.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader-sans-promises.src.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ function logloads(loads) {
141141

142142
(function() {
143143
var Promise = __global.Promise || require('when/es6-shim/Promise');
144-
console.assert = console.assert || function() {};
144+
if (__global.console)
145+
console.assert = console.assert || function() {};
145146

146147
// IE8 support
147148
var indexOf = Array.prototype.indexOf || function(item) {
@@ -209,7 +210,7 @@ function logloads(loads) {
209210
load = createLoad(name);
210211
load.status = 'linked';
211212
// https://bugs.ecmascript.org/show_bug.cgi?id=2795
212-
// load.module = loader.modules[name];
213+
load.module = loader.modules[name];
213214
return load;
214215
}
215216

@@ -285,7 +286,7 @@ function logloads(loads) {
285286
if (instantiateResult === undefined) {
286287
load.address = load.address || '<Anonymous Module ' + ++anonCnt + '>';
287288

288-
// NB instead of load.kind, use load.isDeclarative
289+
// instead of load.kind, use load.isDeclarative
289290
load.isDeclarative = true;
290291
// parse sets load.declare, load.depsList
291292
loader.loaderObj.parse(load);
@@ -377,12 +378,10 @@ function logloads(loads) {
377378
if (loader.modules[name])
378379
throw new TypeError('"' + name + '" already exists in the module table');
379380

380-
// NB this still seems wrong for LoadModule as we may load a dependency
381-
// of another module directly before it has finished loading.
382-
// see https://bugs.ecmascript.org/show_bug.cgi?id=2994
381+
// adjusted to pick up existing loads
383382
for (var i = 0, l = loader.loads.length; i < l; i++)
384383
if (loader.loads[i].name == name)
385-
throw new TypeError('"' + name + '" already loading');
384+
return resolve(loader.loads[i].linkSets[0].done);
386385

387386
var load = createLoad(name);
388387

@@ -1120,8 +1119,6 @@ function logloads(loads) {
11201119

11211120
console.assert(load.source, 'Non-empty source');
11221121

1123-
var depsList;
1124-
11251122
load.isDeclarative = true;
11261123

11271124
var options = this.traceurOptions || {};
@@ -1139,8 +1136,10 @@ function logloads(loads) {
11391136

11401137
var sourceMap = compiler.getSourceMap();
11411138

1142-
if (__global.btoa && sourceMap)
1139+
if (__global.btoa && sourceMap) {
1140+
source += '\n//# sourceURL=' + load.address + '!eval';
11431141
source += '\n//# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(sourceMap))) + '\n';
1142+
}
11441143

11451144
source = 'var __moduleAddress = "' + load.address + '";' + source;
11461145

dist/es6-module-loader.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.src.js

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ define(function (require) {
3232
});
3333
})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });
3434

35-
},{"./Scheduler":3,"./env":5,"./makePromise":6}],3:[function(require,module,exports){
35+
},{"./Scheduler":3,"./env":5,"./makePromise":7}],3:[function(require,module,exports){
3636
/** @license MIT License (c) copyright 2010-2014 original author or authors */
3737
/** @author Brian Cavalier */
3838
/** @author John Hann */
@@ -123,6 +123,7 @@ define(function() {
123123
define(function(require) {
124124

125125
var setTimer = require('../env').setTimer;
126+
var format = require('../format');
126127

127128
return function unhandledRejection(Promise) {
128129
var logError = noop;
@@ -162,15 +163,15 @@ define(function(require) {
162163
function report(r) {
163164
if(!r.handled) {
164165
reported.push(r);
165-
logError('Potentially unhandled rejection [' + r.id + '] ' + formatError(r.value));
166+
logError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));
166167
}
167168
}
168169

169170
function unreport(r) {
170171
var i = reported.indexOf(r);
171172
if(i >= 0) {
172173
reported.splice(i, 1);
173-
logInfo('Handled previous rejection [' + r.id + '] ' + formatObject(r.value));
174+
logInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));
174175
}
175176
}
176177

@@ -191,28 +192,6 @@ define(function(require) {
191192
return Promise;
192193
};
193194

194-
function formatError(e) {
195-
var s = typeof e === 'object' && e.stack ? e.stack : formatObject(e);
196-
return e instanceof Error ? s : s + ' (WARNING: non-Error used)';
197-
}
198-
199-
function formatObject(o) {
200-
var s = String(o);
201-
if(s === '[object Object]' && typeof JSON !== 'undefined') {
202-
s = tryStringify(o, s);
203-
}
204-
return s;
205-
}
206-
207-
function tryStringify(e, defaultValue) {
208-
try {
209-
return JSON.stringify(e);
210-
} catch(e) {
211-
// Ignore. Cannot JSON.stringify e, stick with String(e)
212-
return defaultValue;
213-
}
214-
}
215-
216195
function throwit(e) {
217196
throw e;
218197
}
@@ -222,7 +201,7 @@ define(function(require) {
222201
});
223202
}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));
224203

225-
},{"../env":5}],5:[function(require,module,exports){
204+
},{"../env":5,"../format":6}],5:[function(require,module,exports){
226205
/** @license MIT License (c) copyright 2010-2014 original author or authors */
227206
/** @author Brian Cavalier */
228207
/** @author John Hann */
@@ -302,6 +281,64 @@ define(function(require) {
302281
/** @author Brian Cavalier */
303282
/** @author John Hann */
304283

284+
(function(define) { 'use strict';
285+
define(function() {
286+
287+
return {
288+
formatError: formatError,
289+
formatObject: formatObject,
290+
tryStringify: tryStringify
291+
};
292+
293+
/**
294+
* Format an error into a string. If e is an Error and has a stack property,
295+
* it's returned. Otherwise, e is formatted using formatObject, with a
296+
* warning added about e not being a proper Error.
297+
* @param {*} e
298+
* @returns {String} formatted string, suitable for output to developers
299+
*/
300+
function formatError(e) {
301+
var s = typeof e === 'object' && e !== null && e.stack ? e.stack : formatObject(e);
302+
return e instanceof Error ? s : s + ' (WARNING: non-Error used)';
303+
}
304+
305+
/**
306+
* Format an object, detecting "plain" objects and running them through
307+
* JSON.stringify if possible.
308+
* @param {Object} o
309+
* @returns {string}
310+
*/
311+
function formatObject(o) {
312+
var s = String(o);
313+
if(s === '[object Object]' && typeof JSON !== 'undefined') {
314+
s = tryStringify(o, s);
315+
}
316+
return s;
317+
}
318+
319+
/**
320+
* Try to return the result of JSON.stringify(x). If that fails, return
321+
* defaultValue
322+
* @param {*} x
323+
* @param {*} defaultValue
324+
* @returns {String|*} JSON.stringify(x) or defaultValue
325+
*/
326+
function tryStringify(x, defaultValue) {
327+
try {
328+
return JSON.stringify(x);
329+
} catch(e) {
330+
return defaultValue;
331+
}
332+
}
333+
334+
});
335+
}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));
336+
337+
},{}],7:[function(require,module,exports){
338+
/** @license MIT License (c) copyright 2010-2014 original author or authors */
339+
/** @author Brian Cavalier */
340+
/** @author John Hann */
341+
305342
(function(define) { 'use strict';
306343
define(function() {
307344

@@ -1329,7 +1366,8 @@ function logloads(loads) {
13291366

13301367
(function() {
13311368
var Promise = __global.Promise || require('when/es6-shim/Promise');
1332-
console.assert = console.assert || function() {};
1369+
if (__global.console)
1370+
console.assert = console.assert || function() {};
13331371

13341372
// IE8 support
13351373
var indexOf = Array.prototype.indexOf || function(item) {
@@ -1397,7 +1435,7 @@ function logloads(loads) {
13971435
load = createLoad(name);
13981436
load.status = 'linked';
13991437
// https://bugs.ecmascript.org/show_bug.cgi?id=2795
1400-
// load.module = loader.modules[name];
1438+
load.module = loader.modules[name];
14011439
return load;
14021440
}
14031441

@@ -1473,7 +1511,7 @@ function logloads(loads) {
14731511
if (instantiateResult === undefined) {
14741512
load.address = load.address || '<Anonymous Module ' + ++anonCnt + '>';
14751513

1476-
// NB instead of load.kind, use load.isDeclarative
1514+
// instead of load.kind, use load.isDeclarative
14771515
load.isDeclarative = true;
14781516
// parse sets load.declare, load.depsList
14791517
loader.loaderObj.parse(load);
@@ -1565,12 +1603,10 @@ function logloads(loads) {
15651603
if (loader.modules[name])
15661604
throw new TypeError('"' + name + '" already exists in the module table');
15671605

1568-
// NB this still seems wrong for LoadModule as we may load a dependency
1569-
// of another module directly before it has finished loading.
1570-
// see https://bugs.ecmascript.org/show_bug.cgi?id=2994
1606+
// adjusted to pick up existing loads
15711607
for (var i = 0, l = loader.loads.length; i < l; i++)
15721608
if (loader.loads[i].name == name)
1573-
throw new TypeError('"' + name + '" already loading');
1609+
return resolve(loader.loads[i].linkSets[0].done);
15741610

15751611
var load = createLoad(name);
15761612

@@ -2308,8 +2344,6 @@ function logloads(loads) {
23082344

23092345
console.assert(load.source, 'Non-empty source');
23102346

2311-
var depsList;
2312-
23132347
load.isDeclarative = true;
23142348

23152349
var options = this.traceurOptions || {};
@@ -2327,8 +2361,10 @@ function logloads(loads) {
23272361

23282362
var sourceMap = compiler.getSourceMap();
23292363

2330-
if (__global.btoa && sourceMap)
2364+
if (__global.btoa && sourceMap) {
2365+
source += '\n//# sourceURL=' + load.address + '!eval';
23312366
source += '\n//# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(sourceMap))) + '\n';
2367+
}
23322368

23332369
source = 'var __moduleAddress = "' + load.address + '";' + source;
23342370

0 commit comments

Comments
 (0)