Skip to content

Commit

Permalink
Merge pull request #1010 from nodejs/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Jul 31, 2024
2 parents a695f6a + 49a9ba4 commit c332260
Show file tree
Hide file tree
Showing 117 changed files with 9,214 additions and 8,882 deletions.
6 changes: 5 additions & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ platforms. This is true regardless of entries in the table below.
| GNU/Linux | s390x | kernel >= 4.18[^1], glibc >= 2.28 | Tier 2 | e.g. RHEL 8 |
| GNU/Linux | loong64 | kernel >= 5.19, glibc >= 2.36 | Experimental | |
| Windows | x64 | >= Windows 10/Server 2016 | Tier 1 | [^2],[^3] |
| Windows | x64 | Windows 8.1/Server 2012 | Experimental | |
| Windows | arm64 | >= Windows 10 | Tier 2 | |
| macOS | x64 | >= 11.0 | Tier 1 | For notes about compilation see [^4] |
| macOS | arm64 | >= 11.0 | Tier 1 | |
Expand Down Expand Up @@ -594,6 +593,11 @@ rebuild may take a lot more time than previous builds. Additionally,
ran `./configure` with non-default options (such as `--debug`), you will need
to run it again before invoking `make -j4`.

If you received the error `nodejs g++ fatal error compilation terminated cc1plus`
during compilation, this is likely a memory issue and you should either provide
more RAM or create swap space to accommodate toolchain requirements or reduce
the number of parallel build tasks (`-j<n>`).

### Windows

