@yao-pkg/pkg-fetch 3.5.9 → 3.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,26 +21,36 @@
21
21
  "node-v16.20.2-win-arm64": "7514915e02aedfbdc9f87ede04f1f251b014e312e3e184d5b94b42aeb28c2485",
22
22
  "node-v16.20.2-win-x64": "272729724993ce07b37d328718a0152e50ec5c9d27aa972975c09b75604c0dca",
23
23
  "node-v16.20.2-macos-arm64": "3d04eb7ddd8b614b888eeb1caa6e64a068b665ab4a26dd064051973ae5842a85",
24
- "node-v18.19.1-alpine-arm64": "4ccad264048542197eaf3ccc226c55438caf27a6f285bd6f0fb07c26b654b7fa",
25
- "node-v18.19.1-alpine-x64": "93282b4dbedaa11b0841da09a2d51443fc5584e2fee0439fce02168cf06d75e8",
26
- "node-v18.19.1-linux-arm64": "478a45fff4c19364cca2346fd0370318f74ac07d08377bf67f3f5b0f3294e1d3",
27
- "node-v18.19.1-linux-x64": "a07fe1e4bb5f2a2476f75e57b3ced58b3ceee09338ac1994278ffc9b6ef3a954",
28
- "node-v18.19.1-linuxstatic-arm64": "b82e678fcdcc0edd6013ddad95e972f01e45b3fcf53d728cce489e5140efeddc",
29
- "node-v18.19.1-linuxstatic-armv7": "4ad324a6df121eb75f5662ca2f5635e494a6410413b4fba84cfbc4d5012a08f0",
30
- "node-v18.19.1-linuxstatic-x64": "8d84787aa834a7388382edb1b0d56730e96820b86fa677b807d7670b739b81a5",
31
- "node-v18.19.1-macos-arm64": "75cd919f0614530192848b029f30d5d4b06ff1e4f1d0a0fbf01531442705622d",
32
- "node-v18.19.1-macos-x64": "3dc07964ea5491a881bb5093c38778fcd1b9d9097a5db8206551698ef5b46e72",
33
- "node-v18.19.1-win-arm64": "25bed45ec140abbe68f0bb3ba3cfb46492e6b9fba39232037ad51ad6611bdc9a",
34
- "node-v18.19.1-win-x64": "b50fc3ecbd5de034bb298c47ef4e468c6ed3fbfc5abb7264c732231d8f325e2e",
35
- "node-v20.11.1-alpine-arm64": "8403031e9fd2bef2624c31ac946b61aad7687bbc6b7c28f520a40ec36045535b",
36
- "node-v20.11.1-alpine-x64": "824c0801a248c47974bf791dd15ccdb3505f69d71525582fad6c83252d2723b9",
37
- "node-v20.11.1-linux-arm64": "2ddd236d5a7aa0b6c032f3fcec3ecbb963227e7f3e2fe1a8320a2425d12e44b8",
38
- "node-v20.11.1-linux-x64": "0f065bb2ccfdedaa7889e04604516604c2d0c0a0d9d13869578a6b3916b9a93e",
39
- "node-v20.11.1-linuxstatic-arm64": "81476485a963d19d089fcdaca14139ae66be22e09298095e0da2ea4683ccbc3c",
40
- "node-v20.11.1-linuxstatic-armv7": "bfed657d5b15558b081e68f3577f1830de582d184628c0dfcabbab691e0ed310",
41
- "node-v20.11.1-linuxstatic-x64": "5bc1721f48b10b2f1e18a55a8692023adb3d3bfd8c8c2dff17b710b54543f357",
42
- "node-v20.11.1-macos-arm64": "1fa7f9e233820cfc5668ba21b70c463214f981fc69f1b8175b25dfa871451e26",
43
- "node-v20.11.1-macos-x64": "1558a49dfea01ae42702a71eaa1c7a6479abde8b2778bc7cb4f9a65d65a0afa6",
44
- "node-v20.11.1-win-arm64": "b99c38987104b066fbdc5e1c121fc8386217eeea7ffcadc7ec035532e7ea9789",
45
- "node-v20.11.1-win-x64": "140c377c2c91751832e673cb488724cbd003f01aa237615142cd2907f34fa1a2"
24
+ "node-v18.20.4-alpine-arm64": "86e3e659e02e6197a0cf42474f4abf3965ded46f8cf9e3b7a9b232c977b154c7",
25
+ "node-v18.20.4-alpine-x64": "d5d0f46cfc0387ebd7772c4b200b0a0df1a33426f0025568f2fd0e3145a1f03c",
26
+ "node-v18.20.4-linux-arm64": "6d5cab68b470cb2451c76ced34866f255ef8216c6f51c0a09e143d29f1bf743d",
27
+ "node-v18.20.4-linux-x64": "fc4a2d84782493525d34c9c1288ed90a44db26001fd3746e6446e6fa385f8084",
28
+ "node-v18.20.4-linuxstatic-arm64": "69832ff23792e0eae34158231179639c227bdc33ea8ad66272fafb7d8fa7f907",
29
+ "node-v18.20.4-linuxstatic-armv7": "256b885167bc43c37b04343b31ee081e6e8021cd698706361085563dff80d15d",
30
+ "node-v18.20.4-linuxstatic-x64": "d4ae1354280d6612f720e5654b33efe94b5c3d503ac12ea643738927f655ff53",
31
+ "node-v18.20.4-macos-arm64": "c94ba6e603222f032b1afbc4fc46556ad6a8f0eb777ddd2e38b424c91b09adb9",
32
+ "node-v18.20.4-macos-x64": "8ebc5bd8c21632bc79b5469d0b7dbbee9209214d9deee9aa1d84d0990c7e8464",
33
+ "node-v18.20.4-win-arm64": "01227a811847179a943392a41cc75084d08c21e049278190eebd98cdc6bcc4e0",
34
+ "node-v18.20.4-win-x64": "53196be55b5c4f5362f04eb3a34692263df8e65d756506176269a967f5e9face",
35
+ "node-v20.17.0-alpine-arm64": "764e4ed9b1fc68e9932a98b16ab9f2576de099ac7ad0d230353fe2698ab2d998",
36
+ "node-v20.17.0-alpine-x64": "240ffbc13fa0cb9b1560bd87113ba035e70b9d1f7562e54c026df8c1f092cc3b",
37
+ "node-v20.17.0-linux-arm64": "173d940455d7bd02d75be5aaaca1b313cf498257817b96300a3a7d7b6ca769a8",
38
+ "node-v20.17.0-linux-x64": "f6b00290bbcd9f9a4cc35cc469ddf21e60ba7d58d3d01962fef7f6057ba7fa3c",
39
+ "node-v20.17.0-linuxstatic-arm64": "35353d9fff4a884954fa1da9412dc2348a9d5432964cb7bdda8d397b034d7a4a",
40
+ "node-v20.17.0-linuxstatic-armv7": "5c8a3d46c7b2362afc1f323f3f2ee9c101c4fd02fea4a4ae1ea426a8ab24f246",
41
+ "node-v20.17.0-linuxstatic-x64": "bdabc37d146119e0697f7ce6a18fc3c51c3634241522f3e7bf62c082594c352b",
42
+ "node-v20.17.0-macos-arm64": "2e59df5e88c90f1457fd89abcea47fa0f2b7c66cbf93116d0ab3e5b29c87bc5f",
43
+ "node-v20.17.0-macos-x64": "cb37f44c3cdc12fe6e2e6b461cfdacba35177426bd8ab85f39e4c3d279fca11b",
44
+ "node-v20.17.0-win-arm64": "9769ad72c8ab0f6b1705c9bffb03585044a917511a30d74c68205b7923ff9fa2",
45
+ "node-v20.17.0-win-x64": "9c15a64b3babd2e7cd6c0cb1770495c331bea6df4544df92f734a23cc55bc1bf",
46
+ "node-v22.8.0-alpine-arm64": "ef3970e833cd66b05874e971c36ec4c7599727abfd62b35b268b1813c93545f0",
47
+ "node-v22.8.0-alpine-x64": "b7def0565556b6772b25d00ef80431e7801fb8e1df2a1a5a7c5b1d190a7b4475",
48
+ "node-v22.8.0-linux-arm64": "63d71da9bf16ce51f329667d60b17c6de1fc8c0e09202ccb992426cdaf52aa9f",
49
+ "node-v22.8.0-linux-x64": "bfa58557605fd0056001bc179a16ca7c6ee541e185f4c39cd2ff50b466bd2ac7",
50
+ "node-v22.8.0-linuxstatic-arm64": "4f8cee723c5951c3dc7352f88c1a68e43575f0c5af9e47916114aad409849b69",
51
+ "node-v22.8.0-linuxstatic-armv7": "17b81975a64fd03b1bc64fe9b1d924f68cb96e1c6a2cb3b48178c77761b4b56f",
52
+ "node-v22.8.0-linuxstatic-x64": "10fce22c1481a68f47a9a03a694f4d9abbd7cef3f33e744a9c609253695288c7",
53
+ "node-v22.8.0-macos-x64": "d9970ffebac736af31485d128cec1dc98ed96b1e49ce4f7e5d74ef19ac913627",
54
+ "node-v22.8.0-win-arm64": "817e57d49fa9e8b7787ea972f6942f9d3dfc80c81ec169d25d7d0fa4abb402c1",
55
+ "node-v22.8.0-win-x64": "be5dc1b1928d9d63ccb7c7fc1c6db245cf205b2d733ee0196f10e29f14239211"
46
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yao-pkg/pkg-fetch",
3
- "version": "3.5.9",
3
+ "version": "3.5.11",
4
4
  "description": "Compiles and stores base binaries for pkg",
