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

Conversation

NullVoxPopuli
Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli commented Jan 24, 2022

@NullVoxPopuli NullVoxPopuli changed the title Resolve: https://github.com/embroider-build/embroider/issues/1086#iss… Resolve: https://github.com/embroider-build/embroider/issues/1086 Jan 24, 2022
@@ -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

@NullVoxPopuli NullVoxPopuli Jan 24, 2022

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!

@nightire
Copy link

Does this PR helps #1020 as well?

@NullVoxPopuli
Copy link
Collaborator Author

@nightire I don't think so :(
On my list of things to look at over this week tho

@ef4 ef4 changed the title Resolve: https://github.com/embroider-build/embroider/issues/1086 Support "cache" from @glimmer/tracking Jan 26, 2022
@ef4
Copy link
Contributor

ef4 commented Jan 26, 2022

Thanks, looking good.

@ef4 ef4 merged commit eaec307 into embroider-build:main Jan 26, 2022
@ef4 ef4 added the bug Something isn't working label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants