@vercel/build-utils 14.5.0 → 14.6.1

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,23 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 14.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - aad9541: Run on-disk JavaScript workers with a lazily resolved system Node.js executable in native CLI installations, and install the matching Build Utils preview tarball for dynamically installed Builders.
8
+
9
+ ## 14.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - e82de48: Add strict function affinity configuration and serialize it into function outputs.
14
+
15
+ ## 14.5.1
16
+
17
+ ### Patch Changes
18
+
19
+ - a443e57: Revert dependency install log rewriting that piped pnpm stdout through an unread Transform and could hang large installs.
20
+
3
21
  ## 14.5.0
4
22
 
5
23
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  import type { LambdaOptionsBase } from './lambda';
2
2
  import type { Env, Files } from './types';
3
- export interface ContainerImageConfig extends Pick<LambdaOptionsBase, 'handler' | 'architecture' | 'memory' | 'maxDuration' | 'maxConcurrency' | 'environment' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'> {
3
+ export interface ContainerImageConfig extends Pick<LambdaOptionsBase, 'handler' | 'architecture' | 'memory' | 'maxDuration' | 'affinity' | 'maxConcurrency' | 'environment' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'> {
4
4
  /**
5
5
  * The OCI image reference, for example
6
6
  * `vcr.vercel.com/team/project/svc@sha256:...`.
@@ -20,6 +20,7 @@ export declare class ContainerImage implements ContainerImageConfig {
20
20
  architecture?: ContainerImageConfig['architecture'];
21
21
  memory?: ContainerImageConfig['memory'];
22
22
  maxDuration?: ContainerImageConfig['maxDuration'];
23
+ affinity?: ContainerImageConfig['affinity'];
23
24
  maxConcurrency?: ContainerImageConfig['maxConcurrency'];
24
25
  regions?: ContainerImageConfig['regions'];
25
26
  functionFailoverRegions?: ContainerImageConfig['functionFailoverRegions'];
@@ -32,6 +32,7 @@ class ContainerImage {
32
32
  this.architecture = params.architecture;
33
33
  this.memory = params.memory;
34
34
  this.maxDuration = params.maxDuration;
35
+ this.affinity = params.affinity;
35
36
  this.maxConcurrency = params.maxConcurrency;
36
37
  this.regions = params.regions;
37
38
  this.functionFailoverRegions = params.functionFailoverRegions;
@@ -129,7 +129,6 @@ export declare function usingCorepack(env: {
129
129
  [x: string]: string | undefined;
130
130
  }, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
131
131
  export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
132
- export declare function stripPnpmVersionFooter(line: string): string;
133
132
  /**
134
133
  * Reset the customInstallCommandSet. This should be called at the start of each build
135
134
  * to prevent custom install commands from being skipped due to the set persisting
@@ -52,7 +52,6 @@ __export(run_user_scripts_exports, {
52
52
  scanParentDirs: () => scanParentDirs,
53
53
  spawnAsync: () => spawnAsync,
54
54
  spawnCommand: () => spawnCommand,
55
- stripPnpmVersionFooter: () => stripPnpmVersionFooter,
56
55
  traverseUpDirectories: () => traverseUpDirectories,
57
56
  turboVersionSpecifierSupportsCorepack: () => turboVersionSpecifierSupportsCorepack,
58
57
  usingCorepack: () => usingCorepack,
@@ -65,7 +64,6 @@ var import_path = __toESM(require("path"));
65
64
  var import_async_sema = __toESM(require("async-sema"));
66
65
  var import_cross_spawn = __toESM(require("cross-spawn"));
67
66
  var import_semver = require("semver");
68
- var import_stream = require("stream");
69
67
  var import_util = require("util");
70
68
  var import_debug = __toESM(require("../debug"));
71
69
  var import_errors = require("../errors");
@@ -578,29 +576,6 @@ function getInstallCommandForPackageManager(packageManager, args) {
578
576
  };
579
577
  }
580
578
  }
581
- function stripPnpmVersionFooter(line) {
582
- return line.replace(/ using pnpm v\d+\.\d+\.\d+(?=\r?$)/, "");
583
- }
584
- function createPnpmOutputFilter(destination) {
585
- let incompleteLine = "";
586
- return new import_stream.Transform({
587
- transform(chunk, _encoding, callback) {
588
- const lines = `${incompleteLine}${chunk.toString()}`.split("\n");
589
- incompleteLine = lines.pop() ?? "";
590
- for (const line of lines) {
591
- destination.write(`${stripPnpmVersionFooter(line)}
592
- `);
593
- }
594
- callback();
595
- },
596
- flush(callback) {
597
- if (incompleteLine) {
598
- destination.write(stripPnpmVersionFooter(incompleteLine));
599
- }
600
- callback();
601
- }
602
- });
603
- }
604
579
  async function runInstallCommand({
605
580
  packageManager,
606
581
  args,
@@ -612,9 +587,8 @@ async function runInstallCommand({
612
587
  if (process.env.NPM_ONLY_PRODUCTION) {
613
588
  commandArguments.push("--production");
614
589
  }
615
- const shouldFilterPnpmOutput = packageManager === "pnpm";
616
- opts.outputStream = shouldFilterPnpmOutput ? createPnpmOutputFilter(output?.stdout ?? process.stdout) : output?.stdout;
617
- opts.errorStream = shouldFilterPnpmOutput ? output?.stderr ?? process.stderr : output?.stderr;
590
+ opts.outputStream = output?.stdout;
591
+ opts.errorStream = output?.stderr;
618
592
  await spawnAsync(packageManager, commandArguments, opts);
619
593
  }
620
594
  function initializeSet(set) {
@@ -697,6 +671,12 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
697
671
  }
698
672
  }
699
673
  const installTime = Date.now();
674
+ if (output?.stdout) {
675
+ output.stdout.write("Installing dependencies...\n");
676
+ } else {
677
+ console.log("Installing dependencies...");
678
+ }
679
+ (0, import_debug.default)(`Installing to ${destPath}`);
700
680
  const opts = { cwd: destPath, ...spawnOpts };
701
681
  const env = (0, import_clone_env.cloneEnv)(opts.env || process.env);
702
682
  delete env.NODE_ENV;
@@ -710,20 +690,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
710
690
  turboSupportsCorepackHome,
711
691
  projectCreatedAt
712
692
  });
713
- const packageManager = getPackageManagerDisplayName({
714
- cliType,
715
- lockfileVersion,
716
- packageJsonPackageManager,
717
- env: opts.env
718
- });
719
- const installMessage = `Installing dependencies with ${packageManager}`;
720
- if (output?.stdout) {
721
- output.stdout.write(`${installMessage}
722
- `);
723
- } else {
724
- console.log(installMessage);
725
- }
726
- (0, import_debug.default)(`Installing to ${destPath}`);
727
693
  const maySeeDynamicRequireYarnBug = process.env?.ENABLE_EXPERIMENTAL_COREPACK && packageJson?.packageManager?.startsWith("yarn") && packageJson?.type === "module";
728
694
  if (maySeeDynamicRequireYarnBug) {
729
695
  console.warn(
@@ -742,37 +708,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
742
708
  runNpmInstallSema.release();
743
709
  }
744
710
  }
745
- function getPackageManagerDisplayName({
746
- cliType,
747
- lockfileVersion,
748
- packageJsonPackageManager,
749
- env
750
- }) {
751
- const versionResult = import_cross_spawn.default.sync(cliType, ["--version"], {
752
- env,
753
- encoding: "utf8"
754
- });
755
- const version = versionResult.status === 0 ? versionResult.stdout.trim() : "";
756
- if (version) {
757
- return `${cliType} ${version}`;
758
- }
759
- if (packageJsonPackageManager && env.ENABLE_EXPERIMENTAL_COREPACK) {
760
- return packageJsonPackageManager.replace("@", " ");
761
- }
762
- if (cliType === "pnpm") {
763
- const selectedPath = env.PATH?.split(import_path.default.delimiter).find(
764
- (segment) => /^\/pnpm\d+\/node_modules\/\.bin$/.test(segment)
765
- );
766
- const major = selectedPath?.match(/^\/pnpm(\d+)\//)?.[1];
767
- if (major) {
768
- return `pnpm ${major}`;
769
- }
770
- }
771
- if (cliType === "yarn") {
772
- return detectYarnVersion(lockfileVersion).replace("@", " ").replace(/\.x$/, "");
773
- }
774
- return cliType;
775
- }
776
711
  function getEnvForPackageManager({
777
712
  cliType,
778
713
  lockfileVersion,
@@ -831,6 +766,44 @@ function getEnvForPackageManager({
831
766
  if (pathsToPrepend.length > 0) {
832
767
  const oldPath = env.PATH + "";
833
768
  newEnv.PATH = `${pathsToPrepend.join(import_path.default.delimiter)}${oldPath ? import_path.default.delimiter : ""}${oldPath}`;
769
+ if (newPath && pathsToPrepend.includes(newPath) && detectedLockfile && detectedPackageManager) {
770
+ const versionString = cliType === "pnpm" ? `version ${lockfileVersion} ` : "";
771
+ const pin = resolveCompatiblePnpmPin({
772
+ cliType,
773
+ lockfileVersion,
774
+ packageJsonDevEngines,
775
+ corepackPackageManager: packageJsonPackageManager
776
+ });
777
+ const usedPin = Boolean(pin) && detectedPackageManager === pin?.override.detectedPackageManager;
778
+ const lockfileDefault = detectPackageManager(
779
+ cliType,
780
+ lockfileVersion,
781
+ projectCreatedAt,
782
+ nodeVersion
783
+ );
784
+ const usedEnginesSelector = Boolean(packageJsonEngines?.pnpm) && !usedPin && detectedPackageManager !== lockfileDefault?.detectedPackageManager;
785
+ const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
786
+ if (usedPin && pin) {
787
+ const pinField = pin.source === "devEngines" ? "package.json#devEngines.packageManager" : `package.json#packageManager ${packageJsonPackageManager}`;
788
+ console.log(
789
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from ${pinField}`
790
+ );
791
+ } else if (usedEnginesSelector) {
792
+ console.log(
793
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from package.json#engines.pnpm ${packageJsonEngines?.pnpm}`
794
+ );
795
+ } else if (detectedV9PnpmLockfile) {
796
+ console.log(
797
+ `Detected \`${detectedLockfile}\` ${lockfileVersion} which may be generated by pnpm@9.x, pnpm@10.x, or pnpm@11.x
798
+ Using ${detectedPackageManager} based on project creation date
799
+ To use a different version, set package.json#packageManager or package.json#devEngines.packageManager`
800
+ );
801
+ } else {
802
+ console.log(
803
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
804
+ );
805
+ }
806
+ }
834
807
  }
835
808
  if (cliType === "yarn" && !env.YARN_NODE_LINKER) {
836
809
  newEnv.YARN_NODE_LINKER = "node-modules";
@@ -1396,7 +1369,6 @@ const installDependencies = (0, import_util.deprecate)(
1396
1369
  scanParentDirs,
1397
1370
  spawnAsync,
1398
1371
  spawnCommand,
1399
- stripPnpmVersionFooter,
1400
1372
  traverseUpDirectories,
1401
1373
  turboVersionSpecifierSupportsCorepack,
1402
1374
  usingCorepack,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns the executable that should be used to run Node.js scripts.
3
+ *
4
+ * In the standalone Vercel CLI, `process.execPath` points to the CLI binary
5
+ * rather than Node.js. Resolve Node.js lazily from PATH so commands that do not
6
+ * execute on-disk JavaScript can still run when Node.js is unavailable.
7
+ */
8
+ export declare function getNodeExecPath(): string;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_node_exec_path_exports = {};
20
+ __export(get_node_exec_path_exports, {
21
+ getNodeExecPath: () => getNodeExecPath
22
+ });
23
+ module.exports = __toCommonJS(get_node_exec_path_exports);
24
+ var import_node_fs = require("node:fs");
25
+ var import_node_path = require("node:path");
26
+ const NODE_EXEC_PATH_ENV = "VERCEL_NODE_EXEC_PATH";
27
+ const NATIVE_CLI_ENV = "VERCEL_VC_NATIVE";
28
+ function getNodeExecPath() {
29
+ const override = process.env[NODE_EXEC_PATH_ENV];
30
+ if (override)
31
+ return override;
32
+ if (!process.env[NATIVE_CLI_ENV])
33
+ return process.execPath;
34
+ const nodeExecPath = findNodeExecPath();
35
+ process.env[NODE_EXEC_PATH_ENV] = nodeExecPath;
36
+ return nodeExecPath;
37
+ }
38
+ function findNodeExecPath() {
39
+ const executableName = process.platform === "win32" ? "node.exe" : "node";
40
+ const cliPath = (0, import_node_fs.realpathSync)(process.execPath);
41
+ for (const directory of (process.env.PATH || "").split(import_node_path.delimiter)) {
42
+ if (!directory)
43
+ continue;
44
+ const candidate = (0, import_node_path.resolve)(directory, executableName);
45
+ try {
46
+ (0, import_node_fs.accessSync)(candidate, import_node_fs.constants.X_OK);
47
+ if ((0, import_node_fs.realpathSync)(candidate) !== cliPath)
48
+ return candidate;
49
+ } catch {
50
+ }
51
+ }
52
+ throw new Error("Could not find the Node.js executable in PATH.");
53
+ }
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ getNodeExecPath
57
+ });
package/dist/index.d.ts CHANGED
@@ -19,9 +19,11 @@ import { getPrefixedEnvVars } from './get-prefixed-env-vars';
19
19
  import { getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars } from './get-service-url-env-vars';