5
5
  "main": "lib-es5/index.js",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index dba2631f21..4c4c430dc1 100644
2
+ index ec92c9df4c..8c1e94fca2 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
5
  @@ -174,7 +174,7 @@
@@ -12,7 +12,7 @@ index dba2631f21..4c4c430dc1 100644
12
12
  'lto': ' -flto ', # Clang
13
13
  }],
14
14
  diff --git node/configure.py node/configure.py
15
- index 4638f04b6a..ffa1c6338a 100755
15
+ index 82916748fd..59575698b5 100755
16
16
  --- node/configure.py
17
17
  +++ node/configure.py
18
18
  @@ -1289,9 +1289,7 @@ def configure_node(o):
@@ -41,7 +41,7 @@ index 3d59c73f7c..00b2de4524 100644
41
41
  static const char* GetVersion();
42
42
 
43
43
  diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
44
- index 8d224bea2e..8402afc0fb 100644
44
+ index 3b1a81680b..f49f824cfd 100644
45
45
  --- node/deps/v8/src/api/api.cc
46
46
  +++ node/deps/v8/src/api/api.cc
47
47
  @@ -709,6 +709,29 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
@@ -237,10 +237,10 @@ index 0000000000..a697294fdf
237
237
  + }());
238
238
  +}());
239
239
  diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
240
- index 316996a8c3..8cd0727556 100644
240
+ index 69473df97e..efbd05066d 100644
241
241
  --- node/lib/internal/modules/cjs/loader.js
242
242
  +++ node/lib/internal/modules/cjs/loader.js
243
- @@ -89,7 +89,7 @@ const { internalCompileFunction } = require('internal/vm');
243
+ @@ -95,7 +95,7 @@ const {
244
244
  const assert = require('internal/assert');
245
245
  const fs = require('fs');
246
246
  const path = require('path');
@@ -382,11 +382,25 @@ index 4795be82e7..977124a014 100644
382
382
  const {
383
383
  Module: {
384
384
  _preloadModules,
385
+ diff --git node/lib/internal/vm.js node/lib/internal/vm.js
386
+ index 624e6825b8..fee9d341f2 100644
387
+ --- node/lib/internal/vm.js
388
+ +++ node/lib/internal/vm.js
389
+ @@ -126,7 +126,8 @@ function makeContextifyScript(code,
390
+ cachedData,
391
+ produceCachedData,
392
+ parsingContext,
393
+ - hostDefinedOptionId);
394
+ + hostDefinedOptionId,
395
+ + false);
396
+ } catch (e) {
397
+ throw e; /* node-do-not-add-exception-line */
398
+ }
385
399
  diff --git node/lib/vm.js node/lib/vm.js
386
- index b48e79c282..3b86fa8933 100644
400
+ index 6bea7e5e74..575a5527d9 100644
387
401
  --- node/lib/vm.js
388
402
  +++ node/lib/vm.js
389
- @@ -77,6 +77,7 @@ class Script extends ContextifyScript {
403
+ @@ -80,6 +80,7 @@ class Script extends ContextifyScript {
390
404
  produceCachedData = false,
391
405
  importModuleDynamically,
392
406
  [kParsingContext]: parsingContext,
@@ -394,12 +408,12 @@ index b48e79c282..3b86fa8933 100644
394
408
  } = options;
395
409
 
396
410
  validateString(filename, 'options.filename');
397
- @@ -97,7 +98,8 @@ class Script extends ContextifyScript {
398
- columnOffset,
411
+ @@ -103,7 +104,8 @@ class Script extends ContextifyScript {
399
412
  cachedData,
400
413
  produceCachedData,
401
- - parsingContext);
402
- + parsingContext,
414
+ parsingContext,
415
+ - hostDefinedOptionId);
416
+ + hostDefinedOptionId,
403
417
  + sourceless);
404
418
  } catch (e) {
405
419
  throw e; /* node-do-not-add-exception-line */
@@ -432,7 +446,7 @@ index b1ba86b7b0..e2478e537c 100644
432
446
  parent_env_->AddCleanupHook([](void* data) {
433
447
  Environment* env = static_cast<Environment*>(data);
434
448
  diff --git node/src/node.cc node/src/node.cc
435
- index 0c75b5a08e..385a03090f 100644
449
+ index 367d47325b..5e3cd94124 100644
436
450
  --- node/src/node.cc
437
451
  +++ node/src/node.cc
438
452
  @@ -304,6 +304,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -460,40 +474,45 @@ index 0c75b5a08e..385a03090f 100644
460
474
  }
461
475
 
462
476
  diff --git node/src/node_contextify.cc node/src/node_contextify.cc
463
- index 3da8746e2c..ff60588e77 100644
477
+ index 65a7acbcfb..160784d64c 100644
464
478
  --- node/src/node_contextify.cc
465
479
  +++ node/src/node_contextify.cc
466
- @@ -75,6 +75,7 @@ using v8::ScriptOrigin;
467
- using v8::String;
480
+ @@ -75,6 +75,7 @@ using v8::String;
481
+ using v8::Symbol;
468
482
  using v8::Uint32;
469
483
  using v8::UnboundScript;
470
484
  +using v8::V8;
471
485
  using v8::Value;
472
486
  using v8::WeakCallbackInfo;
473
- using v8::WeakCallbackType;
474
- @@ -787,11 +788,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
487
+
488
+ @@ -786,13 +787,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
475
489
  Local<ArrayBufferView> cached_data_buf;
476
490
  bool produce_cached_data = false;
477
491
  Local<Context> parsing_context = context;
478
492
  + bool sourceless = false;
479
493
 
494
+ Local<Symbol> id_symbol;
480
495
  if (argc > 2) {
481
496
  // new ContextifyScript(code, filename, lineOffset, columnOffset,
482
- // cachedData, produceCachedData, parsingContext)
483
- - CHECK_EQ(argc, 7);
484
- + CHECK_EQ(argc, 8);
497
+ // cachedData, produceCachedData, parsingContext,
498
+ // hostDefinedOptionId)
499
+ - CHECK_EQ(argc, 8);
500
+ + CHECK_EQ(argc, 9);
485
501
  CHECK(args[2]->IsNumber());
486
502
  line_offset = args[2].As<Int32>()->Value();
487
503
  CHECK(args[3]->IsNumber());
488
- @@ -810,6 +812,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
504
+ @@ -811,8 +813,9 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
489
505
  CHECK_NOT_NULL(sandbox);
490
506
  parsing_context = sandbox->context();
491
507
  }
492
- + sourceless = args[7]->IsTrue();
508
+ - CHECK(args[7]->IsSymbol());
509
+ + CHECK(args[7]->IsSymbol());
510
+ id_symbol = args[7].As<Symbol>();
511
+ + sourceless = args[8]->IsTrue();
493
512
  }
494
513
 
495
514
  ContextifyScript* contextify_script =
496
- @@ -860,6 +863,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
515
+ @@ -861,6 +864,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
497
516
  ShouldNotAbortOnUncaughtScope no_abort_scope(env);
498
517
  Context::Scope scope(parsing_context);
499
518
 
@@ -504,21 +523,20 @@ index 3da8746e2c..ff60588e77 100644
504
523
  MaybeLocal<UnboundScript> maybe_v8_script =
505
524
  ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
506
525
 
507
- @@ -873,6 +880,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
526
+ @@ -874,7 +881,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
508
527
  "ContextifyScript::New");
