@vercel/fs-detectors 5.10.3 → 5.11.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.
|
@@ -126,6 +126,7 @@ function generateServicesRoutes(services) {
|
|
|
126
126
|
(s) => s.type === "web" && typeof s.routePrefix === "string"
|
|
127
127
|
).sort((a, b) => b.routePrefix.length - a.routePrefix.length);
|
|
128
128
|
const allWebPrefixes = getWebRoutePrefixes(sortedWebServices);
|
|
129
|
+
const explicitHostPrefixGuard = getExplicitHostPrefixNegativeLookahead(allWebPrefixes);
|
|
129
130
|
for (const service of sortedWebServices) {
|
|
130
131
|
const { routePrefix } = service;
|
|
131
132
|
const normalizedPrefix = routePrefix.slice(1);
|
|
@@ -133,7 +134,6 @@ function generateServicesRoutes(services) {
|
|
|
133
134
|
const hostCondition = getHostCondition(service);
|
|
134
135
|
if (hostCondition && routePrefix !== "/") {
|
|
135
136
|
const normalizedRoutePrefix = (0, import_routing_utils.normalizeRoutePrefix)(routePrefix);
|
|
136
|
-
const escapedPrefix = escapeRegex(normalizedRoutePrefix.slice(1));
|
|
137
137
|
hostRewrites.push({
|
|
138
138
|
src: "^/$",
|
|
139
139
|
dest: normalizedRoutePrefix,
|
|
@@ -142,7 +142,9 @@ function generateServicesRoutes(services) {
|
|
|
142
142
|
check: true
|
|
143
143
|
});
|
|
144
144
|
hostRewrites.push({
|
|
145
|
-
|
|
145
|
+
// Preserve explicit service prefixes so canonical paths like /_/api
|
|
146
|
+
// keep routing to their target service even on another service's host.
|
|
147
|
+
src: `^/${explicitHostPrefixGuard}(.*)$`,
|
|
146
148
|
dest: `${normalizedRoutePrefix}/$1`,
|
|
147
149
|
has: hostCondition,
|
|
148
150
|
missing: PREVIEW_DOMAIN_MISSING,
|
|
@@ -233,6 +235,16 @@ function getWebRoutePrefixes(services) {
|
|
|
233
235
|
}
|
|
234
236
|
return Array.from(unique);
|
|
235
237
|
}
|
|
238
|
+
function getExplicitHostPrefixNegativeLookahead(routePrefixes) {
|
|
239
|
+
const explicitPrefixes = routePrefixes.map(import_routing_utils.normalizeRoutePrefix).filter((prefix) => prefix !== "/").sort((a, b) => b.length - a.length).map((prefix) => escapeRegex(prefix.slice(1)));
|
|
240
|
+
if (explicitPrefixes.length === 0) {
|
|
241
|
+
return "";
|
|
242
|
+
}
|
|
243
|
+
if (explicitPrefixes.length === 1) {
|
|
244
|
+
return `(?!${explicitPrefixes[0]}(?:/|$))`;
|
|
245
|
+
}
|
|
246
|
+
return `(?!(?:${explicitPrefixes.join("|")})(?:/|$))`;
|
|
247
|
+
}
|
|
236
248
|
function getHostCondition(service) {
|
|
237
249
|
if (service.type !== "web") {
|
|
238
250
|
return void 0;
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export declare function hasFile(fs: DetectorFilesystem, filePath: string): Promi
|
|
|
5
5
|
* Reserved internal namespace used by services routing/runtime plumbing.
|
|
6
6
|
*/
|
|
7
7
|
export declare const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
8
|
+
/**
|
|
9
|
+
* Reserved internal namespace used by the dev queue proxy.
|
|
10
|
+
*/
|
|
11
|
+
export declare const INTERNAL_QUEUES_PREFIX = "/_svc/_queues";
|
|
8
12
|
export declare function getInternalServiceFunctionPath(serviceName: string): string;
|
|
9
13
|
export declare function getInternalServiceWorkerPathPrefix(serviceName: string): string;
|
|
10
14
|
export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
|
package/dist/services/utils.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var utils_exports = {};
|
|
20
20
|
__export(utils_exports, {
|
|
21
|
+
INTERNAL_QUEUES_PREFIX: () => INTERNAL_QUEUES_PREFIX,
|
|
21
22
|
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
|
|
22
23
|
filterFrameworksByRuntime: () => filterFrameworksByRuntime,
|
|
23
24
|
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
@@ -44,6 +45,7 @@ async function hasFile(fs, filePath) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
const INTERNAL_SERVICE_PREFIX = "/_svc";
|
|
48
|
+
const INTERNAL_QUEUES_PREFIX = "/_svc/_queues";
|
|
47
49
|
function getInternalServiceFunctionPath(serviceName) {
|
|
48
50
|
return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/index`;
|
|
49
51
|
}
|
|
@@ -146,6 +148,7 @@ async function readVercelConfig(fs) {
|
|
|
146
148
|
}
|
|
147
149
|
// Annotate the CommonJS export names for ESM import in node:
|
|
148
150
|
0 && (module.exports = {
|
|
151
|
+
INTERNAL_QUEUES_PREFIX,
|
|
149
152
|
INTERNAL_SERVICE_PREFIX,
|
|
150
153
|
filterFrameworksByRuntime,
|
|
151
154
|
getBuilderForRuntime,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"@vercel/error-utils": "2.0.3",
|
|
23
|
-
"@vercel/
|
|
24
|
-
"@vercel/
|
|
23
|
+
"@vercel/routing-utils": "6.0.2",
|
|
24
|
+
"@vercel/frameworks": "3.21.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/glob": "7.2.0",
|
|
@@ -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.8.
|
|
35
|
+
"@vercel/build-utils": "13.8.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "node ../../utils/build.mjs",
|