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
parse import assertions #12278
parse import assertions #12278
Conversation
For maintainers only:
|
5c49786
to
d41e7ca
Compare
Tests are broken 😞 |
@alexander-akait yes noticed that too. I was wondering if those failures are related to my change? I can't see the detail of the failures but they are mismatching stats? I'll try to run them locally again |
1eaa9a1
to
7dab9d7
Compare
@alexander-akait tests are passing now, coverage is failing and https://dev.azure.com/webpack/webpack/_build/results?buildId=12330&view=logs&j=1d505e51-909d-5717-0d5b-43f6a0bd49f6&t=6309f675-4460-5c1b-70bc-fd472dead250 is flaky. Could you please restart for me? |
@vankop thanks) |
right, sorry I forgot about that trick! thanks |
@sokra could you please take a look at the PR? the idea is that we allow parsing and stripping out import assertions for now. |
JSON is not loaded dynamically but embedded into the JS file. As it's parsed during build it's already verified that it's really JSON and not JS or something else. I think what we can do it to set the module type for imports with For a |
I was thinking of loading dynamically remote resources. Like: Thanks for your pointers, i'll do that change. |
7dab9d7
to
c45574c
Compare
c45574c
to
709569f
Compare
@sokra I believe I have implemented what you suggested. One test doesn't pass yet and we probably want to show a code frame when the assertion aren't met, that's still WIP. Could you please do an early review? |
709569f
to
2cde506
Compare
@sokra could you please review the change so far? I believe it matches what you suggested. |
70f054d
to
4343e87
Compare
change Map to Record improve test case
284cd5f
to
8bc0927
Compare
Thanks |
Great, thanks for your help! |
@redonkulus yep |
…t-assertions"" This reverts commit 61946b7.
…t-assertions"" This reverts commit 61946b7.
Should |
@sodatea Yes, feel free to open an issue |
Refs #11917
What kind of change does this PR introduce?
Parsing import assertions syntax
Did you add tests for your changes?
Yes, one. Most of the tests are in https://github.com/xtuc/acorn-import-assertions/tree/main/test/fixtures
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
probably not now, import assertions doesn't emit runtime code yet