@vercel/build-utils 14.23.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.
- package/CHANGELOG.md +18 -0
- package/dist/fs/node-version.js +0 -3
- package/dist/fs/stream-to-digest-async.d.ts +0 -1
- package/dist/fs/stream-to-digest-async.js +3 -8
- package/dist/index.d.ts +1 -28
- package/dist/index.js +11 -37
- package/dist/schedules.d.ts +4 -0
- package/dist/types.d.ts +5 -0
- package/package.json +3 -7
- package/dist/collect-build-result/file-to-build-output-file.d.ts +0 -26
- package/dist/collect-build-result/file-to-build-output-file.js +0 -54
- package/dist/collect-build-result/get-build-result-metadata.d.ts +0 -33
- package/dist/collect-build-result/get-build-result-metadata.js +0 -99
- package/dist/collect-build-result/get-content-type.d.ts +0 -1
- package/dist/collect-build-result/get-content-type.js +0 -45
- package/dist/collect-build-result/get-lambda-by-output-path.d.ts +0 -13
- package/dist/collect-build-result/get-lambda-by-output-path.js +0 -31
- package/dist/collect-build-result/get-prerender-chain.d.ts +0 -8
- package/dist/collect-build-result/get-prerender-chain.js +0 -44
- package/dist/collect-build-result/is-route-middleware.d.ts +0 -4
- package/dist/collect-build-result/is-route-middleware.js +0 -30
- package/dist/collect-build-result/prerender-to-build-output-file.d.ts +0 -23
- package/dist/collect-build-result/prerender-to-build-output-file.js +0 -85
- package/dist/collect-build-result/stream-with-extended-payload.d.ts +0 -5
- package/dist/collect-build-result/stream-with-extended-payload.js +0 -49
- package/dist/collect-build-result/validate-build-result.d.ts +0 -19
- package/dist/collect-build-result/validate-build-result.js +0 -139
- package/dist/collect-build-result/validate-prerender.d.ts +0 -8
- package/dist/collect-build-result/validate-prerender.js +0 -32
- package/dist/collect-build-result/validate-regular-file.d.ts +0 -8
- package/dist/collect-build-result/validate-regular-file.js +0 -42
- package/dist/collect-uncompressed-size.d.ts +0 -6
- package/dist/collect-uncompressed-size.js +0 -59
- package/dist/deserialize/create-functions-iterator.d.ts +0 -8
- package/dist/deserialize/create-functions-iterator.js +0 -52
- package/dist/deserialize/deserialize-build-output-types.d.ts +0 -56
- package/dist/deserialize/deserialize-build-output-types.js +0 -16
- package/dist/deserialize/deserialize-build-output.d.ts +0 -4
- package/dist/deserialize/deserialize-build-output.js +0 -296
- package/dist/deserialize/deserialize-edge-function.d.ts +0 -5
- package/dist/deserialize/deserialize-edge-function.js +0 -47
- package/dist/deserialize/deserialize-lambda.d.ts +0 -22
- package/dist/deserialize/deserialize-lambda.js +0 -56
- package/dist/deserialize/hydrate-files-map.d.ts +0 -3
- package/dist/deserialize/hydrate-files-map.js +0 -55
- package/dist/deserialize/maybe-read-json.d.ts +0 -5
- package/dist/deserialize/maybe-read-json.js +0 -37
- package/dist/deserialize/serialized-types.d.ts +0 -32
- package/dist/deserialize/serialized-types.js +0 -16
- package/dist/deserialize/validate-framework-version.d.ts +0 -6
- package/dist/deserialize/validate-framework-version.js +0 -63
- package/dist/finalize-lambda.d.ts +0 -77
- package/dist/finalize-lambda.js +0 -117
- package/dist/process-serverless/get-encrypted-env-file.d.ts +0 -11
- package/dist/process-serverless/get-encrypted-env-file.js +0 -47
- package/dist/process-serverless/get-lambda-environment.d.ts +0 -19
- package/dist/process-serverless/get-lambda-environment.js +0 -53
- package/dist/process-serverless/get-lambda-preload-scripts.d.ts +0 -22
- package/dist/process-serverless/get-lambda-preload-scripts.js +0 -43
- package/dist/process-serverless/get-lambda-supports-streaming.d.ts +0 -22
- package/dist/process-serverless/get-lambda-supports-streaming.js +0 -42
- package/dist/validate-lambda-size.d.ts +0 -45
- package/dist/validate-lambda-size.js +0 -117
package/dist/schedules.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import type { Schedule, ScheduleDefinition, Schedules } from './types';
|
|
|
6
6
|
*/
|
|
7
7
|
export type VercelJsonScheduleDefinition = ScheduleDefinition | (Pick<ScheduleDefinition, 'schedule' | 'timezone' | 'jitter'> & {
|
|
8
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;
|
|
9
13
|
});
|
|
10
14
|
/** `vercel.json#schedules`: schedules keyed by name. */
|
|
11
15
|
export type VercelJsonSchedules = Record<string, VercelJsonScheduleDefinition>;
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "
|
|
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",
|
|
@@ -52,8 +48,8 @@
|
|
|
52
48
|
"vitest": "4.1.10",
|
|
53
49
|
"typescript": "4.9.5",
|
|
54
50
|
"yazl": "2.5.1",
|
|
55
|
-
"@vercel/
|
|
56
|
-
"@vercel/
|
|
51
|
+
"@vercel/error-utils": "2.2.1",
|
|
52
|
+
"@vercel/routing-utils": "6.6.0"
|
|
57
53
|
},
|
|
58
54
|
"scripts": {
|
|
59
55
|
"build": "node build.mjs",
|
|
@@ -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,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 {};
|
|
@@ -1,85 +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 prerender_to_build_output_file_exports = {};
|
|
30
|
-
__export(prerender_to_build_output_file_exports, {
|
|
31
|
-
prerenderToBuildOutputFile: () => prerenderToBuildOutputFile
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(prerender_to_build_output_file_exports);
|
|
34
|
-
var import_file_blob = __toESM(require("../file-blob"));
|
|
35
|
-
var import_crypto = require("crypto");
|
|
36
|
-
var import_file_to_build_output_file = require("./file-to-build-output-file");
|
|
37
|
-
async function prerenderToBuildOutputFile(params) {
|
|
38
|
-
const extended = getExtendedPayload(params.buildResult);
|
|
39
|
-
if (!extended.fallback) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const filePath = params.outputPath + ".fallback";
|
|
43
|
-
const { output, digest } = await (0, import_file_to_build_output_file.fileToBuildOutputFile)({
|
|
44
|
-
outputPath: filePath,
|
|
45
|
-
buildResult: extended.fallback,
|
|
46
|
-
extendedBody: extended.extendedBody
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
file: extended.fallback,
|
|
50
|
-
output,
|
|
51
|
-
digest,
|
|
52
|
-
extended
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
const CRLF = "\r\n";
|
|
56
|
-
const MULTIPART_HEADER = "multipart/x-nextjs-extended-payload";
|
|
57
|
-
const boundary = (0, import_crypto.randomBytes)(8).toString("hex");
|
|
58
|
-
function getExtendedPayload({
|
|
59
|
-
initialHeaders,
|
|
60
|
-
fallback
|
|
61
|
-
}) {
|
|
62
|
-
if (!initialHeaders || !Object.entries(initialHeaders).length) {
|
|
63
|
-
return { initialHeaders: void 0, fallback, extendedBody: void 0 };
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
initialHeaders: {
|
|
67
|
-
...fallback ? {} : { "x-vercel-empty-fallback": "true" },
|
|
68
|
-
"content-type": `${MULTIPART_HEADER}; boundary=${boundary}`
|
|
69
|
-
},
|
|
70
|
-
fallback: fallback ?? new import_file_blob.default({ data: "" }),
|
|
71
|
-
extendedBody: {
|
|
72
|
-
suffix: `${CRLF}${CRLF}--${boundary}--${CRLF}`,
|
|
73
|
-
prefix: [
|
|
74
|
-
`--${boundary}`,
|
|
75
|
-
...Object.entries(initialHeaders).map(
|
|
76
|
-
([key, value]) => `${key}: ${value}`
|
|
77
|
-
)
|
|
78
|
-
].join(CRLF) + CRLF + CRLF
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
0 && (module.exports = {
|
|
84
|
-
prerenderToBuildOutputFile
|
|
85
|
-
});
|
|
@@ -1,49 +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 stream_with_extended_payload_exports = {};
|
|
20
|
-
__export(stream_with_extended_payload_exports, {
|
|
21
|
-
streamWithExtendedPayload: () => streamWithExtendedPayload
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stream_with_extended_payload_exports);
|
|
24
|
-
var import_stream = require("stream");
|
|
25
|
-
function streamWithExtendedPayload(stream, data) {
|
|
26
|
-
return data ? new MultipartContentStream(stream, data) : stream;
|
|
27
|
-
}
|
|
28
|
-
class MultipartContentStream extends import_stream.Readable {
|
|
29
|
-
constructor(stream, data) {
|
|
30
|
-
super();
|
|
31
|
-
stream.on("error", (err) => {
|
|
32
|
-
this.emit("error", err);
|
|
33
|
-
});
|
|
34
|
-
stream.on("end", () => {
|
|
35
|
-
this.push(data.suffix);
|
|
36
|
-
this.push(null);
|
|
37
|
-
});
|
|
38
|
-
this.push(data.prefix);
|
|
39
|
-
stream.on("data", (chunk) => {
|
|
40
|
-
this.push(chunk);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
_read() {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
streamWithExtendedPayload
|
|
49
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BuildResultV2Typical, BuildResultV3, BuilderFunctions, Config } from '../types';
|
|
2
|
-
export declare const SUPPORTED_AL2023_RUNTIMES: readonly ["nodejs20.x", "nodejs22.x", "nodejs24.x", "nodejs26.x", "provided.al2023", "python3.12", "python3.13", "python3.14", "ruby3.3", "bun1.4.x", "bun1.x", "executable"];
|
|
3
|
-
type BuildConfigWithVercelConfig = Config & {
|
|
4
|
-
vercelConfig?: {
|
|
5
|
-
functions?: BuilderFunctions;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export interface ValidateBuildResultParams {
|
|
9
|
-
allowInvalidRuntime?: boolean;
|
|
10
|
-
buildConfig?: BuildConfigWithVercelConfig;
|
|
11
|
-
buildResponse: BuildResultV2Typical | BuildResultV3;
|
|
12
|
-
vercelBaseUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ValidateBuildResultResult {
|
|
15
|
-
buildOutputMap: BuildResultV2Typical['output'];
|
|
16
|
-
customFunctionConfiguration?: BuilderFunctions[string];
|
|
17
|
-
}
|
|
18
|
-
export declare function validateBuildResult({ allowInvalidRuntime, buildConfig, buildResponse, vercelBaseUrl, }: ValidateBuildResultParams): Promise<ValidateBuildResultResult>;
|
|
19
|
-
export {};
|