@vercel/fs-detectors 5.7.9 → 5.7.11

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.
@@ -27,6 +27,7 @@ export interface Options {
27
27
  trailingSlash?: boolean;
28
28
  featHandleMiss?: boolean;
29
29
  bunVersion?: string;
30
+ workPath?: string;
30
31
  }
31
32
  export declare function sortFiles(fileA: string, fileB: string): number;
32
33
  export declare function detectApiExtensions(builders: Builder[]): Set<string>;
@@ -43,6 +43,7 @@ var import_semver = require("semver");
43
43
  var import_path = require("path");
44
44
  var import_frameworks = __toESM(require("@vercel/frameworks"));
45
45
  var import_is_official_runtime = require("./is-official-runtime");
46
+ var import_build_utils = require("@vercel/build-utils");
46
47
  const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
47
48
  const REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
48
49
  const REGEX_NON_VERCEL_PLATFORM_FILES = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
@@ -127,7 +128,7 @@ async function detectBuilders(files, pkg, options = {}) {
127
128
  const apiRoutes = [];
128
129
  const dynamicRoutes = [];
129
130
  for (const fileName of sortedFiles) {
130
- const apiBuilder = maybeGetApiBuilder(fileName, apiMatches, options);
131
+ const apiBuilder = await maybeGetApiBuilder(fileName, apiMatches, options);
131
132
  if (apiBuilder) {
132
133
  const { routeError, apiRoute, isDynamic } = getApiRoute(
133
134
  fileName,
@@ -274,7 +275,7 @@ async function detectBuilders(files, pkg, options = {}) {
274
275
  errorRoutes: routesResult.errorRoutes
275
276
  };
276
277
  }
277
- function maybeGetApiBuilder(fileName, apiMatches, options) {
278
+ async function maybeGetApiBuilder(fileName, apiMatches, options) {
278
279
  const middleware = fileName === "middleware.js" || fileName === "middleware.ts";
279
280
  if (middleware && options.projectSettings?.framework === "nextjs") {
280
281
  return null;
@@ -294,6 +295,13 @@ function maybeGetApiBuilder(fileName, apiMatches, options) {
294
295
  if (fileName.endsWith(".d.ts")) {
295
296
  return null;
296
297
  }
298
+ if (fileName.endsWith(".py") && options.workPath) {
299
+ const fsPath = (0, import_path.join)(options.workPath, fileName);
300
+ const isEntrypoint = await (0, import_build_utils.isPythonEntrypoint)({ fsPath });
301
+ if (!isEntrypoint) {
302
+ return null;
303
+ }
304
+ }
297
305
  const match = apiMatches.find(({ src = "**" }) => {
298
306
  return src === fileName || (0, import_minimatch.default)(fileName, src);
299
307
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "5.7.9",
3
+ "version": "5.7.11",
4
4
  "description": "Vercel filesystem detectors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "json5": "2.2.2",
20
20
  "minimatch": "3.1.2",
21
21
  "semver": "6.3.1",
22
- "@vercel/frameworks": "3.15.4",
23
22
  "@vercel/error-utils": "2.0.3",
24
- "@vercel/routing-utils": "5.3.0"
23
+ "@vercel/frameworks": "3.15.4",
24
+ "@vercel/routing-utils": "5.3.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.2.3"
35
+ "@vercel/build-utils": "13.2.4"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node ../../utils/build.mjs",