@vercel/build-utils 14.22.0 → 15.0.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/daemon-static-publishing.js +7 -1
  3. package/dist/daemons.d.ts +4 -0
  4. package/dist/fs/node-version.js +0 -3
  5. package/dist/fs/stream-to-digest-async.d.ts +0 -1
  6. package/dist/fs/stream-to-digest-async.js +3 -8
  7. package/dist/index.d.ts +1 -28
  8. package/dist/index.js +12 -38
  9. package/dist/schedules.d.ts +24 -15
  10. package/dist/schedules.js +22 -27
  11. package/dist/types.d.ts +21 -8
  12. package/package.json +1 -5
  13. package/dist/collect-build-result/file-to-build-output-file.d.ts +0 -26
  14. package/dist/collect-build-result/file-to-build-output-file.js +0 -54
  15. package/dist/collect-build-result/get-build-result-metadata.d.ts +0 -33
  16. package/dist/collect-build-result/get-build-result-metadata.js +0 -99
  17. package/dist/collect-build-result/get-content-type.d.ts +0 -1
  18. package/dist/collect-build-result/get-content-type.js +0 -45
  19. package/dist/collect-build-result/get-lambda-by-output-path.d.ts +0 -13
  20. package/dist/collect-build-result/get-lambda-by-output-path.js +0 -31
  21. package/dist/collect-build-result/get-prerender-chain.d.ts +0 -8
  22. package/dist/collect-build-result/get-prerender-chain.js +0 -44
  23. package/dist/collect-build-result/is-route-middleware.d.ts +0 -4
  24. package/dist/collect-build-result/is-route-middleware.js +0 -30
  25. package/dist/collect-build-result/prerender-to-build-output-file.d.ts +0 -23
  26. package/dist/collect-build-result/prerender-to-build-output-file.js +0 -85
  27. package/dist/collect-build-result/stream-with-extended-payload.d.ts +0 -5
  28. package/dist/collect-build-result/stream-with-extended-payload.js +0 -49
  29. package/dist/collect-build-result/validate-build-result.d.ts +0 -19
  30. package/dist/collect-build-result/validate-build-result.js +0 -139
  31. package/dist/collect-build-result/validate-prerender.d.ts +0 -8
  32. package/dist/collect-build-result/validate-prerender.js +0 -32
  33. package/dist/collect-build-result/validate-regular-file.d.ts +0 -8
  34. package/dist/collect-build-result/validate-regular-file.js +0 -42
  35. package/dist/collect-uncompressed-size.d.ts +0 -6
  36. package/dist/collect-uncompressed-size.js +0 -59
  37. package/dist/deserialize/create-functions-iterator.d.ts +0 -8
  38. package/dist/deserialize/create-functions-iterator.js +0 -52
  39. package/dist/deserialize/deserialize-build-output-types.d.ts +0 -56
  40. package/dist/deserialize/deserialize-build-output-types.js +0 -16
  41. package/dist/deserialize/deserialize-build-output.d.ts +0 -4
  42. package/dist/deserialize/deserialize-build-output.js +0 -296
  43. package/dist/deserialize/deserialize-edge-function.d.ts +0 -5
  44. package/dist/deserialize/deserialize-edge-function.js +0 -47
  45. package/dist/deserialize/deserialize-lambda.d.ts +0 -22
  46. package/dist/deserialize/deserialize-lambda.js +0 -56
  47. package/dist/deserialize/hydrate-files-map.d.ts +0 -3
  48. package/dist/deserialize/hydrate-files-map.js +0 -55
  49. package/dist/deserialize/maybe-read-json.d.ts +0 -5
  50. package/dist/deserialize/maybe-read-json.js +0 -37
  51. package/dist/deserialize/serialized-types.d.ts +0 -32
  52. package/dist/deserialize/serialized-types.js +0 -16
  53. package/dist/deserialize/validate-framework-version.d.ts +0 -6
  54. package/dist/deserialize/validate-framework-version.js +0 -63
  55. package/dist/finalize-lambda.d.ts +0 -77
  56. package/dist/finalize-lambda.js +0 -117
  57. package/dist/process-serverless/get-encrypted-env-file.d.ts +0 -11
  58. package/dist/process-serverless/get-encrypted-env-file.js +0 -47
  59. package/dist/process-serverless/get-lambda-environment.d.ts +0 -19
  60. package/dist/process-serverless/get-lambda-environment.js +0 -53
  61. package/dist/process-serverless/get-lambda-preload-scripts.d.ts +0 -22
  62. package/dist/process-serverless/get-lambda-preload-scripts.js +0 -43
  63. package/dist/process-serverless/get-lambda-supports-streaming.d.ts +0 -22
  64. package/dist/process-serverless/get-lambda-supports-streaming.js +0 -42
  65. package/dist/validate-lambda-size.d.ts +0 -45
  66. package/dist/validate-lambda-size.js +0 -117
