Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix @cached decorator export from fake @glimmer/tracking module #1135

Merged
merged 3 commits into from
Feb 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix @cached decorator export from fake @glimmer/tracking module
NullVoxPopuli committed Feb 26, 2022

Verified

This commit was signed with the committer’s verified signature.
reneme René Meusel
commit b831897583f42706356dca23f97baf71a5803d34
12 changes: 7 additions & 5 deletions packages/compat/src/compat-adapters/@glimmer/tracking.ts
Original file line number Diff line number Diff line change
@@ -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 } from "@ember/-internals/metal";`
);
this.didBuild = true;
}