@vercel/build-utils 10.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/fs/run-user-scripts.js +29 -41
- package/dist/index.js +29 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 10.0.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [build-utils] Move `runNpmInstallSema` closer to where it's used ([#13061](https://github.com/vercel/vercel/pull/13061))
|
8
|
+
|
9
|
+
- [build-utils] extract getInstallCommandForPackageManager to module scope ([#13058](https://github.com/vercel/vercel/pull/13058))
|
10
|
+
|
11
|
+
- [build-utils] remove redundant sema release ([#13059](https://github.com/vercel/vercel/pull/13059))
|
12
|
+
|
13
|
+
- Revert support pnpm 10 ([#13064](https://github.com/vercel/vercel/pull/13064))
|
14
|
+
|
3
15
|
## 10.0.0
|
4
16
|
|
5
17
|
### Major Changes
|
@@ -67,7 +67,6 @@ var import_node_version = require("./node-version");
|
|
67
67
|
var import_read_config_file = require("./read-config-file");
|
68
68
|
var import_clone_env = require("../clone-env");
|
69
69
|
var import_json5 = __toESM(require("json5"));
|
70
|
-
const runNpmInstallSema = new import_async_sema.default(1);
|
71
70
|
const NO_OVERRIDE = {
|
72
71
|
detectedLockfile: void 0,
|
73
72
|
detectedPackageManager: void 0,
|
@@ -423,38 +422,38 @@ async function walkParentDirsMulti({
|
|
423
422
|
function isSet(v) {
|
424
423
|
return v?.constructor?.name === "Set";
|
425
424
|
}
|
425
|
+
function getInstallCommandForPackageManager(packageManager, args) {
|
426
|
+
switch (packageManager) {
|
427
|
+
case "npm":
|
428
|
+
return {
|
429
|
+
prettyCommand: "npm install",
|
430
|
+
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
431
|
+
};
|
432
|
+
case "pnpm":
|
433
|
+
return {
|
434
|
+
prettyCommand: "pnpm install",
|
435
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
436
|
+
// @see options https://pnpm.io/cli/install
|
437
|
+
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
438
|
+
};
|
439
|
+
case "bun":
|
440
|
+
return {
|
441
|
+
prettyCommand: "bun install",
|
442
|
+
// @see options https://bun.sh/docs/cli/install
|
443
|
+
commandArguments: ["install", ...args]
|
444
|
+
};
|
445
|
+
case "yarn":
|
446
|
+
return {
|
447
|
+
prettyCommand: "yarn install",
|
448
|
+
commandArguments: ["install", ...args]
|
449
|
+
};
|
450
|
+
}
|
451
|
+
}
|
426
452
|
async function runInstallCommand({
|
427
453
|
packageManager,
|
428
454
|
args,
|
429
455
|
opts
|
430
456
|
}) {
|
431
|
-
const getInstallCommandForPackageManager = (packageManager2, args2) => {
|
432
|
-
switch (packageManager2) {
|
433
|
-
case "npm":
|
434
|
-
return {
|
435
|
-
prettyCommand: "npm install",
|
436
|
-
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
437
|
-
};
|
438
|
-
case "pnpm":
|
439
|
-
return {
|
440
|
-
prettyCommand: "pnpm install",
|
441
|
-
// PNPM's install command is similar to NPM's but without the audit nonsense
|
442
|
-
// @see options https://pnpm.io/cli/install
|
443
|
-
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
444
|
-
};
|
445
|
-
case "bun":
|
446
|
-
return {
|
447
|
-
prettyCommand: "bun install",
|
448
|
-
// @see options https://bun.sh/docs/cli/install
|
449
|
-
commandArguments: ["install", ...args2]
|
450
|
-
};
|
451
|
-
case "yarn":
|
452
|
-
return {
|
453
|
-
prettyCommand: "yarn install",
|
454
|
-
commandArguments: ["install", ...args2]
|
455
|
-
};
|
456
|
-
}
|
457
|
-
};
|
458
457
|
const { commandArguments, prettyCommand } = getInstallCommandForPackageManager(packageManager, args);
|
459
458
|
opts.prettyCommand = prettyCommand;
|
460
459
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
@@ -462,6 +461,7 @@ async function runInstallCommand({
|
|
462
461
|
}
|
463
462
|
await spawnAsync(packageManager, commandArguments, opts);
|
464
463
|
}
|
464
|
+
const runNpmInstallSema = new import_async_sema.default(1);
|
465
465
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
466
466
|
if (meta?.isDev) {
|
467
467
|
(0, import_debug.default)("Skipping dependency installation because dev mode is enabled");
|
@@ -482,7 +482,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
482
482
|
(0, import_debug.default)(
|
483
483
|
`Skipping dependency installation because no package.json was found for ${destPath}`
|
484
484
|
);
|
485
|
-
runNpmInstallSema.release();
|
486
485
|
return false;
|
487
486
|
}
|
488
487
|
if (meta && packageJsonPath && args.length === 0) {
|
@@ -595,10 +594,8 @@ function detectPnpmVersion(lockfileVersion) {
|
|
595
594
|
return "pnpm 7";
|
596
595
|
case (lockfileVersion === 6 || lockfileVersion === 6.1):
|
597
596
|
return "pnpm 8";
|
598
|
-
case lockfileVersion === 7:
|
597
|
+
case (lockfileVersion === 7 || lockfileVersion === 9):
|
599
598
|
return "pnpm 9";
|
600
|
-
case lockfileVersion === 9:
|
601
|
-
return "pnpm 10";
|
602
599
|
default:
|
603
600
|
return "not found";
|
604
601
|
}
|
@@ -612,8 +609,6 @@ function validLockfileForPackageManager(cliType, lockfileVersion, packageManager
|
|
612
609
|
return true;
|
613
610
|
case "pnpm":
|
614
611
|
switch (packageManagerMajorVersion) {
|
615
|
-
case 10:
|
616
|
-
return lockfileVersion === 9;
|
617
612
|
case 9:
|
618
613
|
if ("9.0.0" === packageManagerVersion.version && lockfileVersion === 6) {
|
619
614
|
return false;
|
@@ -755,13 +750,6 @@ function detectPackageManager(cliType, lockfileVersion) {
|
|
755
750
|
detectedPackageManager: "pnpm@9.x",
|
756
751
|
pnpmVersionRange: "9.x"
|
757
752
|
};
|
758
|
-
case "pnpm 10":
|
759
|
-
return {
|
760
|
-
path: "/pnpm10/node_modules/.bin",
|
761
|
-
detectedLockfile: "pnpm-lock.yaml",
|
762
|
-
detectedPackageManager: "pnpm@10.x",
|
763
|
-
pnpmVersionRange: "10.x"
|
764
|
-
};
|
765
753
|
case "pnpm 6":
|
766
754
|
return {
|
767
755
|
// undefined because pnpm@6 is the current default in the build container
|
package/dist/index.js
CHANGED
@@ -23080,7 +23080,6 @@ function cloneEnv(...envs) {
|
|
23080
23080
|
|
23081
23081
|
// src/fs/run-user-scripts.ts
|
23082
23082
|
var import_json5 = __toESM(require_lib5());
|
23083
|
-
var runNpmInstallSema = new import_async_sema4.default(1);
|
23084
23083
|
var NO_OVERRIDE = {
|
23085
23084
|
detectedLockfile: void 0,
|
23086
23085
|
detectedPackageManager: void 0,
|
@@ -23436,38 +23435,38 @@ async function walkParentDirsMulti({
|
|
23436
23435
|
function isSet(v) {
|
23437
23436
|
return v?.constructor?.name === "Set";
|
23438
23437
|
}
|
23438
|
+
function getInstallCommandForPackageManager(packageManager, args) {
|
23439
|
+
switch (packageManager) {
|
23440
|
+
case "npm":
|
23441
|
+
return {
|
23442
|
+
prettyCommand: "npm install",
|
23443
|
+
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
23444
|
+
};
|
23445
|
+
case "pnpm":
|
23446
|
+
return {
|
23447
|
+
prettyCommand: "pnpm install",
|
23448
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
23449
|
+
// @see options https://pnpm.io/cli/install
|
23450
|
+
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
23451
|
+
};
|
23452
|
+
case "bun":
|
23453
|
+
return {
|
23454
|
+
prettyCommand: "bun install",
|
23455
|
+
// @see options https://bun.sh/docs/cli/install
|
23456
|
+
commandArguments: ["install", ...args]
|
23457
|
+
};
|
23458
|
+
case "yarn":
|
23459
|
+
return {
|
23460
|
+
prettyCommand: "yarn install",
|
23461
|
+
commandArguments: ["install", ...args]
|
23462
|
+
};
|
23463
|
+
}
|
23464
|
+
}
|
23439
23465
|
async function runInstallCommand({
|
23440
23466
|
packageManager,
|
23441
23467
|
args,
|
23442
23468
|
opts
|
23443
23469
|
}) {
|
23444
|
-
const getInstallCommandForPackageManager = (packageManager2, args2) => {
|
23445
|
-
switch (packageManager2) {
|
23446
|
-
case "npm":
|
23447
|
-
return {
|
23448
|
-
prettyCommand: "npm install",
|
23449
|
-
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
23450
|
-
};
|
23451
|
-
case "pnpm":
|
23452
|
-
return {
|
23453
|
-
prettyCommand: "pnpm install",
|
23454
|
-
// PNPM's install command is similar to NPM's but without the audit nonsense
|
23455
|
-
// @see options https://pnpm.io/cli/install
|
23456
|
-
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
23457
|
-
};
|
23458
|
-
case "bun":
|
23459
|
-
return {
|
23460
|
-
prettyCommand: "bun install",
|
23461
|
-
// @see options https://bun.sh/docs/cli/install
|
23462
|
-
commandArguments: ["install", ...args2]
|
23463
|
-
};
|
23464
|
-
case "yarn":
|
23465
|
-
return {
|
23466
|
-
prettyCommand: "yarn install",
|
23467
|
-
commandArguments: ["install", ...args2]
|
23468
|
-
};
|
23469
|
-
}
|
23470
|
-
};
|
23471
23470
|
const { commandArguments, prettyCommand } = getInstallCommandForPackageManager(packageManager, args);
|
23472
23471
|
opts.prettyCommand = prettyCommand;
|
23473
23472
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
@@ -23475,6 +23474,7 @@ async function runInstallCommand({
|
|
23475
23474
|
}
|
23476
23475
|
await spawnAsync(packageManager, commandArguments, opts);
|
23477
23476
|
}
|
23477
|
+
var runNpmInstallSema = new import_async_sema4.default(1);
|
23478
23478
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
23479
23479
|
if (meta?.isDev) {
|
23480
23480
|
debug("Skipping dependency installation because dev mode is enabled");
|
@@ -23495,7 +23495,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
23495
23495
|
debug(
|
23496
23496
|
`Skipping dependency installation because no package.json was found for ${destPath}`
|
23497
23497
|
);
|
23498
|
-
runNpmInstallSema.release();
|
23499
23498
|
return false;
|
23500
23499
|
}
|
23501
23500
|
if (meta && packageJsonPath && args.length === 0) {
|
@@ -23608,10 +23607,8 @@ function detectPnpmVersion(lockfileVersion) {
|
|
23608
23607
|
return "pnpm 7";
|
23609
23608
|
case (lockfileVersion === 6 || lockfileVersion === 6.1):
|
23610
23609
|
return "pnpm 8";
|
23611
|
-
case lockfileVersion === 7:
|
23610
|
+
case (lockfileVersion === 7 || lockfileVersion === 9):
|
23612
23611
|
return "pnpm 9";
|
23613
|
-
case lockfileVersion === 9:
|
23614
|
-
return "pnpm 10";
|
23615
23612
|
default:
|
23616
23613
|
return "not found";
|
23617
23614
|
}
|
@@ -23625,8 +23622,6 @@ function validLockfileForPackageManager(cliType, lockfileVersion, packageManager
|
|
23625
23622
|
return true;
|
23626
23623
|
case "pnpm":
|
23627
23624
|
switch (packageManagerMajorVersion) {
|
23628
|
-
case 10:
|
23629
|
-
return lockfileVersion === 9;
|
23630
23625
|
case 9:
|
23631
23626
|
if ("9.0.0" === packageManagerVersion.version && lockfileVersion === 6) {
|
23632
23627
|
return false;
|
@@ -23768,13 +23763,6 @@ function detectPackageManager(cliType, lockfileVersion) {
|
|
23768
23763
|
detectedPackageManager: "pnpm@9.x",
|
23769
23764
|
pnpmVersionRange: "9.x"
|
23770
23765
|
};
|
23771
|
-
case "pnpm 10":
|
23772
|
-
return {
|
23773
|
-
path: "/pnpm10/node_modules/.bin",
|
23774
|
-
detectedLockfile: "pnpm-lock.yaml",
|
23775
|
-
detectedPackageManager: "pnpm@10.x",
|
23776
|
-
pnpmVersionRange: "10.x"
|
23777
|
-
};
|
23778
23766
|
case "pnpm 6":
|
23779
23767
|
return {
|
23780
23768
|
// undefined because pnpm@6 is the current default in the build container
|