@vercel/build-utils 13.14.2 → 13.16.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 +20 -0
- package/dist/collect-build-result/file-to-build-output-file.d.ts +26 -0
- package/dist/collect-build-result/file-to-build-output-file.js +54 -0
- package/dist/collect-build-result/get-content-type.d.ts +1 -0
- package/dist/collect-build-result/get-content-type.js +45 -0
- package/dist/collect-build-result/prerender-to-build-output-file.d.ts +23 -0
- package/dist/collect-build-result/prerender-to-build-output-file.js +85 -0
- package/dist/collect-build-result/validate-prerender.d.ts +8 -0
- package/dist/collect-build-result/validate-prerender.js +32 -0
- package/dist/collect-build-result/validate-regular-file.d.ts +9 -0
- package/dist/collect-build-result/validate-regular-file.js +42 -0
- package/dist/deserialize/create-functions-iterator.d.ts +8 -0
- package/dist/deserialize/create-functions-iterator.js +52 -0
- package/dist/deserialize/deserialize-edge-function.d.ts +5 -0
- package/dist/deserialize/deserialize-edge-function.js +47 -0
- package/dist/deserialize/deserialize-lambda.d.ts +22 -0
- package/dist/deserialize/deserialize-lambda.js +56 -0
- package/dist/deserialize/hydrate-files-map.d.ts +3 -0
- package/dist/deserialize/hydrate-files-map.js +55 -0
- package/dist/deserialize/maybe-read-json.d.ts +5 -0
- package/dist/deserialize/maybe-read-json.js +37 -0
- package/dist/deserialize/serialized-types.d.ts +28 -0
- package/dist/deserialize/serialized-types.js +16 -0
- package/dist/deserialize/validate-framework-version.d.ts +5 -0
- package/dist/deserialize/validate-framework-version.js +53 -0
- package/dist/framework-helpers.d.ts +1 -1
- package/dist/framework-helpers.js +2 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +8727 -105
- package/dist/lambda.js +5 -6
- package/dist/types.d.ts +7 -1
- package/package.json +3 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Lambda } from '../lambda';
|
|
2
|
+
import type { NodejsLambda } from '../nodejs-lambda';
|
|
3
|
+
import type { EdgeFunction } from '../edge-function';
|
|
4
|
+
import type FileFsRef from '../file-fs-ref';
|
|
5
|
+
import type { Prerender } from '../prerender';
|
|
6
|
+
/**
|
|
7
|
+
* Maps a type to a new type that does not contain any functions on it.
|
|
8
|
+
* Useful for typing serialized `class` types, which will not contain
|
|
9
|
+
* functions when serialized to JSON.
|
|
10
|
+
*/
|
|
11
|
+
export type Properties<T> = {
|
|
12
|
+
[P in keyof T as T[P] extends (...args: any[]) => any ? never : P]: T[P];
|
|
13
|
+
};
|
|
14
|
+
type FilesMapProp = {
|
|
15
|
+
filePathMap?: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Type for the `.vc-config.json` file of a serialized
|
|
19
|
+
* `ServerlessFunction` instance.
|
|
20
|
+
*/
|
|
21
|
+
export type SerializedLambda = Properties<Omit<Lambda, 'files' | 'zipBuffer'>> & FilesMapProp;
|
|
22
|
+
export type SerializedNodejsLambda = Properties<Omit<NodejsLambda, 'files' | 'zipBuffer'>> & FilesMapProp;
|
|
23
|
+
export type SerializedFileFsRef = Properties<FileFsRef>;
|
|
24
|
+
export type SerializedPrerender = Properties<Omit<Prerender, 'lambda' | 'fallback'>> & {
|
|
25
|
+
fallback: SerializedFileFsRef | null;
|
|
26
|
+
};
|
|
27
|
+
export type SerializedEdgeFunction = Properties<Omit<EdgeFunction, 'name' | 'files' | 'deploymentTarget'>> & FilesMapProp;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var serialized_types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(serialized_types_exports);
|
|
@@ -0,0 +1,53 @@
|
|
|
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 validate_framework_version_exports = {};
|
|
20
|
+
__export(validate_framework_version_exports, {
|
|
21
|
+
validateFrameworkVersion: () => validateFrameworkVersion
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(validate_framework_version_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
const MAX_FRAMEWORK_VERSION_LENGTH = 50;
|
|
26
|
+
function validateFrameworkVersion(frameworkVersion) {
|
|
27
|
+
if (!frameworkVersion) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
if (typeof frameworkVersion !== "string") {
|
|
31
|
+
throw new import_errors.NowBuildError({
|
|
32
|
+
message: `Invalid config.json: "framework.version" type "${typeof frameworkVersion}" should be "string"`,
|
|
33
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_TYPE"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (frameworkVersion.length > MAX_FRAMEWORK_VERSION_LENGTH) {
|
|
37
|
+
const trimmedFrameworkVersion = frameworkVersion.slice(
|
|
38
|
+
0,
|
|
39
|
+
MAX_FRAMEWORK_VERSION_LENGTH
|
|
40
|
+
);
|
|
41
|
+
throw new import_errors.NowBuildError({
|
|
42
|
+
message: `Invalid config.json: "framework.version" length ${frameworkVersion.length} > ${MAX_FRAMEWORK_VERSION_LENGTH}. "${trimmedFrameworkVersion}..."`,
|
|
43
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_LENGTH"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
version: frameworkVersion
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
validateFrameworkVersion
|
|
53
|
+
});
|
|
@@ -3,7 +3,7 @@ import { Builder } from '.';
|
|
|
3
3
|
* List of backend frameworks supported by the experimental backends feature
|
|
4
4
|
*/
|
|
5
5
|
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
|
|
6
|
-
export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "django", "python"];
|
|
6
|
+
export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "django", "python", "fasthtml"];
|
|
7
7
|
export declare const RUNTIME_FRAMEWORKS: readonly ["python"];
|
|
8
8
|
/**
|
|
9
9
|
* List of framework-specific backend builders that get replaced by UNIFIED_BACKEND_BUILDER
|
package/dist/index.d.ts
CHANGED
|
@@ -50,3 +50,15 @@ export { streamWithExtendedPayload, type ExtendedBodyData, } from './collect-bui
|
|
|
50
50
|
export { collectUncompressedSize } from './collect-uncompressed-size';
|
|
51
51
|
export { finalizeLambda, type CreateZipResult, type CreateZipFn, type FinalizeLambdaParams, type FinalizeLambdaResult, type TraceFn, } from './finalize-lambda';
|
|
52
52
|
export { validateLambdaSize, validateUncompressedLambdaSize, FunctionSizeError, MAX_LAMBDA_SIZE, MAX_LAMBDA_UNCOMPRESSED_SIZE, validateEnvWrapperSupport, ENV_WRAPPER_SUPPORTED_FAMILIES, } from './validate-lambda-size';
|
|
53
|
+
export { validateFrameworkVersion } from './deserialize/validate-framework-version';
|
|
54
|
+
export { hydrateFilesMap } from './deserialize/hydrate-files-map';
|
|
55
|
+
export { createFunctionsIterator } from './deserialize/create-functions-iterator';
|
|
56
|
+
export { maybeReadJSON } from './deserialize/maybe-read-json';
|
|
57
|
+
export { deserializeLambda, type DeserializeLambdaOptions, } from './deserialize/deserialize-lambda';
|
|
58
|
+
export { deserializeEdgeFunction } from './deserialize/deserialize-edge-function';
|
|
59
|
+
export type { Properties, SerializedLambda, SerializedNodejsLambda, SerializedEdgeFunction, SerializedFileFsRef, SerializedPrerender, } from './deserialize/serialized-types';
|
|
60
|
+
export { validateRegularFile } from './collect-build-result/validate-regular-file';
|
|
61
|
+
export { validatePrerender } from './collect-build-result/validate-prerender';
|
|
62
|
+
export { getContentType } from './collect-build-result/get-content-type';
|
|
63
|
+
export { fileToBuildOutputFile, type BuildOutputFile, } from './collect-build-result/file-to-build-output-file';
|
|
64
|
+
export { prerenderToBuildOutputFile, type ExtendedPayload, } from './collect-build-result/prerender-to-build-output-file';
|