-
-
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 lts] Compile Ember dynamically in consuming applications
This PR sets up Ember to do a two phase build: * **Phase 1, prepublish:** Run Typescript and Rollup on the main Ember packages, and strip out canary-features. Publish these packages, along with the dependencies for Ember, in the `dist/` folder. * **Phase 2, in addon:** Run Babel transpilation using the consumer's `ember-cli-babel` and Babel configuration on the dist packages and dependencies, and bundle up the final `ember.js` file to serve to apps. This also includes `debug` flags and, in theory, svelting. Two major changes that will occur because of this: 1. We will no longer be distributing `ember.prod.js`, `ember.debug.js`, `ember.min.js`, or `ember-testing.js`. These files existing may be something that people rely on, and the packages that _are_ distributed aren't quite ready to build in a "normal" way, using webpack or another bundler. 2. We will no longer be _building_ `ember.prod.js`, `ember.min.js`, or `ember.debug.js` at all, only a single `ember.js` file. We no longer need separate builds, because the environment settings of the build will handle the differences for us. We _are_ continuing to distribute a pre-built version of the `ember.js` and `ember-testing.js` files. These are used only in the case where the build targets match the default development build targets for Ember apps, providing a small optimization for users' dev workflow. Unfortunately, until we disentangle `ember-cli` from the implementation details of `ember-source` we cannot convert Ember to _build_ like a normal addon locally. Using the `EmberAddon` class blows up in many small ways.
- Loading branch information
Chris Garrett
committed
Aug 2, 2019
1 parent
a1b5a6b
commit de69708
Showing
34 changed files
with
528 additions
and
680 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 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const FEATURES = require('./features'); | ||
|
||
module.exports = function canaryFeatures(tree) { | ||
let plugins = [ | ||
[ | ||
'debug-macros', | ||
{ | ||
flags: [ | ||
{ | ||
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 | ||
), | ||
}, | ||
], | ||
}, | ||
'debug-macros:canary-flags', | ||
], | ||
]; | ||
|
||
return new Babel(tree, { plugins }); | ||
}; |
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,43 +1,12 @@ | ||
'use strict'; | ||
|
||
const Babel = require('broccoli-babel-transpiler'); | ||
const FEATURES = require('./features'); | ||
const buildDebugMacroPlugin = require('../lib/build-debug-macro-plugin'); | ||
|
||
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 | ||
), | ||
}, | ||
], | ||
}, | ||
], | ||
]; | ||
let plugins = [buildDebugMacroPlugin(isDebug)]; | ||
|
||
return new Babel(tree, { plugins }); | ||
}; |
Oops, something went wrong.