summaryrefslogtreecommitdiff
path: root/lib/internal/modules
Commit message (Collapse)AuthorAgeFilesLines
* esm: do not use `'beforeExit'` on the main threadAntoine du Hamel2023-05-141-17/+4
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/47964 Fixes: https://github.com/nodejs/node/issues/47929 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* module: refactor to use `normalizeRequirableId` in the CJS module loaderDarshan Sen2023-05-081-14/+2
| | | | | | | | | | | | | | | `BuiltinModule.normalizeRequirableId()` was introduced in https://github.com/nodejs/node/pull/47779 to fix a bug in the require function of SEAs and Snapshots, so that built-in modules with the `node:` scheme could be required correctly. This change makes more use of this API instead of `BuiltinModule.canBeRequiredByUsers()` and `BuiltinModule.canBeRequiredWithoutScheme()` to reduce chances of such bugs. Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: https://github.com/nodejs/node/pull/47896 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
* src: throw DataCloneError on transfering untransferable objectsChengzhong Wu2023-05-051-4/+12
| | | | | | | | | | | | The HTML StructuredSerializeWithTransfer algorithm defines that when an untransferable object is in the transfer list, a DataCloneError is thrown. An array buffer that is already transferred is also considered as untransferable. PR-URL: https://github.com/nodejs/node/pull/47604 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* tools: fix jsdoc lintMoshe Atlow2023-05-023-8/+0
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/47789 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
* esm: rename `URLCanParse` to be consistentAntoine du Hamel2023-04-242-5/+5
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/47668 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: improve esm resolve performanceYagiz Nizipli2023-04-231-22/+16
| | | | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/46652 Refs: https://github.com/nodejs/performance/issues/39 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* loader: use default loader as cascaded loader in the in loader workerJoyee Cheung2023-04-214-5/+18
| | | | | | | | | | | | Use the default loader as the cascaded loader in the loader worker. Otherwise we spawn loader workers in the loader workers indefinitely. PR-URL: https://github.com/nodejs/node/pull/47620 Fixes: https://github.com/nodejs/node/issues/47566 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* esm: remove support for deprecated hooksAntoine du Hamel2023-04-191-37/+0
| | | | | | | | | | | Those have been deprecated for a while, it's time. PR-URL: https://github.com/nodejs/node/pull/47580 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* esm: initialize `import.meta` on evalAntoine du Hamel2023-04-191-0/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/47551 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* esm: propagate `process.exit` from the loader thread to the main threadAntoine du Hamel2023-04-192-0/+17
| | | | | PR-URL: https://github.com/nodejs/node/pull/47548 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* esm: avoid accessing lazy getters for urlsYagiz Nizipli2023-04-151-15/+25
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/47542 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* esm: avoid try/catch when validating urlsYagiz Nizipli2023-04-152-16/+12
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/47541 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
* esm: move hook execution to separate threadJacob Smith2023-04-138-213/+733
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/44710 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com> Co-authored-by: Michaël Zasso <targos@protonmail.com>
* module: do less CJS module loader initialization at run timeJoyee Cheung2023-04-054-62/+40
| | | | | | | | | | | | | | | | | | This patch: - Builds the set of modules that can be required by users with/without the `node:` prefix at snapshot building time. We only modify it when `--expose-internals` but the default set is now in the snapshot. At run time the CJS module loader only creates a frozen array out of it. - `BuiltinModule.canBeRequiredWithoutScheme()` is now enough to determine if an id can be required without `node:` without an additional call to `BuiltinModule.canBeRequiredByUsers()` - Replace the pending-to-deprecate methods on `Module` with an internal implementation that only queries the CLI flags when being invoked. So we can install these methods in the snapshot. PR-URL: https://github.com/nodejs/node/pull/47194 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* src: bootstrap prepare stack trace callback in shadow realmChengzhong Wu2023-04-044-4/+4
| | | | | | | | | | | Bootstrap per-realm callbacks like `prepare_stack_trace_callback` in the ShadowRealm. This enables stack trace decoration in the ShadowRealm. PR-URL: https://github.com/nodejs/node/pull/47107 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* esm: skip file: URL conversion to path when possibleAntoine du Hamel2023-04-012-8/+31
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/46305 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com>
* permission: add path separator to loader checkRafael Gonzaga2023-03-151-1/+1
| | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/47030 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
* esm: fix import assertion warningAntoine du Hamel2023-03-071-2/+2
| | | | | | | | | Refs: https://github.com/nodejs/node/pull/46901#discussion_r1122242913 PR-URL: https://github.com/nodejs/node/pull/46971 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* lib: enforce use of trailing commasAntoine du Hamel2023-03-066-13/+13
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/46881 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* url: use private properties for brand checkYagiz Nizipli2023-03-032-4/+4
| | | | | | PR-URL: https://github.com/nodejs/node/pull/46904 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* esm: add a runtime warning when using import assertionsAntoine du Hamel2023-03-031-0/+13
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/46901 Refs: https://github.com/nodejs/node/issues/46830 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* src,process: add permission modelRafael Gonzaga2023-02-231-2/+15
| | | | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/44004 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* lib: delete module findPath unused paramssinkhaha2023-02-171-1/+1
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/45371 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: makeRequireFunction patch when experimental policyRafaelGSS2023-02-162-7/+26
| | | | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1747642 CVE-ID: CVE-2023-23918 PR-URL: https://github.com/nodejs-private/node-private/pull/358 Reviewed-by: Bradley Farias <bradley.meck@gmail.com> Reviewed-by: Matteo Collina <matteo.collina@gmail.com>
* policy: makeRequireFunction on mainModule.requireRafaelGSS2023-02-162-27/+43
| | | | | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> Co-authored-by: Bradley Farias <bradley.meck@gmail.com> Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1747642 CVE-ID: CVE-2023-23918 PR-URL: https://github.com/nodejs-private/node-private/pull/358 Reviewed-by: Bradley Farias <bradley.meck@gmail.com> Reviewed-by: Matteo Collina <matteo.collina@gmail.com>
* lib: enforce use of trailing commas in more filesAntoine du Hamel2023-02-161-2/+2
| | | | | | | | | | Some part of the codebase already use trailing commas, this commit is adding a lint rule to ensure it stays this way. This commit also adds the rule for a few files that were missing only one or two trailing commas. PR-URL: https://github.com/nodejs/node/pull/46655 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* lib: enforce use of trailing commas for functionsAntoine du Hamel2023-02-1413-46/+46
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/46629 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
* esm: mark `importAssertions` as requiredAntoine du Hamel2023-01-121-6/+2
| | | | | | | | We already always specify a value, and failing to do so would likely be a bug. PR-URL: https://github.com/nodejs/node/pull/46164 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* esm: allow resolve to return import assertionsGeoffrey Booth2023-01-122-19/+38
| | | | | | PR-URL: https://github.com/nodejs/node/pull/46153 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* tools: add `prefer-proto` ruleJordan Harband2023-01-107-18/+11
| | | | | | | | | | | | | | | | fixup: add support for `Object.create(null)` fixup: extend to any 1-argument Object.create call fixup: add tests PR-URL: https://github.com/nodejs/node/pull/46083 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* module: fix unintended mutationAntoine du Hamel2023-01-071-5/+5
| | | | | | | | | Refs: https://github.com/nodejs/node/pull/46061#issuecomment-1372246648 PR-URL: https://github.com/nodejs/node/pull/46108 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* module: move test reporter loadingGeoffrey Booth2022-12-222-56/+25
| | | | | | | | | | | Move the logic for handling --test-reporter out of the general module loader and into the test_runner subsystem. PR-URL: https://github.com/nodejs/node/pull/45923 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* esm: move hooks handling into separate classGeoffrey Booth2022-12-203-596/+737
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/45869 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* test_runner: add reportersMoshe Atlow2022-12-192-25/+56
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/45712 Fixes: https://github.com/nodejs/node/issues/45648 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* tools: add `ArrayPrototypeConcat` to the list of primordials to avoidAntoine du Hamel2022-12-172-10/+18
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/44445 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* esm: leverage loaders when resolving subsequent loadersMaël Nison2022-12-171-3/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/43772 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
* bootstrap: make CJS loader snapshotableJoyee Cheung2022-12-162-98/+127
| | | | | | | | | | | | This patch makes the top-level access to runtime states in the CJS loader lazy, and move the side-effects into a initializeCJS() function that gets called during pre-execution. As a result the CJS loader can be included into the built-in snapshot. PR-URL: https://github.com/nodejs/node/pull/45849 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* modules: move callbacks and conditions into modules/esm/utils.jsJoyee Cheung2022-12-165-39/+119
| | | | | | | | | | | | | | | | | This moves the following utils into modules/esm/utils.js: - Code related to default conditions - The callbackMap (which is now created in the module instead of hanging off the module_wrap binding, since the C++ land does not need it). - Per-isolate module callbacks These are self-contained code that can be included into the built-in snapshot. PR-URL: https://github.com/nodejs/node/pull/45849 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* lib: lazy-load deps in modules/run_main.jsJoyee Cheung2022-12-161-2/+4
| | | | | | | | So that the file can be snapshotted PR-URL: https://github.com/nodejs/node/pull/45849 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* modules: move modules/cjs/helpers.js to modules/helpers.jsJoyee Cheung2022-12-163-2/+2
| | | | | | | | | The helpers are actually shared by the two loaders, so move them under modules/ directly. PR-URL: https://github.com/nodejs/node/pull/45849 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* bootstrap: lazy load non-essential modulesJoyee Cheung2022-12-098-27/+31
| | | | | | | | | | | | | | | | | | | | | It turns out that even with startup snapshots, there is a non-trivial overhead for loading internal modules. This patch makes the loading of the non-essential modules lazy again. Caveat: we have to make some of the globals lazily-loaded too, so the WPT runner is updated to test what the state of the global scope is after the globals are accessed (and replaced with the loaded value). PR-URL: https://github.com/nodejs/node/pull/45659 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
* module: require.resolve.paths returns null with node schemaMURAKAMI Masahiko2022-11-201-2/+7
| | | | | | | | | | | require.resolve.paths should returns null with builtin module. when builtin module without `node:` schema, `paths` returns null. But, it don't return null when builtin module with `node:` schema. Fixes: https://github.com/nodejs/node/issues/45001 PR-URL: https://github.com/nodejs/node/pull/45147 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
* lib: do not throw if global property is no longer configurableAntoine du Hamel2022-11-171-10/+13
| | | | | | | | Fixes: https://github.com/nodejs/node/issues/45336 PR-URL: https://github.com/nodejs/node/pull/45344 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com>
* watch: watch for missing dependenciesMoshe Atlow2022-11-133-2/+13
| | | | | | PR-URL: https://github.com/nodejs/node/pull/45348 Reviewed-By: Ruy Adorno <ruyadorno@google.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
* esm: add JSDoc property descriptions for loaderRich Trott2022-11-121-7/+7
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/45370 Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* esm: add JSDoc property descriptions for fetchRich Trott2022-11-121-3/+3
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/45370 Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jacob Smith <jacob@frende.me>
* lib: fix JSDoc issuesRich Trott2022-11-072-17/+43
| | | | | | | | | | | | | | | | | | | | | | | | Updating ESLint and dependencies will start flagging a few additional JSDoc issues. One or two of these are simple fixes. The ESM stuff requires throwing explicitly in JSDoc'ed functions rather than calling another function to throw. I think this makes the code easier to understand--you don't need to know that a particular function that starts with `throwsIf` *might* throw but something that starts with `throwsAnythingElse` will always throw. Instead, it's right there in the code. This also might make it easier to improve stack traces if that's something we'd like to do at some point. PR-URL: https://github.com/nodejs/node/pull/45243 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
* module: ensure relative requires work from deleted directoriesBradley Farias2022-10-311-10/+40
| | | | | PR-URL: https://github.com/nodejs/node/pull/42384 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* esm: protect ESM loader from prototype pollutionAntoine du Hamel2022-10-272-6/+7
| | | | | | | | | | | | | In a previous commit, the loader implementation was modified to be protected against most prototype pollution, but was kept vulnerable to `Array.prototype` pollution. This commit fixes that, the tradeoff is that it modifies the `ESMLoader.prototype.import` return type from an `Array` to an array-like object. Refs: https://github.com/nodejs/node/pull/45044 PR-URL: https://github.com/nodejs/node/pull/45175 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
* src,lib: retrieve parsed source map url from v8legendecas2022-10-231-5/+21
| | | | | | | | | | | | | V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: https://github.com/nodejs/node/pull/44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>