@yao-pkg/pkg-fetch 3.5.7 → 3.5.8

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.
package/README.md CHANGED
@@ -50,14 +50,10 @@ This project deploys multiple defense measures to ensure that the safe binaries
50
50
 
51
51
  1. Clone Node.js as a sibling to your current `pkg-fetch` clone
52
52
 
53
- - `git clone https://github.com/nodejs/node.git`
54
- - `cd node`
53
+ - `git clone -b v18.13.0 --single-branch https://github.com/nodejs/node.git`
54
+ - `cd node`
55
55
 
56
- 2. Checkout the tag you wish to generate a patch for
57
-
58
- - `git checkout v18.13.0`
59
-
60
- 3. Attempt to apply the closest patch (e.g. applying the existing patch for
56
+ 2. Attempt to apply the closest patch (e.g. applying the existing patch for
61
57
  18.12.1 when trying to generate a new patch for 18.13.0)
62
58
 
63
59
  - `git apply ..\pkg-fetch\patches\node.v18.12.1.cpp.patch --reject`
@@ -1,5 +1,4 @@
1
1
  {
2
- "node-v10.24.1-alpine-arm64": "f6a59f1ace2ef1f4bf976ff85d9a74bdc71bda098e8aa018e2a089c590aeedea",
3
2
  "node-v14.21.3-alpine-arm64": "651c2b423925c9dab1ca7695acfb1462be13264f0c1fb6c8b472474c7dbacddd",
4
3
  "node-v14.21.3-alpine-x64": "4f2b5b16428f998302bbcf59ca229998be48e5dc6c2487edb603152651c182cd",
5
4
  "node-v14.21.3-linux-arm64": "bb20f63ac32c4e6a0545dfcea3833e8a8a968b95e91ce01cab7f4f48f1a56064",
@@ -22,37 +21,26 @@
22
21
  "node-v16.20.2-win-arm64": "7514915e02aedfbdc9f87ede04f1f251b014e312e3e184d5b94b42aeb28c2485",
23
22
  "node-v16.20.2-win-x64": "272729724993ce07b37d328718a0152e50ec5c9d27aa972975c09b75604c0dca",
24
23
  "node-v16.20.2-macos-arm64": "3d04eb7ddd8b614b888eeb1caa6e64a068b665ab4a26dd064051973ae5842a85",
25
- "node-v18.18.2-alpine-arm64": "244a74549a342ed74b531625c02168e1c0e72f328d8b8d53ab143a6813fd9466",
26
- "node-v18.18.2-alpine-x64": "b9c6d08f510ce15353d9f2441b5b096697c877b1760a6f526c203b47bf3ec83a",
27
- "node-v18.18.2-linux-arm64": "01676c5420d17a2fa53ddf4573ca21895150ae317cd54a7e26234c26d3603e7a",
28
- "node-v18.18.2-linux-x64": "d918fd7ad7d9db0cde09c570ada58a6fb9e2bf43c032a9cb87d0e572f06db646",
29
- "node-v18.18.2-linuxstatic-arm64": "2db35ca7c089fc78a8c6b44804a88aa1035344a7465b038f593cc337198285a6",
30
- "node-v18.18.2-linuxstatic-armv7": "705c75ab9155069ffb8c3f800f8d49121d2b0d07343e4da9a98477e2962602f9",
31
- "node-v18.18.2-linuxstatic-x64": "dce8f6c6f3ce48b4bbfb7a8177165c9743dba12458ccd42b9f3da3c9601fc088",
32
- "node-v18.18.2-macos-x64": "db04d8a9338e1d2f6afd53c99d0a57ec9cc4bca84165ade0d2f5fcf9871bcdb9",
33
- "node-v18.18.2-win-arm64": "ca08e24dfd5bae1a898d86f3241287e057c14e7fce37da1dff63f1bce6822b62",
34
- "node-v18.18.2-win-x64": "81b25a5dc71bb3ebc8219f4cd73ad598a1eaff16ccbb2f75cf8f5db94e08149b",
35
- "node-v18.18.2-macos-arm64": "35deec00661aa042d3557e74281c6742f0184e634da0df055c3c4214360a3070",
36
- "node-v19.8.1-alpine-arm64": "7d4fc8a17f116d6e77b6011201797897592fa03380e939fa8b49b00ba7ac641b",
37
- "node-v19.8.1-alpine-x64": "aca5632e1960d763c7b9914ebfeb929c4ca0e8c2112798eca3959ba9a5076ed8",
38
- "node-v19.8.1-linux-arm64": "4754c852da9e55591d7e54c4b9c5db1db4d52c8452b8533aab73451c1c5797f8",
39
- "node-v19.8.1-linux-x64": "757a9e3b8a72f6eecf5cbc0b8ec4b25298375c1952165c3ef2184133ac81ff44",
40
- "node-v19.8.1-linuxstatic-arm64": "46b343c2d948acdf36d1717ad3e4a0c1bf28ea1abf845e24ed4cbf4d047a0890",
41
- "node-v19.8.1-linuxstatic-armv7": "63c7154dee90dd6734cdf3eaa8ab3e1ab111772612eb48271f6cfd22f84c4dee",
42
- "node-v19.8.1-linuxstatic-x64": "39c5c208347c76d921212d7a0d885c0b54d8c698b01c0e1e4b167b87fbc6ffb1",
43
- "node-v19.8.1-macos-x64": "7288e53e6afe4d07bc5f32965ca7a051d7e72a67f09979c561dc8dabff88a5b2",
44
- "node-v19.8.1-win-arm64": "f288732fc5f5493367a5d60d1e227347099de3db26fd651607df07d37fb8222e",
45
- "node-v19.8.1-win-x64": "98b22116864d72e1ccb4d557dc36785cf731051543c5c876f1bf547872de2d1d",
46
- "node-v19.8.1-macos-arm64": "69c1113d1fbcce01e0062af12a4a1b81f6c3746ff32a8b307f8632788109c94a",
47
- "node-v20.10.0-alpine-arm64": "909d88e166499dd9311e9d8d72cce1c2ae1f81ca7f5602e5ee2d5c4eeb39d99b",
48
- "node-v20.10.0-alpine-x64": "1bcce476efb0b797cd67f4ebb3d5f824241d67246654cf18e94465a473290d6f",
49
- "node-v20.10.0-linux-x64": "d17d0a9477cd702ba0de16f903d4ffbcef1898833568c24cbf2c6ef3b0c052a4",
50
- "node-v20.10.0-linuxstatic-arm64": "38df4a161b347b481e9cbbe78a5830bdcc776183bc9cbde152f6bb60b90f9dd0",
51
- "node-v20.10.0-linuxstatic-armv7": "64d3543fae52e92c191dfd187679b28c234ff67cee17fddb1444a1fad58f4983",
52
- "node-v20.10.0-linuxstatic-x64": "345ed15e21298b206df5c102aa0225108344ae183414cd967c6b517c9671c501",
53
- "node-v20.10.0-macos-x64": "e7d7d837ea3f373b347106118d2ce187e4990534f28d9c8cfdff68084b36a69b",
54
- "node-v20.10.0-win-arm64": "13ca46f22f159d3c83357ad1f75482556abefeba1eeb15e7dc7747a29e82aba5",
55
- "node-v20.10.0-win-x64": "27472c7a532a51ab2089a35f5afbeefd1075f4939fe3f4a8dc594439bf708117",
56
- "node-v20.10.0-linux-arm64": "0162ad9d9eb1e4ce01b3a5fe519be3032d8f6e66d77cdb18105654cde28433b6",
57
- "node-v20.10.0-macos-arm64": "c61c9ddd7218ddd28e38c5d88b13cd2f972b6aaef244d0b2518bf33bfbdad997"
24
+ "node-v18.19.0-alpine-arm64": "718796065af7a231af2467760aa60ca1b71ddc8514e81cf00f157004de27fc17",
25
+ "node-v18.19.0-alpine-x64": "6d16ceb0a1e6df087de5189a896682c4747dfd9f169373c1da25639c991abd3b",
26
+ "node-v18.19.0-linux-arm64": "512d67139c488b8ff775da043cc1e2a721f1b8e745f98214fbf637c7fa7affcc",
27
+ "node-v18.19.0-linux-x64": "9e8c89d6214bdf5efaaf18c30026bc8779d536153639e5b0c420b68cb800775a",
28
+ "node-v18.19.0-linuxstatic-arm64": "9bc83f4ca62eb3501bf4c439720e87074eac73c3680785ea459037f4daa9ffdb",
29
+ "node-v18.19.0-linuxstatic-armv7": "2f36ce5a5e2536d7f14b2a2bcfe0d9907a653370c18586c75d3cb4b772639d65",
30
+ "node-v18.19.0-linuxstatic-x64": "c09d8c8975d3f6159ad188ff993cb9121ac0a79cde624a0ee68de79adc7534c7",
31
+ "node-v18.19.0-macos-arm64": "813ed0157bc126d23f0bf29af84384727a628ada4687fa22e1c8bb7877f7fb1f",
32
+ "node-v18.19.0-macos-x64": "b1309d883f4990850abe73fc94f18e00ed4102377c16bf998413faf90c6db6cd",
33
+ "node-v18.19.0-win-arm64": "69b6b8c7d2b6f57f03d6f995c1b87d1614f6a52d877d92065c86415c02779aa5",
34
+ "node-v18.19.0-win-x64": "33065fb87e5f5380c3bcf410c804a1447f80136118113ff95c346049c2437d9e",
35
+ "node-v20.11.0-alpine-arm64": "47ef05cd0ecd4b595b859851d2683356443544b73c6c2b8d851c99dbfe66c5a2",
36
+ "node-v20.11.0-alpine-x64": "12052931ee5f659e1b56f3357a7d55134d04a8bb75ad36d76ad993ef35dfea5b",
37
+ "node-v20.11.0-linux-arm64": "317e9546705f530abf27575a031a96ec5a4d1f888c2188419ac243bfec7bdbca",
38
+ "node-v20.11.0-linux-x64": "57cad53c1df2c7bf9d1e16175f64d227b6788ac1cc88c6a26cf4a3274f2e8867",
39
+ "node-v20.11.0-linuxstatic-arm64": "cfd092c23c743be0d00f6a87c20afe089586e5b242750c609ba319e7a6b90931",
40
+ "node-v20.11.0-linuxstatic-armv7": "8a25bf3d436a3523bb15fc58374774340766b7be95355d39ad7fe2a0d4a38f1b",
41
+ "node-v20.11.0-linuxstatic-x64": "5a06f4b4638412726a17b2f5b308667aaef9059c034341ba9025829efe8bdd03",
42
+ "node-v20.11.0-macos-arm64": "4db642c5cd55623bcb15c0af5885f2ea791b9e88b769e2c973a00118f4002a9b",
43
+ "node-v20.11.0-macos-x64": "d599428c706a749fe856d491c00dd7bdee88607a3fc572a774288dbff61f96ac",
44
+ "node-v20.11.0-win-arm64": "4f8bcac5cf5452af28658fccbd2a5ea41c1efcc0a1bbd0770d6a0ed50dfe3b64",
45
+ "node-v20.11.0-win-x64": "e0f7c52e40b2d7e41e97017fa1cb50835adf788da62fc2d6ef12b3266f071e7a"
58
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yao-pkg/pkg-fetch",
3
- "version": "3.5.7",
3
+ "version": "3.5.8",
4
4
  "description": "Compiles and stores base binaries for pkg",
5
5
  "main": "lib-es5/index.js",
6
6
  "license": "MIT",
@@ -307,7 +307,7 @@ index de409a31f3..d26e4366ad 100644
307
307
 
308
308
  'conditions': [
309
309
  + ['target_arch=="arm64"', {
310
- + 'cflags': ['-msign-return-address=all'], # Pointer authentication.
310
+ + 'cflags': ['-mbranch-protection=standard'], # Pointer authentication.
311
311
  + }],
312
312
  ['OS=="aix"', {
313
313
  'ldflags': [
@@ -1,5 +1,5 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index 94fae06518..e4116f3c82 100644
2
+ index dba2631f21..4c4c430dc1 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
5
  @@ -174,7 +174,7 @@
@@ -12,7 +12,7 @@ index 94fae06518..e4116f3c82 100644
12
12
  'lto': ' -flto ', # Clang
13
13
  }],
14
14
  diff --git node/configure.py node/configure.py
15
- index 7006ee6581..12fb2ac8d1 100755
15
+ index 4638f04b6a..ffa1c6338a 100755
16
16
  --- node/configure.py
17
17
  +++ node/configure.py
18
18
  @@ -1289,9 +1289,7 @@ def configure_node(o):
@@ -169,7 +169,7 @@ index 618cf9e975..64a57e8afe 100644
169
169
  uint32_t max_payload_length = this->size_ - kHeaderSize;
170
170
  if (payload_length > max_payload_length) {
171
171
  diff --git node/lib/child_process.js node/lib/child_process.js
172
- index 5bdc474c80..196778e7db 100644
172
+ index 449013906e..3a85e4a541 100644
173
173
  --- node/lib/child_process.js
174
174
  +++ node/lib/child_process.js
175
175
  @@ -169,7 +169,7 @@ function fork(modulePath, args = [], options) {
@@ -237,59 +237,144 @@ 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 88bb870a8f..22bbdd9058 100644
240
+ index 316996a8c3..8cd0727556 100644
241
241
  --- node/lib/internal/modules/cjs/loader.js
242
242
  +++ node/lib/internal/modules/cjs/loader.js
243
- @@ -94,7 +94,7 @@ const fs = require('fs');
244
- const internalFS = require('internal/fs/utils');
243
+ @@ -89,7 +89,7 @@ const { internalCompileFunction } = require('internal/vm');
244
+ const assert = require('internal/assert');
245
+ const fs = require('fs');
245
246
  const path = require('path');
246
- const { sep } = path;
247
247
  -const { internalModuleStat } = internalBinding('fs');
248
248
  +const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
249
- const packageJsonReader = require('internal/modules/package_json_reader');
250
249
  const { safeGetenv } = internalBinding('credentials');
251
250
  const {
251
+ privateSymbols: {
252
252
  diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
253
- index bb175d0df5..07f4834c07 100644
253
+ index 1968960576..d73016f3fe 100644
254
254
  --- node/lib/internal/modules/package_json_reader.js
255
255
  +++ node/lib/internal/modules/package_json_reader.js
256
- @@ -1,7 +1,7 @@
257
- 'use strict';
258
-
259
- const { SafeMap } = primordials;
256
+ @@ -12,7 +12,7 @@ const {
257
+ const {
258
+ ERR_INVALID_PACKAGE_CONFIG,
259
+ } = require('internal/errors').codes;
260
260
  -const { internalModuleReadJSON } = internalBinding('fs');
261
261
  +const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
262
- const { pathToFileURL } = require('url');
263
- const { toNamespacedPath } = require('path');
262
+ const { resolve, sep, toNamespacedPath } = require('path');
263
+ const { kEmptyObject } = require('internal/util');
264
264
 
265
265
  diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
266
- index b4a24bbffb..041ee4c715 100644
266
+ index 4795be82e7..977124a014 100644
267
267
  --- node/lib/internal/process/pre_execution.js
268
268
  +++ node/lib/internal/process/pre_execution.js
269
- @@ -36,7 +36,12 @@ const {
270
- isBuildingSnapshot,
271
- } = require('v8').startupSnapshot;
269
+ @@ -36,7 +36,11 @@ const {
270
+ },
271
+ } = require('internal/v8/startup_snapshot');
272
272
 
273
273
  +let _alreadyPrepared = false;
274
274
  +
275
275
  function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
276
276
  + if (_alreadyPrepared === true) return;
277
277
  + _alreadyPrepared = true;
278
- +
279
- prepareExecution({
278
+ return prepareExecution({
280
279
  expandArgv1,
281
280
  initializeModules,
282
- @@ -155,7 +160,8 @@ function patchProcessObject(expandArgv1) {
283
- process.argv[0] = process.execPath;
284
-
281
+ @@ -191,7 +195,8 @@ function patchProcessObject(expandArgv1) {
282
+ // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
283
+ // the entry point.
285
284
  if (expandArgv1 && process.argv[1] &&
286
285
  - !StringPrototypeStartsWith(process.argv[1], '-')) {
287
- + !StringPrototypeStartsWith(process.argv[1], '-') &&
288
- + process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
286
+ + !StringPrototypeStartsWith(process.argv[1], '-') &&
287
+ + process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
289
288
  // Expand process.argv[1] into a full path.
290
289
  const path = require('path');
291
290
  try {
292
- @@ -603,6 +609,7 @@ function loadPreloadModules() {
291
+ @@ -263,7 +268,7 @@ function setupWarningHandler() {
292
+ // https://fetch.spec.whatwg.org/
293
+ function setupFetch() {
294
+ if (process.config.variables.node_no_browser_globals ||
295
+ - getOptionValue('--no-experimental-fetch')) {
296
+ + getOptionValue('--no-experimental-fetch')) {
297
+ return;
298
+ }
299
+
300
+ @@ -313,7 +318,7 @@ function setupFetch() {
301
+ // removed.
302
+ function setupWebCrypto() {
303
+ if (process.config.variables.node_no_browser_globals ||
304
+ - !getOptionValue('--experimental-global-webcrypto')) {
305
+ + !getOptionValue('--experimental-global-webcrypto')) {
306
+ return;
307
+ }
308
+
309
+ @@ -335,7 +340,7 @@ function setupCodeCoverage() {
310
+ // --experimental-test-coverage flag is present, as the test runner will
311
+ // handle coverage.
312
+ if (process.env.NODE_V8_COVERAGE &&
313
+ - !getOptionValue('--experimental-test-coverage')) {
314
+ + !getOptionValue('--experimental-test-coverage')) {
315
+ process.env.NODE_V8_COVERAGE =
316
+ setupCoverageHooks(process.env.NODE_V8_COVERAGE);
317
+ }
318
+ @@ -345,7 +350,7 @@ function setupCodeCoverage() {
319
+ // removed.
320
+ function setupCustomEvent() {
321
+ if (process.config.variables.node_no_browser_globals ||
322
+ - !getOptionValue('--experimental-global-customevent')) {
323
+ + !getOptionValue('--experimental-global-customevent')) {
324
+ return;
325
+ }
326
+ const { CustomEvent } = require('internal/event_target');
327
+ @@ -468,10 +473,10 @@ function initializeDeprecations() {
328
+ ]) {
329
+ utilBinding[name] = pendingDeprecation ?
330
+ deprecate(types[name],
331
+ - 'Accessing native typechecking bindings of Node ' +
332
+ - 'directly is deprecated. ' +
333
+ - `Please use \`util.types.${name}\` instead.`,
334
+ - 'DEP0103') :
335
+ + 'Accessing native typechecking bindings of Node ' +
336
+ + 'directly is deprecated. ' +
337
+ + `Please use \`util.types.${name}\` instead.`,
338
+ + 'DEP0103') :
339
+ types[name];
340
+ }
341
+
342
+ @@ -492,12 +497,12 @@ function initializeDeprecations() {
343
+
344
+ if (pendingDeprecation) {
345
+ process.binding = deprecate(process.binding,
346
+ - 'process.binding() is deprecated. ' +
347
+ - 'Please use public APIs instead.', 'DEP0111');
348
+ + 'process.binding() is deprecated. ' +
349
+ + 'Please use public APIs instead.', 'DEP0111');
350
+
351
+ process._tickCallback = deprecate(process._tickCallback,
352
+ - 'process._tickCallback() is deprecated',
353
+ - 'DEP0134');
354
+ + 'process._tickCallback() is deprecated',
355
+ + 'DEP0134');
356
+ }
357
+ }
358
+
359
+ @@ -533,7 +538,7 @@ function readPolicyFromDisk() {
360
+ const experimentalPolicy = getOptionValue('--experimental-policy');
361
+ if (experimentalPolicy) {
362
+ process.emitWarning('Policies are experimental.',
363
+ - 'ExperimentalWarning');
364
+ + 'ExperimentalWarning');
365
+ const { pathToFileURL, URL } = require('internal/url');
366
+ // URL here as it is slightly different parsing
367
+ // no bare specifiers for now
368
+ @@ -611,7 +616,7 @@ function initializeSourceMapsHandlers() {
369
+ function initializeFrozenIntrinsics() {
370
+ if (getOptionValue('--frozen-intrinsics')) {
371
+ process.emitWarning('The --frozen-intrinsics flag is experimental',
372
+ - 'ExperimentalWarning');
373
+ + 'ExperimentalWarning');
374
+ require('internal/freeze_intrinsics')();
375
+ }
376
+ }
377
+ @@ -620,6 +625,7 @@ function loadPreloadModules() {
293
378
  // For user code, we preload modules if `-r` is passed
294
379
  const preloadModules = getOptionValue('--require');
295
380
  if (preloadModules && preloadModules.length > 0) {
@@ -298,7 +383,7 @@ index b4a24bbffb..041ee4c715 100644
298
383
  Module: {
299
384
  _preloadModules,
300
385
  diff --git node/lib/vm.js node/lib/vm.js
301
- index 21acc55e2e..8a128bcb5c 100644
386
+ index b48e79c282..3b86fa8933 100644
302
387
  --- node/lib/vm.js
303
388
  +++ node/lib/vm.js
304
389
  @@ -77,6 +77,7 @@ class Script extends ContextifyScript {
@@ -320,10 +405,10 @@ index 21acc55e2e..8a128bcb5c 100644
320
405
  throw e; /* node-do-not-add-exception-line */
321
406
  }
322
407
  diff --git node/node.gyp node/node.gyp
323
- index 6b554d75d8..fce4eb4bd5 100644
408
+ index 08cb3f38e8..6c0d2761ab 100644
324
409
  --- node/node.gyp
325
410
  +++ node/node.gyp
326
- @@ -113,6 +113,9 @@
411
+ @@ -116,6 +116,9 @@
327
412
  },
328
413
 
329
414
  'conditions': [
@@ -347,10 +432,10 @@ index b1ba86b7b0..e2478e537c 100644
347
432
  parent_env_->AddCleanupHook([](void* data) {
348
433
  Environment* env = static_cast<Environment*>(data);
349
434
  diff --git node/src/node.cc node/src/node.cc
350
- index 96cdcd3064..cef0838d53 100644
435
+ index 0c75b5a08e..385a03090f 100644
351
436
  --- node/src/node.cc
352
437
  +++ node/src/node.cc
353
- @@ -314,6 +314,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
438
+ @@ -304,6 +304,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
354
439
  return env->RunSnapshotDeserializeMain();
355
440
  }
356
441
 
@@ -359,7 +444,7 @@ index 96cdcd3064..cef0838d53 100644
359
444
  if (env->worker_context() != nullptr) {
360
445
  return StartExecution(env, "internal/main/worker_thread");
361
446
  }
362
- @@ -546,14 +548,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
447
+ @@ -536,14 +538,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
363
448
  }
364
449
 
365
450
  if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
@@ -555,10 +640,10 @@ index 8099b2a3a1..9cc8a07a55 100644
555
640
  + return adjacent(c, nargv);
556
641
  +}
557
642
  diff --git node/src/node_options.cc node/src/node_options.cc
558
- index 26f205bc3b..e52a31f487 100644
643
+ index 6ee79f7df8..cfc3e8d785 100644
559
644
  --- node/src/node_options.cc
560
645
  +++ node/src/node_options.cc
561
- @@ -307,7 +307,7 @@ DebugOptionsParser::DebugOptionsParser() {
646
+ @@ -314,7 +314,7 @@ DebugOptionsParser::DebugOptionsParser() {
562
647
  #ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
563
648
  if (sea::IsSingleExecutable()) return;
564
649
  #endif
@@ -1,8 +1,8 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index 4589f51517..97555b4c0b 100644
2
+ index db09a8a33d..6b2053467d 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
- @@ -174,7 +174,7 @@
5
+ @@ -182,7 +182,7 @@
6
6
  'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
7
7
  }],
8
8
  ['llvm_version=="0.0"', {
@@ -12,10 +12,10 @@ index 4589f51517..97555b4c0b 100644
12
12
  'lto': ' -flto ', # Clang
13
13
  }],
14
14
  diff --git node/configure.py node/configure.py
15
- index 62f041ce52..4688ec0fdd 100755
15
+ index 84b016cd85..3b31b09f04 100755
16
16
  --- node/configure.py
17
17
  +++ node/configure.py
18
- @@ -1270,7 +1270,6 @@ def configure_node(o):
18
+ @@ -1275,7 +1275,6 @@ def configure_node(o):
19
19
 
20
20
  # Enable branch protection for arm64
21
21
  if target_arch == 'arm64':
@@ -258,7 +258,7 @@ index 88c079d10d..a7eaca0574 100644
258
258
  const permission = require('internal/process/permission');
259
259
  const { kEmptyObject } = require('internal/util');
260
260
  diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
261
- index 917ba90a1c..c69638deba 100644
261
+ index 9142fed75e..557627919e 100644
262
262
  --- node/lib/internal/process/pre_execution.js
263
263
  +++ node/lib/internal/process/pre_execution.js
264
264
  @@ -51,7 +51,11 @@ const {
@@ -273,7 +273,7 @@ index 917ba90a1c..c69638deba 100644
273
273
  return prepareExecution({
274
274
  expandArgv1,
275
275
  initializeModules,
276
- @@ -209,7 +213,8 @@ function patchProcessObject(expandArgv1) {
276
+ @@ -230,7 +234,8 @@ function patchProcessObject(expandArgv1) {
277
277
  // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
278
278
  // the entry point.
279
279
  if (expandArgv1 && process.argv[1] &&
@@ -283,7 +283,7 @@ index 917ba90a1c..c69638deba 100644
283
283
  // Expand process.argv[1] into a full path.
284
284
  const path = require('path');
285
285
  try {
286
- @@ -723,6 +728,7 @@ function loadPreloadModules() {
286
+ @@ -744,6 +749,7 @@ function loadPreloadModules() {
287
287
  // For user code, we preload modules if `-r` is passed
288
288
  const preloadModules = getOptionValue('--require');
289
289
  if (preloadModules && preloadModules.length > 0) {
@@ -292,7 +292,7 @@ index 917ba90a1c..c69638deba 100644
292
292
  Module: {
293
293
  _preloadModules,
294
294
  diff --git node/lib/vm.js node/lib/vm.js
295
- index d396a3df8c..74419c83c1 100644
295
+ index 44861be46d..9775ef58b7 100644
296
296
  --- node/lib/vm.js
297
297
  +++ node/lib/vm.js
298
298
  @@ -80,6 +80,7 @@ class Script extends ContextifyScript {
@@ -327,7 +327,7 @@ index de372400fd..2538afa37d 100644
327
327
  parent_env_->AddCleanupHook([](void* data) {
328
328
  Environment* env = static_cast<Environment*>(data);
329
329
  diff --git node/src/node.cc node/src/node.cc
330
- index a9336a1430..c4a97eb85a 100644
330
+ index 524f80ee69..419cb95c4c 100644
331
331
  --- node/src/node.cc
332
332
  +++ node/src/node.cc
333
333
  @@ -322,6 +322,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -355,7 +355,7 @@ index a9336a1430..c4a97eb85a 100644
355
355
  }
356
356
 
357
357
  diff --git node/src/node_contextify.cc node/src/node_contextify.cc
358
- index 64860d7e56..abdb5593ba 100644
358
+ index a68f6bb686..eab5eb9b8b 100644
359
359
  --- node/src/node_contextify.cc
360
360
  +++ node/src/node_contextify.cc
361
361
  @@ -75,6 +75,7 @@ using v8::String;
@@ -366,7 +366,7 @@ index 64860d7e56..abdb5593ba 100644
366
366
  using v8::Value;
367
367
  using v8::WeakCallbackInfo;
368
368
 
369
- @@ -772,13 +773,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
369
+ @@ -798,13 +799,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
370
370
  Local<ArrayBufferView> cached_data_buf;
371
371
  bool produce_cached_data = false;
372
372
  Local<Context> parsing_context = context;
@@ -383,7 +383,7 @@ index 64860d7e56..abdb5593ba 100644
383
383
  CHECK(args[2]->IsNumber());
384
384
  line_offset = args[2].As<Int32>()->Value();
385
385
  CHECK(args[3]->IsNumber());
386
- @@ -799,6 +801,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
386
+ @@ -825,6 +827,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
387
387
  }
388
388
  CHECK(args[7]->IsSymbol());
389
389
  id_symbol = args[7].As<Symbol>();
@@ -394,7 +394,7 @@ index 64860d7e56..abdb5593ba 100644
394
394
  }
395
395
 
396
396
  ContextifyScript* contextify_script =
397
- @@ -847,6 +853,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
397
+ @@ -873,6 +879,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
398
398
  ShouldNotAbortOnUncaughtScope no_abort_scope(env);
399
399
  Context::Scope scope(parsing_context);
400
400
 
@@ -405,7 +405,7 @@ index 64860d7e56..abdb5593ba 100644
405
405
  MaybeLocal<UnboundScript> maybe_v8_script =
406
406
  ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
407
407
 
408
- @@ -861,6 +871,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
408
+ @@ -887,6 +897,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
409
409
  return;
410
410
  }
411
411
 
@@ -417,7 +417,7 @@ index 64860d7e56..abdb5593ba 100644
417
417
  contextify_script->script_.Reset(isolate, v8_script);
418
418
  contextify_script->script_.SetWeak();
419
419
  contextify_script->object()->SetInternalFieldForNodeCore(kUnboundScriptSlot,
420
- @@ -894,6 +909,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
420
+ @@ -920,6 +935,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
421
421
  .IsNothing())
422
422
  return;
423
423
 
@@ -539,7 +539,7 @@ index f66099a557..4048f6bd93 100644
539
539
  + return adjacent(c, nargv);
540
540
  +}
541
541
  diff --git node/src/node_options.cc node/src/node_options.cc
542
- index 29cb7fc6b2..7a27f506f5 100644
542
+ index 5da6918af8..56c793ba96 100644
543
543
  --- node/src/node_options.cc
544
544
  +++ node/src/node_options.cc
545
545
  @@ -302,6 +302,7 @@ void Parse(
@@ -1,7 +1,6 @@
1
1
  {
2
- "v20.10.0": ["node.v20.10.0.cpp.patch"],
3
- "v19.8.1": ["node.v19.8.1.cpp.patch"],
4
- "v18.18.2": ["node.v18.18.2.cpp.patch"],
2
+ "v20.11.0": ["node.v20.11.0.cpp.patch"],
3
+ "v18.19.0": ["node.v18.19.0.cpp.patch"],
5
4
  "v16.20.2": ["node.v16.20.2.cpp.patch"],
6
5
  "v14.21.3": ["node.v14.21.3.cpp.patch"],
7
6
  "v12.22.11": ["node.v12.22.11.cpp.patch"],
@@ -1,581 +0,0 @@
1
- diff --git node/common.gypi node/common.gypi
2
- index b1d87780db..659da7c790 100644
3
- --- node/common.gypi
4
- +++ node/common.gypi
5
- @@ -174,7 +174,7 @@
6
- 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
7
- }],
8
- ['llvm_version=="0.0"', {
9
- - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
10
- + 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
11
- }, {
12
- 'lto': ' -flto ', # Clang
13
- }],
14
- diff --git node/configure.py node/configure.py
15
- index d7765ef6bd..3c15a61215 100755
16
- --- node/configure.py
17
- +++ node/configure.py
18
- @@ -1265,9 +1265,7 @@ def configure_node(o):
19
-
20
- o['variables']['want_separate_host_toolset'] = int(cross_compiling)
21
-
22
- - # Enable branch protection for arm64
23
- if target_arch == 'arm64':
24
- - o['cflags']+=['-msign-return-address=all']
25
- o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
26
-
27
- if options.node_snapshot_main is not None:
28
- diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
29
- index d3e35d6ec5..6e9bbe3849 100644
30
- --- node/deps/v8/include/v8-initialization.h
31
- +++ node/deps/v8/include/v8-initialization.h
32
- @@ -89,6 +89,10 @@ class V8_EXPORT V8 {
33
- static void SetFlagsFromCommandLine(int* argc, char** argv,
34
- bool remove_flags);
35
-
36
- + static void EnableCompilationForSourcelessUse();
37
- + static void DisableCompilationForSourcelessUse();
38
- + static void FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> script);
39
- +
40
- /** Get the version string. */
41
- static const char* GetVersion();
42
-
43
- diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
44
- index a4a4381614..2998f3c49b 100644
45
- --- node/deps/v8/src/api/api.cc
46
- +++ node/deps/v8/src/api/api.cc
47
- @@ -683,6 +683,29 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
48
- HelpOptions(HelpOptions::kDontExit));
49
- }
50
-
51
- +bool save_lazy;
52
- +bool save_predictable;
53
- +
54
- +void V8::EnableCompilationForSourcelessUse() {
55
- + save_lazy = i::FLAG_lazy;
56
- + i::FLAG_lazy = false;
57
- + save_predictable = i::FLAG_predictable;
58
- + i::FLAG_predictable = true;
59
- +}
60
- +
61
- +void V8::DisableCompilationForSourcelessUse() {
62
- + i::FLAG_lazy = save_lazy;
63
- + i::FLAG_predictable = save_predictable;
64
- +}
65
- +
66
- +void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
67
- + auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
68
- + auto function_info =
69
- + i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
70
- + i::Handle<i::Script> script(i::Script::cast(function_info->script()), isolate);
71
- + script->set_source(i::ReadOnlyRoots(isolate).undefined_value());
72
- +}
73
- +
74
- RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
75
-
76
- RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
77
- diff --git node/deps/v8/src/codegen/compiler.cc node/deps/v8/src/codegen/compiler.cc
78
- index 5431deb83e..d11f04ccac 100644
79
- --- node/deps/v8/src/codegen/compiler.cc
80
- +++ node/deps/v8/src/codegen/compiler.cc
81
- @@ -3497,7 +3497,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
82
- maybe_script = lookup_result.script();
83
- maybe_result = lookup_result.toplevel_sfi();
84
- is_compiled_scope = lookup_result.is_compiled_scope();
85
- - if (!maybe_result.is_null()) {
86
- + if (!maybe_result.is_null() && source->length()) {
87
- compile_timer.set_hit_isolate_cache();
88
- } else if (can_consume_code_cache) {
89
- compile_timer.set_consuming_code_cache();
90
- diff --git node/deps/v8/src/objects/js-function.cc node/deps/v8/src/objects/js-function.cc
91
- index 62fe309a47..f1875ce023 100644
92
- --- node/deps/v8/src/objects/js-function.cc
93
- +++ node/deps/v8/src/objects/js-function.cc
94
- @@ -1245,6 +1245,9 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
95
- Handle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
96
- isolate, function, isolate->factory()->class_positions_symbol());
97
- if (maybe_class_positions->IsClassPositions()) {
98
- + if (String::cast(Script::cast(shared_info->script()).source()).IsUndefined(isolate)) {
99
- + return isolate->factory()->NewStringFromAsciiChecked("class {}");
100
- + }
101
- ClassPositions class_positions =
102
- ClassPositions::cast(*maybe_class_positions);
103
- int start_position = class_positions.start();
104
- diff --git node/deps/v8/src/objects/shared-function-info-inl.h node/deps/v8/src/objects/shared-function-info-inl.h
105
- index 43ef0d3d17..79b774463f 100644
106
- --- node/deps/v8/src/objects/shared-function-info-inl.h
107
- +++ node/deps/v8/src/objects/shared-function-info-inl.h
108
- @@ -637,6 +637,14 @@ bool SharedFunctionInfo::ShouldFlushCode(
109
- }
110
- if (!data.IsBytecodeArray()) return false;
111
-
112
- + Object script_obj = script();
113
- + if (!script_obj.IsUndefined()) {
114
- + Script script = Script::cast(script_obj);
115
- + if (script.source().IsUndefined()) {
116
- + return false;
117
- + }
118
- + }
119
- +
120
- if (IsStressFlushingEnabled(code_flush_mode)) return true;
121
-
122
- BytecodeArray bytecode = BytecodeArray::cast(data);
123
- diff --git node/deps/v8/src/parsing/parsing.cc node/deps/v8/src/parsing/parsing.cc
124
- index 8c55a6fb6e..70bf82a57d 100644
125
- --- node/deps/v8/src/parsing/parsing.cc
126
- +++ node/deps/v8/src/parsing/parsing.cc
127
- @@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, Handle<Script> script,
128
- Isolate* isolate, ReportStatisticsMode mode) {
129
- DCHECK(info->flags().is_toplevel());
130
- DCHECK_NULL(info->literal());
131
- + if (String::cast(script->source()).IsUndefined(isolate)) return false;
132
-
133
- VMState<PARSER> state(isolate);
134
-
135
- @@ -75,6 +76,7 @@ bool ParseFunction(ParseInfo* info, Handle<SharedFunctionInfo> shared_info,
136
-
137
- // Create a character stream for the parser.
138
- Handle<Script> script(Script::cast(shared_info->script()), isolate);
139
- + if (String::cast(script->source()).IsUndefined(isolate)) return false;
140
- Handle<String> source(String::cast(script->source()), isolate);
141
- std::unique_ptr<Utf16CharacterStream> stream(
142
- ScannerStream::For(isolate, source, shared_info->StartPosition(),
143
- diff --git node/deps/v8/src/snapshot/code-serializer.cc node/deps/v8/src/snapshot/code-serializer.cc
144
- index 95352299f8..2dd794b855 100644
145
- --- node/deps/v8/src/snapshot/code-serializer.cc
146
- +++ node/deps/v8/src/snapshot/code-serializer.cc
147
- @@ -661,11 +661,7 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheck(
148
- }
149
-
150
- SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckJustSource(
151
- - uint32_t expected_source_hash) const {
152
- - uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
153
- - if (source_hash != expected_source_hash) {
154
- - return SerializedCodeSanityCheckResult::kSourceMismatch;
155
- - }
156
- + uint32_t) const {
157
- return SerializedCodeSanityCheckResult::kSuccess;
158
- }
159
-
160
- @@ -682,10 +678,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource()
161
- if (version_hash != Version::Hash()) {
162
- return SerializedCodeSanityCheckResult::kVersionMismatch;
163
- }
164
- - uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
165
- - if (flags_hash != FlagList::Hash()) {
166
- - return SerializedCodeSanityCheckResult::kFlagsMismatch;
167
- - }
168
- uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
169
- uint32_t max_payload_length = this->size_ - kHeaderSize;
170
- if (payload_length > max_payload_length) {
171
- diff --git node/lib/child_process.js node/lib/child_process.js
172
- index 5d3e2d63a7..077b96a415 100644
173
- --- node/lib/child_process.js
174
- +++ node/lib/child_process.js
175
- @@ -167,7 +167,7 @@ function fork(modulePath, args = [], options) {
176
- throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
177
- }
178
-
179
- - return spawn(options.execPath, args, options);
180
- + return module.exports.spawn(options.execPath, args, options);
181
- }
182
-
183
- function _forkChild(fd, serializationMode) {
184
- diff --git node/lib/internal/bootstrap/pkg.js node/lib/internal/bootstrap/pkg.js
185
- new file mode 100644
186
- index 0000000000..e97e9e524c
187
- --- /dev/null
188
- +++ node/lib/internal/bootstrap/pkg.js
189
- @@ -0,0 +1,49 @@
190
- +'use strict';
191
- +
192
- +const {
193
- + prepareWorkerThreadExecution,
194
- + prepareMainThreadExecution
195
- +} = require('internal/process/pre_execution');
196
- +
197
- +if (internalBinding('worker').isMainThread) {
198
- + prepareMainThreadExecution(true);
199
- +} else {
200
- + prepareWorkerThreadExecution();
201
- +}
202
- +
203
- +(function () {
204
- + var __require__ = require;
205
- + var fs = __require__('fs');
206
- + var vm = __require__('vm');
207
- + function readPrelude (fd) {
208
- + var PAYLOAD_POSITION = '// PAYLOAD_POSITION //' | 0;
209
- + var PAYLOAD_SIZE = '// PAYLOAD_SIZE //' | 0;
210
- + var PRELUDE_POSITION = '// PRELUDE_POSITION //' | 0;
211
- + var PRELUDE_SIZE = '// PRELUDE_SIZE //' | 0;
212
- + if (!PRELUDE_POSITION) {
213
- + // no prelude - remove entrypoint from argv[1]
214
- + process.argv.splice(1, 1);
215
- + return { undoPatch: true };
216
- + }
217
- + var prelude = Buffer.alloc(PRELUDE_SIZE);
218
- + var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
219
- + if (read !== PRELUDE_SIZE) {
220
- + console.error('Pkg: Error reading from file.');
221
- + process.exit(1);
222
- + }
223
- + var s = new vm.Script(prelude, { filename: 'pkg/prelude/bootstrap.js' });
224
- + var fn = s.runInThisContext();
225
- + return fn(process, __require__,
226
- + console, fd, PAYLOAD_POSITION, PAYLOAD_SIZE);
227
- + }
228
- + (function () {
229
- + var fd = fs.openSync(process.execPath, 'r');
230
- + var result = readPrelude(fd);
231
- + if (result && result.undoPatch) {
232
- + var bindingFs = process.binding('fs');
233
- + fs.internalModuleStat = bindingFs.internalModuleStat;
234
- + fs.internalModuleReadJSON = bindingFs.internalModuleReadJSON;
235
- + fs.closeSync(fd);
236
- + }
237
- + }());
238
- +}());
239
- diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
240
- index de83c69a70..f998e5a168 100644
241
- --- node/lib/internal/modules/cjs/loader.js
242
- +++ node/lib/internal/modules/cjs/loader.js
243
- @@ -94,7 +94,7 @@ const fs = require('fs');
244
- const internalFS = require('internal/fs/utils');
245
- const path = require('path');
246
- const { sep } = path;
247
- -const { internalModuleStat } = internalBinding('fs');
248
- +const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
249
- const { safeGetenv } = internalBinding('credentials');
250
- const {
251
- privateSymbols: {
252
- diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
253
- index bb175d0df5..07f4834c07 100644
254
- --- node/lib/internal/modules/package_json_reader.js
255
- +++ node/lib/internal/modules/package_json_reader.js
256
- @@ -1,7 +1,7 @@
257
- 'use strict';
258
-
259
- const { SafeMap } = primordials;
260
- -const { internalModuleReadJSON } = internalBinding('fs');
261
- +const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
262
- const { pathToFileURL } = require('url');
263
- const { toNamespacedPath } = require('path');
264
-
265
- diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
266
- index ebc699ef1d..f109969a94 100644
267
- --- node/lib/internal/process/pre_execution.js
268
- +++ node/lib/internal/process/pre_execution.js
269
- @@ -36,7 +36,12 @@ const {
270
- },
271
- } = require('internal/v8/startup_snapshot');
272
-
273
- +let _alreadyPrepared = false;
274
- +
275
- function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
276
- + if (_alreadyPrepared === true) return;
277
- + _alreadyPrepared = true;
278
- +
279
- prepareExecution({
280
- expandArgv1,
281
- initializeModules,
282
- @@ -147,7 +152,8 @@ function patchProcessObject(expandArgv1) {
283
- process.argv[0] = process.execPath;
284
-
285
- if (expandArgv1 && process.argv[1] &&
286
- - !StringPrototypeStartsWith(process.argv[1], '-')) {
287
- + !StringPrototypeStartsWith(process.argv[1], '-') &&
288
- + process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
289
- // Expand process.argv[1] into a full path.
290
- const path = require('path');
291
- try {
292
- @@ -597,6 +603,7 @@ function loadPreloadModules() {
293
- // For user code, we preload modules if `-r` is passed
294
- const preloadModules = getOptionValue('--require');
295
- if (preloadModules && preloadModules.length > 0) {
296
- + assert(false, '--require is not supported');
297
- const {
298
- Module: {
299
- _preloadModules,
300
- diff --git node/lib/vm.js node/lib/vm.js
301
- index 19117bca5d..94a21205f1 100644
302
- --- node/lib/vm.js
303
- +++ node/lib/vm.js
304
- @@ -79,6 +79,7 @@ class Script extends ContextifyScript {
305
- produceCachedData = false,
306
- importModuleDynamically,
307
- [kParsingContext]: parsingContext,
308
- + sourceless = false,
309
- } = options;
310
-
311
- validateString(filename, 'options.filename');
312
- @@ -103,7 +104,8 @@ class Script extends ContextifyScript {
313
- columnOffset,
314
- cachedData,
315
- produceCachedData,
316
- - parsingContext);
317
- + parsingContext,
318
- + sourceless);
319
- } catch (e) {
320
- throw e; /* node-do-not-add-exception-line */
321
- }
322
- diff --git node/node.gyp node/node.gyp
323
- index 2e41a7bb22..6131b75467 100644
324
- --- node/node.gyp
325
- +++ node/node.gyp
326
- @@ -110,6 +110,9 @@
327
- },
328
-
329
- 'conditions': [
330
- + ['target_arch=="arm64"', {
331
- + 'cflags': ['-msign-return-address=all'], # Pointer authentication.
332
- + }],
333
- ['OS in "aix os400"', {
334
- 'ldflags': [
335
- '-Wl,-bnoerrmsg',
336
- diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
337
- index 02842c7e5e..ff15f069c3 100644
338
- --- node/src/inspector_agent.cc
339
- +++ node/src/inspector_agent.cc
340
- @@ -696,8 +696,6 @@ bool Agent::Start(const std::string& path,
341
- StartIoThreadAsyncCallback));
342
- uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
343
- start_io_thread_async.data = this;
344
- - // Ignore failure, SIGUSR1 won't work, but that should not block node start.
345
- - StartDebugSignalHandler();
346
-
347
- parent_env_->AddCleanupHook([](void* data) {
348
- Environment* env = static_cast<Environment*>(data);
349
- diff --git node/src/node.cc node/src/node.cc
350
- index 6bdcbb3de9..f94d3d396d 100644
351
- --- node/src/node.cc
352
- +++ node/src/node.cc
353
- @@ -303,6 +303,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
354
- return env->RunSnapshotDeserializeMain();
355
- }
356
-
357
- + StartExecution(env, "internal/bootstrap/pkg");
358
- +
359
- if (env->worker_context() != nullptr) {
360
- return StartExecution(env, "internal/main/worker_thread");
361
- }
362
- @@ -506,14 +508,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
363
- }
364
-
365
- if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
366
- -#if HAVE_INSPECTOR
367
- - sigset_t sigmask;
368
- - sigemptyset(&sigmask);
369
- - sigaddset(&sigmask, SIGUSR1);
370
- - const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
371
- - CHECK_EQ(err, 0);
372
- -#endif // HAVE_INSPECTOR
373
- -
374
- ResetSignalHandlers();
375
- }
376
-
377
- diff --git node/src/node_contextify.cc node/src/node_contextify.cc
378
- index 5aadefd84d..f9c307b178 100644
379
- --- node/src/node_contextify.cc
380
- +++ node/src/node_contextify.cc
381
- @@ -75,6 +75,7 @@ using v8::ScriptOrigin;
382
- using v8::String;
383
- using v8::Uint32;
384
- using v8::UnboundScript;
385
- +using v8::V8;
386
- using v8::Value;
387
- using v8::WeakCallbackInfo;
388
- using v8::WeakCallbackType;
389
- @@ -771,11 +772,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
390
- Local<ArrayBufferView> cached_data_buf;
391
- bool produce_cached_data = false;
392
- Local<Context> parsing_context = context;
393
- + bool sourceless = false;
394
-
395
- if (argc > 2) {
396
- // new ContextifyScript(code, filename, lineOffset, columnOffset,
397
- // cachedData, produceCachedData, parsingContext)
398
- - CHECK_EQ(argc, 7);
399
- + CHECK_EQ(argc, 8);
400
- CHECK(args[2]->IsNumber());
401
- line_offset = args[2].As<Int32>()->Value();
402
- CHECK(args[3]->IsNumber());
403
- @@ -794,6 +796,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
404
- CHECK_NOT_NULL(sandbox);
405
- parsing_context = sandbox->context();
406
- }
407
- + sourceless = args[7]->IsTrue();
408
- }
409
-
410
- ContextifyScript* contextify_script =
411
- @@ -844,6 +847,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
412
- ShouldNotAbortOnUncaughtScope no_abort_scope(env);
413
- Context::Scope scope(parsing_context);
414
-
415
- + if (sourceless && produce_cached_data) {
416
- + V8::EnableCompilationForSourcelessUse();
417
- + }
418
- +
419
- MaybeLocal<UnboundScript> maybe_v8_script =
420
- ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
421
-
422
- @@ -857,6 +864,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
423
- "ContextifyScript::New");
424
- return;
425
- }
426
- +
427
- + if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
428
- + if (!source.GetCachedData()->rejected) {
429
- + V8::FixSourcelessScript(env->isolate(), v8_script);
430
- + }
431
- + }
432
- +
433
- contextify_script->script_.Reset(isolate, v8_script);
434
-
435
- std::unique_ptr<ScriptCompiler::CachedData> new_cached_data;
436
- @@ -881,6 +895,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
437
- .IsNothing())
438
- return;
439
-
440
- + if (sourceless && produce_cached_data) {
441
- + V8::DisableCompilationForSourcelessUse();
442
- + }
443
- +
444
- TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
445
- }
446
-
447
- diff --git node/src/node_main.cc node/src/node_main.cc
448
- index 56deaf47fa..e7ffa1baaa 100644
449
- --- node/src/node_main.cc
450
- +++ node/src/node_main.cc
451
- @@ -22,6 +22,8 @@
452
- #include "node.h"
453
- #include <cstdio>
454
-
455
- +int reorder(int argc, char** argv);
456
- +
457
- #ifdef _WIN32
458
- #include <windows.h>
459
- #include <VersionHelpers.h>
460
- @@ -88,12 +90,95 @@ int wmain(int argc, wchar_t* wargv[]) {
461
- }
462
- argv[argc] = nullptr;
463
- // Now that conversion is done, we can finally start.
464
- - return node::Start(argc, argv);
465
- + return reorder(argc, argv);
466
- }
467
- #else
468
- // UNIX
469
-
470
- int main(int argc, char* argv[]) {
471
- + return reorder(argc, argv);
472
- +}
473
- +#endif
474
- +
475
- +#include <string.h>
476
- +
477
- +int strlen2 (char* s) {
478
- + int len = 0;
479
- + while (*s) {
480
- + len += 1;
481
- + s += 1;
482
- + }
483
- + return len;
484
- +}
485
- +
486
- +bool should_set_dummy() {
487
- +#ifdef _WIN32
488
- + #define MAX_ENV_LENGTH 32767
489
- + wchar_t execpath_env[MAX_ENV_LENGTH];
490
- + DWORD result = GetEnvironmentVariableW(L"PKG_EXECPATH", execpath_env, MAX_ENV_LENGTH);
491
- + if (result == 0 && GetLastError() != ERROR_SUCCESS) return true;
492
- + return wcscmp(execpath_env, L"PKG_INVOKE_NODEJS") != 0;
493
- +#else
494
- + const char* execpath_env = getenv("PKG_EXECPATH");
495
- + if (!execpath_env) return true;
496
- + return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
497
- +#endif
498
- +}
499
- +
500
- +// for uv_setup_args
501
- +int adjacent(int argc, char** argv) {
502
- + size_t size = 0;
503
- + for (int i = 0; i < argc; i++) {
504
- + size += strlen(argv[i]) + 1;
505
- + }
506
- + char* args = new char[size];
507
- + size_t pos = 0;
508
- + for (int i = 0; i < argc; i++) {
509
- + memcpy(&args[pos], argv[i], strlen(argv[i]) + 1);
510
- + argv[i] = &args[pos];
511
- + pos += strlen(argv[i]) + 1;
512
- + }
513
- return node::Start(argc, argv);
514
- }
515
- +
516
- +volatile char* BAKERY = (volatile char*) "\0// BAKERY // BAKERY " \
517
- + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
518
- + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
519
- + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY ";
520
- +
521
- +#ifdef __clang__
522
- +__attribute__((optnone))
523
- +#elif defined(__GNUC__)
524
- +__attribute__((optimize(0)))
525
- #endif
526
- +
527
- +int load_baked(char** nargv) {
528
- + int c = 1;
529
- +
530
- + char* bakery = (char*) BAKERY;
531
- + while (true) {
532
- + size_t width = strlen2(bakery);
533
- + if (width == 0) break;
534
- + nargv[c++] = bakery;
535
- + bakery += width + 1;
536
- + }
537
- +
538
- + return c;
539
- +}
540
- +
541
- +int reorder(int argc, char** argv) {
542
- + char** nargv = new char*[argc + 64];
543
- +
544
- + nargv[0] = argv[0];
545
- + int c = load_baked(nargv);
546
- +
547
- + if (should_set_dummy()) {
548
- + nargv[c++] = (char*) "PKG_DUMMY_ENTRYPOINT";
549
- + }
550
- +
551
- + for (int i = 1; i < argc; i++) {
552
- + nargv[c++] = argv[i];
553
- + }
554
- +
555
- + return adjacent(c, nargv);
556
- +}
557
- diff --git node/src/node_options.cc node/src/node_options.cc
558
- index e7b0ba1073..530d56bd76 100644
559
- --- node/src/node_options.cc
560
- +++ node/src/node_options.cc
561
- @@ -301,6 +301,7 @@ void Parse(
562
- // TODO(addaleax): Make that unnecessary.
563
-
564
- DebugOptionsParser::DebugOptionsParser() {
565
- + return;
566
- #ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
567
- if (sea::IsSingleExecutable()) return;
568
- #endif
569
- diff --git node/tools/icu/icu-generic.gyp node/tools/icu/icu-generic.gyp
570
- index db45e6fbdf..3e39f1fbdf 100644
571
- --- node/tools/icu/icu-generic.gyp
572
- +++ node/tools/icu/icu-generic.gyp
573
- @@ -52,7 +52,7 @@
574
- 'conditions': [
575
- [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
576
- 'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
577
- - 'cflags_cc': [ '-frtti' ],
578
- + 'cflags_cc': [ '-frtti', '-fno-lto' ],
579
- 'cflags_cc!': [ '-fno-rtti' ],
580
- }],
581
- [ 'OS == "mac" or OS == "ios"', {