Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: node 20.11.0 and 18.19.0 patches #18

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false # prevent test to stop if one fails
matrix:
node-version: [12, 14, 16, 18, 19, 20] # match patched node versions
node-version: [12, 14, 16, 18, 20] # match patched node versions
os: [ubuntu-latest] # Skip macos-latest, windows-latest for now

runs-on: ${{ matrix.os }}
Expand Down
155 changes: 120 additions & 35 deletions patches/node.v18.18.2.cpp.patch → patches/node.v18.19.0.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git node/common.gypi node/common.gypi
index 94fae06518..e4116f3c82 100644
index dba2631f21..4c4c430dc1 100644
--- node/common.gypi
+++ node/common.gypi
@@ -174,7 +174,7 @@
Expand All @@ -12,7 +12,7 @@ index 94fae06518..e4116f3c82 100644
'lto': ' -flto ', # Clang
}],
diff --git node/configure.py node/configure.py
index 7006ee6581..12fb2ac8d1 100755
index 4638f04b6a..ffa1c6338a 100755
--- node/configure.py
+++ node/configure.py
@@ -1289,9 +1289,7 @@ def configure_node(o):
Expand Down Expand Up @@ -169,7 +169,7 @@ index 618cf9e975..64a57e8afe 100644
uint32_t max_payload_length = this->size_ - kHeaderSize;
if (payload_length > max_payload_length) {
diff --git node/lib/child_process.js node/lib/child_process.js
index 5bdc474c80..196778e7db 100644
index 449013906e..3a85e4a541 100644
--- node/lib/child_process.js
+++ node/lib/child_process.js
@@ -169,7 +169,7 @@ function fork(modulePath, args = [], options) {
Expand Down Expand Up @@ -237,59 +237,144 @@ index 0000000000..a697294fdf
+ }());
+}());
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
index 88bb870a8f..22bbdd9058 100644
index 316996a8c3..8cd0727556 100644
--- node/lib/internal/modules/cjs/loader.js
+++ node/lib/internal/modules/cjs/loader.js
@@ -94,7 +94,7 @@ const fs = require('fs');
const internalFS = require('internal/fs/utils');
@@ -89,7 +89,7 @@ const { internalCompileFunction } = require('internal/vm');
const assert = require('internal/assert');
const fs = require('fs');
const path = require('path');
const { sep } = path;
-const { internalModuleStat } = internalBinding('fs');
+const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
const packageJsonReader = require('internal/modules/package_json_reader');
const { safeGetenv } = internalBinding('credentials');
const {
privateSymbols: {
diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
index bb175d0df5..07f4834c07 100644
index 1968960576..d73016f3fe 100644
--- node/lib/internal/modules/package_json_reader.js
+++ node/lib/internal/modules/package_json_reader.js
@@ -1,7 +1,7 @@
'use strict';

const { SafeMap } = primordials;
@@ -12,7 +12,7 @@ const {
const {
ERR_INVALID_PACKAGE_CONFIG,
} = require('internal/errors').codes;
-const { internalModuleReadJSON } = internalBinding('fs');
+const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
const { pathToFileURL } = require('url');
const { toNamespacedPath } = require('path');
const { resolve, sep, toNamespacedPath } = require('path');
const { kEmptyObject } = require('internal/util');

diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
index b4a24bbffb..041ee4c715 100644
index 4795be82e7..977124a014 100644
--- node/lib/internal/process/pre_execution.js
+++ node/lib/internal/process/pre_execution.js
@@ -36,7 +36,12 @@ const {
isBuildingSnapshot,
} = require('v8').startupSnapshot;
@@ -36,7 +36,11 @@ const {
},
} = require('internal/v8/startup_snapshot');

+let _alreadyPrepared = false;
+
function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
+ if (_alreadyPrepared === true) return;
+ _alreadyPrepared = true;
+
prepareExecution({
return prepareExecution({
expandArgv1,
initializeModules,
@@ -155,7 +160,8 @@ function patchProcessObject(expandArgv1) {
process.argv[0] = process.execPath;

@@ -191,7 +195,8 @@ function patchProcessObject(expandArgv1) {
// If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
// the entry point.
if (expandArgv1 && process.argv[1] &&
- !StringPrototypeStartsWith(process.argv[1], '-')) {
+ !StringPrototypeStartsWith(process.argv[1], '-') &&
+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
+ !StringPrototypeStartsWith(process.argv[1], '-') &&
+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
// Expand process.argv[1] into a full path.
const path = require('path');
try {
@@ -603,6 +609,7 @@ function loadPreloadModules() {
@@ -263,7 +268,7 @@ function setupWarningHandler() {
// https://fetch.spec.whatwg.org/
function setupFetch() {
if (process.config.variables.node_no_browser_globals ||
- getOptionValue('--no-experimental-fetch')) {
+ getOptionValue('--no-experimental-fetch')) {
return;
}

@@ -313,7 +318,7 @@ function setupFetch() {
// removed.
function setupWebCrypto() {
if (process.config.variables.node_no_browser_globals ||
- !getOptionValue('--experimental-global-webcrypto')) {
+ !getOptionValue('--experimental-global-webcrypto')) {
return;
}

@@ -335,7 +340,7 @@ function setupCodeCoverage() {
// --experimental-test-coverage flag is present, as the test runner will
// handle coverage.
if (process.env.NODE_V8_COVERAGE &&
- !getOptionValue('--experimental-test-coverage')) {
+ !getOptionValue('--experimental-test-coverage')) {
process.env.NODE_V8_COVERAGE =
setupCoverageHooks(process.env.NODE_V8_COVERAGE);
}
@@ -345,7 +350,7 @@ function setupCodeCoverage() {
// removed.
function setupCustomEvent() {
if (process.config.variables.node_no_browser_globals ||
- !getOptionValue('--experimental-global-customevent')) {
+ !getOptionValue('--experimental-global-customevent')) {
return;
}
const { CustomEvent } = require('internal/event_target');
@@ -468,10 +473,10 @@ function initializeDeprecations() {
]) {
utilBinding[name] = pendingDeprecation ?
deprecate(types[name],
- 'Accessing native typechecking bindings of Node ' +
- 'directly is deprecated. ' +
- `Please use \`util.types.${name}\` instead.`,
- 'DEP0103') :
+ 'Accessing native typechecking bindings of Node ' +
+ 'directly is deprecated. ' +
+ `Please use \`util.types.${name}\` instead.`,
+ 'DEP0103') :
types[name];
}

@@ -492,12 +497,12 @@ function initializeDeprecations() {

if (pendingDeprecation) {
process.binding = deprecate(process.binding,
- 'process.binding() is deprecated. ' +
- 'Please use public APIs instead.', 'DEP0111');
+ 'process.binding() is deprecated. ' +
+ 'Please use public APIs instead.', 'DEP0111');

process._tickCallback = deprecate(process._tickCallback,
- 'process._tickCallback() is deprecated',
- 'DEP0134');
+ 'process._tickCallback() is deprecated',
+ 'DEP0134');
}
}

@@ -533,7 +538,7 @@ function readPolicyFromDisk() {
const experimentalPolicy = getOptionValue('--experimental-policy');
if (experimentalPolicy) {
process.emitWarning('Policies are experimental.',
- 'ExperimentalWarning');
+ 'ExperimentalWarning');
const { pathToFileURL, URL } = require('internal/url');
// URL here as it is slightly different parsing
// no bare specifiers for now
@@ -611,7 +616,7 @@ function initializeSourceMapsHandlers() {
function initializeFrozenIntrinsics() {
if (getOptionValue('--frozen-intrinsics')) {
process.emitWarning('The --frozen-intrinsics flag is experimental',
- 'ExperimentalWarning');
+ 'ExperimentalWarning');
require('internal/freeze_intrinsics')();
}
}
@@ -620,6 +625,7 @@ function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
if (preloadModules && preloadModules.length > 0) {
Expand All @@ -298,7 +383,7 @@ index b4a24bbffb..041ee4c715 100644
Module: {
_preloadModules,
diff --git node/lib/vm.js node/lib/vm.js
index 21acc55e2e..8a128bcb5c 100644
index b48e79c282..3b86fa8933 100644
--- node/lib/vm.js
+++ node/lib/vm.js
@@ -77,6 +77,7 @@ class Script extends ContextifyScript {
Expand All @@ -320,10 +405,10 @@ index 21acc55e2e..8a128bcb5c 100644
throw e; /* node-do-not-add-exception-line */
}
diff --git node/node.gyp node/node.gyp
index 6b554d75d8..fce4eb4bd5 100644
index 08cb3f38e8..6c0d2761ab 100644
--- node/node.gyp
+++ node/node.gyp
@@ -113,6 +113,9 @@
@@ -116,6 +116,9 @@
},

'conditions': [
Expand All @@ -347,10 +432,10 @@ index b1ba86b7b0..e2478e537c 100644
parent_env_->AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
diff --git node/src/node.cc node/src/node.cc
index 96cdcd3064..cef0838d53 100644
index 0c75b5a08e..385a03090f 100644
--- node/src/node.cc
+++ node/src/node.cc
@@ -314,6 +314,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -304,6 +304,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return env->RunSnapshotDeserializeMain();
}

Expand All @@ -359,7 +444,7 @@ index 96cdcd3064..cef0838d53 100644
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
@@ -546,14 +548,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
@@ -536,14 +538,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
}

if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
Expand Down Expand Up @@ -555,10 +640,10 @@ index 8099b2a3a1..9cc8a07a55 100644
+ return adjacent(c, nargv);
+}
diff --git node/src/node_options.cc node/src/node_options.cc
index 26f205bc3b..e52a31f487 100644
index 6ee79f7df8..cfc3e8d785 100644
--- node/src/node_options.cc
+++ node/src/node_options.cc
@@ -307,7 +307,7 @@ DebugOptionsParser::DebugOptionsParser() {
@@ -314,7 +314,7 @@ DebugOptionsParser::DebugOptionsParser() {
#ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
if (sea::IsSingleExecutable()) return;
#endif
Expand Down
Loading
Loading