@vercel/build-utils 14.3.0 → 14.5.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 +42 -0
- package/dist/generate-node-builder-functions.js +16 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -2
- package/dist/prerender.d.ts +24 -15
- package/dist/prerender.js +2 -2
- package/dist/trace/trace.d.ts +8 -0
- package/dist/trace/trace.js +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 14.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 90afd71: Expose the resolved rewrite destination as the request path observed by Node backend framework applications (express, hono, h3, koa, nestjs, fastify, elysia) and the unified backends builder, and warn affected backend projects about the behavior change.
|
|
8
|
+
|
|
9
|
+
## 14.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e5b0363: Add `Span.reportChildEvents()` so a tree of trace events produced in another process (e.g. a forked build worker) can be reported under an existing span. Its root events are reparented to that span while links internal to the set are preserved, keeping trace nesting intact.
|
|
14
|
+
|
|
15
|
+
## 14.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- f8add0a: Replace `prerenderClassification` on `Prerender` with `initialMetadata`.
|
|
20
|
+
|
|
21
|
+
The platform consumes only the request-time compute mode and the HTML shell
|
|
22
|
+
size, so the flattened four-field taxonomy (`routeType`, `response`,
|
|
23
|
+
`compute`, `htmlSize`) is reduced to a single grouped field:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
initialMetadata?: {
|
|
27
|
+
compute: 'blocking' | 'resuming' | 'static';
|
|
28
|
+
htmlSize?: number;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The group is named `initialMetadata` because the values describe the
|
|
33
|
+
deployment as it was built: revalidation can regenerate a route's output over
|
|
34
|
+
the deployment's lifetime, so readers must treat them as initial values, not
|
|
35
|
+
live state. `@vercel/next` reads `compute` and `htmlSize` off the v4
|
|
36
|
+
prerender-manifest taxonomy and deliberately ignores `routeType` and
|
|
37
|
+
`response`; the values are still carried unvalidated so a compute mode added
|
|
38
|
+
by a future framework release cannot hard-fail a deploy, and they are still
|
|
39
|
+
set only on the primary output of each prerender group. `htmlSize: 0` is a
|
|
40
|
+
real size (a shell that postponed everything); `htmlSize` is absent when
|
|
41
|
+
there is no HTML shell to measure (route handlers, Pages Router). Absence of
|
|
42
|
+
the whole group remains legitimate (`notFoundRoutes`, Pages Router
|
|
43
|
+
`fallback: false`, older frameworks).
|
|
44
|
+
|
|
3
45
|
## 14.3.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
|
@@ -76,6 +76,22 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
|
|
|
76
76
|
slug: frameworkName,
|
|
77
77
|
version
|
|
78
78
|
};
|
|
79
|
+
if (!res.routes) {
|
|
80
|
+
res.routes = [
|
|
81
|
+
{ handle: "filesystem" },
|
|
82
|
+
{
|
|
83
|
+
src: "/(.*)",
|
|
84
|
+
dest: "/",
|
|
85
|
+
transforms: [
|
|
86
|
+
{
|
|
87
|
+
type: "request.path",
|
|
88
|
+
op: "set",
|
|
89
|
+
args: "/$1"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
}
|
|
79
95
|
return res;
|
|
80
96
|
};
|
|
81
97
|
const entrypointCallback = async (args) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import FileFsRef from './file-fs-ref';
|
|
|
3
3
|
import FileRef from './file-ref';
|
|
4
4
|
import { Lambda, createLambda, getLambdaOptionsFromFunction, sanitizeConsumerName } from './lambda';
|
|
5
5
|
import { NodejsLambda, type NodejsLambdaOptions } from './nodejs-lambda';
|
|
6
|
-
import { Prerender, type
|
|
6
|
+
import { Prerender, type PrerenderInitialMetadata } from './prerender';
|
|
7
7
|
import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget } from './fs/download';
|
|
8
8
|
import getWriteableDirectory from './fs/get-writable-directory';
|
|
9
9
|
import glob, { GlobOptions } from './fs/glob';
|
|
@@ -20,7 +20,7 @@ import { getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars } from './get-se
|
|
|
20
20
|
import { cloneEnv } from './clone-env';
|
|
21
21
|
import { hardLinkDir } from './hard-link-dir';
|
|
22
22
|
import { validateNpmrc } from './validate-npmrc';
|
|
23
|
-
export type { NodejsLambdaOptions,
|
|
23
|
+
export type { NodejsLambdaOptions, PrerenderInitialMetadata };
|
|
24
24
|
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, getOrCreateBunBinary, 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, };
|
|
25
25
|
export { EdgeFunction } from './edge-function';
|
|
26
26
|
export { ContainerImage } from './container-image';
|
package/dist/index.js
CHANGED
|
@@ -35406,13 +35406,13 @@ var Prerender = class {
|
|
|
35406
35406
|
chain,
|
|
35407
35407
|
exposeErrBody,
|
|
35408
35408
|
partialFallback,
|
|
35409
|
-
|
|
35409
|
+
initialMetadata
|
|
35410
35410
|
}) {
|
|
35411
35411
|
this.type = "Prerender";
|
|
35412
35412
|
this.expiration = expiration;
|
|
35413
35413
|
this.staleExpiration = staleExpiration;
|
|
35414
35414
|
this.sourcePath = sourcePath;
|
|
35415
|
-
this.
|
|
35415
|
+
this.initialMetadata = initialMetadata;
|
|
35416
35416
|
this.lambda = lambda;
|
|
35417
35417
|
if (this.lambda) {
|
|
35418
35418
|
this.lambda.operationType = this.lambda.operationType || "ISR";
|
|
@@ -39344,6 +39344,22 @@ var Span = class _Span {
|
|
|
39344
39344
|
reporter: this._reporter
|
|
39345
39345
|
});
|
|
39346
39346
|
}
|
|
39347
|
+
/**
|
|
39348
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
39349
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
39350
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
39351
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
39352
|
+
* caller does not need to know or set this span's id.
|
|
39353
|
+
*/
|
|
39354
|
+
reportChildEvents(events) {
|
|
39355
|
+
if (!this._reporter)
|
|
39356
|
+
return;
|
|
39357
|
+
const ids = new Set(events.map((event) => event.id));
|
|
39358
|
+
for (const event of events) {
|
|
39359
|
+
const isRoot = event.parentId === void 0 || !ids.has(event.parentId);
|
|
39360
|
+
this._reporter.report(isRoot ? { ...event, parentId: this.id } : event);
|
|
39361
|
+
}
|
|
39362
|
+
}
|
|
39347
39363
|
async trace(fn) {
|
|
39348
39364
|
try {
|
|
39349
39365
|
return await fn(this);
|
|
@@ -39440,6 +39456,22 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
|
|
|
39440
39456
|
slug: frameworkName,
|
|
39441
39457
|
version
|
|
39442
39458
|
};
|
|
39459
|
+
if (!res.routes) {
|
|
39460
|
+
res.routes = [
|
|
39461
|
+
{ handle: "filesystem" },
|
|
39462
|
+
{
|
|
39463
|
+
src: "/(.*)",
|
|
39464
|
+
dest: "/",
|
|
39465
|
+
transforms: [
|
|
39466
|
+
{
|
|
39467
|
+
type: "request.path",
|
|
39468
|
+
op: "set",
|
|
39469
|
+
args: "/$1"
|
|
39470
|
+
}
|
|
39471
|
+
]
|
|
39472
|
+
}
|
|
39473
|
+
];
|
|
39474
|
+
}
|
|
39443
39475
|
return res;
|
|
39444
39476
|
};
|
|
39445
39477
|
const entrypointCallback = async (args) => {
|
package/dist/prerender.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type { File, HasField, Chain } from './types';
|
|
2
2
|
import { Lambda } from './lambda';
|
|
3
3
|
/**
|
|
4
|
-
* The framework's own description of what it prerendered
|
|
5
|
-
*
|
|
4
|
+
* The framework's own description of what it prerendered at build time,
|
|
5
|
+
* rather than re-deriving it from build artifacts. These are *initial*
|
|
6
|
+
* values: revalidation can regenerate a route's output over the lifetime of
|
|
7
|
+
* a deployment, so readers must treat them as the state as of the build,
|
|
8
|
+
* not as live state.
|
|
6
9
|
*/
|
|
7
|
-
export interface
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export interface PrerenderInitialMetadata {
|
|
11
|
+
/**
|
|
12
|
+
* What has to happen at request time to finish the response, as of build
|
|
13
|
+
* time: `static` needs no server compute, `resuming` streams the static
|
|
14
|
+
* response while the server resumes postponed work, and `blocking` cannot
|
|
15
|
+
* start the response until request-time compute starts.
|
|
16
|
+
*/
|
|
13
17
|
compute: 'blocking' | 'resuming' | 'static';
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Byte size of the prerendered HTML shell, when the entry has one. `0` is
|
|
20
|
+
* a real size — a shell that postponed everything — and `undefined` means
|
|
21
|
+
* there is no HTML shell to measure (route handlers, Pages Router).
|
|
22
|
+
*/
|
|
15
23
|
htmlSize?: number;
|
|
16
24
|
}
|
|
17
25
|
interface PrerenderOptions {
|
|
@@ -32,7 +40,7 @@ interface PrerenderOptions {
|
|
|
32
40
|
chain?: Chain;
|
|
33
41
|
exposeErrBody?: boolean;
|
|
34
42
|
partialFallback?: boolean;
|
|
35
|
-
|
|
43
|
+
initialMetadata?: PrerenderInitialMetadata;
|
|
36
44
|
}
|
|
37
45
|
export declare class Prerender {
|
|
38
46
|
type: 'Prerender';
|
|
@@ -63,11 +71,12 @@ export declare class Prerender {
|
|
|
63
71
|
exposeErrBody?: boolean;
|
|
64
72
|
partialFallback?: boolean;
|
|
65
73
|
/**
|
|
66
|
-
* The framework's
|
|
67
|
-
* framework did not provide
|
|
68
|
-
* Pages Router `fallback: false` templates
|
|
74
|
+
* The framework's build-time serving metadata for this prerender.
|
|
75
|
+
* `undefined` when the framework did not provide it, which is legitimate:
|
|
76
|
+
* not-found routes, Pages Router `fallback: false` templates, and builds
|
|
77
|
+
* from frameworks that predate the field carry none.
|
|
69
78
|
*/
|
|
70
|
-
|
|
71
|
-
constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback,
|
|
79
|
+
initialMetadata?: PrerenderInitialMetadata;
|
|
80
|
+
constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, initialMetadata, }: PrerenderOptions);
|
|
72
81
|
}
|
|
73
82
|
export {};
|
package/dist/prerender.js
CHANGED
|
@@ -40,13 +40,13 @@ class Prerender {
|
|
|
40
40
|
chain,
|
|
41
41
|
exposeErrBody,
|
|
42
42
|
partialFallback,
|
|
43
|
-
|
|
43
|
+
initialMetadata
|
|
44
44
|
}) {
|
|
45
45
|
this.type = "Prerender";
|
|
46
46
|
this.expiration = expiration;
|
|
47
47
|
this.staleExpiration = staleExpiration;
|
|
48
48
|
this.sourcePath = sourcePath;
|
|
49
|
-
this.
|
|
49
|
+
this.initialMetadata = initialMetadata;
|
|
50
50
|
this.lambda = lambda;
|
|
51
51
|
if (this.lambda) {
|
|
52
52
|
this.lambda.operationType = this.lambda.operationType || "ISR";
|
package/dist/trace/trace.d.ts
CHANGED
|
@@ -32,6 +32,14 @@ export declare class Span {
|
|
|
32
32
|
stop(): void;
|
|
33
33
|
setAttributes(attrs: Attributes): void;
|
|
34
34
|
child(name: string, attrs?: Attributes): Span;
|
|
35
|
+
/**
|
|
36
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
37
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
38
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
39
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
40
|
+
* caller does not need to know or set this span's id.
|
|
41
|
+
*/
|
|
42
|
+
reportChildEvents(events: TraceEvent[]): void;
|
|
35
43
|
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
|
|
36
44
|
}
|
|
37
45
|
export {};
|
package/dist/trace/trace.js
CHANGED
|
@@ -78,6 +78,22 @@ class Span {
|
|
|
78
78
|
reporter: this._reporter
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
83
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
84
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
85
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
86
|
+
* caller does not need to know or set this span's id.
|
|
87
|
+
*/
|
|
88
|
+
reportChildEvents(events) {
|
|
89
|
+
if (!this._reporter)
|
|
90
|
+
return;
|
|
91
|
+
const ids = new Set(events.map((event) => event.id));
|
|
92
|
+
for (const event of events) {
|
|
93
|
+
const isRoot = event.parentId === void 0 || !ids.has(event.parentId);
|
|
94
|
+
this._reporter.report(isRoot ? { ...event, parentId: this.id } : event);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
81
97
|
async trace(fn) {
|
|
82
98
|
try {
|
|
83
99
|
return await fn(this);
|