@vercel/fs-detectors 5.7.13 → 5.7.15
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/detect-framework.d.ts +15 -3
- package/dist/detect-framework.js +38 -6
- package/package.json +3 -3
|
@@ -7,17 +7,29 @@ interface BaseFramework {
|
|
|
7
7
|
export interface DetectFrameworkOptions {
|
|
8
8
|
fs: DetectorFilesystem;
|
|
9
9
|
frameworkList: readonly BaseFramework[];
|
|
10
|
+
/**
|
|
11
|
+
* When true, includes experimental frameworks in detection.
|
|
12
|
+
* If undefined, falls back to VERCEL_USE_EXPERIMENTAL_FRAMEWORKS env var.
|
|
13
|
+
* Defaults to false if neither is set.
|
|
14
|
+
*/
|
|
15
|
+
useExperimentalFrameworks?: boolean;
|
|
10
16
|
}
|
|
11
17
|
export interface DetectFrameworkRecordOptions {
|
|
12
18
|
fs: DetectorFilesystem;
|
|
13
19
|
frameworkList: readonly Framework[];
|
|
20
|
+
/**
|
|
21
|
+
* When true, includes experimental frameworks in detection.
|
|
22
|
+
* If undefined, falls back to VERCEL_USE_EXPERIMENTAL_FRAMEWORKS env var.
|
|
23
|
+
* Defaults to false if neither is set.
|
|
24
|
+
*/
|
|
25
|
+
useExperimentalFrameworks?: boolean;
|
|
14
26
|
}
|
|
15
27
|
export declare function removeSupersededFrameworks(matches: (Pick<Framework, 'supersedes' | 'slug'> | null)[]): void;
|
|
16
|
-
export declare function detectFramework({ fs, frameworkList, }: DetectFrameworkOptions): Promise<string | null>;
|
|
28
|
+
export declare function detectFramework({ fs, frameworkList, useExperimentalFrameworks, }: DetectFrameworkOptions): Promise<string | null>;
|
|
17
29
|
/**
|
|
18
30
|
* Detects all matching Frameworks based on the given virtual filesystem.
|
|
19
31
|
*/
|
|
20
|
-
export declare function detectFrameworks({ fs, frameworkList, }: DetectFrameworkRecordOptions): Promise<Framework[]>;
|
|
32
|
+
export declare function detectFrameworks({ fs, frameworkList, useExperimentalFrameworks, }: DetectFrameworkRecordOptions): Promise<Framework[]>;
|
|
21
33
|
/**
|
|
22
34
|
* Framework with a `detectedVersion` specifying the version
|
|
23
35
|
* or version range of the relevant package
|
|
@@ -25,6 +37,6 @@ export declare function detectFrameworks({ fs, frameworkList, }: DetectFramework
|
|
|
25
37
|
type VersionedFramework = Framework & {
|
|
26
38
|
detectedVersion?: string;
|
|
27
39
|
};
|
|
28
|
-
export declare function detectFrameworkRecord({ fs, frameworkList, }: DetectFrameworkRecordOptions): Promise<VersionedFramework | null>;
|
|
40
|
+
export declare function detectFrameworkRecord({ fs, frameworkList, useExperimentalFrameworks, }: DetectFrameworkRecordOptions): Promise<VersionedFramework | null>;
|
|
29
41
|
export declare function detectFrameworkVersion(frameworkRecord: Framework): string | undefined;
|
|
30
42
|
export {};
|
package/dist/detect-framework.js
CHANGED
|
@@ -26,6 +26,23 @@ __export(detect_framework_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(detect_framework_exports);
|
|
28
28
|
var import_child_process = require("child_process");
|
|
29
|
+
function shouldIncludeExperimentalFrameworks(useExperimentalFrameworks) {
|
|
30
|
+
if (typeof useExperimentalFrameworks === "boolean") {
|
|
31
|
+
return useExperimentalFrameworks;
|
|
32
|
+
}
|
|
33
|
+
const experimentalEnv = process.env.VERCEL_USE_EXPERIMENTAL_FRAMEWORKS;
|
|
34
|
+
const isEnabled = (val) => val === "1" || typeof val === "string" && val.toLowerCase() === "true";
|
|
35
|
+
return isEnabled(experimentalEnv);
|
|
36
|
+
}
|
|
37
|
+
function filterFrameworkList(frameworkList, useExperimentalFrameworks) {
|
|
38
|
+
if (shouldIncludeExperimentalFrameworks(useExperimentalFrameworks)) {
|
|
39
|
+
return frameworkList;
|
|
40
|
+
}
|
|
41
|
+
return frameworkList.filter((f) => {
|
|
42
|
+
const experimental = f.experimental;
|
|
43
|
+
return !experimental;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
29
46
|
async function matches(fs, framework) {
|
|
30
47
|
const { detectors } = framework;
|
|
31
48
|
if (!detectors) {
|
|
@@ -138,10 +155,15 @@ function removeSupersededFrameworks(matches2) {
|
|
|
138
155
|
}
|
|
139
156
|
async function detectFramework({
|
|
140
157
|
fs,
|
|
141
|
-
frameworkList
|
|
158
|
+
frameworkList,
|
|
159
|
+
useExperimentalFrameworks
|
|
142
160
|
}) {
|
|
161
|
+
const filteredList = filterFrameworkList(
|
|
162
|
+
frameworkList,
|
|
163
|
+
useExperimentalFrameworks
|
|
164
|
+
);
|
|
143
165
|
const result = await Promise.all(
|
|
144
|
-
|
|
166
|
+
filteredList.map(async (frameworkMatch) => {
|
|
145
167
|
if (await matches(fs, frameworkMatch)) {
|
|
146
168
|
return frameworkMatch;
|
|
147
169
|
}
|
|
@@ -153,10 +175,15 @@ async function detectFramework({
|
|
|
153
175
|
}
|
|
154
176
|
async function detectFrameworks({
|
|
155
177
|
fs,
|
|
156
|
-
frameworkList
|
|
178
|
+
frameworkList,
|
|
179
|
+
useExperimentalFrameworks
|
|
157
180
|
}) {
|
|
181
|
+
const filteredList = filterFrameworkList(
|
|
182
|
+
frameworkList,
|
|
183
|
+
useExperimentalFrameworks
|
|
184
|
+
);
|
|
158
185
|
const result = await Promise.all(
|
|
159
|
-
|
|
186
|
+
filteredList.map(async (frameworkMatch) => {
|
|
160
187
|
if (await matches(fs, frameworkMatch)) {
|
|
161
188
|
return frameworkMatch;
|
|
162
189
|
}
|
|
@@ -168,10 +195,15 @@ async function detectFrameworks({
|
|
|
168
195
|
}
|
|
169
196
|
async function detectFrameworkRecord({
|
|
170
197
|
fs,
|
|
171
|
-
frameworkList
|
|
198
|
+
frameworkList,
|
|
199
|
+
useExperimentalFrameworks
|
|
172
200
|
}) {
|
|
201
|
+
const filteredList = filterFrameworkList(
|
|
202
|
+
frameworkList,
|
|
203
|
+
useExperimentalFrameworks
|
|
204
|
+
);
|
|
173
205
|
const result = await Promise.all(
|
|
174
|
-
|
|
206
|
+
filteredList.map(async (frameworkMatch) => {
|
|
175
207
|
const matchResult = await matches(fs, frameworkMatch);
|
|
176
208
|
if (matchResult) {
|
|
177
209
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.15",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"@vercel/error-utils": "2.0.3",
|
|
23
|
-
"@vercel/frameworks": "3.15.
|
|
23
|
+
"@vercel/frameworks": "3.15.7",
|
|
24
24
|
"@vercel/routing-utils": "5.3.2"
|
|
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.2.
|
|
35
|
+
"@vercel/build-utils": "13.2.13"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "node ../../utils/build.mjs",
|