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

[12.x] modules backports #35385

Closed

Commits on Sep 28, 2020

  1. module: package "imports" field

    PR-URL: nodejs#34117
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    75a2cf3 View commit details
    Browse the repository at this point in the history
  2. module: self referential modules in repl or -r

    Load self referential modules from the repl and using the preload flag
    `-r`. In both cases the base path used for resolution is the current
    `process.cwd()`. Also fixes an internal cycle bug in the REPL exports
    resolution.
    
    PR-URL: nodejs#32261
    Fixes: nodejs#31595
    Reviewed-By: Guy Bedford <guybedford@gmail.com>
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    dnlup authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    f3a328c View commit details
    Browse the repository at this point in the history
  3. module: use cjsCache over esm injection

    PR-URL: nodejs#34605
    Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    39a42b3 View commit details
    Browse the repository at this point in the history
  4. module: custom --conditions flag option

    PR-URL: nodejs#34637
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    9485ad6 View commit details
    Browse the repository at this point in the history
  5. module: share CJS/ESM resolver fns, refactoring

    PR-URL: nodejs#34744
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    7e20df2 View commit details
    Browse the repository at this point in the history
  6. module: fix check for package.json at volume root

    This patch converts the "read package scope" algorithm's while loop
    into a do-while loop enabling items at the filesystem root dir to
    be considered within the scope of a sibling package.json also at the
    filesystem root dir.
    
    Fixes: nodejs#33438
    
    Co-authored-by: Guy Bedford <guybedford@gmail.com>
    
    PR-URL: nodejs#34595
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: Mary Marchini <oss@mmarchini.me>
    DerekNonGeneric authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    d6af3ba View commit details
    Browse the repository at this point in the history
  7. module: drop -u alias for --conditions

    Old versions of mocha break after nodejs#34637.
    
    This was a bug in mocha, but since this is a widely used module
    we can expect ecosystem breakage until modules are updated to
    the latest version of mocha. Drop the conflicting `-u` alias --
    we can potentially bring it back once modules have been updated.
    
    PR-URL: nodejs#34935
    Refs: mochajs/mocha#4417
    Refs: nodejs#34637
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
    Reviewed-By: Myles Borins <myles.borins@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Shelley Vohr <codebytere@gmail.com>
    richardlau authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    56393c1 View commit details
    Browse the repository at this point in the history
  8. esm: improve error message of ERR_UNSUPPORTED_ESM_URL_SCHEME

    Refs: nodejs#34765
    
    PR-URL: nodejs#34795
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: Guy Bedford <guybedford@gmail.com>
    Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    lundibundi authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    8030eb5 View commit details
    Browse the repository at this point in the history
  9. esm: shorten ERR_UNSUPPORTED_ESM_URL_SCHEME message

    I know it just got modified to include new information, but this
    shortens the message a bit without (I hope) losing clarity or meaning.
    
    PR-URL: nodejs#34836
    Reviewed-By: Guy Bedford <guybedford@gmail.com>
    Reviewed-By: Denys Otrishko <shishugi@gmail.com>
    Trott authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    96325b1 View commit details
    Browse the repository at this point in the history
  10. esm: better package.json parser errors

    PR-URL: nodejs#35117
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    b29b966 View commit details
    Browse the repository at this point in the history
  11. module: use isURLInstance instead of instanceof

    PR-URL: nodejs#34951
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
    aduh95 authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    be78b83 View commit details
    Browse the repository at this point in the history
  12. module: fix crash on multiline named cjs imports

    The node process crashes when trying to parse a multiline import
    statement for named exports of a CommonJS module:
    
        TypeError: Cannot read property '0' of null
              at ModuleJob._instantiate (internal/modules/esm/module_job.js:112:77)
              at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
              at async Loader.import (internal/modules/esm/loader.js:165:24)
              at async rejects.name (file:///***/node/test/es-module/test-esm-cjs-named-error.mjs:56:3)
              at async waitForActual (assert.js:721:5)
              at async rejects (assert.js:830:25),
    
    The reason is that the regexp that is currently used to decorate the
    original error fails for multi line import statements.
    
    Unfortunately the undecorated error stack only contains the single line
    which causes the import to fail:
    
        file:///***/node/test/fixtures/es-modules/package-cjs-named-error/multi-line.mjs:2
          comeOn,
          ^^^^^^
        SyntaxError: The requested module './fail.cjs' does not provide an export named 'comeOn'
            at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
            at async ModuleJob.run (internal/modules/esm/module_job.js:141:5)
            at async Loader.import (internal/modules/esm/loader.js:165:24)
            at async rejects.name (file:///***/node/test/es-module/test-esm-cjs-named-error.mjs:56:3)
            at async waitForActual (assert.js:721:5)
            at async rejects (assert.js:830:25)
    
    Hence, for multiline import statements we cannot create an equivalent
    piece of code that uses default import followed by an object
    destructuring assignment.
    
    In any case the node process should definitely not crash. So until we
    have a more sophisticated way of extracting the entire problematic
    multiline import statement, show the code example only for single-line
    imports where the current regexp approach works well.
    
    Refs: nodejs#35259
    
    PR-URL: nodejs#35275
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Myles Borins <myles.borins@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    ctavan authored and guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    0772b5b View commit details
    Browse the repository at this point in the history
  13. module: exports pattern support

    PR-URL: nodejs#34718
    Reviewed-By: Jan Krems <jan.krems@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    guybedford committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    ab60e95 View commit details
    Browse the repository at this point in the history