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

Commit c7ff629

Browse files
committed
Refactor polyfills to be in a single closure
This refactors the two polyfills to share a single closure that wraps both of them and contains polyfills for a few Object.*. Implementation is that there is now a `polyfill-wrapper-start.js` which has the outer most closure, then the two polyfills (after being compiled), then `polyfill-wrapper-end.js`.
1 parent 2e79b2d commit c7ff629

File tree

7 files changed

+1135
-1135
lines changed

7 files changed

+1135
-1135
lines changed

Gruntfile.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,32 @@ module.exports = function (grunt) {
1919
'lib/system.js'
2020
]
2121
},
22-
esnext: {
22+
concat: {
2323
dist: {
2424
src: [
2525
'node_modules/when/es6-shim/Promise.js',
26-
'src/loader.js',
27-
'src/system.js'
26+
'src/polyfill-wrapper-start.js',
27+
'dist/<%= pkg.name %>.js',
28+
'src/polyfill-wrapper-end.js'
2829
],
2930
dest: 'dist/<%= pkg.name %>.js'
3031
},
3132
polyfillOnly: {
33+
src: [
34+
'src/polyfill-wrapper-start.js',
35+
'dist/<%= pkg.name %>.js',
36+
'src/polyfill-wrapper-end.js'
37+
],
38+
dest: 'dist/<%= pkg.name %>-sans-promises.js'
39+
}
40+
},
41+
esnext: {
42+
dist: {
3243
src: [
3344
'src/loader.js',
3445
'src/system.js'
3546
],
36-
dest: 'dist/<%= pkg.name %>-sans-promises.js'
47+
dest: 'dist/<%= pkg.name %>.js'
3748
}
3849
},
3950
'string-replace': {
@@ -46,7 +57,7 @@ module.exports = function (grunt) {
4657
pattern: 'var $__Object$getPrototypeOf = Object.getPrototypeOf;\n' +
4758
'var $__Object$defineProperty = Object.defineProperty;\n' +
4859
'var $__Object$create = Object.create;',
49-
replacement: "<%= grunt.file.read('src/object_polyfills.js') %>"
60+
replacement: ''
5061
}]
5162

5263
}
@@ -76,8 +87,10 @@ module.exports = function (grunt) {
7687
grunt.loadNpmTasks('grunt-contrib-jshint');
7788
grunt.loadNpmTasks('grunt-contrib-uglify');
7889
grunt.loadNpmTasks('grunt-esnext');
90+
grunt.loadNpmTasks('grunt-contrib-concat');
7991
grunt.loadNpmTasks('grunt-string-replace');
8092

8193
grunt.registerTask('lint', ['jshint']);
82-
grunt.registerTask('default', [/*'jshint', */'esnext', 'string-replace', 'uglify']);
94+
grunt.registerTask('default', [/*'jshint', */'esnext', 'string-replace',
95+
'concat', 'uglify']);
8396
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
],
2424
"devDependencies": {
2525
"grunt": "~0.4.1",
26+
"grunt-contrib-concat": "^0.5.0",
2627
"grunt-contrib-jshint": "~0.6.0",
2728
"grunt-contrib-uglify": "~0.2.2",
2829
"grunt-esnext": "0.0.3",

0 commit comments

Comments
 (0)