@vercel/build-utils 2.12.3-canary.9 → 2.13.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/convert-runtime-to-plugin.d.ts +65 -0
- package/dist/convert-runtime-to-plugin.js +298 -0
- package/dist/detect-builders.d.ts +8 -9
- package/dist/detect-builders.js +58 -5
- package/dist/detect-file-system-api.d.ts +34 -0
- package/dist/detect-file-system-api.js +173 -0
- package/dist/fs/glob.js +2 -1
- package/dist/fs/normalize-path.d.ts +4 -0
- package/dist/fs/normalize-path.js +11 -0
- package/dist/get-ignore-filter.d.ts +1 -0
- package/dist/get-ignore-filter.js +59 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2319 -912
- package/dist/lambda.d.ts +7 -3
- package/dist/lambda.js +14 -4
- package/dist/types.d.ts +18 -2
- package/package.json +6 -6
package/dist/lambda.d.ts
CHANGED
@@ -11,6 +11,7 @@ interface LambdaOptions {
|
|
11
11
|
maxDuration?: number;
|
12
12
|
environment: Environment;
|
13
13
|
allowQuery?: string[];
|
14
|
+
regions?: string[];
|
14
15
|
}
|
15
16
|
interface CreateLambdaOptions {
|
16
17
|
files: Files;
|
@@ -20,11 +21,13 @@ interface CreateLambdaOptions {
|
|
20
21
|
maxDuration?: number;
|
21
22
|
environment?: Environment;
|
22
23
|
allowQuery?: string[];
|
24
|
+
regions?: string[];
|
23
25
|
}
|
24
26
|
interface GetLambdaOptionsFromFunctionOptions {
|
25
27
|
sourceFile: string;
|
26
|
-
config?: Config
|
28
|
+
config?: Pick<Config, 'functions'>;
|
27
29
|
}
|
30
|
+
export declare const FILES_SYMBOL: unique symbol;
|
28
31
|
export declare class Lambda {
|
29
32
|
type: 'Lambda';
|
30
33
|
zipBuffer: Buffer;
|
@@ -34,9 +37,10 @@ export declare class Lambda {
|
|
34
37
|
maxDuration?: number;
|
35
38
|
environment: Environment;
|
36
39
|
allowQuery?: string[];
|
37
|
-
|
40
|
+
regions?: string[];
|
41
|
+
constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }: LambdaOptions);
|
38
42
|
}
|
39
|
-
export declare function createLambda({ files, handler, runtime, memory, maxDuration, environment, allowQuery, }: CreateLambdaOptions): Promise<Lambda>;
|
43
|
+
export declare function createLambda({ files, handler, runtime, memory, maxDuration, environment, allowQuery, regions, }: CreateLambdaOptions): Promise<Lambda>;
|
40
44
|
export declare function createZip(files: Files): Promise<Buffer>;
|
41
45
|
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
|
42
46
|
export {};
|
package/dist/lambda.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = void 0;
|
6
|
+
exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = exports.FILES_SYMBOL = void 0;
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
8
8
|
const async_sema_1 = __importDefault(require("async-sema"));
|
9
9
|
const yazl_1 = require("yazl");
|
@@ -11,8 +11,9 @@ const minimatch_1 = __importDefault(require("minimatch"));
|
|
11
11
|
const fs_extra_1 = require("fs-extra");
|
12
12
|
const download_1 = require("./fs/download");
|
13
13
|
const stream_to_buffer_1 = __importDefault(require("./fs/stream-to-buffer"));
|
14
|
+
exports.FILES_SYMBOL = Symbol('files');
|
14
15
|
class Lambda {
|
15
|
-
constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, }) {
|
16
|
+
constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }) {
|
16
17
|
this.type = 'Lambda';
|
17
18
|
this.zipBuffer = zipBuffer;
|
18
19
|
this.handler = handler;
|
@@ -21,12 +22,13 @@ class Lambda {
|
|
21
22
|
this.maxDuration = maxDuration;
|
22
23
|
this.environment = environment;
|
23
24
|
this.allowQuery = allowQuery;
|
25
|
+
this.regions = regions;
|
24
26
|
}
|
25
27
|
}
|
26
28
|
exports.Lambda = Lambda;
|
27
29
|
const sema = new async_sema_1.default(10);
|
28
30
|
const mtime = new Date(1540000000000);
|
29
|
-
async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, }) {
|
31
|
+
async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, regions, }) {
|
30
32
|
assert_1.default(typeof files === 'object', '"files" must be an object');
|
31
33
|
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
32
34
|
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
@@ -41,17 +43,25 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
|
|
41
43
|
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
42
44
|
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
43
45
|
}
|
46
|
+
if (regions !== undefined) {
|
47
|
+
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
48
|
+
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
49
|
+
}
|
44
50
|
await sema.acquire();
|
45
51
|
try {
|
46
52
|
const zipBuffer = await createZip(files);
|
47
|
-
|
53
|
+
const lambda = new Lambda({
|
48
54
|
zipBuffer,
|
49
55
|
handler,
|
50
56
|
runtime,
|
51
57
|
memory,
|
52
58
|
maxDuration,
|
53
59
|
environment,
|
60
|
+
regions,
|
54
61
|
});
|
62
|
+
// @ts-ignore This symbol is a private API
|
63
|
+
lambda[exports.FILES_SYMBOL] = files;
|
64
|
+
return lambda;
|
55
65
|
}
|
56
66
|
finally {
|
57
67
|
sema.release();
|
package/dist/types.d.ts
CHANGED
@@ -9,6 +9,7 @@ export interface File {
|
|
9
9
|
mode: number;
|
10
10
|
contentType?: string;
|
11
11
|
toStream: () => NodeJS.ReadableStream;
|
12
|
+
toStreamAsync?: () => Promise<NodeJS.ReadableStream>;
|
12
13
|
/**
|
13
14
|
* The absolute path to the file in the filesystem
|
14
15
|
*/
|
@@ -20,7 +21,7 @@ export interface Files {
|
|
20
21
|
export interface Config {
|
21
22
|
[key: string]: string | string[] | boolean | number | {
|
22
23
|
[key: string]: string;
|
23
|
-
} | BuilderFunctions | undefined;
|
24
|
+
} | BuilderFunctions | ProjectSettings | undefined | null;
|
24
25
|
maxLambdaSize?: string;
|
25
26
|
includeFiles?: string | string[];
|
26
27
|
excludeFiles?: string | string[];
|
@@ -34,11 +35,12 @@ export interface Config {
|
|
34
35
|
[key: string]: string;
|
35
36
|
};
|
36
37
|
functions?: BuilderFunctions;
|
38
|
+
projectSettings?: ProjectSettings;
|
37
39
|
outputDirectory?: string;
|
38
40
|
installCommand?: string;
|
39
41
|
buildCommand?: string;
|
40
42
|
devCommand?: string;
|
41
|
-
framework?: string;
|
43
|
+
framework?: string | null;
|
42
44
|
nodeVersion?: string;
|
43
45
|
}
|
44
46
|
export interface Meta {
|
@@ -50,6 +52,7 @@ export interface Meta {
|
|
50
52
|
filesRemoved?: string[];
|
51
53
|
env?: Env;
|
52
54
|
buildEnv?: Env;
|
55
|
+
avoidTopLevelInstall?: boolean;
|
53
56
|
}
|
54
57
|
export interface AnalyzeOptions {
|
55
58
|
/**
|
@@ -303,3 +306,16 @@ export interface BuilderFunctions {
|
|
303
306
|
excludeFiles?: string;
|
304
307
|
};
|
305
308
|
}
|
309
|
+
export interface ProjectSettings {
|
310
|
+
framework?: string | null;
|
311
|
+
devCommand?: string | null;
|
312
|
+
installCommand?: string | null;
|
313
|
+
buildCommand?: string | null;
|
314
|
+
outputDirectory?: string | null;
|
315
|
+
rootDirectory?: string | null;
|
316
|
+
createdAt?: number;
|
317
|
+
autoExposeSystemEnvs?: boolean;
|
318
|
+
sourceFilesOutsideRootDirectory?: boolean;
|
319
|
+
directoryListing?: boolean;
|
320
|
+
gitForkProtection?: boolean;
|
321
|
+
}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.13.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
7
|
-
"homepage": "https://github.com/vercel/vercel/blob/
|
7
|
+
"homepage": "https://github.com/vercel/vercel/blob/main/DEVELOPING_A_RUNTIME.md",
|
8
8
|
"repository": {
|
9
9
|
"type": "git",
|
10
10
|
"url": "https://github.com/vercel/vercel.git",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"@types/async-retry": "^1.2.1",
|
22
22
|
"@types/cross-spawn": "6.0.0",
|
23
23
|
"@types/end-of-stream": "^1.4.0",
|
24
|
-
"@types/fs-extra": "
|
24
|
+
"@types/fs-extra": "9.0.13",
|
25
25
|
"@types/glob": "^7.1.1",
|
26
26
|
"@types/jest": "27.0.1",
|
27
27
|
"@types/js-yaml": "3.12.1",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
32
|
"@types/yazl": "^2.4.1",
|
33
|
-
"@vercel/frameworks": "0.5.1-canary.
|
33
|
+
"@vercel/frameworks": "0.5.1-canary.19",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"boxen": "4.2.0",
|
39
39
|
"cross-spawn": "6.0.5",
|
40
40
|
"end-of-stream": "1.4.1",
|
41
|
-
"fs-extra": "
|
41
|
+
"fs-extra": "10.0.0",
|
42
42
|
"glob": "7.1.3",
|
43
43
|
"into-stream": "5.0.0",
|
44
44
|
"js-yaml": "3.13.1",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "7039771ec9d90c61219701b5557297d23d428617"
|
53
53
|
}
|