@vercel/build-utils 13.2.4 → 13.2.5

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,13 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Adding in user configured deploymentId to build output type ([#14497](https://github.com/vercel/vercel/pull/14497))
8
+
9
+ - skip secondary installation for vercel.ts ([#14471](https://github.com/vercel/vercel/pull/14471))
10
+
3
11
  ## 13.2.4
4
12
 
5
13
  ### Patch Changes
@@ -92,6 +92,12 @@ export declare function usingCorepack(env: {
92
92
  [x: string]: string | undefined;
93
93
  }, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
94
94
  export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
95
+ /**
96
+ * Reset the customInstallCommandSet. This should be called at the start of each build
97
+ * to prevent custom install commands from being skipped due to the set persisting
98
+ * across multiple builds in the same Node process (e.g., in unit tests).
99
+ */
100
+ export declare function resetCustomInstallCommandSet(): void;
95
101
  export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, projectCreatedAt?: number): Promise<boolean>;
96
102
  /**
97
103
  * Prepares the input environment based on the used package manager and lockfile
@@ -189,7 +195,7 @@ export declare function runCustomInstallCommand({ destPath, installCommand, spaw
189
195
  installCommand: string;
190
196
  spawnOpts?: SpawnOptions;
191
197
  projectCreatedAt?: number;
192
- }): Promise<void>;
198
+ }): Promise<boolean>;
193
199
  export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions, projectCreatedAt?: number): Promise<boolean>;
194
200
  export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
195
201
  export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
@@ -40,6 +40,7 @@ __export(run_user_scripts_exports, {
40
40
  getScriptName: () => getScriptName,
41
41
  getSpawnOptions: () => getSpawnOptions,
42
42
  installDependencies: () => installDependencies,
43
+ resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
43
44
  runBundleInstall: () => runBundleInstall,
44
45
  runCustomInstallCommand: () => runCustomInstallCommand,
45
46
  runNpmInstall: () => runNpmInstall,
@@ -526,6 +527,10 @@ function checkIfAlreadyInstalled(runNpmInstallSet, packageJsonPath) {
526
527
  return { alreadyInstalled, runNpmInstallSet: initializedRunNpmInstallSet };
527
528
  }
528
529
  const runNpmInstallSema = new import_async_sema.default(1);
530
+ let customInstallCommandSet;
531
+ function resetCustomInstallCommandSet() {
532
+ customInstallCommandSet = void 0;
533
+ }
529
534
  async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
530
535
  if (meta?.isDev) {
531
536
  (0, import_debug.default)("Skipping dependency installation because dev mode is enabled");
@@ -557,6 +562,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
557
562
  if (alreadyInstalled) {
558
563
  return false;
559
564
  }
565
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
566
+ (0, import_debug.default)(
567
+ `Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`
568
+ );
569
+ runNpmInstallSet.add(packageJsonPath);
570
+ meta.runNpmInstallSet = runNpmInstallSet;
571
+ return false;
572
+ }
560
573
  meta.runNpmInstallSet = runNpmInstallSet;
561
574
  }
562
575
  if (cliType === "yarn") {
@@ -946,6 +959,24 @@ async function runCustomInstallCommand({
946
959
  spawnOpts,
947
960
  projectCreatedAt
948
961
  }) {
962
+ const normalizedPath = import_path.default.normalize(destPath);
963
+ const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(
964
+ customInstallCommandSet,
965
+ normalizedPath
966
+ );
967
+ customInstallCommandSet = runNpmInstallSet;
968
+ if (alreadyInstalled) {
969
+ (0, import_debug.default)(
970
+ `Skipping custom install command for ${normalizedPath} because it was already run`
971
+ );
972
+ return false;
973
+ }
974
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
975
+ (0, import_debug.default)(
976
+ `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
977
+ );
978
+ return false;
979
+ }
949
980
  console.log(`Running "install" command: \`${installCommand}\`...`);
950
981
  const {
951
982
  cliType,
@@ -969,6 +1000,7 @@ async function runCustomInstallCommand({
969
1000
  env,
970
1001
  cwd: destPath
971
1002
  });
1003
+ return true;
972
1004
  }
973
1005
  async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
974
1006
  (0, import_assert.default)(import_path.default.isAbsolute(destPath));
@@ -1066,6 +1098,7 @@ const installDependencies = (0, import_util.deprecate)(
1066
1098
  getScriptName,
1067
1099
  getSpawnOptions,
1068
1100
  installDependencies,
1101
+ resetCustomInstallCommandSet,
1069
1102
  runBundleInstall,
1070
1103
  runCustomInstallCommand,
1071
1104
  runNpmInstall,
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory }
8
8
  import getWriteableDirectory from './fs/get-writable-directory';
9
9
  import glob, { GlobOptions } from './fs/glob';
10
10
  import rename from './fs/rename';
11
- import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, traverseUpDirectories } from './fs/run-user-scripts';
11
+ import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, traverseUpDirectories } from './fs/run-user-scripts';
12
12
  import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion } from './fs/node-version';
13
13
  import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
14
14
  import debug from './debug';
@@ -18,7 +18,7 @@ import { getPrefixedEnvVars } from './get-prefixed-env-vars';
18
18
  import { cloneEnv } from './clone-env';
19
19
  import { hardLinkDir } from './hard-link-dir';
20
20
  import { validateNpmrc } from './validate-npmrc';
21
- export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
21
+ export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
22
22
  export { EdgeFunction } from './edge-function';
23
23
  export { readConfigFile } from './fs/read-config-file';
24
24
  export { normalizePath } from './fs/normalize-path';
package/dist/index.js CHANGED
@@ -23776,6 +23776,7 @@ __export(src_exports, {
23776
23776
  normalizePath: () => normalizePath,
23777
23777
  readConfigFile: () => readConfigFile,
23778
23778
  rename: () => rename,
23779
+ resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
23779
23780
  runBundleInstall: () => runBundleInstall,
23780
23781
  runCustomInstallCommand: () => runCustomInstallCommand,
23781
23782
  runNpmInstall: () => runNpmInstall,
@@ -25552,6 +25553,10 @@ function checkIfAlreadyInstalled(runNpmInstallSet, packageJsonPath) {
25552
25553
  return { alreadyInstalled, runNpmInstallSet: initializedRunNpmInstallSet };
25553
25554
  }
25554
25555
  var runNpmInstallSema = new import_async_sema4.default(1);
25556
+ var customInstallCommandSet;
25557
+ function resetCustomInstallCommandSet() {
25558
+ customInstallCommandSet = void 0;
25559
+ }
25555
25560
  async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
25556
25561
  if (meta?.isDev) {
25557
25562
  debug("Skipping dependency installation because dev mode is enabled");
@@ -25583,6 +25588,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
25583
25588
  if (alreadyInstalled) {
25584
25589
  return false;
25585
25590
  }
25591
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
25592
+ debug(
25593
+ `Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`
25594
+ );
25595
+ runNpmInstallSet.add(packageJsonPath);
25596
+ meta.runNpmInstallSet = runNpmInstallSet;
25597
+ return false;
25598
+ }
25586
25599
  meta.runNpmInstallSet = runNpmInstallSet;
25587
25600
  }
25588
25601
  if (cliType === "yarn") {
@@ -25972,6 +25985,24 @@ async function runCustomInstallCommand({
25972
25985
  spawnOpts,
25973
25986
  projectCreatedAt
25974
25987
  }) {
25988
+ const normalizedPath = import_path5.default.normalize(destPath);
25989
+ const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(
25990
+ customInstallCommandSet,
25991
+ normalizedPath
25992
+ );
25993
+ customInstallCommandSet = runNpmInstallSet;
25994
+ if (alreadyInstalled) {
25995
+ debug(
25996
+ `Skipping custom install command for ${normalizedPath} because it was already run`
25997
+ );
25998
+ return false;
25999
+ }
26000
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
26001
+ debug(
26002
+ `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
26003
+ );
26004
+ return false;
26005
+ }
25975
26006
  console.log(`Running "install" command: \`${installCommand}\`...`);
25976
26007
  const {
25977
26008
  cliType,
@@ -25995,6 +26026,7 @@ async function runCustomInstallCommand({
25995
26026
  env,
25996
26027
  cwd: destPath
25997
26028
  });
26029
+ return true;
25998
26030
  }
25999
26031
  async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
26000
26032
  (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
@@ -26825,6 +26857,7 @@ async function isPythonEntrypoint(file) {
26825
26857
  normalizePath,
26826
26858
  readConfigFile,
26827
26859
  rename,
26860
+ resetCustomInstallCommandSet,
26828
26861
  runBundleInstall,
26829
26862
  runCustomInstallCommand,
26830
26863
  runNpmInstall,
package/dist/types.d.ts CHANGED
@@ -469,6 +469,14 @@ export interface BuildResultV2Typical {
469
469
  flags?: {
470
470
  definitions: FlagDefinitions;
471
471
  };
472
+ /**
473
+ * User-configured deployment ID for skew protection.
474
+ * This allows users to specify a custom deployment identifier
475
+ * in their next.config.js that will be used for version skew protection
476
+ * with pre-built deployments.
477
+ * @example "abc123"
478
+ */
479
+ deploymentId?: string;
472
480
  }
473
481
  export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
474
482
  export interface BuildResultV3 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.2.4",
3
+ "version": "13.2.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -48,7 +48,7 @@
48
48
  "vitest": "2.0.1",
49
49
  "json5": "2.2.3",
50
50
  "@vercel/error-utils": "2.0.3",
51
- "@vercel/routing-utils": "5.3.1"
51
+ "@vercel/routing-utils": "5.3.2"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "node build.mjs",