@vercel/build-utils 5.1.1 → 5.3.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/dist/fs/glob.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  import vanillaGlob_ from 'glob';
2
2
  import FileFsRef from '../file-fs-ref';
3
3
  export declare type GlobOptions = vanillaGlob_.IOptions;
4
- interface FsFiles {
5
- [filePath: string]: FileFsRef;
6
- }
7
- export default function glob(pattern: string, opts: GlobOptions | string, mountpoint?: string): Promise<FsFiles>;
8
- export {};
4
+ export default function glob(pattern: string, opts: GlobOptions | string, mountpoint?: string): Promise<Record<string, FileFsRef>>;
package/dist/fs/glob.js CHANGED
@@ -26,14 +26,15 @@ async function glob(pattern, opts, mountpoint) {
26
26
  throw new Error(`basePath/cwd must be an absolute path (${options.cwd})`);
27
27
  }
28
28
  const results = {};
29
+ const statCache = {};
29
30
  options.symlinks = {};
30
- options.statCache = {};
31
+ options.statCache = statCache;
31
32
  options.stat = true;
32
33
  options.dot = true;
33
34
  const files = await vanillaGlob(pattern, options);
34
35
  for (const relativePath of files) {
35
36
  const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
36
- let stat = options.statCache[fsPath];
37
+ let stat = statCache[fsPath];
37
38
  assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
38
39
  const isSymlink = options.symlinks[fsPath];
39
40
  if (isSymlink || stat.isFile()) {
@@ -14,7 +14,7 @@ const allOptions = [
14
14
  major: 12,
15
15
  range: '12.x',
16
16
  runtime: 'nodejs12.x',
17
- discontinueDate: new Date('2022-08-09'),
17
+ discontinueDate: new Date('2022-10-01'),
18
18
  },
19
19
  {
20
20
  major: 10,
@@ -0,0 +1,14 @@
1
+ declare type Envs = {
2
+ [key: string]: string | undefined;
3
+ };
4
+ /**
5
+ * Get the framework-specific prefixed System Environment Variables.
6
+ * See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
7
+ * @param envPrefix - Prefix, typically from `@vercel/frameworks`
8
+ * @param envs - Environment Variables, typically from `process.env`
9
+ */
10
+ export declare function getPrefixedEnvVars({ envPrefix, envs, }: {
11
+ envPrefix: string | undefined;
12
+ envs: Envs;
13
+ }): Envs;
14
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPrefixedEnvVars = void 0;
4
+ /**
5
+ * Get the framework-specific prefixed System Environment Variables.
6
+ * See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
7
+ * @param envPrefix - Prefix, typically from `@vercel/frameworks`
8
+ * @param envs - Environment Variables, typically from `process.env`
9
+ */
10
+ function getPrefixedEnvVars({ envPrefix, envs, }) {
11
+ const vercelSystemEnvPrefix = 'VERCEL_';
12
+ const newEnvs = {};
13
+ if (envPrefix && envs.VERCEL_URL) {
14
+ Object.keys(envs)
15
+ .filter(key => key.startsWith(vercelSystemEnvPrefix))
16
+ .forEach(key => {
17
+ const newKey = `${envPrefix}${key}`;
18
+ if (!(newKey in envs)) {
19
+ newEnvs[newKey] = envs[key];
20
+ }
21
+ });
22
+ // Tell turbo to exclude all Vercel System Env Vars
23
+ // See https://github.com/vercel/turborepo/pull/1622
24
+ newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
25
+ }
26
+ return newEnvs;
27
+ }
28
+ exports.getPrefixedEnvVars = getPrefixedEnvVars;
package/dist/index.d.ts CHANGED
@@ -14,7 +14,8 @@ import streamToBuffer from './fs/stream-to-buffer';
14
14
  import debug from './debug';
15
15
  import getIgnoreFilter from './get-ignore-filter';
16
16
  import { getPlatformEnv } from './get-platform-env';
17
- export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
17
+ import { getPrefixedEnvVars } from './get-prefixed-env-vars';
18
+ export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
18
19
  export { EdgeFunction } from './edge-function';
19
20
  export { readConfigFile } from './fs/read-config-file';
20
21
  export { normalizePath } from './fs/normalize-path';
package/dist/index.js CHANGED
@@ -30618,14 +30618,15 @@ async function glob(pattern, opts, mountpoint) {
30618
30618
  throw new Error(`basePath/cwd must be an absolute path (${options.cwd})`);
30619
30619
  }
30620
30620
  const results = {};
30621
+ const statCache = {};
30621
30622
  options.symlinks = {};
30622
- options.statCache = {};
30623
+ options.statCache = statCache;
30623
30624
  options.stat = true;
30624
30625
  options.dot = true;
30625
30626
  const files = await vanillaGlob(pattern, options);
30626
30627
  for (const relativePath of files) {
30627
30628
  const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
30628
- let stat = options.statCache[fsPath];
30629
+ let stat = statCache[fsPath];
30629
30630
  assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
30630
30631
  const isSymlink = options.symlinks[fsPath];
30631
30632
  if (isSymlink || stat.isFile()) {
@@ -30666,7 +30667,7 @@ const allOptions = [
30666
30667
  major: 12,
30667
30668
  range: '12.x',
30668
30669
  runtime: 'nodejs12.x',
30669
- discontinueDate: new Date('2022-08-09'),
30670
+ discontinueDate: new Date('2022-10-01'),
30670
30671
  },
30671
30672
  {
30672
30673
  major: 10,
@@ -31429,6 +31430,42 @@ const getPlatformEnv = (name) => {
31429
31430
  exports.getPlatformEnv = getPlatformEnv;
31430
31431
 
31431
31432
 
31433
+ /***/ }),
31434
+
31435
+ /***/ 6838:
31436
+ /***/ ((__unused_webpack_module, exports) => {
31437
+
31438
+ "use strict";
31439
+
31440
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
31441
+ exports.getPrefixedEnvVars = void 0;
31442
+ /**
31443
+ * Get the framework-specific prefixed System Environment Variables.
31444
+ * See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
31445
+ * @param envPrefix - Prefix, typically from `@vercel/frameworks`
31446
+ * @param envs - Environment Variables, typically from `process.env`
31447
+ */
31448
+ function getPrefixedEnvVars({ envPrefix, envs, }) {
31449
+ const vercelSystemEnvPrefix = 'VERCEL_';
31450
+ const newEnvs = {};
31451
+ if (envPrefix && envs.VERCEL_URL) {
31452
+ Object.keys(envs)
31453
+ .filter(key => key.startsWith(vercelSystemEnvPrefix))
31454
+ .forEach(key => {
31455
+ const newKey = `${envPrefix}${key}`;
31456
+ if (!(newKey in envs)) {
31457
+ newEnvs[newKey] = envs[key];
31458
+ }
31459
+ });
31460
+ // Tell turbo to exclude all Vercel System Env Vars
31461
+ // See https://github.com/vercel/turborepo/pull/1622
31462
+ newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
31463
+ }
31464
+ return newEnvs;
31465
+ }
31466
+ exports.getPrefixedEnvVars = getPrefixedEnvVars;
31467
+
31468
+
31432
31469
  /***/ }),
31433
31470
 
31434
31471
  /***/ 2855:
@@ -31462,7 +31499,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31462
31499
  return (mod && mod.__esModule) ? mod : { "default": mod };
31463
31500
  };
31464
31501
  Object.defineProperty(exports, "__esModule", ({ value: true }));
31465
- exports.normalizePath = exports.readConfigFile = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.downloadFile = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
31502
+ exports.normalizePath = exports.readConfigFile = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPrefixedEnvVars = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.downloadFile = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
31466
31503
  const file_blob_1 = __importDefault(__webpack_require__(2397));
31467
31504
  exports.FileBlob = file_blob_1.default;
31468
31505
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -31517,6 +31554,8 @@ const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
31517
31554
  exports.getIgnoreFilter = get_ignore_filter_1.default;
31518
31555
  const get_platform_env_1 = __webpack_require__(4678);
31519
31556
  Object.defineProperty(exports, "getPlatformEnv", ({ enumerable: true, get: function () { return get_platform_env_1.getPlatformEnv; } }));
31557
+ const get_prefixed_env_vars_1 = __webpack_require__(6838);
31558
+ Object.defineProperty(exports, "getPrefixedEnvVars", ({ enumerable: true, get: function () { return get_prefixed_env_vars_1.getPrefixedEnvVars; } }));
31520
31559
  var edge_function_1 = __webpack_require__(8038);
31521
31560
  Object.defineProperty(exports, "EdgeFunction", ({ enumerable: true, get: function () { return edge_function_1.EdgeFunction; } }));
31522
31561
  var read_config_file_1 = __webpack_require__(7792);
@@ -31550,7 +31589,7 @@ const download_1 = __webpack_require__(1611);
31550
31589
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
31551
31590
  class Lambda {
31552
31591
  constructor(opts) {
31553
- const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
31592
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, } = opts;
31554
31593
  if ('files' in opts) {
31555
31594
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
31556
31595
  }
@@ -31573,6 +31612,9 @@ class Lambda {
31573
31612
  if (supportsMultiPayloads !== undefined) {
31574
31613
  assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
31575
31614
  }
31615
+ if (supportsWrapper !== undefined) {
31616
+ assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
31617
+ }
31576
31618
  if (regions !== undefined) {
31577
31619
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
31578
31620
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
@@ -31588,6 +31630,7 @@ class Lambda {
31588
31630
  this.regions = regions;
31589
31631
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
31590
31632
  this.supportsMultiPayloads = supportsMultiPayloads;
31633
+ this.supportsWrapper = supportsWrapper;
31591
31634
  }
31592
31635
  async createZip() {
31593
31636
  let { zipBuffer } = this;
package/dist/lambda.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface LambdaOptionsBase {
13
13
  allowQuery?: string[];
14
14
  regions?: string[];
15
15
  supportsMultiPayloads?: boolean;
16
+ supportsWrapper?: boolean;
16
17
  }
17
18
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
18
19
  files: Files;
@@ -45,6 +46,7 @@ export declare class Lambda {
45
46
  */
46
47
  zipBuffer?: Buffer;
47
48
  supportsMultiPayloads?: boolean;
49
+ supportsWrapper?: boolean;
48
50
  constructor(opts: LambdaOptions);
49
51
  createZip(): Promise<Buffer>;
50
52
  }
package/dist/lambda.js CHANGED
@@ -13,7 +13,7 @@ const download_1 = require("./fs/download");
13
13
  const stream_to_buffer_1 = __importDefault(require("./fs/stream-to-buffer"));
14
14
  class Lambda {
15
15
  constructor(opts) {
16
- const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
16
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, } = opts;
17
17
  if ('files' in opts) {
18
18
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
19
19
  }
@@ -36,6 +36,9 @@ class Lambda {
36
36
  if (supportsMultiPayloads !== undefined) {
37
37
  assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
38
38
  }
39
+ if (supportsWrapper !== undefined) {
40
+ assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
41
+ }
39
42
  if (regions !== undefined) {
40
43
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
41
44
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
@@ -51,6 +54,7 @@ class Lambda {
51
54
  this.regions = regions;
52
55
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
53
56
  this.supportsMultiPayloads = supportsMultiPayloads;
57
+ this.supportsWrapper = supportsWrapper;
54
58
  }
55
59
  async createZip() {
56
60
  let { zipBuffer } = this;
package/dist/types.d.ts CHANGED
@@ -297,6 +297,7 @@ export interface ProjectSettings {
297
297
  directoryListing?: boolean;
298
298
  gitForkProtection?: boolean;
299
299
  commandForIgnoringBuildStep?: string | null;
300
+ skipGitConnectDuringLink?: boolean;
300
301
  }
301
302
  export interface BuilderV2 {
302
303
  version: 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "5.1.1",
3
+ "version": "5.3.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -47,5 +47,5 @@
47
47
  "typescript": "4.3.4",
48
48
  "yazl": "2.5.1"
49
49
  },
50
- "gitHead": "5eb8b16cbdf6215618b4b8125673941757fa1a8e"
50
+ "gitHead": "b52d01f809b80734ed1ab61df82f299f11a04720"
51
51
  }