@vercel/build-utils 7.1.0 → 7.2.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/CHANGELOG.md +20 -0
- package/build.mjs +3 -0
- package/dist/clone-env.js +39 -30
- package/dist/debug.js +28 -9
- package/dist/edge-function.js +36 -16
- package/dist/errors.js +83 -74
- package/dist/file-blob.js +63 -32
- package/dist/file-fs-ref.js +99 -65
- package/dist/file-ref.js +97 -77
- package/dist/fs/download.js +121 -91
- package/dist/fs/get-writable-directory.js +29 -9
- package/dist/fs/glob.js +104 -77
- package/dist/fs/node-version.js +115 -82
- package/dist/fs/normalize-path.js +28 -8
- package/dist/fs/read-config-file.js +66 -40
- package/dist/fs/rename.js +27 -14
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +481 -419
- package/dist/fs/stream-to-buffer.js +51 -24
- package/dist/get-ignore-filter.js +80 -49
- package/dist/get-platform-env.js +41 -22
- package/dist/get-prefixed-env-vars.js +48 -32
- package/dist/hard-link-dir.js +90 -70
- package/dist/index.js +21456 -29356
- package/dist/lambda.js +208 -144
- package/dist/nodejs-lambda.js +40 -12
- package/dist/prerender.d.ts +6 -2
- package/dist/prerender.js +130 -64
- package/dist/schemas.js +83 -57
- package/dist/should-serve.js +43 -16
- package/dist/types.d.ts +12 -0
- package/dist/types.js +15 -1
- package/dist/validate-npmrc.js +38 -24
- package/package.json +3 -3
- package/build.js +0 -30
package/dist/schemas.js
CHANGED
@@ -1,61 +1,87 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
patternProperties: {
|
10
|
-
'^.{1,256}$': {
|
11
|
-
type: 'object',
|
12
|
-
additionalProperties: false,
|
13
|
-
properties: {
|
14
|
-
runtime: {
|
15
|
-
type: 'string',
|
16
|
-
maxLength: 256,
|
17
|
-
},
|
18
|
-
memory: {
|
19
|
-
minimum: 128,
|
20
|
-
maximum: 3008,
|
21
|
-
},
|
22
|
-
maxDuration: {
|
23
|
-
type: 'number',
|
24
|
-
minimum: 1,
|
25
|
-
maximum: 900,
|
26
|
-
},
|
27
|
-
includeFiles: {
|
28
|
-
type: 'string',
|
29
|
-
maxLength: 256,
|
30
|
-
},
|
31
|
-
excludeFiles: {
|
32
|
-
type: 'string',
|
33
|
-
maxLength: 256,
|
34
|
-
},
|
35
|
-
},
|
36
|
-
},
|
37
|
-
},
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
38
9
|
};
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var schemas_exports = {};
|
20
|
+
__export(schemas_exports, {
|
21
|
+
buildsSchema: () => buildsSchema,
|
22
|
+
functionsSchema: () => functionsSchema
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(schemas_exports);
|
25
|
+
const functionsSchema = {
|
26
|
+
type: "object",
|
27
|
+
minProperties: 1,
|
28
|
+
maxProperties: 50,
|
29
|
+
additionalProperties: false,
|
30
|
+
patternProperties: {
|
31
|
+
"^.{1,256}$": {
|
32
|
+
type: "object",
|
33
|
+
additionalProperties: false,
|
34
|
+
properties: {
|
35
|
+
runtime: {
|
36
|
+
type: "string",
|
37
|
+
maxLength: 256
|
38
|
+
},
|
39
|
+
memory: {
|
40
|
+
minimum: 128,
|
41
|
+
maximum: 3008
|
59
42
|
},
|
60
|
-
|
43
|
+
maxDuration: {
|
44
|
+
type: "number",
|
45
|
+
minimum: 1,
|
46
|
+
maximum: 900
|
47
|
+
},
|
48
|
+
includeFiles: {
|
49
|
+
type: "string",
|
50
|
+
maxLength: 256
|
51
|
+
},
|
52
|
+
excludeFiles: {
|
53
|
+
type: "string",
|
54
|
+
maxLength: 256
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
};
|
60
|
+
const buildsSchema = {
|
61
|
+
type: "array",
|
62
|
+
minItems: 0,
|
63
|
+
maxItems: 128,
|
64
|
+
items: {
|
65
|
+
type: "object",
|
66
|
+
additionalProperties: false,
|
67
|
+
required: ["use"],
|
68
|
+
properties: {
|
69
|
+
src: {
|
70
|
+
type: "string",
|
71
|
+
minLength: 1,
|
72
|
+
maxLength: 4096
|
73
|
+
},
|
74
|
+
use: {
|
75
|
+
type: "string",
|
76
|
+
minLength: 3,
|
77
|
+
maxLength: 256
|
78
|
+
},
|
79
|
+
config: { type: "object" }
|
80
|
+
}
|
81
|
+
}
|
61
82
|
};
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
84
|
+
0 && (module.exports = {
|
85
|
+
buildsSchema,
|
86
|
+
functionsSchema
|
87
|
+
});
|
package/dist/should-serve.js
CHANGED
@@ -1,20 +1,47 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var should_serve_exports = {};
|
20
|
+
__export(should_serve_exports, {
|
21
|
+
shouldServe: () => shouldServe
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(should_serve_exports);
|
24
|
+
var import_path = require("path");
|
25
|
+
const shouldServe = ({
|
26
|
+
entrypoint,
|
27
|
+
files,
|
28
|
+
requestPath
|
29
|
+
}) => {
|
30
|
+
requestPath = requestPath.replace(/\/$/, "");
|
31
|
+
entrypoint = entrypoint.replace(/\\/, "/");
|
32
|
+
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
33
|
+
return true;
|
34
|
+
}
|
35
|
+
const { dir, name } = (0, import_path.parse)(entrypoint);
|
36
|
+
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
37
|
+
return true;
|
38
|
+
}
|
39
|
+
return false;
|
16
40
|
};
|
17
|
-
exports.shouldServe = shouldServe;
|
18
41
|
function hasProp(obj, key) {
|
19
|
-
|
42
|
+
return Object.hasOwnProperty.call(obj, key);
|
20
43
|
}
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
45
|
+
0 && (module.exports = {
|
46
|
+
shouldServe
|
47
|
+
});
|
package/dist/types.d.ts
CHANGED
@@ -43,6 +43,14 @@ export interface Config {
|
|
43
43
|
middleware?: boolean;
|
44
44
|
[key: string]: unknown;
|
45
45
|
}
|
46
|
+
export type HasField = Array<{
|
47
|
+
type: 'host';
|
48
|
+
value: string;
|
49
|
+
} | {
|
50
|
+
type: 'header' | 'cookie' | 'query';
|
51
|
+
key: string;
|
52
|
+
value?: string;
|
53
|
+
}>;
|
46
54
|
export interface Meta {
|
47
55
|
isDev?: boolean;
|
48
56
|
devCacheDir?: string;
|
@@ -265,9 +273,13 @@ export interface PackageJson {
|
|
265
273
|
readonly packageManager?: string;
|
266
274
|
}
|
267
275
|
export interface NodeVersion {
|
276
|
+
/** major version number: 18 */
|
268
277
|
major: number;
|
278
|
+
/** major version range: "18.x" */
|
269
279
|
range: string;
|
280
|
+
/** runtime descriptor: "nodejs18.x" */
|
270
281
|
runtime: string;
|
282
|
+
/** date beyond which this version is discontinued: 2023-08-17T19:05:45.951Z */
|
271
283
|
discontinueDate?: Date;
|
272
284
|
}
|
273
285
|
export interface Builder {
|
package/dist/types.js
CHANGED
@@ -1,2 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
for (let key of __getOwnPropNames(from))
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
+
}
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var types_exports = {};
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/validate-npmrc.js
CHANGED
@@ -1,27 +1,41 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var validate_npmrc_exports = {};
|
20
|
+
__export(validate_npmrc_exports, {
|
21
|
+
validateNpmrc: () => validateNpmrc
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(validate_npmrc_exports);
|
24
|
+
var import_path = require("path");
|
25
|
+
var import_promises = require("fs/promises");
|
17
26
|
async function validateNpmrc(cwd) {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
const npmrc = await (0, import_promises.readFile)((0, import_path.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
|
28
|
+
if (err.code !== "ENOENT")
|
29
|
+
throw err;
|
30
|
+
});
|
31
|
+
const nodeRegExp = /(?<!#.*)use-node-version/;
|
32
|
+
if (npmrc?.match(nodeRegExp)) {
|
33
|
+
throw new Error(
|
34
|
+
'Detected unsupported "use-node-version" in your ".npmrc". Please use "engines" in your "package.json" instead.'
|
35
|
+
);
|
36
|
+
}
|
26
37
|
}
|
27
|
-
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
39
|
+
0 && (module.exports = {
|
40
|
+
validateNpmrc
|
41
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.2.0",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -43,12 +43,12 @@
|
|
43
43
|
"minimatch": "3.1.2",
|
44
44
|
"multistream": "2.1.1",
|
45
45
|
"node-fetch": "2.6.7",
|
46
|
-
"semver": "6.
|
46
|
+
"semver": "6.3.1",
|
47
47
|
"typescript": "4.9.5",
|
48
48
|
"yazl": "2.5.1"
|
49
49
|
},
|
50
50
|
"scripts": {
|
51
|
-
"build": "node build",
|
51
|
+
"build": "node build.mjs",
|
52
52
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
53
53
|
"test-unit": "pnpm test test/unit.*test.*",
|
54
54
|
"test-e2e": "pnpm test test/integration.test.ts"
|
package/build.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
const fs = require('fs-extra');
|
3
|
-
const execa = require('execa');
|
4
|
-
const { join } = require('path');
|
5
|
-
|
6
|
-
async function main() {
|
7
|
-
const outDir = join(__dirname, 'dist');
|
8
|
-
|
9
|
-
// Start fresh
|
10
|
-
await fs.remove(outDir);
|
11
|
-
|
12
|
-
// Compile TypeScript
|
13
|
-
await execa('tsc', [], { stdio: 'inherit' });
|
14
|
-
|
15
|
-
// Run `ncc`
|
16
|
-
const mainDir = join(outDir, 'main');
|
17
|
-
await execa('ncc', ['build', 'src/index.ts', '-o', mainDir], {
|
18
|
-
stdio: 'inherit',
|
19
|
-
});
|
20
|
-
// Move compiled ncc file to out dir
|
21
|
-
await fs.rename(join(mainDir, 'index.js'), join(outDir, 'index.js'));
|
22
|
-
|
23
|
-
// Delete leftover "main" dir
|
24
|
-
await fs.remove(mainDir);
|
25
|
-
}
|
26
|
-
|
27
|
-
main().catch(err => {
|
28
|
-
console.error(err);
|
29
|
-
process.exit(1);
|
30
|
-
});
|