@vercel/build-utils 14.2.0 → 14.4.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.
@@ -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, mirroring the
5
- * Next.js prerender taxonomy rather than re-deriving it from build artifacts.
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 PrerenderClassification {
8
- /** What kind of entry this is within its route group. */
9
- routeType: 'route' | 'page' | 'shell' | 'fallback';
10
- /** How much of the response the prerender contains. */
11
- response: 'empty' | 'initial' | 'complete';
12
- /** What has to happen at request time to finish the response. */
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
- /** Byte size of the prerendered HTML shell, when the entry has one. */
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
- prerenderClassification?: PrerenderClassification;
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 classification of this prerender. `undefined` when the
67
- * framework did not provide one, which is legitimate: not-found routes and
68
- * Pages Router `fallback: false` templates have no classification.
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
- prerenderClassification?: PrerenderClassification;
71
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, prerenderClassification, }: PrerenderOptions);
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
- prerenderClassification
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.prerenderClassification = prerenderClassification;
49
+ this.initialMetadata = initialMetadata;
50
50
  this.lambda = lambda;
51
51
  if (this.lambda) {
52
52
  this.lambda.operationType = this.lambda.operationType || "ISR";
@@ -11,3 +11,5 @@ export declare const INTERNAL_SERVICE_PREFIX = "/_svc";
11
11
  export declare function getInternalServiceFunctionPath(serviceName: string): string;
12
12
  export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
13
13
  export declare function getInternalServiceCronPath(serviceName: string, entrypoint: string, handler?: string): string;
14
+ export declare function getInternalServiceWorkerPathPrefix(serviceName: string): string;
15
+ export declare function getInternalServiceWorkerPath(serviceName: string, entrypoint: string, handler?: string): string;
@@ -21,7 +21,9 @@ __export(service_path_utils_exports, {
21
21
  INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
22
22
  getInternalServiceCronPath: () => getInternalServiceCronPath,
23
23
  getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
24
- getInternalServiceFunctionPath: () => getInternalServiceFunctionPath
24
+ getInternalServiceFunctionPath: () => getInternalServiceFunctionPath,
25
+ getInternalServiceWorkerPath: () => getInternalServiceWorkerPath,
26
+ getInternalServiceWorkerPathPrefix: () => getInternalServiceWorkerPathPrefix
25
27
  });
26
28
  module.exports = __toCommonJS(service_path_utils_exports);
27
29
  const INTERNAL_SERVICE_PREFIX = "/_svc";
@@ -39,10 +41,19 @@ function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
39
41
  const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
40
42
  return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
41
43
  }
44
+ function getInternalServiceWorkerPathPrefix(serviceName) {
45
+ return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/workers`;
46
+ }
47
+ function getInternalServiceWorkerPath(serviceName, entrypoint, handler = "worker") {
48
+ const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
49
+ return `${getInternalServiceWorkerPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
50
+ }
42
51
  // Annotate the CommonJS export names for ESM import in node:
43
52
  0 && (module.exports = {
44
53
  INTERNAL_SERVICE_PREFIX,
45
54
  getInternalServiceCronPath,
46
55
  getInternalServiceCronPathPrefix,
47
- getInternalServiceFunctionPath
56
+ getInternalServiceFunctionPath,
57
+ getInternalServiceWorkerPath,
58
+ getInternalServiceWorkerPathPrefix
48
59
  });
package/dist/types.d.ts CHANGED
@@ -321,6 +321,14 @@ export declare namespace PackageJson {
321
321
  pnpm?: string;
322
322
  bun?: string;
323
323
  }
324
+ interface DevEnginePackageManager {
325
+ name?: string;
326
+ version?: string;
327
+ onFail?: 'download' | 'error' | 'warn' | 'ignore';
328
+ }
329
+ interface DevEngines {
330
+ packageManager?: DevEnginePackageManager | DevEnginePackageManager[];
331
+ }
324
332
  interface PublishConfig {
325
333
  registry?: string;
326
334
  }
@@ -359,6 +367,7 @@ export interface PackageJson {
359
367
  readonly optionalDependencies?: PackageJson.DependencyMap;
360
368
  readonly bundledDependencies?: string[];
361
369
  readonly engines?: PackageJson.Engines;
370
+ readonly devEngines?: PackageJson.DevEngines;
362
371
  readonly os?: string[];
363
372
  readonly cpu?: string[];
364
373
  readonly preferGlobal?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.2.0",
3
+ "version": "14.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -52,8 +52,8 @@
52
52
  "vitest": "4.1.10",
53
53
  "typescript": "4.9.5",
54
54
  "yazl": "2.5.1",
55
- "@vercel/routing-utils": "6.5.0",
56
- "@vercel/error-utils": "2.2.1"
55
+ "@vercel/error-utils": "2.2.1",
56
+ "@vercel/routing-utils": "6.5.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "node build.mjs",