@vercel/build-utils 7.7.1 → 7.9.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,21 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 7.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `base` parameter to `scanParentDirs()` ([#11261](https://github.com/vercel/vercel/pull/11261))
8
+
9
+ ## 7.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Remove `VERCEL_ENABLE_NPM_DEFAULT` env var check ([#11242](https://github.com/vercel/vercel/pull/11242))
14
+
15
+ ### Patch Changes
16
+
17
+ - Rename variants to flags and remove legacy flags ([#11121](https://github.com/vercel/vercel/pull/11121))
18
+
3
19
  ## 7.7.1
4
20
 
5
21
  ### Patch Changes
@@ -75,7 +75,7 @@ export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesP
75
75
  export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
76
76
  export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
77
77
  export declare function getNodeVersion(destPath: string, nodeVersionFallback?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion>;
78
- export declare function scanParentDirs(destPath: string, readPackageJson?: boolean): Promise<ScanParentDirsResult>;
78
+ export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
79
79
  export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
80
80
  export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, nodeVersion?: NodeVersion): Promise<boolean>;
81
81
  /**
@@ -200,16 +200,16 @@ async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL
200
200
  }
201
201
  return (0, import_node_version.getSupportedNodeVersion)(nodeVersion, isAuto, availableVersions);
202
202
  }
203
- async function scanParentDirs(destPath, readPackageJson = false) {
203
+ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
204
204
  (0, import_assert.default)(import_path.default.isAbsolute(destPath));
205
205
  const pkgJsonPath = await walkParentDirs({
206
- base: "/",
206
+ base,
207
207
  start: destPath,
208
208
  filename: "package.json"
209
209
  });
210
210
  const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra.default.readFile(pkgJsonPath, "utf8")) : void 0;
211
211
  const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] = await walkParentDirsMulti({
212
- base: "/",
212
+ base,
213
213
  start: destPath,
214
214
  filenames: [
215
215
  "yarn.lock",
@@ -247,11 +247,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
247
247
  lockfilePath = bunLockPath;
248
248
  lockfileVersion = 0;
249
249
  } else {
250
- if (process.env.VERCEL_ENABLE_NPM_DEFAULT === "1") {
251
- cliType = "npm";
252
- } else {
253
- cliType = "yarn";
254
- }
250
+ cliType = "npm";
255
251
  }
256
252
  const packageJsonPath = pkgJsonPath || void 0;
257
253
  return {
package/dist/index.js CHANGED
@@ -21919,16 +21919,16 @@ async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL
21919
21919
  }
21920
21920
  return getSupportedNodeVersion(nodeVersion, isAuto, availableVersions);
21921
21921
  }
21922
- async function scanParentDirs(destPath, readPackageJson = false) {
21922
+ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
21923
21923
  (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
21924
21924
  const pkgJsonPath = await walkParentDirs({
21925
- base: "/",
21925
+ base,
21926
21926
  start: destPath,
21927
21927
  filename: "package.json"
21928
21928
  });
21929
21929
  const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra7.default.readFile(pkgJsonPath, "utf8")) : void 0;
21930
21930
  const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] = await walkParentDirsMulti({
21931
- base: "/",
21931
+ base,
21932
21932
  start: destPath,
21933
21933
  filenames: [
21934
21934
  "yarn.lock",
@@ -21966,11 +21966,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
21966
21966
  lockfilePath = bunLockPath;
21967
21967
  lockfileVersion = 0;
21968
21968
  } else {
21969
- if (process.env.VERCEL_ENABLE_NPM_DEFAULT === "1") {
21970
- cliType = "npm";
21971
- } else {
21972
- cliType = "yarn";
21973
- }
21969
+ cliType = "npm";
21974
21970
  }
21975
21971
  const packageJsonPath = pkgJsonPath || void 0;
21976
21972
  return {
package/dist/types.d.ts CHANGED
@@ -385,14 +385,6 @@ export interface Cron {
385
385
  path: string;
386
386
  schedule: string;
387
387
  }
388
- /**
389
- * @deprecated Replaced by Variants. Remove once fully replaced.
390
- */
391
- export interface Flag {
392
- key: string;
393
- defaultValue?: unknown;
394
- metadata: Record<string, unknown>;
395
- }
396
388
  /** The framework which created the function */
397
389
  export interface FunctionFramework {
398
390
  slug: string;
@@ -415,9 +407,9 @@ export interface BuildResultV2Typical {
415
407
  framework?: {
416
408
  version: string;
417
409
  };
418
- /** @deprecated Replaced by Variants. Remove once fully replaced. */
419
- flags?: Flag[];
420
- variants?: Record<string, VariantDefinition>;
410
+ flags?: {
411
+ definitions: FlagDefinitions;
412
+ };
421
413
  }
422
414
  export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
423
415
  export interface BuildResultV3 {
@@ -433,17 +425,18 @@ export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDe
433
425
  * TODO: The following types will eventually be exported by a more
434
426
  * relevant package.
435
427
  */
436
- type VariantJSONArray = ReadonlyArray<VariantJSONValue>;
437
- type VariantJSONValue = string | boolean | number | null | VariantJSONArray | {
438
- [key: string]: VariantJSONValue;
428
+ type FlagJSONArray = ReadonlyArray<FlagJSONValue>;
429
+ type FlagJSONValue = string | boolean | number | null | FlagJSONArray | {
430
+ [key: string]: FlagJSONValue;
439
431
  };
440
- type VariantOption = {
441
- value: VariantJSONValue;
432
+ type FlagOption = {
433
+ value: FlagJSONValue;
442
434
  label?: string;
443
435
  };
444
- export interface VariantDefinition {
445
- options?: VariantOption[];
436
+ export interface FlagDefinition {
437
+ options?: FlagOption[];
446
438
  origin?: string;
447
439
  description?: string;
448
440
  }
441
+ export type FlagDefinitions = Record<string, FlagDefinition>;
449
442
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "7.7.1",
3
+ "version": "7.9.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",