Skip to content

Commit

Permalink
Merge pull request #421 from RuslanZavacky/tree-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Dec 15, 2021
2 parents 23ede75 + 84b72c7 commit 1b8ddfa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3662,6 +3662,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"
Expand Down

0 comments on commit 1b8ddfa

Please sign in to comment.