Skip to content
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.30.0](https://github.com/nodejs/corepack/compare/v0.29.4...v0.30.0) (2024-11-23)


### Features

* update package manager versions ([#578](https://github.com/nodejs/corepack/issues/578)) ([a286c8f](https://github.com/nodejs/corepack/commit/a286c8f5537ea9ecf9b6ff53c7bc3e8da4e3c8bb))


### Performance Improvements

* prefer `module.enableCompileCache` over `v8-compile-cache` ([#574](https://github.com/nodejs/corepack/issues/574)) ([cba6905](https://github.com/nodejs/corepack/commit/cba690575bd606faeee54bd512ccb8797d49055f))

## [0.29.4](https://github.com/nodejs/corepack/compare/v0.29.3...v0.29.4) (2024-09-07)


Expand Down
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"definitions": {
"npm": {
"default": "10.8.3+sha1.e6085b2864fcfd9b1aad7b602601b5a2fc116699",
"default": "10.9.1+sha1.ab141c1229765c11c8c59060fc9cf450a2207bd6",
"fetchLatestFrom": {
"type": "npm",
"package": "npm"
Expand Down Expand Up @@ -38,7 +38,7 @@
}
},
"pnpm": {
"default": "9.9.0+sha1.3edbe440f4e570aa8f049adbd06b9483d55cc2d2",
"default": "9.14.2+sha1.5202b50ab92394b3c922d2e293f196e2df6d441b",
"fetchLatestFrom": {
"type": "npm",
"package": "pnpm"
Expand Down Expand Up @@ -102,7 +102,7 @@
"package": "yarn"
},
"transparent": {
"default": "4.4.1+sha224.fd21d9eb5fba020083811af1d4953acc21eeb9f6ff97efd1b3f9d4de",
"default": "4.5.2+sha224.c2e2e9ed3cdadd6ec250589b3393f71ae56d5ec297af11cec1eba3b4",
"commands": [
[
"yarn",
Expand Down
2 changes: 2 additions & 0 deletions mkshims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async function main() {
fs.writeFileSync(corepackPath, [
`#!/usr/bin/env node`,
`process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT??='0';`,
`require('module').enableCompileCache?.();`,
`require('./lib/corepack.cjs').runMain(process.argv.slice(2));`,
].join(`\n`));
fs.chmodSync(corepackPath, 0o755);
Expand All @@ -34,6 +35,7 @@ async function main() {
const entryScript = [
`#!/usr/bin/env node`,
`process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT??='1'`,
`require('module').enableCompileCache?.();`,
`require('./lib/corepack.cjs').runMain(['${binaryName}', ...process.argv.slice(2)]);`,
].join(`\n`);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "corepack",
"version": "0.29.4",
"version": "0.30.0",
"homepage": "https://github.com/nodejs/corepack#readme",
"bugs": {
"url": "https://github.com/nodejs/corepack/issues"
Expand Down
22 changes: 16 additions & 6 deletions sources/corepackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,16 @@ export async function runVersion(locator: Locator, installSpec: InstallSpec & {s
if (!binPath)
throw new Error(`Assertion failed: Unable to locate path for bin '${binName}'`);

// Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache
// $ docker run -it node:20.3.0-slim corepack [email protected] --version
// [SIGSEGV]
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`))
// @ts-expect-error - No types
await import(`v8-compile-cache`);
// @ts-expect-error - Missing types
if (!Module.enableCompileCache) {
// Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache
// $ docker run -it node:20.3.0-slim corepack [email protected] --version
// [SIGSEGV]
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) {
// @ts-expect-error - No types
await import(`v8-compile-cache`);
}
}

// We load the binary into the current process,
// while making it think it was spawned.
Expand All @@ -429,6 +433,12 @@ export async function runVersion(locator: Locator, installSpec: InstallSpec & {s
// Use nextTick to unwind the stack, and consequently remove Corepack from
// the stack trace of the package manager.
process.nextTick(Module.runMain, binPath);

// @ts-expect-error - No types
if (Module.flushCompileCache) {
// @ts-expect-error - No types
setImmediate(Module.flushCompileCache);
}
}

export function shouldSkipIntegrityCheck() {
Expand Down
Binary file modified tests/nocks.db
Binary file not shown.
Loading
Loading