@vercel/build-utils 7.5.1 → 7.7.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,25 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 7.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Revert "Revert "Default ruby to only currently supported version (3.2.0)"" ([#11137](https://github.com/vercel/vercel/pull/11137))
8
+
9
+ ## 7.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Revert "Default ruby to only currently supported version (3.2.0)" ([#11135](https://github.com/vercel/vercel/pull/11135))
14
+
15
+ - Mark `flags` as deprecated and replace them with `variants` ([#11098](https://github.com/vercel/vercel/pull/11098))
16
+
17
+ - [build-utils] change default package manager when no lockfile detected from `yarn` to `npm` (gated behind feature flag) ([#11131](https://github.com/vercel/vercel/pull/11131))
18
+
19
+ ### Patch Changes
20
+
21
+ - Update internal type for variants ([#11111](https://github.com/vercel/vercel/pull/11111))
22
+
3
23
  ## 7.5.1
4
24
 
5
25
  ### Patch Changes
@@ -220,7 +220,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
220
220
  });
221
221
  let lockfilePath;
222
222
  let lockfileVersion;
223
- let cliType = "yarn";
223
+ let cliType;
224
224
  const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
225
225
  Boolean(yarnLockPath),
226
226
  npmLockPath ? (0, import_read_config_file.readConfigFile)(npmLockPath) : null,
@@ -246,6 +246,12 @@ async function scanParentDirs(destPath, readPackageJson = false) {
246
246
  cliType = "bun";
247
247
  lockfilePath = bunLockPath;
248
248
  lockfileVersion = 0;
249
+ } else {
250
+ if (process.env.VERCEL_ENABLE_NPM_DEFAULT === "1") {
251
+ cliType = "npm";
252
+ } else {
253
+ cliType = "yarn";
254
+ }
249
255
  }
250
256
  const packageJsonPath = pkgJsonPath || void 0;
251
257
  return {
@@ -302,6 +308,13 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
302
308
  const { cliType, packageJsonPath, lockfileVersion } = await scanParentDirs(
303
309
  destPath
304
310
  );
311
+ if (!packageJsonPath) {
312
+ (0, import_debug.default)(
313
+ `Skipping dependency installation because no package.json was found for ${destPath}`
314
+ );
315
+ runNpmInstallSema.release();
316
+ return false;
317
+ }
305
318
  if (meta && packageJsonPath && args.length === 0) {
306
319
  if (!isSet(meta.runNpmInstallSet)) {
307
320
  meta.runNpmInstallSet = /* @__PURE__ */ new Set();
package/dist/index.js CHANGED
@@ -21939,7 +21939,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
21939
21939
  });
21940
21940
  let lockfilePath;
21941
21941
  let lockfileVersion;
21942
- let cliType = "yarn";
21942
+ let cliType;
21943
21943
  const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
21944
21944
  Boolean(yarnLockPath),
21945
21945
  npmLockPath ? readConfigFile(npmLockPath) : null,
@@ -21965,6 +21965,12 @@ async function scanParentDirs(destPath, readPackageJson = false) {
21965
21965
  cliType = "bun";
21966
21966
  lockfilePath = bunLockPath;
21967
21967
  lockfileVersion = 0;
21968
+ } else {
21969
+ if (process.env.VERCEL_ENABLE_NPM_DEFAULT === "1") {
21970
+ cliType = "npm";
21971
+ } else {
21972
+ cliType = "yarn";
21973
+ }
21968
21974
  }
21969
21975
  const packageJsonPath = pkgJsonPath || void 0;
21970
21976
  return {
@@ -22021,6 +22027,13 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
22021
22027
  const { cliType, packageJsonPath, lockfileVersion } = await scanParentDirs(
22022
22028
  destPath
22023
22029
  );
22030
+ if (!packageJsonPath) {
22031
+ debug(
22032
+ `Skipping dependency installation because no package.json was found for ${destPath}`
22033
+ );
22034
+ runNpmInstallSema.release();
22035
+ return false;
22036
+ }
22024
22037
  if (meta && packageJsonPath && args.length === 0) {
22025
22038
  if (!isSet(meta.runNpmInstallSet)) {
22026
22039
  meta.runNpmInstallSet = /* @__PURE__ */ new Set();
package/dist/types.d.ts CHANGED
@@ -385,6 +385,9 @@ export interface Cron {
385
385
  path: string;
386
386
  schedule: string;
387
387
  }
388
+ /**
389
+ * @deprecated Replaced by Variants. Remove once fully replaced.
390
+ */
388
391
  export interface Flag {
389
392
  key: string;
390
393
  defaultValue?: unknown;
@@ -412,7 +415,9 @@ export interface BuildResultV2Typical {
412
415
  framework?: {
413
416
  version: string;
414
417
  };
418
+ /** @deprecated Replaced by Variants. Remove once fully replaced. */
415
419
  flags?: Flag[];
420
+ variants?: Record<string, VariantDefinition>;
416
421
  }
417
422
  export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
418
423
  export interface BuildResultV3 {
@@ -424,4 +429,21 @@ export type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
424
429
  export type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
425
430
  export type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
426
431
  export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
432
+ /**
433
+ * TODO: The following types will eventually be exported by a more
434
+ * relevant package.
435
+ */
436
+ type VariantJSONArray = ReadonlyArray<VariantJSONValue>;
437
+ type VariantJSONValue = string | boolean | number | null | VariantJSONArray | {
438
+ [key: string]: VariantJSONValue;
439
+ };
440
+ type VariantOption = {
441
+ value: VariantJSONValue;
442
+ label?: string;
443
+ };
444
+ export interface VariantDefinition {
445
+ options?: VariantOption[];
446
+ origin?: string;
447
+ description?: string;
448
+ }
427
449
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "7.5.1",
3
+ "version": "7.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",