@vercel/fs-detectors 7.7.2 → 7.8.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/dist/detect-builders.js
CHANGED
|
@@ -153,6 +153,7 @@ var require_entrypoint = __commonJS({
|
|
|
153
153
|
var import_constants2 = require_constants();
|
|
154
154
|
var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
155
155
|
var NODE_FILE_ENTRYPOINT_RE = /^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?:[\w@+.-]+\/)*[\w@+.-]+\.[cm]?[jt]s$/;
|
|
156
|
+
var PYTHON_FILE_ENTRYPOINT_RE = /^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?:[\w@+.-]+\/)*[\w@+.-]+\.py$/;
|
|
156
157
|
var NODE_DECLARATION_ENTRYPOINT_RE = /\.d\.[cm]?ts$/;
|
|
157
158
|
function parsePyModuleAttrEntrypoint2(entrypoint) {
|
|
158
159
|
const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
|
|
@@ -167,11 +168,10 @@ var require_entrypoint = __commonJS({
|
|
|
167
168
|
moduleName: modulePart
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
|
-
var SCHEDULE_ENTRYPOINT_FORMS_HINT = 'Use a source file path like "jobs/nightly.
|
|
171
|
+
var SCHEDULE_ENTRYPOINT_FORMS_HINT = 'Use a source file path like "jobs/nightly.py" or "jobs/nightly.ts".';
|
|
171
172
|
function parseScheduleEntrypoint(entrypoint) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return { runtime: "python", ...python };
|
|
173
|
+
if (PYTHON_FILE_ENTRYPOINT_RE.test(entrypoint)) {
|
|
174
|
+
return { runtime: "python", filePath: entrypoint };
|
|
175
175
|
}
|
|
176
176
|
if (NODE_FILE_ENTRYPOINT_RE.test(entrypoint) && !NODE_DECLARATION_ENTRYPOINT_RE.test(entrypoint)) {
|
|
177
177
|
return { runtime: "node", filePath: entrypoint };
|
package/dist/detect-framework.js
CHANGED
|
@@ -63,7 +63,8 @@ async function matches(fs, framework) {
|
|
|
63
63
|
const check = async ({
|
|
64
64
|
path,
|
|
65
65
|
matchContent,
|
|
66
|
-
matchPackage
|
|
66
|
+
matchPackage,
|
|
67
|
+
fallback = false
|
|
67
68
|
}) => {
|
|
68
69
|
if (matchPackage && matchContent) {
|
|
69
70
|
throw new Error(
|
|
@@ -102,12 +103,14 @@ async function matches(fs, framework) {
|
|
|
102
103
|
if (matchPackage && match[3]) {
|
|
103
104
|
return {
|
|
104
105
|
framework,
|
|
105
|
-
detectedVersion: match[3]
|
|
106
|
+
detectedVersion: match[3],
|
|
107
|
+
fallback
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
return {
|
|
110
|
-
framework
|
|
112
|
+
framework,
|
|
113
|
+
fallback
|
|
111
114
|
};
|
|
112
115
|
};
|
|
113
116
|
const result = [];
|
|
@@ -134,7 +137,8 @@ async function matches(fs, framework) {
|
|
|
134
137
|
)?.detectedVersion;
|
|
135
138
|
return {
|
|
136
139
|
framework,
|
|
137
|
-
detectedVersion
|
|
140
|
+
detectedVersion,
|
|
141
|
+
fallback: result.some((match) => match?.fallback)
|
|
138
142
|
};
|
|
139
143
|
}
|
|
140
144
|
function removeSupersededFramework(matches2, slug) {
|
|
@@ -158,6 +162,31 @@ function removeSupersededFrameworks(matches2) {
|
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
}
|
|
165
|
+
function orderFrameworkMatches(matches2) {
|
|
166
|
+
const normalMatches = matches2.filter(
|
|
167
|
+
(match) => Boolean(match && !match.fallback)
|
|
168
|
+
);
|
|
169
|
+
const fallbackMatches = matches2.filter(
|
|
170
|
+
(match) => Boolean(match?.fallback)
|
|
171
|
+
);
|
|
172
|
+
const normalFrameworks = normalMatches.map((match) => match.framework);
|
|
173
|
+
removeSupersededFrameworks(normalFrameworks);
|
|
174
|
+
const fallbackFrameworks = fallbackMatches.map((match) => match.framework);
|
|
175
|
+
for (const framework of normalFrameworks) {
|
|
176
|
+
for (const slug of framework.supersedes ?? []) {
|
|
177
|
+
removeSupersededFramework(fallbackFrameworks, slug);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
removeSupersededFrameworks(fallbackFrameworks);
|
|
181
|
+
return [
|
|
182
|
+
...normalMatches.filter(
|
|
183
|
+
(match) => normalFrameworks.includes(match.framework)
|
|
184
|
+
),
|
|
185
|
+
...fallbackMatches.filter(
|
|
186
|
+
(match) => fallbackFrameworks.includes(match.framework)
|
|
187
|
+
)
|
|
188
|
+
];
|
|
189
|
+
}
|
|
161
190
|
async function detectFramework({
|
|
162
191
|
fs,
|
|
163
192
|
frameworkList,
|
|
@@ -168,15 +197,12 @@ async function detectFramework({
|
|
|
168
197
|
useExperimentalFrameworks
|
|
169
198
|
);
|
|
170
199
|
const result = await Promise.all(
|
|
171
|
-
filteredList.map(async (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
200
|
+
filteredList.map(async (framework) => {
|
|
201
|
+
const match = await matches(fs, framework);
|
|
202
|
+
return match ? { ...match, framework } : null;
|
|
176
203
|
})
|
|
177
204
|
);
|
|
178
|
-
|
|
179
|
-
return result.find((res) => res !== null)?.slug ?? null;
|
|
205
|
+
return orderFrameworkMatches(result)[0]?.framework.slug ?? null;
|
|
180
206
|
}
|
|
181
207
|
async function detectFrameworks({
|
|
182
208
|
fs,
|
|
@@ -188,15 +214,12 @@ async function detectFrameworks({
|
|
|
188
214
|
useExperimentalFrameworks
|
|
189
215
|
);
|
|
190
216
|
const result = await Promise.all(
|
|
191
|
-
filteredList.map(async (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
217
|
+
filteredList.map(async (framework) => {
|
|
218
|
+
const match = await matches(fs, framework);
|
|
219
|
+
return match ? { ...match, framework } : null;
|
|
196
220
|
})
|
|
197
221
|
);
|
|
198
|
-
|
|
199
|
-
return result.filter((res) => res !== null);
|
|
222
|
+
return orderFrameworkMatches(result).map((match) => match.framework);
|
|
200
223
|
}
|
|
201
224
|
async function detectFrameworkRecord({
|
|
202
225
|
fs,
|
|
@@ -208,19 +231,13 @@ async function detectFrameworkRecord({
|
|
|
208
231
|
useExperimentalFrameworks
|
|
209
232
|
);
|
|
210
233
|
const result = await Promise.all(
|
|
211
|
-
filteredList.map(async (
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
...frameworkMatch,
|
|
216
|
-
detectedVersion: matchResult?.detectedVersion
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return null;
|
|
234
|
+
filteredList.map(async (framework) => {
|
|
235
|
+
const match2 = await matches(fs, framework);
|
|
236
|
+
return match2 ? { ...match2, framework } : null;
|
|
220
237
|
})
|
|
221
238
|
);
|
|
222
|
-
|
|
223
|
-
return
|
|
239
|
+
const match = orderFrameworkMatches(result)[0];
|
|
240
|
+
return match ? { ...match.framework, detectedVersion: match.detectedVersion } : null;
|
|
224
241
|
}
|
|
225
242
|
function detectFrameworkVersion(frameworkRecord) {
|
|
226
243
|
const allDetectors = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"smol-toml": "1.5.2",
|
|
23
|
-
"@vercel/build-utils": "14.13.
|
|
24
|
-
"@vercel/
|
|
25
|
-
"@vercel/frameworks": "3.34.0",
|
|
23
|
+
"@vercel/build-utils": "14.13.2",
|
|
24
|
+
"@vercel/frameworks": "3.35.0",
|
|
26
25
|
"@vercel/python-analysis": "0.14.0",
|
|
27
|
-
"@vercel/routing-utils": "6.6.0"
|
|
26
|
+
"@vercel/routing-utils": "6.6.0",
|
|
27
|
+
"@vercel/error-utils": "2.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/glob": "7.2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/node": "20.11.0",
|
|
34
34
|
"@types/semver": "7.3.10",
|
|
35
35
|
"vitest": "4.1.10",
|
|
36
|
-
"@vercel-internals/runtimes": "1.1.
|
|
36
|
+
"@vercel-internals/runtimes": "1.1.6"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "node build.mjs",
|