@vercel/build-utils 5.1.0 → 5.3.0
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/node-version.js +1 -1
- package/dist/get-prefixed-env-vars.d.ts +14 -0
- package/dist/get-prefixed-env-vars.js +28 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +45 -3
- package/dist/lambda.d.ts +2 -0
- package/dist/lambda.js +5 -1
- package/package.json +3 -4
package/dist/fs/node-version.js
CHANGED
@@ -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
|
-
|
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
@@ -30666,7 +30666,7 @@ const allOptions = [
|
|
30666
30666
|
major: 12,
|
30667
30667
|
range: '12.x',
|
30668
30668
|
runtime: 'nodejs12.x',
|
30669
|
-
discontinueDate: new Date('2022-
|
30669
|
+
discontinueDate: new Date('2022-10-01'),
|
30670
30670
|
},
|
30671
30671
|
{
|
30672
30672
|
major: 10,
|
@@ -31429,6 +31429,42 @@ const getPlatformEnv = (name) => {
|
|
31429
31429
|
exports.getPlatformEnv = getPlatformEnv;
|
31430
31430
|
|
31431
31431
|
|
31432
|
+
/***/ }),
|
31433
|
+
|
31434
|
+
/***/ 6838:
|
31435
|
+
/***/ ((__unused_webpack_module, exports) => {
|
31436
|
+
|
31437
|
+
"use strict";
|
31438
|
+
|
31439
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
31440
|
+
exports.getPrefixedEnvVars = void 0;
|
31441
|
+
/**
|
31442
|
+
* Get the framework-specific prefixed System Environment Variables.
|
31443
|
+
* See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
|
31444
|
+
* @param envPrefix - Prefix, typically from `@vercel/frameworks`
|
31445
|
+
* @param envs - Environment Variables, typically from `process.env`
|
31446
|
+
*/
|
31447
|
+
function getPrefixedEnvVars({ envPrefix, envs, }) {
|
31448
|
+
const vercelSystemEnvPrefix = 'VERCEL_';
|
31449
|
+
const newEnvs = {};
|
31450
|
+
if (envPrefix && envs.VERCEL_URL) {
|
31451
|
+
Object.keys(envs)
|
31452
|
+
.filter(key => key.startsWith(vercelSystemEnvPrefix))
|
31453
|
+
.forEach(key => {
|
31454
|
+
const newKey = `${envPrefix}${key}`;
|
31455
|
+
if (!(newKey in envs)) {
|
31456
|
+
newEnvs[newKey] = envs[key];
|
31457
|
+
}
|
31458
|
+
});
|
31459
|
+
// Tell turbo to exclude all Vercel System Env Vars
|
31460
|
+
// See https://github.com/vercel/turborepo/pull/1622
|
31461
|
+
newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
|
31462
|
+
}
|
31463
|
+
return newEnvs;
|
31464
|
+
}
|
31465
|
+
exports.getPrefixedEnvVars = getPrefixedEnvVars;
|
31466
|
+
|
31467
|
+
|
31432
31468
|
/***/ }),
|
31433
31469
|
|
31434
31470
|
/***/ 2855:
|
@@ -31462,7 +31498,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31462
31498
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
31463
31499
|
};
|
31464
31500
|
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;
|
31501
|
+
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
31502
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
31467
31503
|
exports.FileBlob = file_blob_1.default;
|
31468
31504
|
const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
|
@@ -31517,6 +31553,8 @@ const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
|
|
31517
31553
|
exports.getIgnoreFilter = get_ignore_filter_1.default;
|
31518
31554
|
const get_platform_env_1 = __webpack_require__(4678);
|
31519
31555
|
Object.defineProperty(exports, "getPlatformEnv", ({ enumerable: true, get: function () { return get_platform_env_1.getPlatformEnv; } }));
|
31556
|
+
const get_prefixed_env_vars_1 = __webpack_require__(6838);
|
31557
|
+
Object.defineProperty(exports, "getPrefixedEnvVars", ({ enumerable: true, get: function () { return get_prefixed_env_vars_1.getPrefixedEnvVars; } }));
|
31520
31558
|
var edge_function_1 = __webpack_require__(8038);
|
31521
31559
|
Object.defineProperty(exports, "EdgeFunction", ({ enumerable: true, get: function () { return edge_function_1.EdgeFunction; } }));
|
31522
31560
|
var read_config_file_1 = __webpack_require__(7792);
|
@@ -31550,7 +31588,7 @@ const download_1 = __webpack_require__(1611);
|
|
31550
31588
|
const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
|
31551
31589
|
class Lambda {
|
31552
31590
|
constructor(opts) {
|
31553
|
-
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
|
31591
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, } = opts;
|
31554
31592
|
if ('files' in opts) {
|
31555
31593
|
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
31556
31594
|
}
|
@@ -31573,6 +31611,9 @@ class Lambda {
|
|
31573
31611
|
if (supportsMultiPayloads !== undefined) {
|
31574
31612
|
assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
|
31575
31613
|
}
|
31614
|
+
if (supportsWrapper !== undefined) {
|
31615
|
+
assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
|
31616
|
+
}
|
31576
31617
|
if (regions !== undefined) {
|
31577
31618
|
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
31578
31619
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
@@ -31588,6 +31629,7 @@ class Lambda {
|
|
31588
31629
|
this.regions = regions;
|
31589
31630
|
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
31590
31631
|
this.supportsMultiPayloads = supportsMultiPayloads;
|
31632
|
+
this.supportsWrapper = supportsWrapper;
|
31591
31633
|
}
|
31592
31634
|
async createZip() {
|
31593
31635
|
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.3.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -14,8 +14,7 @@
|
|
14
14
|
"build": "node build",
|
15
15
|
"test": "jest --env node --verbose --runInBand --bail",
|
16
16
|
"test-unit": "yarn test test/unit.*test.*",
|
17
|
-
"test-integration-once": "yarn test test/integration.test.ts"
|
18
|
-
"prepublishOnly": "node build"
|
17
|
+
"test-integration-once": "yarn test test/integration.test.ts"
|
19
18
|
},
|
20
19
|
"devDependencies": {
|
21
20
|
"@iarna/toml": "2.2.3",
|
@@ -48,5 +47,5 @@
|
|
48
47
|
"typescript": "4.3.4",
|
49
48
|
"yazl": "2.5.1"
|
50
49
|
},
|
51
|
-
"gitHead": "
|
50
|
+
"gitHead": "47e3381c6df661168e8be335cc58df03f3cf2414"
|
52
51
|
}
|