vercel-cli 48.6.6__py3-none-any.whl → 50.4.6__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.
Files changed (34) hide show
  1. vercel_cli/vendor/dist/index.js +70005 -64961
  2. vercel_cli/vendor/dist/vc.js +4 -3
  3. vercel_cli/vendor/node_modules/.package-lock.json +6 -6
  4. vercel_cli/vendor/node_modules/@vercel/build-utils/CHANGELOG.md +132 -0
  5. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/framework-helpers.d.ts +5 -4
  6. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/framework-helpers.js +28 -2
  7. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.js +8 -3
  8. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts +6 -0
  9. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.js +11 -0
  10. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts +25 -6
  11. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js +53 -11
  12. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/generate-node-builder-functions.d.ts +8 -2
  13. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/generate-node-builder-functions.js +4 -2
  14. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.d.ts +5 -4
  15. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.js +2545 -502
  16. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.d.ts +17 -0
  17. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.js +11 -1
  18. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/python.d.ts +22 -0
  19. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/python.js +85 -0
  20. vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.d.ts +9 -0
  21. vercel_cli/vendor/node_modules/@vercel/build-utils/lib/python/ast_parser.py +72 -0
  22. vercel_cli/vendor/node_modules/@vercel/build-utils/lib/python/tests/test_ast_parser.py +72 -0
  23. vercel_cli/vendor/node_modules/@vercel/build-utils/package.json +4 -4
  24. vercel_cli/vendor/node_modules/@vercel/python/dist/index.js +910 -421
  25. vercel_cli/vendor/node_modules/@vercel/python/package.json +3 -3
  26. vercel_cli/vendor/node_modules/@vercel/python/vc_init.py +371 -161
  27. vercel_cli/vendor/node_modules/@vercel/python/vc_init_dev_asgi.py +3 -2
  28. vercel_cli/vendor/package.json +5 -4
  29. {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/METADATA +1 -1
  30. {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/RECORD +34 -30
  31. {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/WHEEL +1 -1
  32. /vercel_cli/vendor/dist/{builder-worker.js → builder-worker.cjs} +0 -0
  33. /vercel_cli/vendor/dist/{get-latest-worker.js → get-latest-worker.cjs} +0 -0
  34. {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/entry_points.txt +0 -0
@@ -2,10 +2,12 @@
2
2
  import type { Config, Env, Files, FunctionFramework, TriggerEvent } from './types';
3
3
  export type { TriggerEvent };
4
4
  export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
5
+ export type LambdaExecutableRuntimeLanguages = 'rust' | 'go';
5
6
  export type LambdaArchitecture = 'x86_64' | 'arm64';
6
7
  export interface LambdaOptionsBase {
7
8
  handler: string;
8
9
  runtime: string;
10
+ runtimeLanguage?: LambdaExecutableRuntimeLanguages;
9
11
  architecture?: LambdaArchitecture;
10
12
  memory?: number;
11
13
  maxDuration?: number;
@@ -41,6 +43,11 @@ export interface LambdaOptionsBase {
41
43
  * When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
42
44
  */
43
45
  supportsCancellation?: boolean;
46
+ /**
47
+ * Whether to disable automatic fetch instrumentation.
48
+ * When true, the Function runtime will not automatically instrument fetch calls.
49
+ */
50
+ shouldDisableAutomaticFetchInstrumentation?: boolean;
44
51
  }
45
52
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
46
53
  files: Files;
@@ -70,6 +77,11 @@ export declare class Lambda {
70
77
  files?: Files;
71
78
  handler: string;
72
79
  runtime: string;
80
+ /**
81
+ * When using a generic runtime such as "executable" or "provided" (custom runtimes),
82
+ * this field can be used to specify the language the executable was compiled with.
83
+ */
84
+ runtimeLanguage?: LambdaExecutableRuntimeLanguages;
73
85
  architecture: LambdaArchitecture;
74
86
  memory?: number;
75
87
  maxDuration?: number;
@@ -105,6 +117,11 @@ export declare class Lambda {
105
117
  * When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
106
118
  */
107
119
  supportsCancellation?: boolean;
120
+ /**
121
+ * Whether to disable automatic fetch instrumentation.
122
+ * When true, the Function runtime will not automatically instrument fetch calls.
123
+ */
124
+ shouldDisableAutomaticFetchInstrumentation?: boolean;
108
125
  constructor(opts: LambdaOptions);
109
126
  createZip(): Promise<Buffer>;
110
127
  /**
@@ -60,6 +60,7 @@ class Lambda {
60
60
  const {
61
61
  handler,
62
62
  runtime,
63
+ runtimeLanguage,
63
64
  maxDuration,
64
65
  architecture,
65
66
  memory,
@@ -73,7 +74,8 @@ class Lambda {
73
74
  operationType,
74
75
  framework,
75
76
  experimentalTriggers,
76
- supportsCancellation
77
+ supportsCancellation,
78
+ shouldDisableAutomaticFetchInstrumentation
77
79
  } = opts;
78
80
  if ("files" in opts) {
79
81
  (0, import_assert.default)(typeof opts.files === "object", '"files" must be an object');
@@ -90,6 +92,12 @@ class Lambda {
90
92
  '"architecture" must be either "x86_64" or "arm64"'
91
93
  );
92
94
  }
95
+ if (runtimeLanguage !== void 0) {
96
+ (0, import_assert.default)(
97
+ runtimeLanguage === "rust" || runtimeLanguage === "go",
98
+ '"runtimeLanguage" is invalid. Valid options: "rust", "go"'
99
+ );
100
+ }
93
101
  if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) {
94
102
  (0, import_assert.default)(
95
103
  typeof opts.experimentalAllowBundling === "boolean",
@@ -213,6 +221,7 @@ class Lambda {
213
221
  this.files = "files" in opts ? opts.files : void 0;
214
222
  this.handler = handler;
215
223
  this.runtime = runtime;
224
+ this.runtimeLanguage = runtimeLanguage;
216
225
  this.architecture = getDefaultLambdaArchitecture(architecture);
217
226
  this.memory = memory;
218
227
  this.maxDuration = maxDuration;
@@ -227,6 +236,7 @@ class Lambda {
227
236
  this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
228
237
  this.experimentalTriggers = experimentalTriggers;
229
238
  this.supportsCancellation = supportsCancellation;
239
+ this.shouldDisableAutomaticFetchInstrumentation = shouldDisableAutomaticFetchInstrumentation;
230
240
  }
231
241
  async createZip() {
232
242
  let { zipBuffer } = this;
@@ -0,0 +1,22 @@
1
+ import FileFsRef from './file-fs-ref';
2
+ /**
3
+ * Run a Python script that only uses the standard library.
4
+ */
5
+ export declare function runStdlibPyScript(options: {
6
+ scriptName: string;
7
+ pythonPath?: string;
8
+ args?: string[];
9
+ cwd?: string;
10
+ }): Promise<{
11
+ exitCode: number;
12
+ stdout: string;
13
+ stderr: string;
14
+ }>;
15
+ /**
16
+ * Check if a Python file is a valid entrypoint by detecting:
17
+ * - A top-level 'app' callable (Flask, FastAPI, Sanic, WSGI/ASGI, etc.)
18
+ * - A top-level 'handler' class (BaseHTTPRequestHandler subclass)
19
+ */
20
+ export declare function isPythonEntrypoint(file: FileFsRef | {
21
+ fsPath?: string;
22
+ }): Promise<boolean>;
@@ -0,0 +1,85 @@
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 python_exports = {};
30
+ __export(python_exports, {
31
+ isPythonEntrypoint: () => isPythonEntrypoint,
32
+ runStdlibPyScript: () => runStdlibPyScript
33
+ });
34
+ module.exports = __toCommonJS(python_exports);
35
+ var import_fs = __toESM(require("fs"));
36
+ var import_path = require("path");
37
+ var import_execa = __toESM(require("execa"));
38
+ var import_debug = __toESM(require("./debug"));
39
+ const isWin = process.platform === "win32";
40
+ async function runStdlibPyScript(options) {
41
+ const { scriptName, pythonPath, args = [], cwd } = options;
42
+ const scriptPath = (0, import_path.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
43
+ if (!import_fs.default.existsSync(scriptPath)) {
44
+ throw new Error(`Python script not found: ${scriptPath}`);
45
+ }
46
+ const pythonCmd = pythonPath ?? (isWin ? "python" : "python3");
47
+ (0, import_debug.default)(
48
+ `Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`
49
+ );
50
+ try {
51
+ const result = await (0, import_execa.default)(pythonCmd, [scriptPath, ...args], { cwd });
52
+ return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
53
+ } catch (err) {
54
+ const execaErr = err;
55
+ return {
56
+ exitCode: execaErr.exitCode ?? 1,
57
+ stdout: execaErr.stdout ?? "",
58
+ stderr: execaErr.stderr ?? ""
59
+ };
60
+ }
61
+ }
62
+ async function isPythonEntrypoint(file) {
63
+ try {
64
+ const fsPath = file.fsPath;
65
+ if (!fsPath)
66
+ return false;
67
+ const content = await import_fs.default.promises.readFile(fsPath, "utf-8");
68
+ if (!content.includes("app") && !content.includes("handler") && !content.includes("Handler")) {
69
+ return false;
70
+ }
71
+ const result = await runStdlibPyScript({
72
+ scriptName: "ast_parser",
73
+ args: [fsPath]
74
+ });
75
+ return result.exitCode === 0;
76
+ } catch (err) {
77
+ (0, import_debug.default)(`Failed to check Python entrypoint: ${err}`);
78
+ return false;
79
+ }
80
+ }
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ isPythonEntrypoint,
84
+ runStdlibPyScript
85
+ });
@@ -346,6 +346,7 @@ export interface ProjectSettings {
346
346
  outputDirectory?: string | null;
347
347
  rootDirectory?: string | null;
348
348
  nodeVersion?: string;
349
+ monorepoManager?: string | null;
349
350
  createdAt?: number;
350
351
  autoExposeSystemEnvs?: boolean;
351
352
  sourceFilesOutsideRootDirectory?: boolean;
@@ -469,6 +470,14 @@ export interface BuildResultV2Typical {
469
470
  flags?: {
470
471
  definitions: FlagDefinitions;
471
472
  };
473
+ /**
474
+ * User-configured deployment ID for skew protection.
475
+ * This allows users to specify a custom deployment identifier
476
+ * in their next.config.js that will be used for version skew protection
477
+ * with pre-built deployments.
478
+ * @example "abc123"
479
+ */
480
+ deploymentId?: string;
472
481
  }
473
482
  export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
474
483
  export interface BuildResultV3 {
@@ -0,0 +1,72 @@
1
+ import sys
2
+ import ast
3
+
4
+
5
+ def contains_app_or_handler(file_path: str) -> bool:
6
+ """
7
+ Check if a Python file contains or exports:
8
+ - A top-level 'app' callable (e.g., Flask, FastAPI, Sanic apps)
9
+ - A top-level 'handler' class (e.g., BaseHTTPRequestHandler subclass)
10
+ """
11
+ with open(file_path, "r") as file:
12
+ code = file.read()
13
+
14
+ try:
15
+ tree = ast.parse(code)
16
+ except SyntaxError:
17
+ return False
18
+
19
+ for node in ast.iter_child_nodes(tree):
20
+ # Check for top-level assignment to 'app'
21
+ # e.g., app = Sanic() or app = Flask(__name__) or app = create_app()
22
+ if isinstance(node, ast.Assign):
23
+ for target in node.targets:
24
+ if isinstance(target, ast.Name) and target.id == "app":
25
+ return True
26
+
27
+ # Check for annotated assignment to 'app'
28
+ # e.g., app: Sanic = Sanic()
29
+ if isinstance(node, ast.AnnAssign):
30
+ if isinstance(node.target, ast.Name) and node.target.id == "app":
31
+ return True
32
+
33
+ # Check for function named 'app'
34
+ # e.g., def app(environ, start_response): ...
35
+ if isinstance(node, ast.FunctionDef) and node.name == "app":
36
+ return True
37
+
38
+ # Check for async function named 'app'
39
+ # e.g., async def app(scope, receive, send): ...
40
+ if isinstance(node, ast.AsyncFunctionDef) and node.name == "app":
41
+ return True
42
+
43
+ # Check for import of 'app'
44
+ # e.g., from server import app
45
+ # e.g., from server import application as app
46
+ if isinstance(node, ast.ImportFrom):
47
+ for alias in node.names:
48
+ # alias.asname is the 'as' name, alias.name is the original name
49
+ # If aliased, check asname; otherwise check the original name
50
+ imported_as = alias.asname if alias.asname else alias.name
51
+ if imported_as == "app":
52
+ return True
53
+
54
+ # Check for top-level class named 'handler'
55
+ # e.g., class handler(BaseHTTPRequestHandler):
56
+ if isinstance(node, ast.ClassDef) and node.name.lower() == "handler":
57
+ return True
58
+
59
+ return False
60
+
61
+
62
+ if __name__ == "__main__":
63
+ if len(sys.argv) != 2:
64
+ print("Usage: python ast_parser.py <file_path>")
65
+ sys.exit(1)
66
+
67
+ file_path = sys.argv[1]
68
+ result = contains_app_or_handler(file_path)
69
+
70
+ # Exit with 0 if found, 1 if not found
71
+ sys.exit(0 if result else 1)
72
+
@@ -0,0 +1,72 @@
1
+ import unittest
2
+ import tempfile
3
+ import os
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ sys.path.insert(0, str(Path(__file__).parent.parent))
8
+
9
+ from ast_parser import contains_app_or_handler
10
+
11
+
12
+ class TestContainsAppOrHandler(unittest.TestCase):
13
+ def _check(self, code: str) -> bool:
14
+ """Helper to test code snippets without needing fixture files."""
15
+ with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
16
+ f.write(code)
17
+ f.flush()
18
+ try:
19
+ return contains_app_or_handler(f.name)
20
+ finally:
21
+ os.unlink(f.name)
22
+
23
+ def test_flask_app(self):
24
+ self.assertTrue(self._check("from flask import Flask\napp = Flask(__name__)"))
25
+
26
+ def test_fastapi_app(self):
27
+ self.assertTrue(self._check("from fastapi import FastAPI\napp = FastAPI()"))
28
+
29
+ def test_sanic_app(self):
30
+ self.assertTrue(self._check("from sanic import Sanic\napp = Sanic('app')"))
31
+
32
+ def test_annotated_app(self):
33
+ self.assertTrue(self._check("from fastapi import FastAPI\napp: FastAPI = FastAPI()"))
34
+
35
+ def test_wsgi_function(self):
36
+ self.assertTrue(self._check("def app(environ, start_response):\n pass"))
37
+
38
+ def test_asgi_function(self):
39
+ self.assertTrue(self._check("async def app(scope, receive, send):\n pass"))
40
+
41
+ def test_imported_app(self):
42
+ self.assertTrue(self._check("from server import app"))
43
+
44
+ def test_imported_app_aliased(self):
45
+ self.assertTrue(self._check("from server import application as app"))
46
+
47
+ def test_handler_class(self):
48
+ self.assertTrue(self._check("class Handler:\n pass"))
49
+
50
+ def test_handler_class_lowercase(self):
51
+ self.assertTrue(self._check("class handler:\n pass"))
52
+
53
+ def test_no_app_or_handler(self):
54
+ self.assertFalse(self._check("def hello():\n return 'world'"))
55
+
56
+ def test_app_in_function_not_toplevel(self):
57
+ # app defined inside a function should NOT match
58
+ self.assertFalse(self._check("def create():\n app = Flask(__name__)\n return app"))
59
+
60
+ def test_syntax_error(self):
61
+ self.assertFalse(self._check("def broken("))
62
+
63
+ def test_empty_file(self):
64
+ self.assertFalse(self._check(""))
65
+
66
+ def test_only_comments(self):
67
+ self.assertFalse(self._check("# just a comment\n# another comment"))
68
+
69
+
70
+ if __name__ == "__main__":
71
+ unittest.main()
72
+
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "12.2.1",
3
+ "version": "13.2.12",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -26,8 +26,6 @@
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.3",
30
- "@vercel/routing-utils": "5.2.1",
31
29
  "aggregate-error": "3.0.1",
32
30
  "async-retry": "1.2.3",
33
31
  "async-sema": "2.1.4",
@@ -48,7 +46,9 @@
48
46
  "typescript": "4.9.5",
49
47
  "yazl": "2.5.1",
50
48
  "vitest": "2.0.1",
51
- "json5": "2.2.3"
49
+ "json5": "2.2.3",
50
+ "@vercel/error-utils": "2.0.3",
51
+ "@vercel/routing-utils": "5.3.2"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "node build.mjs",