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

Commit 67ef95b

Browse files
committed
Merge pull request #136 from josh/es6-promise
Switch to ES6 Polyfill
2 parents 7a4c870 + 6bf5f74 commit 67ef95b

11 files changed

+35
-1866
lines changed

Gruntfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ module.exports = function (grunt) {
1515
},
1616
dist: [
1717
'lib/index.js',
18-
'lib/promise.js',
1918
'lib/loader.js',
2019
'lib/system.js'
2120
]
2221
},
2322
concat: {
2423
dist: {
2524
src: [
26-
'lib/promise.js',
25+
'node_modules/es6-promise/dist/promise-1.0.0.js',
2726
'lib/module.js',
2827
'lib/loader.js',
2928
'lib/system.js'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ For use in NodeJS, the `Module`, `Loader` and `System` globals are provided as e
284284
index.js:
285285
```javascript
286286
var System = require('es6-module-loader').System;
287-
287+
288288
System.import('some-module').then(function(m) {
289289
console.log(m.p);
290290
});
@@ -415,7 +415,7 @@ _Also, please don't edit files in the "dist" subdirectory as they are generated
415415
## Credit
416416
Copyright (c) 2014 Luke Hoban, Addy Osmani, Guy Bedford
417417

418-
ES6 Promises integration from [when.js](https://github.com/cujojs/when/blob/master/docs/es6-promise-shim.md), Copyright (c) 2010-2014 Brian Cavalier, John Hann, MIT License
418+
ES6 Promises integration from [es6-promise](https://github.com/jakearchibald/es6-promise).
419419

420420
## License
421421
Licensed under the MIT license.

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.5.4",
44
"description": "An ES6 Module Loader polyfill based on the latest spec.",
55
"homepage": "https://github.com/ModuleLoader/es6-module-loader",
6-
"main": "dist/es6-module-loader.js",
6+
"main": "dist/es6-module-loader-sans-promises.js",
77
"dependencies": {
8+
"es6-promise": "^1.0",
89
"traceur": "0.0.32"
910
},
1011
"keywords": [

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
https://github.com/jorendorff/js-loaders/blob/e60d3651/specs/es6-modules-2013-12-02.pdf
88
with the only exceptions as described here
99
10-
- Abstract functions have been combined where possible, and their associated functions
10+
- Abstract functions have been combined where possible, and their associated functions
1111
commented
1212
1313
- When the traceur global is detected, declarative modules are transformed by Traceur
@@ -55,7 +55,7 @@ function logloads(loads) {
5555

5656
(function (global) {
5757
(function() {
58-
var Promise = global.Promise || require('./promise');
58+
var Promise = global.Promise || require('es6-promise').Promise;
5959

6060
var traceur;
6161

@@ -76,7 +76,7 @@ function logloads(loads) {
7676
console.assert = console.assert || function() {};
7777

7878
// Define an IE-friendly shim good-enough for purposes
79-
var indexOf = Array.prototype.indexOf || function(item) {
79+
var indexOf = Array.prototype.indexOf || function(item) {
8080
for (var i = 0, thisLen = this.length; i < thisLen; i++) {
8181
if (this[i] === item) {
8282
return i;
@@ -139,7 +139,7 @@ function logloads(loads) {
139139
);
140140
}
141141
function proceedToFetch(loader, load, p) {
142-
proceedToTranslate(loader, load,
142+
proceedToTranslate(loader, load,
143143
p
144144
// CallFetch
145145
.then(function(address) {
@@ -407,7 +407,7 @@ function logloads(loads) {
407407
// dynamic modules are evaluated during linking
408408
if (module.module)
409409
return module.module;
410-
410+
411411
// ensure all dependencies are evaluated first
412412
for (var m in module.dependencies) {
413413
var depName = module.dependencies[m];
@@ -505,7 +505,7 @@ function logloads(loads) {
505505
module: module
506506
};
507507
}
508-
508+
509509
load.status = 'linked';
510510
finishLoad(loader, load);
511511
}
@@ -722,7 +722,7 @@ function logloads(loads) {
722722
eval('var __moduleName = "' + (__moduleName || '').replace('"', '\"') + '"; with(global) { (function() { ' + __source + ' \n }).call(global); }');
723723
}
724724
catch(e) {
725-
if (e.name == 'SyntaxError')
725+
if (e.name == 'SyntaxError')
726726
e.message = 'Evaluating ' + (__sourceURL || __moduleName) + '\n\t' + e.message;
727727
throw e;
728728
}
@@ -745,7 +745,7 @@ function logloads(loads) {
745745
(function (global) {
746746
var isBrowser = typeof window != 'undefined';
747747
var Loader = global.Reflect && global.Reflect.Loader || require('./loader');
748-
var Promise = global.Promise || require('./promise');
748+
var Promise = global.Promise || require('es6-promise').Promise;
749749

750750
// Helpers
751751
// Absolute URL parsing, from https://gist.github.com/Yaffle/1088850
@@ -950,7 +950,7 @@ function logloads(loads) {
950950

951951
if (global.System && global.traceur)
952952
global.traceurSystem = global.System;
953-
953+
954954
global.System = System;
955955

956956
// <script type="module"> support

dist/es6-module-loader-sans-promises.min.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.

0 commit comments

Comments
 (0)