-
Notifications
You must be signed in to change notification settings - Fork 142
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
Merged
stefanpenner
merged 4 commits into
embroider-build:master
from
eoneill:compat-htmlbars-ast-plugin-wrapper
Aug 26, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { join } from 'path'; | ||
|
||
export default function prepHtmlbarsAstPluginsForUnwrap(registry: any): void { | ||
for (let wrapper of registry.load('htmlbars-ast-plugin')) { | ||
const { plugin, parallelBabel, baseDir, cacheKey } = wrapper; | ||
if (plugin) { | ||
// if the parallelBabel options were set on the wrapper, but not on the plugin, add it | ||
if (parallelBabel && !plugin.parallelBabel) { | ||
plugin.parallelBabel = { | ||
requireFile: join(__dirname, 'htmlbars-unwrapper.js'), | ||
buildUsing: 'unwrapPlugin', | ||
params: parallelBabel, | ||
}; | ||
} | ||
|
||
// NOTE: `_parallelBabel` (not `parallelBabel`) is expected by broccoli-babel-transpiler | ||
if (plugin.parallelBabel && !plugin._parallelBabel) { | ||
plugin._parallelBabel = plugin.parallelBabel; | ||
} | ||
|
||
// if the baseDir is set on the wrapper, but not on the plugin, add it | ||
if (baseDir && !plugin.baseDir) { | ||
plugin.baseDir = baseDir; | ||
} | ||
|
||
// if the cacheKey is set on the wrapper, but not on the plugin, add it | ||
if (cacheKey && !plugin.cacheKey) { | ||
plugin.cacheKey = cacheKey; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likestage1.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
instage1.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 theinject-babel-helpers
plugin (fromember-source
) is not parallelizable.This was fixed in emberjs/ember.js#19047, but not backported to
[email protected]
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 ofember-source
above3.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.
@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.
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.