electron/patches/node/fix_do_not_resolve_electron_entrypoints.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Wed, 26 Jul 2023 17:03:15 -0700
Subject: fix: do not resolve electron entrypoints
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
chore: bump node to v20.11.0 (main) (#40941) * chore: bump node in DEPS to v20.11.0 * module: bootstrap module loaders in shadow realm https://github.com/nodejs/node/pull/48655 * src: add commit hash shorthand in zlib version https://github.com/nodejs/node/pull/50158 * v8,tools: expose necessary V8 defines https://github.com/nodejs/node/pull/50820 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * esm: fallback to readFileSync when source is nullish https://github.com/nodejs/node/pull/50825 * vm: allow dynamic import with a referrer realm https://github.com/nodejs/node/pull/50360 * test: skip test-diagnostics-channel-memory-leak.js https://github.com/nodejs/node/pull/50327 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * lib: fix assert throwing different error messages in ESM and CJS https://github.com/nodejs/node/pull/50634 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * deps: update base64 to 0.5.1 https://github.com/nodejs/node/pull/50629 * src: avoid silent coercion to signed/unsigned int https://github.com/nodejs/node/pull/50663 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * chore: fix patch indices * chore: update patches * test: disable TLS cipher test This can't be enabled owing to BoringSSL incompatibilities. https://github.com/nodejs/node/pull/50186 * fix: check for Buffer and global definition in shadow realm https://github.com/nodejs/node/pull/51239 * test: disable parallel/test-shadow-realm-custom-loader Incompatible with our asar logic, resulting in the following failure: > Failed to CompileAndCall electron script: electron/js2c/asar_bundle * chore: remove deleted parallel/test-crypto-modp1-error test * test: make test-node-output-v8-warning generic https://github.com/nodejs/node/pull/50421 * chore: fixup ModuleWrap patch * test: match wpt/streams/transferable/transform-stream-members.any.js to upstream * fix: sandbox is not enabled on arm * chore: disable v8 sandbox on ia32/arm --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2024-01-18 21:16:45 +00:00
index 449131b9af99744c08d62d73f8d124cef5c9cc71..3df06eff63106aece1009d88fd01df2abdf6d943 100644
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
chore: bump node to v20.11.0 (main) (#40941) * chore: bump node in DEPS to v20.11.0 * module: bootstrap module loaders in shadow realm https://github.com/nodejs/node/pull/48655 * src: add commit hash shorthand in zlib version https://github.com/nodejs/node/pull/50158 * v8,tools: expose necessary V8 defines https://github.com/nodejs/node/pull/50820 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * esm: fallback to readFileSync when source is nullish https://github.com/nodejs/node/pull/50825 * vm: allow dynamic import with a referrer realm https://github.com/nodejs/node/pull/50360 * test: skip test-diagnostics-channel-memory-leak.js https://github.com/nodejs/node/pull/50327 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * lib: fix assert throwing different error messages in ESM and CJS https://github.com/nodejs/node/pull/50634 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * deps: update base64 to 0.5.1 https://github.com/nodejs/node/pull/50629 * src: avoid silent coercion to signed/unsigned int https://github.com/nodejs/node/pull/50663 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * chore: fix patch indices * chore: update patches * test: disable TLS cipher test This can't be enabled owing to BoringSSL incompatibilities. https://github.com/nodejs/node/pull/50186 * fix: check for Buffer and global definition in shadow realm https://github.com/nodejs/node/pull/51239 * test: disable parallel/test-shadow-realm-custom-loader Incompatible with our asar logic, resulting in the following failure: > Failed to CompileAndCall electron script: electron/js2c/asar_bundle * chore: remove deleted parallel/test-crypto-modp1-error test * test: make test-node-output-v8-warning generic https://github.com/nodejs/node/pull/50421 * chore: fixup ModuleWrap patch * test: match wpt/streams/transferable/transform-stream-members.any.js to upstream * fix: sandbox is not enabled on arm * chore: disable v8 sandbox on ia32/arm --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2024-01-18 21:16:45 +00:00
@@ -132,7 +132,7 @@ async function defaultLoad(url, context = kEmptyObject) {
source = null;
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
format ??= 'builtin';
chore: bump node to v20.11.0 (main) (#40941) * chore: bump node in DEPS to v20.11.0 * module: bootstrap module loaders in shadow realm https://github.com/nodejs/node/pull/48655 * src: add commit hash shorthand in zlib version https://github.com/nodejs/node/pull/50158 * v8,tools: expose necessary V8 defines https://github.com/nodejs/node/pull/50820 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * esm: fallback to readFileSync when source is nullish https://github.com/nodejs/node/pull/50825 * vm: allow dynamic import with a referrer realm https://github.com/nodejs/node/pull/50360 * test: skip test-diagnostics-channel-memory-leak.js https://github.com/nodejs/node/pull/50327 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * lib: fix assert throwing different error messages in ESM and CJS https://github.com/nodejs/node/pull/50634 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * deps: update base64 to 0.5.1 https://github.com/nodejs/node/pull/50629 * src: avoid silent coercion to signed/unsigned int https://github.com/nodejs/node/pull/50663 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * chore: fix patch indices * chore: update patches * test: disable TLS cipher test This can't be enabled owing to BoringSSL incompatibilities. https://github.com/nodejs/node/pull/50186 * fix: check for Buffer and global definition in shadow realm https://github.com/nodejs/node/pull/51239 * test: disable parallel/test-shadow-realm-custom-loader Incompatible with our asar logic, resulting in the following failure: > Failed to CompileAndCall electron script: electron/js2c/asar_bundle * chore: remove deleted parallel/test-crypto-modp1-error test * test: make test-node-output-v8-warning generic https://github.com/nodejs/node/pull/50421 * chore: fixup ModuleWrap patch * test: match wpt/streams/transferable/transform-stream-members.any.js to upstream * fix: sandbox is not enabled on arm * chore: disable v8 sandbox on ia32/arm --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2024-01-18 21:16:45 +00:00
} else if (format !== 'commonjs' || defaultType === 'module') {
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
- if (source == null) {
+ if (format !== 'electron' && source == null) {
({ responseURL, source } = await getSource(urlInstance, context));
chore: bump node to v20.11.0 (main) (#40941) * chore: bump node in DEPS to v20.11.0 * module: bootstrap module loaders in shadow realm https://github.com/nodejs/node/pull/48655 * src: add commit hash shorthand in zlib version https://github.com/nodejs/node/pull/50158 * v8,tools: expose necessary V8 defines https://github.com/nodejs/node/pull/50820 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * esm: fallback to readFileSync when source is nullish https://github.com/nodejs/node/pull/50825 * vm: allow dynamic import with a referrer realm https://github.com/nodejs/node/pull/50360 * test: skip test-diagnostics-channel-memory-leak.js https://github.com/nodejs/node/pull/50327 * esm: do not call getSource when format is commonjs https://github.com/nodejs/node/pull/50465 * lib: fix assert throwing different error messages in ESM and CJS https://github.com/nodejs/node/pull/50634 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * deps: update base64 to 0.5.1 https://github.com/nodejs/node/pull/50629 * src: avoid silent coercion to signed/unsigned int https://github.com/nodejs/node/pull/50663 * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * chore: fix patch indices * chore: update patches * test: disable TLS cipher test This can't be enabled owing to BoringSSL incompatibilities. https://github.com/nodejs/node/pull/50186 * fix: check for Buffer and global definition in shadow realm https://github.com/nodejs/node/pull/51239 * test: disable parallel/test-shadow-realm-custom-loader Incompatible with our asar logic, resulting in the following failure: > Failed to CompileAndCall electron script: electron/js2c/asar_bundle * chore: remove deleted parallel/test-crypto-modp1-error test * test: make test-node-output-v8-warning generic https://github.com/nodejs/node/pull/50421 * chore: fixup ModuleWrap patch * test: match wpt/streams/transferable/transform-stream-members.any.js to upstream * fix: sandbox is not enabled on arm * chore: disable v8 sandbox on ia32/arm --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2024-01-18 21:16:45 +00:00
context = { __proto__: context, source };
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
}
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 4831f3678cde9b4edad04922932c8239a7908a04..e364c76e2eccafdd795544cb224e43f3df456fbb 100644
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -397,6 +397,9 @@ function cjsPreparseModuleExports(filename, source) {
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
if (cached) {
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
return { module, exportNames: cached.exportNames };
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
}
+ if (filename === 'electron') {
+ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) };
+ }
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
}
const loaded = Boolean(module);
if (!loaded) {
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
index 1f03c313121db054ff824d07e57c57c749005497..2c8aa6461497f39062ec350ef8a063b9b0ac1edf 100644
--- a/lib/internal/modules/run_main.js
+++ b/lib/internal/modules/run_main.js
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
@@ -2,6 +2,7 @@
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
const {
StringPrototypeEndsWith,
+ StringPrototypeStartsWith,
} = primordials;
chore: upgrade to Node.js v20 (#40545) * chore: upgrade to Node.js v20 * src: allow embedders to override NODE_MODULE_VERSION https://github.com/nodejs/node/pull/49279 * src: fix missing trailing , https://github.com/nodejs/node/pull/46909 * src,tools: initialize cppgc https://github.com/nodejs/node/pull/45704 * tools: allow passing absolute path of config.gypi in js2c https://github.com/nodejs/node/pull/49162 * tools: port js2c.py to C++ https://github.com/nodejs/node/pull/46997 * doc,lib: disambiguate the old term, NativeModule https://github.com/nodejs/node/pull/45673 * chore: fixup Node.js BSSL tests * https://github.com/nodejs/node/pull/49492 * https://github.com/nodejs/node/pull/44498 * deps: upgrade to libuv 1.45.0 https://github.com/nodejs/node/pull/48078 * deps: update V8 to 10.7 https://github.com/nodejs/node/pull/44741 * test: use gcUntil() in test-v8-serialize-leak https://github.com/nodejs/node/pull/49168 * module: make CJS load from ESM loader https://github.com/nodejs/node/pull/47999 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * chore: address changes to CJS/ESM loading * module: make CJS load from ESM loader (https://github.com/nodejs/node/pull/47999) * lib: improve esm resolve performance (https://github.com/nodejs/node/pull/46652) * bootstrap: optimize modules loaded in the built-in snapshot https://github.com/nodejs/node/pull/45849 * test: mark test-runner-output as flaky https://github.com/nodejs/node/pull/49854 * lib: lazy-load deps in modules/run_main.js https://github.com/nodejs/node/pull/45849 * url: use private properties for brand check https://github.com/nodejs/node/pull/46904 * test: refactor `test-node-output-errors` https://github.com/nodejs/node/pull/48992 * assert: deprecate callTracker https://github.com/nodejs/node/pull/47740 * src: cast v8::Object::GetInternalField() return value to v8::Value https://github.com/nodejs/node/pull/48943 * test: adapt test-v8-stats for V8 update https://github.com/nodejs/node/pull/45230 * tls: ensure TLS Sockets are closed if the underlying wrap closes https://github.com/nodejs/node/pull/49327 * test: deflake test-tls-socket-close https://github.com/nodejs/node/pull/49575 * net: fix crash due to simultaneous close/shutdown on JS Stream Sockets https://github.com/nodejs/node/pull/49400 * net: use asserts in JS Socket Stream to catch races in future https://github.com/nodejs/node/pull/49400 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * src: create BaseObject with node::Realm https://github.com/nodejs/node/pull/44348 * src: implement DataQueue and non-memory resident Blob https://github.com/nodejs/node/pull/45258 * sea: add support for V8 bytecode-only caching https://github.com/nodejs/node/pull/48191 * chore: fixup patch indices * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * build: modify js2c.py into GN executable * fix: (WIP) handle string replacement of fs -> original-fs * [v20.x] backport vm-related memory fixes https://github.com/nodejs/node/pull/49874 * src: make BuiltinLoader threadsafe and non-global https://github.com/nodejs/node/pull/45942 * src: avoid copying string in fs_permission https://github.com/nodejs/node/pull/47746 * look upon my works ye mighty and dispair * chore: patch cleanup * [api] Remove AllCan Read/Write https://chromium-review.googlesource.com/c/v8/v8/+/5006387 * fix: missing include for NODE_EXTERN * chore: fixup patch indices * fix: fail properly when js2c fails in Node.js * build: fix js2c root_gen_dir * fix: lib/fs.js -> lib/original-fs.js * build: fix original-fs file xforms * fixup! module: make CJS load from ESM loader * build: get rid of CppHeap for now * build: add patch to prevent extra fs lookup on esm load * build: greatly simplify js2c modifications Moves our original-fs modifications back into a super simple python script action, wires up the output of that action into our call to js2c * chore: update to handle moved internal/modules/helpers file * test: update @types/node test * feat: enable preventing cppgc heap creation * feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler * fix: no cppgc initialization in the renderer * gyp: put filenames in variables https://github.com/nodejs/node/pull/46965 * test: disable single executable tests * fix: nan tests failing on node headers missing file * tls,http2: send fatal alert on ALPN mismatch https://github.com/nodejs/node/pull/44031 * test: disable snapshot tests * https://github.com/nodejs/node/pull/47887 * https://github.com/nodejs/node/pull/49684 * https://github.com/nodejs/node/pull/44193 * build: use deps/v8 for v8/tools Node.js hard depends on these in their builtins * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * build: remove js2c //base dep * build: use electron_js2c_toolchain to build node_js2c * fix: don't create SafeSet outside packageResolve Fixes failure in parallel/test-require-delete-array-iterator: === release test-require-delete-array-iterator === Path: parallel/test-require-delete-array-iterator node:internal/per_context/primordials:426 constructor(i) { super(i); } // eslint-disable-line no-useless-constructor ^ TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) at new Set (<anonymous>) at new SafeSet (node:internal/per_context/primordials:426:22) * fix: failing crashReporter tests on Linux These were failing because our change from node::InitializeNodeWithArgs to node::InitializeOncePerProcess meant that we now inadvertently called PlatformInit, which reset signal handling. This meant that our intentional crash function ElectronBindings::Crash no longer worked and the renderer process no longer crashed when process.crash() was called. We don't want to use Node.js' default signal handling in the renderer process, so we disable it by passing kNoDefaultSignalHandling to node::InitializeOncePerProcess. * build: only create cppgc heap on non-32 bit platforms * chore: clean up util:CompileAndCall * src: fix compatility with upcoming V8 12.1 APIs https://github.com/nodejs/node/pull/50709 * fix: use thread_local BuiltinLoader * chore: fixup v8 patch indices --------- Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-11-30 14:51:35 +00:00
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
const { containsModuleSyntax } = internalBinding('contextify');
@@ -13,6 +14,13 @@ const path = require('path');
* @param {string} main - Entry point path
*/
function resolveMainPath(main) {
+ // For built-in modules used as the main entry point we _never_
+ // want to waste cycles resolving them to file paths on disk
+ // that actually might exist
+ if (typeof main === 'string' && StringPrototypeStartsWith(main, 'electron/js2c')) {
+ return main;
+ }
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
+
const defaultType = getOptionValue('--experimental-default-type');
/** @type {string} */
let mainPath;
@@ -50,6 +58,13 @@ function resolveMainPath(main) {
* @param {string} mainPath - Absolute path to the main entry point
*/
function shouldUseESMLoader(mainPath) {
+ // For built-in modules used as the main entry point we _never_
+ // want to waste cycles resolving them to file paths on disk
+ // that actually might exist
+ if (typeof mainPath === 'string' && StringPrototypeStartsWith(mainPath, 'electron/js2c')) {
+ return false;
+ }
chore: bump node to v20.10.0 (main) (#40675) * chore: bump node in DEPS to v20.10.0 * chore: update feat_initialize_asar_support.patch no code changes; patch just needed an update due to nearby upstream changes Xref: https://github.com/nodejs/node/pull/49986 * chore: update pass_all_globals_through_require.patch no manual changes; patch applied with fuzz Xref: https://github.com/nodejs/node/pull/49657 * chore: update refactor_allow_embedder_overriding_of_internal_fs_calls Xref: https://github.com/nodejs/node/pull/49912 no code changes; patch just needed an update due to nearby upstream changes * chore: update chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch Xref: https://github.com/nodejs/node/pull/49986 minor manual changes needed to sync with upstream change * update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/50096 Xref: https://github.com/nodejs/node/pull/50314 in lib/internal/modules/esm/load.js, update the code that checks for `format === 'electron'`. I'd like 👀 on this Xref: https://github.com/nodejs/node/pull/49657 add braces in lib/internal/modules/esm/translators.js to sync with upstream * fix: lazyload fs in esm loaders to apply asar patches * https://github.com/nodejs/node/pull/50127 * https://github.com/nodejs/node/pull/50096 * esm: jsdoc for modules code https://github.com/nodejs/node/pull/49523 * test: set test-cli-node-options as flaky https://github.com/nodejs/node/pull/50296 * deps: update c-ares to 1.20.1 https://github.com/nodejs/node/pull/50082 * esm: bypass CommonJS loader under --default-type=module https://github.com/nodejs/node/pull/49986 * deps: update uvwasi to 0.0.19 https://github.com/nodejs/node/pull/49908 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * crypto: account for disabled SharedArrayBuffer https://github.com/nodejs/node/pull/50034 * test: fix edge snapshot stack traces https://github.com/nodejs/node/pull/49659 * src: generate snapshot with --predictable https://github.com/nodejs/node/pull/48749 * chore: fixup patch indices * fs: throw errors from sync branches instead of separate implementations https://github.com/nodejs/node/pull/49913 * crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey https://github.com/nodejs/node/pull/50234 * esm: detect ESM syntax in ambiguous JavaScrip https://github.com/nodejs/node/pull/50096 * fixup! test: fix edge snapshot stack traces * esm: unflag extensionless ES module JavaScript and Wasm in module scope https://github.com/nodejs/node/pull/49974 * [tagged-ptr] Arrowify objects https://chromium-review.googlesource.com/c/v8/v8/+/4705331 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-12-11 20:09:50 +00:00
+
if (getOptionValue('--experimental-default-type') === 'module') { return true; }
/**