vercel-cli 48.2.2__py3-none-any.whl → 48.2.9__py3-none-any.whl

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.

Potentially problematic release.


This version of vercel-cli might be problematic. Click here for more details.

@@ -3,9 +3,9 @@
3
3
  "requires": true,
4
4
  "packages": {
5
5
  "node_modules/@vercel/build-utils": {
6
- "version": "12.1.0",
7
- "resolved": "https://registry.npmjs.org/@vercel/build-utils/-/build-utils-12.1.0.tgz",
8
- "integrity": "sha512-yqpAh2KHm9iWUXo/aRWiLIxi8dMAwFtse2iZsg2QNEMs9W20va6L8PMFvdAa5MX9pgRwc38gbjD3V7drxSwq4g==",
6
+ "version": "12.1.2",
7
+ "resolved": "https://registry.npmjs.org/@vercel/build-utils/-/build-utils-12.1.2.tgz",
8
+ "integrity": "sha512-W0j2n9e65rr/fpzghTCgH4qFJgMX249hCQJmEdVzdKkXRlO6DfSqBljEHASCFaeBeumBdgS5jeSDixXyjKtdfw==",
9
9
  "license": "Apache-2.0"
10
10
  },
11
11
  "node_modules/@vercel/detect-agent": {
@@ -18,9 +18,9 @@
18
18
  }
19
19
  },
20
20
  "node_modules/@vercel/python": {
21
- "version": "5.0.7",
22
- "resolved": "https://registry.npmjs.org/@vercel/python/-/python-5.0.7.tgz",
23
- "integrity": "sha512-hswxQErqha3aLxPqdisPEN2WpN422OMbxK1O2DA8saPi1opRh1SjD9kFaPu74iY9H0lIjN+evQpBVeCFmn6n2g==",
21
+ "version": "5.0.9",
22
+ "resolved": "https://registry.npmjs.org/@vercel/python/-/python-5.0.9.tgz",
23
+ "integrity": "sha512-dZ7nLAXvLWN/H6ZFmZu0uDUURNELEoXzGq77sOW0TsHivfBdTpfad6O1O2zPz/P29Pv00Nv9pW+ZQFiimUYwcQ==",
24
24
  "license": "Apache-2.0"
25
25
  }
26
26
  }
@@ -1,5 +1,17 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 12.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Reuse duplicated node builder logic ([#14031](https://github.com/vercel/vercel/pull/14031))
8
+
9
+ ## 12.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Change archive split from 100MB -> 20MB ([#14046](https://github.com/vercel/vercel/pull/14046))
14
+
3
15
  ## 12.1.0
4
16
 
5
17
  ### Minor Changes
@@ -56,7 +56,7 @@ function streamToBuffer(stream) {
56
56
  });
57
57
  }
58
58
  const MB = 1024 * 1024;