509
528
  return;
510
529
  }
511
- +
512
- + if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
530
+ -
531
+ + if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
513
532
  + if (!source.GetCachedData()->rejected) {
514
533
  + V8::FixSourcelessScript(env->isolate(), v8_script);
515
534
  + }
516
535
  + }
517
- +
518
536
  contextify_script->script_.Reset(isolate, v8_script);
519
-
520
- std::unique_ptr<ScriptCompiler::CachedData> new_cached_data;
521
- @@ -897,6 +911,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
537
+ contextify_script->script_.SetWeak();
538
+ contextify_script->object()->SetInternalFieldForNodeCore(kUnboundScriptSlot,
539
+ @@ -908,6 +919,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
522
540
  .IsNothing())
523
541
  return;
524
542
 
@@ -1,8 +1,8 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index db09a8a33d..6b2053467d 100644
2
+ index 7c0b4a0851..064e453130 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
- @@ -182,7 +182,7 @@
5
+ @@ -184,7 +184,7 @@
6
6
  'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
7
7
  }],
8
8
  ['llvm_version=="0.0"', {
@@ -11,18 +11,6 @@ index db09a8a33d..6b2053467d 100644
11
11
  }, {
12
12
  'lto': ' -flto ', # Clang
13
13
  }],
14
- diff --git node/configure.py node/configure.py
15
- index 84b016cd85..3b31b09f04 100755
16
- --- node/configure.py
17
- +++ node/configure.py
18
- @@ -1275,7 +1275,6 @@ def configure_node(o):
19
-
20
- # Enable branch protection for arm64
21
- if target_arch == 'arm64':
22
- - o['cflags']+=['-msign-return-address=all']
23
- o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
24
-
25
- if options.node_snapshot_main is not None:
26
14
  diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
27
15
  index d3e35d6ec5..6e9bbe3849 100644
28
16
  --- node/deps/v8/include/v8-initialization.h
@@ -39,7 +27,7 @@ index d3e35d6ec5..6e9bbe3849 100644
39
27
  static const char* GetVersion();
40
28
 
41
29
  diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
42
- index a91dfc271c..a4cd4eeb31 100644
30
+ index a06394e6c1..154b7a82a8 100644
43
31
  --- node/deps/v8/src/api/api.cc
44
32
  +++ node/deps/v8/src/api/api.cc
45
33
  @@ -806,6 +806,28 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
@@ -164,7 +152,7 @@ index c83e8e4581..8cb451e147 100644
164
152
  uint32_t max_payload_length = this->size_ - kHeaderSize;
165
153
  if (payload_length > max_payload_length) {
166
154
  diff --git node/lib/child_process.js node/lib/child_process.js
167
- index 449013906e..3a85e4a541 100644
155
+ index 48870b35ad..d2aca054b2 100644
168
156
  --- node/lib/child_process.js
169
157
  +++ node/lib/child_process.js
170
158
  @@ -169,7 +169,7 @@ function fork(modulePath, args = [], options) {
@@ -232,10 +220,10 @@ index 0000000000..a697294fdf
232
220
  + }());
233
221
  +}());
234
222
  diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
235
- index b077ee386b..b4271b5951 100644
223
+ index c284b39b1a..ce38f028e4 100644
236
224
  --- node/lib/internal/modules/cjs/loader.js
237
225
  +++ node/lib/internal/modules/cjs/loader.js
