Skip to content

Commit

Permalink
Fix @cached decorator export from fake @glimmer/tracking module
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Feb 19, 2022
1 parent 9422ba8 commit 7a944f7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/compat/src/compat-adapters/@glimmer/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ class RedirectToEmber extends Plugin {
build() {
if (!this.didBuild) {
copyFileSync(join(this.inputPaths[0], 'package.json'), join(this.outputPath, 'package.json'));
outputFileSync(join(this.outputPath, 'index.js'), `export { tracked } from '@ember/-internals/metal';`);
outputFileSync(
join(this.outputPath, 'primitives', 'cache.js'),
join(this.outputPath, 'index.js'),
// Prior to ember-source 4.1, cached didn't exist
// using this way of importing from metal, cached will be undefined if pre 4.1
`import * as metal from "@ember/-internals/metal";
const { cached, createCache, getValue, isConst } = metal;
export { cached, createCache, getValue, isConst };
`
const { cached, tracked } = metal;
export { cached, tracked };`
);
outputFileSync(
join(this.outputPath, 'primitives', 'cache.js'),
`export { createCache, getValue, isConst } as metal from "@ember/-internals/metal";`
);
this.didBuild = true;
}
Expand Down

0 comments on commit 7a944f7

Please sign in to comment.