@vercel/build-utils 2.12.3-canary.8 → 2.13.1-canary.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/.turbo/turbo-build.log +32 -0
- package/dist/convert-runtime-to-plugin.d.ts +65 -0
- package/dist/convert-runtime-to-plugin.js +296 -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/fs/run-user-scripts.d.ts +16 -0
- package/dist/fs/run-user-scripts.js +55 -22
- package/dist/get-ignore-filter.d.ts +1 -0
- package/dist/get-ignore-filter.js +59 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +2461 -1020
- package/dist/lambda.d.ts +14 -13
- package/dist/lambda.js +43 -33
- package/dist/types.d.ts +18 -2
- package/package.json +6 -6
package/dist/lambda.d.ts
CHANGED
@@ -4,15 +4,6 @@ interface Environment {
|
|
4
4
|
[key: string]: string;
|
5
5
|
}
|
6
6
|
interface LambdaOptions {
|
7
|
-
zipBuffer: Buffer;
|
8
|
-
handler: string;
|
9
|
-
runtime: string;
|
10
|
-
memory?: number;
|
11
|
-
maxDuration?: number;
|
12
|
-
environment: Environment;
|
13
|
-
allowQuery?: string[];
|
14
|
-
}
|
15
|
-
interface CreateLambdaOptions {
|
16
7
|
files: Files;
|
17
8
|
handler: string;
|
18
9
|
runtime: string;
|
@@ -20,23 +11,33 @@ interface CreateLambdaOptions {
|
|
20
11
|
maxDuration?: number;
|
21
12
|
environment?: Environment;
|
22
13
|
allowQuery?: string[];
|
14
|
+
regions?: string[];
|
23
15
|
}
|
24
16
|
interface GetLambdaOptionsFromFunctionOptions {
|
25
17
|
sourceFile: string;
|
26
|
-
config?: Config
|
18
|
+
config?: Pick<Config, 'functions'>;
|
27
19
|
}
|
28
20
|
export declare class Lambda {
|
29
21
|
type: 'Lambda';
|
30
|
-
|
22
|
+
files: Files;
|
31
23
|
handler: string;
|
32
24
|
runtime: string;
|
33
25
|
memory?: number;
|
34
26
|
maxDuration?: number;
|
35
27
|
environment: Environment;
|
36
28
|
allowQuery?: string[];
|
37
|
-
|
29
|
+
regions?: string[];
|
30
|
+
/**
|
31
|
+
* @deprecated Use `await lambda.createZip()` instead.
|
32
|
+
*/
|
33
|
+
zipBuffer?: Buffer;
|
34
|
+
constructor({ files, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }: LambdaOptions);
|
35
|
+
createZip(): Promise<Buffer>;
|
38
36
|
}
|
39
|
-
|
37
|
+
/**
|
38
|
+
* @deprecated Use `new Lambda()` instead.
|
39
|
+
*/
|
40
|
+
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
40
41
|
export declare function createZip(files: Files): Promise<Buffer>;
|
41
42
|
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
|
42
43
|
export {};
|
package/dist/lambda.js
CHANGED
@@ -12,50 +12,60 @@ 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
14
|
class Lambda {
|
15
|
-
constructor({
|
15
|
+
constructor({ files, handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, }) {
|
16
|
+
assert_1.default(typeof files === 'object', '"files" must be an object');
|
17
|
+
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
18
|
+
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
19
|
+
assert_1.default(typeof environment === 'object', '"environment" is not an object');
|
20
|
+
if (memory !== undefined) {
|
21
|
+
assert_1.default(typeof memory === 'number', '"memory" is not a number');
|
22
|
+
}
|
23
|
+
if (maxDuration !== undefined) {
|
24
|
+
assert_1.default(typeof maxDuration === 'number', '"maxDuration" is not a number');
|
25
|
+
}
|
26
|
+
if (allowQuery !== undefined) {
|
27
|
+
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
28
|
+
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
29
|
+
}
|
30
|
+
if (regions !== undefined) {
|
31
|
+
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
32
|
+
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
33
|
+
}
|
16
34
|
this.type = 'Lambda';
|
17
|
-
this.
|
35
|
+
this.files = files;
|
18
36
|
this.handler = handler;
|
19
37
|
this.runtime = runtime;
|
20
38
|
this.memory = memory;
|
21
39
|
this.maxDuration = maxDuration;
|
22
40
|
this.environment = environment;
|
23
41
|
this.allowQuery = allowQuery;
|
42
|
+
this.regions = regions;
|
43
|
+
}
|
44
|
+
async createZip() {
|
45
|
+
let { zipBuffer } = this;
|
46
|
+
if (!zipBuffer) {
|
47
|
+
await sema.acquire();
|
48
|
+
try {
|
49
|
+
zipBuffer = await createZip(this.files);
|
50
|
+
}
|
51
|
+
finally {
|
52
|
+
sema.release();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
return zipBuffer;
|
24
56
|
}
|
25
57
|
}
|
26
58
|
exports.Lambda = Lambda;
|
27
59
|
const sema = new async_sema_1.default(10);
|
28
60
|
const mtime = new Date(1540000000000);
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
if (maxDuration !== undefined) {
|
38
|
-
assert_1.default(typeof maxDuration === 'number', '"maxDuration" is not a number');
|
39
|
-
}
|
40
|
-
if (allowQuery !== undefined) {
|
41
|
-
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
42
|
-
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
43
|
-
}
|
44
|
-
await sema.acquire();
|
45
|
-
try {
|
46
|
-
const zipBuffer = await createZip(files);
|
47
|
-
return new Lambda({
|
48
|
-
zipBuffer,
|
49
|
-
handler,
|
50
|
-
runtime,
|
51
|
-
memory,
|
52
|
-
maxDuration,
|
53
|
-
environment,
|
54
|
-
});
|
55
|
-
}
|
56
|
-
finally {
|
57
|
-
sema.release();
|
58
|
-
}
|
61
|
+
/**
|
62
|
+
* @deprecated Use `new Lambda()` instead.
|
63
|
+
*/
|
64
|
+
async function createLambda(opts) {
|
65
|
+
const lambda = new Lambda(opts);
|
66
|
+
// backwards compat
|
67
|
+
lambda.zipBuffer = await lambda.createZip();
|
68
|
+
return lambda;
|
59
69
|
}
|
60
70
|
exports.createLambda = createLambda;
|
61
71
|
async function createZip(files) {
|
@@ -90,7 +100,7 @@ async function createZip(files) {
|
|
90
100
|
}
|
91
101
|
exports.createZip = createZip;
|
92
102
|
async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
93
|
-
if (config
|
103
|
+
if (config === null || config === void 0 ? void 0 : config.functions) {
|
94
104
|
for (const [pattern, fn] of Object.entries(config.functions)) {
|
95
105
|
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
|
96
106
|
return {
|
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.1-canary.1",
|
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.21",
|
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": "ab1decf79da76e85f7f562d1c4ee5e5dcf4c2a17"
|
53
53
|
}
|