@vercel/build-utils 7.1.1 → 7.2.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 +18 -0
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +31 -7
- package/dist/index.js +240 -1003
- package/dist/prerender.d.ts +6 -2
- package/dist/prerender.js +22 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 7.2.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Internal variants ([#10549](https://github.com/vercel/vercel/pull/10549))
|
8
|
+
|
9
|
+
## 7.2.0
|
10
|
+
|
11
|
+
### Minor Changes
|
12
|
+
|
13
|
+
- Add new optional prerender field: experimentalStreamingLambdaPath ([#10476](https://github.com/vercel/vercel/pull/10476))
|
14
|
+
|
15
|
+
- [build-utils] Add zero config detection for bun package manager ([#10486](https://github.com/vercel/vercel/pull/10486))
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- add `experimentalBypassFor` field to Prerender ([#10481](https://github.com/vercel/vercel/pull/10481))
|
20
|
+
|
3
21
|
## 7.1.1
|
4
22
|
|
5
23
|
### Patch Changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { SpawnOptions } from 'child_process';
|
3
3
|
import { Meta, PackageJson, NodeVersion, Config } from '../types';
|
4
|
-
export type CliType = 'yarn' | 'npm' | 'pnpm';
|
4
|
+
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun';
|
5
5
|
export interface ScanParentDirsResult {
|
6
6
|
/**
|
7
7
|
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
@@ -207,18 +207,24 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
207
207
|
filename: "package.json"
|
208
208
|
});
|
209
209
|
const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra.default.readFile(pkgJsonPath, "utf8")) : void 0;
|
210
|
-
const [yarnLockPath, npmLockPath, pnpmLockPath] = await walkParentDirsMulti({
|
210
|
+
const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] = await walkParentDirsMulti({
|
211
211
|
base: "/",
|
212
212
|
start: destPath,
|
213
|
-
filenames: [
|
213
|
+
filenames: [
|
214
|
+
"yarn.lock",
|
215
|
+
"package-lock.json",
|
216
|
+
"pnpm-lock.yaml",
|
217
|
+
"bun.lockb"
|
218
|
+
]
|
214
219
|
});
|
215
220
|
let lockfilePath;
|
216
221
|
let lockfileVersion;
|
217
222
|
let cliType = "yarn";
|
218
|
-
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
|
223
|
+
const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
|
219
224
|
Boolean(yarnLockPath),
|
220
225
|
npmLockPath ? (0, import_read_config_file.readConfigFile)(npmLockPath) : null,
|
221
|
-
pnpmLockPath ? (0, import_read_config_file.readConfigFile)(pnpmLockPath) : null
|
226
|
+
pnpmLockPath ? (0, import_read_config_file.readConfigFile)(pnpmLockPath) : null,
|
227
|
+
bunLockPath ? import_fs_extra.default.readFile(bunLockPath, "utf8") : null
|
222
228
|
]);
|
223
229
|
if (hasYarnLock) {
|
224
230
|
cliType = "yarn";
|
@@ -231,6 +237,10 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
231
237
|
cliType = "npm";
|
232
238
|
lockfilePath = npmLockPath;
|
233
239
|
lockfileVersion = packageLockJson.lockfileVersion;
|
240
|
+
} else if (bunLockBin) {
|
241
|
+
cliType = "bun";
|
242
|
+
lockfilePath = bunLockPath;
|
243
|
+
lockfileVersion = 0;
|
234
244
|
}
|
235
245
|
const packageJsonPath = pkgJsonPath || void 0;
|
236
246
|
return {
|
@@ -322,6 +332,9 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
322
332
|
} else if (cliType === "pnpm") {
|
323
333
|
opts.prettyCommand = "pnpm install";
|
324
334
|
commandArgs = args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"]);
|
335
|
+
} else if (cliType === "bun") {
|
336
|
+
opts.prettyCommand = "bun install";
|
337
|
+
commandArgs = ["install", ...args];
|
325
338
|
} else {
|
326
339
|
opts.prettyCommand = "yarn install";
|
327
340
|
commandArgs = ["install", ...args];
|
@@ -364,22 +377,31 @@ function getEnvForPackageManager({
|
|
364
377
|
const npm7 = "/node16/bin-npm7";
|
365
378
|
const pnpm7 = "/pnpm7/node_modules/.bin";
|
366
379
|
const pnpm8 = "/pnpm8/node_modules/.bin";
|
380
|
+
const bun1 = "/bun1";
|
367
381
|
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === "1";
|
368
382
|
if (cliType === "npm") {
|
369
383
|
if (typeof lockfileVersion === "number" && lockfileVersion >= 2 && (nodeVersion?.major || 0) < 16 && !oldPath.includes(npm7) && !corepackEnabled) {
|
370
384
|
newEnv.PATH = `${npm7}${import_path.default.delimiter}${oldPath}`;
|
371
|
-
console.log("Detected `package-lock.json` generated by npm 7
|
385
|
+
console.log("Detected `package-lock.json` generated by npm 7+");
|
372
386
|
}
|
373
387
|
} else if (cliType === "pnpm") {
|
374
388
|
if (typeof lockfileVersion === "number" && lockfileVersion === 5.4 && !oldPath.includes(pnpm7) && !corepackEnabled) {
|
375
389
|
newEnv.PATH = `${pnpm7}${import_path.default.delimiter}${oldPath}`;
|
376
390
|
console.log(
|
377
|
-
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7
|
391
|
+
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7`
|
378
392
|
);
|
379
393
|
} else if (typeof lockfileVersion === "number" && lockfileVersion >= 6 && !oldPath.includes(pnpm8) && !corepackEnabled) {
|
380
394
|
newEnv.PATH = `${pnpm8}${import_path.default.delimiter}${oldPath}`;
|
381
395
|
console.log(
|
382
|
-
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8
|
396
|
+
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8`
|
397
|
+
);
|
398
|
+
}
|
399
|
+
} else if (cliType === "bun") {
|
400
|
+
if (!oldPath.includes(bun1) && !corepackEnabled) {
|
401
|
+
newEnv.PATH = `${bun1}${import_path.default.delimiter}${oldPath}`;
|
402
|
+
console.log("Detected `bun.lockb` generated by Bun");
|
403
|
+
console.warn(
|
404
|
+
"Warning: Bun is used as a package manager at build time only, not at runtime with Functions"
|
383
405
|
);
|
384
406
|
}
|
385
407
|
} else {
|
@@ -438,6 +460,8 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
438
460
|
opts.prettyCommand = `npm run ${scriptName}`;
|
439
461
|
} else if (cliType === "pnpm") {
|
440
462
|
opts.prettyCommand = `pnpm run ${scriptName}`;
|
463
|
+
} else if (cliType === "bun") {
|
464
|
+
opts.prettyCommand = `bun run ${scriptName}`;
|
441
465
|
} else {
|
442
466
|
opts.prettyCommand = `yarn run ${scriptName}`;
|
443
467
|
}
|