@vercel/build-utils 14.17.0 → 14.18.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 +11 -0
- package/dist/fs/run-user-scripts.d.ts +19 -1
- package/dist/fs/run-user-scripts.js +112 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +15 -15
- package/dist/schedules.js +17 -4
- package/dist/static-files/bundle.d.ts +11 -0
- package/dist/static-files/bundle.js +67 -0
- package/dist/static-files/index.d.ts +11 -0
- package/dist/static-files/index.js +49 -0
- package/dist/static-files/promote.d.ts +19 -0
- package/dist/static-files/promote.js +90 -0
- package/dist/static-files/routes.d.ts +60 -0
- package/dist/static-files/routes.js +205 -0
- package/dist/static-files/types.d.ts +81 -0
- package/dist/static-files/types.js +32 -0
- package/dist/static-files/utils.d.ts +23 -0
- package/dist/static-files/utils.js +58 -0
- package/dist/types.d.ts +4 -0
- package/package.json +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
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 types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
EMPTY_DISCOVERY: () => EMPTY_DISCOVERY
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(types_exports);
|
|
24
|
+
const EMPTY_DISCOVERY = Object.freeze({
|
|
25
|
+
mounts: Object.freeze([]),
|
|
26
|
+
shadowRoutes: Object.freeze([]),
|
|
27
|
+
excludedFiles: Object.freeze([])
|
|
28
|
+
});
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
EMPTY_DISCOVERY
|
|
32
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { StaticMount, StaticPromotionOptions } from './types';
|
|
2
|
+
/** `urlPath` with trailing slashes removed, so the root mount ("/") is ''. */
|
|
3
|
+
export declare function trimTrailingSlashes(urlPath: string): string;
|
|
4
|
+
export declare function trimSlashes(urlPath: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* True when `urlPath` is `base` or under it. `base` is a normalized (no
|
|
7
|
+
* trailing slash) mount prefix, so '' is the root mount and covers everything.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mountCovers(base: string, urlPath: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Mounts in CDN copy-priority order: plain mounts (declaration order), then
|
|
12
|
+
* frontends (longest prefix first). An earlier mount owns every colliding
|
|
13
|
+
* path under its prefix.
|
|
14
|
+
*/
|
|
15
|
+
export declare function byCopyPriority(mounts: StaticMount[]): StaticMount[];
|
|
16
|
+
/**
|
|
17
|
+
* Escape regex metacharacters in a literal path segment before it goes into a
|
|
18
|
+
* route `src`. Discovery emits shadow bodies already escaped, but mount
|
|
19
|
+
* prefixes are raw URL paths and must be escaped here.
|
|
20
|
+
*/
|
|
21
|
+
export declare function escapeRegex(text: string): string;
|
|
22
|
+
/** Debug-log prefix for a step. */
|
|
23
|
+
export declare function logLabel(opts: StaticPromotionOptions | undefined): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
byCopyPriority: () => byCopyPriority,
|
|
22
|
+
escapeRegex: () => escapeRegex,
|
|
23
|
+
logLabel: () => logLabel,
|
|
24
|
+
mountCovers: () => mountCovers,
|
|
25
|
+
trimSlashes: () => trimSlashes,
|
|
26
|
+
trimTrailingSlashes: () => trimTrailingSlashes
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(utils_exports);
|
|
29
|
+
function trimTrailingSlashes(urlPath) {
|
|
30
|
+
return urlPath.replace(/\/+$/, "");
|
|
31
|
+
}
|
|
32
|
+
function trimSlashes(urlPath) {
|
|
33
|
+
return urlPath.replace(/^\/+|\/+$/g, "");
|
|
34
|
+
}
|
|
35
|
+
function mountCovers(base, urlPath) {
|
|
36
|
+
return base === "" || urlPath === base || urlPath.startsWith(base + "/");
|
|
37
|
+
}
|
|
38
|
+
function byCopyPriority(mounts) {
|
|
39
|
+
return [
|
|
40
|
+
...mounts.filter((m) => !m.frontend),
|
|
41
|
+
...mounts.filter((m) => m.frontend).sort((a, b) => b.urlPath.length - a.urlPath.length)
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
function escapeRegex(text) {
|
|
45
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
46
|
+
}
|
|
47
|
+
function logLabel(opts) {
|
|
48
|
+
return opts?.debugLabel ?? "static-files";
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
byCopyPriority,
|
|
53
|
+
escapeRegex,
|
|
54
|
+
logLabel,
|
|
55
|
+
mountCovers,
|
|
56
|
+
trimSlashes,
|
|
57
|
+
trimTrailingSlashes
|
|
58
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -660,12 +660,15 @@ export interface ScheduleExpression {
|
|
|
660
660
|
/** Maximum random delay applied to each firing, from 1 to 15 whole minutes (OPTIONAL) */
|
|
661
661
|
jitter?: number;
|
|
662
662
|
}
|
|
663
|
+
export type ScheduleRequestMethod = 'GET' | 'POST';
|
|
663
664
|
export type ScheduleTarget = {
|
|
664
665
|
/** Build output path of the function to invoke, e.g. "api/cron" */
|
|
665
666
|
function: string;
|
|
666
667
|
} | {
|
|
667
668
|
/** Deployment path to invoke over HTTP, like `crons[].path`. Must start with `/`. */
|
|
668
669
|
path: string;
|
|
670
|
+
/** HTTP method used to invoke `path`. Defaults to `POST`. */
|
|
671
|
+
requestMethod?: ScheduleRequestMethod;
|
|
669
672
|
} | {
|
|
670
673
|
/** Name of the queue topic to publish to */
|
|
671
674
|
topic: string;
|
|
@@ -687,6 +690,7 @@ export type FlatBuildOutputSchedule = {
|
|
|
687
690
|
jitter?: number;
|
|
688
691
|
} & ({
|
|
689
692
|
path: string;
|
|
693
|
+
requestMethod?: ScheduleRequestMethod;
|
|
690
694
|
} | {
|
|
691
695
|
function: string;
|
|
692
696
|
} | {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.18.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vitest": "4.1.10",
|
|
53
53
|
"typescript": "4.9.5",
|
|
54
54
|
"yazl": "2.5.1",
|
|
55
|
-
"@vercel/
|
|
56
|
-
"@vercel/
|
|
55
|
+
"@vercel/routing-utils": "6.6.0",
|
|
56
|
+
"@vercel/error-utils": "2.2.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "node build.mjs",
|