-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX][FEAT] Adds a second dist build which targets IE
This PR adds a second dist to the build which targets IE. This allows the primary bundles to drop ES5 compilation from babel, and allows us to choose which bundles we want to use based on the consuming application's targets. In the long run, we want to actually enable consuming apps to build the Ember source code themselves. This is a temporary in-between measure to address a bug in native classes, in which users who do _not_ have IE as a build target cannot `.extend` from native classes due to conflicts in transpilation vs actual native class syntax.
- Loading branch information
Showing
11 changed files
with
295 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const stripClassCallCheck = require('./transforms/strip-class-call-check'); | ||
|
||
module.exports = function stripForProd(tree) { | ||
let options = { | ||
plugins: [ | ||
[stripClassCallCheck, { source: 'ember-babel' }], | ||
['minify-dead-code-elimination', { optimizeRawSize: true }], | ||
], | ||
}; | ||
|
||
return new Babel(tree, options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const injectBabelHelpers = require('./transforms/inject-babel-helpers'); | ||
const injectNodeGlobals = require('./transforms/inject-node-globals'); | ||
const enifed = require('./transforms/transform-define'); | ||
const FEATURES = require('./features'); | ||
const resolveModuleSource = require('amd-name-resolver').moduleResolve; | ||
|
||
module.exports = function toES5(tree, babelPlugins, _options) { | ||
let options = Object.assign( | ||
{ | ||
environment: 'development', | ||
}, | ||
_options | ||
); | ||
|
||
let isDebug = options.environment !== 'production'; | ||
|
||
options.moduleIds = true; | ||
options.resolveModuleSource = resolveModuleSource; | ||
options.sourceMap = true; | ||
options.plugins = [ | ||
injectBabelHelpers, | ||
[ | ||
'debug-macros', | ||
{ | ||
debugTools: { | ||
source: '@ember/debug', | ||
assertPredicateIndex: 1, | ||
isDebug, | ||
}, | ||
externalizeHelpers: { | ||
module: true, | ||
}, | ||
flags: [ | ||
{ source: '@glimmer/env', flags: { DEBUG: isDebug } }, | ||
{ | ||
source: '@ember/canary-features', | ||
flags: Object.assign( | ||
// explicit list of additional exports within @ember/canary-features | ||
// without adding this (with a null value) an error is thrown during | ||
// the feature replacement process (e.g. XYZ is not a supported flag) | ||
{ | ||
FEATURES: null, | ||
DEFAULT_FEATURES: null, | ||
isEnabled: null, | ||
}, | ||
FEATURES | ||
), | ||
}, | ||
], | ||
}, | ||
], | ||
...babelPlugins, | ||
injectNodeGlobals, | ||
['transform-es2015-modules-amd', { noInterop: true, strict: true }], | ||
enifed, | ||
]; | ||
|
||
if (options.transformDefine) { | ||
options.plugins = [enifed]; | ||
delete options.transformDefine; | ||
} | ||
|
||
if (options.transformModules === false) { | ||
options.plugins.pop(); | ||
options.plugins.pop(); | ||
delete options.moduleIds; | ||
delete options.resolveModuleSource; | ||
delete options.transformModules; | ||
} | ||
|
||
if (options.inlineHelpers) { | ||
options.plugins.shift(); | ||
delete options.inlineHelpers; | ||
} | ||
|
||
delete options.environment; | ||
|
||
return new Babel(tree, options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,24 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const injectBabelHelpers = require('./transforms/inject-babel-helpers'); | ||
const injectNodeGlobals = require('./transforms/inject-node-globals'); | ||
const enifed = require('./transforms/transform-define'); | ||
const FEATURES = require('./features'); | ||
const stripClassCallCheck = require('./transforms/strip-class-call-check'); | ||
const resolveModuleSource = require('amd-name-resolver').moduleResolve; | ||
const toES = require('./to-es'); | ||
|
||
module.exports = function toES5(tree, _options) { | ||
let options = Object.assign( | ||
{ | ||
environment: 'developement', | ||
}, | ||
_options | ||
); | ||
|
||
let isDebug = options.environment !== 'production'; | ||
|
||
options.moduleIds = true; | ||
options.resolveModuleSource = resolveModuleSource; | ||
options.sourceMap = true; | ||
options.plugins = [ | ||
injectBabelHelpers, | ||
return toES( | ||
tree, | ||
[ | ||
'debug-macros', | ||
{ | ||
debugTools: { | ||
source: '@ember/debug', | ||
assertPredicateIndex: 1, | ||
isDebug, | ||
}, | ||
externalizeHelpers: { | ||
module: true, | ||
}, | ||
flags: [ | ||
{ source: '@glimmer/env', flags: { DEBUG: isDebug } }, | ||
{ | ||
source: '@ember/canary-features', | ||
flags: Object.assign( | ||
// explicit list of additional exports within @ember/canary-features | ||
// without adding this (with a null value) an error is thrown during | ||
// the feature replacement process (e.g. XYZ is not a supported flag) | ||
{ | ||
FEATURES: null, | ||
DEFAULT_FEATURES: null, | ||
isEnabled: null, | ||
}, | ||
FEATURES | ||
), | ||
}, | ||
], | ||
}, | ||
['transform-es2015-template-literals', { loose: true }], | ||
['transform-es2015-literals'], | ||
['transform-es2015-arrow-functions'], | ||
['transform-es2015-destructuring', { loose: true }], | ||
['transform-es2015-spread', { loose: true }], | ||
['transform-es2015-parameters'], | ||
['transform-es2015-computed-properties', { loose: true }], | ||
['transform-es2015-shorthand-properties'], | ||
['transform-es2015-block-scoping', { throwIfClosureRequired: true }], | ||
['check-es2015-constants'], | ||
['transform-es2015-classes', { loose: true }], | ||
['transform-object-assign'], | ||
], | ||
['transform-es2015-template-literals', { loose: true }], | ||
['transform-es2015-literals'], | ||
['transform-es2015-arrow-functions'], | ||
['transform-es2015-destructuring', { loose: true }], | ||
['transform-es2015-spread', { loose: true }], | ||
['transform-es2015-parameters'], | ||
['transform-es2015-computed-properties', { loose: true }], | ||
['transform-es2015-shorthand-properties'], | ||
['transform-es2015-block-scoping', { throwIfClosureRequired: true }], | ||
['check-es2015-constants'], | ||
['transform-es2015-classes', { loose: true }], | ||
['transform-object-assign'], | ||
injectNodeGlobals, | ||
['transform-es2015-modules-amd', { noInterop: true, strict: true }], | ||
enifed, | ||
]; | ||
|
||
if (options.transformDefine) { | ||
options.plugins = [enifed]; | ||
delete options.transformDefine; | ||
} | ||
|
||
if (options.transformModules === false) { | ||
options.plugins.pop(); | ||
options.plugins.pop(); | ||
delete options.moduleIds; | ||
delete options.resolveModuleSource; | ||
delete options.transformModules; | ||
} | ||
|
||
if (options.inlineHelpers) { | ||
options.plugins.shift(); | ||
delete options.inlineHelpers; | ||
} | ||
|
||
delete options.environment; | ||
|
||
return new Babel(tree, options); | ||
_options | ||
); | ||
}; | ||
|
||
function stripForProd(tree) { | ||
let options = { | ||
plugins: [ | ||
[stripClassCallCheck, { source: 'ember-babel' }], | ||
['minify-dead-code-elimination', { optimizeRawSize: true }], | ||
], | ||
}; | ||
|
||
return new Babel(tree, options); | ||
} | ||
|
||
module.exports.stripForProd = stripForProd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
const toES = require('./to-es'); | ||
|
||
module.exports = function toES5(tree, _options) { | ||
return toES(tree, [], _options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": "3.6.0-bugfix-ie-dual-build+0bbf1ce3", | ||
"buildType": "bugfix-ie-dual-build", | ||
"SHA": "0bbf1ce363324a1e40c67c0a32676ffe32ea9a39", | ||
"assetPath": "/bugfix-ie-dual-build/shas/0bbf1ce363324a1e40c67c0a32676ffe32ea9a39.tgz" | ||
} |
Oops, something went wrong.