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

src: port initializeImportMeta to native #57286

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Mar 3, 2025

Supersedes #57003.

We should probably avoid translating the URL to a path twice when the user needs both dirname and filename, but I'm not sure if there's an elegant way to do it without crossing the C++/JS bundary.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Mar 3, 2025
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 77.27273% with 15 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (6b0af17) to head (f10398b).
Report is 67 commits behind head on main.

Files with missing lines Patch % Lines
src/node_modules.cc 73.68% 4 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57286      +/-   ##
==========================================
- Coverage   90.24%   90.21%   -0.04%     
==========================================
  Files         630      630              
  Lines      184908   185263     +355     
  Branches    36181    36253      +72     
==========================================
+ Hits       166874   167134     +260     
+ Misses      11061    11057       -4     
- Partials     6973     7072      +99     
Files with missing lines Coverage Δ
lib/internal/modules/esm/initialize_import_meta.js 100.00% <100.00%> (ø)
src/node_modules.cc 78.55% <73.68%> (-0.47%) ⬇️

... and 70 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JakobJingleheimer JakobJingleheimer left a comment

Choose a reason for hiding this comment

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

I'm not great with cpp, but it looks fine AFAICT, and conceptually checks out 🙂

Copy link

@jsumners-nr jsumners-nr left a comment

Choose a reason for hiding this comment

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

I think the original implementation is much easier to understand and maintain.

@aduh95
Copy link
Contributor Author

aduh95 commented Mar 6, 2025

I think the original implementation is much easier to understand and maintain.

Do you have any suggestions on how to improve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants