@yarnpkg/core
Advanced tools
Comparing version 3.2.0-rc.11 to 3.2.0-rc.12
@@ -9,8 +9,8 @@ "use strict"; | ||
const crypto_1 = require("crypto"); | ||
const fs_1 = (0, tslib_1.__importDefault)(require("fs")); | ||
const fs_1 = tslib_1.__importDefault(require("fs")); | ||
const MessageName_1 = require("./MessageName"); | ||
const Report_1 = require("./Report"); | ||
const hashUtils = (0, tslib_1.__importStar)(require("./hashUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const hashUtils = tslib_1.__importStar(require("./hashUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
const CACHE_VERSION = 8; | ||
@@ -17,0 +17,0 @@ class Cache { |
@@ -12,2 +12,3 @@ /// <reference types="node" /> | ||
import * as miscUtils from './miscUtils'; | ||
import * as nodeUtils from './nodeUtils'; | ||
import { IdentHash, Package, PackageExtension } from './types'; | ||
@@ -33,2 +34,3 @@ export declare const ENVIRONMENT_PREFIX = "yarn_"; | ||
cpu: Array<string> | null; | ||
libc: Array<string> | null; | ||
}; | ||
@@ -298,6 +300,3 @@ export declare type FormatType = formatUtils.Type; | ||
getLinkers(): import("./Linker").Linker[]; | ||
getSupportedArchitectures(): { | ||
os: string[] | null; | ||
cpu: string[] | null; | ||
}; | ||
getSupportedArchitectures(): nodeUtils.ArchitectureSet; | ||
refreshPackageExtensions(): Promise<void>; | ||
@@ -304,0 +303,0 @@ normalizePackage(original: Package): Package; |
@@ -8,6 +8,6 @@ "use strict"; | ||
const parsers_1 = require("@yarnpkg/parsers"); | ||
const camelcase_1 = (0, tslib_1.__importDefault)(require("camelcase")); | ||
const camelcase_1 = tslib_1.__importDefault(require("camelcase")); | ||
const ci_info_1 = require("ci-info"); | ||
const clipanion_1 = require("clipanion"); | ||
const p_limit_1 = (0, tslib_1.__importDefault)(require("p-limit")); | ||
const p_limit_1 = tslib_1.__importDefault(require("p-limit")); | ||
const stream_1 = require("stream"); | ||
@@ -23,8 +23,8 @@ const CorePlugin_1 = require("./CorePlugin"); | ||
const WorkspaceResolver_1 = require("./WorkspaceResolver"); | ||
const folderUtils = (0, tslib_1.__importStar)(require("./folderUtils")); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const nodeUtils = (0, tslib_1.__importStar)(require("./nodeUtils")); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const folderUtils = tslib_1.__importStar(require("./folderUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const nodeUtils = tslib_1.__importStar(require("./nodeUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
const types_1 = require("./types"); | ||
@@ -256,2 +256,9 @@ const IGNORED_ENV_VARIABLES = new Set([ | ||
}, | ||
libc: { | ||
description: `Array of supported libc libraries, or null to target them all`, | ||
type: SettingsType.STRING, | ||
isArray: true, | ||
isNullable: true, | ||
default: [`current`], | ||
}, | ||
}, | ||
@@ -1122,10 +1129,14 @@ }, | ||
getSupportedArchitectures() { | ||
const architecture = nodeUtils.getArchitecture(); | ||
const supportedArchitectures = this.get(`supportedArchitectures`); | ||
let os = supportedArchitectures.get(`os`); | ||
if (os !== null) | ||
os = os.map(value => value === `current` ? process.platform : value); | ||
os = os.map(value => value === `current` ? architecture.os : value); | ||
let cpu = supportedArchitectures.get(`cpu`); | ||
if (cpu !== null) | ||
cpu = cpu.map(value => value === `current` ? process.arch : value); | ||
return { os, cpu }; | ||
cpu = cpu.map(value => value === `current` ? architecture.cpu : value); | ||
let libc = supportedArchitectures.get(`libc`); | ||
if (libc !== null) | ||
libc = miscUtils.mapAndFilter(libc, value => { var _a; return value === `current` ? (_a = architecture.libc) !== null && _a !== void 0 ? _a : miscUtils.mapAndFilter.skip : value; }); | ||
return { os, cpu, libc }; | ||
} | ||
@@ -1132,0 +1143,0 @@ async refreshPackageExtensions() { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const MessageName_1 = require("./MessageName"); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
exports.CorePlugin = { | ||
@@ -9,0 +9,0 @@ hooks: { |
@@ -6,7 +6,7 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const cross_spawn_1 = (0, tslib_1.__importDefault)(require("cross-spawn")); | ||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn")); | ||
const Configuration_1 = require("./Configuration"); | ||
const MessageName_1 = require("./MessageName"); | ||
const Report_1 = require("./Report"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
var EndStrategy; | ||
@@ -13,0 +13,0 @@ (function (EndStrategy) { |
@@ -6,10 +6,10 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const ci_info_1 = (0, tslib_1.__importDefault)(require("ci-info")); | ||
const chalk_1 = tslib_1.__importDefault(require("chalk")); | ||
const ci_info_1 = tslib_1.__importDefault(require("ci-info")); | ||
const clipanion_1 = require("clipanion"); | ||
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch")); | ||
const strip_ansi_1 = (0, tslib_1.__importDefault)(require("strip-ansi")); | ||
const micromatch_1 = tslib_1.__importDefault(require("micromatch")); | ||
const strip_ansi_1 = tslib_1.__importDefault(require("strip-ansi")); | ||
const MessageName_1 = require("./MessageName"); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
const types_1 = require("./types"); | ||
@@ -16,0 +16,0 @@ // We have to workaround a TS bug: |
@@ -7,3 +7,3 @@ "use strict"; | ||
const crypto_1 = require("crypto"); | ||
const globby_1 = (0, tslib_1.__importDefault)(require("globby")); | ||
const globby_1 = tslib_1.__importDefault(require("globby")); | ||
function makeHash(...args) { | ||
@@ -10,0 +10,0 @@ const hash = (0, crypto_1.createHash)(`sha512`); |
@@ -9,9 +9,9 @@ "use strict"; | ||
const http_1 = require("http"); | ||
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch")); | ||
const tunnel_1 = (0, tslib_1.__importDefault)(require("tunnel")); | ||
const micromatch_1 = tslib_1.__importDefault(require("micromatch")); | ||
const tunnel_1 = tslib_1.__importDefault(require("tunnel")); | ||
const url_1 = require("url"); | ||
const MessageName_1 = require("./MessageName"); | ||
const Report_1 = require("./Report"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
var got_2 = require("got"); | ||
@@ -212,3 +212,3 @@ Object.defineProperty(exports, "RequestError", { enumerable: true, get: function () { return got_2.RequestError; } }); | ||
const httpsKeyFilePath = networkConfig.httpsKeyFilePath; | ||
const { default: got } = await Promise.resolve().then(() => (0, tslib_1.__importStar)(require(`got`))); | ||
const { default: got } = await Promise.resolve().then(() => tslib_1.__importStar(require(`got`))); | ||
const certificateAuthority = caFilePath | ||
@@ -215,0 +215,0 @@ ? await getCachedFile(caFilePath) |
@@ -7,2 +7,3 @@ import * as execUtils from './execUtils'; | ||
import * as miscUtils from './miscUtils'; | ||
import * as nodeUtils from './nodeUtils'; | ||
import * as scriptUtils from './scriptUtils'; | ||
@@ -49,2 +50,3 @@ import * as semverUtils from './semverUtils'; | ||
export { miscUtils }; | ||
export { nodeUtils }; | ||
export { scriptUtils }; | ||
@@ -51,0 +53,0 @@ export { semverUtils }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.treeUtils = exports.tgzUtils = exports.structUtils = exports.semverUtils = exports.scriptUtils = exports.miscUtils = exports.formatUtils = exports.folderUtils = exports.execUtils = exports.httpUtils = exports.hashUtils = exports.PackageExtensionStatus = exports.PackageExtensionType = exports.LinkType = exports.YarnVersion = exports.Workspace = exports.WorkspaceResolver = exports.VirtualFetcher = exports.ThrowReport = exports.TelemetryManager = exports.StreamReport = exports.Report = exports.ReportError = exports.TAG_REGEXP = exports.InstallMode = exports.Project = exports.stringifyMessageName = exports.parseMessageName = exports.MessageName = exports.Manifest = exports.LightReport = exports.BuildType = exports.SettingsType = exports.ProjectLookup = exports.FormatType = exports.Configuration = exports.DEFAULT_LOCK_FILENAME = exports.DEFAULT_RC_FILENAME = exports.Cache = void 0; | ||
exports.treeUtils = exports.tgzUtils = exports.structUtils = exports.semverUtils = exports.scriptUtils = exports.nodeUtils = exports.miscUtils = exports.formatUtils = exports.folderUtils = exports.execUtils = exports.httpUtils = exports.hashUtils = exports.PackageExtensionStatus = exports.PackageExtensionType = exports.LinkType = exports.YarnVersion = exports.Workspace = exports.WorkspaceResolver = exports.VirtualFetcher = exports.ThrowReport = exports.TelemetryManager = exports.StreamReport = exports.Report = exports.ReportError = exports.TAG_REGEXP = exports.InstallMode = exports.Project = exports.stringifyMessageName = exports.parseMessageName = exports.MessageName = exports.Manifest = exports.LightReport = exports.BuildType = exports.SettingsType = exports.ProjectLookup = exports.FormatType = exports.Configuration = exports.DEFAULT_LOCK_FILENAME = exports.DEFAULT_RC_FILENAME = exports.Cache = void 0; | ||
const tslib_1 = require("tslib"); | ||
const execUtils = (0, tslib_1.__importStar)(require("./execUtils")); | ||
const execUtils = tslib_1.__importStar(require("./execUtils")); | ||
exports.execUtils = execUtils; | ||
const folderUtils = (0, tslib_1.__importStar)(require("./folderUtils")); | ||
const folderUtils = tslib_1.__importStar(require("./folderUtils")); | ||
exports.folderUtils = folderUtils; | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
exports.formatUtils = formatUtils; | ||
const hashUtils = (0, tslib_1.__importStar)(require("./hashUtils")); | ||
const hashUtils = tslib_1.__importStar(require("./hashUtils")); | ||
exports.hashUtils = hashUtils; | ||
const httpUtils = (0, tslib_1.__importStar)(require("./httpUtils")); | ||
const httpUtils = tslib_1.__importStar(require("./httpUtils")); | ||
exports.httpUtils = httpUtils; | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
exports.miscUtils = miscUtils; | ||
const scriptUtils = (0, tslib_1.__importStar)(require("./scriptUtils")); | ||
const nodeUtils = tslib_1.__importStar(require("./nodeUtils")); | ||
exports.nodeUtils = nodeUtils; | ||
const scriptUtils = tslib_1.__importStar(require("./scriptUtils")); | ||
exports.scriptUtils = scriptUtils; | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
exports.semverUtils = semverUtils; | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
exports.structUtils = structUtils; | ||
const tgzUtils = (0, tslib_1.__importStar)(require("./tgzUtils")); | ||
const tgzUtils = tslib_1.__importStar(require("./tgzUtils")); | ||
exports.tgzUtils = tgzUtils; | ||
const treeUtils = (0, tslib_1.__importStar)(require("./treeUtils")); | ||
const treeUtils = tslib_1.__importStar(require("./treeUtils")); | ||
exports.treeUtils = treeUtils; | ||
@@ -27,0 +29,0 @@ var Cache_1 = require("./Cache"); |
@@ -8,4 +8,4 @@ "use strict"; | ||
const MessageName_1 = require("./MessageName"); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
exports.IMPORTED_PATTERNS = [ | ||
@@ -12,0 +12,0 @@ // These ones come from Git urls |
@@ -7,3 +7,3 @@ "use strict"; | ||
const StreamReport_1 = require("./StreamReport"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
class LightReport extends Report_1.Report { | ||
@@ -10,0 +10,0 @@ constructor({ configuration, stdout, suggestInstall = true }) { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class LockfileResolver { | ||
@@ -8,0 +8,0 @@ constructor(resolver) { |
@@ -37,2 +37,3 @@ import { FakeFS, Filename, PortablePath } from '@yarnpkg/fslib'; | ||
cpu: Array<string> | null; | ||
libc: Array<string> | null; | ||
type: string | null; | ||
@@ -96,3 +97,9 @@ packageManager: string | null; | ||
getConditions(): string | null; | ||
/** | ||
* @deprecated Prefer getConditions() instead | ||
*/ | ||
isCompatibleWithOS(os: string): boolean; | ||
/** | ||
* @deprecated Prefer getConditions() instead | ||
*/ | ||
isCompatibleWithCPU(cpu: string): boolean; | ||
@@ -99,0 +106,0 @@ ensureDependencyMeta(descriptor: Descriptor): DependencyMeta; |
@@ -7,7 +7,7 @@ "use strict"; | ||
const parsers_1 = require("@yarnpkg/parsers"); | ||
const semver_1 = (0, tslib_1.__importDefault)(require("semver")); | ||
const semver_1 = tslib_1.__importDefault(require("semver")); | ||
const WorkspaceResolver_1 = require("./WorkspaceResolver"); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class Manifest { | ||
@@ -20,2 +20,3 @@ constructor() { | ||
this.cpu = null; | ||
this.libc = null; | ||
this.type = null; | ||
@@ -170,2 +171,17 @@ this.packageManager = null; | ||
} | ||
if (Array.isArray(data.libc)) { | ||
const libc = []; | ||
this.libc = libc; | ||
for (const item of data.libc) { | ||
if (typeof item !== `string`) { | ||
errors.push(new Error(`Parsing failed for the 'libc' field`)); | ||
} | ||
else { | ||
libc.push(item); | ||
} | ||
} | ||
} | ||
else { | ||
this.libc = null; | ||
} | ||
if (typeof data.type === `string`) | ||
@@ -562,7 +578,15 @@ this.type = data.type; | ||
fields.push(toConditionLine(`cpu`, this.cpu)); | ||
if (this.libc && this.libc.length > 0) | ||
fields.push(toConditionLine(`libc`, this.libc)); | ||
return fields.length > 0 ? fields.join(` & `) : null; | ||
} | ||
/** | ||
* @deprecated Prefer getConditions() instead | ||
*/ | ||
isCompatibleWithOS(os) { | ||
return Manifest.isManifestFieldCompatible(this.os, os); | ||
} | ||
/** | ||
* @deprecated Prefer getConditions() instead | ||
*/ | ||
isCompatibleWithCPU(cpu) { | ||
@@ -569,0 +593,0 @@ return Manifest.isManifestFieldCompatible(this.cpu, cpu); |
@@ -7,5 +7,5 @@ "use strict"; | ||
const clipanion_1 = require("clipanion"); | ||
const micromatch_1 = (0, tslib_1.__importDefault)(require("micromatch")); | ||
const p_limit_1 = (0, tslib_1.__importDefault)(require("p-limit")); | ||
const semver_1 = (0, tslib_1.__importDefault)(require("semver")); | ||
const micromatch_1 = tslib_1.__importDefault(require("micromatch")); | ||
const p_limit_1 = tslib_1.__importDefault(require("p-limit")); | ||
const semver_1 = tslib_1.__importDefault(require("semver")); | ||
const stream_1 = require("stream"); | ||
@@ -12,0 +12,0 @@ /** |
@@ -7,3 +7,3 @@ "use strict"; | ||
const Report_1 = require("./Report"); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class MultiFetcher { | ||
@@ -10,0 +10,0 @@ constructor(fetchers) { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class MultiResolver { | ||
@@ -8,0 +8,0 @@ constructor(resolvers) { |
export declare function builtinModules(): Set<string>; | ||
export declare type Architecture = { | ||
os: string; | ||
cpu: string; | ||
libc: string | null; | ||
}; | ||
export declare type ArchitectureSet = { | ||
os: Array<string> | null; | ||
cpu: Array<string> | null; | ||
libc: Array<string> | null; | ||
}; | ||
export declare function getArchitecture(): Architecture; | ||
export declare function getArchitectureName(architecture?: Architecture): string; | ||
export declare function getArchitectureSet(): ArchitectureSet; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.builtinModules = void 0; | ||
exports.getArchitectureSet = exports.getArchitectureName = exports.getArchitecture = exports.builtinModules = void 0; | ||
const tslib_1 = require("tslib"); | ||
const module_1 = (0, tslib_1.__importDefault)(require("module")); | ||
const module_1 = tslib_1.__importDefault(require("module")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
function builtinModules() { | ||
@@ -11,1 +12,50 @@ // @ts-expect-error | ||
exports.builtinModules = builtinModules; | ||
function getLibc() { | ||
var _a, _b, _c, _d; | ||
// It seems that Node randomly crashes with no output under some circumstances when running a getReport() on Windows. | ||
// Since Windows has no libc anyway, shortcut this path. | ||
if (process.platform === `win32`) | ||
return null; | ||
const report = (_b = (_a = process.report) === null || _a === void 0 ? void 0 : _a.getReport()) !== null && _b !== void 0 ? _b : {}; | ||
const sharedObjects = (_c = report.sharedObjects) !== null && _c !== void 0 ? _c : []; | ||
// Matches the first group if libc, second group if musl | ||
const libcRegExp = /\/(?:(ld-linux-|[^/]+-linux-gnu\/)|(libc.musl-|ld-musl-))/; | ||
return (_d = miscUtils.mapAndFind(sharedObjects, entry => { | ||
const match = entry.match(libcRegExp); | ||
if (!match) | ||
return miscUtils.mapAndFind.skip; | ||
if (match[1]) | ||
return `glibc`; | ||
if (match[2]) | ||
return `musl`; | ||
throw new Error(`Assertion failed: Expected the libc variant to have been detected`); | ||
})) !== null && _d !== void 0 ? _d : null; | ||
} | ||
let architecture; | ||
let architectureSet; | ||
function getArchitecture() { | ||
return architecture = architecture !== null && architecture !== void 0 ? architecture : { | ||
os: process.platform, | ||
cpu: process.arch, | ||
libc: getLibc(), | ||
}; | ||
} | ||
exports.getArchitecture = getArchitecture; | ||
function getArchitectureName(architecture = getArchitecture()) { | ||
if (architecture.libc) { | ||
return `${architecture.os}-${architecture.cpu}-${architecture.libc}`; | ||
} | ||
else { | ||
return `${architecture.os}-${architecture.cpu}`; | ||
} | ||
} | ||
exports.getArchitectureName = getArchitectureName; | ||
function getArchitectureSet() { | ||
const architecture = getArchitecture(); | ||
return architectureSet = architectureSet !== null && architectureSet !== void 0 ? architectureSet : { | ||
os: [architecture.os], | ||
cpu: [architecture.cpu], | ||
libc: architecture.libc ? [architecture.libc] : [], | ||
}; | ||
} | ||
exports.getArchitectureSet = getArchitectureSet; |
@@ -5,5 +5,5 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const semver_1 = (0, tslib_1.__importDefault)(require("semver")); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const semver_1 = tslib_1.__importDefault(require("semver")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
exports.TAG_REGEXP = /^(?!v)[a-z0-9._-]+$/i; | ||
@@ -10,0 +10,0 @@ class ProtocolResolver { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const throttle_1 = (0, tslib_1.__importDefault)(require("lodash/throttle")); | ||
const throttle_1 = tslib_1.__importDefault(require("lodash/throttle")); | ||
const stream_1 = require("stream"); | ||
@@ -8,0 +8,0 @@ const string_decoder_1 = require("string_decoder"); |
@@ -9,4 +9,4 @@ "use strict"; | ||
const shell_1 = require("@yarnpkg/shell"); | ||
const capitalize_1 = (0, tslib_1.__importDefault)(require("lodash/capitalize")); | ||
const p_limit_1 = (0, tslib_1.__importDefault)(require("p-limit")); | ||
const capitalize_1 = tslib_1.__importDefault(require("lodash/capitalize")); | ||
const p_limit_1 = tslib_1.__importDefault(require("p-limit")); | ||
const stream_1 = require("stream"); | ||
@@ -18,7 +18,7 @@ const Manifest_1 = require("./Manifest"); | ||
const YarnVersion_1 = require("./YarnVersion"); | ||
const execUtils = (0, tslib_1.__importStar)(require("./execUtils")); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const execUtils = tslib_1.__importStar(require("./execUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
/** | ||
@@ -25,0 +25,0 @@ * @internal |
@@ -21,1 +21,6 @@ import semver from 'semver'; | ||
export declare function validRange(potentialRange: string): semver.Range | null; | ||
/** | ||
* Cleans the potential version by removing leading/trailing whitespace and '=v' prefix | ||
* @returns A valid SemVer string, otherwise null | ||
*/ | ||
export declare function clean(potentialVersion: string): string | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validRange = exports.satisfiesWithPrereleases = exports.SemVer = void 0; | ||
exports.clean = exports.validRange = exports.satisfiesWithPrereleases = exports.SemVer = void 0; | ||
const tslib_1 = require("tslib"); | ||
const semver_1 = (0, tslib_1.__importDefault)(require("semver")); | ||
const semver_1 = tslib_1.__importDefault(require("semver")); | ||
var semver_2 = require("semver"); | ||
@@ -84,1 +84,17 @@ Object.defineProperty(exports, "SemVer", { enumerable: true, get: function () { return semver_2.SemVer; } }); | ||
exports.validRange = validRange; | ||
/** | ||
The RegExp from https://semver.org/ but modified to | ||
- allow the version to start with `(?:[\sv=]*?)` | ||
- allow the version to end with `(?:\s*)` | ||
- place the valid version in capture group one | ||
*/ | ||
const CLEAN_SEMVER_REGEXP = /^(?:[\sv=]*?)((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\s*)$/; | ||
/** | ||
* Cleans the potential version by removing leading/trailing whitespace and '=v' prefix | ||
* @returns A valid SemVer string, otherwise null | ||
*/ | ||
function clean(potentialVersion) { | ||
const version = CLEAN_SEMVER_REGEXP.exec(potentialVersion); | ||
return version ? version[1] : null; | ||
} | ||
exports.clean = clean; |
@@ -5,8 +5,8 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const slice_ansi_1 = (0, tslib_1.__importDefault)(require("@arcanis/slice-ansi")); | ||
const ci_info_1 = (0, tslib_1.__importDefault)(require("ci-info")); | ||
const slice_ansi_1 = tslib_1.__importDefault(require("@arcanis/slice-ansi")); | ||
const ci_info_1 = tslib_1.__importDefault(require("ci-info")); | ||
const MessageName_1 = require("./MessageName"); | ||
const Report_1 = require("./Report"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
const PROGRESS_FRAMES = [`⠋`, `⠙`, `⠹`, `⠸`, `⠼`, `⠴`, `⠦`, `⠧`, `⠇`, `⠏`]; | ||
@@ -13,0 +13,0 @@ const PROGRESS_INTERVAL = 80; |
@@ -6,2 +6,3 @@ /// <reference types="node" /> | ||
import { Workspace } from './Workspace'; | ||
import * as nodeUtils from './nodeUtils'; | ||
import { Ident, Descriptor, Locator, Package } from './types'; | ||
@@ -398,6 +399,3 @@ /** | ||
*/ | ||
export declare function isPackageCompatible(pkg: Package, architectures: { | ||
os: Array<string> | null; | ||
cpu: Array<string> | null; | ||
}): boolean; | ||
export declare function isPackageCompatible(pkg: Package, architectures: nodeUtils.ArchitectureSet): boolean; | ||
export {}; |
@@ -6,12 +6,12 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const querystring_1 = (0, tslib_1.__importDefault)(require("querystring")); | ||
const semver_1 = (0, tslib_1.__importDefault)(require("semver")); | ||
const querystring_1 = tslib_1.__importDefault(require("querystring")); | ||
const semver_1 = tslib_1.__importDefault(require("semver")); | ||
const tinylogic_1 = require("tinylogic"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const hashUtils = (0, tslib_1.__importStar)(require("./hashUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
const hashUtils = tslib_1.__importStar(require("./hashUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
const VIRTUAL_PROTOCOL = `virtual:`; | ||
const VIRTUAL_ABBREVIATE = 5; | ||
const conditionRegex = /(os|cpu)=([a-z0-9_-]+)/; | ||
const conditionRegex = /(os|cpu|libc)=([a-z0-9_-]+)/; | ||
const conditionParser = (0, tinylogic_1.makeParser)(conditionRegex); | ||
@@ -18,0 +18,0 @@ /** |
@@ -6,5 +6,5 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const hashUtils = (0, tslib_1.__importStar)(require("./hashUtils")); | ||
const httpUtils = (0, tslib_1.__importStar)(require("./httpUtils")); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const hashUtils = tslib_1.__importStar(require("./hashUtils")); | ||
const httpUtils = tslib_1.__importStar(require("./httpUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
var MetricName; | ||
@@ -11,0 +11,0 @@ (function (MetricName) { |
@@ -8,5 +8,5 @@ "use strict"; | ||
const stream_1 = require("stream"); | ||
const tar_1 = (0, tslib_1.__importDefault)(require("tar")); | ||
const tar_1 = tslib_1.__importDefault(require("tar")); | ||
const WorkerPool_1 = require("./WorkerPool"); | ||
const miscUtils = (0, tslib_1.__importStar)(require("./miscUtils")); | ||
const miscUtils = tslib_1.__importStar(require("./miscUtils")); | ||
const worker_zip_1 = require("./worker-zip"); | ||
@@ -13,0 +13,0 @@ async function makeArchiveFromDirectory(source, { baseFs = new fslib_1.NodeFS(), prefixPath = fslib_1.PortablePath.root, compressionLevel, inMemory = false } = {}) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const treeify_1 = require("treeify"); | ||
const formatUtils = (0, tslib_1.__importStar)(require("./formatUtils")); | ||
const formatUtils = tslib_1.__importStar(require("./formatUtils")); | ||
function treeNodeToTreeify(printTree, { configuration }) { | ||
@@ -9,0 +9,0 @@ const target = {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class VirtualFetcher { | ||
@@ -9,0 +9,0 @@ supports(locator) { |
@@ -6,4 +6,4 @@ /// <reference types="node" /> | ||
tmpFile: PortablePath; | ||
tgz: Buffer; | ||
tgz: Buffer | Uint8Array; | ||
opts: ExtractBufferOptions; | ||
}; |
@@ -14,3 +14,3 @@ "use strict"; | ||
// Buffers sent through Node are turned into regular Uint8Arrays | ||
const tgzBuffer = Buffer.from(tgz); | ||
const tgzBuffer = Buffer.from(tgz.buffer, tgz.byteOffset, tgz.byteLength); | ||
await (0, tgzUtils_1.extractArchiveTo)(tgzBuffer, zipFs, bufferOpts); | ||
@@ -17,0 +17,0 @@ zipFs.saveAndClose(); |
export declare class WorkerPool<TIn, TOut> { | ||
private source; | ||
private pool; | ||
private queue; | ||
private workers; | ||
private limit; | ||
private cleanupInterval; | ||
constructor(source: string); | ||
private createWorker; | ||
run(data: TIn): Promise<TOut>; | ||
} |
@@ -6,45 +6,59 @@ "use strict"; | ||
const os_1 = require("os"); | ||
const p_queue_1 = (0, tslib_1.__importDefault)(require("p-queue")); | ||
const p_limit_1 = tslib_1.__importDefault(require("p-limit")); | ||
const worker_threads_1 = require("worker_threads"); | ||
const kTaskInfo = Symbol(`kTaskInfo`); | ||
class WorkerPool { | ||
constructor(source) { | ||
this.source = source; | ||
this.pool = []; | ||
this.queue = new p_queue_1.default({ | ||
concurrency: Math.max(1, (0, os_1.cpus)().length), | ||
this.workers = []; | ||
this.limit = (0, p_limit_1.default)(Math.max(1, (0, os_1.cpus)().length)); | ||
this.cleanupInterval = setInterval(() => { | ||
if (this.limit.pendingCount === 0 && this.limit.activeCount === 0) { | ||
// Start terminating one worker at a time when there are no tasks left. | ||
// This allows the pool to scale down without having to re-create the | ||
// entire pool when there is a short amount of time without tasks. | ||
const worker = this.workers.pop(); | ||
if (worker) { | ||
worker.terminate(); | ||
} | ||
else { | ||
clearInterval(this.cleanupInterval); | ||
} | ||
} | ||
}, 5000).unref(); | ||
} | ||
createWorker() { | ||
this.cleanupInterval.refresh(); | ||
const worker = new worker_threads_1.Worker(this.source, { | ||
eval: true, | ||
execArgv: [...process.execArgv, `--unhandled-rejections=strict`], | ||
}); | ||
const timeout = setTimeout(() => { | ||
if (this.queue.size !== 0 || this.queue.pending !== 0) | ||
return; | ||
for (const worker of this.pool) | ||
worker.terminate(); | ||
this.pool = []; | ||
}, 1000).unref(); | ||
this.queue.on(`idle`, () => { | ||
timeout.refresh(); | ||
worker.on(`message`, (result) => { | ||
if (!worker[kTaskInfo]) | ||
throw new Error(`Assertion failed: Worker sent a result without having a task assigned`); | ||
worker[kTaskInfo].resolve(result); | ||
worker[kTaskInfo] = null; | ||
worker.unref(); | ||
this.workers.push(worker); | ||
}); | ||
worker.on(`error`, err => { | ||
var _a; | ||
(_a = worker[kTaskInfo]) === null || _a === void 0 ? void 0 : _a.reject(err); | ||
worker[kTaskInfo] = null; | ||
}); | ||
worker.on(`exit`, code => { | ||
var _a; | ||
if (code !== 0) | ||
(_a = worker[kTaskInfo]) === null || _a === void 0 ? void 0 : _a.reject(new Error(`Worker exited with code ${code}`)); | ||
worker[kTaskInfo] = null; | ||
}); | ||
return worker; | ||
} | ||
run(data) { | ||
return this.queue.add(() => { | ||
return this.limit(() => { | ||
var _a; | ||
const worker = (_a = this.pool.pop()) !== null && _a !== void 0 ? _a : new worker_threads_1.Worker(this.source, { | ||
eval: true, | ||
execArgv: [...process.execArgv, `--unhandled-rejections=strict`], | ||
}); | ||
const worker = (_a = this.workers.pop()) !== null && _a !== void 0 ? _a : this.createWorker(); | ||
worker.ref(); | ||
return new Promise((resolve, reject) => { | ||
const exitHandler = (code) => { | ||
if (code !== 0) { | ||
reject(new Error(`Worker exited with code ${code}`)); | ||
} | ||
}; | ||
worker.once(`message`, (result) => { | ||
this.pool.push(worker); | ||
worker.unref(); | ||
worker.off(`error`, reject); | ||
worker.off(`exit`, exitHandler); | ||
resolve(result); | ||
}); | ||
worker.once(`error`, reject); | ||
worker.once(`exit`, exitHandler); | ||
worker[kTaskInfo] = { resolve, reject }; | ||
worker.postMessage(data); | ||
@@ -51,0 +65,0 @@ }); |
@@ -6,8 +6,8 @@ "use strict"; | ||
const fslib_1 = require("@yarnpkg/fslib"); | ||
const globby_1 = (0, tslib_1.__importDefault)(require("globby")); | ||
const globby_1 = tslib_1.__importDefault(require("globby")); | ||
const Manifest_1 = require("./Manifest"); | ||
const WorkspaceResolver_1 = require("./WorkspaceResolver"); | ||
const hashUtils = (0, tslib_1.__importStar)(require("./hashUtils")); | ||
const semverUtils = (0, tslib_1.__importStar)(require("./semverUtils")); | ||
const structUtils = (0, tslib_1.__importStar)(require("./structUtils")); | ||
const hashUtils = tslib_1.__importStar(require("./hashUtils")); | ||
const semverUtils = tslib_1.__importStar(require("./semverUtils")); | ||
const structUtils = tslib_1.__importStar(require("./structUtils")); | ||
class Workspace { | ||
@@ -14,0 +14,0 @@ constructor(workspaceCwd, { project }) { |
{ | ||
"name": "@yarnpkg/core", | ||
"version": "3.2.0-rc.11", | ||
"version": "3.2.0-rc.12", | ||
"license": "BSD-2-Clause", | ||
@@ -11,8 +11,8 @@ "main": "./lib/index.js", | ||
"@types/treeify": "^1.0.0", | ||
"@yarnpkg/fslib": "^2.6.1-rc.6", | ||
"@yarnpkg/fslib": "^2.6.1-rc.7", | ||
"@yarnpkg/json-proxy": "^2.1.1", | ||
"@yarnpkg/libzip": "^2.2.3-rc.6", | ||
"@yarnpkg/parsers": "^2.5.0-rc.9", | ||
"@yarnpkg/pnp": "^3.1.1-rc.11", | ||
"@yarnpkg/shell": "^3.2.0-rc.9", | ||
"@yarnpkg/libzip": "^2.2.3-rc.7", | ||
"@yarnpkg/parsers": "^2.5.0-rc.10", | ||
"@yarnpkg/pnp": "^3.1.1-rc.12", | ||
"@yarnpkg/shell": "^3.2.0-rc.10", | ||
"camelcase": "^5.3.1", | ||
@@ -31,3 +31,2 @@ "chalk": "^3.0.0", | ||
"p-limit": "^2.2.0", | ||
"p-queue": "^6.0.0", | ||
"pluralize": "^7.0.0", | ||
@@ -54,6 +53,6 @@ "pretty-bytes": "^5.1.0", | ||
"@types/tunnel": "^0.0.0", | ||
"@yarnpkg/cli": "^3.2.0-rc.11", | ||
"@yarnpkg/cli": "^3.2.0-rc.12", | ||
"@yarnpkg/plugin-link": "^2.2.0", | ||
"@yarnpkg/plugin-npm": "^2.7.0-rc.4", | ||
"@yarnpkg/plugin-pnp": "^3.2.0-rc.1", | ||
"@yarnpkg/plugin-npm": "^2.7.0-rc.5", | ||
"@yarnpkg/plugin-pnp": "^3.2.0-rc.2", | ||
"esbuild": "npm:esbuild-wasm@^0.11.20", | ||
@@ -60,0 +59,0 @@ "rollup": "^2.59.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
746238
32
13209
- Removedp-queue@^6.0.0
- Removedeventemitter3@4.0.7(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-queue@6.6.2(transitive)
- Removedp-timeout@3.2.0(transitive)
Updated@yarnpkg/fslib@^2.6.1-rc.7
Updated@yarnpkg/libzip@^2.2.3-rc.7
Updated@yarnpkg/pnp@^3.1.1-rc.12
Updated@yarnpkg/shell@^3.2.0-rc.10