diff --git a/index.js b/index.js index 88471a48..e89dc3d7 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ const path = require('path'); const getBabelOptions = require('./lib/get-babel-options'); const findApp = require('./lib/find-app'); const emberPlugins = require('./lib/ember-plugins'); +const cacheKeyForTree = require('calculate-cache-key-for-tree'); const APP_BABEL_RUNTIME_VERSION = new WeakMap(); const PROJECTS_WITH_VALID_EMBER_CLI = new WeakSet(); @@ -273,6 +274,17 @@ module.exports = { return polyfillTree; }, + cacheKeyForTree(treeType) { + if (treeType === 'addon') { + let isRootBabel = this.parent === this.project; + let shouldIncludeHelpers = isRootBabel && _shouldIncludeHelpers(this._getAppOptions(), this); + + return cacheKeyForTree('addon', this, [shouldIncludeHelpers]); + } + + return cacheKeyForTree(treeType, this); + }, + included: function(app) { this._super.included.apply(this, arguments); this.app = app; diff --git a/package.json b/package.json index dbd1f381..4d6eeeec 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "broccoli-debug": "^0.6.4", "broccoli-funnel": "^2.0.2", "broccoli-source": "^2.1.2", + "calculate-cache-key-for-tree": "^2.0.0", "clone": "^2.1.2", "ember-cli-babel-plugin-helpers": "^1.1.1", "ember-cli-version-checker": "^4.1.0", diff --git a/yarn.lock b/yarn.lock index 25a3ae41..e01b567d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2860,6 +2860,13 @@ calculate-cache-key-for-tree@^1.0.0: dependencies: json-stable-stringify "^1.0.1" +calculate-cache-key-for-tree@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/calculate-cache-key-for-tree/-/calculate-cache-key-for-tree-2.0.0.tgz#7ac57f149a4188eacb0a45b210689215d3fef8d6" + integrity sha512-Quw8a6y8CPmRd6eU+mwypktYCwUcf8yVFIRbNZ6tPQEckX9yd+EBVEPC/GSZZrMWH9e7Vz4pT7XhpmyApRByLQ== + dependencies: + json-stable-stringify "^1.0.1" + call-bind@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"