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

Resolve import.meta.{filename,dirname} in files imported from config #5520

Merged
merged 1 commit into from
May 22, 2024

Conversation

BPScott
Copy link
Contributor

@BPScott BPScott commented May 18, 2024

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

List any relevant issue numbers: N/A

Description

Back in #4005, rollup was taught how to resolve import.meta.url in files imported into the rollup config using a relative path - making import.meta.url refer the file it's used in, rather than the config file.

node 20.11.0 introduced two new import meta fields - import.meta.filename and import.meta.dirname - that act the same as __filename and __dirname in commonjs.

This PR teaches rollup config transpilation how to transform import.meta.filename and import.meta.dirname so they behave as expected inside plugins that are imported via relative paths. Previously, import.meta.filename and import.meta.dirname would be the file/directory of the config file.

Copy link

vercel bot commented May 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2024 10:10pm

Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.81%. Comparing base (a25a779) to head (eaa76d4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5520   +/-   ##
=======================================
  Coverage   98.81%   98.81%           
=======================================
  Files         238      238           
  Lines        9540     9544    +4     
  Branches     2437     2439    +2     
=======================================
+ Hits         9427     9431    +4     
  Misses         48       48           
  Partials       65       65           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BPScott BPScott marked this pull request as ready for review May 19, 2024 04:19
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, thanks!

@lukastaegert lukastaegert added this pull request to the merge queue May 22, 2024
Merged via the queue into rollup:master with commit cc993e7 May 22, 2024
38 checks passed
Copy link

This PR has been released as part of rollup@4.18.0. You can test it via npm install rollup.

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.

None yet

2 participants