@vercel/build-utils 7.0.0 → 7.1.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/dist/schemas.js CHANGED
@@ -1,61 +1,87 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildsSchema = exports.functionsSchema = void 0;
4
- exports.functionsSchema = {
5
- type: 'object',
6
- minProperties: 1,
7
- maxProperties: 50,
8
- additionalProperties: false,
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
- exports.buildsSchema = {
40
- type: 'array',
41
- minItems: 0,
42
- maxItems: 128,
43
- items: {
44
- type: 'object',
45
- additionalProperties: false,
46
- required: ['use'],
47
- properties: {
48
- src: {
49
- type: 'string',
50
- minLength: 1,
51
- maxLength: 4096,
52
- },
53
- use: {
54
- type: 'string',
55
- minLength: 3,
56
- maxLength: 256,
57
- },
58
- config: { type: 'object' },
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
+ });
@@ -1,20 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldServe = void 0;
4
- const path_1 = require("path");
5
- const shouldServe = ({ entrypoint, files, requestPath, }) => {
6
- requestPath = requestPath.replace(/\/$/, ''); // sanitize trailing '/'
7
- entrypoint = entrypoint.replace(/\\/, '/'); // windows compatibility
8
- if (entrypoint === requestPath && hasProp(files, entrypoint)) {
9
- return true;
10
- }
11
- const { dir, name } = (0, path_1.parse)(entrypoint);
12
- if (name === 'index' && dir === requestPath && hasProp(files, entrypoint)) {
13
- return true;
14
- }
15
- return false;
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
- return Object.hasOwnProperty.call(obj, key);
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
@@ -265,9 +265,13 @@ export interface PackageJson {
265
265
  readonly packageManager?: string;
266
266
  }
267
267
  export interface NodeVersion {
268
+ /** major version number: 18 */
268
269
  major: number;
270
+ /** major version range: "18.x" */
269
271
  range: string;
272
+ /** runtime descriptor: "nodejs18.x" */
270
273
  runtime: string;
274
+ /** date beyond which this version is discontinued: 2023-08-17T19:05:45.951Z */
271
275
  discontinueDate?: Date;
272
276
  }
273
277
  export interface Builder {
package/dist/types.js CHANGED
@@ -1,2 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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);
@@ -1,27 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateNpmrc = void 0;
4
- const path_1 = require("path");
5
- const promises_1 = require("fs/promises");
6
- /**
7
- * Checks if there is a `.npmrc` in the cwd (project root) and makes sure it
8
- * doesn't contain a `use-node-version`. This config setting is not supported
9
- * since it causes the package manager to install the Node.js version which in
10
- * the case of newer Node.js versions is not compatible with AWS due to
11
- * outdated GLIBC binaries.
12
- *
13
- * @see https://pnpm.io/npmrc#use-node-version
14
- *
15
- * @param cwd The current working directory (e.g. project root);
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
- const npmrc = await (0, promises_1.readFile)((0, path_1.join)(cwd, '.npmrc'), 'utf-8').catch(err => {
19
- if (err.code !== 'ENOENT')
20
- throw err;
21
- });
22
- const nodeRegExp = /(?<!#.*)use-node-version/;
23
- if (npmrc?.match(nodeRegExp)) {
24
- throw new Error('Detected unsupported "use-node-version" in your ".npmrc". Please use "engines" in your "package.json" instead.');
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
- exports.validateNpmrc = validateNpmrc;
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.0.0",
3
+ "version": "7.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -26,7 +26,7 @@
26
26
  "@types/node-fetch": "^2.1.6",
27
27
  "@types/semver": "6.0.0",
28
28
  "@types/yazl": "2.4.2",
29
- "@vercel/error-utils": "2.0.0",
29
+ "@vercel/error-utils": "2.0.1",
30
30
  "@vercel/ncc": "0.24.0",
31
31
  "aggregate-error": "3.0.1",
32
32
  "async-retry": "1.2.3",
@@ -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.1.1",
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
- });