Skip to content

Conversation

younggglcy
Copy link
Contributor

@younggglcy younggglcy commented Mar 17, 2024

Rollup Plugin Name: @rollup/plugin-esm-shim

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

resolves #1649

Description

See the repro #1649 given, the shims were inserted into wrong position because the object

{
  keyword: ' import',
  dn: '',
};

matches the ESMStaticImportRegex regex.

This PR fixes it by disallowing \n in the specifier group in the regex.

@younggglcy younggglcy requested a review from tada5hi as a code owner March 17, 2024 15:08
@tada5hi
Copy link
Member

tada5hi commented Mar 18, 2024

looking good

@younggglcy
Copy link
Contributor Author

ping politely here. can anyone help merge this pr

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@lukastaegert lukastaegert merged commit 1795863 into rollup:master Apr 5, 2024
@younggglcy younggglcy deleted the fix/issue_1649 branch April 5, 2024 05:34
younggglcy added a commit to younggglcy/plugins that referenced this pull request Jun 6, 2024
* fix: update regex to do not match new line in specifier group

* test: add testcases and update snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@rollup/plugin-esm-shim] Import regex fails if the the code contains an "import" string followed by more content

3 participants