mirror of
https://github.com/electron/electron.git
synced 2026-01-09 07:28:12 -05:00
* chore: bump node in DEPS to v24.11.1
* src: add a default branch for module phase
https://github.com/nodejs/node/pull/60261
* src: conditionally disable source phase imports by default
https://github.com/nodejs/node/pull/60364
* chore: update patches
* src: update locks to use DictionaryTemplate and other minor cleanups
https://github.com/nodejs/node/pull/60061
* deps: update simdjson to 4.0.7
https://github.com/nodejs/node/pull/59883
* test: move sea tests into test/sea
https://github.com/nodejs/node/pull/60250
* fixup deps: update simdjson to 4.0.7a
* src: conditionally disable source phase imports by default
https://github.com/nodejs/node/pull/60364
* module: handle null source from async loader hooks in sync hooks
https://github.com/nodejs/node/pull/59929
* Revert "src: conditionally disable source phase imports by default"
This reverts commit 5f85b84262.
* src: allow disabling JS source phase imports
https://github.com/nodejs/node/pull/60364
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
63 lines
2.4 KiB
Diff
63 lines
2.4 KiB
Diff
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
|
|
|
|
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
|
index 96869be3c48b84106a5fe2cb752fe979a211d96a..64f8902b1a3d5c335a3b8889b2dc801e8f9ec79c 100644
|
|
--- a/lib/internal/modules/esm/translators.js
|
|
+++ b/lib/internal/modules/esm/translators.js
|
|
@@ -404,6 +404,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
|
return { module, exportNames: module[kModuleExportNames] };
|
|
}
|
|
|
|
+ if (filename === 'electron') {
|
|
+ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) };
|
|
+ }
|
|
+
|
|
if (source === undefined) {
|
|
({ source } = loadSourceForCJSWithHooks(module, filename, format));
|
|
}
|
|
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
|
|
index d337eeca801b9c187d1513519d7faf27310dbc41..34025f0c2c984b1b9993709cbd00be4158ea1db3 100644
|
|
--- a/lib/internal/modules/run_main.js
|
|
+++ b/lib/internal/modules/run_main.js
|
|
@@ -2,6 +2,7 @@
|
|
|
|
const {
|
|
StringPrototypeEndsWith,
|
|
+ StringPrototypeStartsWith,
|
|
globalThis,
|
|
} = primordials;
|
|
|
|
@@ -27,6 +28,13 @@ const {
|
|
* @returns {string|undefined}
|
|
*/
|
|
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;
|
|
+ }
|
|
+
|
|
/** @type {string} */
|
|
let mainPath;
|
|
// Extension searching for the main entry point is supported for backward compatibility.
|
|
@@ -50,6 +58,13 @@ function resolveMainPath(main) {
|
|
* @returns {boolean}
|
|
*/
|
|
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;
|
|
+ }
|
|
+
|
|
/**
|
|
* @type {string[]} userLoaders A list of custom loaders registered by the user
|
|
* (or an empty list when none have been registered).
|