Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brendenpalmer committed Apr 27, 2021
1 parent 69ded96 commit 12aa427
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/babel-options-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,26 @@ function _shouldIncludeDecoratorPlugins(config) {
return customOptions.disableDecoratorTransforms !== true;
}

/**
* 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"] || {};

Expand All @@ -422,6 +442,8 @@ function _shouldHandleTypeScript(config, parent, project) {

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 {
Expand Down

0 comments on commit 12aa427

Please sign in to comment.