@vercel/build-utils 5.2.0 → 5.3.2

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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "5.2.0",
3
+ "version": "5.3.2",
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": "32afd67d29d46f67027091ab9695d8ff330355b5"
50
+ "gitHead": "6700630feb23bdb4e94ea727911a9e10aa546361"
51
51
  }