Commit Graph
39014 Commits
Author SHA1 Message Date
Antoine du Hamel c20fdb4e52 doc: edit import.meta.resolve documentation
PR-URL: https://github.com/nodejs/node/pull/49247
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Refs: https://github.com/nodejs/node/pull/49028
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2023-11-23 10:47:43 +01:00
Geoffrey Booth 1ac389ecef doc: update module hooks docs
PR-URL: https://github.com/nodejs/node/pull/49265
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-23 10:47:34 +01:00
Geoffrey Booth ed2d46f4cc doc: move and rename loaders section
PR-URL: https://github.com/nodejs/node/pull/49261
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-11-23 10:47:22 +01:00
Geoffrey Booth d1f5514917 esm: refactor mocking test
PR-URL: https://github.com/nodejs/node/pull/49465
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-23 10:47:12 +01:00
Geoffrey Booth 258df0e72d doc: add signature for module.register
PR-URL: https://github.com/nodejs/node/pull/49251
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-23 10:47:02 +01:00
Antoine du Hamel e1c6f46926 test: reduce flakiness of test-esm-loader-hooks
PR-URL: https://github.com/nodejs/node/pull/49248
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-11-23 10:46:52 +01:00
Jacob Smith 58eaf3f6ae doc: caveat unavailability of import.meta.resolve in custom loaders
PR-URL: https://github.com/nodejs/node/pull/49242
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:46:42 +01:00
Antoine du Hamel e8d475ffc4 test: refactor test-esm-loader-hooks for easier debugging
- Always check stderr before stdout as the former would contain error
  information.
- Always match the full stdout to avoid surprises.
- Use `deepStrictEqual` when appropriate to get more informative test
  failures.
- Remove leading slashes from relative paths/URLs to not confuse them
  with absolute paths.
- Remove unnecessary `--no-warnings` flag.

PR-URL: https://github.com/nodejs/node/pull/49131
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:46:32 +01:00
Antoine du Hamel 2fef28b2b9 doc: fix name of the flag in initialize() docs
PR-URL: https://github.com/nodejs/node/pull/49158
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-11-23 10:46:22 +01:00
Antoine du Hamel 01ca6d277d esm: fix globalPreload warning
PR-URL: https://github.com/nodejs/node/pull/49069
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/49026
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:46:11 +01:00
Guy Bedford c1a84398b4 esm: unflag import.meta.resolve
PR-URL: https://github.com/nodejs/node/pull/49028
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-11-23 10:46:00 +01:00
Guy Bedford ef43f084e9 esm: import.meta.resolve exact module not found errors should return
PR-URL: https://github.com/nodejs/node/pull/49038
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:45:47 +01:00
Antoine du Hamel 26f01669fc test: reduce flakiness of test-esm-loader-hooks
PR-URL: https://github.com/nodejs/node/pull/49105
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-11-23 10:45:35 +01:00
Antoine du Hamel 385f24c9cc esm: protect ERR_UNSUPPORTED_DIR_IMPORT against prototype pollution
PR-URL: https://github.com/nodejs/node/pull/49060
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:45:17 +01:00
Antoine du Hamel d5a1153970 test: use fixtures.fileURL when appropriate
PR-URL: https://github.com/nodejs/node/pull/48990
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-11-23 10:45:07 +01:00
Izaak Schroeder 10e7c3a376 esm: add initialize hook, integrate with register
Follows @giltayar's proposed API:

> `register` can pass any data it wants to the loader, which will be
passed to the exported `initialize` function of the loader.
Additionally, if the user of `register` wants to communicate with the
loader, it can just create a `MessageChannel` and pass the port to the
loader as data.

The `register` API is now:

```ts
interface Options {
  parentUrl?: string;
  data?: any;
  transferList?: any[];
}

function register(loader: string, parentUrl?: string): any;
function register(loader: string, options?: Options): any;
```

This API is backwards compatible with the old one (new arguments are
optional and at the end) and allows for passing data into the new
`initialize` hook. If this hook returns data it is passed back to
`register`:

```ts
function initialize(data: any): Promise<any>;
```

**NOTE**: Currently there is no mechanism for a loader to exchange
ownership of something back to the caller.

Refs: https://github.com/nodejs/loaders/issues/147
PR-URL: https://github.com/nodejs/node/pull/48842
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:44:54 +01:00
Antoine du Hamel f96b610268 esm: fix typo parentUrl -> parentURL
PR-URL: https://github.com/nodejs/node/pull/48999
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-11-23 10:44:42 +01:00
Antoine du Hamel 3424793013 test: fix snapshot tests when cwd contains spaces or backslashes
Both are valid characters for file names on non-Windows systems.

PR-URL: https://github.com/nodejs/node/pull/48959
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-11-23 10:44:33 +01:00
Antoine du Hamel a9347a4635 test: order common.mjs in ASCII order
PR-URL: https://github.com/nodejs/node/pull/48960
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-11-23 10:44:23 +01:00
Antoine du Hamel adb9280d8e test: fix some assumptions in tests
Some tests are assuming they will be run from a directory that do not
contain any quote or special character in its path. That assumption is
not necessary, using `JSON.stringify` or `pathToFileURL` ensures the
test can be run whatever the path looks like.

