-
Notifications
You must be signed in to change notification settings - Fork 137
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 caching of template AST plugins (follow caching protocol of ember-cli-htmlbars) #924
Fix caching of template AST plugins (follow caching protocol of ember-cli-htmlbars) #924
Conversation
What can we do to prevent regressing this again? Is there a test scenario to add, or unit test to write? Obviously we want to the regression prevention to be as light wait as possible |
Yeah, I don't think we should be renaming the Otherwise this looks good to me. |
@@ -0,0 +1,28 @@ | |||
import { join } from 'path'; | |||
|
|||
export default function prepHtmlbarsAstPluginsForUnwrap(registry: any): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be unit tested to prevent future regressions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest setting THROW_UNLESS_PARALLELIZABLE
during something like stage1.test.ts
.
We already run with this flag, but only in the macros package's test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting THROW_UNLESS_PARALLELIZABLE=1
in stage1.test.ts
definitely causes the tests to fail. I was able to confirm that the patch here works. However, even with this patch, the tests continue to fail as the inject-babel-helpers
plugin (from ember-source
) is not parallelizable.
This was fixed in emberjs/ember.js#19047, but not backported to ember-source@3.17
which is currently used in a few test-packages (e.g. here and here).
Bumping ember-source
resolves the issue, however, I don't think I can currently bump these instances of ember-source
above 3.17
per #927 / #934 (@stefanpenner).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping ember-source resolves the issue, however, I don't think I can currently bump these instances of ember-source above 3.17 per #927 / #934 (@stefanpenner)
@eoneill #927 / #934 are not ember-source, they are for ember-cli, but the fix appears to be in ember-source -> emberjs/ember.js@104265a
Looking at the ember-source commit, it suggests that if we get to ember-source@~3.22 the issue you describe is addressed.
rg 'ember-source":'
test-packages/support/package.json
21: "ember-source": "3.17.0",
packages/router/package.json
63: "ember-source": "~3.16.0",
test-packages/macro-sample-addon/package.json
54: "ember-source": "~3.10.0",
test-packages/fastboot-addon/package.json
47: "ember-source": "~3.17.0",
test-packages/sample-transforms/package.json
46: "ember-source": "~3.10.0",
packages/util/package.json
64: "ember-source": "~3.21.1",
tests/app-template/package.json
54: "ember-source": "~3.26.1",
tests/addon-template/package.json
53: "ember-source": "~3.26.1",
I can quickly try to upgrade those, and see if we can land this with the flag enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if we can just quickly sneak in a conservative ember-source bump to help with (pr open #935)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated ember-source to the minimum version described ^^. You should be unblocked from that side of things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and added THROW_UNLESS_PARALLELIZABLE=1
in latest commit. This should be resolved now.
Several of your tests that where failing due to the ember global being missing should now be green: #925 |
If I don't set
This is because I think the reasonable fix forwards is... // set `parallelBabel` derived from wrapper
if (parallelBabel && !plugin.parallelBabel) {
plugin.parallelBabel = { ... };
}
// mirror onto `_parallelBabel`
if (plugin.parallelBabel && !plugin._parallelBabel) {
plugin._parallelBabel = plugin.parallelBabel;
} |
Ok, that makes sense. |
This aims to help enable #924 (comment) to add THROW_UNLESS_PARALLELIZABLE
This aims to help enable #924 (comment) to add THROW_UNLESS_PARALLELIZABLE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that ember-source has been bumped, let's include THROW_UNLESS_PARALLELIZABLE
in this PR to prevent regression as @ef4 recommended
d4eedc8
to
3fdbfa1
Compare
@eoneill Nice thanks! |
This addresses two issues.
The first is that most registered
htmlbars-ast-plugin
will currently opt-out of caching becaue there is no caching strategy (baseDir
/cacheKey
) on the raw plugin. In classic build, this is derived from the plugin wrapper. In embroider, that context is currently lost. The fix here is to mirrorbaseDir
/cacheKey
onto the plugin itself.The second is that we only "unwrap" plugins at the App level, not at the Addon level. This resulted in our builds failing when
THROW_UNLESS_PARALLELIZABLE=1
. The fix here is to also unwrap the plugins in theV1Addon
.The two changes allow our app to build with
THROW_UNLESS_PARALLELIZABLE=1
and we no longer get a bunch of...NOTE: I changed
plugin.parallelBabel
toplugin._parallelBabel
because that's whatbroccoli-babel-transpiler
is expecting, but I'm not entirely sure this is correct (given the previous commit). If we need both for compat, we could mirror this...References: