Skip to content

Commit

Permalink
implement ember module plugin deprecation for new 3.26-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Feb 22, 2021
1 parent 8135847 commit 21731b2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/ember-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ function _getEmberModulesAPIPolyfill(appRoot, config) {

if (_emberVersionRequiresModulesAPIPolyfill()) {
const ignore = _getEmberModulesAPIIgnore(appRoot, config);
const useEmberModule = _shouldDeprecateGlobalEmber(appRoot);

return [
[require.resolve("babel-plugin-ember-modules-api-polyfill"), { ignore }],
[
require.resolve("babel-plugin-ember-modules-api-polyfill"),
{ ignore, useEmberModule },
],
];
}
}
Expand All @@ -80,6 +84,16 @@ function _shouldIgnoreJQuery(appRoot) {
return pkg && semver.gt(pkg.version, "0.6.0");
}

function _shouldDeprecateGlobalEmber(appRoot) {
let packagePath = resolvePackagePath("ember-source", appRoot);
if (packagePath === null) {
return false;
}

let pkg = require(packagePath);
return pkg && semver.get(pkg.version, "3.26.0-beta.1");
}

function _emberDataVersionRequiresPackagesPolyfill(appRoot) {
let packagePath = resolvePackagePath("ember-data", appRoot);
if (packagePath === null) {
Expand Down Expand Up @@ -128,7 +142,7 @@ function _getEmberDataPackagesPolyfill(appRoot, config) {
function _getModuleResolutionPlugins(config) {
if (!config.disableModuleResolution) {
const resolvePath = require("../lib/relative-module-paths")
.resolveRelativeModulePath;
.resolveRelativeModulePath;
return [
[require.resolve("babel-plugin-module-resolver"), { resolvePath }],
[
Expand Down

0 comments on commit 21731b2

Please sign in to comment.