20
20
  import { cloneEnv } from './clone-env';
21
21
  import { hardLinkDir } from './hard-link-dir';
22
+ import { getNodeExecPath } from './get-node-exec-path';
22
23
  import { validateNpmrc } from './validate-npmrc';
23
24
  export type { NodejsLambdaOptions, PrerenderInitialMetadata };
24
- 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, getOrCreateBunBinary, detectPackageManager, runNpmInstall, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
25
+ export type { LambdaAffinity } from './lambda';
26
+ export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getNodeExecPath, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, getOrCreateBunBinary, detectPackageManager, runNpmInstall, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
25
27
  export { EdgeFunction } from './edge-function';
26
28
  export { ContainerImage } from './container-image';
27
29
  export type { ContainerImageConfig } from './container-image';
package/dist/index.js CHANGED
@@ -2024,11 +2024,11 @@ var require_stream_readable = __commonJS({
2024
2024
  var require_stream_transform = __commonJS({
2025
2025
  "../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js"(exports, module2) {
2026
2026
  "use strict";
2027
- module2.exports = Transform2;
2027
+ module2.exports = Transform;
2028
2028
  var Duplex = require_stream_duplex();
2029
2029
  var util = Object.create(require_util());
2030
2030
  util.inherits = require_inherits();
2031
- util.inherits(Transform2, Duplex);
2031
+ util.inherits(Transform, Duplex);
2032
2032
  function afterTransform(er, data) {
2033
2033
  var ts = this._transformState;
2034
2034
  ts.transforming = false;
@@ -2047,9 +2047,9 @@ var require_stream_transform = __commonJS({
2047
2047
  this._read(rs.highWaterMark);
2048
2048
  }
2049
2049
  }
2050
- function Transform2(options) {
2051
- if (!(this instanceof Transform2))
2052
- return new Transform2(options);
2050
+ function Transform(options) {
2051
+ if (!(this instanceof Transform))
2052
+ return new Transform(options);
2053
2053
  Duplex.call(this, options);
2054
2054
  this._transformState = {
2055
2055
  afterTransform: afterTransform.bind(this),
@@ -2079,14 +2079,14 @@ var require_stream_transform = __commonJS({
2079
2079
  done(this, null, null);
2080
2080
  }
2081
2081
  }
2082
- Transform2.prototype.push = function(chunk, encoding) {
2082
+ Transform.prototype.push = function(chunk, encoding) {
2083
2083
  this._transformState.needTransform = false;
2084
2084
  return Duplex.prototype.push.call(this, chunk, encoding);
2085
2085
  };
2086
- Transform2.prototype._transform = function(chunk, encoding, cb) {
2086
+ Transform.prototype._transform = function(chunk, encoding, cb) {
2087
2087
  throw new Error("_transform() is not implemented");
2088
2088
  };
2089
- Transform2.prototype._write = function(chunk, encoding, cb) {
2089
+ Transform.prototype._write = function(chunk, encoding, cb) {
2090
2090
  var ts = this._transformState;
2091
2091
  ts.writecb = cb;
2092
2092
  ts.writechunk = chunk;
@@ -2097,7 +2097,7 @@ var require_stream_transform = __commonJS({
2097
2097
  this._read(rs.highWaterMark);
2098
2098
  }
2099
2099
  };
2100
- Transform2.prototype._read = function(n) {
2100
+ Transform.prototype._read = function(n) {
2101
2101
  var ts = this._transformState;
2102
2102
  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
2103
2103
  ts.transforming = true;
@@ -2106,7 +2106,7 @@ var require_stream_transform = __commonJS({
2106
2106
  ts.needTransform = true;
2107
2107
  }
2108
2108
  };
2109
- Transform2.prototype._destroy = function(err, cb) {
2109
+ Transform.prototype._destroy = function(err, cb) {
2110
2110
  var _this2 = this;
2111
2111
  Duplex.prototype._destroy.call(this, err, function(err2) {
2112
2112
  cb(err2);
@@ -2132,14 +2132,14 @@ var require_stream_passthrough = __commonJS({
2132
2132
  "../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module2) {
2133
2133
  "use strict";
2134
2134
  module2.exports = PassThrough;
2135
- var Transform2 = require_stream_transform();
2135
+ var Transform = require_stream_transform();
2136
2136
  var util = Object.create(require_util());
2137
2137
  util.inherits = require_inherits();
2138
- util.inherits(PassThrough, Transform2);
2138
+ util.inherits(PassThrough, Transform);
2139
2139
  function PassThrough(options) {
2140
2140
  if (!(this instanceof PassThrough))
2141
2141
  return new PassThrough(options);
2142
- Transform2.call(this, options);
2142
+ Transform.call(this, options);
2143
2143
  }
2144
2144
  PassThrough.prototype._transform = function(chunk, encoding, cb) {
2145
2145
  cb(null, chunk);
@@ -2374,8 +2374,8 @@ var require_universalify = __commonJS({
2374
2374
  if (typeof args[args.length - 1] === "function")
2375
2375
  fn.apply(this, args);
2376
2376
  else {
2377
- return new Promise((resolve, reject) => {
2378
- args.push((err, res) => err != null ? reject(err) : resolve(res));
2377
+ return new Promise((resolve2, reject) => {
2378
+ args.push((err, res) => err != null ? reject(err) : resolve2(res));
2379
2379
  fn.apply(this, args);
2380
2380
  });
2381
2381
  }
@@ -2398,7 +2398,7 @@ var require_universalify = __commonJS({
2398
2398
  // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
2399
2399
  var require_polyfills = __commonJS({
2400
2400
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
2401
- var constants = require("constants");
2401
+ var constants2 = require("constants");
2402
2402
  var origCwd = process.cwd;
2403
2403
  var cwd = null;
2404
2404
  var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
@@ -2423,7 +2423,7 @@ var require_polyfills = __commonJS({
2423
2423
  var chdir;
2424
2424
  module2.exports = patch;
2425
2425
  function patch(fs11) {
2426
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
2426
+ if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
2427
2427
  patchLchmod(fs11);
2428
2428
  }
2429
2429
  if (!fs11.lutimes) {
@@ -2530,7 +2530,7 @@ var require_polyfills = __commonJS({
2530
2530
  fs12.lchmod = function(path8, mode, callback) {
2531
2531
  fs12.open(
2532
2532
  path8,
2533
- constants.O_WRONLY | constants.O_SYMLINK,
2533
+ constants2.O_WRONLY | constants2.O_SYMLINK,
2534
2534
  mode,
2535
2535
  function(err, fd) {
2536
2536
  if (err) {
@@ -2548,7 +2548,7 @@ var require_polyfills = __commonJS({
2548
2548
  );
2549
2549
  };
2550
2550
  fs12.lchmodSync = function(path8, mode) {
2551
- var fd = fs12.openSync(path8, constants.O_WRONLY | constants.O_SYMLINK, mode);
2551
+ var fd = fs12.openSync(path8, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
2552
2552
  var threw = true;
2553
2553
  var ret;
2554
2554
  try {
@@ -2568,9 +2568,9 @@ var require_polyfills = __commonJS({
2568
2568
  };
2569
2569
  }
2570
2570
  function patchLutimes(fs12) {
2571
- if (constants.hasOwnProperty("O_SYMLINK") && fs12.futimes) {
2571
+ if (constants2.hasOwnProperty("O_SYMLINK") && fs12.futimes) {
2572
2572
  fs12.lutimes = function(path8, at, mt, cb) {
2573
- fs12.open(path8, constants.O_SYMLINK, function(er, fd) {
2573
+ fs12.open(path8, constants2.O_SYMLINK, function(er, fd) {
2574
2574
  if (er) {
2575
2575
  if (cb)
2576
2576
  cb(er);
@@ -2585,7 +2585,7 @@ var require_polyfills = __commonJS({
2585
2585
  });
2586
2586
  };
2587
2587
  fs12.lutimesSync = function(path8, at, mt) {
2588
- var fd = fs12.openSync(path8, constants.O_SYMLINK);
2588
+ var fd = fs12.openSync(path8, constants2.O_SYMLINK);
2589
2589
  var ret;
2590
2590
  var threw = true;
2591
2591
  try {
@@ -3256,19 +3256,19 @@ var require_fs = __commonJS({
3256
3256
  if (typeof callback === "function") {
3257
3257
  return fs11.exists(filename, callback);
3258
3258
  }
3259
- return new Promise((resolve) => {
3260
- return fs11.exists(filename, resolve);
3259
+ return new Promise((resolve2) => {
3260
+ return fs11.exists(filename, resolve2);
3261
3261
  });
3262
3262
  };
3263
3263
  exports.read = function(fd, buffer, offset, length, position, callback) {
3264
3264
  if (typeof callback === "function") {
3265
3265
  return fs11.read(fd, buffer, offset, length, position, callback);
3266
3266
  }
3267
- return new Promise((resolve, reject) => {
3267
+ return new Promise((resolve2, reject) => {
3268
3268
  fs11.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
3269
3269
  if (err)
3270
3270
  return reject(err);
3271
- resolve({ bytesRead, buffer: buffer2 });
3271
+ resolve2({ bytesRead, buffer: buffer2 });
3272
3272
  });
3273
3273
  });
3274
3274
  };
@@ -3276,11 +3276,11 @@ var require_fs = __commonJS({
3276
3276
  if (typeof args[args.length - 1] === "function") {
3277
3277
  return fs11.write(fd, buffer, ...args);
3278
3278
  }
3279
- return new Promise((resolve, reject) => {
3279
+ return new Promise((resolve2, reject) => {
3280
3280
  fs11.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
3281
3281
  if (err)
3282
3282
  return reject(err);
3283
- resolve({ bytesWritten, buffer: buffer2 });
3283
+ resolve2({ bytesWritten, buffer: buffer2 });
3284
3284
  });
3285
3285
  });
3286
3286
  };
@@ -3289,11 +3289,11 @@ var require_fs = __commonJS({
3289
3289
  if (typeof args[args.length - 1] === "function") {
3290
3290
  return fs11.writev(fd, buffers, ...args);
3291
3291
  }
3292
- return new Promise((resolve, reject) => {
3292
+ return new Promise((resolve2, reject) => {
3293
3293
  fs11.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
3294
3294
  if (err)
3295
3295
  return reject(err);
3296
- resolve({ bytesWritten, buffers: buffers2 });
3296
+ resolve2({ bytesWritten, buffers: buffers2 });
3297
3297
  });
3298
3298
  });
3299
3299
  };
@@ -5405,12 +5405,12 @@ var require_async_sema = __commonJS({
5405
5405
  if (token) {
5406
5406
  return token;
5407
5407
  }
5408
- return new Promise((resolve, reject) => {
5408
+ return new Promise((resolve2, reject) => {
5409
5409
  if (this.pauseFn && !this.paused) {
5410
5410
  this.paused = true;
5411
5411
  this.pauseFn();
5412
5412
  }
5413
- this.waiting.push({ resolve, reject });
5413
+ this.waiting.push({ resolve: resolve2, reject });
5414
5414
  });
5415
5415
  }
5416
5416
  async v() {
@@ -5668,7 +5668,7 @@ var require_lib2 = __commonJS({
5668
5668
  "../../node_modules/.pnpm/async-retry@1.2.3/node_modules/async-retry/lib/index.js"(exports, module2) {
5669
5669
  var retrier = require_retry2();
5670
5670
  function retry2(fn, opts) {
5671
- function run(resolve, reject) {
5671
+ function run(resolve2, reject) {
5672
5672
  var options = opts || {};
5673
5673
  var op = retrier.operation(options);
5674
5674
  function bail(err) {
@@ -5693,7 +5693,7 @@ var require_lib2 = __commonJS({
5693
5693
  onError(err, num);
5694
5694
  return;
5695
5695
  }
5696
- Promise.resolve(val).then(resolve).catch(function catchIt(err) {
5696
+ Promise.resolve(val).then(resolve2).catch(function catchIt(err) {
5697
5697
  onError(err, num);
5698
5698
  });
5699
5699
  }
@@ -6016,7 +6016,7 @@ var require_buffer_crc32 = __commonJS({
6016
6016
  var require_yazl = __commonJS({
6017
6017
  "../../node_modules/.pnpm/yazl@2.5.1/node_modules/yazl/index.js"(exports) {
6018
6018
  var fs11 = require("fs");
6019
- var Transform2 = require("stream").Transform;
6019
+ var Transform = require("stream").Transform;
6020
6020
  var PassThrough = require("stream").PassThrough;
6021
6021
  var zlib = require("zlib");
6022
6022
  var util = require("util");
@@ -6540,18 +6540,18 @@ var require_yazl = __commonJS({
6540
6540
  buffer.writeUInt32LE(low, offset);
6541
6541
  buffer.writeUInt32LE(high, offset + 4);
6542
6542
  }
6543
- util.inherits(ByteCounter, Transform2);
6543
+ util.inherits(ByteCounter, Transform);
6544
6544
  function ByteCounter(options) {
6545
- Transform2.call(this, options);
6545
+ Transform.call(this, options);
6546
6546
  this.byteCount = 0;
6547
6547
  }
6548
6548
  ByteCounter.prototype._transform = function(chunk, encoding, cb) {
6549
6549
  this.byteCount += chunk.length;
6550
6550
  cb(null, chunk);
6551
6551
  };
6552
- util.inherits(Crc32Watcher, Transform2);
6552
+ util.inherits(Crc32Watcher, Transform);
6553
6553
  function Crc32Watcher(options) {
6554
- Transform2.call(this, options);
6554
+ Transform.call(this, options);
6555
6555
  this.crc32 = 0;
6556
6556
  }
6557
6557
  Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
@@ -7670,7 +7670,7 @@ var require_old = __commonJS({
7670
7670
  splitRootRe = /^[\/]*/;
7671
7671
  }
7672
7672
  var splitRootRe;
7673
- exports.realpathSync = function realpathSync(p, cache) {
7673
+ exports.realpathSync = function realpathSync2(p, cache) {
7674
7674
  p = pathModule.resolve(p);
7675
7675
  if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
7676
7676
  return cache[p];
@@ -7835,8 +7835,8 @@ var require_fs2 = __commonJS({
7835
7835
  "../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js"(exports, module2) {
7836
7836
  module2.exports = realpath;
7837
7837
  realpath.realpath = realpath;
7838
- realpath.sync = realpathSync;
7839
- realpath.realpathSync = realpathSync;
7838
+ realpath.sync = realpathSync2;
7839
+ realpath.realpathSync = realpathSync2;
7840
7840
  realpath.monkeypatch = monkeypatch;
7841
7841
  realpath.unmonkeypatch = unmonkeypatch;
7842
7842
  var fs11 = require("fs");
@@ -7864,7 +7864,7 @@ var require_fs2 = __commonJS({
7864
7864
  }
7865
7865
  });
7866
7866
  }
7867
- function realpathSync(p, cache) {
7867
+ function realpathSync2(p, cache) {
7868
7868
  if (ok) {
7869
7869
  return origRealpathSync(p, cache);
7870
7870
  }
@@ -7880,7 +7880,7 @@ var require_fs2 = __commonJS({
7880
7880
  }
7881
7881
  function monkeypatch() {
7882
7882
  fs11.realpath = realpath;
7883
- fs11.realpathSync = realpathSync;
7883
+ fs11.realpathSync = realpathSync2;
7884
7884
  }
7885
7885
  function unmonkeypatch() {
7886
7886
  fs11.realpath = origRealpath;
@@ -9849,12 +9849,12 @@ var require_isexe = __commonJS({
9849
9849
  if (typeof Promise !== "function") {
9850
9850
  throw new TypeError("callback not provided");
9851
9851
  }
9852
- return new Promise(function(resolve, reject) {
9852
+ return new Promise(function(resolve2, reject) {
9853
9853
  isexe(path8, options || {}, function(er, is) {
9854
9854
  if (er) {
9855
9855
  reject(er);
9856
9856
  } else {
9857
- resolve(is);
9857
+ resolve2(is);
9858
9858
  }
9859
9859
  });
9860
9860
  });
@@ -23415,7 +23415,7 @@ var require_dist2 = __commonJS({
23415
23415
  return x;
23416
23416
  } : _d;
23417
23417
  var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
23418
- var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
23418
+ var delimiter2 = "[" + escapeString(options.delimiter || "/#?") + "]";
23419
23419
  var route = start ? "^" : "";
23420
23420
  for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
23421
23421
  var token = tokens_1[_i];
@@ -23444,19 +23444,19 @@ var require_dist2 = __commonJS({
23444
23444
  }
23445
23445
  if (end) {
23446
23446
  if (!strict)
23447
- route += delimiter + "?";
23447
+ route += delimiter2 + "?";
23448
23448
  route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
23449
23449
  } else {
23450
23450
  var endToken = tokens[tokens.length - 1];
23451
- var isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : (
23451
+ var isEndDelimited = typeof endToken === "string" ? delimiter2.indexOf(endToken[endToken.length - 1]) > -1 : (
23452
23452
  // tslint:disable-next-line
23453
23453
  endToken === void 0
23454
23454
  );
23455
23455
  if (!strict) {
23456
- route += "(?:" + delimiter + "(?=" + endsWith + "))?";
23456
+ route += "(?:" + delimiter2 + "(?=" + endsWith + "))?";
23457
23457
  }
23458
23458
  if (!isEndDelimited) {
23459
- route += "(?=" + delimiter + "|" + endsWith + ")";
23459
+ route += "(?=" + delimiter2 + "|" + endsWith + ")";
23460
23460
  }
23461
23461
  }
23462
23462
  return new RegExp(route, flags(options));
@@ -23567,7 +23567,7 @@ var require_dist3 = __commonJS({
23567
23567
  options = {};
23568
23568
  }
23569
23569
  var tokens = lexer(str);
23570
- var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
23570
+ var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter2 = _b === void 0 ? "/#?" : _b;
23571
23571
  var result = [];
23572
23572
  var key = 0;
23573
23573
  var i = 0;
@@ -23592,7 +23592,7 @@ var require_dist3 = __commonJS({
23592
23592
  return result2;
23593
23593
  };
23594
23594
  var isSafe = function(value2) {
23595
- for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
23595
+ for (var _i = 0, delimiter_1 = delimiter2; _i < delimiter_1.length; _i++) {
23596
23596
  var char2 = delimiter_1[_i];
23597
23597
  if (value2.indexOf(char2) > -1)
23598
23598
  return true;
@@ -23606,8 +23606,8 @@ var require_dist3 = __commonJS({
23606
23606
  throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name, '"'));
23607
23607
  }
23608
23608
  if (!prevText || isSafe(prevText))
23609
- return "[^".concat(escapeString(delimiter), "]+?");
23610
- return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
23609
+ return "[^".concat(escapeString(delimiter2), "]+?");
23610
+ return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter2), "])+?");
23611
23611
  };
23612
23612
  while (i < tokens.length) {
23613
23613
  var char = tryConsume("CHAR");
@@ -23803,9 +23803,9 @@ var require_dist3 = __commonJS({
23803
23803
  }
23804
23804
  var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
23805
23805
  return x;
23806
- } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
23806
+ } : _d, _e = options.delimiter, delimiter2 = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
23807
23807
  var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
23808
- var delimiterRe = "[".concat(escapeString(delimiter), "]");
23808
+ var delimiterRe = "[".concat(escapeString(delimiter2), "]");
23809
23809
  var route = start ? "^" : "";
23810
23810
  for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
23811
23811
  var token = tokens_1[_i];
@@ -34387,6 +34387,7 @@ __export(src_exports, {
34387
34387
  getMaxDurationSchema: () => getMaxDurationSchema,
34388
34388
  getNodeBinPath: () => getNodeBinPath,
34389
34389
  getNodeBinPaths: () => getNodeBinPaths,
34390
+ getNodeExecPath: () => getNodeExecPath,
34390
34391
  getNodeVersion: () => getNodeVersion,
34391
34392
  getOrCreateBunBinary: () => getOrCreateBunBinary,
34392
34393
  getPackageJson: () => getPackageJson,
@@ -34494,7 +34495,7 @@ var FileBlob = class _FileBlob {
34494
34495
  (0, import_assert.default)(typeof mode === "number");
34495
34496
  (0, import_assert.default)(typeof stream.pipe === "function");
34496
34497
  const chunks = [];
34497
- await new Promise((resolve, reject) => {
34498
+ await new Promise((resolve2, reject) => {
34498
34499
  stream.on(
34499
34500
  "data",
34500
34501
  (chunk) => (
@@ -34506,7 +34507,7 @@ var FileBlob = class _FileBlob {
34506
34507
  )
34507
34508
  );
34508
34509
  stream.on("error", (error) => reject(error));
34509
- stream.on("end", () => resolve());
34510
+ stream.on("end", () => resolve2());
34510
34511
  });
34511
34512
  const data = Buffer.concat(chunks);
34512
34513
  return new _FileBlob({ mode, contentType, data });
@@ -34567,13 +34568,13 @@ var FileFsRef = class _FileFsRef {
34567
34568
  (0, import_assert2.default)(typeof stream.pipe === "function");
34568
34569
  (0, import_assert2.default)(typeof fsPath === "string");
34569
34570
  await import_fs_extra.default.mkdirp(import_path.default.dirname(fsPath));
34570
- await new Promise((resolve, reject) => {
34571
+ await new Promise((resolve2, reject) => {
34571
34572
  const dest = import_fs_extra.default.createWriteStream(fsPath, {
34572
34573
  mode: mode & 511
34573
34574
  });
34574
34575
  stream.pipe(dest);
34575
34576
  stream.on("error", reject);
34576
- dest.on("finish", resolve);
34577
+ dest.on("finish", resolve2);
34577
34578
  dest.on("error", reject);
34578
34579
  });
34579
34580
  return _FileFsRef.fromFsPath({ mode, contentType, fsPath });
@@ -34830,7 +34831,7 @@ var import_fs_extra2 = __toESM(require_lib());
34830
34831
  // src/fs/stream-to-buffer.ts
34831
34832
  var import_end_of_stream = __toESM(require_end_of_stream());
34832
34833
  function streamToBuffer(stream) {
34833
- return new Promise((resolve, reject) => {
34834
+ return new Promise((resolve2, reject) => {
34834
34835
  const buffers = [];
34835
34836
  stream.on("data", (chunk) => {
34836
34837
  const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
@@ -34844,13 +34845,13 @@ function streamToBuffer(stream) {
34844
34845
  try {
34845
34846
  switch (buffers.length) {
34846
34847
  case 0:
34847
- resolve(Buffer.allocUnsafe(0));
34848
+ resolve2(Buffer.allocUnsafe(0));
34848
34849
  break;
34849
34850
  case 1:
34850
- resolve(Buffer.from(buffers[0]));
34851
+ resolve2(Buffer.from(buffers[0]));
34851
34852
  break;
34852
34853
  default:
34853
- resolve(Buffer.concat(buffers));
34854
+ resolve2(Buffer.concat(buffers));
34854
34855
  }
34855
34856
  } catch (concatErr) {
34856
34857
  reject(concatErr);
@@ -35053,6 +35054,7 @@ var Lambda = class {
35053
35054
  runtime,
35054
35055
  runtimeLanguage,
35055
35056
  maxDuration,
35057
+ affinity,
35056
35058
  maxConcurrency,
35057
35059
  architecture,
35058
35060
  memory,
@@ -35106,6 +35108,12 @@ var Lambda = class {
35106
35108
  '"maxDuration" is not a number or "max"'
35107
35109
  );
35108
35110
  }
35111
+ if (affinity !== void 0) {
35112
+ (0, import_assert4.default)(
35113
+ typeof affinity === "object" && affinity !== null && affinity.mode === "strict" && Object.keys(affinity).length === 1,
35114
+ '"affinity" must be an object with only `mode: "strict"`'
35115
+ );
35116
+ }
35109
35117
  if (maxConcurrency !== void 0) {
35110
35118
  (0, import_assert4.default)(
35111
35119
  Number.isInteger(maxConcurrency) && maxConcurrency >= 1,
@@ -35247,6 +35255,7 @@ var Lambda = class {
35247
35255
  this.architecture = getDefaultLambdaArchitecture(architecture);
35248
35256
  this.memory = memory;
35249
35257
  this.maxDuration = maxDuration;
35258
+ this.affinity = affinity;
35250
35259
  this.maxConcurrency = maxConcurrency;
35251
35260
  this.environment = environment;
35252
35261
  this.allowQuery = allowQuery;
@@ -35305,7 +35314,7 @@ async function createZip(files) {
35305
35314
  }
35306
35315
  }
35307
35316
  const zipFile = new import_yazl.ZipFile();
35308
- const zipBuffer = await new Promise((resolve, reject) => {
35317
+ const zipBuffer = await new Promise((resolve2, reject) => {
35309
35318
  for (const name of names) {
35310
35319
  const file = files[name];
35311
35320
  const opts = { mode: file.mode, mtime };
@@ -35321,7 +35330,7 @@ async function createZip(files) {
35321
35330
  }
35322
35331
  }
35323
35332
  zipFile.end();
35324
- streamToBuffer(zipFile.outputStream).then(resolve).catch(reject);
35333
+ streamToBuffer(zipFile.outputStream).then(resolve2).catch(reject);
35325
35334
  });
35326
35335
  return zipBuffer;
35327
35336
  }
@@ -35356,6 +35365,7 @@ async function getLambdaOptionsFromFunction({
35356
35365
  architecture: fn.architecture,
35357
35366
  memory: fn.memory,
35358
35367
  maxDuration: fn.maxDuration,
35368
+ affinity: fn.affinity,
35359
35369
  maxConcurrency: fn.maxConcurrency,
35360
35370
  regions: fn.regions,
35361
35371
  functionFailoverRegions: fn.functionFailoverRegions,
@@ -35662,7 +35672,6 @@ var import_path6 = __toESM(require("path"));
35662
35672
  var import_async_sema4 = __toESM(require_async_sema());
35663
35673
  var import_cross_spawn = __toESM(require_cross_spawn());
35664
35674
  var import_semver2 = __toESM(require_semver2());
35665
- var import_stream2 = require("stream");
35666
35675
  var import_util6 = require("util");
35667
35676
 
35668
35677
  // src/fs/node-version.ts
@@ -36706,7 +36715,7 @@ var NO_OVERRIDE = {
36706
36715
  path: void 0
36707
36716
  };
36708
36717
  function spawnAsync(command, args, opts = {}) {
36709
- return new Promise((resolve, reject) => {
36718
+ return new Promise((resolve2, reject) => {
36710
36719
  const stderrLogs = [];
36711
36720
  const hasCustomStreams = opts.outputStream || opts.errorStream;
36712
36721
  if (hasCustomStreams) {
@@ -36728,7 +36737,7 @@ function spawnAsync(command, args, opts = {}) {
36728
36737
  child.on("error", reject);
36729
36738
  child.on("close", (code, signal) => {
36730
36739
  if (code === 0 || opts.ignoreNon0Exit) {
36731
- return resolve();
36740
+ return resolve2();
36732
36741
  }
36733
36742
  const cmd = opts.prettyCommand ? `Command "${opts.prettyCommand}"` : "Command";
36734
36743
  reject(
@@ -37204,29 +37213,6 @@ function getInstallCommandForPackageManager(packageManager, args) {
37204
37213
  };
37205
37214
  }
37206
37215
  }
37207
- function stripPnpmVersionFooter(line) {
37208
- return line.replace(/ using pnpm v\d+\.\d+\.\d+(?=\r?$)/, "");
37209
- }
37210
- function createPnpmOutputFilter(destination) {
37211
- let incompleteLine = "";
37212
- return new import_stream2.Transform({
37213
- transform(chunk, _encoding, callback) {
37214
- const lines = `${incompleteLine}${chunk.toString()}`.split("\n");
37215
- incompleteLine = lines.pop() ?? "";
37216
- for (const line of lines) {
37217
- destination.write(`${stripPnpmVersionFooter(line)}
37218
- `);
37219
- }
37220
- callback();
37221
- },
37222
- flush(callback) {
37223
- if (incompleteLine) {
37224
- destination.write(stripPnpmVersionFooter(incompleteLine));
37225
- }
37226
- callback();
37227
- }
37228
- });
37229
- }
37230
37216
  async function runInstallCommand({
37231
37217
  packageManager,
37232
37218
  args,
@@ -37238,9 +37224,8 @@ async function runInstallCommand({
37238
37224
  if (process.env.NPM_ONLY_PRODUCTION) {
37239
37225
  commandArguments.push("--production");
37240
37226
  }
37241
- const shouldFilterPnpmOutput = packageManager === "pnpm";
37242
- opts.outputStream = shouldFilterPnpmOutput ? createPnpmOutputFilter(output?.stdout ?? process.stdout) : output?.stdout;
37243
- opts.errorStream = shouldFilterPnpmOutput ? output?.stderr ?? process.stderr : output?.stderr;
37227
+ opts.outputStream = output?.stdout;
37228
+ opts.errorStream = output?.stderr;
37244
37229
  await spawnAsync(packageManager, commandArguments, opts);
37245
37230
  }
37246
37231
  function initializeSet(set) {
@@ -37323,6 +37308,12 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
37323
37308
  }
37324
37309
  }
37325
37310
  const installTime = Date.now();
37311
+ if (output?.stdout) {
37312
+ output.stdout.write("Installing dependencies...\n");
37313
+ } else {
37314
+ console.log("Installing dependencies...");
37315
+ }
37316
+ debug(`Installing to ${destPath}`);
37326
37317
  const opts = { cwd: destPath, ...spawnOpts };
37327
37318
  const env = cloneEnv(opts.env || process.env);
37328
37319
  delete env.NODE_ENV;
@@ -37336,20 +37327,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
37336
37327
  turboSupportsCorepackHome,
37337
37328
  projectCreatedAt
37338
37329
  });
37339
- const packageManager = getPackageManagerDisplayName({
37340
- cliType,
37341
- lockfileVersion,
37342
- packageJsonPackageManager,
37343
- env: opts.env
37344
- });
37345
- const installMessage = `Installing dependencies with ${packageManager}`;
37346
- if (output?.stdout) {
37347
- output.stdout.write(`${installMessage}
37348
- `);
37349
- } else {
37350
- console.log(installMessage);
37351
- }
37352
- debug(`Installing to ${destPath}`);
37353
37330
  const maySeeDynamicRequireYarnBug = process.env?.ENABLE_EXPERIMENTAL_COREPACK && packageJson?.packageManager?.startsWith("yarn") && packageJson?.type === "module";
37354
37331
  if (maySeeDynamicRequireYarnBug) {
37355
37332
  console.warn(
@@ -37368,37 +37345,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
37368
37345
  runNpmInstallSema.release();
37369
37346
  }
37370
37347
  }
37371
- function getPackageManagerDisplayName({
37372
- cliType,
37373
- lockfileVersion,
37374
- packageJsonPackageManager,
37375
- env
37376
- }) {
37377
- const versionResult = import_cross_spawn.default.sync(cliType, ["--version"], {
37378
- env,
37379
- encoding: "utf8"
37380
- });
37381
- const version = versionResult.status === 0 ? versionResult.stdout.trim() : "";
37382
- if (version) {
37383
- return `${cliType} ${version}`;
37384
- }
37385
- if (packageJsonPackageManager && env.ENABLE_EXPERIMENTAL_COREPACK) {
37386
- return packageJsonPackageManager.replace("@", " ");
37387
- }
37388
- if (cliType === "pnpm") {
37389
- const selectedPath = env.PATH?.split(import_path6.default.delimiter).find(
37390
- (segment) => /^\/pnpm\d+\/node_modules\/\.bin$/.test(segment)
37391
- );
37392
- const major = selectedPath?.match(/^\/pnpm(\d+)\//)?.[1];
37393
- if (major) {
37394
- return `pnpm ${major}`;
37395
- }
37396
- }
37397
- if (cliType === "yarn") {
37398
- return detectYarnVersion(lockfileVersion).replace("@", " ").replace(/\.x$/, "");
37399
- }
37400
- return cliType;
37401
- }
37402
37348
  function getEnvForPackageManager({
37403
37349
  cliType,
37404
37350
  lockfileVersion,
@@ -37457,6 +37403,44 @@ function getEnvForPackageManager({
37457
37403
  if (pathsToPrepend.length > 0) {
37458
37404
  const oldPath = env.PATH + "";
37459
37405
  newEnv.PATH = `${pathsToPrepend.join(import_path6.default.delimiter)}${oldPath ? import_path6.default.delimiter : ""}${oldPath}`;
37406
+ if (newPath && pathsToPrepend.includes(newPath) && detectedLockfile && detectedPackageManager) {
37407
+ const versionString = cliType === "pnpm" ? `version ${lockfileVersion} ` : "";
37408
+ const pin = resolveCompatiblePnpmPin({
37409
+ cliType,
37410
+ lockfileVersion,
37411
+ packageJsonDevEngines,
37412
+ corepackPackageManager: packageJsonPackageManager
37413
+ });
37414
+ const usedPin = Boolean(pin) && detectedPackageManager === pin?.override.detectedPackageManager;
37415
+ const lockfileDefault = detectPackageManager(
37416
+ cliType,
37417
+ lockfileVersion,
37418
+ projectCreatedAt,
37419
+ nodeVersion
37420
+ );
37421
+ const usedEnginesSelector = Boolean(packageJsonEngines?.pnpm) && !usedPin && detectedPackageManager !== lockfileDefault?.detectedPackageManager;
37422
+ const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
37423
+ if (usedPin && pin) {
37424
+ const pinField = pin.source === "devEngines" ? "package.json#devEngines.packageManager" : `package.json#packageManager ${packageJsonPackageManager}`;
37425
+ console.log(
37426
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from ${pinField}`
37427
+ );
37428
+ } else if (usedEnginesSelector) {
37429
+ console.log(
37430
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from package.json#engines.pnpm ${packageJsonEngines?.pnpm}`
37431
+ );
37432
+ } else if (detectedV9PnpmLockfile) {
37433
+ console.log(
37434
+ `Detected \`${detectedLockfile}\` ${lockfileVersion} which may be generated by pnpm@9.x, pnpm@10.x, or pnpm@11.x
37435
+ Using ${detectedPackageManager} based on project creation date
37436
+ To use a different version, set package.json#packageManager or package.json#devEngines.packageManager`
37437
+ );
37438
+ } else {
37439
+ console.log(
37440
+ `Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
37441
+ );
37442
+ }
37443
+ }
37460
37444
  }
37461
37445
  if (cliType === "yarn" && !env.YARN_NODE_LINKER) {
37462
37446
  newEnv.YARN_NODE_LINKER = "node-modules";
@@ -38002,10 +37986,10 @@ var import_os2 = require("os");
38002
37986
  var import_path7 = require("path");
38003
37987
  var import_child_process = require("child_process");
38004
37988
  function spawnAsync2(command, args, options) {
38005
- return new Promise((resolve, reject) => {
37989
+ return new Promise((resolve2, reject) => {
38006
37990
  const child = (0, import_child_process.spawn)(command, args, options);
38007
37991
  child.once("error", reject);
38008
- child.once("close", resolve);
37992
+ child.once("close", resolve2);
38009
37993
  });
38010
37994
  }
38011
37995
  async function getOrCreateBunBinary() {
@@ -38315,6 +38299,38 @@ async function linkOrCopy(srcFile, destFile) {
38315
38299
  }
38316
38300
  }
38317
38301
 
38302
+ // src/get-node-exec-path.ts
38303
+ var import_node_fs = require("fs");
38304
+ var import_node_path = require("path");
38305
+ var NODE_EXEC_PATH_ENV = "VERCEL_NODE_EXEC_PATH";
38306
+ var NATIVE_CLI_ENV = "VERCEL_VC_NATIVE";
38307
+ function getNodeExecPath() {
38308
+ const override = process.env[NODE_EXEC_PATH_ENV];
38309
+ if (override)
38310
+ return override;
38311
+ if (!process.env[NATIVE_CLI_ENV])
38312
+ return process.execPath;
38313
+ const nodeExecPath = findNodeExecPath();
38314
+ process.env[NODE_EXEC_PATH_ENV] = nodeExecPath;
38315
+ return nodeExecPath;
38316
+ }
38317
+ function findNodeExecPath() {
38318
+ const executableName = process.platform === "win32" ? "node.exe" : "node";
38319
+ const cliPath = (0, import_node_fs.realpathSync)(process.execPath);
38320
+ for (const directory of (process.env.PATH || "").split(import_node_path.delimiter)) {
38321
+ if (!directory)
38322
+ continue;
38323
+ const candidate = (0, import_node_path.resolve)(directory, executableName);
38324
+ try {
38325
+ (0, import_node_fs.accessSync)(candidate, import_node_fs.constants.X_OK);
38326
+ if ((0, import_node_fs.realpathSync)(candidate) !== cliPath)
38327
+ return candidate;
38328
+ } catch {
38329
+ }
38330
+ }
38331
+ throw new Error("Could not find the Node.js executable in PATH.");
38332
+ }
38333
+
38318
38334
  // src/validate-npmrc.ts
38319
38335
  var import_path10 = require("path");
38320
38336
  var import_promises = require("fs/promises");
@@ -38358,6 +38374,7 @@ var ContainerImage = class {
38358
38374
  this.architecture = params.architecture;
38359
38375
  this.memory = params.memory;
38360
38376
  this.maxDuration = params.maxDuration;
38377
+ this.affinity = params.affinity;
38361
38378
  this.maxConcurrency = params.maxConcurrency;
38362
38379
  this.regions = params.regions;
38363
38380
  this.functionFailoverRegions = params.functionFailoverRegions;
@@ -38509,6 +38526,17 @@ var getFunctionsSchema = () => ({
38509
38526
  maximum: 10240
38510
38527
  },
38511
38528
  maxDuration: getMaxDurationSchema(),
38529
+ affinity: {
38530
+ type: "object",
38531
+ additionalProperties: false,
38532
+ required: ["mode"],
38533
+ properties: {
38534
+ mode: {
38535
+ type: "string",
38536
+ const: "strict"
38537
+ }
38538
+ }
38539
+ },
38512
38540
  maxConcurrency: {
38513
38541
  type: "integer",
38514
38542
  minimum: 1
@@ -39412,8 +39440,8 @@ async function isPackageInstalled(packageName, path8) {
39412
39440
  var defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
39413
39441
 
39414
39442
  // src/generate-node-builder-functions.ts
39415
- var import_node_path = require("path");
39416
- var import_node_fs = __toESM(require("fs"));
39443
+ var import_node_path2 = require("path");
39444
+ var import_node_fs2 = __toESM(require("fs"));
39417
39445
  var import_node_module = require("module");
39418
39446
  function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild, opts) {
39419
39447
  const entrypointsForMessage = validFilenames.map((filename) => `- ${filename}.{${validExtensions.join(",")}}`).join("\n");
@@ -39485,9 +39513,9 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
39485
39513
  const {
39486
39514
  entrypoint: entrypointFromOutputDir,
39487
39515
  entrypointsNotMatchingRegex: entrypointsNotMatchingRegex2
39488
- } = findEntrypoint(await glob(entrypointGlob, (0, import_node_path.join)(args.workPath, dir)));
39516
+ } = findEntrypoint(await glob(entrypointGlob, (0, import_node_path2.join)(args.workPath, dir)));
39489
39517
  if (entrypointFromOutputDir) {
39490
- return (0, import_node_path.join)(dir, entrypointFromOutputDir);
39518
+ return (0, import_node_path2.join)(dir, entrypointFromOutputDir);
39491
39519
  }
39492
39520
  if (entrypointsNotMatchingRegex2.length > 0) {
39493
39521
  throw new Error(
@@ -39559,7 +39587,7 @@ ${entrypointsForMessage}`
39559
39587
  };
39560
39588
  };
39561
39589
  const checkMatchesRegex = (file) => {
39562
- const content = import_node_fs.default.readFileSync(file.fsPath, "utf-8");
39590
+ const content = import_node_fs2.default.readFileSync(file.fsPath, "utf-8");
39563
39591
  const matchesContent = content.match(regex);
39564
39592
  return matchesContent !== null;
39565
39593
  };
@@ -39567,7 +39595,7 @@ ${entrypointsForMessage}`
39567
39595
  const packageJson = files["package.json"];
39568
39596
  if (packageJson) {
39569
39597
  if (packageJson.type === "FileFsRef") {
39570
- const packageJsonContent = import_node_fs.default.readFileSync(packageJson.fsPath, "utf-8");
39598
+ const packageJsonContent = import_node_fs2.default.readFileSync(packageJson.fsPath, "utf-8");
39571
39599
  let packageJsonJson;
39572
39600
  try {
39573
39601
  packageJsonJson = JSON.parse(packageJsonContent);
@@ -39985,7 +40013,7 @@ function getLambdaSupportsStreaming(lambda, forceStreamingRuntime) {
39985
40013
  // src/fs/stream-to-digest-async.ts
39986
40014
  var import_crypto = require("crypto");
39987
40015
  async function streamToDigestAsync(stream) {
39988
- return await new Promise((resolve, reject) => {
40016
+ return await new Promise((resolve2, reject) => {
39989
40017
  stream.once("error", reject);
39990
40018
  let count = 0;
39991
40019
  const sha2562 = (0, import_crypto.createHash)("sha256");
@@ -39996,7 +40024,7 @@ async function streamToDigestAsync(stream) {
39996
40024
  md5: md52.digest("hex"),
39997
40025
  size: count
39998
40026
  };
39999
- resolve(res);
40027
+ resolve2(res);
40000
40028
  });
40001
40029
  stream.on("readable", () => {
40002
40030
  let chunk;
@@ -40217,11 +40245,11 @@ function getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse) {
40217
40245
  }
40218
40246
 
40219
40247
  // src/collect-build-result/stream-with-extended-payload.ts
40220
- var import_stream3 = require("stream");
40248
+ var import_stream2 = require("stream");
40221
40249
  function streamWithExtendedPayload(stream, data) {
40222
40250
  return data ? new MultipartContentStream(stream, data) : stream;
40223
40251
  }
40224
- var MultipartContentStream = class extends import_stream3.Readable {
40252
+ var MultipartContentStream = class extends import_stream2.Readable {
40225
40253
  constructor(stream, data) {
40226
40254
  super();
40227
40255
  stream.on("error", (err) => {
@@ -41010,6 +41038,7 @@ function getExtendedPayload({
41010
41038
  getMaxDurationSchema,
41011
41039
  getNodeBinPath,
41012
41040
  getNodeBinPaths,
41041
+ getNodeExecPath,
41013
41042
  getNodeVersion,
41014
41043
  getOrCreateBunBinary,
41015
41044
  getPackageJson,
package/dist/lambda.d.ts CHANGED
@@ -20,6 +20,9 @@ export declare function sanitizeConsumerName(functionPath: string): string;
20
20
  export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
21
21
  export type LambdaExecutableRuntimeLanguages = 'rust' | 'go';
22
22
  export type LambdaArchitecture = 'x86_64' | 'arm64';
23
+ export interface LambdaAffinity {
24
+ mode: 'strict';
25
+ }
23
26
  export interface LambdaOptionsBase {
24
27
  handler: string;
25
28
  runtime: string;
@@ -27,6 +30,7 @@ export interface LambdaOptionsBase {
27
30
  architecture?: LambdaArchitecture;
28
31
  memory?: number;
29
32
  maxDuration?: MaxDuration;
33
+ affinity?: LambdaAffinity;
30
34
  maxConcurrency?: number;
31
35
  environment?: Env;
32
36
  allowQuery?: string[];
@@ -103,6 +107,7 @@ export declare class Lambda {
103
107
  architecture: LambdaArchitecture;
104
108
  memory?: number;
105
109
  maxDuration?: MaxDuration;
110
+ affinity?: LambdaAffinity;
106
111
  /** Maximum number of requests that one function instance can process concurrently. */
107
112
  maxConcurrency?: number;
108
113
  environment: Env;
@@ -156,4 +161,4 @@ export declare class Lambda {
156
161
  */
157
162
  export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
158
163
  export declare function createZip(files: Files): Promise<Buffer>;
159
- export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'maxConcurrency' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
164
+ export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'affinity' | 'maxConcurrency' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
package/dist/lambda.js CHANGED
@@ -80,6 +80,7 @@ class Lambda {
80
80
  runtime,
81
81
  runtimeLanguage,
82
82
  maxDuration,
83
+ affinity,
83
84
  maxConcurrency,
84
85
  architecture,
85
86
  memory,
@@ -133,6 +134,12 @@ class Lambda {
133
134
  '"maxDuration" is not a number or "max"'
134
135
  );
135
136
  }
137
+ if (affinity !== void 0) {
138
+ (0, import_assert.default)(
139
+ typeof affinity === "object" && affinity !== null && affinity.mode === "strict" && Object.keys(affinity).length === 1,
140
+ '"affinity" must be an object with only `mode: "strict"`'
141
+ );
142
+ }
136
143
  if (maxConcurrency !== void 0) {
137
144
  (0, import_assert.default)(
138
145
  Number.isInteger(maxConcurrency) && maxConcurrency >= 1,
@@ -274,6 +281,7 @@ class Lambda {
274
281
  this.architecture = getDefaultLambdaArchitecture(architecture);
275
282
  this.memory = memory;
276
283
  this.maxDuration = maxDuration;
284
+ this.affinity = affinity;
277
285
  this.maxConcurrency = maxConcurrency;
278
286
  this.environment = environment;
279
287
  this.allowQuery = allowQuery;
@@ -383,6 +391,7 @@ async function getLambdaOptionsFromFunction({
383
391
  architecture: fn.architecture,
384
392
  memory: fn.memory,
385
393
  maxDuration: fn.maxDuration,
394
+ affinity: fn.affinity,
386
395
  maxConcurrency: fn.maxConcurrency,
387
396
  regions: fn.regions,
388
397
  functionFailoverRegions: fn.functionFailoverRegions,
package/dist/schemas.d.ts CHANGED
@@ -31,6 +31,17 @@ export declare const getFunctionsSchema: () => {
31
31
  enum: string[];
32
32
  })[];
33
33
  };
34
+ affinity: {
35
+ type: string;
36
+ additionalProperties: boolean;
37
+ required: string[];
38
+ properties: {
39
+ mode: {
40
+ type: string;
41
+ const: string;
42
+ };
43
+ };
44
+ };
34
45
  maxConcurrency: {
35
46
  type: string;
36
47
  minimum: number;
@@ -137,6 +148,17 @@ export declare const functionsSchema: {
137
148
  enum: string[];
138
149
  })[];
139
150
  };
151
+ affinity: {
152
+ type: string;
153
+ additionalProperties: boolean;
154
+ required: string[];
155
+ properties: {
156
+ mode: {
157
+ type: string;
158
+ const: string;
159
+ };
160
+ };
161
+ };
140
162
  maxConcurrency: {
141
163
  type: string;
142
164
  minimum: number;
package/dist/schemas.js CHANGED
@@ -117,6 +117,17 @@ const getFunctionsSchema = () => ({
117
117
  maximum: 10240
118
118
  },
119
119
  maxDuration: (0, import_max_duration.getMaxDurationSchema)(),
120
+ affinity: {
121
+ type: "object",
122
+ additionalProperties: false,
123
+ required: ["mode"],
124
+ properties: {
125
+ mode: {
126
+ type: "string",
127
+ const: "strict"
128
+ }
129
+ }
130
+ },
120
131
  maxConcurrency: {
121
132
  type: "integer",
122
133
  minimum: 1
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type FileRef from './file-ref';
2
2
  import type FileFsRef from './file-fs-ref';
3
3
  import type FileBlob from './file-blob';
4
- import type { Lambda, LambdaArchitecture } from './lambda';
4
+ import type { Lambda, LambdaAffinity, LambdaArchitecture } from './lambda';
5
5
  import type { Prerender } from './prerender';
6
6
  import type { EdgeFunction } from './edge-function';
7
7
  import type { ContainerImage } from './container-image';
@@ -415,6 +415,7 @@ export interface BuilderFunctions {
415
415
  architecture?: LambdaArchitecture;
416
416
  memory?: number;
417
417
  maxDuration?: MaxDuration;
418
+ affinity?: LambdaAffinity;
418
419
  maxConcurrency?: number;
419
420
  regions?: string[];
420
421
  functionFailoverRegions?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.5.0",
3
+ "version": "14.6.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -52,8 +52,8 @@
52
52
  "vitest": "4.1.10",
53
53
  "typescript": "4.9.5",
54
54
  "yazl": "2.5.1",
55
- "@vercel/error-utils": "2.2.1",
56
- "@vercel/routing-utils": "6.5.0"
55
+ "@vercel/routing-utils": "6.5.0",
56
+ "@vercel/error-utils": "2.2.1"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "node build.mjs",