@vercel/build-utils 8.7.0 → 8.8.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 8.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add bun detection using bun.lock ([#12740](https://github.com/vercel/vercel/pull/12740))
8
+
3
9
  ## 8.7.0
4
10
 
5
11
  ### Minor Changes
@@ -239,7 +239,13 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
239
239
  });
240
240
  const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra.default.readFile(pkgJsonPath, "utf8")) : void 0;
241
241
  const {
242
- paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath],
242
+ paths: [
243
+ yarnLockPath,
244
+ npmLockPath,
245
+ pnpmLockPath,
246
+ bunLockTextPath,
247
+ bunLockBinPath
248
+ ],
243
249
  packageJsonPackageManager
244
250
  } = await walkParentDirsMulti({
245
251
  base,
@@ -248,17 +254,19 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
248
254
  "yarn.lock",
249
255
  "package-lock.json",
250
256
  "pnpm-lock.yaml",
257
+ "bun.lock",
251
258
  "bun.lockb"
252
259
  ]
253
260
  });
254
261
  let lockfilePath;
255
262
  let lockfileVersion;
256
263
  let cliType;
257
- const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
264
+ const bunLockPath = bunLockTextPath ?? bunLockBinPath;
265
+ const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLock] = await Promise.all([
258
266
  Boolean(yarnLockPath),
259
267
  npmLockPath ? (0, import_read_config_file.readConfigFile)(npmLockPath) : null,
260
268
  pnpmLockPath ? (0, import_read_config_file.readConfigFile)(pnpmLockPath) : null,
261
- bunLockPath ? import_fs_extra.default.readFile(bunLockPath, "utf8") : null
269
+ bunLockPath ? import_fs_extra.default.readFile(bunLockPath) : null
262
270
  ]);
263
271
  const rootProjectInfo = readPackageJson ? await readProjectRootInfo({
264
272
  base,
@@ -269,10 +277,10 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
269
277
  turboVersionRange,
270
278
  rootProjectInfo?.rootDir
271
279
  ) : void 0;
272
- if (bunLockBin && hasYarnLock) {
280
+ if (bunLock && hasYarnLock) {
273
281
  cliType = "bun";
274
282
  lockfilePath = bunLockPath;
275
- lockfileVersion = 0;
283
+ lockfileVersion = bunLockTextPath ? 1 : 0;
276
284
  } else if (hasYarnLock) {
277
285
  cliType = "yarn";
278
286
  lockfilePath = yarnLockPath;
@@ -284,10 +292,10 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
284
292
  cliType = "npm";
285
293
  lockfilePath = npmLockPath;
286
294
  lockfileVersion = packageLockJson.lockfileVersion;
287
- } else if (bunLockBin) {
295
+ } else if (bunLock) {
288
296
  cliType = "bun";
289
297
  lockfilePath = bunLockPath;
290
- lockfileVersion = 0;
298
+ lockfileVersion = bunLockTextPath ? 1 : 0;
291
299
  } else {
292
300
  cliType = detectPackageManagerNameWithoutLockfile(
293
301
  packageJsonPackageManager,
@@ -751,7 +759,7 @@ function detectPackageManager(cliType, lockfileVersion) {
751
759
  case "bun":
752
760
  return {
753
761
  path: "/bun1",
754
- detectedLockfile: "bun.lockb",
762
+ detectedLockfile: lockfileVersion === 0 ? "bun.lockb" : "bun.lock",
755
763
  detectedPackageManager: "bun@1.x"
756
764
  };
757
765
  case "yarn":
package/dist/index.js CHANGED
@@ -24798,7 +24798,13 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
24798
24798
  });
24799
24799
  const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra7.default.readFile(pkgJsonPath, "utf8")) : void 0;
24800
24800
  const {
24801
- paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath],
24801
+ paths: [
24802
+ yarnLockPath,
24803
+ npmLockPath,
24804
+ pnpmLockPath,
24805
+ bunLockTextPath,
24806
+ bunLockBinPath
24807
+ ],
24802
24808
  packageJsonPackageManager
24803
24809
  } = await walkParentDirsMulti({
24804
24810
  base,
@@ -24807,17 +24813,19 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
24807
24813
  "yarn.lock",
24808
24814
  "package-lock.json",
24809
24815
  "pnpm-lock.yaml",
24816
+ "bun.lock",
24810
24817
  "bun.lockb"
24811
24818
  ]
24812
24819
  });
24813
24820
  let lockfilePath;
24814
24821
  let lockfileVersion;
24815
24822
  let cliType;
24816
- const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
24823
+ const bunLockPath = bunLockTextPath ?? bunLockBinPath;
24824
+ const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLock] = await Promise.all([
24817
24825
  Boolean(yarnLockPath),
24818
24826
  npmLockPath ? readConfigFile(npmLockPath) : null,
24819
24827
  pnpmLockPath ? readConfigFile(pnpmLockPath) : null,
24820
- bunLockPath ? import_fs_extra7.default.readFile(bunLockPath, "utf8") : null
24828
+ bunLockPath ? import_fs_extra7.default.readFile(bunLockPath) : null
24821
24829
  ]);
24822
24830
  const rootProjectInfo = readPackageJson ? await readProjectRootInfo({
24823
24831
  base,
@@ -24828,10 +24836,10 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
24828
24836
  turboVersionRange,
24829
24837
  rootProjectInfo?.rootDir
24830
24838
  ) : void 0;
24831
- if (bunLockBin && hasYarnLock) {
24839
+ if (bunLock && hasYarnLock) {
24832
24840
  cliType = "bun";
24833
24841
  lockfilePath = bunLockPath;
24834
- lockfileVersion = 0;
24842
+ lockfileVersion = bunLockTextPath ? 1 : 0;
24835
24843
  } else if (hasYarnLock) {
24836
24844
  cliType = "yarn";
24837
24845
  lockfilePath = yarnLockPath;
@@ -24843,10 +24851,10 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
24843
24851
  cliType = "npm";
24844
24852
  lockfilePath = npmLockPath;
24845
24853
  lockfileVersion = packageLockJson.lockfileVersion;
24846
- } else if (bunLockBin) {
24854
+ } else if (bunLock) {
24847
24855
  cliType = "bun";
24848
24856
  lockfilePath = bunLockPath;
24849
- lockfileVersion = 0;
24857
+ lockfileVersion = bunLockTextPath ? 1 : 0;
24850
24858
  } else {
24851
24859
  cliType = detectPackageManagerNameWithoutLockfile(
24852
24860
  packageJsonPackageManager,
@@ -25310,7 +25318,7 @@ function detectPackageManager(cliType, lockfileVersion) {
25310
25318
  case "bun":
25311
25319
  return {
25312
25320
  path: "/bun1",
25313
- detectedLockfile: "bun.lockb",
25321
+ detectedLockfile: lockfileVersion === 0 ? "bun.lockb" : "bun.lock",
25314
25322
  detectedPackageManager: "bun@1.x"
25315
25323
  };
25316
25324
  case "yarn":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -53,7 +53,7 @@
53
53
  "build": "node build.mjs",
54
54
  "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
55
55
  "vitest-run": "vitest -c ../../vitest.config.mts",
56
- "vitest-unit": "glob --absolute 'test/unit.*.test.ts'",
56
+ "vitest-unit": "glob --absolute 'test/unit.*test.ts'",
57
57
  "vitest-e2e": "glob --absolute 'test/integration-*.test.ts'",
58
58
  "type-check": "tsc --noEmit"
59
59
  }