@vercel/build-utils 13.2.5 → 13.2.6
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 +8 -0
- package/dist/fs/node-version.js +2 -2
- package/dist/fs/read-config-file.d.ts +6 -0
- package/dist/fs/read-config-file.js +11 -0
- package/dist/fs/run-user-scripts.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +63 -52
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update http links in Node.js version incompatibility message to https ([#14583](https://github.com/vercel/vercel/pull/14583))
|
|
8
|
+
|
|
9
|
+
- Ensure internal build step runs if a build script is missing ([#14564](https://github.com/vercel/vercel/pull/14564))
|
|
10
|
+
|
|
3
11
|
## 13.2.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/fs/node-version.js
CHANGED
|
@@ -152,7 +152,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
152
152
|
if (!found) {
|
|
153
153
|
throw new import_errors.NowBuildError({
|
|
154
154
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
|
155
|
-
link: "
|
|
155
|
+
link: "https://vercel.link/node-version",
|
|
156
156
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
|
|
157
157
|
isAuto,
|
|
158
158
|
availableVersions
|
|
@@ -167,7 +167,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
167
167
|
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
|
|
168
168
|
throw new import_errors.NowBuildError({
|
|
169
169
|
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
170
|
-
link: "
|
|
170
|
+
link: "https://vercel.link/node-version",
|
|
171
171
|
message: `${intro} ${getHint(isAuto)}`
|
|
172
172
|
});
|
|
173
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
|
});
|
|
@@ -224,16 +224,16 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
|
|
|
224
224
|
const { node } = packageJson.engines;
|
|
225
225
|
if (configuredVersion && !(0, import_semver.intersects)(configuredVersion, supportedNodeVersion.range)) {
|
|
226
226
|
console.warn(
|
|
227
|
-
`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:
|
|
227
|
+
`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`
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
230
|
if ((0, import_semver.coerce)(node)?.raw === node) {
|
|
231
231
|
console.warn(
|
|
232
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More:
|
|
232
|
+
`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`
|
|
233
233
|
);
|
|
234
234
|
} else if ((0, import_semver.validRange)(node) && (0, import_semver.intersects)(`${latestVersion.major + 1}.x`, node)) {
|
|
235
235
|
console.warn(
|
|
236
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More:
|
|
236
|
+
`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`
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
239
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { hardLinkDir } from './hard-link-dir';
|
|
|
20
20
|
import { validateNpmrc } from './validate-npmrc';
|
|
21
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, 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';
|
package/dist/index.js
CHANGED
|
@@ -318,7 +318,7 @@ var require_BufferList = __commonJS({
|
|
|
318
318
|
this.head = this.tail = null;
|
|
319
319
|
this.length = 0;
|
|
320
320
|
};
|
|
321
|
-
BufferList.prototype.join = function
|
|
321
|
+
BufferList.prototype.join = function join6(s) {
|
|
322
322
|
if (this.length === 0)
|
|
323
323
|
return "";
|
|
324
324
|
var p = this.head;
|
|
@@ -23752,6 +23752,7 @@ __export(src_exports, {
|
|
|
23752
23752
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
23753
23753
|
getNodeVersion: () => getNodeVersion,
|
|
23754
23754
|
getOsRelease: () => getOsRelease,
|
|
23755
|
+
getPackageJson: () => getPackageJson,
|
|
23755
23756
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
23756
23757
|
getPlatformEnv: () => getPlatformEnv,
|
|
23757
23758
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
@@ -24832,7 +24833,7 @@ function rename(files, delegate) {
|
|
|
24832
24833
|
// src/fs/run-user-scripts.ts
|
|
24833
24834
|
var import_assert6 = __toESM(require("assert"));
|
|
24834
24835
|
var import_fs_extra7 = __toESM(require_lib());
|
|
24835
|
-
var
|
|
24836
|
+
var import_path6 = __toESM(require("path"));
|
|
24836
24837
|
var import_async_sema4 = __toESM(require_async_sema());
|
|
24837
24838
|
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
24838
24839
|
var import_semver2 = __toESM(require_semver2());
|
|
@@ -24974,7 +24975,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
24974
24975
|
if (!found) {
|
|
24975
24976
|
throw new NowBuildError({
|
|
24976
24977
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
|
24977
|
-
link: "
|
|
24978
|
+
link: "https://vercel.link/node-version",
|
|
24978
24979
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
|
|
24979
24980
|
isAuto,
|
|
24980
24981
|
availableVersions
|
|
@@ -24989,7 +24990,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
|
24989
24990
|
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
|
|
24990
24991
|
throw new NowBuildError({
|
|
24991
24992
|
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
24992
|
-
link: "
|
|
24993
|
+
link: "https://vercel.link/node-version",
|
|
24993
24994
|
message: `${intro} ${getHint(isAuto)}`
|
|
24994
24995
|
});
|
|
24995
24996
|
}
|
|
@@ -25039,6 +25040,7 @@ var import_js_yaml = __toESM(require_js_yaml2());
|
|
|
25039
25040
|
var import_toml = __toESM(require_toml());
|
|
25040
25041
|
var import_fs_extra6 = __toESM(require_lib());
|
|
25041
25042
|
var import_error_utils = __toESM(require_dist());
|
|
25043
|
+
var import_path5 = require("path");
|
|
25042
25044
|
async function readFileOrNull(file) {
|
|
25043
25045
|
try {
|
|
25044
25046
|
const data = await (0, import_fs_extra6.readFile)(file);
|
|
@@ -25074,6 +25076,14 @@ async function readConfigFile(files) {
|
|
|
25074
25076
|
}
|
|
25075
25077
|
return null;
|
|
25076
25078
|
}
|
|
25079
|
+
async function getPackageJson(dir) {
|
|
25080
|
+
const packagePath = (0, import_path5.join)(dir, "package.json");
|
|
25081
|
+
try {
|
|
25082
|
+
return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
|
|
25083
|
+
} catch (err) {
|
|
25084
|
+
return {};
|
|
25085
|
+
}
|
|
25086
|
+
}
|
|
25077
25087
|
|
|
25078
25088
|
// src/clone-env.ts
|
|
25079
25089
|
var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
|
|
@@ -25144,13 +25154,13 @@ function* traverseUpDirectories({
|
|
|
25144
25154
|
start,
|
|
25145
25155
|
base
|
|
25146
25156
|
}) {
|
|
25147
|
-
let current =
|
|
25148
|
-
const normalizedRoot = base ?
|
|
25157
|
+
let current = import_path6.default.normalize(start);
|
|
25158
|
+
const normalizedRoot = base ? import_path6.default.normalize(base) : void 0;
|
|
25149
25159
|
while (current) {
|
|
25150
25160
|
yield current;
|
|
25151
25161
|
if (current === normalizedRoot)
|
|
25152
25162
|
break;
|
|
25153
|
-
const next =
|
|
25163
|
+
const next = import_path6.default.join(current, "..");
|
|
25154
25164
|
current = next === current ? void 0 : next;
|
|
25155
25165
|
}
|
|
25156
25166
|
}
|
|
@@ -25160,29 +25170,29 @@ async function readProjectRootInfo({
|
|
|
25160
25170
|
}) {
|
|
25161
25171
|
let curRootPackageJsonPath;
|
|
25162
25172
|
for (const dir of traverseUpDirectories({ start, base })) {
|
|
25163
|
-
const packageJsonPath =
|
|
25173
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
25164
25174
|
if (await import_fs_extra7.default.pathExists(packageJsonPath)) {
|
|
25165
25175
|
curRootPackageJsonPath = packageJsonPath;
|
|
25166
25176
|
}
|
|
25167
25177
|
}
|
|
25168
25178
|
return curRootPackageJsonPath ? {
|
|
25169
25179
|
packageJson: await import_fs_extra7.default.readJson(curRootPackageJsonPath),
|
|
25170
|
-
rootDir:
|
|
25180
|
+
rootDir: import_path6.default.dirname(curRootPackageJsonPath)
|
|
25171
25181
|
} : void 0;
|
|
25172
25182
|
}
|
|
25173
25183
|
async function getNodeBinPath({
|
|
25174
25184
|
cwd
|
|
25175
25185
|
}) {
|
|
25176
25186
|
const { lockfilePath } = await scanParentDirs(cwd);
|
|
25177
|
-
const dir =
|
|
25178
|
-
return
|
|
25187
|
+
const dir = import_path6.default.dirname(lockfilePath || cwd);
|
|
25188
|
+
return import_path6.default.join(dir, "node_modules", ".bin");
|
|
25179
25189
|
}
|
|
25180
25190
|
function getNodeBinPaths({
|
|
25181
25191
|
start,
|
|
25182
25192
|
base
|
|
25183
25193
|
}) {
|
|
25184
25194
|
return Array.from(traverseUpDirectories({ start, base })).map(
|
|
25185
|
-
(dir) =>
|
|
25195
|
+
(dir) => import_path6.default.join(dir, "node_modules/.bin")
|
|
25186
25196
|
);
|
|
25187
25197
|
}
|
|
25188
25198
|
async function chmodPlusX(fsPath) {
|
|
@@ -25194,10 +25204,10 @@ async function chmodPlusX(fsPath) {
|
|
|
25194
25204
|
await import_fs_extra7.default.chmod(fsPath, base8);
|
|
25195
25205
|
}
|
|
25196
25206
|
async function runShellScript(fsPath, args = [], spawnOpts) {
|
|
25197
|
-
(0, import_assert6.default)(
|
|
25198
|
-
const destPath =
|
|
25207
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(fsPath));
|
|
25208
|
+
const destPath = import_path6.default.dirname(fsPath);
|
|
25199
25209
|
await chmodPlusX(fsPath);
|
|
25200
|
-
const command = `./${
|
|
25210
|
+
const command = `./${import_path6.default.basename(fsPath)}`;
|
|
25201
25211
|
await spawnAsync(command, args, {
|
|
25202
25212
|
...spawnOpts,
|
|
25203
25213
|
cwd: destPath,
|
|
@@ -25215,7 +25225,7 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
|
25215
25225
|
if (!meta.isDev) {
|
|
25216
25226
|
let found = false;
|
|
25217
25227
|
const oldPath = opts.env.PATH || process.env.PATH || "";
|
|
25218
|
-
const pathSegments = oldPath.split(
|
|
25228
|
+
const pathSegments = oldPath.split(import_path6.default.delimiter).map((segment) => {
|
|
25219
25229
|
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
|
25220
25230
|
found = true;
|
|
25221
25231
|
return `/node${nodeVersion.major}/bin`;
|
|
@@ -25225,7 +25235,7 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
|
25225
25235
|
if (!found) {
|
|
25226
25236
|
pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
|
25227
25237
|
}
|
|
25228
|
-
opts.env.PATH = pathSegments.filter(Boolean).join(
|
|
25238
|
+
opts.env.PATH = pathSegments.filter(Boolean).join(import_path6.default.delimiter);
|
|
25229
25239
|
}
|
|
25230
25240
|
return opts;
|
|
25231
25241
|
}
|
|
@@ -25250,23 +25260,23 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
|
|
|
25250
25260
|
const { node } = packageJson.engines;
|
|
25251
25261
|
if (configuredVersion && !(0, import_semver2.intersects)(configuredVersion, supportedNodeVersion.range)) {
|
|
25252
25262
|
console.warn(
|
|
25253
|
-
`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:
|
|
25263
|
+
`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`
|
|
25254
25264
|
);
|
|
25255
25265
|
}
|
|
25256
25266
|
if ((0, import_semver2.coerce)(node)?.raw === node) {
|
|
25257
25267
|
console.warn(
|
|
25258
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More:
|
|
25268
|
+
`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`
|
|
25259
25269
|
);
|
|
25260
25270
|
} else if ((0, import_semver2.validRange)(node) && (0, import_semver2.intersects)(`${latestVersion.major + 1}.x`, node)) {
|
|
25261
25271
|
console.warn(
|
|
25262
|
-
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More:
|
|
25272
|
+
`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`
|
|
25263
25273
|
);
|
|
25264
25274
|
}
|
|
25265
25275
|
}
|
|
25266
25276
|
return supportedNodeVersion;
|
|
25267
25277
|
}
|
|
25268
25278
|
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
25269
|
-
(0, import_assert6.default)(
|
|
25279
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
25270
25280
|
const pkgJsonPath = await walkParentDirs({
|
|
25271
25281
|
base,
|
|
25272
25282
|
start: destPath,
|
|
@@ -25379,8 +25389,8 @@ async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
|
|
|
25379
25389
|
if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) {
|
|
25380
25390
|
return true;
|
|
25381
25391
|
}
|
|
25382
|
-
const turboJsonPath =
|
|
25383
|
-
const turboJsoncPath =
|
|
25392
|
+
const turboJsonPath = import_path6.default.join(rootDir, "turbo.json");
|
|
25393
|
+
const turboJsoncPath = import_path6.default.join(rootDir, "turbo.jsonc");
|
|
25384
25394
|
const [turboJsonExists, turboJsoncExists] = await Promise.all([
|
|
25385
25395
|
import_fs_extra7.default.pathExists(turboJsonPath),
|
|
25386
25396
|
import_fs_extra7.default.pathExists(turboJsoncPath)
|
|
@@ -25397,7 +25407,7 @@ async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
|
|
|
25397
25407
|
turboJson = import_json5.default.parse(await import_fs_extra7.default.readFile(turboConfigPath, "utf8"));
|
|
25398
25408
|
} catch (err) {
|
|
25399
25409
|
console.warn(
|
|
25400
|
-
`WARNING: Failed to parse ${
|
|
25410
|
+
`WARNING: Failed to parse ${import_path6.default.basename(turboConfigPath)}`
|
|
25401
25411
|
);
|
|
25402
25412
|
}
|
|
25403
25413
|
}
|
|
@@ -25457,10 +25467,10 @@ async function walkParentDirs({
|
|
|
25457
25467
|
start,
|
|
25458
25468
|
filename
|
|
25459
25469
|
}) {
|
|
25460
|
-
(0, import_assert6.default)(
|
|
25461
|
-
(0, import_assert6.default)(
|
|
25470
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(base), 'Expected "base" to be absolute path');
|
|
25471
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(start), 'Expected "start" to be absolute path');
|
|
25462
25472
|
for (const dir of traverseUpDirectories({ start, base })) {
|
|
25463
|
-
const fullPath =
|
|
25473
|
+
const fullPath = import_path6.default.join(dir, filename);
|
|
25464
25474
|
if (await import_fs_extra7.default.pathExists(fullPath)) {
|
|
25465
25475
|
return fullPath;
|
|
25466
25476
|
}
|
|
@@ -25474,12 +25484,12 @@ async function walkParentDirsMulti({
|
|
|
25474
25484
|
}) {
|
|
25475
25485
|
let packageManager;
|
|
25476
25486
|
for (const dir of traverseUpDirectories({ start, base })) {
|
|
25477
|
-
const fullPaths = filenames.map((f) =>
|
|
25487
|
+
const fullPaths = filenames.map((f) => import_path6.default.join(dir, f));
|
|
25478
25488
|
const existResults = await Promise.all(
|
|
25479
25489
|
fullPaths.map((f) => import_fs_extra7.default.pathExists(f))
|
|
25480
25490
|
);
|
|
25481
25491
|
const foundOneOrMore = existResults.some((b) => b);
|
|
25482
|
-
const packageJsonPath =
|
|
25492
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
25483
25493
|
const packageJson = await import_fs_extra7.default.readJSON(packageJsonPath).catch(() => null);
|
|
25484
25494
|
if (packageJson?.packageManager) {
|
|
25485
25495
|
packageManager = packageJson.packageManager;
|
|
@@ -25562,7 +25572,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
25562
25572
|
debug("Skipping dependency installation because dev mode is enabled");
|
|
25563
25573
|
return false;
|
|
25564
25574
|
}
|
|
25565
|
-
(0, import_assert6.default)(
|
|
25575
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
25566
25576
|
try {
|
|
25567
25577
|
await runNpmInstallSema.acquire();
|
|
25568
25578
|
const {
|
|
@@ -25680,11 +25690,11 @@ function getEnvForPackageManager({
|
|
|
25680
25690
|
};
|
|
25681
25691
|
const alreadyInPath = (newPath2) => {
|
|
25682
25692
|
const oldPath = env.PATH ?? "";
|
|
25683
|
-
return oldPath.split(
|
|
25693
|
+
return oldPath.split(import_path6.default.delimiter).includes(newPath2);
|
|
25684
25694
|
};
|
|
25685
25695
|
if (newPath && !alreadyInPath(newPath)) {
|
|
25686
25696
|
const oldPath = env.PATH + "";
|
|
25687
|
-
newEnv.PATH = `${newPath}${
|
|
25697
|
+
newEnv.PATH = `${newPath}${import_path6.default.delimiter}${oldPath}`;
|
|
25688
25698
|
if (detectedLockfile && detectedPackageManager) {
|
|
25689
25699
|
const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
|
|
25690
25700
|
const pnpm10UsingPackageJsonPackageManager = detectedPackageManager === "pnpm@10.x" && packageJsonPackageManager;
|
|
@@ -25963,7 +25973,7 @@ function getPathForPackageManager({
|
|
|
25963
25973
|
}
|
|
25964
25974
|
const alreadyInPath = (newPath) => {
|
|
25965
25975
|
const oldPath = env.PATH ?? "";
|
|
25966
|
-
return oldPath.split(
|
|
25976
|
+
return oldPath.split(import_path6.default.delimiter).includes(newPath);
|
|
25967
25977
|
};
|
|
25968
25978
|
switch (true) {
|
|
25969
25979
|
case (cliType === "yarn" && !env.YARN_NODE_LINKER):
|
|
@@ -25985,7 +25995,7 @@ async function runCustomInstallCommand({
|
|
|
25985
25995
|
spawnOpts,
|
|
25986
25996
|
projectCreatedAt
|
|
25987
25997
|
}) {
|
|
25988
|
-
const normalizedPath =
|
|
25998
|
+
const normalizedPath = import_path6.default.normalize(destPath);
|
|
25989
25999
|
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(
|
|
25990
26000
|
customInstallCommandSet,
|
|
25991
26001
|
normalizedPath
|
|
@@ -26029,7 +26039,7 @@ async function runCustomInstallCommand({
|
|
|
26029
26039
|
return true;
|
|
26030
26040
|
}
|
|
26031
26041
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
|
|
26032
|
-
(0, import_assert6.default)(
|
|
26042
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
26033
26043
|
const {
|
|
26034
26044
|
packageJson,
|
|
26035
26045
|
cliType,
|
|
@@ -26079,7 +26089,7 @@ async function runBundleInstall(destPath, args = [], spawnOpts, meta) {
|
|
|
26079
26089
|
debug("Skipping dependency installation because dev mode is enabled");
|
|
26080
26090
|
return;
|
|
26081
26091
|
}
|
|
26082
|
-
(0, import_assert6.default)(
|
|
26092
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
26083
26093
|
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: "bundle install" };
|
|
26084
26094
|
await spawnAsync("bundle", args.concat(["install"]), opts);
|
|
26085
26095
|
}
|
|
@@ -26088,7 +26098,7 @@ async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
|
26088
26098
|
debug("Skipping dependency installation because dev mode is enabled");
|
|
26089
26099
|
return;
|
|
26090
26100
|
}
|
|
26091
|
-
(0, import_assert6.default)(
|
|
26101
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
26092
26102
|
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: "pip3 install" };
|
|
26093
26103
|
await spawnAsync(
|
|
26094
26104
|
"pip3",
|
|
@@ -26112,7 +26122,7 @@ var installDependencies = (0, import_util2.deprecate)(
|
|
|
26112
26122
|
);
|
|
26113
26123
|
|
|
26114
26124
|
// src/get-ignore-filter.ts
|
|
26115
|
-
var
|
|
26125
|
+
var import_path7 = __toESM(require("path"));
|
|
26116
26126
|
var import_fs_extra8 = __toESM(require_lib());
|
|
26117
26127
|
var import_ignore = __toESM(require_ignore());
|
|
26118
26128
|
function isCodedError(error) {
|
|
@@ -26132,12 +26142,12 @@ async function get_ignore_filter_default(downloadPath, rootDirectory) {
|
|
|
26132
26142
|
throw error;
|
|
26133
26143
|
}
|
|
26134
26144
|
};
|
|
26135
|
-
const vercelIgnorePath =
|
|
26145
|
+
const vercelIgnorePath = import_path7.default.join(
|
|
26136
26146
|
downloadPath,
|
|
26137
26147
|
rootDirectory || "",
|
|
26138
26148
|
".vercelignore"
|
|
26139
26149
|
);
|
|
26140
|
-
const nowIgnorePath =
|
|
26150
|
+
const nowIgnorePath = import_path7.default.join(
|
|
26141
26151
|
downloadPath,
|
|
26142
26152
|
rootDirectory || "",
|
|
26143
26153
|
".nowignore"
|
|
@@ -26200,22 +26210,22 @@ function getPrefixedEnvVars({
|
|
|
26200
26210
|
}
|
|
26201
26211
|
|
|
26202
26212
|
// src/hard-link-dir.ts
|
|
26203
|
-
var
|
|
26213
|
+
var import_path8 = __toESM(require("path"));
|
|
26204
26214
|
var import_fs2 = require("fs");
|
|
26205
26215
|
async function hardLinkDir(src, destDirs) {
|
|
26206
26216
|
if (destDirs.length === 0)
|
|
26207
26217
|
return;
|
|
26208
|
-
destDirs = destDirs.filter((destDir) =>
|
|
26218
|
+
destDirs = destDirs.filter((destDir) => import_path8.default.relative(destDir, src) !== "");
|
|
26209
26219
|
const files = await import_fs2.promises.readdir(src);
|
|
26210
26220
|
await Promise.all(
|
|
26211
26221
|
files.map(async (file) => {
|
|
26212
26222
|
if (file === "node_modules")
|
|
26213
26223
|
return;
|
|
26214
|
-
const srcFile =
|
|
26224
|
+
const srcFile = import_path8.default.join(src, file);
|
|
26215
26225
|
if ((await import_fs2.promises.lstat(srcFile)).isDirectory()) {
|
|
26216
26226
|
const destSubdirs = await Promise.all(
|
|
26217
26227
|
destDirs.map(async (destDir) => {
|
|
26218
|
-
const destSubdir =
|
|
26228
|
+
const destSubdir = import_path8.default.join(destDir, file);
|
|
26219
26229
|
try {
|
|
26220
26230
|
await import_fs2.promises.mkdir(destSubdir, { recursive: true });
|
|
26221
26231
|
} catch (err) {
|
|
@@ -26230,7 +26240,7 @@ async function hardLinkDir(src, destDirs) {
|
|
|
26230
26240
|
}
|
|
26231
26241
|
await Promise.all(
|
|
26232
26242
|
destDirs.map(async (destDir) => {
|
|
26233
|
-
const destFile =
|
|
26243
|
+
const destFile = import_path8.default.join(destDir, file);
|
|
26234
26244
|
try {
|
|
26235
26245
|
await linkOrCopyFile(srcFile, destFile);
|
|
26236
26246
|
} catch (err) {
|
|
@@ -26249,7 +26259,7 @@ async function linkOrCopyFile(srcFile, destFile) {
|
|
|
26249
26259
|
await linkOrCopy(srcFile, destFile);
|
|
26250
26260
|
} catch (err) {
|
|
26251
26261
|
if (err.code === "ENOENT") {
|
|
26252
|
-
await import_fs2.promises.mkdir(
|
|
26262
|
+
await import_fs2.promises.mkdir(import_path8.default.dirname(destFile), { recursive: true });
|
|
26253
26263
|
await linkOrCopy(srcFile, destFile);
|
|
26254
26264
|
return;
|
|
26255
26265
|
}
|
|
@@ -26269,10 +26279,10 @@ async function linkOrCopy(srcFile, destFile) {
|
|
|
26269
26279
|
}
|
|
26270
26280
|
|
|
26271
26281
|
// src/validate-npmrc.ts
|
|
26272
|
-
var
|
|
26282
|
+
var import_path9 = require("path");
|
|
26273
26283
|
var import_promises = require("fs/promises");
|
|
26274
26284
|
async function validateNpmrc(cwd) {
|
|
26275
|
-
const npmrc = await (0, import_promises.readFile)((0,
|
|
26285
|
+
const npmrc = await (0, import_promises.readFile)((0, import_path9.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
|
|
26276
26286
|
if (err.code !== "ENOENT")
|
|
26277
26287
|
throw err;
|
|
26278
26288
|
});
|
|
@@ -26333,7 +26343,7 @@ async function getProvidedRuntime() {
|
|
|
26333
26343
|
}
|
|
26334
26344
|
|
|
26335
26345
|
// src/should-serve.ts
|
|
26336
|
-
var
|
|
26346
|
+
var import_path10 = require("path");
|
|
26337
26347
|
var shouldServe = ({
|
|
26338
26348
|
entrypoint,
|
|
26339
26349
|
files,
|
|
@@ -26344,7 +26354,7 @@ var shouldServe = ({
|
|
|
26344
26354
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
|
26345
26355
|
return true;
|
|
26346
26356
|
}
|
|
26347
|
-
const { dir, name } = (0,
|
|
26357
|
+
const { dir, name } = (0, import_path10.parse)(entrypoint);
|
|
26348
26358
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
|
26349
26359
|
return true;
|
|
26350
26360
|
}
|
|
@@ -26750,12 +26760,12 @@ function shouldUseExperimentalBackends(framework) {
|
|
|
26750
26760
|
|
|
26751
26761
|
// src/python.ts
|
|
26752
26762
|
var import_fs3 = __toESM(require("fs"));
|
|
26753
|
-
var
|
|
26763
|
+
var import_path11 = require("path");
|
|
26754
26764
|
var import_execa = __toESM(require_execa());
|
|
26755
26765
|
var isWin2 = process.platform === "win32";
|
|
26756
26766
|
async function runStdlibPyScript(options) {
|
|
26757
26767
|
const { scriptName, pythonPath, args = [], cwd } = options;
|
|
26758
|
-
const scriptPath = (0,
|
|
26768
|
+
const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
|
|
26759
26769
|
if (!import_fs3.default.existsSync(scriptPath)) {
|
|
26760
26770
|
throw new Error(`Python script not found: ${scriptPath}`);
|
|
26761
26771
|
}
|
|
@@ -26833,6 +26843,7 @@ async function isPythonEntrypoint(file) {
|
|
|
26833
26843
|
getNodeBinPaths,
|
|
26834
26844
|
getNodeVersion,
|
|
26835
26845
|
getOsRelease,
|
|
26846
|
+
getPackageJson,
|
|
26836
26847
|
getPathForPackageManager,
|
|
26837
26848
|
getPlatformEnv,
|
|
26838
26849
|
getPrefixedEnvVars,
|
package/dist/types.d.ts
CHANGED
|
@@ -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;
|