PR-URL: https://github.com/nodejs/node/pull/48958
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-11-23 10:44:13 +01:00
LiviaMedeiros 48c25b154b fs: make mkdtemp accept buffers and URL
PR-URL: https://github.com/nodejs/node/pull/48828
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-23 10:44:04 +01:00
Antoine du Hamel f02637e805 test: fix es-module/test-esm-initialization
PR-URL: https://github.com/nodejs/node/pull/48880
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-11-23 10:43:53 +01:00
Antoine du Hamel 14e148ee6c module: ensure successful import returns the same result
PR-URL: https://github.com/nodejs/node/pull/46662
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:43:44 +01:00
Izaak Schroeder 03c1b5e647 esm: unflag Module.register and allow nested loader import()
Major functional changes:

- Allow `import()` to work within loaders that require other loaders,
- Unflag the use of `Module.register`.

A new interface `Customizations` has been created in order to unify
`ModuleLoader` (previously `DefaultModuleLoader`), `Hooks` and
`CustomizedModuleLoader` all of which now implement it:

```ts
interface LoadResult {
  format: ModuleFormat;
  source: ModuleSource;
}

interface ResolveResult {
  format: string;
  url: URL['href'];
}

interface Customizations {
  allowImportMetaResolve: boolean;
  load(url: string, context: object): Promise<LoadResult>
  resolve(
    originalSpecifier:
    string, parentURL: string,
    importAssertions: Record<string, string>
  ): Promise<ResolveResult>
  resolveSync(
    originalSpecifier:
    string, parentURL: string,
    importAssertions: Record<string, string>
  ) ResolveResult;
  register(specifier: string, parentUrl: string): any;
  forceLoadHooks(): void;
  importMetaInitialize(meta, context, loader): void;
}
```

The `ModuleLoader` class now has `setCustomizations` which takes an
object of this shape and delegates its responsibilities to this object
if present.

Note that two properties `allowImportMetaResolve` and `resolveSync`
exist now as a mechanism for `import.meta.resolve` – since `Hooks`
does not implement `resolveSync` other loaders cannot use
`import.meta.resolve`; `allowImportMetaResolve` is a way of checking
for that case instead of invoking `resolveSync` and erroring.

Fixes https://github.com/nodejs/node/issues/48515
Closes https://github.com/nodejs/node/pull/48439

PR-URL: https://github.com/nodejs/node/pull/48559
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:43:33 +01:00
Antoine du Hamel 63aa5d7270 esm: add back globalPreload tests and fix failing ones
PR-URL: https://github.com/nodejs/node/pull/48779
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/48778
Fixes: https://github.com/nodejs/node/issues/48516
Refs: https://github.com/nodejs/node/pull/46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:43:20 +01:00
João Lenon 65dfe85f03 module: implement register utility
PR-URL: https://github.com/nodejs/node/pull/46826
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-23 10:43:08 +01:00
Antoine du Hamel 2ef80f12b9 typings: fix JSDoc in ESM loader modules
PR-URL: https://github.com/nodejs/node/pull/48424
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-23 10:42:56 +01:00
Antoine du Hamel 1c7be606f1 esm: remove support for arrays in import internal method
This avoids initializing arrays that we never use, and simplifies the
implementation overall.

PR-URL: https://github.com/nodejs/node/pull/48296
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-11-23 10:42:45 +01:00
Antoine du Hamel 655111fa00 esm: handle globalPreload hook returning a nullish value
PR-URL: https://github.com/nodejs/node/pull/48249
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/48240
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:42:35 +01:00
Antoine du Hamel 9938a8bf13 esm: handle more error types thrown from the loader thread
PR-URL: https://github.com/nodejs/node/pull/48247
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Refs: https://github.com/nodejs/node/issues/48240
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:42:20 +01:00
Antoine du Hamel 8cab32a5d1 esm: do not use 'beforeExit' on the main thread
PR-URL: https://github.com/nodejs/node/pull/47964
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:42:06 +01:00
Antoine du Hamel b61efcce95 esm: rename URLCanParse to be consistent
PR-URL: https://github.com/nodejs/node/pull/47668
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:22:09 +01:00
Joyee Cheung b77a6b2376 loader: use default loader as cascaded loader in the in loader worker
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
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:21:52 +01:00
Antoine du Hamel ca20f5931d esm: remove support for deprecated hooks
Those have been deprecated for a while, it's time.

