@vercel/fs-detectors 6.9.1 → 6.9.3
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.
|
@@ -102,9 +102,8 @@ function validateServiceConfigV2(name, config) {
|
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
104
|
async function resolveConfiguredServiceV2(name, config, fs) {
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const serviceFsResult = normalizedRoot === "." ? { fs } : await (0, import_resolve.getServiceFs)(fs, name, root);
|
|
105
|
+
const normalizedRoot = (0, import_utils.stripTrailingSlash)(import_path.posix.normalize(config.root));
|
|
106
|
+
const serviceFsResult = normalizedRoot === "." ? { fs } : await (0, import_resolve.getServiceFs)(fs, name, normalizedRoot);
|
|
108
107
|
if (serviceFsResult.error) {
|
|
109
108
|
return { error: serviceFsResult.error };
|
|
110
109
|
}
|
|
@@ -194,7 +193,7 @@ async function resolveConfiguredServiceV2(name, config, fs) {
|
|
|
194
193
|
service: {
|
|
195
194
|
schema: "experimentalServicesV2",
|
|
196
195
|
name,
|
|
197
|
-
root,
|
|
196
|
+
root: normalizedRoot,
|
|
198
197
|
framework,
|
|
199
198
|
runtime,
|
|
200
199
|
entrypoint: entrypointFile,
|
package/dist/services/resolve.js
CHANGED
|
@@ -60,7 +60,7 @@ async function getServiceFs(fs, serviceName, root) {
|
|
|
60
60
|
if (!root) {
|
|
61
61
|
return { fs };
|
|
62
62
|
}
|
|
63
|
-
const normalizedRoot = import_path.posix.normalize(root);
|
|
63
|
+
const normalizedRoot = (0, import_utils.stripTrailingSlash)(import_path.posix.normalize(root));
|
|
64
64
|
if (!await fs.hasPath(normalizedRoot)) {
|
|
65
65
|
return {
|
|
66
66
|
fs,
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ import type { DetectorFilesystem } from '../detectors/filesystem';
|
|
|
4
4
|
import type { ServiceRuntime, ExperimentalServices, ExperimentalServicesV2, ServiceDetectionError, ServiceDetectionWarning, ResolvedService } from './types';
|
|
5
5
|
export declare const DETECTION_FRAMEWORKS: Framework[];
|
|
6
6
|
export { INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceCronPath, };
|
|
7
|
+
/**
|
|
8
|
+
* Removes a trailing slash from an already-`posixPath.normalize`d path.
|
|
9
|
+
*
|
|
10
|
+
* `posixPath.normalize` preserves trailing slashes (`"frontend/"` stays
|
|
11
|
+
* `"frontend/"`), which double-prefixes builder paths when the value is later
|
|
12
|
+
* used as both `builder.config.workspace` and a `posixPath.join` prefix. Strip
|
|
13
|
+
* it so `"frontend/"` and `"frontend"` resolve identically. An empty result or
|
|
14
|
+
* a lone `"/"` collapses to `"."` (matching `normalizeServiceEntrypoint`).
|
|
15
|
+
*/
|
|
16
|
+
export declare function stripTrailingSlash(p: string): string;
|
|
7
17
|
export declare function hasFile(fs: DetectorFilesystem, filePath: string): Promise<boolean>;
|
|
8
18
|
/**
|
|
9
19
|
* Reserved internal namespace used by the dev queue proxy.
|
package/dist/services/utils.js
CHANGED
|
@@ -46,7 +46,8 @@ __export(utils_exports, {
|
|
|
46
46
|
isFrontendFramework: () => isFrontendFramework,
|
|
47
47
|
isRouteOwningBuilder: () => isRouteOwningBuilder,
|
|
48
48
|
isStaticBuild: () => isStaticBuild,
|
|
49
|
-
readVercelConfig: () => readVercelConfig
|
|
49
|
+
readVercelConfig: () => readVercelConfig,
|
|
50
|
+
stripTrailingSlash: () => stripTrailingSlash
|
|
50
51
|
});
|
|
51
52
|
module.exports = __toCommonJS(utils_exports);
|
|
52
53
|
var import_framework_helpers = require("@vercel/build-utils/dist/framework-helpers");
|
|
@@ -56,6 +57,10 @@ var import_types = require("./types");
|
|
|
56
57
|
const DETECTION_FRAMEWORKS = import_frameworks.frameworkList.filter(
|
|
57
58
|
(framework) => !framework.experimental || framework.runtimeFramework
|
|
58
59
|
);
|
|
60
|
+
function stripTrailingSlash(p) {
|
|
61
|
+
const stripped = p.replace(/\/+$/, "");
|
|
62
|
+
return stripped === "" ? "." : stripped;
|
|
63
|
+
}
|
|
59
64
|
async function hasFile(fs, filePath) {
|
|
60
65
|
try {
|
|
61
66
|
return await fs.isFile(filePath);
|
|
@@ -232,5 +237,6 @@ function combineBuildCommand(buildCommand, preDeployCommand) {
|
|
|
232
237
|
isFrontendFramework,
|
|
233
238
|
isRouteOwningBuilder,
|
|
234
239
|
isStaticBuild,
|
|
235
|
-
readVercelConfig
|
|
240
|
+
readVercelConfig,
|
|
241
|
+
stripTrailingSlash
|
|
236
242
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.3",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"smol-toml": "1.5.2",
|
|
23
|
-
"@vercel/build-utils": "13.
|
|
23
|
+
"@vercel/build-utils": "13.31.1",
|
|
24
|
+
"@vercel/routing-utils": "6.3.1",
|
|
24
25
|
"@vercel/error-utils": "2.2.0",
|
|
25
|
-
"@vercel/routing-utils": "6.3.0",
|
|
26
26
|
"@vercel/frameworks": "3.29.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|