@vercel/fs-detectors 6.15.7 → 6.15.10

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.
@@ -47,6 +47,7 @@ var import_path = require("path");
47
47
  var import_frameworks = require("@vercel/frameworks");
48
48
  var import_is_official_runtime = require("./is-official-runtime");
49
49
  var import_build_utils = require("@vercel/build-utils");
50
+ var import_python = require("./python");
50
51
  var import_get_services_builders = require("./services/get-services-builders");
51
52
  const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
52
53
  const VERCEL_PLATFORM_FILES = [
@@ -426,7 +427,7 @@ async function maybeGetApiBuilder(fileName, apiMatches, options) {
426
427
  }
427
428
  if (fileName.endsWith(".py") && options.workPath) {
428
429
  const fsPath = (0, import_path.join)(options.workPath, fileName);
429
- const isEntrypoint = await (0, import_build_utils.isPythonEntrypoint)({ fsPath });
430
+ const isEntrypoint = await (0, import_python.isPythonEntrypoint)(fsPath);
430
431
  if (!isEntrypoint) {
431
432
  return null;
432
433
  }
@@ -0,0 +1,2 @@
1
+ /** Check whether a Python file defines a supported function entrypoint. */
2
+ export declare function isPythonEntrypoint(fsPath: string): Promise<boolean>;
package/dist/python.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
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
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var python_exports = {};
30
+ __export(python_exports, {
31
+ isPythonEntrypoint: () => isPythonEntrypoint
32
+ });
33
+ module.exports = __toCommonJS(python_exports);
34
+ var import_fs = __toESM(require("fs"));
35
+ var import_build_utils = require("@vercel/build-utils");
36
+ var import_python_analysis = require("@vercel/python-analysis");
37
+ async function isPythonEntrypoint(fsPath) {
38
+ try {
39
+ const content = await import_fs.default.promises.readFile(fsPath, "utf-8");
40
+ return await (0, import_python_analysis.findAppOrHandler)(content) !== null;
41
+ } catch (err) {
42
+ (0, import_build_utils.debug)(`Failed to check Python entrypoint: ${err}`);
43
+ return false;
44
+ }
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ isPythonEntrypoint
49
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "6.15.7",
3
+ "version": "6.15.10",
4
4
  "description": "Vercel filesystem detectors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,9 +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": "14.1.0",
23
+ "@vercel/build-utils": "14.2.0",
24
24
  "@vercel/error-utils": "2.2.1",
25
- "@vercel/frameworks": "3.31.0",
25
+ "@vercel/frameworks": "3.32.0",
26
+ "@vercel/python-analysis": "0.14.0",
26
27
  "@vercel/routing-utils": "6.5.0"
27
28
  },
28
29
  "devDependencies": {