@vercel/build-utils 6.7.1 → 6.7.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/debug.js +1 -1
- package/dist/file-blob.js +5 -5
- package/dist/file-fs-ref.js +6 -6
- package/dist/file-ref.js +5 -5
- package/dist/fs/download.js +9 -9
- package/dist/fs/get-writable-directory.js +2 -2
- package/dist/fs/glob.js +7 -7
- package/dist/fs/node-version.js +3 -3
- package/dist/fs/read-config-file.js +8 -4
- package/dist/fs/rename.d.ts +1 -1
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +30 -30
- package/dist/fs/stream-to-buffer.js +1 -1
- package/dist/get-ignore-filter.js +1 -1
- package/dist/get-prefixed-env-vars.d.ts +1 -1
- package/dist/index.js +1157 -98
- package/dist/lambda.d.ts +1 -1
- package/dist/lambda.js +21 -21
- package/dist/should-serve.js +1 -1
- package/dist/types.d.ts +12 -12
- package/package.json +4 -3
package/dist/lambda.d.ts
CHANGED
@@ -3,7 +3,7 @@ import type { Files, Config, FunctionFramework } from './types';
|
|
3
3
|
interface Environment {
|
4
4
|
[key: string]: string;
|
5
5
|
}
|
6
|
-
export
|
6
|
+
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
7
7
|
export interface LambdaOptionsBase {
|
8
8
|
handler: string;
|
9
9
|
runtime: string;
|
package/dist/lambda.js
CHANGED
@@ -15,39 +15,39 @@ class Lambda {
|
|
15
15
|
constructor(opts) {
|
16
16
|
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, supportsResponseStreaming, experimentalResponseStreaming, operationType, framework, } = opts;
|
17
17
|
if ('files' in opts) {
|
18
|
-
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
18
|
+
(0, assert_1.default)(typeof opts.files === 'object', '"files" must be an object');
|
19
19
|
}
|
20
20
|
if ('zipBuffer' in opts) {
|
21
|
-
assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
|
21
|
+
(0, assert_1.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
|
22
22
|
}
|
23
|
-
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
24
|
-
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
25
|
-
assert_1.default(typeof environment === 'object', '"environment" is not an object');
|
23
|
+
(0, assert_1.default)(typeof handler === 'string', '"handler" is not a string');
|
24
|
+
(0, assert_1.default)(typeof runtime === 'string', '"runtime" is not a string');
|
25
|
+
(0, assert_1.default)(typeof environment === 'object', '"environment" is not an object');
|
26
26
|
if (memory !== undefined) {
|
27
|
-
assert_1.default(typeof memory === 'number', '"memory" is not a number');
|
27
|
+
(0, assert_1.default)(typeof memory === 'number', '"memory" is not a number');
|
28
28
|
}
|
29
29
|
if (maxDuration !== undefined) {
|
30
|
-
assert_1.default(typeof maxDuration === 'number', '"maxDuration" is not a number');
|
30
|
+
(0, assert_1.default)(typeof maxDuration === 'number', '"maxDuration" is not a number');
|
31
31
|
}
|
32
32
|
if (allowQuery !== undefined) {
|
33
|
-
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
34
|
-
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
33
|
+
(0, assert_1.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
|
34
|
+
(0, assert_1.default)(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
|
35
35
|
}
|
36
36
|
if (supportsMultiPayloads !== undefined) {
|
37
|
-
assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
|
37
|
+
(0, assert_1.default)(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
|
38
38
|
}
|
39
39
|
if (supportsWrapper !== undefined) {
|
40
|
-
assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
|
40
|
+
(0, assert_1.default)(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
|
41
41
|
}
|
42
42
|
if (regions !== undefined) {
|
43
|
-
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
44
|
-
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
43
|
+
(0, assert_1.default)(Array.isArray(regions), '"regions" is not an Array');
|
44
|
+
(0, assert_1.default)(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
45
45
|
}
|
46
46
|
if (framework !== undefined) {
|
47
|
-
assert_1.default(typeof framework === 'object', '"framework" is not an object');
|
48
|
-
assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
|
47
|
+
(0, assert_1.default)(typeof framework === 'object', '"framework" is not an object');
|
48
|
+
(0, assert_1.default)(typeof framework.slug === 'string', '"framework.slug" is not a string');
|
49
49
|
if (framework.version !== undefined) {
|
50
|
-
assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
|
50
|
+
(0, assert_1.default)(typeof framework.version === 'string', '"framework.version" is not a string');
|
51
51
|
}
|
52
52
|
}
|
53
53
|
this.type = 'Lambda';
|
@@ -111,8 +111,8 @@ async function createZip(files) {
|
|
111
111
|
const symlinkTargets = new Map();
|
112
112
|
for (const name of names) {
|
113
113
|
const file = files[name];
|
114
|
-
if (file.mode && download_1.isSymbolicLink(file.mode) && file.type === 'FileFsRef') {
|
115
|
-
const symlinkTarget = await fs_extra_1.readlink(file.fsPath);
|
114
|
+
if (file.mode && (0, download_1.isSymbolicLink)(file.mode) && file.type === 'FileFsRef') {
|
115
|
+
const symlinkTarget = await (0, fs_extra_1.readlink)(file.fsPath);
|
116
116
|
symlinkTargets.set(name, symlinkTarget);
|
117
117
|
}
|
118
118
|
}
|
@@ -125,7 +125,7 @@ async function createZip(files) {
|
|
125
125
|
if (typeof symlinkTarget === 'string') {
|
126
126
|
zipFile.addBuffer(Buffer.from(symlinkTarget, 'utf8'), name, opts);
|
127
127
|
}
|
128
|
-
else if (file.mode && download_1.isDirectory(file.mode)) {
|
128
|
+
else if (file.mode && (0, download_1.isDirectory)(file.mode)) {
|
129
129
|
zipFile.addEmptyDirectory(name, opts);
|
130
130
|
}
|
131
131
|
else {
|
@@ -135,7 +135,7 @@ async function createZip(files) {
|
|
135
135
|
}
|
136
136
|
}
|
137
137
|
zipFile.end();
|
138
|
-
stream_to_buffer_1.default(zipFile.outputStream).then(resolve).catch(reject);
|
138
|
+
(0, stream_to_buffer_1.default)(zipFile.outputStream).then(resolve).catch(reject);
|
139
139
|
});
|
140
140
|
return zipBuffer;
|
141
141
|
}
|
@@ -143,7 +143,7 @@ exports.createZip = createZip;
|
|
143
143
|
async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
144
144
|
if (config?.functions) {
|
145
145
|
for (const [pattern, fn] of Object.entries(config.functions)) {
|
146
|
-
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
|
146
|
+
if (sourceFile === pattern || (0, minimatch_1.default)(sourceFile, pattern)) {
|
147
147
|
return {
|
148
148
|
memory: fn.memory,
|
149
149
|
maxDuration: fn.maxDuration,
|
package/dist/should-serve.js
CHANGED
@@ -8,7 +8,7 @@ const shouldServe = ({ entrypoint, files, requestPath, }) => {
|
|
8
8
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
9
9
|
return true;
|
10
10
|
}
|
11
|
-
const { dir, name } = path_1.parse(entrypoint);
|
11
|
+
const { dir, name } = (0, path_1.parse)(entrypoint);
|
12
12
|
if (name === 'index' && dir === requestPath && hasProp(files, entrypoint)) {
|
13
13
|
return true;
|
14
14
|
}
|
package/dist/types.d.ts
CHANGED
@@ -8,7 +8,7 @@ import type { EdgeFunction } from './edge-function';
|
|
8
8
|
export interface Env {
|
9
9
|
[name: string]: string | undefined;
|
10
10
|
}
|
11
|
-
export
|
11
|
+
export type File = FileRef | FileFsRef | FileBlob;
|
12
12
|
export interface FileBase {
|
13
13
|
type: string;
|
14
14
|
mode: number;
|
@@ -151,7 +151,7 @@ export interface ShouldServeOptions {
|
|
151
151
|
/**
|
152
152
|
* `startDevServer()` is given the same parameters as `build()`.
|
153
153
|
*/
|
154
|
-
export
|
154
|
+
export type StartDevServerOptions = BuildOptions;
|
155
155
|
export interface StartDevServerSuccess {
|
156
156
|
/**
|
157
157
|
* Port number where the dev server can be connected to, assumed to be running
|
@@ -168,7 +168,7 @@ export interface StartDevServerSuccess {
|
|
168
168
|
* `startDevServer()` may return `null` to opt-out of spawning a dev server for
|
169
169
|
* a given `entrypoint`.
|
170
170
|
*/
|
171
|
-
export
|
171
|
+
export type StartDevServerResult = StartDevServerSuccess | null;
|
172
172
|
/**
|
173
173
|
* Credit to Iain Reid, MIT license.
|
174
174
|
* Source: https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e
|
@@ -312,9 +312,9 @@ export interface BuilderV3 {
|
|
312
312
|
shouldServe?: ShouldServe;
|
313
313
|
startDevServer?: StartDevServer;
|
314
314
|
}
|
315
|
-
|
316
|
-
|
317
|
-
export
|
315
|
+
type ImageFormat = 'image/avif' | 'image/webp';
|
316
|
+
type ImageContentDispositionType = 'inline' | 'attachment';
|
317
|
+
export type RemotePattern = {
|
318
318
|
/**
|
319
319
|
* Must be `http` or `https`.
|
320
320
|
*/
|
@@ -391,14 +391,14 @@ export interface BuildResultV2Typical {
|
|
391
391
|
version: string;
|
392
392
|
};
|
393
393
|
}
|
394
|
-
export
|
394
|
+
export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
|
395
395
|
export interface BuildResultV3 {
|
396
396
|
routes?: any[];
|
397
397
|
output: Lambda | EdgeFunction;
|
398
398
|
}
|
399
|
-
export
|
400
|
-
export
|
401
|
-
export
|
402
|
-
export
|
403
|
-
export
|
399
|
+
export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
|
400
|
+
export type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
|
401
|
+
export type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
|
402
|
+
export type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
|
403
|
+
export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
|
404
404
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "6.7.
|
3
|
+
"version": "6.7.2",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"@types/node-fetch": "^2.1.6",
|
33
33
|
"@types/semver": "6.0.0",
|
34
34
|
"@types/yazl": "2.4.2",
|
35
|
+
"@vercel/error-utils": "1.0.10",
|
35
36
|
"@vercel/ncc": "0.24.0",
|
36
37
|
"aggregate-error": "3.0.1",
|
37
38
|
"async-retry": "1.2.3",
|
@@ -48,8 +49,8 @@
|
|
48
49
|
"multistream": "2.1.1",
|
49
50
|
"node-fetch": "2.6.7",
|
50
51
|
"semver": "6.1.1",
|
51
|
-
"typescript": "4.
|
52
|
+
"typescript": "4.9.5",
|
52
53
|
"yazl": "2.5.1"
|
53
54
|
},
|
54
|
-
"gitHead": "
|
55
|
+
"gitHead": "2de365f9cfea3ce283d2bf855507c71209f1e3d8"
|
55
56
|
}
|