#### Tips
Expand Down
8 changes: 8 additions & 0 deletions deps/corepack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.29.3](https://github.com/nodejs/corepack/compare/v0.29.2...v0.29.3) (2024-07-21)


### Bug Fixes

* fallback to `shasum` when `integrity` is not defined ([#542](https://github.com/nodejs/corepack/issues/542)) ([eb63873](https://github.com/nodejs/corepack/commit/eb63873c6c617a2f8ac7106e26ccfe8aa3ae1fb9))
* make `DEBUG=corepack` more useful ([#538](https://github.com/nodejs/corepack/issues/538)) ([6019d7b](https://github.com/nodejs/corepack/commit/6019d7b56e85bd8b7b58a1a487922c707e70e30e))

## [0.29.2](https://github.com/nodejs/corepack/compare/v0.29.1...v0.29.2) (2024-07-13)


Expand Down
14,766 changes: 7,363 additions & 7,403 deletions deps/corepack/dist/lib/corepack.cjs

Large diffs are not rendered by default.

19 changes: 6 additions & 13 deletions deps/corepack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "corepack",
"version": "0.29.2",
"version": "0.29.3",
"homepage": "https://github.com/nodejs/corepack#readme",
"bugs": {
"url": "https://github.com/nodejs/corepack/issues"
Expand All @@ -18,35 +18,28 @@
"license": "MIT",
"packageManager": "[email protected]+sha224.934d21773e22af4b69a7032a2d3b4cb38c1f7c019624777cc9916b23",
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
"@babel/preset-typescript": "^7.13.0",
"@jest/globals": "^29.0.0",
"@types/debug": "^4.1.5",
"@types/jest": "^29.0.0",
"@types/node": "^20.4.6",
"@types/proxy-from-env": "^1",
"@types/semver": "^7.1.0",
"@types/tar": "^6.0.0",
"@types/which": "^3.0.0",
"@yarnpkg/eslint-config": "^2.0.0",
"@yarnpkg/fslib": "^3.0.0-rc.48",
"@zkochan/cmd-shim": "^6.0.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"better-sqlite3": "^10.0.0",
"clipanion": "^3.0.1",
"clipanion": "patch:clipanion@npm%3A3.2.1#~/.yarn/patches/clipanion-npm-3.2.1-fc9187f56c.patch",
"debug": "^4.1.1",
"esbuild": "^0.21.0",
"eslint": "^8.57.0",
"jest": "^29.0.0",
"proxy-from-env": "^1.1.0",
"semver": "^7.5.2",
"semver": "^7.6.3",
"supports-color": "^9.0.0",
"tar": "^6.2.1",
"tar": "^7.4.0",
"tsx": "^4.16.2",
"typescript": "^5.3.3",
"undici": "^6.19.2",
"v8-compile-cache": "^2.3.0",
"vitest": "^2.0.3",
"which": "^4.0.0"
},
"resolutions": {
Expand All @@ -62,7 +55,7 @@
"postpack": "run clean",
"rimraf": "node -e 'for(let i=2;i<process.argv.length;i++)fs.rmSync(process.argv[i],{recursive:true,force:true});'",
"typecheck": "tsc --noEmit",
"test": "jest"
"test": "vitest"
},
"files": [
"dist",
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ if (cluster.isPrimary) {
```cjs
const cluster = require('node:cluster');
const http = require('node:http');
const numCPUs = require('node:os').availableParallelism();
const process = require('node:process');

if (cluster.isPrimary) {
Expand All @@ -335,7 +336,6 @@ if (cluster.isPrimary) {
}

// Start workers and listen for messages containing notifyRequest
const numCPUs = require('node:os').availableParallelism();
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}
Expand Down
7 changes: 7 additions & 0 deletions doc/api/single-executable-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ If the paths are not absolute, Node.js will use the path relative to the
current working directory. The version of the Node.js binary used to produce
the blob must be the same as the one to which the blob will be injected.
Note: When generating cross-platform SEAs (e.g., generating a SEA
for `linux-x64` on `darwin-arm64`), `useCodeCache` and `useSnapshot`
must be set to false to avoid generating incompatible executables.
Since code cache and snapshots can only be loaded on the same platform
where they are compiled, the generated executable might crash on startup when
trying to load code cache or snapshots built on a different platform.
### Assets
Users can include assets by adding a key-path dictionary to the configuration
Expand Down
7 changes: 4 additions & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const {
MathFloor,
MathMin,
MathTrunc,
NumberIsInteger,
NumberIsNaN,
NumberMAX_SAFE_INTEGER,
NumberMIN_SAFE_INTEGER,
Expand Down Expand Up @@ -208,23 +209,23 @@ function _copy(source, target, targetStart, sourceStart, sourceEnd) {
if (targetStart === undefined) {
targetStart = 0;
} else {
targetStart = toInteger(targetStart, 0);
targetStart = NumberIsInteger(targetStart) ? targetStart : toInteger(targetStart, 0);
if (targetStart < 0)
throw new ERR_OUT_OF_RANGE('targetStart', '>= 0', targetStart);
}

if (sourceStart === undefined) {
sourceStart = 0;
} else {
sourceStart = toInteger(sourceStart, 0);
sourceStart = NumberIsInteger(sourceStart) ? sourceStart : toInteger(sourceStart, 0);
if (sourceStart < 0 || sourceStart > source.length)
throw new ERR_OUT_OF_RANGE('sourceStart', `>= 0 && <= ${source.length}`, sourceStart);
}

if (sourceEnd === undefined) {
sourceEnd = source.length;
} else {
sourceEnd = toInteger(sourceEnd, 0);
sourceEnd = NumberIsInteger(sourceEnd) ? sourceEnd : toInteger(sourceEnd, 0);
if (sourceEnd < 0)
throw new ERR_OUT_OF_RANGE('sourceEnd', '>= 0', sourceEnd);
}
Expand Down
39 changes: 19 additions & 20 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function lazyUtilColors() {
}

// Track amount of indentation required via `console.group()`.
const kGroupIndent = Symbol('kGroupIndent');
const kGroupIndentationWidth = Symbol('kGroupIndentWidth');
const kFormatForStderr = Symbol('kFormatForStderr');
const kFormatForStdout = Symbol('kFormatForStdout');
Expand All @@ -91,7 +90,6 @@ const kBindStreamsEager = Symbol('kBindStreamsEager');
const kBindStreamsLazy = Symbol('kBindStreamsLazy');
const kUseStdout = Symbol('kUseStdout');
const kUseStderr = Symbol('kUseStderr');
const kInternalTimeLogImpl = Symbol('kInternalTimeLogImpl');

const optionsMap = new SafeWeakMap();
function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
Expand Down Expand Up @@ -178,6 +176,8 @@ ObjectDefineProperty(Console, SymbolHasInstance, {
const kColorInspectOptions = { colors: true };
const kNoColorInspectOptions = {};

const internalIndentationMap = new SafeWeakMap();

ObjectDefineProperties(Console.prototype, {
[kBindStreamsEager]: {
__proto__: null,
Expand Down Expand Up @@ -247,7 +247,6 @@ ObjectDefineProperties(Console.prototype, {
[kCounts]: { __proto__: null, ...consolePropAttributes, value: new SafeMap() },
[kColorMode]: { __proto__: null, ...consolePropAttributes, value: colorMode },
[kIsConsole]: { __proto__: null, ...consolePropAttributes, value: true },
[kGroupIndent]: { __proto__: null, ...consolePropAttributes, value: '' },
[kGroupIndentationWidth]: {
__proto__: null,
...consolePropAttributes,
Expand All @@ -268,7 +267,7 @@ ObjectDefineProperties(Console.prototype, {
...consolePropAttributes,
value: function(streamSymbol, string, color = '') {
const ignoreErrors = this._ignoreErrors;
const groupIndent = this[kGroupIndent];
const groupIndent = internalIndentationMap.get(this) || '';

const useStdout = streamSymbol === kUseStdout;
const stream = useStdout ? this._stdout : this._stderr;
Expand Down Expand Up @@ -372,11 +371,11 @@ function createWriteErrorHandler(instance, streamSymbol) {
};
}

function timeLogImpl(label, formatted, args) {
function timeLogImpl(consoleRef, label, formatted, args) {
if (args === undefined) {
this.log('%s: %s', label, formatted);
consoleRef.log('%s: %s', label, formatted);
} else {
this.log('%s: %s', label, formatted, ...new SafeArrayIterator(args));
consoleRef.log('%s: %s', label, formatted, ...new SafeArrayIterator(args));
}
}

Expand Down Expand Up @@ -407,17 +406,11 @@ const consoleMethods = {
},

timeEnd(label = 'default') {
if (this[kInternalTimeLogImpl] === undefined)
this[kInternalTimeLogImpl] = FunctionPrototypeBind(timeLogImpl, this);

timeEnd(this._times, kTraceConsoleCategory, 'console.timeEnd()', kNone, this[kInternalTimeLogImpl], label, `time::${label}`);
timeEnd(this._times, kTraceConsoleCategory, 'console.timeEnd()', kNone, (label, formatted, args) => timeLogImpl(this, label, formatted, args), label, `time::${label}`);
},

timeLog(label = 'default', ...data) {
if (this[kInternalTimeLogImpl] === undefined)
this[kInternalTimeLogImpl] = FunctionPrototypeBind(timeLogImpl, this);

timeLog(this._times, kTraceConsoleCategory, 'console.timeLog()', kNone, this[kInternalTimeLogImpl], label, `time::${label}`, data);
timeLog(this._times, kTraceConsoleCategory, 'console.timeLog()', kNone, (label, formatted, args) => timeLogImpl(this, label, formatted, args), label, `time::${label}`, data);
},

trace: function trace(...args) {
Expand Down Expand Up @@ -489,16 +482,22 @@ const consoleMethods = {
if (data.length > 0) {
ReflectApply(this.log, this, data);
}
this[kGroupIndent] +=
StringPrototypeRepeat(' ', this[kGroupIndentationWidth]);

let currentIndentation = internalIndentationMap.get(this) || '';
currentIndentation += StringPrototypeRepeat(' ', this[kGroupIndentationWidth]);

internalIndentationMap.set(this, currentIndentation);
},

groupEnd() {
this[kGroupIndent] = StringPrototypeSlice(
this[kGroupIndent],
const currentIndentation = internalIndentationMap.get(this) || '';
const newIndentation = StringPrototypeSlice(
currentIndentation,
0,
this[kGroupIndent].length - this[kGroupIndentationWidth],
currentIndentation.length - this[kGroupIndentationWidth],
);

internalIndentationMap.set(this, newIndentation);
},

// https://console.spec.whatwg.org/#table
Expand Down
4 changes: 2 additions & 2 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ const win32 = {
*/
basename(path, suffix) {
if (suffix !== undefined)
validateString(suffix, 'ext');
validateString(suffix, 'suffix');
validateString(path, 'path');
let start = 0;
let end = -1;
Expand Down Expand Up @@ -1335,7 +1335,7 @@ const posix = {
*/
basename(path, suffix) {
if (suffix !== undefined)
validateString(suffix, 'ext');
validateString(suffix, 'suffix');
validateString(path, 'path');

let start = 0;
Expand Down
26 changes: 10 additions & 16 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
Boolean,
Int8Array,
ObjectAssign,
ObjectKeys,
StringPrototypeCharCodeAt,
decodeURIComponent,
Expand Down Expand Up @@ -735,11 +736,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
}

const result = new Url();
const tkeys = ObjectKeys(this);
for (let tk = 0; tk < tkeys.length; tk++) {
const tkey = tkeys[tk];
result[tkey] = this[tkey];
}
ObjectAssign(result, this);

// Hash is always overridden, no matter what.
// even href="" will remove it.
Expand All @@ -754,12 +751,13 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// Hrefs like //foo/bar always cut to the protocol.
if (relative.slashes && !relative.protocol) {
// Take everything except the protocol from relative
const rkeys = ObjectKeys(relative);
for (let rk = 0; rk < rkeys.length; rk++) {
const rkey = rkeys[rk];
if (rkey !== 'protocol')
result[rkey] = relative[rkey];
}
const relativeWithoutProtocol = ObjectKeys(relative).reduce((acc, key) => {
if (key !== 'protocol') {
acc[key] = relative[key];
}
return acc;
}, {});
ObjectAssign(result, relativeWithoutProtocol);

// urlParse appends trailing / to urls like http://www.example.com
if (slashedProtocol.has(result.protocol) &&
Expand All @@ -781,11 +779,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// because that's known to be hostless.
// anything else is assumed to be absolute.
if (!slashedProtocol.has(relative.protocol)) {
const keys = ObjectKeys(relative);
for (let v = 0; v < keys.length; v++) {
const k = keys[v];
result[k] = relative[k];
}
ObjectAssign(result, relative);
result.href = result.format();
return result;
}
Expand Down
Loading

0 comments on commit c332260

Please sign in to comment.