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

[v22.x] backport unflagging of --experimental-require-module and related fixes/refactorings #55217

Open
wants to merge 3 commits into
base: v22.x-staging
Choose a base branch
from

Commits on Oct 11, 2024

  1. module: unflag --experimental-require-module

    This unflags --experimental-require-module so require(esm) can be
    used without the flag. For now, when require() actually encounters
    an ESM, it will still emit an experimental warning. To opt out
    of the feature, --no-experimental-require-module can be used.
    
    There are some tests specifically testing ERR_REQUIRE_ESM. Some
    of them are repurposed to test --no-experimental-require-module.
    Some of them are modified to just expect loading require(esm) to
    work, when it's appropriate.
    
    PR-URL: nodejs#55085
    Backport-PR-URL: nodejs#55217
    Refs: nodejs#52697
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Marco Ippolito <[email protected]>
    Reviewed-By: Rafael Gonzaga <[email protected]>
    Reviewed-By: Yagiz Nizipli <[email protected]>
    Reviewed-By: LiviaMedeiros <[email protected]>
    Reviewed-By: Antoine du Hamel <[email protected]>
    Reviewed-By: Filip Skokan <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Richard Lau <[email protected]>
    joyeecheung authored and aduh95 committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    4d67eb9 View commit details
    Browse the repository at this point in the history
  2. module: use kNodeModulesRE to detect node_modules

    This is faster and more consistent with other places using the
    regular expression to detect node_modules.
    
    PR-URL: nodejs#55243
    Backport-PR-URL: nodejs#55217
    Reviewed-By: Antoine du Hamel <[email protected]>
    Reviewed-By: Jacob Smith <[email protected]>
    Reviewed-By: Richard Lau <[email protected]>
    Reviewed-By: Marco Ippolito <[email protected]>
    Refs: nodejs#52697
    joyeecheung authored and aduh95 committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    6f4e4d5 View commit details
    Browse the repository at this point in the history
  3. module: do not warn when require(esm) comes from node_modules

    Some packages have been using try-catch to load require(esm)
    in environments that are available. In 23, where require(esm)
    is unflagged, we emit an experimental warning when require()
    is used to load ESM. To backport require(esm) to older LTS
    releases, however, this could break existing CLI output.
    To reduce the disruption for LTS, on older release lines,
    this commit is applied to skip the warning if require(esm)
    comes from node_modules. This warning will be eventually
    removed when require(esm) becomes stable.
    
    PR-URL: nodejs#55217
    Refs: nodejs#52697
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Antoine du Hamel <[email protected]>
    joyeecheung authored and aduh95 committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    71c2d02 View commit details
    Browse the repository at this point in the history