59
- async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
59
+ async function streamToBufferChunks(stream, chunkSize = 20 * MB) {
60
60
  const chunks = [];
61
61
  let currentChunk = [];
62
62
  let currentSize = 0;
@@ -0,0 +1,11 @@
1
+ import { BuildV3 } from './types';
2
+ import type FileFsRef from './file-fs-ref';
3
+ export declare function generateNodeBuilderFunctions(frameworkName: string, regex: RegExp, validFilenames: string[], validExtensions: string[], nodeBuild: any): {
4
+ require_: NodeRequire;
5
+ findEntrypoint: (files: Record<string, FileFsRef>) => {
6
+ entrypoint: string;
7
+ entrypointsNotMatchingRegex: string[];
8
+ };
9
+ build: BuildV3;
10
+ entrypointCallback: (args: Parameters<BuildV3>[0]) => Promise<string>;
11
+ };
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var generate_node_builder_functions_exports = {};
30
+ __export(generate_node_builder_functions_exports, {
31
+ generateNodeBuilderFunctions: () => generateNodeBuilderFunctions
32
+ });
33
+ module.exports = __toCommonJS(generate_node_builder_functions_exports);
34
+ var import_glob = __toESM(require("./fs/glob"));
35
+ var import_node_path = require("node:path");
36
+ var import_node_fs = __toESM(require("node:fs"));
37
+ var import_node_module = require("node:module");
38
+ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild) {
39
+ const entrypointsForMessage = validFilenames.map((filename) => `- ${filename}.{${validExtensions.join(",")}}`).join("\n");
40
+ const require_ = (0, import_node_module.createRequire)(__filename);
41
+ const build = async (args) => {
42
+ process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS = "1";
43
+ const includeFiles = ["views/**/*"];
44
+ const includeFilesFromConfig = args.config.includeFiles;
45
+ if (includeFilesFromConfig) {
46
+ includeFiles.push(...includeFilesFromConfig);
47
+ }
48
+ const res = await nodeBuild({
49
+ ...args,
50
+ config: {
51
+ ...args.config,
52
+ includeFiles
53
+ },
54
+ // this is package.json, but we'll replace it with the return value of the entrypointCallback
55
+ // after install and build scripts have had a chance to run
56
+ entrypoint: "package.json",
57
+ considerBuildCommand: true,
58
+ entrypointCallback: async () => {
59
+ return entrypointCallback(args);
60
+ }
61
+ });
62
+ let version = void 0;
63
+ try {
64
+ const resolved = require_.resolve(`${frameworkName}/package.json`, {
65
+ paths: [args.workPath]
66
+ });
67
+ const frameworkVersion = require_(resolved).version;
68
+ if (frameworkVersion) {
69
+ version = frameworkVersion;
70
+ }
71
+ } catch (e) {
72
+ }
73
+ res.output.framework = {
74
+ slug: frameworkName,
75
+ version
76
+ };
77
+ return res;
78
+ };
79
+ const entrypointCallback = async (args) => {
80
+ const mainPackageEntrypoint = findMainPackageEntrypoint(args.files);
81
+ const entrypointGlob = `{${validFilenames.map((entrypoint) => `${entrypoint}`).join(",")}}.{${validExtensions.join(",")}}`;
82
+ const dir = args.config.projectSettings?.outputDirectory?.replace(
83
+ /^\/+|\/+$/g,
84
+ ""
85
+ );
86
+ if (dir) {
87
+ const {
88
+ entrypoint: entrypointFromOutputDir,
89
+ entrypointsNotMatchingRegex: entrypointsNotMatchingRegex2
90
+ } = findEntrypoint(await (0, import_glob.default)(entrypointGlob, (0, import_node_path.join)(args.workPath, dir)));
91
+ if (entrypointFromOutputDir) {
92
+ return (0, import_node_path.join)(dir, entrypointFromOutputDir);
93
+ }
94
+ if (entrypointsNotMatchingRegex2.length > 0) {
95
+ throw new Error(
96
+ `No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex2.length)}: ${entrypointsNotMatchingRegex2.join(", ")}`
97
+ );
98
+ }
99
+ throw new Error(
100
+ `No entrypoint found in output directory: "${dir}". Searched for:
101
+ ${entrypointsForMessage}`
102
+ );
103
+ }
104
+ const files = await (0, import_glob.default)(entrypointGlob, args.workPath);
105
+ const { entrypoint: entrypointFromRoot, entrypointsNotMatchingRegex } = findEntrypoint(files);
106
+ if (entrypointFromRoot) {
107
+ return entrypointFromRoot;
108
+ }
109
+ if (mainPackageEntrypoint) {
110
+ const entrypointFromPackageJson = await (0, import_glob.default)(
111
+ mainPackageEntrypoint,
112
+ args.workPath
113
+ );
114
+ if (entrypointFromPackageJson[mainPackageEntrypoint]) {
115
+ if (checkMatchesRegex(entrypointFromPackageJson[mainPackageEntrypoint])) {
116
+ return mainPackageEntrypoint;
117
+ }
118
+ }
119
+ }
120
+ if (entrypointsNotMatchingRegex.length > 0) {
121
+ throw new Error(
122
+ `No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex.length)}: ${entrypointsNotMatchingRegex.join(", ")}`
123
+ );
124
+ }
125
+ throw new Error(
126
+ `No entrypoint found. Searched for:
127
+ ${entrypointsForMessage}`
128
+ );
129
+ };
130
+ function pluralize(word, count) {
131
+ return count === 1 ? word : `${word}s`;
132
+ }
133
+ const findEntrypoint = (files) => {
134
+ const allEntrypoints = validFilenames.flatMap(
135
+ (filename) => validExtensions.map((extension) => `${filename}.${extension}`)
136
+ );
137
+ const possibleEntrypointsInFiles = allEntrypoints.filter((entrypoint2) => {
138
+ return files[entrypoint2] !== void 0;
139
+ });
140
+ const entrypointsMatchingRegex = possibleEntrypointsInFiles.filter(
141
+ (entrypoint2) => {
142
+ const file = files[entrypoint2];
143
+ return checkMatchesRegex(file);
144
+ }
145
+ );
146
+ const entrypointsNotMatchingRegex = possibleEntrypointsInFiles.filter(
147
+ (entrypoint2) => {
148
+ const file = files[entrypoint2];
149
+ return !checkMatchesRegex(file);
150
+ }
151
+ );
152
+ const entrypoint = entrypointsMatchingRegex[0];
153
+ if (entrypointsMatchingRegex.length > 1) {
154
+ console.warn(
155
+ `Multiple entrypoints found: ${entrypointsMatchingRegex.join(", ")}. Using ${entrypoint}.`
156
+ );
157
+ }
158
+ return {
159
+ entrypoint,
160
+ entrypointsNotMatchingRegex
161
+ };
162
+ };
163
+ const checkMatchesRegex = (file) => {
164
+ const content = import_node_fs.default.readFileSync(file.fsPath, "utf-8");
165
+ const matchesContent = content.match(regex);
166
+ return matchesContent !== null;
167
+ };
168
+ const findMainPackageEntrypoint = (files) => {
169
+ const packageJson = files["package.json"];
170
+ if (packageJson) {
171
+ if (packageJson.type === "FileFsRef") {
172
+ const packageJsonContent = import_node_fs.default.readFileSync(packageJson.fsPath, "utf-8");
173
+ let packageJsonJson;
174
+ try {
175
+ packageJsonJson = JSON.parse(packageJsonContent);
176
+ } catch (_e) {
177
+ packageJsonJson = {};
178
+ }
179
+ if ("main" in packageJsonJson && typeof packageJsonJson.main === "string") {
180
+ return packageJsonJson.main;
181
+ }
182
+ }
183
+ }
184
+ return null;
185
+ };
186
+ return {
187
+ require_,
188
+ findEntrypoint,
189
+ build,
190
+ entrypointCallback
191
+ };
192
+ }
193
+ // Annotate the CommonJS export names for ESM import in node:
194
+ 0 && (module.exports = {
195
+ generateNodeBuilderFunctions
196
+ });
@@ -31,3 +31,4 @@ export * from './trace';
31
31
  export { NODE_VERSIONS } from './fs/node-version';
32
32
  export { getInstalledPackageVersion } from './get-installed-package-version';
33
33
  export { defaultCachePathGlob } from './default-cache-path-glob';
34
+ export { generateNodeBuilderFunctions } from './generate-node-builder-functions';