@vercel/build-utils 14.1.1 → 14.3.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 +19 -0
- package/build.mjs +3 -11
- package/dist/fs/run-user-scripts.d.ts +19 -10
- package/dist/fs/run-user-scripts.js +266 -85
- package/dist/index.d.ts +0 -1
- package/dist/index.js +586 -416
- package/dist/service-path-utils.d.ts +2 -0
- package/dist/service-path-utils.js +13 -2
- package/dist/types.d.ts +24 -6
- package/package.json +4 -5
- package/turbo.json +43 -7
- package/dist/python.d.ts +0 -10
- package/dist/python.js +0 -52
|
@@ -11,3 +11,5 @@ export declare const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
|
11
11
|
export declare function getInternalServiceFunctionPath(serviceName: string): string;
|
|
12
12
|
export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
|
|
13
13
|
export declare function getInternalServiceCronPath(serviceName: string, entrypoint: string, handler?: string): string;
|
|
14
|
+
export declare function getInternalServiceWorkerPathPrefix(serviceName: string): string;
|
|
15
|
+
export declare function getInternalServiceWorkerPath(serviceName: string, entrypoint: string, handler?: string): string;
|
|
@@ -21,7 +21,9 @@ __export(service_path_utils_exports, {
|
|
|
21
21
|
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
|
|
22
22
|
getInternalServiceCronPath: () => getInternalServiceCronPath,
|
|
23
23
|
getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
|
|
24
|
-
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath
|
|
24
|
+
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath,
|
|
25
|
+
getInternalServiceWorkerPath: () => getInternalServiceWorkerPath,
|
|
26
|
+
getInternalServiceWorkerPathPrefix: () => getInternalServiceWorkerPathPrefix
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(service_path_utils_exports);
|
|
27
29
|
const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
@@ -39,10 +41,19 @@ function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
|
|
|
39
41
|
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
40
42
|
return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
41
43
|
}
|
|
44
|
+
function getInternalServiceWorkerPathPrefix(serviceName) {
|
|
45
|
+
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/workers`;
|
|
46
|
+
}
|
|
47
|
+
function getInternalServiceWorkerPath(serviceName, entrypoint, handler = "worker") {
|
|
48
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
49
|
+
return `${getInternalServiceWorkerPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
50
|
+
}
|
|
42
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
52
|
0 && (module.exports = {
|
|
44
53
|
INTERNAL_SERVICE_PREFIX,
|
|
45
54
|
getInternalServiceCronPath,
|
|
46
55
|
getInternalServiceCronPathPrefix,
|
|
47
|
-
getInternalServiceFunctionPath
|
|
56
|
+
getInternalServiceFunctionPath,
|
|
57
|
+
getInternalServiceWorkerPath,
|
|
58
|
+
getInternalServiceWorkerPathPrefix
|
|
48
59
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -321,6 +321,14 @@ export declare namespace PackageJson {
|
|
|
321
321
|
pnpm?: string;
|
|
322
322
|
bun?: string;
|
|
323
323
|
}
|
|
324
|
+
interface DevEnginePackageManager {
|
|
325
|
+
name?: string;
|
|
326
|
+
version?: string;
|
|
327
|
+
onFail?: 'download' | 'error' | 'warn' | 'ignore';
|
|
328
|
+
}
|
|
329
|
+
interface DevEngines {
|
|
330
|
+
packageManager?: DevEnginePackageManager | DevEnginePackageManager[];
|
|
331
|
+
}
|
|
324
332
|
interface PublishConfig {
|
|
325
333
|
registry?: string;
|
|
326
334
|
}
|
|
@@ -359,6 +367,7 @@ export interface PackageJson {
|
|
|
359
367
|
readonly optionalDependencies?: PackageJson.DependencyMap;
|
|
360
368
|
readonly bundledDependencies?: string[];
|
|
361
369
|
readonly engines?: PackageJson.Engines;
|
|
370
|
+
readonly devEngines?: PackageJson.DevEngines;
|
|
362
371
|
readonly os?: string[];
|
|
363
372
|
readonly cpu?: string[];
|
|
364
373
|
readonly preferGlobal?: boolean;
|
|
@@ -738,7 +747,7 @@ export interface Chain {
|
|
|
738
747
|
*/
|
|
739
748
|
headers: Record<string, string>;
|
|
740
749
|
}
|
|
741
|
-
interface
|
|
750
|
+
interface QueueTriggerEventBase {
|
|
742
751
|
/** Name of the queue topic to consume from (REQUIRED) */
|
|
743
752
|
topic: string;
|
|
744
753
|
/**
|
|
@@ -770,7 +779,7 @@ interface TriggerEventBase {
|
|
|
770
779
|
* Queue trigger input event for v1beta (from vercel.json config).
|
|
771
780
|
* Requires explicit consumer name.
|
|
772
781
|
*/
|
|
773
|
-
export interface
|
|
782
|
+
export interface QueueTriggerEventInputV1 extends QueueTriggerEventBase {
|
|
774
783
|
/** Event type - must be "queue/v1beta" (REQUIRED) */
|
|
775
784
|
type: 'queue/v1beta';
|
|
776
785
|
/** Name of the consumer group for this trigger (REQUIRED) */
|
|
@@ -781,25 +790,34 @@ export interface TriggerEventInputV1 extends TriggerEventBase {
|
|
|
781
790
|
* Consumer name is implicitly derived from the function path.
|
|
782
791
|
* Only one trigger per function is allowed.
|
|
783
792
|
*/
|
|
784
|
-
export interface
|
|
793
|
+
export interface QueueTriggerEventInputV2 extends QueueTriggerEventBase {
|
|
785
794
|
/** Event type - must be "queue/v2beta" (REQUIRED) */
|
|
786
795
|
type: 'queue/v2beta';
|
|
787
796
|
}
|
|
797
|
+
export interface ScheduleTriggerEventInputV1 {
|
|
798
|
+
/** Event type - must be "schedule/v1beta" (REQUIRED) */
|
|
799
|
+
type: 'schedule/v1beta';
|
|
800
|
+
}
|
|
788
801
|
/**
|
|
789
|
-
* Queue trigger input event from vercel.json config.
|
|
802
|
+
* Queue or Schedule trigger input event from vercel.json config.
|
|
790
803
|
* v1beta requires explicit consumer, v2beta derives consumer from function path.
|
|
791
804
|
*/
|
|
792
|
-
export type TriggerEventInput =
|
|
805
|
+
export type TriggerEventInput = QueueTriggerEventInputV1 | QueueTriggerEventInputV2 | ScheduleTriggerEventInputV1;
|
|
793
806
|
/**
|
|
794
807
|
* Processed queue trigger event for Lambda.
|
|
795
808
|
* Consumer is always present (explicitly provided for v1beta, derived for v2beta).
|
|
796
809
|
*/
|
|
797
|
-
export interface
|
|
810
|
+
export interface QueueTriggerEvent extends QueueTriggerEventBase {
|
|
798
811
|
/** Event type */
|
|
799
812
|
type: 'queue/v1beta' | 'queue/v2beta';
|
|
800
813
|
/** Name of the consumer group for this trigger (always present in processed output) */
|
|
801
814
|
consumer: string;
|
|
802
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Schedule trigger event is the same as the input event.
|
|
818
|
+
*/
|
|
819
|
+
export type ScheduleTriggerEvent = ScheduleTriggerEventInputV1;
|
|
820
|
+
export type TriggerEvent = QueueTriggerEvent | ScheduleTriggerEvent;
|
|
803
821
|
export type ServiceRuntime = 'node' | 'python' | 'go' | 'rust' | 'ruby' | 'container';
|
|
804
822
|
export type ServiceType = 'web' | 'cron' | 'worker' | 'job';
|
|
805
823
|
export interface ExperimentalServiceMount {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"cjs-module-lexer": "1.2.3",
|
|
15
|
-
"es-module-lexer": "1.5.0"
|
|
16
|
-
"@vercel/python-analysis": "0.13.2"
|
|
15
|
+
"es-module-lexer": "1.5.0"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
18
|
"@types/async-retry": "^1.2.1",
|
|
@@ -53,8 +52,8 @@
|
|
|
53
52
|
"vitest": "4.1.10",
|
|
54
53
|
"typescript": "4.9.5",
|
|
55
54
|
"yazl": "2.5.1",
|
|
56
|
-
"@vercel/
|
|
57
|
-
"@vercel/
|
|
55
|
+
"@vercel/error-utils": "2.2.1",
|
|
56
|
+
"@vercel/routing-utils": "6.5.0"
|
|
58
57
|
},
|
|
59
58
|
"scripts": {
|
|
60
59
|
"build": "node build.mjs",
|
package/turbo.json
CHANGED
|
@@ -3,51 +3,87 @@
|
|
|
3
3
|
"extends": ["//"],
|
|
4
4
|
"tasks": {
|
|
5
5
|
"test": {
|
|
6
|
-
"dependsOn": ["build"]
|
|
6
|
+
"dependsOn": ["build", "//#generate:cache-keys"]
|
|
7
7
|
},
|
|
8
8
|
"test-unit": {
|
|
9
|
-
"dependsOn": ["build"]
|
|
9
|
+
"dependsOn": ["build", "//#generate:cache-keys"]
|
|
10
10
|
},
|
|
11
11
|
"test-e2e": {
|
|
12
12
|
"command": ["node", "-e", "process.exit(0)"],
|
|
13
|
-
"dependsOn": [
|
|
13
|
+
"dependsOn": [
|
|
14
|
+
"test-e2e:1",
|
|
15
|
+
"test-e2e:2",
|
|
16
|
+
"test-e2e:3",
|
|
17
|
+
"test-e2e:4",
|
|
18
|
+
"//#generate:cache-keys"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"test-e2e-artifacts": {
|
|
22
|
+
"command": ["node", "-e", "process.exit(0)"],
|
|
23
|
+
"dependsOn": [
|
|
24
|
+
"test-e2e:1",
|
|
25
|
+
"test-e2e:2",
|
|
26
|
+
"test-e2e:3",
|
|
27
|
+
"test-e2e:4",
|
|
28
|
+
"//#generate:cache-keys"
|
|
29
|
+
]
|
|
14
30
|
},
|
|
15
31
|
"test-e2e:1": {
|
|
16
32
|
"command": ["node", "test/run-integration-group.mjs", "1"],
|
|
17
|
-
"dependsOn": ["build"],
|
|
33
|
+
"dependsOn": ["build", "//#generate:cache-keys"],
|
|
18
34
|
"inputs": [
|
|
19
35
|
"$TURBO_DEFAULT$",
|
|
20
36
|
"$TURBO_ROOT$/test/lib/**",
|
|
37
|
+
{
|
|
38
|
+
"mode": "dependencyOutputs",
|
|
39
|
+
"globs": ["turbo-platform-cache-key.json"],
|
|
40
|
+
"from": ["//#generate:cache-keys"]
|
|
41
|
+
},
|
|
21
42
|
"$TURBO_ROOT$/vitest.config.mts"
|
|
22
43
|
],
|
|
23
44
|
"outputLogs": "new-only"
|
|
24
45
|
},
|
|
25
46
|
"test-e2e:2": {
|
|
26
47
|
"command": ["node", "test/run-integration-group.mjs", "2"],
|
|
27
|
-
"dependsOn": ["build"],
|
|
48
|
+
"dependsOn": ["build", "//#generate:cache-keys"],
|
|
28
49
|
"inputs": [
|
|
29
50
|
"$TURBO_DEFAULT$",
|
|
30
51
|
"$TURBO_ROOT$/test/lib/**",
|
|
52
|
+
{
|
|
53
|
+
"mode": "dependencyOutputs",
|
|
54
|
+
"globs": ["turbo-platform-cache-key.json"],
|
|
55
|
+
"from": ["//#generate:cache-keys"]
|
|
56
|
+
},
|
|
31
57
|
"$TURBO_ROOT$/vitest.config.mts"
|
|
32
58
|
],
|
|
33
59
|
"outputLogs": "new-only"
|
|
34
60
|
},
|
|
35
61
|
"test-e2e:3": {
|
|
36
62
|
"command": ["node", "test/run-integration-group.mjs", "3"],
|
|
37
|
-
"dependsOn": ["build"],
|
|
63
|
+
"dependsOn": ["build", "//#generate:cache-keys"],
|
|
38
64
|
"inputs": [
|
|
39
65
|
"$TURBO_DEFAULT$",
|
|
40
66
|
"$TURBO_ROOT$/test/lib/**",
|
|
67
|
+
{
|
|
68
|
+
"mode": "dependencyOutputs",
|
|
69
|
+
"globs": ["turbo-platform-cache-key.json"],
|
|
70
|
+
"from": ["//#generate:cache-keys"]
|
|
71
|
+
},
|
|
41
72
|
"$TURBO_ROOT$/vitest.config.mts"
|
|
42
73
|
],
|
|
43
74
|
"outputLogs": "new-only"
|
|
44
75
|
},
|
|
45
76
|
"test-e2e:4": {
|
|
46
77
|
"command": ["node", "test/run-integration-group.mjs", "4"],
|
|
47
|
-
"dependsOn": ["build"],
|
|
78
|
+
"dependsOn": ["build", "//#generate:cache-keys"],
|
|
48
79
|
"inputs": [
|
|
49
80
|
"$TURBO_DEFAULT$",
|
|
50
81
|
"$TURBO_ROOT$/test/lib/**",
|
|
82
|
+
{
|
|
83
|
+
"mode": "dependencyOutputs",
|
|
84
|
+
"globs": ["turbo-platform-cache-key.json"],
|
|
85
|
+
"from": ["//#generate:cache-keys"]
|
|
86
|
+
},
|
|
51
87
|
"$TURBO_ROOT$/vitest.config.mts"
|
|
52
88
|
],
|
|
53
89
|
"outputLogs": "new-only"
|
package/dist/python.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import FileFsRef from './file-fs-ref';
|
|
2
|
-
/**
|
|
3
|
-
* Check if a Python file is a valid entrypoint by detecting:
|
|
4
|
-
* - A top-level 'app' callable (Flask, FastAPI, Sanic, WSGI/ASGI, etc.)
|
|
5
|
-
* - A top-level 'application' callable (Django)
|
|
6
|
-
* - A top-level 'handler' class (BaseHTTPRequestHandler subclass)
|
|
7
|
-
*/
|
|
8
|
-
export declare function isPythonEntrypoint(file: FileFsRef | {
|
|
9
|
-
fsPath?: string;
|
|
10
|
-
}): Promise<boolean>;
|
package/dist/python.js
DELETED
|
@@ -1,52 +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 python_exports = {};
|
|
30
|
-
__export(python_exports, {
|
|
31
|
-
isPythonEntrypoint: () => isPythonEntrypoint
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(python_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
|
-
var import_python_analysis = require("@vercel/python-analysis");
|
|
36
|
-
var import_debug = __toESM(require("./debug"));
|
|
37
|
-
async function isPythonEntrypoint(file) {
|
|
38
|
-
try {
|
|
39
|
-
const fsPath = file.fsPath;
|
|
40
|
-
if (!fsPath)
|
|
41
|
-
return false;
|
|
42
|
-
const content = await import_fs.default.promises.readFile(fsPath, "utf-8");
|
|
43
|
-
return await (0, import_python_analysis.findAppOrHandler)(content) !== null;
|
|
44
|
-
} catch (err) {
|
|
45
|
-
(0, import_debug.default)(`Failed to check Python entrypoint: ${err}`);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
isPythonEntrypoint
|
|
52
|
-
});
|