@vercel/build-utils 13.2.3 → 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,19 @@
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
+
11
+ ## 13.2.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [python] only create api builders for `.py` files that export an app or handler ([#14493](https://github.com/vercel/vercel/pull/14493))
16
+
3
17
  ## 13.2.3
4
18
 
5
19
  ### 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';
@@ -33,3 +33,4 @@ export { getInstalledPackageVersion } from './get-installed-package-version';
33
33
  export { defaultCachePathGlob } from './default-cache-path-glob';
34
34
  export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
35
35
  export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
36
+ export * from './python';