@vercel/build-utils 2.12.3-canary.1 → 2.12.3-canary.13
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/detect-builders.js +1 -1
- package/dist/index.js +2718 -2476
- package/dist/lambda.d.ts +5 -2
- package/dist/lambda.js +8 -2
- package/dist/prerender.d.ts +3 -1
- package/dist/prerender.js +10 -1
- package/package.json +4 -4
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,6 +21,7 @@ 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;
|
@@ -34,9 +36,10 @@ export declare class Lambda {
|
|
34
36
|
maxDuration?: number;
|
35
37
|
environment: Environment;
|
36
38
|
allowQuery?: string[];
|
37
|
-
|
39
|
+
regions?: string[];
|
40
|
+
constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }: LambdaOptions);
|
38
41
|
}
|
39
|
-
export declare function createLambda({ files, handler, runtime, memory, maxDuration, environment, allowQuery, }: CreateLambdaOptions): Promise<Lambda>;
|
42
|
+
export declare function createLambda({ files, handler, runtime, memory, maxDuration, environment, allowQuery, regions, }: CreateLambdaOptions): Promise<Lambda>;
|
40
43
|
export declare function createZip(files: Files): Promise<Buffer>;
|
41
44
|
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
|
42
45
|
export {};
|
package/dist/lambda.js
CHANGED
@@ -12,7 +12,7 @@ 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({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, }) {
|
15
|
+
constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }) {
|
16
16
|
this.type = 'Lambda';
|
17
17
|
this.zipBuffer = zipBuffer;
|
18
18
|
this.handler = handler;
|
@@ -21,12 +21,13 @@ class Lambda {
|
|
21
21
|
this.maxDuration = maxDuration;
|
22
22
|
this.environment = environment;
|
23
23
|
this.allowQuery = allowQuery;
|
24
|
+
this.regions = regions;
|
24
25
|
}
|
25
26
|
}
|
26
27
|
exports.Lambda = Lambda;
|
27
28
|
const sema = new async_sema_1.default(10);
|
28
29
|
const mtime = new Date(1540000000000);
|
29
|
-
async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, }) {
|
30
|
+
async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, regions, }) {
|
30
31
|
assert_1.default(typeof files === 'object', '"files" must be an object');
|
31
32
|
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
32
33
|
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
@@ -41,6 +42,10 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
|
|
41
42
|
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
42
43
|
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
43
44
|
}
|
45
|
+
if (regions !== undefined) {
|
46
|
+
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
47
|
+
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
48
|
+
}
|
44
49
|
await sema.acquire();
|
45
50
|
try {
|
46
51
|
const zipBuffer = await createZip(files);
|
@@ -51,6 +56,7 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
|
|
51
56
|
memory,
|
52
57
|
maxDuration,
|
53
58
|
environment,
|
59
|
+
regions,
|
54
60
|
});
|
55
61
|
}
|
56
62
|
finally {
|
package/dist/prerender.d.ts
CHANGED
@@ -8,6 +8,7 @@ interface PrerenderOptions {
|
|
8
8
|
fallback: FileBlob | FileFsRef | FileRef | null;
|
9
9
|
group?: number;
|
10
10
|
bypassToken?: string | null;
|
11
|
+
allowQuery?: string[];
|
11
12
|
}
|
12
13
|
export declare class Prerender {
|
13
14
|
type: 'Prerender';
|
@@ -16,6 +17,7 @@ export declare class Prerender {
|
|
16
17
|
fallback: FileBlob | FileFsRef | FileRef | null;
|
17
18
|
group?: number;
|
18
19
|
bypassToken: string | null;
|
19
|
-
|
20
|
+
allowQuery?: string[];
|
21
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, }: PrerenderOptions);
|
20
22
|
}
|
21
23
|
export {};
|
package/dist/prerender.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Prerender = void 0;
|
4
4
|
class Prerender {
|
5
|
-
constructor({ expiration, lambda, fallback, group, bypassToken, }) {
|
5
|
+
constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, }) {
|
6
6
|
this.type = 'Prerender';
|
7
7
|
this.expiration = expiration;
|
8
8
|
this.lambda = lambda;
|
@@ -28,6 +28,15 @@ class Prerender {
|
|
28
28
|
throw new Error('The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null.');
|
29
29
|
}
|
30
30
|
this.fallback = fallback;
|
31
|
+
if (allowQuery !== undefined) {
|
32
|
+
if (!Array.isArray(allowQuery)) {
|
33
|
+
throw new Error('The `allowQuery` argument for `Prerender` must be Array.');
|
34
|
+
}
|
35
|
+
if (!allowQuery.every(q => typeof q === 'string')) {
|
36
|
+
throw new Error('The `allowQuery` argument for `Prerender` must be Array of strings.');
|
37
|
+
}
|
38
|
+
this.allowQuery = allowQuery;
|
39
|
+
}
|
31
40
|
}
|
32
41
|
}
|
33
42
|
exports.Prerender = Prerender;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.12.3-canary.
|
3
|
+
"version": "2.12.3-canary.13",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -30,8 +30,8 @@
|
|
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.
|
34
|
-
"@vercel/ncc": "0.
|
33
|
+
"@vercel/frameworks": "0.5.1-canary.9",
|
34
|
+
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
37
37
|
"async-sema": "2.1.4",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "cd7185a872a5767cfc010b849a4064cbc4e9f679"
|
53
53
|
}
|