@vercel/build-utils 13.16.0 → 13.17.1
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/prerender-to-build-output-file.js +1 -1
- package/dist/deserialize/serialized-types.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -1
- package/dist/service-path-utils.d.ts +13 -0
- package/dist/service-path-utils.js +48 -0
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Align deserialize logic with existing callers. ([#16002](https://github.com/vercel/vercel/pull/16002))
|
|
8
|
+
|
|
9
|
+
## 13.17.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Support dynamically specifying crons from a python service ([#15930](https://github.com/vercel/vercel/pull/15930))
|
|
14
|
+
|
|
3
15
|
## 13.16.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -54,6 +54,7 @@ async function prerenderToBuildOutputFile(params) {
|
|
|
54
54
|
}
|
|
55
55
|
const CRLF = "\r\n";
|
|
56
56
|
const MULTIPART_HEADER = "multipart/x-nextjs-extended-payload";
|
|
57
|
+
const boundary = (0, import_crypto.randomBytes)(8).toString("hex");
|
|
57
58
|
function getExtendedPayload({
|
|
58
59
|
initialHeaders,
|
|
59
60
|
fallback
|
|
@@ -61,7 +62,6 @@ function getExtendedPayload({
|
|
|
61
62
|
if (!initialHeaders || !Object.entries(initialHeaders).length) {
|
|
62
63
|
return { initialHeaders: void 0, fallback, extendedBody: void 0 };
|
|
63
64
|
}
|
|
64
|
-
const boundary = (0, import_crypto.randomBytes)(8).toString("hex");
|
|
65
65
|
return {
|
|
66
66
|
initialHeaders: {
|
|
67
67
|
...fallback ? {} : { "x-vercel-empty-fallback": "true" },
|
|
@@ -18,8 +18,8 @@ type FilesMapProp = {
|
|
|
18
18
|
* Type for the `.vc-config.json` file of a serialized
|
|
19
19
|
* `ServerlessFunction` instance.
|
|
20
20
|
*/
|
|
21
|
-
export type SerializedLambda = Properties<Omit<
|
|
22
|
-
export type SerializedNodejsLambda = Properties<Omit<
|
|
21
|
+
export type SerializedLambda<T extends Lambda = Lambda> = Properties<Omit<T, 'files' | 'zipBuffer'>> & FilesMapProp;
|
|
22
|
+
export type SerializedNodejsLambda<T extends NodejsLambda = NodejsLambda> = Properties<Omit<T, 'files' | 'zipBuffer'>> & FilesMapProp;
|
|
23
23
|
export type SerializedFileFsRef = Properties<FileFsRef>;
|
|
24
24
|
export type SerializedPrerender = Properties<Omit<Prerender, 'lambda' | 'fallback'>> & {
|
|
25
25
|
fallback: SerializedFileFsRef | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ 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
39
|
export * from './node-entrypoint';
|
|
40
|
+
export * from './service-path-utils';
|
|
40
41
|
export { getEncryptedEnv, type EncryptedEnvFile, } from './process-serverless/get-encrypted-env-file';
|
|
41
42
|
export { getLambdaEnvironment } from './process-serverless/get-lambda-environment';
|
|
42
43
|
export { getLambdaPreloadScripts, type BytecodeCachingOptions, } from './process-serverless/get-lambda-preload-scripts';
|
package/dist/index.js
CHANGED
|
@@ -28255,6 +28255,7 @@ __export(src_exports, {
|
|
|
28255
28255
|
FileFsRef: () => file_fs_ref_default,
|
|
28256
28256
|
FileRef: () => FileRef,
|
|
28257
28257
|
FunctionSizeError: () => FunctionSizeError,
|
|
28258
|
+
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
|
|
28258
28259
|
Lambda: () => Lambda,
|
|
28259
28260
|
MAX_LAMBDA_SIZE: () => MAX_LAMBDA_SIZE,
|
|
28260
28261
|
MAX_LAMBDA_UNCOMPRESSED_SIZE: () => MAX_LAMBDA_UNCOMPRESSED_SIZE,
|
|
@@ -28292,6 +28293,9 @@ __export(src_exports, {
|
|
|
28292
28293
|
getEnvForPackageManager: () => getEnvForPackageManager,
|
|
28293
28294
|
getIgnoreFilter: () => get_ignore_filter_default,
|
|
28294
28295
|
getInstalledPackageVersion: () => getInstalledPackageVersion,
|
|
28296
|
+
getInternalServiceCronPath: () => getInternalServiceCronPath,
|
|
28297
|
+
getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
|
|
28298
|
+
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath,
|
|
28295
28299
|
getLambdaByOutputPath: () => getLambdaByOutputPath,
|
|
28296
28300
|
getLambdaEnvironment: () => getLambdaEnvironment,
|
|
28297
28301
|
getLambdaOptionsFromFunction: () => getLambdaOptionsFromFunction,
|
|
@@ -32436,6 +32440,23 @@ async function isNodeEntrypoint(file) {
|
|
|
32436
32440
|
}
|
|
32437
32441
|
}
|
|
32438
32442
|
|
|
32443
|
+
// src/service-path-utils.ts
|
|
32444
|
+
var INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
32445
|
+
function normalizeInternalServiceEntrypoint(entrypoint) {
|
|
32446
|
+
const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
|
|
32447
|
+
return normalized || "index";
|
|
32448
|
+
}
|
|
32449
|
+
function getInternalServiceFunctionPath(serviceName) {
|
|
32450
|
+
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/index`;
|
|
32451
|
+
}
|
|
32452
|
+
function getInternalServiceCronPathPrefix(serviceName) {
|
|
32453
|
+
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/crons`;
|
|
32454
|
+
}
|
|
32455
|
+
function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
|
|
32456
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
32457
|
+
return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
32458
|
+
}
|
|
32459
|
+
|
|
32439
32460
|
// src/process-serverless/get-encrypted-env-file.ts
|
|
32440
32461
|
function getEncryptedEnv(envFilename, envContent) {
|
|
32441
32462
|
if (!envFilename || !envContent) {
|
|
@@ -33242,6 +33263,7 @@ async function prerenderToBuildOutputFile(params) {
|
|
|
33242
33263
|
}
|
|
33243
33264
|
var CRLF = "\r\n";
|
|
33244
33265
|
var MULTIPART_HEADER = "multipart/x-nextjs-extended-payload";
|
|
33266
|
+
var boundary = (0, import_crypto2.randomBytes)(8).toString("hex");
|
|
33245
33267
|
function getExtendedPayload({
|
|
33246
33268
|
initialHeaders,
|
|
33247
33269
|
fallback
|
|
@@ -33249,7 +33271,6 @@ function getExtendedPayload({
|
|
|
33249
33271
|
if (!initialHeaders || !Object.entries(initialHeaders).length) {
|
|
33250
33272
|
return { initialHeaders: void 0, fallback, extendedBody: void 0 };
|
|
33251
33273
|
}
|
|
33252
|
-
const boundary = (0, import_crypto2.randomBytes)(8).toString("hex");
|
|
33253
33274
|
return {
|
|
33254
33275
|
initialHeaders: {
|
|
33255
33276
|
...fallback ? {} : { "x-vercel-empty-fallback": "true" },
|
|
@@ -33280,6 +33301,7 @@ function getExtendedPayload({
|
|
|
33280
33301
|
FileFsRef,
|
|
33281
33302
|
FileRef,
|
|
33282
33303
|
FunctionSizeError,
|
|
33304
|
+
INTERNAL_SERVICE_PREFIX,
|
|
33283
33305
|
Lambda,
|
|
33284
33306
|
MAX_LAMBDA_SIZE,
|
|
33285
33307
|
MAX_LAMBDA_UNCOMPRESSED_SIZE,
|
|
@@ -33317,6 +33339,9 @@ function getExtendedPayload({
|
|
|
33317
33339
|
getEnvForPackageManager,
|
|
33318
33340
|
getIgnoreFilter,
|
|
33319
33341
|
getInstalledPackageVersion,
|
|
33342
|
+
getInternalServiceCronPath,
|
|
33343
|
+
getInternalServiceCronPathPrefix,
|
|
33344
|
+
getInternalServiceFunctionPath,
|
|
33320
33345
|
getLambdaByOutputPath,
|
|
33321
33346
|
getLambdaEnvironment,
|
|
33322
33347
|
getLambdaOptionsFromFunction,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for generating internal service paths.
|
|
3
|
+
*
|
|
4
|
+
* These are used by builders (e.g. @vercel/python) to produce cron entries
|
|
5
|
+
* and rewrite routes for service builds.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Reserved internal namespace used by services routing/runtime plumbing.
|
|
9
|
+
*/
|
|
10
|
+
export declare const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
11
|
+
export declare function getInternalServiceFunctionPath(serviceName: string): string;
|
|
12
|
+
export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
|
|
13
|
+
export declare function getInternalServiceCronPath(serviceName: string, entrypoint: string, handler?: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 service_path_utils_exports = {};
|
|
20
|
+
__export(service_path_utils_exports, {
|
|
21
|
+
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
|
|
22
|
+
getInternalServiceCronPath: () => getInternalServiceCronPath,
|
|
23
|
+
getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
|
|
24
|
+
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(service_path_utils_exports);
|
|
27
|
+
const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
28
|
+
function normalizeInternalServiceEntrypoint(entrypoint) {
|
|
29
|
+
const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
|
|
30
|
+
return normalized || "index";
|
|
31
|
+
}
|
|
32
|
+
function getInternalServiceFunctionPath(serviceName) {
|
|
33
|
+
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/index`;
|
|
34
|
+
}
|
|
35
|
+
function getInternalServiceCronPathPrefix(serviceName) {
|
|
36
|
+
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/crons`;
|
|
37
|
+
}
|
|
38
|
+
function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
|
|
39
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
40
|
+
return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
INTERNAL_SERVICE_PREFIX,
|
|
45
|
+
getInternalServiceCronPath,
|
|
46
|
+
getInternalServiceCronPathPrefix,
|
|
47
|
+
getInternalServiceFunctionPath
|
|
48
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -118,6 +118,8 @@ export interface BuildOptions {
|
|
|
118
118
|
subdomain?: string;
|
|
119
119
|
/** Workspace directory for this service, relative to the project root. */
|
|
120
120
|
workspace?: string;
|
|
121
|
+
/** Cron schedule expression (e.g., "0 0 * * *"). Only present for cron services. */
|
|
122
|
+
schedule?: string;
|
|
121
123
|
};
|
|
122
124
|
}
|
|
123
125
|
export interface PrepareCacheOptions {
|
|
@@ -219,6 +221,11 @@ export interface StartDevServerSuccess {
|
|
|
219
221
|
* dev server will forcefully be killed.
|
|
220
222
|
*/
|
|
221
223
|
shutdown?: () => Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Cron entries produced by the builder for this service.
|
|
226
|
+
* Used by the dev orchestrator to schedule cron triggers.
|
|
227
|
+
*/
|
|
228
|
+
crons?: Cron[];
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* `startDevServer()` may return `null` to opt-out of spawning a dev server for
|
|
@@ -545,6 +552,7 @@ export interface BuildResultV2Typical {
|
|
|
545
552
|
* @example "abc123"
|
|
546
553
|
*/
|
|
547
554
|
deploymentId?: string;
|
|
555
|
+
crons?: Cron[];
|
|
548
556
|
}
|
|
549
557
|
export type BuildResultVX = {
|
|
550
558
|
resultVersion: 2;
|
|
@@ -557,6 +565,7 @@ export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
|
|
|
557
565
|
export interface BuildResultV3 {
|
|
558
566
|
routes?: any[];
|
|
559
567
|
output: Lambda | EdgeFunction;
|
|
568
|
+
crons?: Cron[];
|
|
560
569
|
}
|
|
561
570
|
export type BuildVX = (options: BuildOptions) => Promise<BuildResultVX>;
|
|
562
571
|
export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
|