PR-URL: https://github.com/nodejs/node/pull/47580
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:21:32 +01:00
Antoine du Hamel 5de37a1e37 esm: initialize import.meta on eval
PR-URL: https://github.com/nodejs/node/pull/47551
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:21:18 +01:00
Antoine du Hamel 39fbce7313 esm: propagate process.exit from the loader thread to the main thread
PR-URL: https://github.com/nodejs/node/pull/47548
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-11-23 10:21:01 +01:00
Yagiz Nizipli 2a528b76e6 esm: avoid try/catch when validating urls
PR-URL: https://github.com/nodejs/node/pull/47541
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:19:23 +01:00
bac9b1758f esm: move hook execution to separate thread
PR-URL: https://github.com/nodejs/node/pull/44710
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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>
2023-11-23 10:19:07 +01:00
npm CLI robot 272e55c66f deps: upgrade npm to 10.2.3
PR-URL: https://github.com/nodejs/node/pull/50531
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2023-11-21 09:18:59 +01:00
Luigi Pinca 8c918e5e59 test: relax version check with shared OpenSSL
Relax the OpenSSL version check when Node.js is built with the
`--shared-openssl` option. Verify only that `process.versions.openssl`
is truthy.

Fixes: https://github.com/nodejs/node/issues/43078
PR-URL: https://github.com/nodejs/node/pull/50505
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-11-15 11:16:43 +01:00
Node.js GitHub Bot 3f6dcc62e5 deps: update archs files for openssl-3.0.12+quic1
PR-URL: https://github.com/nodejs/node/pull/50411
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-11-15 11:16:22 +01:00
Node.js GitHub Bot da26cdbe84 deps: upgrade openssl sources to quictls/openssl-3.0.12+quic1
PR-URL: https://github.com/nodejs/node/pull/50411
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-11-15 11:16:18 +01:00
Kerem Kat c6caf13ad5 test: fix crypto-dh error message for OpenSSL 3.x
OpenSSL 3.0.12 and 3.1.4 changes the type of error short keys and IVs
cause. The error message in test-crypto-dh for the "empty secret" is
now 'Supplied key is too small' instead of
'error:02800080:Diffie-Hellman routines::invalid secret'.

Error message change is test-only and uses the right error message for
versions >=3.0.12 in 3.0.x and >= 3.1.4 in 3.1.x series.

ref. https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=0df40630850fb2740e6be6890bb905d3fc623b2d
ref. https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=5f69f5c65e483928c4b28ed16af6e5742929f1ee
ref. https://www.openssl.org/news/vulnerabilities.html#CVE-2023-5363

PR-URL: https://github.com/nodejs/node/pull/50395
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-11-15 11:15:52 +01:00
Joyee Cheung 65b41ebd1f test: split test-crypto-dh to avoid timeout on slow machines in the CI
Locally this speeds up running test-crypto-dh* from 7s to 2s. This was
previously timing out in CI (took more than 2 minutes) so should see
a bigger gap in the CI.

PR-URL: https://github.com/nodejs/node/pull/49492
Refs: https://github.com/nodejs/node/issues/49202
Refs: https://github.com/nodejs/reliability/issues/655
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-11-15 11:15:44 +01:00
Dominique Leuenberger 7606921e1d test: fix testsuite against zlib version 1.3
In the past, zlib versions had major.minor.micro formats, but with 1.3
this has been changed.

Change the test code to accept one, two, or three elements past the
major version.

PR-URL: https://github.com/nodejs/node/pull/50364
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-11-15 11:13:51 +01:00
翠 / green 17246be158 lib: add api to detect whether source-maps are enabled
Add `process.sourceMapsEnabled` to detect
whether source-maps are enabled.

Fixes: https://github.com/nodejs/node/issues/46304
PR-URL: https://github.com/nodejs/node/pull/46391
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-11-15 10:34:11 +01:00
Hemanth HM bbafd42d75 repl: display dynamic import variant in static import error messages
Enhance the REPL message for static import error message.

```
> import {foo, bar} from 'moo';
import {foo, bar} from 'moo';
^^^^^^

Uncaught:
SyntaxError: .* dynamic import: const {foo,bar} = await import('moo');
```

PR-URL: https://github.com/nodejs/node/pull/48129
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-10 16:21:46 +01:00
Joyee Cheung cf9ddcd6c8 bootstrap: simplify initialization of source map handlers
- Move the initialization of process.setSourceMapsEnabled
  and the maybeCacheGeneratedSourceMap callback to
  bootstrap/node.js so they are included in the snapshot.
- Simplify the handling of --enable-source-maps by explicitly
  calling setSourceMapsEnabled() during pre-execution.

PR-URL: https://github.com/nodejs/node/pull/48304
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-11-10 16:21:46 +01:00
Jithil P Ponnan cc7bf1f641 src: add cjs_module_lexer_version base64_version
src: add cjs_module_lexer_version base64_version
PR-URL: https://github.com/nodejs/node/pull/45629
Refs: https://github.com/nodejs/node/issues/45260
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-11-10 16:21:46 +01:00
Daniel Lemire 0a950c3752 src: add missing to_ascii method in dns queries
PR-URL: https://github.com/nodejs/node/pull/48354
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2023-11-10 16:21:45 +01:00