@@ -1,21 +1,30 @@
1
- import type { Schedule } from './types';
1
+ import type { Schedule, ScheduleDefinition, Schedules } from './types';
2
2
  /**
3
- * A `vercel.json` schedule. `entrypoint` targets are resolved to `function`
4
- * before the schedule reaches Build Output.
3
+ * A `vercel.json` schedule without its name, which is its key in `schedules`.
4
+ * `entrypoint` targets are resolved to `function` before the schedule reaches
5
+ * Build Output.
5
6
  */
6
- export type VercelJsonSchedule = Schedule | (Pick<Schedule, 'name' | 'schedule' | 'timezone' | 'jitter'> & {
7
+ export type VercelJsonScheduleDefinition = ScheduleDefinition | (Pick<ScheduleDefinition, 'schedule' | 'timezone' | 'jitter'> & {
7
8
  entrypoint: string;
9
+ /** Command for a Dockerfile or Containerfile schedule entrypoint. */
10
+ command?: string[];
11
+ /** Directory of a command schedule's service; `entrypoint` is relative to it. */
12
+ root?: string;
8
13
  });
9
- declare const SCHEDULE_TARGET_KEYS: readonly ["path", "function", "topic", "entrypoint"];
10
- export type ScheduleTargetKey = (typeof SCHEDULE_TARGET_KEYS)[number];
14
+ /** `vercel.json#schedules`: schedules keyed by name. */
15
+ export type VercelJsonSchedules = Record<string, VercelJsonScheduleDefinition>;
16
+ /** A `vercel.json` schedule with its name. */
17
+ export type VercelJsonSchedule = {
18
+ name: string;
19
+ } & VercelJsonScheduleDefinition;
11
20
  /**
12
- * Name for a schedule without one: a hex hash of `type|ref|expression`, which
13
- * always satisfies the schedule name pattern. Build Output omits these names
14
- * (except for entrypoint schedules) and the API derives its own; using the
15
- * same hash keeps `vercel dev` names the same as deployed ones. A function
16
- * target's service is appended as `|service`, matching the API.
21
+ * The schedules in `schedules` with their names, in key order. Accepts the
22
+ * deprecated array format, which already names each schedule.
17
23
  */
18
- export declare function defaultScheduleName(type: ScheduleTargetKey, ref: string, expression: string, service?: string): string;
19
- /** The schedule's `name`, or its default name when it has none. */
20
- export declare function getScheduleName(schedule: VercelJsonSchedule): string;
21
- export {};
24
+ export declare function getNamedSchedules(schedules: Schedules | readonly Schedule[] | undefined): Schedule[];
25
+ export declare function getNamedSchedules(schedules: VercelJsonSchedules | readonly VercelJsonSchedule[] | undefined): VercelJsonSchedule[];
26
+ /** Named schedules keyed by name, for `schedules` in Build Output. */
27
+ export declare function toScheduleRecord(schedules: readonly Schedule[]): Schedules;
28
+ export declare function toScheduleRecord(schedules: readonly VercelJsonSchedule[]): VercelJsonSchedules;
29
+ /** Warning for `schedules` in the deprecated array format. */
30
+ export declare function getSchedulesArrayDeprecationWarning(source: string): string;
package/dist/schedules.js CHANGED
@@ -18,37 +18,32 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var schedules_exports = {};
20
20
  __export(schedules_exports, {
21
- defaultScheduleName: () => defaultScheduleName,
22
- getScheduleName: () => getScheduleName
21
+ getNamedSchedules: () => getNamedSchedules,
22
+ getSchedulesArrayDeprecationWarning: () => getSchedulesArrayDeprecationWarning,
23
+ toScheduleRecord: () => toScheduleRecord
23
24
  });
24
25
  module.exports = __toCommonJS(schedules_exports);
25
- var import_crypto = require("crypto");
26
- const SCHEDULE_TARGET_KEYS = [
27
- "path",
28
- "function",
29
- "topic",
30
- "entrypoint"
31
- ];
32
- const DEFAULT_NAME_HASH_LENGTH = 12;
33
- function defaultScheduleName(type, ref, expression, service) {
34
- const input = `${type}|${ref}|${expression}`;
35
- return (0, import_crypto.createHash)("sha1").update(service === void 0 ? input : `${input}|${service}`).digest("hex").slice(0, DEFAULT_NAME_HASH_LENGTH);
26
+ function getNamedSchedules(schedules) {
27
+ if (schedules === void 0)
28
+ return [];
29
+ if (Array.isArray(schedules))
30
+ return [...schedules];
31
+ return Object.entries(schedules).map(([name, schedule]) => ({
32
+ name,
33
+ ...schedule
34
+ }));
36
35
  }
37
- function getScheduleName(schedule) {
38
- if (schedule.name !== void 0)
39
- return schedule.name;
40
- const type = SCHEDULE_TARGET_KEYS.find((key) => key in schedule);
41
- if (type === void 0) {
42
- throw new Error(
43
- "Schedule must include one of `path`, `function`, `topic`, or `entrypoint`."
44
- );
45
- }
46
- const ref = schedule[type];
47
- const service = type === "function" && "service" in schedule ? schedule.service : void 0;
48
- return defaultScheduleName(type, ref ?? "", schedule.schedule, service);
36
+ function toScheduleRecord(schedules) {
37
+ return Object.fromEntries(
38
+ schedules.map(({ name, ...schedule }) => [name, schedule])
39
+ );
40
+ }
41
+ function getSchedulesArrayDeprecationWarning(source) {
42
+ return `Listing \`schedules\` as an array in ${source} is deprecated. Key each schedule by its name instead, like \`"schedules": { "nightly": { "schedule": "0 0 * * *", "path": "/api/cron" } }\`.`;
49
43
  }
50
44
  // Annotate the CommonJS export names for ESM import in node:
51
45
  0 && (module.exports = {
52
- defaultScheduleName,
53
- getScheduleName
46
+ getNamedSchedules,
47
+ getSchedulesArrayDeprecationWarning,
48
+ toScheduleRecord
54
49
  });
package/dist/types.d.ts CHANGED
@@ -22,6 +22,11 @@ export interface FileBase {
22
22
  export interface Files {
23
23
  [filePath: string]: File;
24
24
  }
25
+ /** Data surrounding file content in a build-output upload. */
26
+ export interface ExtendedBodyData {
27
+ prefix: string;
28
+ suffix: string;
29
+ }
25
30
  export interface ScheduleFunctionEntrypoint {
26
31
  /** Runtime-specific entrypoint locator from `vercel.json`. */
27
32
  entrypoint: string;
@@ -535,8 +540,11 @@ export interface GetDevManifestOptions {
535
540
  export interface DevManifest {
536
541
  /** Complete replacement snapshot for the invoking builder scope. */
537
542
  functions: DevFunction[];
538
- /** Native framework schedules, using the static Build Output API schema. */
539
- schedules?: Schedule[];
543
+ /**
544
+ * Native framework schedules keyed by name, using the static Build Output
545
+ * API schema. The array format is deprecated.
546
+ */
547
+ schedules?: Schedules | Schedule[];
540
548
  /** Authored functions keys resolved by this provider, for unmatched diagnostics. */
541
549
  matchedFunctionPatterns: string[];
542
550
  }
@@ -668,12 +676,10 @@ export interface Cron {
668
676
  schedule: string;
669
677
  }
670
678
  export type ScheduleRequestMethod = 'GET' | 'POST';
671
- export type Schedule = {
672
- /**
673
- * Unique name of the schedule within the deployment. Defaults to a hash of
674
- * the target and cron expression.
675
- */
676
- name?: string;
679
+ /**
680
+ * A schedule without its name, which is its key in `schedules`.
681
+ */
682
+ export type ScheduleDefinition = {
677
683
  /** Cron expression describing when the schedule fires (REQUIRED) */
678
684
  schedule: string;
679
685
  /** IANA timezone for cron evaluation, e.g. "America/New_York". Defaults to UTC. */
@@ -697,6 +703,13 @@ export type Schedule = {
697
703
  /** Name of the queue topic to publish to */
698
704
  topic: string;
699
705
  });
706
+ /** Schedules keyed by name, as in Build Output `config.json#schedules`. */
707
+ export type Schedules = Record<string, ScheduleDefinition>;
708
+ /** A schedule with its name. */
709
+ export type Schedule = {
710
+ /** Unique name of the schedule within the deployment (REQUIRED) */
711
+ name: string;
712
+ } & ScheduleDefinition;
700
713
  export interface ServiceQueueTopic {
701
714
  topic: string;
702
715
  retryAfterSeconds?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.22.0",
3
+ "version": "15.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -16,13 +16,11 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/async-retry": "^1.2.1",
19
- "@types/bytes": "3.1.1",
20
19
  "@types/cross-spawn": "6.0.0",
21
20
  "@types/end-of-stream": "^1.4.0",
22
21
  "@types/fs-extra": "9.0.13",
23
22
  "@types/glob": "7.2.0",
24
23
  "@types/js-yaml": "3.12.1",
25
- "@types/mime-types": "2.1.0",
26
24
  "@types/minimatch": "^5.1.2",
27
25
  "@types/ms": "0.7.31",
28
26
  "@types/multistream": "2.1.1",
@@ -33,7 +31,6 @@
33
31
  "aggregate-error": "3.0.1",
34
32
  "async-retry": "1.2.3",
35
33
  "async-sema": "2.1.4",
36
- "bytes": "3.1.2",
37
34
  "cross-spawn": "6.0.5",
38
35
  "end-of-stream": "1.4.1",
39
36
  "execa": "3.2.0",
@@ -43,7 +40,6 @@
43
40
  "into-stream": "5.0.0",
44
41
  "js-yaml": "3.13.1",
45
42
  "json5": "2.2.3",
46
- "mime-types": "2.1.28",
47
43
  "minimatch": "3.1.2",
48
44
  "ms": "2.1.3",
49
45
  "multistream": "2.1.1",
@@ -1,26 +0,0 @@
1
- import type { FileDigest } from '../fs/stream-to-digest-async';
2
- import type FileFsRef from '../file-fs-ref';
3
- import type FileRef from '../file-ref';
4
- import type FileBlob from '../file-blob';
5
- export interface BuildOutputFile {
6
- contentType?: string;
7
- digest: string;
8
- lambda: null;
9
- mode: number;
10
- path: string;
11
- paths?: string[];
12
- size?: number;
13
- type?: 'file';
14
- prerenderPath?: string;
15
- }
16
- export declare function fileToBuildOutputFile(params: {
17
- buildResult: FileBlob | FileFsRef | FileRef;
18
- extendedBody?: {
19
- prefix: string;
20
- suffix: string;
21
- };
22
- outputPath: string;
23
- }): Promise<{
24
- output: BuildOutputFile;
25
- digest: FileDigest;
26
- }>;
@@ -1,54 +0,0 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var file_to_build_output_file_exports = {};
20
- __export(file_to_build_output_file_exports, {
21
- fileToBuildOutputFile: () => fileToBuildOutputFile
22
- });
23
- module.exports = __toCommonJS(file_to_build_output_file_exports);
24
- var import_stream_to_digest_async = require("../fs/stream-to-digest-async");
25
- var import_stream_with_extended_payload = require("./stream-with-extended-payload");
26
- var import_validate_regular_file = require("./validate-regular-file");
27
- var import_get_content_type = require("./get-content-type");
28
- async function fileToBuildOutputFile(params) {
29
- await (0, import_validate_regular_file.validateRegularFile)(params.buildResult);
30
- const digest = await (0, import_stream_to_digest_async.streamToDigestAsync)(
31
- (0, import_stream_with_extended_payload.streamWithExtendedPayload)(
32
- params.buildResult.toStreamAsync ? await params.buildResult.toStreamAsync() : params.buildResult.toStream(),
33
- params.extendedBody
34
- )
35
- );
36
- const contentType = params.buildResult.contentType ? params.buildResult.contentType : "fsPath" in params.buildResult ? (0, import_get_content_type.getContentType)(params.buildResult.fsPath) : void 0;
37
- return {
38
- digest,
39
- output: {
40
- type: "file",
41
- path: params.outputPath,
42
- prerenderPath: params.buildResult.prerenderPath,
43
- digest: digest.sha256,
44
- mode: params.buildResult.mode,
45
- contentType,
46
- size: digest.size,
47
- lambda: null
48
- }
49
- };
50
- }
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- fileToBuildOutputFile
54
- });
@@ -1,33 +0,0 @@
1
- import type { Route } from '@vercel/routing-utils';
2
- import type { EdgeFunction } from '../edge-function';
3
- import type { File } from '../types';
4
- import type { Lambda } from '../lambda';
5
- import type { Prerender } from '../prerender';
6
- export interface BuildResultMetadata {
7
- middleware: Map<string, MiddlewareMeta>;
8
- ppr: Map<string, boolean>;
9
- }
10
- /**
11
- * Extract metadata about the build result that depend on the relationship
12
- * between components in the build output. This data is later used to map to
13
- * the infrastructure that we need to create.
14
- */
15
- export declare function getBuildResultMetadata(params: {
16
- buildOutputMap: Record<string, EdgeFunction | Lambda | Prerender | File>;
17
- routes: Route[];
18
- }): BuildResultMetadata;
19
- type MiddlewareMeta = {
20
- type: 'middleware';
21
- middlewarePath: string;
22
- outputPath: string;
23
- match: Set<string>;
24
- edgeFunction: EdgeFunction;
25
- index: number;
26
- } | {
27
- type: 'middleware-lambda';
28
- middlewarePath: string;
29
- outputPath: string;
30
- match: Set<string>;
31
- index: number;
32
- };
33
- export {};
@@ -1,99 +0,0 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var get_build_result_metadata_exports = {};
20
- __export(get_build_result_metadata_exports, {
21
- getBuildResultMetadata: () => getBuildResultMetadata
22
- });
23
- module.exports = __toCommonJS(get_build_result_metadata_exports);
24
- var import_errors = require("../errors");
25
- var import_get_lambda_by_output_path = require("./get-lambda-by-output-path");
26
- var import_get_prerender_chain = require("./get-prerender-chain");
27
- var import_is_route_middleware = require("./is-route-middleware");
28
- function getBuildResultMetadata(params) {
29
- return {
30
- middleware: getMiddlewareMetadata(params),
31
- ppr: new Map(
32
- Object.entries(params.buildOutputMap).flatMap(([_outputPath, output]) => {
33
- if (output.type === "Prerender") {
34
- const chain = (0, import_get_prerender_chain.getPrerenderChain)(output);
35
- if (chain) {
36
- const maybeLambda = (0, import_get_lambda_by_output_path.getLambdaByOutputPath)({
37
- buildOutputMap: params.buildOutputMap,
38
- outputPath: chain.outputPath
39
- });
40
- if (maybeLambda) {
41
- return [[chain.outputPath, true]];
42
- }
43
- }
44
- }
45
- return [];
46
- })
47
- )
48
- };
49
- }
50
- function getMiddlewareMetadata(params) {
51
- const deduped = new Map(
52
- params.routes.filter(import_is_route_middleware.isRouteMiddleware).map(
53
- (route) => toMiddlewareTuple({
54
- buildOutputMap: params.buildOutputMap,
55
- middlewarePath: route.middlewarePath
56
- })
57
- )
58
- );
59
- return new Map(
60
- Array.from(deduped, ([outputPath, metadata], index) => [
61
- outputPath,
62
- { ...metadata, index }
63
- ])
64
- );
65
- }
66
- function toMiddlewareTuple(params) {
67
- const keys = [
68
- params.middlewarePath,
69
- params.middlewarePath.replace(/^\//, "")
70
- ];
71
- const [outputPath, output] = Object.entries(params.buildOutputMap).find(
72
- (entry) => keys.includes(entry[0]) && (entry[1].type === "EdgeFunction" || entry[1].type === "Lambda")
73
- ) ?? [];
74
- if (!outputPath || !output) {
75
- throw new import_errors.NowBuildError({
76
- message: `Mapping ${params.middlewarePath} not found. Maybe you provided a wrong middlewarePath?`,
77
- code: "middleware_path_not_found"
78
- });
79
- }
80
- return [
81
- outputPath,
82
- output.type === "EdgeFunction" ? {
83
- edgeFunction: output,
84
- match: new Set(keys),
85
- middlewarePath: params.middlewarePath,
86
- outputPath,
87
- type: "middleware"
88
- } : {
89
- match: new Set(keys),
90
- middlewarePath: params.middlewarePath,
91
- outputPath,
92
- type: "middleware-lambda"
93
- }
94
- ];
95
- }
96
- // Annotate the CommonJS export names for ESM import in node:
97
- 0 && (module.exports = {
98
- getBuildResultMetadata
99
- });
@@ -1 +0,0 @@
1
- export declare function getContentType(path: string): string;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var get_content_type_exports = {};
30
- __export(get_content_type_exports, {
31
- getContentType: () => getContentType
32
- });
33
- module.exports = __toCommonJS(get_content_type_exports);
34
- var import_path = require("path");
35
- var import_mime_types = __toESM(require("mime-types"));
36
- function getContentType(path) {
37
- if (path.endsWith(".html")) {
38
- return "text/html; charset=utf-8";
39
- }
40
- return import_mime_types.default.contentType((0, import_path.extname)(path)) || "application/octet-stream";
41
- }
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- getContentType
45
- });
@@ -1,13 +0,0 @@
1
- import type { EdgeFunction } from '../edge-function';
2
- import type { File } from '../types';
3
- import type { Lambda } from '../lambda';
4
- import type { Prerender } from '../prerender';
5
- /**
6
- * A Prerender can hold references to a Lambda or another Prerender when
7
- * using PPR. This function retrieves the Lambda or Prerender from the
8
- * build output map ensuring its type.
9
- */
10
- export declare function getLambdaByOutputPath(params: {
11
- buildOutputMap: Record<string, EdgeFunction | Lambda | Prerender | File>;
12
- outputPath: string;
13
- }): Lambda | undefined;
@@ -1,31 +0,0 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var get_lambda_by_output_path_exports = {};
20
- __export(get_lambda_by_output_path_exports, {
21
- getLambdaByOutputPath: () => getLambdaByOutputPath
22
- });
23
- module.exports = __toCommonJS(get_lambda_by_output_path_exports);
24
- function getLambdaByOutputPath(params) {
25
- const output = params.buildOutputMap[params.outputPath];
26
- return output?.type === "Lambda" ? output : output?.type === "Prerender" ? output.lambda : void 0;
27
- }
28
- // Annotate the CommonJS export names for ESM import in node:
29
- 0 && (module.exports = {
30
- getLambdaByOutputPath
31
- });
@@ -1,8 +0,0 @@
1
- import type { Chain } from '../types';
2
- import type { Prerender } from '../prerender';
3
- /**
4
- * The Prerender chain can be defined as a `chain` property or as a flag
5
- * `experimentalStreamingLambdaPath`. This function normalizes the chain
6
- * to a single structure.
7
- */
8
- export declare function getPrerenderChain(prerender: Prerender): Chain | undefined;
@@ -1,44 +0,0 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var get_prerender_chain_exports = {};
20
- __export(get_prerender_chain_exports, {
21
- getPrerenderChain: () => getPrerenderChain
22
- });
23
- module.exports = __toCommonJS(get_prerender_chain_exports);
24
- function getPrerenderChain(prerender) {
25
- if (prerender.chain) {
26
- return {
27
- outputPath: prerender.chain.outputPath,
28
- headers: prerender.chain.headers
29
- };
30
- }
31
- if (prerender.experimentalStreamingLambdaPath) {
32
- return {
33
- outputPath: prerender.experimentalStreamingLambdaPath,
34
- headers: {
35
- "x-matched-path": prerender.experimentalStreamingLambdaPath
36
- }
37
- };
38
- }
39
- return void 0;
40
- }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- getPrerenderChain
44
- });
@@ -1,4 +0,0 @@
1
- import type { Route } from '@vercel/routing-utils';
2
- export declare function isRouteMiddleware(route: Route): route is Route & {
3
- middlewarePath: string;
4
- };
@@ -1,30 +0,0 @@
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var is_route_middleware_exports = {};
20
- __export(is_route_middleware_exports, {
21
- isRouteMiddleware: () => isRouteMiddleware
22
- });
23
- module.exports = __toCommonJS(is_route_middleware_exports);
24
- function isRouteMiddleware(route) {
25
- return "middlewarePath" in route && typeof route.middlewarePath === "string";
26
- }
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- isRouteMiddleware
30
- });
@@ -1,23 +0,0 @@
1
- import type { FileDigest } from '../fs/stream-to-digest-async';
2
- import type { Prerender } from '../prerender';
3
- import type { File } from '../types';
4
- import { type BuildOutputFile } from './file-to-build-output-file';
5
- interface PrerenderToBuildOutputFileResult {
6
- digest: FileDigest;
7
- extended: ExtendedPayload;
8
- file: File;
9
- output: BuildOutputFile;
10
- }
11
- export declare function prerenderToBuildOutputFile(params: {
12
- buildResult: Prerender;
13
- outputPath: string;
14
- }): Promise<PrerenderToBuildOutputFileResult | null>;
15
- export interface ExtendedPayload {
16
- extendedBody: {
17
- prefix: string;
18
- suffix: string;
19
- } | undefined;
20
- fallback?: File | null;
21
- initialHeaders: Record<string, string> | undefined;
22
- }
23
- export {};