-
-
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.
1. Gather all files 2. Transpile to ES5 3. Debug macros + strip and prep for production 4. Gather files into bundles 5. Transform AMD and concat files This flow ended up making the most sense to me given that we _must_ do the AMD transform last. It keeps most major operations at a per-file level, and saves the file-divying and concatting for last.
- Loading branch information
Showing
16 changed files
with
248 additions
and
457 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
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,43 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const FEATURES = require('./features'); | ||
|
||
module.exports = function debugMacros(tree, environment) { | ||
let isDebug = environment !== 'production'; | ||
|
||
let plugins = [ | ||
[ | ||
'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 | ||
), | ||
}, | ||
], | ||
}, | ||
], | ||
]; | ||
|
||
return new Babel(tree, { plugins }); | ||
}; |
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 was deleted.
Oops, something went wrong.
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,24 +1,32 @@ | ||
'use strict'; | ||
|
||
const toES = require('./to-es'); | ||
const Babel = require('broccoli-babel-transpiler'); | ||
const injectBabelHelpers = require('./transforms/inject-babel-helpers'); | ||
|
||
module.exports = function toES5(tree, _options) { | ||
return toES( | ||
tree, | ||
[ | ||
['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'], | ||
], | ||
_options | ||
); | ||
module.exports = function toES6(tree, _options) { | ||
let options = Object.assign({}, _options); | ||
|
||
options.sourceMap = true; | ||
options.plugins = [ | ||
injectBabelHelpers, | ||
['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'], | ||
]; | ||
|
||
if (options.inlineHelpers) { | ||
options.plugins.shift(); | ||
delete options.inlineHelpers; | ||
} | ||
|
||
return new Babel(tree, options); | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.