@vercel/build-utils 13.29.1 → 13.31.0
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 +20 -0
- package/dist/deploy-manifest.d.ts +9 -0
- package/dist/deploy-manifest.js +16 -0
- package/dist/fs/run-user-scripts.js +62 -25
- package/dist/index.d.ts +4 -2
- package/dist/index.js +556 -324
- package/dist/prerender.d.ts +23 -1
- package/dist/prerender.js +20 -4
- package/dist/ruby-diagnostics.d.ts +21 -0
- package/dist/ruby-diagnostics.js +219 -0
- package/dist/types.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8dec9ea: Add deploy-manifest as an extension of project manifest.
|
|
8
|
+
- 3afdb18: Emit project manifest for hugo, zola, jekyll, and middleman frameworks.
|
|
9
|
+
- 04f830c: Autodetect Bun runtime if engines.bun is set.
|
|
10
|
+
|
|
11
|
+
## 13.30.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 01e18e8: Add `hasFallback`, `htmlSize`, and `isDynamicRoute` to `Prerender`
|
|
16
|
+
|
|
17
|
+
These optional fields surface per-route PPR shell metadata in the Build Output so consumers can classify prerenders (e.g. full shell vs. empty shell vs. concrete prerender):
|
|
18
|
+
|
|
19
|
+
- `hasFallback` — whether a dynamic route template had a static fallback (`undefined` for concrete prerenders)
|
|
20
|
+
- `htmlSize` — byte size of the prerendered `.html` shell (`0` for an empty shell, `undefined` when there's no `.html`)
|
|
21
|
+
- `isDynamicRoute` — whether the entry came from a dynamic route template rather than a concrete prerender
|
|
22
|
+
|
|
3
23
|
## 13.29.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PackageManifest } from './package-manifest';
|
|
2
|
+
export interface DeployManifestBuild extends PackageManifest {
|
|
3
|
+
root: string;
|
|
4
|
+
builder: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DeployManifest {
|
|
7
|
+
manifestVersion: '2.0';
|
|
8
|
+
builds: Record<string, DeployManifestBuild>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var deploy_manifest_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(deploy_manifest_exports);
|
|
@@ -217,40 +217,77 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
|
217
217
|
return opts;
|
|
218
218
|
}
|
|
219
219
|
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = (0, import_node_version.getAvailableNodeVersions)()) {
|
|
220
|
-
if (config.bunVersion) {
|
|
221
|
-
return (0, import_node_version.getSupportedBunVersion)(config.bunVersion);
|
|
222
|
-
}
|
|
223
|
-
const latestVersion = (0, import_node_version.getLatestNodeVersion)(availableVersions);
|
|
224
|
-
if (meta.isDev) {
|
|
225
|
-
latestVersion.runtime = "nodejs";
|
|
226
|
-
return latestVersion;
|
|
227
|
-
}
|
|
228
220
|
const { packageJson } = await findPackageJson(destPath, true);
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (packageJson?.engines?.node) {
|
|
237
|
-
const { node } = packageJson.engines;
|
|
238
|
-
if (configuredVersion && !(0, import_semver.intersects)(configuredVersion, supportedNodeVersion.range)) {
|
|
221
|
+
const packageJsonNodeVersion = packageJson?.engines?.node;
|
|
222
|
+
const packageJsonBunVersion = packageJson?.engines?.bun;
|
|
223
|
+
const latestNodeVersion = (0, import_node_version.getLatestNodeVersion)(availableVersions);
|
|
224
|
+
let targetRuntime;
|
|
225
|
+
if (packageJsonNodeVersion && packageJsonBunVersion) {
|
|
226
|
+
if (config.bunVersion) {
|
|
227
|
+
targetRuntime = "bun";
|
|
239
228
|
console.warn(
|
|
240
|
-
`Warning
|
|
229
|
+
`Warning detected "engines": { "node": ..., "bun": ... } in \`package.json\`. Since "bunVersion" is set in \`vercel.json\`, using "bun".`
|
|
241
230
|
);
|
|
242
|
-
}
|
|
243
|
-
|
|
231
|
+
} else {
|
|
232
|
+
targetRuntime = "node";
|
|
244
233
|
console.warn(
|
|
245
|
-
`Warning
|
|
234
|
+
`Warning detected "engines": { "node": ..., "bun": ... } in \`package.json\`. Defaulting to "node".`
|
|
246
235
|
);
|
|
247
|
-
}
|
|
236
|
+
}
|
|
237
|
+
} else if (packageJsonNodeVersion) {
|
|
238
|
+
targetRuntime = "node";
|
|
239
|
+
if (config.bunVersion) {
|
|
248
240
|
console.warn(
|
|
249
|
-
`Warning
|
|
241
|
+
`Warning detected "engines": { "node": ... } in \`package.json\` and "bunVersion" in \`vercel.json\`. \`package.json\` takes precedence, using "node".`
|
|
250
242
|
);
|
|
251
243
|
}
|
|
244
|
+
} else if (packageJsonBunVersion || config.bunVersion) {
|
|
245
|
+
targetRuntime = "bun";
|
|
246
|
+
} else {
|
|
247
|
+
targetRuntime = "node";
|
|
248
|
+
}
|
|
249
|
+
if (meta.isDev) {
|
|
250
|
+
if (targetRuntime === "node") {
|
|
251
|
+
latestNodeVersion.runtime = "nodejs";
|
|
252
|
+
return latestNodeVersion;
|
|
253
|
+
} else {
|
|
254
|
+
return (0, import_node_version.getSupportedBunVersion)("1.x");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (targetRuntime === "node") {
|
|
258
|
+
const configuredNodeVersion = config.nodeVersion ?? fallbackVersion;
|
|
259
|
+
const supportedNodeVersion = await (0, import_node_version.getSupportedNodeVersion)(
|
|
260
|
+
packageJsonNodeVersion || configuredNodeVersion,
|
|
261
|
+
!packageJsonNodeVersion,
|
|
262
|
+
availableVersions
|
|
263
|
+
);
|
|
264
|
+
if (packageJson?.engines?.node) {
|
|
265
|
+
const { node } = packageJson.engines;
|
|
266
|
+
if (configuredNodeVersion && !(0, import_semver.intersects)(configuredNodeVersion, supportedNodeVersion.range)) {
|
|
267
|
+
console.warn(
|
|
268
|
+
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredNodeVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More: https://vercel.link/node-version`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if ((0, import_semver.coerce)(node)?.raw === node) {
|
|
272
|
+
console.warn(
|
|
273
|
+
`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`
|
|
274
|
+
);
|
|
275
|
+
} else if ((0, import_semver.validRange)(node) && (0, import_semver.intersects)(`${latestNodeVersion.major + 1}.x`, node)) {
|
|
276
|
+
console.warn(
|
|
277
|
+
`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`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return supportedNodeVersion;
|
|
282
|
+
} else {
|
|
283
|
+
if (packageJsonBunVersion) {
|
|
284
|
+
return (0, import_node_version.getSupportedBunVersion)(packageJsonBunVersion);
|
|
285
|
+
}
|
|
286
|
+
if (config.bunVersion) {
|
|
287
|
+
return (0, import_node_version.getSupportedBunVersion)(config.bunVersion);
|
|
288
|
+
}
|
|
289
|
+
return (0, import_node_version.getSupportedBunVersion)("1.x");
|
|
252
290
|
}
|
|
253
|
-
return supportedNodeVersion;
|
|
254
291
|
}
|
|
255
292
|
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
256
293
|
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory, i
|
|
|
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, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, findPackageJson, traverseUpDirectories, PipInstallResult, NpmInstallOutput } 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, PipInstallResult, NpmInstallOutput, type CliType } 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';
|
|
@@ -20,7 +20,7 @@ import { cloneEnv } from './clone-env';
|
|
|
20
20
|
import { hardLinkDir } from './hard-link-dir';
|
|
21
21
|
import { validateNpmrc } from './validate-npmrc';
|
|
22
22
|
export type { NodejsLambdaOptions };
|
|
23
|
-
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, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
|
|
23
|
+
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, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
|
|
24
24
|
export { EdgeFunction } from './edge-function';
|
|
25
25
|
export { readConfigFile, getPackageJson } from './fs/read-config-file';
|
|
26
26
|
export { normalizePath } from './fs/normalize-path';
|
|
@@ -29,7 +29,9 @@ export * from './should-serve';
|
|
|
29
29
|
export * from './schemas';
|
|
30
30
|
export { DEFAULT_MAX_DURATION_LIMIT, SKIP_MAX_DURATION_LIMIT_ENV, getMaxDurationLimit, getMaxDurationSchema, } from './max-duration';
|
|
31
31
|
export * from './package-manifest';
|
|
32
|
+
export * from './deploy-manifest';
|
|
32
33
|
export { generateProjectManifest } from './node-diagnostics';
|
|
34
|
+
export { generateRubyProjectManifest, parseGemfileLock, } from './ruby-diagnostics';
|
|
33
35
|
export * from './types';
|
|
34
36
|
export * from './errors';
|
|
35
37
|
export * from './trace';
|