Skip to content

module: only emit require(esm) warning under --trace-require-module#56194

Closed
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:trace-require-module
Closed

module: only emit require(esm) warning under --trace-require-module#56194
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:trace-require-module

Conversation

@joyeecheung

Copy link
Copy Markdown
Member

require(esm) is relatively stable now and the experimental warning has run its course - it's now more troublesome than useful. This patch changes it to no longer emit a warning unless --trace-require-module is explicitly used. The flag supports two modes:

  • --trace-require-module=all: emit warnings for all usages
  • --trace-require-module=no-node-modules: emit warnings for usages that do not come from a node_modules folder.

Fixes: #55417
Refs: #55085 (comment)

@nodejs-github-bot

Copy link
Copy Markdown
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++. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Dec 9, 2024
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2024
require(esm) is relatively stable now and the experimental warning
has run its course - it's now more troublesome than useful.
This patch changes it to no longer emit a warning unless
`--trace-require-module` is explicitly used. The flag supports
two modes:

- `--trace-require-module=all`: emit warnings for all usages
- `--trace-require-module=no-node-modules`: emit warnings for
  usages that do not come from a `node_modules` folder.
Comment thread doc/api/modules.md Outdated
@joyeecheung joyeecheung added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Dec 9, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 9, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Dec 9, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.49%. Comparing base (b915124) to head (9351661).
Report is 446 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #56194      +/-   ##
==========================================
+ Coverage   87.99%   88.49%   +0.50%     
==========================================
  Files         656      656              
  Lines      188959   189271     +312     
  Branches    35979    36346     +367     
==========================================
+ Hits       166267   167496    +1229     
+ Misses      15867    14973     -894     
+ Partials     6825     6802      -23     
Files with missing lines Coverage Δ
lib/internal/modules/cjs/loader.js 98.30% <100.00%> (+3.99%) ⬆️
src/node_options.cc 87.96% <100.00%> (+0.08%) ⬆️
src/node_options.h 98.29% <ø> (ø)

... and 101 files with indirect coverage changes

@aduh95 aduh95 added semver-minor PRs that contain new features and should be released in the next minor version. dont-land-on-v18.x author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 10, 2024
@joyeecheung

Copy link
Copy Markdown
Member Author

I don't know if it's necessary since we aren't changing the stability index (I was thinking about changing it and then realized that it was already release candidate), but anyway cc @nodejs/tsc for awareness

@joyeecheung joyeecheung added the notable-change PRs with changes that should be highlighted in changelogs. label Dec 10, 2024
@github-actions

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @joyeecheung.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

The warning actually broke one of my tests in v22 :).

@joyeecheung

Copy link
Copy Markdown
Member Author

backport in #56927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can we supress the new experimental warning from the new default require(esm) setting?

9 participants