Skip to content

Commit

Permalink
Try to get ember booting
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Oct 26, 2023
1 parent 8baa2e7 commit d1544ee
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
38 changes: 23 additions & 15 deletions lib/ember-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ function _getEmberDataPackagesPolyfill(appRoot, config) {

function _getModuleResolutionPlugins(config) {
if (!config.disableModuleResolution) {
const resolvePath = require("../lib/relative-module-paths")
.resolveRelativeModulePath;
const resolvePath =
require("../lib/relative-module-paths").resolveRelativeModulePath;
return [
[require.resolve("babel-plugin-module-resolver"), { resolvePath }],
[
Expand All @@ -162,16 +162,16 @@ function _getModuleResolutionPlugins(config) {
function _getProposalDecoratorsAndClassPlugins(config) {
if (!config.shouldIgnoreDecoratorAndClassPlugins) {
return [
/**
* Required for apps to use `@ember/template-compliation`
* for transforming templates from babel-plugin-ember-template-compilation
* which shipped in ember-cli-htmlbars 6.2
*
* Normally this plugin wouldn't be required because the feature has shipped
* in all browsers, but because we have legacy decorators, and
* legacy decorators do not support parsing the static block syntax,
* we need to compile it away.
*/
/**
* Required for apps to use `@ember/template-compliation`
* for transforming templates from babel-plugin-ember-template-compilation
* which shipped in ember-cli-htmlbars 6.2
*
* Normally this plugin wouldn't be required because the feature has shipped
* in all browsers, but because we have legacy decorators, and
* legacy decorators do not support parsing the static block syntax,
* we need to compile it away.
*/
["@babel/plugin-transform-class-static-block"],
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties"],
Expand All @@ -180,9 +180,15 @@ function _getProposalDecoratorsAndClassPlugins(config) {
}

function _getImportMetaEnv(config) {

Check failure on line 182 in lib/ember-plugins.js

View workflow job for this annotation

GitHub Actions / Lint

'config' is defined but never used
const isProduction = process.env.EMBER_ENV === "production";
const isDebug = !isProduction;

return [
["module:@import-meta-env/babel", { env: { DEV: isDebug, PROD: !isDebug }}],
]
[
"module:@import-meta-env/babel",
{ env: { DEV: isDebug, PROD: isProduction } },
],
];
}

/**
Expand All @@ -204,6 +210,7 @@ function _getImportMetaEnv(config) {
module.exports = function (appRoot, config = {}) {
return []
.concat(
_getImportMetaEnv(config),
_getProposalDecoratorsAndClassPlugins(config),
_getDebugMacroPlugins(appRoot),
_getEmberModulesAPIPolyfill(appRoot, config),
Expand All @@ -217,4 +224,5 @@ module.exports.getDebugMacroPlugins = _getDebugMacroPlugins;
module.exports.getEmberModulesAPIPolyfill = _getEmberModulesAPIPolyfill;
module.exports.getEmberDataPackagesPolyfill = _getEmberDataPackagesPolyfill;
module.exports.getModuleResolutionPlugins = _getModuleResolutionPlugins;
module.exports.getProposalDecoratorsAndClassPlugins = _getProposalDecoratorsAndClassPlugins;
module.exports.getProposalDecoratorsAndClassPlugins =
_getProposalDecoratorsAndClassPlugins;
3 changes: 2 additions & 1 deletion lib/get-babel-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ module.exports = function getBabelOptions(config, appInstance) {
);
}

userPlugins = _addImportMetaEnv(userPlugins.slice(), parent, project),

options.plugins = []
.concat(
shouldIncludeHelpers && _getHelpersPlugin(project),
userPlugins,
_addImportMetaEnv(userPlugins.slice(), parent, project),
_getDebugMacroPlugins(config, project),
_getEmberModulesAPIPolyfill(config, parent, project),
_getEmberDataPackagesPolyfill(config, parent),
Expand Down

0 comments on commit d1544ee

Please sign in to comment.