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

Support "cache" from @glimmer/tracking #1088

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/compat/src/compat-adapters/@glimmer/tracking.ts
Expand Up @@ -20,7 +20,7 @@ class RedirectToEmber extends Plugin {
outputFileSync(join(this.outputPath, 'index.js'), `export { tracked } from '@ember/-internals/metal';`);
outputFileSync(
join(this.outputPath, 'primitives', 'cache.js'),
`export { createCache, getValue, isConst } from "@ember/-internals/metal";`
`export { cached, createCache, getValue, isConst } from "@ember/-internals/metal";`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ef4 does this need to be in a macroCondition somehow? (exports have to be top-level don't they?) since pre ember-source-4.1, this cached export doesn't exist?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can write this in a way that isn't a SyntaxError even when cached is not exported by ember metal:

import * as metal from "@ember/-internals/metal";
const { cached, createCache, getValue, isConst } = metal;
export { cached, createCache, getValue, isConst };

It means our module always exports the name cached, but on older ember its value will be undefined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will that work pre 3.27? I know some modules weren't allowing import *
I mean, I guess I'll find out!

);
this.didBuild = true;
}
Expand Down