@vercel/build-utils 13.10.0 → 13.12.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 +12 -0
- package/dist/collect-build-result/get-build-result-metadata.d.ts +33 -0
- package/dist/collect-build-result/get-build-result-metadata.js +99 -0
- package/dist/collect-build-result/get-lambda-by-output-path.d.ts +13 -0
- package/dist/collect-build-result/get-lambda-by-output-path.js +31 -0
- package/dist/collect-build-result/get-prerender-chain.d.ts +8 -0
- package/dist/collect-build-result/get-prerender-chain.js +44 -0
- package/dist/collect-build-result/is-route-middleware.d.ts +4 -0
- package/dist/collect-build-result/is-route-middleware.js +30 -0
- package/dist/collect-build-result/stream-with-extended-payload.d.ts +6 -0
- package/dist/collect-build-result/stream-with-extended-payload.js +49 -0
- package/dist/fs/stream-to-digest-async.d.ts +10 -0
- package/dist/fs/stream-to-digest-async.js +62 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +516 -90
- package/dist/process-serverless/get-encrypted-env-file.d.ts +11 -0
- package/dist/process-serverless/get-encrypted-env-file.js +47 -0
- package/dist/process-serverless/get-lambda-environment.d.ts +18 -0
- package/dist/process-serverless/get-lambda-environment.js +53 -0
- package/dist/process-serverless/get-lambda-preload-scripts.d.ts +21 -0
- package/dist/process-serverless/get-lambda-preload-scripts.js +43 -0
- package/dist/process-serverless/get-lambda-supports-streaming.d.ts +23 -0
- package/dist/process-serverless/get-lambda-supports-streaming.js +98 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add hash utilities (`streamToDigestAsync`, `sha256`, `md5`) and build result helpers (`getBuildResultMetadata`, `getLambdaByOutputPath`, `isRouteMiddleware`, `getPrerenderChain`, `streamWithExtendedPayload`) for shared use. ([#15726](https://github.com/vercel/vercel/pull/15726))
|
|
8
|
+
|
|
9
|
+
## 13.11.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add `process-serverless` utilities: `getLambdaEnvironment`, `getLambdaPreloadScripts`, `getLambdaSupportsStreaming`, and `getEncryptedEnv`. ([#15712](https://github.com/vercel/vercel/pull/15712))
|
|
14
|
+
|
|
3
15
|
## 13.10.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -0,0 +1,33 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export interface FileDigest {
|
|
4
|
+
md5: string;
|
|
5
|
+
sha256: string;
|
|
6
|
+
size: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function streamToDigestAsync(stream: NodeJS.ReadableStream): Promise<FileDigest>;
|
|
9
|
+
export declare function sha256(value: any): string;
|
|
10
|
+
export declare function md5(value: Buffer): string;
|
|
@@ -0,0 +1,62 @@
|
|
|
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_to_digest_async_exports = {};
|
|
20
|
+
__export(stream_to_digest_async_exports, {
|
|
21
|
+
md5: () => md5,
|
|
22
|
+
sha256: () => sha256,
|
|
23
|
+
streamToDigestAsync: () => streamToDigestAsync
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stream_to_digest_async_exports);
|
|
26
|
+
var import_crypto = require("crypto");
|
|
27
|
+
async function streamToDigestAsync(stream) {
|
|
28
|
+
return await new Promise((resolve, reject) => {
|
|
29
|
+
stream.once("error", reject);
|
|
30
|
+
let count = 0;
|
|
31
|
+
const sha2562 = (0, import_crypto.createHash)("sha256");
|
|
32
|
+
const md52 = (0, import_crypto.createHash)("md5");
|
|
33
|
+
stream.on("end", () => {
|
|
34
|
+
const res = {
|
|
35
|
+
sha256: sha2562.digest("hex"),
|
|
36
|
+
md5: md52.digest("hex"),
|
|
37
|
+
size: count
|
|
38
|
+
};
|
|
39
|
+
resolve(res);
|
|
40
|
+
});
|
|
41
|
+
stream.on("readable", () => {
|
|
42
|
+
let chunk;
|
|
43
|
+
while (null !== (chunk = stream.read())) {
|
|
44
|
+
md52.update(chunk);
|
|
45
|
+
sha2562.update(chunk);
|
|
46
|
+
count += chunk.length;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function sha256(value) {
|
|
52
|
+
return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
|
|
53
|
+
}
|
|
54
|
+
function md5(value) {
|
|
55
|
+
return (0, import_crypto.createHash)("md5").update(value).digest("hex");
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
md5,
|
|
60
|
+
sha256,
|
|
61
|
+
streamToDigestAsync
|
|
62
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -36,3 +36,13 @@ export { defaultCachePathGlob } from './default-cache-path-glob';
|
|
|
36
36
|
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
|
|
37
37
|
export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, BackendFramework, isBackendFramework, isNodeBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
|
|
38
38
|
export * from './python';
|
|
39
|
+
export { getEncryptedEnv, type EncryptedEnvFile, } from './process-serverless/get-encrypted-env-file';
|
|
40
|
+
export { getLambdaEnvironment } from './process-serverless/get-lambda-environment';
|
|
41
|
+
export { getLambdaPreloadScripts, type BytecodeCachingOptions, } from './process-serverless/get-lambda-preload-scripts';
|
|
42
|
+
export { getLambdaSupportsStreaming, type SupportsStreamingResult, } from './process-serverless/get-lambda-supports-streaming';
|
|
43
|
+
export { streamToDigestAsync, sha256, md5, type FileDigest, } from './fs/stream-to-digest-async';
|
|
44
|
+
export { getBuildResultMetadata, type BuildResultMetadata, } from './collect-build-result/get-build-result-metadata';
|
|
45
|
+
export { getLambdaByOutputPath } from './collect-build-result/get-lambda-by-output-path';
|
|
46
|
+
export { isRouteMiddleware } from './collect-build-result/is-route-middleware';
|
|
47
|
+
export { getPrerenderChain } from './collect-build-result/get-prerender-chain';
|
|
48
|
+
export { streamWithExtendedPayload, type ExtendedBodyData, } from './collect-build-result/stream-with-extended-payload';
|