@vercel/fs-detectors 5.14.3 → 5.15.1
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 +9 -1
- package/dist/services/utils.d.ts +1 -1
- package/dist/services/utils.js +41 -14
- package/package.json +4 -4
package/dist/detect-builders.js
CHANGED
|
@@ -174,7 +174,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
|
174
174
|
if (!hasNextApiFiles && (fileName.startsWith("pages/api") || fileName.startsWith("src/pages/api"))) {
|
|
175
175
|
hasNextApiFiles = true;
|
|
176
176
|
}
|
|
177
|
-
if (!fallbackEntrypoint && buildCommand && !fileName.includes("/") && fileName !== "now.json" && fileName !== "vercel.json") {
|
|
177
|
+
if (!fallbackEntrypoint && buildCommand && !fileName.includes("/") && fileName !== "now.json" && fileName !== "vercel.json" && fileName !== "vercel.toml") {
|
|
178
178
|
fallbackEntrypoint = fileName;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -310,6 +310,14 @@ async function maybeGetApiBuilder(fileName, apiMatches, options) {
|
|
|
310
310
|
return null;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
+
const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
|
|
314
|
+
if (process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
|
|
315
|
+
const fsPath = (0, import_path.join)(options.workPath, fileName);
|
|
316
|
+
const isEntrypoint = await (0, import_build_utils.isNodeEntrypoint)({ fsPath });
|
|
317
|
+
if (!isEntrypoint) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
313
321
|
const match = apiMatches.find(({ src = "**" }) => {
|
|
314
322
|
return src === fileName || (0, import_minimatch.default)(fileName, src);
|
|
315
323
|
});
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface ReadVercelConfigResult {
|
|
|
63
63
|
error: ServiceDetectionError | null;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Read and parse vercel.json from filesystem.
|
|
66
|
+
* Read and parse vercel.json or vercel.toml from filesystem.
|
|
67
67
|
* Returns the parsed config or an error if the file exists but is invalid.
|
|
68
68
|
*/
|
|
69
69
|
export declare function readVercelConfig(fs: DetectorFilesystem): Promise<ReadVercelConfigResult>;
|
package/dist/services/utils.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var utils_exports = {};
|
|
20
30
|
__export(utils_exports, {
|
|
@@ -136,22 +146,39 @@ function inferServiceRuntime(config) {
|
|
|
136
146
|
}
|
|
137
147
|
async function readVercelConfig(fs) {
|
|
138
148
|
const hasVercelJson = await fs.hasPath("vercel.json");
|
|
139
|
-
if (
|
|
140
|
-
|
|
149
|
+
if (hasVercelJson) {
|
|
150
|
+
try {
|
|
151
|
+
const content = await fs.readFile("vercel.json");
|
|
152
|
+
const config = JSON.parse(content.toString());
|
|
153
|
+
return { config, error: null };
|
|
154
|
+
} catch {
|
|
155
|
+
return {
|
|
156
|
+
config: null,
|
|
157
|
+
error: {
|
|
158
|
+
code: "INVALID_VERCEL_JSON",
|
|
159
|
+
message: "Failed to parse vercel.json. Ensure it contains valid JSON."
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
141
163
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
config: null
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
const hasVercelToml = process.env.VERCEL_TOML_CONFIG_ENABLED === "1" && await fs.hasPath("vercel.toml");
|
|
165
|
+
if (hasVercelToml) {
|
|
166
|
+
try {
|
|
167
|
+
const { parse: tomlParse } = await import("smol-toml");
|
|
168
|
+
const content = await fs.readFile("vercel.toml");
|
|
169
|
+
const config = tomlParse(content.toString());
|
|
170
|
+
return { config, error: null };
|
|
171
|
+
} catch {
|
|
172
|
+
return {
|
|
173
|
+
config: null,
|
|
174
|
+
error: {
|
|
175
|
+
code: "INVALID_VERCEL_TOML",
|
|
176
|
+
message: "Failed to parse vercel.toml. Ensure it contains valid TOML."
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
154
180
|
}
|
|
181
|
+
return { config: null, error: null };
|
|
155
182
|
}
|
|
156
183
|
// Annotate the CommonJS export names for ESM import in node:
|
|
157
184
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.1",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
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.14.1",
|
|
24
24
|
"@vercel/error-utils": "2.0.3",
|
|
25
|
-
"@vercel/
|
|
26
|
-
"@vercel/
|
|
25
|
+
"@vercel/frameworks": "3.24.0",
|
|
26
|
+
"@vercel/routing-utils": "6.1.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/glob": "7.2.0",
|