@yarnpkg/core
Advanced tools
Comparing version 4.0.0-rc.34 to 4.0.0-rc.35
@@ -24,1 +24,2 @@ export declare const openUrl: ((url: string) => Promise<boolean>) | undefined; | ||
export declare function getCaller(): Caller | null; | ||
export declare function availableParallelism(): any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCaller = exports.getArchitectureSet = exports.getArchitectureName = exports.getArchitecture = exports.builtinModules = exports.openUrl = void 0; | ||
exports.availableParallelism = exports.getCaller = exports.getArchitectureSet = exports.getArchitectureName = exports.getArchitecture = exports.builtinModules = exports.openUrl = void 0; | ||
const tslib_1 = require("tslib"); | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const module_1 = tslib_1.__importDefault(require("module")); | ||
const os_1 = tslib_1.__importDefault(require("os")); | ||
const execUtils = tslib_1.__importStar(require("./execUtils")); | ||
@@ -109,1 +110,9 @@ const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
exports.getCaller = getCaller; | ||
function availableParallelism() { | ||
// TODO: Use os.availableParallelism directly when dropping support for Node.js < 19.4.0 | ||
if (`availableParallelism` in os_1.default) | ||
// @ts-expect-error - No types yet | ||
return os_1.default.availableParallelism(); | ||
return Math.max(1, os_1.default.cpus().length); | ||
} | ||
exports.availableParallelism = availableParallelism; |
@@ -15,2 +15,3 @@ /// <reference types="node" /> | ||
includeWarnings?: boolean; | ||
includePrefix?: boolean; | ||
json?: boolean; | ||
@@ -30,2 +31,3 @@ stdout: Writable; | ||
private configuration; | ||
private includePrefix; | ||
private includeFooter; | ||
@@ -53,3 +55,3 @@ private includeInfos; | ||
private forgettableLines; | ||
constructor({ configuration, stdout, json, includeFooter, includeLogs, includeInfos, includeWarnings, forgettableBufferSize, forgettableNames, }: StreamReportOptions); | ||
constructor({ configuration, stdout, json, includePrefix, includeFooter, includeLogs, includeInfos, includeWarnings, forgettableBufferSize, forgettableNames, }: StreamReportOptions); | ||
hasErrors(): boolean; | ||
@@ -90,4 +92,5 @@ exitCode(): 1 | 0; | ||
private formatName; | ||
private formatPrefix; | ||
private formatNameWithHyperlink; | ||
private formatIndent; | ||
} |
@@ -112,3 +112,3 @@ "use strict"; | ||
} | ||
constructor({ configuration, stdout, json = false, includeFooter = true, includeLogs = !json, includeInfos = includeLogs, includeWarnings = includeLogs, forgettableBufferSize = BASE_FORGETTABLE_BUFFER_SIZE, forgettableNames = new Set(), }) { | ||
constructor({ configuration, stdout, json = false, includePrefix = true, includeFooter = true, includeLogs = !json, includeInfos = includeLogs, includeWarnings = includeLogs, forgettableBufferSize = BASE_FORGETTABLE_BUFFER_SIZE, forgettableNames = new Set(), }) { | ||
super(); | ||
@@ -134,2 +134,3 @@ this.uncommitted = new Set(); | ||
this.forgettableNames = new Set([...forgettableNames, ...BASE_FORGETTABLE_NAMES]); | ||
this.includePrefix = includePrefix; | ||
this.includeFooter = includeFooter; | ||
@@ -286,3 +287,3 @@ this.includeInfos = includeInfos; | ||
const prefix = formattedName ? `${formattedName}: ` : ``; | ||
const message = `${formatUtils.pretty(this.configuration, `➤`, `blueBright`)} ${prefix}${this.formatIndent()}${text}`; | ||
const message = `${this.formatPrefix(prefix, `blueBright`)}${text}`; | ||
if (!this.json) { | ||
@@ -316,3 +317,3 @@ if (this.forgettableNames.has(name)) { | ||
if (!this.json) { | ||
this.writeLineWithForgettableReset(`${formatUtils.pretty(this.configuration, `➤`, `yellowBright`)} ${prefix}${this.formatIndent()}${text}`); | ||
this.writeLineWithForgettableReset(`${this.formatPrefix(prefix, `yellowBright`)}${text}`); | ||
} | ||
@@ -329,3 +330,3 @@ else { | ||
if (!this.json) { | ||
this.writeLineWithForgettableReset(`${formatUtils.pretty(this.configuration, `➤`, `redBright`)} ${prefix}${this.formatIndent()}${text}`, { truncate: false }); | ||
this.writeLineWithForgettableReset(`${this.formatPrefix(prefix, `redBright`)}${text}`, { truncate: false }); | ||
} | ||
@@ -538,2 +539,5 @@ else { | ||
} | ||
formatPrefix(prefix, caretColor) { | ||
return this.includePrefix ? `${formatUtils.pretty(this.configuration, `➤`, caretColor)} ${prefix}${this.formatIndent()}` : ``; | ||
} | ||
formatNameWithHyperlink(name) { | ||
@@ -540,0 +544,0 @@ return formatNameWithHyperlink(name, { |
@@ -5,5 +5,5 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const os_1 = require("os"); | ||
const p_limit_1 = tslib_1.__importDefault(require("p-limit")); | ||
const worker_threads_1 = require("worker_threads"); | ||
const nodeUtils = tslib_1.__importStar(require("./nodeUtils")); | ||
const kTaskInfo = Symbol(`kTaskInfo`); | ||
@@ -14,3 +14,3 @@ class WorkerPool { | ||
this.workers = []; | ||
this.limit = (0, p_limit_1.default)(Math.max(1, (0, os_1.cpus)().length)); | ||
this.limit = (0, p_limit_1.default)(nodeUtils.availableParallelism()); | ||
this.cleanupInterval = setInterval(() => { | ||
@@ -17,0 +17,0 @@ if (this.limit.pendingCount === 0 && this.limit.activeCount === 0) { |
{ | ||
"name": "@yarnpkg/core", | ||
"version": "4.0.0-rc.34", | ||
"version": "4.0.0-rc.35", | ||
"stableVersion": "3.3.1", | ||
@@ -16,6 +16,6 @@ "license": "BSD-2-Clause", | ||
"@types/treeify": "^1.0.0", | ||
"@yarnpkg/fslib": "^3.0.0-rc.34", | ||
"@yarnpkg/libzip": "^3.0.0-rc.34", | ||
"@yarnpkg/parsers": "^3.0.0-rc.34", | ||
"@yarnpkg/shell": "^4.0.0-rc.34", | ||
"@yarnpkg/fslib": "^3.0.0-rc.35", | ||
"@yarnpkg/libzip": "^3.0.0-rc.35", | ||
"@yarnpkg/parsers": "^3.0.0-rc.35", | ||
"@yarnpkg/shell": "^4.0.0-rc.35", | ||
"camelcase": "^5.3.1", | ||
@@ -51,6 +51,6 @@ "chalk": "^3.0.0", | ||
"@types/tunnel": "^0.0.0", | ||
"@yarnpkg/cli": "^4.0.0-rc.34", | ||
"@yarnpkg/plugin-link": "^3.0.0-rc.34", | ||
"@yarnpkg/plugin-npm": "^3.0.0-rc.34", | ||
"@yarnpkg/plugin-pnp": "^4.0.0-rc.34", | ||
"@yarnpkg/cli": "^4.0.0-rc.35", | ||
"@yarnpkg/plugin-link": "^3.0.0-rc.35", | ||
"@yarnpkg/plugin-npm": "^3.0.0-rc.35", | ||
"@yarnpkg/plugin-pnp": "^4.0.0-rc.35", | ||
"comment-json": "^2.2.0", | ||
@@ -57,0 +57,0 @@ "esbuild": "npm:esbuild-wasm@^0.15.15", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
785368
13861
Updated@yarnpkg/fslib@^3.0.0-rc.35
Updated@yarnpkg/libzip@^3.0.0-rc.35
Updated@yarnpkg/shell@^4.0.0-rc.35