Skip to content

Commit

Permalink
chore: update build_modify_js2c_py_to_allow_injection_of_original-fs_…
Browse files Browse the repository at this point in the history
…and_custom_embedder_js.patch

Xref: nodejs/node#46930

manually sync patch to minor upstream code shear
  • Loading branch information
ckerr committed Jul 25, 2023
1 parent 2de20eb commit 4c43c9e
Showing 1 changed file with 10 additions and 9 deletions.
Expand Up @@ -14,7 +14,7 @@ renderer/browser/worker/sandboxed bootstrap scripts). These are loaded
through LoadEmbedderJavaScriptSource()

diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js
index ce885c154c81c5703365fa34957697698da9aff6..229b0d522aeee3632145c86715bea1394d496bc4 100644
index ce885c154c..229b0d522a 100644
--- a/lib/internal/fs/watchers.js
+++ b/lib/internal/fs/watchers.js
@@ -293,11 +293,13 @@ function emitCloseNT(self) {
Expand All @@ -37,7 +37,7 @@ index ce885c154c81c5703365fa34957697698da9aff6..229b0d522aeee3632145c86715bea139
async function* watch(filename, options = kEmptyObject) {
const path = toNamespacedPath(getValidatedPath(filename));
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 40d9025746d3c39cf9ea27b6cffc8f2eb7e62c1e..d3a0dd7cedb0d239ae427d1af2335e155345a454 100644
index 2220869fa7..522670ed5c 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -33,6 +33,7 @@ BuiltinLoader BuiltinLoader::instance_;
Expand All @@ -49,7 +49,7 @@ index 40d9025746d3c39cf9ea27b6cffc8f2eb7e62c1e..d3a0dd7cedb0d239ae427d1af2335e15
AddExternalizedBuiltin(
"internal/deps/cjs-module-lexer/lexer",
diff --git a/src/node_builtins.h b/src/node_builtins.h
index 90b158b84bb2a66781cf92f5b4c1a64f9e2ee651..8d9f7c409659a30747e5feeac6cfec4208791370 100644
index 90b158b84b..8d9f7c4096 100644
--- a/src/node_builtins.h
+++ b/src/node_builtins.h
@@ -71,6 +71,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
Expand All @@ -61,7 +61,7 @@ index 90b158b84bb2a66781cf92f5b4c1a64f9e2ee651..8d9f7c409659a30747e5feeac6cfec42

std::vector<std::string> GetBuiltinIds();
diff --git a/tools/js2c.py b/tools/js2c.py
index ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb..ece70a8d7a1fdca051d4b821ba114be54bd34e4e 100755
index 54c7dfce36..7b99ae5e5e 100755
--- a/tools/js2c.py
+++ b/tools/js2c.py
@@ -39,6 +39,8 @@ import codecs
Expand Down Expand Up @@ -113,7 +113,7 @@ index ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb..ece70a8d7a1fdca051d4b821ba114be5
if split[0] == 'deps':
split = ['internal'] + split
else: # `lib/**/*.js` so drop the 'lib' part
@@ -142,23 +148,36 @@ def NormalizeFileName(filename):
@@ -134,23 +140,36 @@ def NormalizeFileName(filename):
return os.path.splitext(filename)[0]


Expand Down Expand Up @@ -159,22 +159,23 @@ index ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb..ece70a8d7a1fdca051d4b821ba114be5
write_if_chaged(out, target)


@@ -218,6 +237,7 @@ def main():
@@ -214,6 +233,7 @@ def main():
default=None,
help='input file directory')
help='root directory containing the sources')
parser.add_argument('--verbose', action='store_true', help='output file')
+ parser.add_argument('--only-js', action='store_true', help='do not require or parse any config.gypi files')
parser.add_argument('sources', nargs='*', help='input files')
options = parser.parse_args()
global is_verbose
@@ -230,12 +250,15 @@ def main():
@@ -230,13 +250,15 @@ def main():

source_files = functools.reduce(SourceFileByExt, sources, {})

- # Should have exactly 3 types: `.js`, `.mjs` and `.gypi`
- assert len(source_files) == 3
- # Currently config.gypi is the only `.gypi` file allowed
- assert source_files['.gypi'] == ['config.gypi']
- assert len(source_files['.gypi']) == 1
- assert os.path.basename(source_files['.gypi'][0]) == 'config.gypi'
- source_files['config.gypi'] = source_files.pop('.gypi')[0]
- JS2C(source_files, options.target)
+ if options.only_js:
Expand Down

0 comments on commit 4c43c9e

Please sign in to comment.