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

Commit c9b3c2e

Browse files
committed
Merge pull request #346 from ModuleLoader/0.17
0.17 wip
2 parents 3cbb146 + 6524a6d commit c9b3c2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1007
-1817
lines changed

.agignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

Gruntfile.js

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,30 @@ module.exports = function (grunt) {
2121
dist: {
2222
files: {
2323
'dist/<%= pkg.name %>.src.js': [
24-
'node_modules/when/es6-shim/Promise.js',
25-
'src/polyfill-wrapper-start.js',
26-
'dist/<%= pkg.name %>.js',
27-
'src/polyfill-wrapper-end.js'
24+
'src/wrapper-start.js',
25+
'src/loader.js',
26+
'src/dynamic-only.js',
27+
'src/url-polyfill.js',
28+
'src/system.js',
29+
'src/system-resolve.js',
30+
'src/system-fetch.js',
31+
'src/wrapper-end.js'
2832
],
29-
'dist/<%= pkg.name %>-sans-promises.src.js': [
30-
'src/polyfill-wrapper-start.js',
31-
'dist/<%= pkg.name %>.js',
32-
'src/polyfill-wrapper-end.js'
33+
'dist/<%= pkg.name %>-dev.src.js': [
34+
'src/wrapper-start.js',
35+
'src/loader.js',
36+
'src/declarative.js',
37+
'src/transpiler.js',
38+
'src/url-polyfill.js',
39+
'src/system.js',
40+
'src/system-resolve.js',
41+
'src/system-fetch.js',
42+
'src/module-tag.js',
43+
'src/wrapper-end.js'
3344
]
3445
}
3546
}
3647
},
37-
esnext: {
38-
dist: {
39-
src: [
40-
'src/loader.js',
41-
'src/transpiler.js',
42-
'src/system.js'
43-
],
44-
dest: 'dist/<%= pkg.name %>.js'
45-
}
46-
},
47-
'string-replace': {
48-
dist: {
49-
files: {
50-
'dist/<%= pkg.name %>.js': 'dist/<%= pkg.name %>.js'
51-
},
52-
options: {
53-
replacements:[{
54-
pattern: 'var $__Object$getPrototypeOf = Object.getPrototypeOf;\n' +
55-
'var $__Object$defineProperty = Object.defineProperty;\n' +
56-
'var $__Object$create = Object.create;',
57-
replacement: ''
58-
}, {
59-
pattern: '$__Object$getPrototypeOf(SystemLoader.prototype).constructor',
60-
replacement: '$__super'
61-
}]
62-
}
63-
}
64-
},
6548
uglify: {
6649
options: {
6750
banner: '<%= meta.banner %>\n',
@@ -77,21 +60,21 @@ module.exports = function (grunt) {
7760
src: 'dist/<%= pkg.name %>.src.js',
7861
dest: 'dist/<%= pkg.name %>.js'
7962
},
80-
distSansPromises: {
81-
src: 'dist/<%= pkg.name %>-sans-promises.src.js',
82-
dest: 'dist/<%= pkg.name %>-sans-promises.js'
63+
devDist: {
64+
options: {
65+
banner: '<%= meta.banner %>\n'
66+
},
67+
src: 'dist/<%= pkg.name %>-dev.src.js',
68+
dest: 'dist/<%= pkg.name %>-dev.js'
8369
}
8470
}
8571
});
8672

8773
grunt.loadNpmTasks('grunt-contrib-jshint');
8874
grunt.loadNpmTasks('grunt-contrib-uglify');
89-
grunt.loadNpmTasks('grunt-esnext');
9075
grunt.loadNpmTasks('grunt-contrib-concat');
91-
grunt.loadNpmTasks('grunt-string-replace');
9276

9377
grunt.registerTask('lint', ['jshint']);
94-
grunt.registerTask('compile', ['esnext', 'string-replace', 'concat']);
95-
grunt.registerTask('default', [/*'jshint', */'esnext', 'string-replace',
96-
'concat', 'uglify']);
78+
grunt.registerTask('compile', ['concat']);
79+
grunt.registerTask('default', [/*'jshint', */'concat', 'uglify']);
9780
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _For upgrading to ES6 Module Loader 0.16, [read the release notes here](https://
44

55
Dynamically loads ES6 modules in browsers and [NodeJS](#nodejs-use) with support for loading existing and custom module formats through loader hooks.
66

7-
This project implements dynamic module loading through `System` exactly to the previous ES6-specified loader API at [2014-08-24 ES6 Specification Draft Rev 27, Section 15](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#august_24_2014_draft_rev_27) and is being converted to track the newly redrafted specification at https://github.com/whatwg/loader (work in progress at https://github.com/ModuleLoader/es6-module-loader/tree/1.0).
7+
This project implements dynamic module loading through `System` exactly to the previous ES6-specified loader API at [2014-08-24 ES6 Specification Draft Rev 27, Section 15](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#august_24_2014_draft_rev_27). The new loader implementing the [WhatWG loader spec](https://github.com/whatwg/loader) is pending alpha release on the [1.0 branch](https://github.com/ModuleLoader/es6-module-loader/tree/1.0).
88

99
* Provides an asynchronous loader (`System.import`) to [dynamically load ES6 modules](#getting-started).
1010
* Supports both [Traceur](https://github.com/google/traceur-compiler) and [Babel](http://babeljs.io/) for compiling ES6 modules and syntax into ES5 in the browser with source map support.

index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
var System = require('./dist/es6-module-loader.src');
1+
if (typeof Promise === 'undefined')
2+
require('when/es6-shim/Promise');
3+
4+
var System = require('./dist/es6-module-loader-dev.src');
5+
6+
var filePrefix = 'file:' + (process.platform.match(/^win/) ? '/' : '') + '//';
27

3-
System.transpiler = 'traceur';
48
try {
5-
System.paths.traceur = 'file:' + require.resolve('traceur/bin/traceur.js');
9+
System.paths.traceur = filePrefix + require.resolve('traceur/bin/traceur.js');
610
}
711
catch(e) {}
812
try {
9-
System.paths.babel = 'file:' + require.resolve('babel-core/browser.js');
13+
System.paths.babel = filePrefix + require.resolve('babel-core/browser.js');
1014
}
1115
catch(e) {}
1216
try {
13-
System.paths.babel = System.paths.babel || 'file:' + require.resolve('babel/browser.js');
17+
System.paths.babel = System.paths.babel || filePrefix + require.resolve('babel/browser.js');
1418
}
1519
catch(e) {}
1620

karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ module.exports = function(config) {
3939

4040
[!options.ie8 ? (!options['babel'] ? 'node_modules/traceur/bin/traceur.js' : 'node_modules/babel-core/browser.js') : ''],
4141

42-
'dist/es6-module-loader' + (options.polyfill ? '' : '-sans-promises') + '.src.js',
42+
[options.polyfill ? 'node_modules/when/es6-shim/Promise' : ''],
43+
'dist/es6-module-loader-dev.src.js',
4344

4445
'test/_browser.js',
4546
'test/browser-script-type-module.js',

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
"grunt-contrib-concat": "^0.5.0",
3030
"grunt-contrib-jshint": "~0.6.0",
3131
"grunt-contrib-uglify": "~0.6.0",
32-
"grunt-esnext": "0.0.3",
33-
"grunt-string-replace": "^0.2.7",
3432
"karma": "^0.12.28",
3533
"karma-benchmark": "^0.4.0",
3634
"karma-benchmark-reporter": "^0.1.1",

0 commit comments

Comments
 (0)