-
-
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.
Refactor the internal Ember loader to use the standard Ember CLI loader
This PR refactors the internal Ember loader so that it uses the standard Ember CLI loader instead for modules. This means that modules will be defined in the main namespace, and importable from there, instead of in a hidden namespace that only Ember can use. Notes: - Code is still loaded and built via `treeForVendor` and included as a vendor file. This needs to be the case for the time being for bootstrapping. - Loader code is still included for Node support. If `define` and `require` are not already defined, then a backup shim is used instead. - Modules are now exposed from Ember, but `ember-cli-babel` still transpiles them to global references. This unblocks us from being able to make all modules work normally, however. - `require` shim module is no longer defined, we reference `define` and `require` as globals instead (which is more accurate). In the future we should update this to use Embroider's conventions. - `__loader` is still exposed on the Ember object, referencing the same values as before.
- Loading branch information
1 parent
df22118
commit b99fa0f
Showing
20 changed files
with
167 additions
and
203 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 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
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,30 @@ | ||
import { context } from '@ember/-internals/environment'; | ||
|
||
(function () { | ||
let Ember; | ||
|
||
function defineEmber(key) { | ||
Object.defineProperty(context.exports, key, { | ||
enumerable: true, | ||
configurable: true, | ||
get() { | ||
if (!Ember) { | ||
Ember = require('ember').default; | ||
} | ||
|
||
return Ember; | ||
}, | ||
}); | ||
} | ||
|
||
// Bootstrap the global | ||
defineEmber('Ember'); | ||
defineEmber('Em'); | ||
|
||
// Bootstrap Node module | ||
// eslint-disable-next-line no-undef | ||
if (typeof module === 'object' && typeof module.require === 'function') { | ||
// eslint-disable-next-line no-undef | ||
module.exports = Ember = require('ember').default; | ||
} | ||
})(); |
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
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,5 @@ | ||
declare module 'ember' { | ||
declare const Ember: any; | ||
|
||
export default Ember; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Ember from '../index'; | ||
import require from 'require'; | ||
import { | ||
FEATURES, | ||
EMBER_GLIMMER_HELPER_MANAGER, | ||
|
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
Oops, something went wrong.