ember-cli-babel
Advanced tools
Comparing version 7.26.3 to 7.26.4
@@ -0,1 +1,15 @@ | ||
Version 9 of Highlight.js has reached EOL and is no longer supported. | ||
Please upgrade or ask whatever dependency you are using to upgrade. | ||
https://github.com/highlightjs/highlight.js/issues/2877 | ||
## v7.26.4 (2021-04-28) | ||
#### :bug: Bug Fix | ||
* [#394](https://github.com/babel/ember-cli-babel/pull/394) Include addon name directory in 'treeForAddon' (mitigate issues with Embroider when using external helpers) ([@charlespierce](https://github.com/charlespierce)) | ||
* [#400](https://github.com/babel/ember-cli-babel/pull/400) Update `_shouldHandleTypeScript` to read from `pkg.dependencies` instead of relying on `addons` ([@brendenpalmer](https://github.com/brendenpalmer)) | ||
#### Committers: 2 | ||
- Brenden Palmer ([@brendenpalmer](https://github.com/brendenpalmer)) | ||
- Charles Pierce ([@charlespierce](https://github.com/charlespierce)) | ||
## v7.26.3 (2021-03-26) | ||
@@ -2,0 +16,0 @@ |
12
index.js
@@ -107,3 +107,3 @@ 'use strict'; | ||
getSupportedExtensions(config = {}) { | ||
return _getExtensions(config, this.parent); | ||
return _getExtensions(config, this.parent, this.project); | ||
}, | ||
@@ -164,3 +164,3 @@ | ||
if (_shouldHandleTypeScript(config, this.parent)) { | ||
if (_shouldHandleTypeScript(config, this.parent, this.project)) { | ||
let Funnel = require('broccoli-funnel'); | ||
@@ -180,3 +180,3 @@ let inputWithoutDeclarations = new Funnel(transpilationInput, { exclude: ['**/*.d.ts'] }); | ||
name: 'ember-cli-babel', | ||
ext: _getExtensions(this._getAddonOptions(), this.parent), | ||
ext: _getExtensions(this._getAddonOptions(), this.parent, this.project), | ||
toTree: (tree) => this.transpileTree(tree) | ||
@@ -251,3 +251,3 @@ }); | ||
return this.transpileTree(babelHelpersTree, { | ||
const transpiledHelpers = this.transpileTree(babelHelpersTree, { | ||
'ember-cli-babel': { | ||
@@ -258,2 +258,6 @@ // prevents the helpers from being double transpiled, and including themselves | ||
}); | ||
return new Funnel(transpiledHelpers, { | ||
destDir: this.moduleName(), | ||
}); | ||
}, | ||
@@ -260,0 +264,0 @@ |
const VersionChecker = require("ember-cli-version-checker"); | ||
const resolvePackagePath = require("resolve-package-path"); | ||
const clone = require("clone"); | ||
@@ -267,6 +268,6 @@ const semver = require("semver"); | ||
function _buildClassFeaturePluginConstraints(constraints, config, parent) { | ||
function _buildClassFeaturePluginConstraints(constraints, config, parent, project) { | ||
// With versions of ember-cli-typescript < 4.0, class feature plugins like | ||
// @babel/plugin-proposal-class-properties were run before the TS transform. | ||
if (!_shouldHandleTypeScript(config, parent)) { | ||
if (!_shouldHandleTypeScript(config, parent, project)) { | ||
constraints.before = constraints.before || []; | ||
@@ -299,3 +300,4 @@ constraints.before.push("@babel/plugin-transform-typescript"); | ||
config, | ||
parent | ||
parent, | ||
project | ||
) | ||
@@ -325,3 +327,4 @@ ); | ||
config, | ||
parent | ||
parent, | ||
project | ||
) | ||
@@ -395,4 +398,4 @@ ); | ||
function _getExtensions(config, parent) { | ||
let shouldHandleTypeScript = _shouldHandleTypeScript(config, parent); | ||
function _getExtensions(config, parent, project) { | ||
let shouldHandleTypeScript = _shouldHandleTypeScript(config, parent, project); | ||
let emberCLIBabelConfig = config["ember-cli-babel"] || {}; | ||
@@ -411,14 +414,59 @@ return ( | ||
function _shouldHandleTypeScript(config, parent) { | ||
/** | ||
* Returns whether we should handle TypeScript (based on the existence of | ||
* `ember-cli-typescript` as a depenency). It's worth noting that we parse | ||
* the `package.json` deps/devDeps directly (rather than using `addons` on | ||
* the parent) because it's possible for `ember-cli-typescript` not to exist | ||
* on the addons array, even if it is a dependency. | ||
* | ||
* Some more context: | ||
* | ||
* `ember-cli-typescript` returns a stable cache key so its possible for it to | ||
* be deduped as part of `ember-engines`. The reason this is important is because | ||
* `ember-engines` dedupe is _stateful_ so it's possible for `ember-cli-typescript` | ||
* to not be part of the addons array when `ember-cli-babel` is running. | ||
* | ||
* For more info on `ember-engines` dedupe logic: | ||
* https://github.com/ember-engines/ember-engines/blob/master/packages/ember-engines/lib/utils/deeply-non-duplicated-addon.js#L35 | ||
* | ||
* @name _shouldHandleTypeScript | ||
* @returns {boolean} | ||
*/ | ||
function _shouldHandleTypeScript(config, parent, project) { | ||
let emberCLIBabelConfig = config["ember-cli-babel"] || {}; | ||
if (typeof emberCLIBabelConfig.enableTypeScriptTransform === "boolean") { | ||
return emberCLIBabelConfig.enableTypeScriptTransform; | ||
} | ||
let typeScriptAddon = | ||
parent.addons && | ||
parent.addons.find((a) => a.name === "ember-cli-typescript"); | ||
return ( | ||
typeof typeScriptAddon !== "undefined" && | ||
semver.gte(typeScriptAddon.pkg.version, "4.0.0-alpha.1") | ||
); | ||
let pkg = parent.pkg; | ||
if (!pkg) { | ||
return false; | ||
} | ||
let dependencies; | ||
// consider `dependencies` and `devDependencies` if the parent is the project | ||
// (`ember-cli` uses both in this case), otherwise only care about `dependencies` | ||
if (parent === project) { | ||
dependencies = Object.assign({}, pkg.dependencies, pkg.devDependencies); | ||
} else { | ||
dependencies = pkg.dependencies || {}; | ||
} | ||
let tsDependency = dependencies["ember-cli-typescript"]; | ||
if (tsDependency !== undefined) { | ||
let tsPkgPath = resolvePackagePath("ember-cli-typescript", parent.root); | ||
if (tsPkgPath === null) { | ||
return false; | ||
} | ||
let tsPkg = require(tsPkgPath); | ||
return semver.gte(tsPkg.version, "4.0.0-alpha.1"); | ||
} | ||
return false; | ||
} | ||
@@ -425,0 +473,0 @@ |
@@ -21,3 +21,3 @@ const { | ||
let shouldIncludeHelpers = _shouldIncludeHelpers(config, appInstance); | ||
let shouldHandleTypeScript = _shouldHandleTypeScript(config, parent); | ||
let shouldHandleTypeScript = _shouldHandleTypeScript(config, parent, project); | ||
let shouldIncludeDecoratorPlugins = _shouldIncludeDecoratorPlugins(config); | ||
@@ -24,0 +24,0 @@ |
{ | ||
"name": "ember-cli-babel", | ||
"version": "7.26.3", | ||
"version": "7.26.4", | ||
"description": "Ember CLI addon for Babel", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
106312
1058
11