238
- @@ -95,7 +95,7 @@ const { containsModuleSyntax } = internalBinding('contextify');
226
+ @@ -138,7 +138,7 @@ const {
239
227
  const assert = require('internal/assert');
240
228
  const fs = require('fs');
241
229
  const path = require('path');
@@ -258,10 +246,10 @@ index 88c079d10d..a7eaca0574 100644
258
246
  const permission = require('internal/process/permission');
259
247
  const { kEmptyObject } = require('internal/util');
260
248
  diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
261
- index cffffc28d3..679b9c3939 100644
249
+ index 59308ab817..35583f830a 100644
262
250
  --- node/lib/internal/process/pre_execution.js
263
251
  +++ node/lib/internal/process/pre_execution.js
264
- @@ -52,7 +52,11 @@ const {
252
+ @@ -51,7 +51,11 @@ const {
265
253
  },
266
254
  } = require('internal/v8/startup_snapshot');
267
255
 
@@ -273,7 +261,7 @@ index cffffc28d3..679b9c3939 100644
273
261
  return prepareExecution({
274
262
  expandArgv1,
275
263
  initializeModules,
276
- @@ -231,7 +235,8 @@ function patchProcessObject(expandArgv1) {
264
+ @@ -243,7 +247,8 @@ function patchProcessObject(expandArgv1) {
277
265
  // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
278
266
  // the entry point.
279
267
  if (expandArgv1 && process.argv[1] &&
@@ -283,7 +271,7 @@ index cffffc28d3..679b9c3939 100644
283
271
  // Expand process.argv[1] into a full path.
284
272
  const path = require('path');
285
273
  try {
286
- @@ -747,6 +752,7 @@ function loadPreloadModules() {
274
+ @@ -722,6 +727,7 @@ function loadPreloadModules() {
287
275
  // For user code, we preload modules if `-r` is passed
288
276
  const preloadModules = getOptionValue('--require');
289
277
  if (preloadModules && preloadModules.length > 0) {
@@ -292,10 +280,10 @@ index cffffc28d3..679b9c3939 100644
292
280
  Module: {
293
281
  _preloadModules,
294
282
  diff --git node/lib/vm.js node/lib/vm.js
295
- index 44861be46d..9775ef58b7 100644
283
+ index 34814c430d..db1f4779b6 100644
296
284
  --- node/lib/vm.js
297
285
  +++ node/lib/vm.js
298
- @@ -80,6 +80,7 @@ class Script extends ContextifyScript {
286
+ @@ -97,6 +97,7 @@ class Script extends ContextifyScript {
299
287
  produceCachedData = false,
300
288
  importModuleDynamically,
301
289
  [kParsingContext]: parsingContext,
@@ -303,7 +291,7 @@ index 44861be46d..9775ef58b7 100644
303
291
  } = options;
304
292
 
305
293
  validateString(filename, 'options.filename');
306
- @@ -103,7 +104,8 @@ class Script extends ContextifyScript {
294
+ @@ -120,7 +121,8 @@ class Script extends ContextifyScript {
307
295
  cachedData,
308
296
  produceCachedData,
309
297
  parsingContext,
@@ -314,23 +302,26 @@ index 44861be46d..9775ef58b7 100644
314
302
  throw e; /* node-do-not-add-exception-line */
315
303
  }
316
304
  diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
317
- index de372400fd..2538afa37d 100644
305
+ index 4cab7dea04..a1f0d51ab5 100644
318
306
  --- node/src/inspector_agent.cc
319
307
  +++ node/src/inspector_agent.cc
320
- @@ -707,8 +707,6 @@ bool Agent::Start(const std::string& path,
308
+ @@ -738,11 +738,6 @@ bool Agent::Start(const std::string& path,
321
309
  StartIoThreadAsyncCallback));
322
310
  uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
323
311
  start_io_thread_async.data = this;
324
- - // Ignore failure, SIGUSR1 won't work, but that should not block node start.
325
- - StartDebugSignalHandler();
312
+ - if (parent_env_->should_start_debug_signal_handler()) {
313
+ - // Ignore failure, SIGUSR1 won't work, but that should not block node
314
+ - // start.
315
+ - StartDebugSignalHandler();
316
+ - }
326
317
 
327
318
  parent_env_->AddCleanupHook([](void* data) {
328
319
  Environment* env = static_cast<Environment*>(data);
329
320
  diff --git node/src/node.cc node/src/node.cc
330
- index 524f80ee69..419cb95c4c 100644
321
+ index 9f6f8e53ab..ee8fa43f2f 100644
331
322
  --- node/src/node.cc
332
323
  +++ node/src/node.cc
333
- @@ -322,6 +322,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
324
+ @@ -377,6 +377,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
334
325
  return env->RunSnapshotDeserializeMain();
335
326
  }
336
327
 
@@ -339,7 +330,7 @@ index 524f80ee69..419cb95c4c 100644
339
330
  if (env->worker_context() != nullptr) {
340
331
  return StartExecution(env, "internal/main/worker_thread");
341
332
  }
342
- @@ -543,14 +545,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
333
+ @@ -601,14 +603,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
343
334
  }
344
335
 
345
336
  if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
@@ -355,10 +346,10 @@ index 524f80ee69..419cb95c4c 100644
355
346
  }
356
347
 
357
348
  diff --git node/src/node_contextify.cc node/src/node_contextify.cc
358
- index a68f6bb686..eab5eb9b8b 100644
349
+ index d873792ab9..588e53377d 100644
359
350
  --- node/src/node_contextify.cc
360
351
  +++ node/src/node_contextify.cc
361
- @@ -75,6 +75,7 @@ using v8::String;
352
+ @@ -76,6 +76,7 @@ using v8::String;
362
353
  using v8::Symbol;
363
354
  using v8::Uint32;
364
355
  using v8::UnboundScript;
@@ -366,7 +357,7 @@ index a68f6bb686..eab5eb9b8b 100644
366
357
  using v8::Value;
367
358
  using v8::WeakCallbackInfo;
368
359
 
369
- @@ -798,13 +799,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
360
+ @@ -789,13 +790,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
370
361
  Local<ArrayBufferView> cached_data_buf;
371
362
  bool produce_cached_data = false;
372
363
  Local<Context> parsing_context = context;
@@ -383,7 +374,7 @@ index a68f6bb686..eab5eb9b8b 100644
383
374
  CHECK(args[2]->IsNumber());
384
375
  line_offset = args[2].As<Int32>()->Value();
385
376
  CHECK(args[3]->IsNumber());
386
- @@ -825,6 +827,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
377
+ @@ -816,6 +818,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
387
378
  }
388
379
  CHECK(args[7]->IsSymbol());
389
380
  id_symbol = args[7].As<Symbol>();
@@ -394,7 +385,7 @@ index a68f6bb686..eab5eb9b8b 100644
394
385
  }
395
386
 
396
387
  ContextifyScript* contextify_script =
397
- @@ -873,6 +879,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
388
+ @@ -864,6 +870,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
398
389
  ShouldNotAbortOnUncaughtScope no_abort_scope(env);
399
390
  Context::Scope scope(parsing_context);
400
391
 
@@ -405,7 +396,7 @@ index a68f6bb686..eab5eb9b8b 100644
405
396
  MaybeLocal<UnboundScript> maybe_v8_script =
406
397
  ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
407
398
 
408
- @@ -887,6 +897,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
399
+ @@ -878,6 +888,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
409
400
  return;
410
401
  }
411
402
 
@@ -417,7 +408,7 @@ index a68f6bb686..eab5eb9b8b 100644
417
408
  contextify_script->script_.Reset(isolate, v8_script);
418
409
  contextify_script->script_.SetWeak();
419
410
  contextify_script->object()->SetInternalFieldForNodeCore(kUnboundScriptSlot,
420
- @@ -920,6 +935,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
411
+ @@ -911,6 +926,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
421
412
  .IsNothing())
422
413
  return;
423
414
 
@@ -539,10 +530,10 @@ index f66099a557..4048f6bd93 100644
539
530
  + return adjacent(c, nargv);
540
531
  +}
541
532
  diff --git node/src/node_options.cc node/src/node_options.cc
542
- index 5da6918af8..56c793ba96 100644
533
+ index e94e4dbc95..097ba01185 100644
543
534
  --- node/src/node_options.cc
544
535
  +++ node/src/node_options.cc
545
- @@ -302,6 +302,7 @@ void Parse(
536
+ @@ -307,6 +307,7 @@ void Parse(
546
537
  // TODO(addaleax): Make that unnecessary.
547
538
 
548
539
  DebugOptionsParser::DebugOptionsParser() {
@@ -0,0 +1,686 @@
1
+ diff --git node/common.gypi node/common.gypi
2
+ index a97e77860e..09444e795f 100644
3
+ --- node/common.gypi
4
+ +++ node/common.gypi
5
+ @@ -187,7 +187,7 @@
6
+ ['clang==1', {
7
+ 'lto': ' -flto ', # Clang
8
+ }, {
9
+ - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
10
+ + 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
11
+ }],
12
+ ],
13
+ },
14
+ diff --git node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
15
+ index 61a7d06cad..eeebf67796 100644
16
+ --- node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
17
+ +++ node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
18
+ @@ -33,17 +33,6 @@
19
+
20
+ #include "nghttp3_macro.h"
21
+
22
+ -#if defined(_MSC_VER) && !defined(__clang__) && \
23
+ - (defined(_M_ARM) || defined(_M_ARM64))
24
+ -unsigned int __popcnt(unsigned int x) {
25
+ - unsigned int c = 0;
26
+ - for (; x; ++c) {
27
+ - x &= x - 1;
28
+ - }
29
+ - return c;
30
+ -}
31
+ -#endif
32
+ -
33
+ int nghttp3_ringbuf_init(nghttp3_ringbuf *rb, size_t nmemb, size_t size,
34
+ const nghttp3_mem *mem) {
35
+ if (nmemb) {
36
+ diff --git node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
37
+ index c381c23127..6894bc2308 100644
38
+ --- node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
39
+ +++ node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
40
+ @@ -31,17 +31,6 @@
41
+
42
+ #include "ngtcp2_macro.h"
43
+
44
+ -#if defined(_MSC_VER) && !defined(__clang__) && \
45
+ - (defined(_M_ARM) || defined(_M_ARM64))
46
+ -static unsigned int __popcnt(unsigned int x) {
47
+ - unsigned int c = 0;
48
+ - for (; x; ++c) {
49
+ - x &= x - 1;
50
+ - }
51
+ - return c;
52
+ -}
53
+ -#endif
54
+ -
55
+ int ngtcp2_ringbuf_init(ngtcp2_ringbuf *rb, size_t nmemb, size_t size,
56
+ const ngtcp2_mem *mem) {
57
+ uint8_t *buf = ngtcp2_mem_malloc(mem, nmemb * size);
58
+ diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
59
+ index d3e35d6ec5..6e9bbe3849 100644
60
+ --- node/deps/v8/include/v8-initialization.h
61
+ +++ node/deps/v8/include/v8-initialization.h
62
+ @@ -89,6 +89,10 @@ class V8_EXPORT V8 {
63
+ static void SetFlagsFromCommandLine(int* argc, char** argv,
64
+ bool remove_flags);
65
+
66
+ + static void EnableCompilationForSourcelessUse();
67
+ + static void DisableCompilationForSourcelessUse();
68
+ + static void FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> script);
69
+ +
70
+ /** Get the version string. */
71
+ static const char* GetVersion();
72
+
73
+ diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
74
+ index 2dd476dda3..8a51f25b57 100644
75
+ --- node/deps/v8/src/api/api.cc
76
+ +++ node/deps/v8/src/api/api.cc
77
+ @@ -624,6 +624,28 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
78
+ HelpOptions(HelpOptions::kDontExit));
79
+ }
80
+
81
+ +bool save_lazy;
82
+ +bool save_predictable;
83
+ +
84
+ +void V8::EnableCompilationForSourcelessUse() {
85
+ + save_lazy = i::v8_flags.lazy;
86
+ + i::v8_flags.lazy = false;
87
+ + save_predictable = i::v8_flags.predictable;
88
+ + i::v8_flags.predictable = true;
89
+ +}
90
+ +
91
+ +void V8::DisableCompilationForSourcelessUse() {
92
+ + i::v8_flags.lazy = save_lazy;
93
+ + i::v8_flags.predictable = save_predictable;
94
+ +}
95
+ +
96
+ +void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
97
+ + auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
98
+ + auto function_info = i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
99
+ + i::Handle<i::Script> script(i::Script::cast(function_info->script()), isolate);
100
+ + script->SetSource(isolate, script, isolate->factory()->empty_string());
101
+ +}
102
+ +
103
+ RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
104
+
105
+ RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
106
+ diff --git node/deps/v8/src/codegen/compiler.cc node/deps/v8/src/codegen/compiler.cc
107
+ index 49afab11b6..4c81f9f90b 100644
108
+ --- node/deps/v8/src/codegen/compiler.cc
109
+ +++ node/deps/v8/src/codegen/compiler.cc
110
+ @@ -3627,7 +3627,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
111
+ maybe_script = lookup_result.script();
112
+ maybe_result = lookup_result.toplevel_sfi();
113
+ is_compiled_scope = lookup_result.is_compiled_scope();
114
+ - if (!maybe_result.is_null()) {
115
+ + if (!maybe_result.is_null() && source->length()) {
116
+ compile_timer.set_hit_isolate_cache();
117
+ } else if (can_consume_code_cache) {
118
+ compile_timer.set_consuming_code_cache();
119
+ diff --git node/deps/v8/src/compiler/wasm-compiler.cc node/deps/v8/src/compiler/wasm-compiler.cc
120
+ index 16f1f1470b..4bfeca49e6 100644
121
+ --- node/deps/v8/src/compiler/wasm-compiler.cc
122
+ +++ node/deps/v8/src/compiler/wasm-compiler.cc
123
+ @@ -8613,12 +8613,13 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
124
+ '-');
125
+
126
+ auto compile_with_turboshaft = [&]() {
127
+ + wasm::WrapperCompilationInfo info;
128
+ + info.code_kind = CodeKind::WASM_TO_JS_FUNCTION;
129
+ + info.import_info.import_kind = kind;
130
+ + info.import_info.expected_arity = expected_arity;
131
+ + info.import_info.suspend = suspend;
132
+ return Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(
133
+ - env->module, sig,
134
+ - wasm::WrapperCompilationInfo{
135
+ - .code_kind = CodeKind::WASM_TO_JS_FUNCTION,
136
+ - .import_info = {kind, expected_arity, suspend}},
137
+ - func_name, WasmStubAssemblerOptions(), nullptr);
138
+ + env->module, sig, info, func_name, WasmStubAssemblerOptions(), nullptr);
139
+ };
140
+ auto compile_with_turbofan = [&]() {
141
+ //--------------------------------------------------------------------------
142
+ @@ -8774,13 +8775,15 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
143
+ base::VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen, sig);
144
+
145
+ auto compile_with_turboshaft = [&]() {
146
+ + wasm::WrapperCompilationInfo info;
147
+ + info.code_kind = CodeKind::WASM_TO_JS_FUNCTION;
148
+ + info.import_info.import_kind = kind;
149
+ + info.import_info.expected_arity = expected_arity;
150
+ + info.import_info.suspend = suspend;
151
+ std::unique_ptr<turboshaft::TurboshaftCompilationJob> job =
152
+ Pipeline::NewWasmTurboshaftWrapperCompilationJob(
153
+ - isolate, sig,
154
+ - wasm::WrapperCompilationInfo{
155
+ - .code_kind = CodeKind::WASM_TO_JS_FUNCTION,
156
+ - .import_info = {kind, expected_arity, suspend}},
157
+ - nullptr, std::move(name_buffer), WasmAssemblerOptions());
158
+ + isolate, sig, info, nullptr, std::move(name_buffer),
159
+ + WasmAssemblerOptions());
160
+
161
+ // Compile the wrapper
162
+ if (job->ExecuteJob(isolate->counters()->runtime_call_stats()) ==
163
+ diff --git node/deps/v8/src/heap/marking-visitor-inl.h node/deps/v8/src/heap/marking-visitor-inl.h
164
+ index 39a5bbd22c..4b860f55d5 100644
165
+ --- node/deps/v8/src/heap/marking-visitor-inl.h
166
+ +++ node/deps/v8/src/heap/marking-visitor-inl.h
167
+ @@ -329,6 +329,13 @@ bool MarkingVisitorBase<ConcreteVisitor>::HasBytecodeArrayForFlushing(
168
+ template <typename ConcreteVisitor>
169
+ bool MarkingVisitorBase<ConcreteVisitor>::ShouldFlushCode(
170
+ Tagged<SharedFunctionInfo> sfi) const {
171
+ + auto script_obj = sfi->script();
172
+ + if (!IsUndefined(script_obj)) {
173
+ + auto script = i::Script::cast(script_obj);
174
+ + if (IsUndefined(script->source())) {
175
+ + return false;
176
+ + }
177
+ + }
178
+ return IsStressFlushingEnabled(code_flush_mode_) || IsOld(sfi);
179
+ }
180
+
181
+ diff --git node/deps/v8/src/objects/js-function.cc node/deps/v8/src/objects/js-function.cc
182
+ index 529e283bbf..c997c53a18 100644
183
+ --- node/deps/v8/src/objects/js-function.cc
184
+ +++ node/deps/v8/src/objects/js-function.cc
185
+ @@ -1308,6 +1308,10 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
186
+ Handle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
187
+ isolate, function, isolate->factory()->class_positions_symbol());
188
+ if (IsClassPositions(*maybe_class_positions)) {
189
+ + if (IsUndefined(
190
+ + String::cast(Script::cast(shared_info->script())->source()))) {
191
+ + return isolate->factory()->NewStringFromAsciiChecked("class {}");
192
+ + }
193
+ Tagged<ClassPositions> class_positions =
194
+ ClassPositions::cast(*maybe_class_positions);
195
+ int start_position = class_positions->start();
196
+ diff --git node/deps/v8/src/objects/objects.cc node/deps/v8/src/objects/objects.cc
197
+ index 8e013c2544..7ac03149d8 100644
198
+ --- node/deps/v8/src/objects/objects.cc
199
+ +++ node/deps/v8/src/objects/objects.cc
200
+ @@ -4263,7 +4263,12 @@ void Script::InitLineEndsInternal(IsolateT* isolate, Handle<Script> script) {
201
+
202
+ void Script::SetSource(Isolate* isolate, Handle<Script> script,
203
+ Handle<String> source) {
204
+ - script->set_source(*source);
205
+ + if (source->length() > 0) {
206
+ + script->set_source(*source);
207
+ + } else {
208
+ + Tagged<PrimitiveHeapObject> und = *isolate->factory()->undefined_value();
209
+ + script->set_source(und);
210
+ + }
211
+ if (isolate->NeedsSourcePositions()) InitLineEnds(isolate, script);
212
+ }
213
+
214
+ diff --git node/deps/v8/src/parsing/parsing.cc node/deps/v8/src/parsing/parsing.cc
215
+ index f160b27ea4..748452ba45 100644
216
+ --- node/deps/v8/src/parsing/parsing.cc
217
+ +++ node/deps/v8/src/parsing/parsing.cc
218
+ @@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, Handle<Script> script,
219
+ DCHECK(info->flags().is_toplevel());
220
+ DCHECK_NULL(info->literal());
221
+
222
+ + if (IsUndefined(String::cast(script->source()))) return false;
223
+ VMState<PARSER> state(isolate);
224
+
225
+ // Create a character stream for the parser.
226
+ @@ -74,6 +75,8 @@ bool ParseFunction(ParseInfo* info, Handle<SharedFunctionInfo> shared_info,
227
+
228
+ // Create a character stream for the parser.
229
+ Handle<Script> script(Script::cast(shared_info->script()), isolate);
230
+ + if (IsUndefined(String::cast(script->source()))) return false;
231
+ +
232
+ Handle<String> source(String::cast(script->source()), isolate);
233
+ std::unique_ptr<Utf16CharacterStream> stream(
234
+ ScannerStream::For(isolate, source, shared_info->StartPosition(),
235
+ diff --git node/deps/v8/src/snapshot/code-serializer.cc node/deps/v8/src/snapshot/code-serializer.cc
236
+ index ec69ad5123..1894032344 100644
237
+ --- node/deps/v8/src/snapshot/code-serializer.cc
238
+ +++ node/deps/v8/src/snapshot/code-serializer.cc
239
+ @@ -703,10 +703,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheck(
240
+
241
+ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckJustSource(
242
+ uint32_t expected_source_hash) const {
243
+ - uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
244
+ - if (source_hash != expected_source_hash) {
245
+ - return SerializedCodeSanityCheckResult::kSourceMismatch;
246
+ - }
247
+ return SerializedCodeSanityCheckResult::kSuccess;
248
+ }
249
+
250
+ @@ -723,10 +719,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource(
251
+ if (version_hash != Version::Hash()) {
252
+ return SerializedCodeSanityCheckResult::kVersionMismatch;
253
+ }
254
+ - uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
255
+ - if (flags_hash != FlagList::Hash()) {
256
+ - return SerializedCodeSanityCheckResult::kFlagsMismatch;
257
+ - }
258
+ uint32_t ro_snapshot_checksum =
259
+ GetHeaderValue(kReadOnlySnapshotChecksumOffset);
260
+ if (ro_snapshot_checksum != expected_ro_snapshot_checksum) {
261
+ diff --git node/lib/child_process.js node/lib/child_process.js
262
+ index 4e15255a01..987da265e6 100644
263
+ --- node/lib/child_process.js
264
+ +++ node/lib/child_process.js
265
+ @@ -168,7 +168,7 @@ function fork(modulePath, args = [], options) {
266
+ throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
267
+ }
268
+
269
+ - return spawn(options.execPath, args, options);
270
+ + return module.exports.spawn(options.execPath, args, options);
271
+ }
272
+
273
+ function _forkChild(fd, serializationMode) {
274
+ diff --git node/lib/internal/bootstrap/pkg.js node/lib/internal/bootstrap/pkg.js
275
+ new file mode 100644
276
+ index 0000000000..a697294fdf
277
+ --- /dev/null
278
+ +++ node/lib/internal/bootstrap/pkg.js
279
+ @@ -0,0 +1,49 @@
280
+ +'use strict';
281
+ +
282
+ +const {
283
+ + prepareWorkerThreadExecution,
284
+ + prepareMainThreadExecution
285
+ +} = require('internal/process/pre_execution');
286
+ +
287
+ +if (internalBinding('worker').isMainThread) {
288
+ + prepareMainThreadExecution(true);
289
+ +} else {
290
+ + prepareWorkerThreadExecution();
291
+ +}
292
+ +
293
+ +(function () {
294
+ + var __require__ = require;
295
+ + var fs = __require__('fs');
296
+ + var vm = __require__('vm');
297
+ + function readPrelude (fd) {
298
+ + var PAYLOAD_POSITION = '// PAYLOAD_POSITION //' | 0;
299
+ + var PAYLOAD_SIZE = '// PAYLOAD_SIZE //' | 0;
300
+ + var PRELUDE_POSITION = '// PRELUDE_POSITION //' | 0;
301
+ + var PRELUDE_SIZE = '// PRELUDE_SIZE //' | 0;
302
+ + if (!PRELUDE_POSITION) {
303
+ + // no prelude - remove entrypoint from argv[1]
304
+ + process.argv.splice(1, 1);
305
+ + return { undoPatch: true };
306
+ + }
307
+ + var prelude = Buffer.alloc(PRELUDE_SIZE);
308
+ + var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
309
+ + if (read !== PRELUDE_SIZE) {
310
+ + console.error('Pkg: Error reading from file.');
311
+ + process.exit(1);
312
+ + }
313
+ + var s = new vm.Script(prelude, { filename: 'pkg/prelude/bootstrap.js' });
314
+ + var fn = s.runInThisContext();
315
+ + return fn(process, __require__,
316
+ + console, fd, PAYLOAD_POSITION, PAYLOAD_SIZE);
317
+ + }
318
+ + (function () {
319
+ + var fd = fs.openSync(process.execPath, 'r');
320
+ + var result = readPrelude(fd);
321
+ + if (result && result.undoPatch) {
322
+ + var bindingFs = process.binding('fs');
323
+ + fs.internalModuleStat = bindingFs.internalModuleStat;
324
+ + fs.internalModuleReadJSON = bindingFs.internalModuleReadJSON;
325
+ + fs.closeSync(fd);
326
+ + }
327
+ + }());
328
+ +}());
329
+ diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
330
+ index 451b7c2195..203be65195 100644
331
+ --- node/lib/internal/modules/cjs/loader.js
332
+ +++ node/lib/internal/modules/cjs/loader.js
333
+ @@ -234,7 +234,10 @@ function stat(filename) {
334
+ const result = statCache.get(filename);
335
+ if (result !== undefined) { return result; }
336
+ }
337
+ - const result = internalFsBinding.internalModuleStat(filename);
338
+ + const fs = require('fs');
339
+ + const result = fs.existsSync(filename) ?
340
+ + (fs.statSync(filename).isDirectory() ? 1 : 0) : -1;
341
+ +
342
+ if (statCache !== null && result >= 0) {
343
+ // Only set cache when `internalModuleStat(filename)` succeeds.
344
+ statCache.set(filename, result);
345
+ diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
346
+ index 9a9dcebb79..9f00ec6a85 100644
347
+ --- node/lib/internal/modules/package_json_reader.js
348
+ +++ node/lib/internal/modules/package_json_reader.js
349
+ @@ -80,14 +80,19 @@ function deserializePackageJSON(path, contents) {
350
+ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
351
+ // This function will be called by both CJS and ESM, so we need to make sure
352
+ // non-null attributes are converted to strings.
353
+ - const parsed = modulesBinding.readPackageJSON(
354
+ - jsonPath,
355
+ - isESM,
356
+ - base == null ? undefined : `${base}`,
357
+ - specifier == null ? undefined : `${specifier}`,
358
+ - );
359
+ -
360
+ - return deserializePackageJSON(jsonPath, parsed);
361
+ + const fs = require('fs');
362
+ + if (fs.existsSync(jsonPath)) {
363
+ + const json = JSONParse(fs.readFileSync(jsonPath, { encoding: "utf8" }).trim());
364
+ + return deserializePackageJSON(jsonPath, [
365
+ + json['name'],
366
+ + json['main'],
367
+ + json['type'],
368
+ + json['exports'],
369
+ + json['imports'],
370
+ + ]);
371
+ + } else {
372
+ + return deserializePackageJSON(jsonPath, undefined);
373
+ + }
374
+ }
375
+
376
+ /**
377
+ diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
378
+ index ea420b84da..756c84ea18 100644
379
+ --- node/lib/internal/process/pre_execution.js
380
+ +++ node/lib/internal/process/pre_execution.js
381
+ @@ -49,7 +49,11 @@ const {
382
+ },
383
+ } = require('internal/v8/startup_snapshot');
384
+
385
+ +let _alreadyPrepared = false;
386
+ +
387
+ function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
388
+ + if (_alreadyPrepared === true) return;
389
+ + _alreadyPrepared = true;
390
+ return prepareExecution({
391
+ expandArgv1,
392
+ initializeModules,
393
+ @@ -241,7 +245,8 @@ function patchProcessObject(expandArgv1) {
394
+ // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
395
+ // the entry point.
396
+ if (expandArgv1 && process.argv[1] &&
397
+ - !StringPrototypeStartsWith(process.argv[1], '-')) {
398
+ + !StringPrototypeStartsWith(process.argv[1], '-') &&
399
+ + process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
400
+ // Expand process.argv[1] into a full path.
401
+ const path = require('path');
402
+ try {
403
+ @@ -722,6 +727,7 @@ function loadPreloadModules() {
404
+ // For user code, we preload modules if `-r` is passed
405
+ const preloadModules = getOptionValue('--require');
406
+ if (preloadModules && preloadModules.length > 0) {
407
+ + assert(false, '--require is not supported');
408
+ const {
409
+ Module: {
410
+ _preloadModules,
411
+ diff --git node/lib/vm.js node/lib/vm.js
412
+ index 3eea66b3f0..86fd70ac89 100644
413
+ --- node/lib/vm.js
414
+ +++ node/lib/vm.js
415
+ @@ -98,6 +98,7 @@ class Script extends ContextifyScript {
416
+ produceCachedData = false,
417
+ importModuleDynamically,
418
+ [kParsingContext]: parsingContext,
419
+ + sourceless = false,
420
+ } = options;
421
+
422
+ validateString(filename, 'options.filename');
423
+ @@ -121,7 +122,8 @@ class Script extends ContextifyScript {
424
+ cachedData,
425
+ produceCachedData,
426
+ parsingContext,
427
+ - hostDefinedOptionId);
428
+ + hostDefinedOptionId,
429
+ + sourceless);
430
+ } catch (e) {
431
+ throw e; /* node-do-not-add-exception-line */
432
+ }
433
+ diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
434
+ index bb39a0cb42..5fa6cb65cc 100644
435
+ --- node/src/inspector_agent.cc
436
+ +++ node/src/inspector_agent.cc
437
+ @@ -766,11 +766,6 @@ bool Agent::Start(const std::string& path,
438
+ StartIoThreadAsyncCallback));
439
+ uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
440
+ start_io_thread_async.data = this;
441
+ - if (parent_env_->should_start_debug_signal_handler()) {
442
+ - // Ignore failure, SIGUSR1 won't work, but that should not block node
443
+ - // start.
444
+ - StartDebugSignalHandler();
445
+ - }
446
+
447
+ parent_env_->AddCleanupHook([](void* data) {
448
+ Environment* env = static_cast<Environment*>(data);
449
+ diff --git node/src/node.cc node/src/node.cc
450
+ index e1614e60f5..c19041aab2 100644
451
+ --- node/src/node.cc
452
+ +++ node/src/node.cc
453
+ @@ -394,6 +394,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
454
+ return env->RunSnapshotDeserializeMain();
455
+ }
456
+
457
+ + StartExecution(env, "internal/bootstrap/pkg");
458
+ +
459
+ if (env->worker_context() != nullptr) {
460
+ return StartExecution(env, "internal/main/worker_thread");
461
+ }
462
+ @@ -618,14 +620,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
463
+ }
464
+
465
+ if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
466
+ -#if HAVE_INSPECTOR
467
+ - sigset_t sigmask;
468
+ - sigemptyset(&sigmask);
469
+ - sigaddset(&sigmask, SIGUSR1);
470
+ - const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
471
+ - CHECK_EQ(err, 0);
472
+ -#endif // HAVE_INSPECTOR
473
+ -
474
+ ResetSignalHandlers();
475
+ }
476
+
477
+ diff --git node/src/node_contextify.cc node/src/node_contextify.cc
478
+ index fc137486f5..81388a8812 100644
479
+ --- node/src/node_contextify.cc
480
+ +++ node/src/node_contextify.cc
481
+ @@ -85,6 +85,7 @@ using v8::Symbol;
482
+ using v8::Uint32;
483
+ using v8::UnboundScript;
484
+ using v8::Value;
485
+ +using v8::V8;
486
+
487
+ // The vm module executes code in a sandboxed environment with a different
488
+ // global object than the rest of the code. This is achieved by applying
489
+ @@ -981,13 +982,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
490
+ Local<ArrayBufferView> cached_data_buf;
491
+ bool produce_cached_data = false;
492
+ Local<Context> parsing_context = context;
493
+ -
494
+ + bool sourceless = false;
495
+ Local<Symbol> id_symbol;
496
+ if (argc > 2) {
497
+ // new ContextifyScript(code, filename, lineOffset, columnOffset,
498
+ // cachedData, produceCachedData, parsingContext,
499
+ - // hostDefinedOptionId)
500
+ - CHECK_EQ(argc, 8);
501
+ + // hostDefinedOptionId, sourceless)
502
+ + CHECK_GE(argc, 8);
503
+ CHECK(args[2]->IsNumber());
504
+ line_offset = args[2].As<Int32>()->Value();
505
+ CHECK(args[3]->IsNumber());
506
+ @@ -1008,6 +1009,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
507
+ }
508
+ CHECK(args[7]->IsSymbol());
509
+ id_symbol = args[7].As<Symbol>();
510
+ + if (argc > 8) {
511
+ + CHECK(args[8]->IsBoolean());
512
+ + sourceless = args[8]->IsTrue();
513
+ + }
514
+ }
515
+
516
+ ContextifyScript* contextify_script =
517
+ @@ -1055,6 +1060,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
518
+ ShouldNotAbortOnUncaughtScope no_abort_scope(env);
519
+ Context::Scope scope(parsing_context);
520
+
521
+ + if (sourceless && produce_cached_data) {
522
+ + V8::EnableCompilationForSourcelessUse();
523
+ + }
524
+ +
525
+ MaybeLocal<UnboundScript> maybe_v8_script =
526
+ ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
527
+
528
+ @@ -1069,6 +1078,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
529
+ return;
530
+ }
531
+
532
+ + if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
533
+ + if (!source.GetCachedData()->rejected) {
534
+ + V8::FixSourcelessScript(env->isolate(), v8_script);
535
+ + }
536
+ + }
537
+ +
538
+ contextify_script->script_.Reset(isolate, v8_script);
539
+ contextify_script->script_.SetWeak();
540
+ contextify_script->object()->SetInternalField(kUnboundScriptSlot, v8_script);
541
+ @@ -1101,6 +1116,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
542
+ .IsNothing())
543
+ return;
544
+
545
+ + if (sourceless && produce_cached_data) {
546
+ + V8::DisableCompilationForSourcelessUse();
547
+ + }
548
+ +
549
+ TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
550
+ }
551
+
552
+ diff --git node/src/node_main.cc node/src/node_main.cc
553
+ index f66099a557..4048f6bd93 100644
554
+ --- node/src/node_main.cc
555
+ +++ node/src/node_main.cc
556
+ @@ -22,6 +22,8 @@
557
+ #include "node.h"
558
+ #include <cstdio>
559
+
560
+ +int reorder(int argc, char** argv);
561
+ +
562
+ #ifdef _WIN32
563
+ #include <windows.h>
564
+ #include <VersionHelpers.h>
565
+ @@ -88,12 +90,95 @@ int wmain(int argc, wchar_t* wargv[]) {
566
+ }
567
+ argv[argc] = nullptr;
568
+ // Now that conversion is done, we can finally start.
569
+ - return node::Start(argc, argv);
570
+ + return reorder(argc, argv);
571
+ }
572
+ #else
573
+ // UNIX
574
+
575
+ int main(int argc, char* argv[]) {
576
+ + return reorder(argc, argv);
577
+ +}
578
+ +#endif
579
+ +
580
+ +#include <string.h>
581
+ +
582
+ +int strlen2 (char* s) {
583
+ + int len = 0;
584
+ + while (*s) {
585
+ + len += 1;
586
+ + s += 1;
587
+ + }
588
+ + return len;
589
+ +}
590
+ +
591
+ +bool should_set_dummy() {
592
+ +#ifdef _WIN32
593
+ + #define MAX_ENV_LENGTH 32767
594
+ + wchar_t execpath_env[MAX_ENV_LENGTH];
595
+ + DWORD result = GetEnvironmentVariableW(L"PKG_EXECPATH", execpath_env, MAX_ENV_LENGTH);
596
+ + if (result == 0 && GetLastError() != ERROR_SUCCESS) return true;
597
+ + return wcscmp(execpath_env, L"PKG_INVOKE_NODEJS") != 0;
598
+ +#else
599
+ + const char* execpath_env = getenv("PKG_EXECPATH");
600
+ + if (!execpath_env) return true;
601
+ + return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
602
+ +#endif
603
+ +}
604
+ +
605
+ +// for uv_setup_args
606
+ +int adjacent(int argc, char** argv) {
607
+ + size_t size = 0;
608
+ + for (int i = 0; i < argc; i++) {
609
+ + size += strlen(argv[i]) + 1;
610
+ + }
611
+ + char* args = new char[size];
612
+ + size_t pos = 0;
613
+ + for (int i = 0; i < argc; i++) {
614
+ + memcpy(&args[pos], argv[i], strlen(argv[i]) + 1);
615
+ + argv[i] = &args[pos];
616
+ + pos += strlen(argv[i]) + 1;
617
+ + }
618
+ return node::Start(argc, argv);
619
+ }
620
+ +
621
+ +volatile char* BAKERY = (volatile char*) "\0// BAKERY // BAKERY " \
622
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
623
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
624
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY ";
625
+ +
626
+ +#ifdef __clang__
627
+ +__attribute__((optnone))
628
+ +#elif defined(__GNUC__)
629
+ +__attribute__((optimize(0)))
630
+ #endif
631
+ +
632
+ +int load_baked(char** nargv) {
633
+ + int c = 1;
634
+ +
635
+ + char* bakery = (char*) BAKERY;
636
+ + while (true) {
637
+ + size_t width = strlen2(bakery);
638
+ + if (width == 0) break;
639
+ + nargv[c++] = bakery;
640
+ + bakery += width + 1;
641
+ + }
642
+ +
643
+ + return c;
644
+ +}
645
+ +
646
+ +int reorder(int argc, char** argv) {
647
+ + char** nargv = new char*[argc + 64];
648
+ +
649
+ + nargv[0] = argv[0];
650
+ + int c = load_baked(nargv);
651
+ +
652
+ + if (should_set_dummy()) {
653
+ + nargv[c++] = (char*) "PKG_DUMMY_ENTRYPOINT";
654
+ + }
655
+ +
656
+ + for (int i = 1; i < argc; i++) {
657
+ + nargv[c++] = argv[i];
658
+ + }
659
+ +
660
+ + return adjacent(c, nargv);
661
+ +}
662
+ diff --git node/src/node_options.cc node/src/node_options.cc
663
+ index 545db1dbbc..183af9dbad 100644
664
+ --- node/src/node_options.cc
665
+ +++ node/src/node_options.cc
666
+ @@ -307,6 +307,7 @@ void Parse(
667
+ // TODO(addaleax): Make that unnecessary.
668
+
669
+ DebugOptionsParser::DebugOptionsParser() {
670
+ + return;
671
+ #ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
672
+ if (sea::IsSingleExecutable()) return;
673
+ #endif
674
+ diff --git node/tools/icu/icu-generic.gyp node/tools/icu/icu-generic.gyp
675
+ index 2655b9e694..1d951571c7 100644
676
+ --- node/tools/icu/icu-generic.gyp
677
+ +++ node/tools/icu/icu-generic.gyp
678
+ @@ -52,7 +52,7 @@
679
+ 'conditions': [
680
+ [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
681
+ 'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
682
+ - 'cflags_cc': [ '-frtti' ],
683
+ + 'cflags_cc': [ '-frtti', '-fno-lto' ],
684
+ 'cflags_cc!': [ '-fno-rtti' ],
685
+ }],
686
+ [ 'OS == "mac" or OS == "ios"', {
@@ -1,6 +1,7 @@
1
1
  {
2
- "v20.11.1": ["node.v20.11.1.cpp.patch"],
3
- "v18.19.1": ["node.v18.19.1.cpp.patch"],
2
+ "v22.8.0": ["node.v22.8.0.cpp.patch"],
3
+ "v20.17.0": ["node.v20.17.0.cpp.patch"],
4
+ "v18.20.4": ["node.v18.20.4.cpp.patch"],
4
5
  "v16.20.2": ["node.v16.20.2.cpp.patch"],
5
6
  "v14.21.3": ["node.v14.21.3.cpp.patch"],
6
7
  "v12.22.11": ["node.v12.22.11.cpp.patch"],