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

Commit 2e79b2d

Browse files
committed
Bring IE8 support to SystemLoader
This updates with all of the changes recommended. To summarize: * Using a string-replace grunt plugin to insert polyfills where needed for the various Object.* methods being used by esnext. Verified to work in IE9 (don't have an IE8 VM on this machine). * Constructor now calls `super(options || {})` * Removed unnecessary `System.constructor =` assignment * Replaced tests and Node references to use `dist/es6-module-loader.js` * instead. Part of #209
1 parent 858c4a5 commit 2e79b2d

File tree

10 files changed

+63
-1477
lines changed

10 files changed

+63
-1477
lines changed

Gruntfile.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
23
module.exports = function (grunt) {
34
grunt.initConfig({
45
pkg: grunt.file.readJSON('package.json'),
@@ -22,27 +23,35 @@ module.exports = function (grunt) {
2223
dist: {
2324
src: [
2425
'node_modules/when/es6-shim/Promise.js',
25-
'lib/loader.js',
26-
'lib/system.js'
26+
'src/loader.js',
27+
'src/system.js'
2728
],
2829
dest: 'dist/<%= pkg.name %>.js'
2930
},
30-
loader: {
31-
src: [ 'lib/loader.js' ],
32-
dest: 'dist/loader.js'
33-
},
34-
system: {
35-
src: [ 'lib/system.js' ],
36-
dest: 'dist/system.js'
37-
},
3831
polyfillOnly: {
3932
src: [
40-
'lib/loader.js',
41-
'lib/system.js'
33+
'src/loader.js',
34+
'src/system.js'
4235
],
4336
dest: 'dist/<%= pkg.name %>-sans-promises.js'
4437
}
4538
},
39+
'string-replace': {
40+
dist: {
41+
files: {
42+
'dist/<%= pkg.name %>.js': 'dist/<%= pkg.name %>.js'
43+
},
44+
options: {
45+
replacements:[{
46+
pattern: 'var $__Object$getPrototypeOf = Object.getPrototypeOf;\n' +
47+
'var $__Object$defineProperty = Object.defineProperty;\n' +
48+
'var $__Object$create = Object.create;',
49+
replacement: "<%= grunt.file.read('src/object_polyfills.js') %>"
50+
}]
51+
52+
}
53+
}
54+
},
4655
uglify: {
4756
options: {
4857
banner: '<%= meta.banner %>\n',
@@ -67,7 +76,8 @@ module.exports = function (grunt) {
6776
grunt.loadNpmTasks('grunt-contrib-jshint');
6877
grunt.loadNpmTasks('grunt-contrib-uglify');
6978
grunt.loadNpmTasks('grunt-esnext');
79+
grunt.loadNpmTasks('grunt-string-replace');
7080

7181
grunt.registerTask('lint', ['jshint']);
72-
grunt.registerTask('default', [/*'jshint', */'esnext', 'uglify']);
82+
grunt.registerTask('default', [/*'jshint', */'esnext', 'string-replace', 'uglify']);
7383
};

0 commit comments

Comments
 (0)