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.
- vercel_cli/vendor/dist/index.js +70005 -64961
- vercel_cli/vendor/dist/vc.js +4 -3
- vercel_cli/vendor/node_modules/.package-lock.json +6 -6
- vercel_cli/vendor/node_modules/@vercel/build-utils/CHANGELOG.md +132 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/framework-helpers.d.ts +5 -4
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/framework-helpers.js +28 -2
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.js +8 -3
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts +6 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.js +11 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts +25 -6
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js +53 -11
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/generate-node-builder-functions.d.ts +8 -2
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/generate-node-builder-functions.js +4 -2
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.d.ts +5 -4
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.js +2545 -502
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.d.ts +17 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.js +11 -1
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/python.d.ts +22 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/python.js +85 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.d.ts +9 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/lib/python/ast_parser.py +72 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/lib/python/tests/test_ast_parser.py +72 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/package.json +4 -4
- vercel_cli/vendor/node_modules/@vercel/python/dist/index.js +910 -421
- vercel_cli/vendor/node_modules/@vercel/python/package.json +3 -3
- vercel_cli/vendor/node_modules/@vercel/python/vc_init.py +371 -161
- vercel_cli/vendor/node_modules/@vercel/python/vc_init_dev_asgi.py +3 -2
- vercel_cli/vendor/package.json +5 -4
- {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/METADATA +1 -1
- {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/RECORD +34 -30
- {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/WHEEL +1 -1
- /vercel_cli/vendor/dist/{builder-worker.js → builder-worker.cjs} +0 -0
- /vercel_cli/vendor/dist/{get-latest-worker.js → get-latest-worker.cjs} +0 -0
- {vercel_cli-48.6.6.dist-info → vercel_cli-50.4.6.dist-info}/entry_points.txt +0 -0
vercel_cli/vendor/dist/vc.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
2
|
// This shim defers loading the real module until the compile cache is enabled.
|
|
4
3
|
// https://nodejs.org/api/module.html#moduleenablecompilecachecachedir
|
|
4
|
+
// enableCompileCache was added in Node.js 22.8.0, so we need to handle older versions.
|
|
5
5
|
try {
|
|
6
|
-
const { enableCompileCache } =
|
|
6
|
+
const { enableCompileCache } = await import('node:module');
|
|
7
7
|
if (enableCompileCache) {
|
|
8
8
|
enableCompileCache();
|
|
9
9
|
}
|
|
10
10
|
} catch {}
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
await import('./index.js');
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"requires": true,
|
|
4
4
|
"packages": {
|
|
5
5
|
"node_modules/@vercel/build-utils": {
|
|
6
|
-
"version": "
|
|
7
|
-
"resolved": "https://registry.npmjs.org/@vercel/build-utils/-/build-utils-
|
|
8
|
-
"integrity": "sha512-
|
|
6
|
+
"version": "13.2.12",
|
|
7
|
+
"resolved": "https://registry.npmjs.org/@vercel/build-utils/-/build-utils-13.2.12.tgz",
|
|
8
|
+
"integrity": "sha512-jUzCgg/E+k3OfEgVF3kPuTMIpKpofhUfPdmBXqbKBCjVGA+jofveOVxzu3mPvNwCXXjdzfVSSCbPFIc4SP5irA==",
|
|
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": "
|
|
22
|
-
"resolved": "https://registry.npmjs.org/@vercel/python/-/python-
|
|
23
|
-
"integrity": "sha512-
|
|
21
|
+
"version": "6.1.6",
|
|
22
|
+
"resolved": "https://registry.npmjs.org/@vercel/python/-/python-6.1.6.tgz",
|
|
23
|
+
"integrity": "sha512-4N9doC1i97rx6nh8h05GiDWfnAIRZLVjKKg+hJmxBO5aVWr8uyXrM337KFC4NF6rxutMHsXAp5DBe/M+dOJDKg==",
|
|
24
24
|
"license": "Apache-2.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,5 +1,137 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.2.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add `findPackageJson` function for optimized package.json lookup without lockfile scanning. This improves `getNodeVersion` performance by avoiding unnecessary lockfile parsing. ([#14658](https://github.com/vercel/vercel/pull/14658))
|
|
8
|
+
|
|
9
|
+
## 13.2.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Add 'go' as a valid runtimeLanguage option for Lambda functions ([#14624](https://github.com/vercel/vercel/pull/14624))
|
|
14
|
+
|
|
15
|
+
## 13.2.9
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- replace getRuntimeNodeVersion with getNodeVersion ([#14622](https://github.com/vercel/vercel/pull/14622))
|
|
20
|
+
|
|
21
|
+
## 13.2.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Remove getSpawnOptions ([#14604](https://github.com/vercel/vercel/pull/14604))
|
|
26
|
+
|
|
27
|
+
## 13.2.7
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Replace getNodeVersion with getRuntimeNodeVersion ([#14600](https://github.com/vercel/vercel/pull/14600))
|
|
32
|
+
|
|
33
|
+
- Add zero-config support for Koa.js ([#14567](https://github.com/vercel/vercel/pull/14567))
|
|
34
|
+
|
|
35
|
+
## 13.2.6
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Update http links in Node.js version incompatibility message to https ([#14583](https://github.com/vercel/vercel/pull/14583))
|
|
40
|
+
|
|
41
|
+
- Ensure internal build step runs if a build script is missing ([#14564](https://github.com/vercel/vercel/pull/14564))
|
|
42
|
+
|
|
43
|
+
## 13.2.5
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Adding in user configured deploymentId to build output type ([#14497](https://github.com/vercel/vercel/pull/14497))
|
|
48
|
+
|
|
49
|
+
- skip secondary installation for vercel.ts ([#14471](https://github.com/vercel/vercel/pull/14471))
|
|
50
|
+
|
|
51
|
+
## 13.2.4
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [python] only create api builders for `.py` files that export an app or handler ([#14493](https://github.com/vercel/vercel/pull/14493))
|
|
56
|
+
|
|
57
|
+
## 13.2.3
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Use `workspace:*` for workspace dependencies ([#14396](https://github.com/vercel/vercel/pull/14396))
|
|
62
|
+
|
|
63
|
+
## 13.2.2
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Bump NFT dependency ([#14373](https://github.com/vercel/vercel/pull/14373))
|
|
68
|
+
|
|
69
|
+
## 13.2.1
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Disables auto instrumentation when the app has manual instrumentation setup ([#14345](https://github.com/vercel/vercel/pull/14345))
|
|
74
|
+
|
|
75
|
+
## 13.2.0
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- Remove env var check for node24 ([#14355](https://github.com/vercel/vercel/pull/14355))
|
|
80
|
+
|
|
81
|
+
## 13.1.2
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Support `runtimeLanguage` in build-utils ([#14344](https://github.com/vercel/vercel/pull/14344))
|
|
86
|
+
|
|
87
|
+
## 13.1.1
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Only run introspection when isExperimentalBackendsWithoutIntrospectionEnabled is truthy ([#14336](https://github.com/vercel/vercel/pull/14336))
|
|
92
|
+
|
|
93
|
+
## 13.1.0
|
|
94
|
+
|
|
95
|
+
### Minor Changes
|
|
96
|
+
|
|
97
|
+
- Remove --unsafe-perm from npm install command ([#14302](https://github.com/vercel/vercel/pull/14302))
|
|
98
|
+
|
|
99
|
+
## 13.0.2
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Improve warning messages surrounding Elysia ([#14272](https://github.com/vercel/vercel/pull/14272))
|
|
104
|
+
|
|
105
|
+
## 13.0.1
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Revert "Remove getSpawnOptions" ([#14261](https://github.com/vercel/vercel/pull/14261))
|
|
110
|
+
|
|
111
|
+
## 13.0.0
|
|
112
|
+
|
|
113
|
+
### Major Changes
|
|
114
|
+
|
|
115
|
+
- Remove getSpawnOptions ([#14176](https://github.com/vercel/vercel/pull/14176))
|
|
116
|
+
|
|
117
|
+
## 12.2.4
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Add helper for detecting backend builders ([#14182](https://github.com/vercel/vercel/pull/14182))
|
|
122
|
+
|
|
123
|
+
## 12.2.3
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Add Elysia framework ([#14164](https://github.com/vercel/vercel/pull/14164))
|
|
128
|
+
|
|
129
|
+
## 12.2.2
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Allow Node.js 24 behind env var feature flag ([#14160](https://github.com/vercel/vercel/pull/14160))
|
|
134
|
+
|
|
3
135
|
## 12.2.1
|
|
4
136
|
|
|
5
137
|
### Patch Changes
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { Builder } from '.';
|
|
1
2
|
/**
|
|
2
3
|
* List of backend frameworks supported by the experimental backends feature
|
|
3
4
|
*/
|
|
4
|
-
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "nestjs", "fastify"];
|
|
5
|
+
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
|
|
6
|
+
export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/koa", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
|
|
5
7
|
export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
|
|
6
8
|
/**
|
|
7
9
|
* Checks if the given framework is a backend framework
|
|
8
10
|
*/
|
|
9
11
|
export declare function isBackendFramework(framework: string | null | undefined): framework is BackendFramework;
|
|
10
|
-
|
|
11
|
-
* Checks if experimental backends are enabled via environment variable
|
|
12
|
-
*/
|
|
12
|
+
export declare function isExperimentalBackendsWithoutIntrospectionEnabled(): boolean;
|
|
13
13
|
export declare function isExperimentalBackendsEnabled(): boolean;
|
|
14
|
+
export declare function isBackendBuilder(builder: Builder | null | undefined): boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Checks if experimental backends are enabled AND the framework is a backend framework
|
|
16
17
|
*/
|
|
@@ -18,9 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var framework_helpers_exports = {};
|
|
20
20
|
__export(framework_helpers_exports, {
|
|
21
|
+
BACKEND_BUILDERS: () => BACKEND_BUILDERS,
|
|
21
22
|
BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
|
|
23
|
+
isBackendBuilder: () => isBackendBuilder,
|
|
22
24
|
isBackendFramework: () => isBackendFramework,
|
|
23
25
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
26
|
+
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
24
27
|
shouldUseExperimentalBackends: () => shouldUseExperimentalBackends
|
|
25
28
|
});
|
|
26
29
|
module.exports = __toCommonJS(framework_helpers_exports);
|
|
@@ -28,25 +31,48 @@ const BACKEND_FRAMEWORKS = [
|
|
|
28
31
|
"express",
|
|
29
32
|
"hono",
|
|
30
33
|
"h3",
|
|
34
|
+
"koa",
|
|
31
35
|
"nestjs",
|
|
32
|
-
"fastify"
|
|
36
|
+
"fastify",
|
|
37
|
+
"elysia"
|
|
38
|
+
];
|
|
39
|
+
const BACKEND_BUILDERS = [
|
|
40
|
+
"@vercel/express",
|
|
41
|
+
"@vercel/hono",
|
|
42
|
+
"@vercel/h3",
|
|
43
|
+
"@vercel/koa",
|
|
44
|
+
"@vercel/nestjs",
|
|
45
|
+
"@vercel/fastify",
|
|
46
|
+
"@vercel/elysia"
|
|
33
47
|
];
|
|
34
48
|
function isBackendFramework(framework) {
|
|
35
49
|
if (!framework)
|
|
36
50
|
return false;
|
|
37
51
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
38
52
|
}
|
|
53
|
+
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
54
|
+
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
55
|
+
}
|
|
39
56
|
function isExperimentalBackendsEnabled() {
|
|
40
|
-
return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
|
|
57
|
+
return isExperimentalBackendsWithoutIntrospectionEnabled() || process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
|
|
41
58
|
process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
|
|
42
59
|
}
|
|
60
|
+
function isBackendBuilder(builder) {
|
|
61
|
+
if (!builder)
|
|
62
|
+
return false;
|
|
63
|
+
const use = builder.use;
|
|
64
|
+
return BACKEND_BUILDERS.includes(use);
|
|
65
|
+
}
|
|
43
66
|
function shouldUseExperimentalBackends(framework) {
|
|
44
67
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
45
68
|
}
|
|
46
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
70
|
0 && (module.exports = {
|
|
71
|
+
BACKEND_BUILDERS,
|
|
48
72
|
BACKEND_FRAMEWORKS,
|
|
73
|
+
isBackendBuilder,
|
|
49
74
|
isBackendFramework,
|
|
50
75
|
isExperimentalBackendsEnabled,
|
|
76
|
+
isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
51
77
|
shouldUseExperimentalBackends
|
|
52
78
|
});
|
|
@@ -45,6 +45,11 @@ var import_types = require("../types");
|
|
|
45
45
|
var import_errors = require("../errors");
|
|
46
46
|
var import_debug = __toESM(require("../debug"));
|
|
47
47
|
const NODE_VERSIONS = [
|
|
48
|
+
new import_types.NodeVersion({
|
|
49
|
+
major: 24,
|
|
50
|
+
range: "24.x",
|
|
51
|
+
runtime: "nodejs24.x"
|
|
52
|
+
}),
|
|
48
53
|
new import_types.NodeVersion({
|
|
49
54
|
major: 22,
|
|
50
55
|
range: "22.x",
|
|
@@ -100,7 +105,7 @@ const BUN_VERSIONS = [
|
|
|
100
105
|
})
|
|
101
106
|
];
|
|
102
107
|
function getNodeVersionByMajor(major) {
|
|
103
|
-
return
|
|
108
|
+
return getOptions().find((v) => v.major === major);
|
|
104
109
|
}
|
|
105
110
|
function getOptions() {
|
|
106
111
|
return NODE_VERSIONS;
|
|
@@ -147,7 +152,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
147
152
|
if (!found) {
|
|
148
153
|
throw new import_errors.NowBuildError({
|
|
149
154
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
|
150
|
-
link: "
|
|
155
|
+
link: "https://vercel.link/node-version",
|
|
151
156
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
|
|
152
157
|
isAuto,
|
|
153
158
|
availableVersions
|
|
@@ -162,7 +167,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
162
167
|
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
|
|
163
168
|
throw new import_errors.NowBuildError({
|
|
164
169
|
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
165
|
-
link: "
|
|
170
|
+
link: "https://vercel.link/node-version",
|
|
166
171
|
message: `${intro} ${getHint(isAuto)}`
|
|
167
172
|
});
|
|
168
173
|
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
import type { PackageJson } from '../types';
|
|
1
2
|
export declare function readConfigFile<T>(files: string | string[]): Promise<T | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Reads and parses the package.json file from a directory.
|
|
5
|
+
* Returns an empty object if the file doesn't exist or can't be parsed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPackageJson(dir: string): Promise<PackageJson>;
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var read_config_file_exports = {};
|
|
30
30
|
__export(read_config_file_exports, {
|
|
31
|
+
getPackageJson: () => getPackageJson,
|
|
31
32
|
readConfigFile: () => readConfigFile
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(read_config_file_exports);
|
|
@@ -35,6 +36,7 @@ var import_js_yaml = __toESM(require("js-yaml"));
|
|
|
35
36
|
var import_toml = __toESM(require("@iarna/toml"));
|
|
36
37
|
var import_fs_extra = require("fs-extra");
|
|
37
38
|
var import_error_utils = require("@vercel/error-utils");
|
|
39
|
+
var import_path = require("path");
|
|
38
40
|
async function readFileOrNull(file) {
|
|
39
41
|
try {
|
|
40
42
|
const data = await (0, import_fs_extra.readFile)(file);
|
|
@@ -70,7 +72,16 @@ async function readConfigFile(files) {
|
|
|
70
72
|
}
|
|
71
73
|
return null;
|
|
72
74
|
}
|
|
75
|
+
async function getPackageJson(dir) {
|
|
76
|
+
const packagePath = (0, import_path.join)(dir, "package.json");
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(await (0, import_fs_extra.readFile)(packagePath, "utf8"));
|
|
79
|
+
} catch (err) {
|
|
80
|
+
return {};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
73
83
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
84
|
0 && (module.exports = {
|
|
85
|
+
getPackageJson,
|
|
75
86
|
readConfigFile
|
|
76
87
|
});
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
import { SpawnOptions } from 'child_process';
|
|
3
3
|
import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
|
|
4
4
|
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
|
|
5
|
-
export interface
|
|
6
|
-
/**
|
|
7
|
-
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
|
8
|
-
*/
|
|
9
|
-
cliType: CliType;
|
|
5
|
+
export interface FindPackageJsonResult {
|
|
10
6
|
/**
|
|
11
7
|
* The file path of found `package.json` file, or `undefined` if not found.
|
|
12
8
|
*/
|
|
@@ -16,6 +12,12 @@ export interface ScanParentDirsResult {
|
|
|
16
12
|
* option is enabled.
|
|
17
13
|
*/
|
|
18
14
|
packageJson?: PackageJson;
|
|
15
|
+
}
|
|
16
|
+
export interface ScanParentDirsResult extends FindPackageJsonResult {
|
|
17
|
+
/**
|
|
18
|
+
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
|
19
|
+
*/
|
|
20
|
+
cliType: CliType;
|
|
19
21
|
/**
|
|
20
22
|
* The file path of the lockfile (`yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`)
|
|
21
23
|
* or `undefined` if not found.
|
|
@@ -84,14 +86,31 @@ export declare function getNodeBinPath({ cwd, }: {
|
|
|
84
86
|
}): Promise<string>;
|
|
85
87
|
export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesProps): string[];
|
|
86
88
|
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Don't use this function directly.
|
|
91
|
+
*
|
|
92
|
+
* Use getEnvForPackageManager() instead when within a builder.
|
|
93
|
+
*/
|
|
87
94
|
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
|
|
88
95
|
export declare function getNodeVersion(destPath: string, fallbackVersion?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion | BunVersion>;
|
|
96
|
+
/**
|
|
97
|
+
* Traverses up directories to find and optionally read package.json.
|
|
98
|
+
* This is a lightweight alternative to `scanParentDirs` when only
|
|
99
|
+
* package.json information is needed (without lockfile detection).
|
|
100
|
+
*/
|
|
101
|
+
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
|
|
89
102
|
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
|
|
90
103
|
export declare function turboVersionSpecifierSupportsCorepack(turboVersionSpecifier: string): boolean;
|
|
91
104
|
export declare function usingCorepack(env: {
|
|
92
105
|
[x: string]: string | undefined;
|
|
93
106
|
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
|
|
94
107
|
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Reset the customInstallCommandSet. This should be called at the start of each build
|
|
110
|
+
* to prevent custom install commands from being skipped due to the set persisting
|
|
111
|
+
* across multiple builds in the same Node process (e.g., in unit tests).
|
|
112
|
+
*/
|
|
113
|
+
export declare function resetCustomInstallCommandSet(): void;
|
|
95
114
|
export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, projectCreatedAt?: number): Promise<boolean>;
|
|
96
115
|
/**
|
|
97
116
|
* Prepares the input environment based on the used package manager and lockfile
|
|
@@ -189,7 +208,7 @@ export declare function runCustomInstallCommand({ destPath, installCommand, spaw
|
|
|
189
208
|
installCommand: string;
|
|
190
209
|
spawnOpts?: SpawnOptions;
|
|
191
210
|
projectCreatedAt?: number;
|
|
192
|
-
}): Promise<
|
|
211
|
+
}): Promise<boolean>;
|
|
193
212
|
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions, projectCreatedAt?: number): Promise<boolean>;
|
|
194
213
|
export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
|
|
195
214
|
export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
|
|
@@ -31,6 +31,7 @@ __export(run_user_scripts_exports, {
|
|
|
31
31
|
PNPM_10_PREFERRED_AT: () => PNPM_10_PREFERRED_AT,
|
|
32
32
|
detectPackageManager: () => detectPackageManager,
|
|
33
33
|
execCommand: () => execCommand,
|
|
34
|
+
findPackageJson: () => findPackageJson,
|
|
34
35
|
getEnvForPackageManager: () => getEnvForPackageManager,
|
|
35
36
|
getNodeBinPath: () => getNodeBinPath,
|
|
36
37
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
@@ -40,6 +41,7 @@ __export(run_user_scripts_exports, {
|
|
|
40
41
|
getScriptName: () => getScriptName,
|
|
41
42
|
getSpawnOptions: () => getSpawnOptions,
|
|
42
43
|
installDependencies: () => installDependencies,
|
|
44
|
+
resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
|
|
43
45
|
runBundleInstall: () => runBundleInstall,
|
|
44
46
|
runCustomInstallCommand: () => runCustomInstallCommand,
|
|
45
47
|
runNpmInstall: () => runNpmInstall,
|
|
@@ -211,7 +213,7 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
|
|
|
211
213
|
latestVersion.runtime = "nodejs";
|
|
212
214
|
return latestVersion;
|
|
213
215
|
}
|
|
214
|
-
const { packageJson } = await
|
|
216
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
215
217
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
216
218
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
217
219
|
const supportedNodeVersion = await (0, import_node_version.getSupportedNodeVersion)(
|
|
@@ -223,22 +225,22 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
|
|
|
223
225
|
const { node } = packageJson.engines;
|
|
224
226
|
if (configuredVersion && !(0, import_semver.intersects)(configuredVersion, supportedNodeVersion.range)) {
|
|
225
227
|
console.warn(
|
|
226
|
-
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More:
|
|
228
|
+
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More: https://vercel.link/node-version`
|
|
227
229
|
);
|
|
228
230
|
}
|
|
229
231
|
if ((0, import_semver.coerce)(node)?.raw === node) {
|
|
230
232
|
console.warn(
|
|
231
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More:
|
|
233
|
+
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: https://vercel.link/node-version`
|
|
232
234
|
);
|
|
233
235
|
} else if ((0, import_semver.validRange)(node) && (0, import_semver.intersects)(`${latestVersion.major + 1}.x`, node)) {
|
|
234
236
|
console.warn(
|
|
235
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More:
|
|
237
|
+
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version`
|
|
236
238
|
);
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
return supportedNodeVersion;
|
|
240
242
|
}
|
|
241
|
-
async function
|
|
243
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
242
244
|
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
243
245
|
const pkgJsonPath = await walkParentDirs({
|
|
244
246
|
base,
|
|
@@ -255,6 +257,18 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
|
255
257
|
);
|
|
256
258
|
}
|
|
257
259
|
}
|
|
260
|
+
return {
|
|
261
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
262
|
+
packageJson
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
266
|
+
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
267
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(
|
|
268
|
+
destPath,
|
|
269
|
+
readPackageJson,
|
|
270
|
+
base
|
|
271
|
+
);
|
|
258
272
|
const {
|
|
259
273
|
paths: [
|
|
260
274
|
yarnLockPath,
|
|
@@ -474,7 +488,7 @@ function getInstallCommandForPackageManager(packageManager, args) {
|
|
|
474
488
|
case "npm":
|
|
475
489
|
return {
|
|
476
490
|
prettyCommand: "npm install",
|
|
477
|
-
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit"
|
|
491
|
+
commandArguments: args.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit"])
|
|
478
492
|
};
|
|
479
493
|
case "pnpm":
|
|
480
494
|
return {
|
|
@@ -526,6 +540,10 @@ function checkIfAlreadyInstalled(runNpmInstallSet, packageJsonPath) {
|
|
|
526
540
|
return { alreadyInstalled, runNpmInstallSet: initializedRunNpmInstallSet };
|
|
527
541
|
}
|
|
528
542
|
const runNpmInstallSema = new import_async_sema.default(1);
|
|
543
|
+
let customInstallCommandSet;
|
|
544
|
+
function resetCustomInstallCommandSet() {
|
|
545
|
+
customInstallCommandSet = void 0;
|
|
546
|
+
}
|
|
529
547
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
|
|
530
548
|
if (meta?.isDev) {
|
|
531
549
|
(0, import_debug.default)("Skipping dependency installation because dev mode is enabled");
|
|
@@ -557,6 +575,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
557
575
|
if (alreadyInstalled) {
|
|
558
576
|
return false;
|
|
559
577
|
}
|
|
578
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
579
|
+
(0, import_debug.default)(
|
|
580
|
+
`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`
|
|
581
|
+
);
|
|
582
|
+
runNpmInstallSet.add(packageJsonPath);
|
|
583
|
+
meta.runNpmInstallSet = runNpmInstallSet;
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
560
586
|
meta.runNpmInstallSet = runNpmInstallSet;
|
|
561
587
|
}
|
|
562
588
|
if (cliType === "yarn") {
|
|
@@ -667,11 +693,6 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
667
693
|
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
|
|
668
694
|
);
|
|
669
695
|
}
|
|
670
|
-
if (cliType === "bun") {
|
|
671
|
-
console.warn(
|
|
672
|
-
"Warning: Bun is used as a package manager at build time only, not at runtime with Functions"
|
|
673
|
-
);
|
|
674
|
-
}
|
|
675
696
|
}
|
|
676
697
|
}
|
|
677
698
|
if (cliType === "yarn" && !env.YARN_NODE_LINKER) {
|
|
@@ -951,6 +972,24 @@ async function runCustomInstallCommand({
|
|
|
951
972
|
spawnOpts,
|
|
952
973
|
projectCreatedAt
|
|
953
974
|
}) {
|
|
975
|
+
const normalizedPath = import_path.default.normalize(destPath);
|
|
976
|
+
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(
|
|
977
|
+
customInstallCommandSet,
|
|
978
|
+
normalizedPath
|
|
979
|
+
);
|
|
980
|
+
customInstallCommandSet = runNpmInstallSet;
|
|
981
|
+
if (alreadyInstalled) {
|
|
982
|
+
(0, import_debug.default)(
|
|
983
|
+
`Skipping custom install command for ${normalizedPath} because it was already run`
|
|
984
|
+
);
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
988
|
+
(0, import_debug.default)(
|
|
989
|
+
`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
|
|
990
|
+
);
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
954
993
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
955
994
|
const {
|
|
956
995
|
cliType,
|
|
@@ -974,6 +1013,7 @@ async function runCustomInstallCommand({
|
|
|
974
1013
|
env,
|
|
975
1014
|
cwd: destPath
|
|
976
1015
|
});
|
|
1016
|
+
return true;
|
|
977
1017
|
}
|
|
978
1018
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
|
|
979
1019
|
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
@@ -1062,6 +1102,7 @@ const installDependencies = (0, import_util.deprecate)(
|
|
|
1062
1102
|
PNPM_10_PREFERRED_AT,
|
|
1063
1103
|
detectPackageManager,
|
|
1064
1104
|
execCommand,
|
|
1105
|
+
findPackageJson,
|
|
1065
1106
|
getEnvForPackageManager,
|
|
1066
1107
|
getNodeBinPath,
|
|
1067
1108
|
getNodeBinPaths,
|
|
@@ -1071,6 +1112,7 @@ const installDependencies = (0, import_util.deprecate)(
|
|
|
1071
1112
|
getScriptName,
|
|
1072
1113
|
getSpawnOptions,
|
|
1073
1114
|
installDependencies,
|
|
1115
|
+
resetCustomInstallCommandSet,
|
|
1074
1116
|
runBundleInstall,
|
|
1075
1117
|
runCustomInstallCommand,
|
|
1076
1118
|
runNpmInstall,
|
vercel_cli/vendor/node_modules/@vercel/build-utils/dist/generate-node-builder-functions.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { BuildV3 } from './types';
|
|
1
|
+
import { BuildV3, Config } from './types';
|
|
2
2
|
import type FileFsRef from './file-fs-ref';
|
|
3
|
-
export declare function generateNodeBuilderFunctions(frameworkName: string, regex: RegExp, validFilenames: string[], validExtensions: string[], nodeBuild: any
|
|
3
|
+
export declare function generateNodeBuilderFunctions(frameworkName: string, regex: RegExp, validFilenames: string[], validExtensions: string[], nodeBuild: any, // necessary to avoid circular dependency
|
|
4
|
+
opts?: {
|
|
5
|
+
checks?: (info: {
|
|
6
|
+
config: Config;
|
|
7
|
+
isBun: boolean;
|
|
8
|
+
}) => void;
|
|
9
|
+
}): {
|
|
4
10
|
require_: NodeRequire;
|
|
5
11
|
findEntrypoint: (files: Record<string, FileFsRef>) => {
|
|
6
12
|
entrypoint: string;
|
|
@@ -35,7 +35,7 @@ var import_glob = __toESM(require("./fs/glob"));
|
|
|
35
35
|
var import_node_path = require("node:path");
|
|
36
36
|
var import_node_fs = __toESM(require("node:fs"));
|
|
37
37
|
var import_node_module = require("node:module");
|
|
38
|
-
function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild) {
|
|
38
|
+
function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild, opts) {
|
|
39
39
|
const entrypointsForMessage = validFilenames.map((filename) => `- ${filename}.{${validExtensions.join(",")}}`).join("\n");
|
|
40
40
|
const require_ = (0, import_node_module.createRequire)(__filename);
|
|
41
41
|
const build = async (args) => {
|
|
@@ -57,7 +57,9 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
|
|
|
57
57
|
considerBuildCommand: true,
|
|
58
58
|
entrypointCallback: async () => {
|
|
59
59
|
return entrypointCallback(args);
|
|
60
|
-
}
|
|
60
|
+
},
|
|
61
|
+
checks: opts?.checks ?? (() => {
|
|
62
|
+
})
|
|
61
63
|
});
|
|
62
64
|
let version = void 0;
|
|
63
65
|
try {
|
|
@@ -8,7 +8,7 @@ import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory }
|
|
|
8
8
|
import getWriteableDirectory from './fs/get-writable-directory';
|
|
9
9
|
import glob, { GlobOptions } from './fs/glob';
|
|
10
10
|
import rename from './fs/rename';
|
|
11
|
-
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, traverseUpDirectories } from './fs/run-user-scripts';
|
|
11
|
+
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, findPackageJson, traverseUpDirectories } from './fs/run-user-scripts';
|
|
12
12
|
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion } from './fs/node-version';
|
|
13
13
|
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
|
|
14
14
|
import debug from './debug';
|
|
@@ -18,9 +18,9 @@ import { getPrefixedEnvVars } from './get-prefixed-env-vars';
|
|
|
18
18
|
import { cloneEnv } from './clone-env';
|
|
19
19
|
import { hardLinkDir } from './hard-link-dir';
|
|
20
20
|
import { validateNpmrc } from './validate-npmrc';
|
|
21
|
-
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
|
|
21
|
+
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
|
|
22
22
|
export { EdgeFunction } from './edge-function';
|
|
23
|
-
export { readConfigFile } from './fs/read-config-file';
|
|
23
|
+
export { readConfigFile, getPackageJson } from './fs/read-config-file';
|
|
24
24
|
export { normalizePath } from './fs/normalize-path';
|
|
25
25
|
export { getOsRelease, getProvidedRuntime } from './os';
|
|
26
26
|
export * from './should-serve';
|
|
@@ -32,4 +32,5 @@ 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
34
|
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
|
|
35
|
-
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isExperimentalBackendsEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
|
|
35
|
+
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
|
|
36
|
+
export * from './python';
|