@vercel/fs-detectors 5.8.17 → 5.8.18
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/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExt
|
|
|
2
2
|
export { detectServices, generateServicesRoutes, } from './services/detect-services';
|
|
3
3
|
export { autoDetectServices } from './services/auto-detect';
|
|
4
4
|
export type { AutoDetectOptions, AutoDetectResult, } from './services/auto-detect';
|
|
5
|
-
export { isStaticBuild, isRouteOwningBuilder, INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceWorkerPath, getInternalServiceWorkerPathPrefix, } from './services/utils';
|
|
5
|
+
export { isStaticBuild, isRouteOwningBuilder, INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPath, getInternalServiceCronPathPrefix, getInternalServiceWorkerPath, getInternalServiceWorkerPathPrefix, } from './services/utils';
|
|
6
6
|
export { getServicesBuilders } from './services/get-services-builders';
|
|
7
7
|
export type { DetectServicesOptions, DetectServicesResult, DetectServicesSource, ResolvedService, Service, ServicesRoutes, ServiceDetectionError, } from './services/types';
|
|
8
8
|
export { detectFileSystemAPI } from './detect-file-system-api';
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
|
|
41
41
|
detectServices: () => import_detect_services.detectServices,
|
|
42
42
|
generateServicesRoutes: () => import_detect_services.generateServicesRoutes,
|
|
43
|
+
getInternalServiceCronPath: () => import_utils.getInternalServiceCronPath,
|
|
43
44
|
getInternalServiceCronPathPrefix: () => import_utils.getInternalServiceCronPathPrefix,
|
|
44
45
|
getInternalServiceFunctionPath: () => import_utils.getInternalServiceFunctionPath,
|
|
45
46
|
getInternalServiceWorkerPath: () => import_utils.getInternalServiceWorkerPath,
|
|
@@ -99,6 +100,7 @@ var import_detect_instrumentation = require("./detect-instrumentation");
|
|
|
99
100
|
detectOutputDirectory,
|
|
100
101
|
detectServices,
|
|
101
102
|
generateServicesRoutes,
|
|
103
|
+
getInternalServiceCronPath,
|
|
102
104
|
getInternalServiceCronPathPrefix,
|
|
103
105
|
getInternalServiceFunctionPath,
|
|
104
106
|
getInternalServiceWorkerPath,
|
|
@@ -30,6 +30,8 @@ export declare function detectServices(options: DetectServicesOptions): Promise<
|
|
|
30
30
|
* Internal queue callback routes under `/_svc/{serviceName}/workers/{entry}/{handler}`
|
|
31
31
|
* that rewrite to `/_svc/{serviceName}/index`.
|
|
32
32
|
*
|
|
33
|
-
* - Cron services:
|
|
33
|
+
* - Cron services:
|
|
34
|
+
* Internal cron callback routes under `/_svc/{serviceName}/crons/{entry}/{handler}`
|
|
35
|
+
* that rewrite to `/_svc/{serviceName}/index`.
|
|
34
36
|
*/
|
|
35
37
|
export declare function generateServicesRoutes(services: ResolvedService[]): ServicesRoutes;
|
|
@@ -162,6 +162,17 @@ function generateServicesRoutes(services) {
|
|
|
162
162
|
check: true
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
+
const cronServices = services.filter((s) => s.type === "cron");
|
|
166
|
+
for (const service of cronServices) {
|
|
167
|
+
const cronEntrypoint = service.entrypoint || service.builder.src || "index";
|
|
168
|
+
const cronPath = (0, import_utils.getInternalServiceCronPath)(service.name, cronEntrypoint);
|
|
169
|
+
const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
|
|
170
|
+
crons.push({
|
|
171
|
+
src: `^${escapeRegex(cronPath)}$`,
|
|
172
|
+
dest: functionPath,
|
|
173
|
+
check: true
|
|
174
|
+
});
|
|
175
|
+
}
|
|
165
176
|
return { rewrites, defaults, crons, workers };
|
|
166
177
|
}
|
|
167
178
|
function escapeRegex(str) {
|
package/dist/services/types.d.ts
CHANGED
package/dist/services/utils.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function getInternalServiceFunctionPath(serviceName: string): str
|
|
|
9
9
|
export declare function getInternalServiceWorkerPathPrefix(serviceName: string): string;
|
|
10
10
|
export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
|
|
11
11
|
export declare function getInternalServiceWorkerPath(serviceName: string, entrypoint: string, handler?: string): string;
|
|
12
|
+
export declare function getInternalServiceCronPath(serviceName: string, entrypoint: string, handler?: string): string;
|
|
12
13
|
export declare function getBuilderForRuntime(runtime: ServiceRuntime): string;
|
|
13
14
|
export declare function isStaticBuild(service: ResolvedService): boolean;
|
|
14
15
|
/**
|
package/dist/services/utils.js
CHANGED
|
@@ -21,6 +21,7 @@ __export(utils_exports, {
|
|
|
21
21
|
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
|
|
22
22
|
filterFrameworksByRuntime: () => filterFrameworksByRuntime,
|
|
23
23
|
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
24
|
+
getInternalServiceCronPath: () => getInternalServiceCronPath,
|
|
24
25
|
getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
|
|
25
26
|
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath,
|
|
26
27
|
getInternalServiceWorkerPath: () => getInternalServiceWorkerPath,
|
|
@@ -60,6 +61,10 @@ function getInternalServiceWorkerPath(serviceName, entrypoint, handler = "worker
|
|
|
60
61
|
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
61
62
|
return `${getInternalServiceWorkerPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
62
63
|
}
|
|
64
|
+
function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
|
|
65
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
66
|
+
return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
67
|
+
}
|
|
63
68
|
function getBuilderForRuntime(runtime) {
|
|
64
69
|
const builder = import_types.RUNTIME_BUILDERS[runtime];
|
|
65
70
|
if (!builder) {
|
|
@@ -144,6 +149,7 @@ async function readVercelConfig(fs) {
|
|
|
144
149
|
INTERNAL_SERVICE_PREFIX,
|
|
145
150
|
filterFrameworksByRuntime,
|
|
146
151
|
getBuilderForRuntime,
|
|
152
|
+
getInternalServiceCronPath,
|
|
147
153
|
getInternalServiceCronPathPrefix,
|
|
148
154
|
getInternalServiceFunctionPath,
|
|
149
155
|
getInternalServiceWorkerPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.18",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"json5": "2.2.2",
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
|
-
"@vercel/routing-utils": "6.0.2",
|
|
23
22
|
"@vercel/error-utils": "2.0.3",
|
|
23
|
+
"@vercel/routing-utils": "6.0.2",
|
|
24
24
|
"@vercel/frameworks": "3.20.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/semver": "7.3.10",
|
|
33
33
|
"jest-junit": "16.0.0",
|
|
34
34
|
"typescript": "4.9.5",
|
|
35
|
-
"@vercel/build-utils": "13.6.
|
|
35
|
+
"@vercel/build-utils": "13.6.3"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "node ../../utils/build.mjs",
|