@vercel/fs-detectors 5.8.9 → 5.8.12

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.
@@ -528,23 +528,7 @@ function checkUnusedFunctions(frontendBuilder, usedFunctions, options) {
528
528
  }
529
529
  }
530
530
  if (frontendBuilder && ((0, import_is_official_runtime.isOfficialRuntime)("express", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("hono", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("backends", frontendBuilder.use))) {
531
- const validFilenames = [
532
- "app",
533
- "index",
534
- "server",
535
- "src/app",
536
- "src/index",
537
- "src/server"
538
- ];
539
- const validExtensions = ["js", "cjs", "mjs", "ts", "cts", "mts"];
540
- const validEntrypoints = validFilenames.flatMap(
541
- (filename) => validExtensions.map((extension) => `${filename}.${extension}`)
542
- );
543
- for (const fnKey of unusedFunctions.values()) {
544
- if (validEntrypoints.includes(fnKey)) {
545
- unusedFunctions.delete(fnKey);
546
- }
547
- }
531
+ return null;
548
532
  }
549
533
  if (unusedFunctions.size) {
550
534
  const [fnKey] = Array.from(unusedFunctions);
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { autoDetectServices } from './services/auto-detect';
4
4
  export type { AutoDetectOptions, AutoDetectResult, } from './services/auto-detect';
5
5
  export { isStaticBuild, isRouteOwningBuilder, INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, } from './services/utils';
6
6
  export { getServicesBuilders } from './services/get-services-builders';
7
- export type { DetectServicesOptions, DetectServicesResult, ResolvedService, Service, ServicesRoutes, ServiceDetectionError, } from './services/types';
7
+ export type { DetectServicesOptions, DetectServicesResult, DetectServicesSource, ResolvedService, Service, ServicesRoutes, ServiceDetectionError, } from './services/types';
8
8
  export { detectFileSystemAPI } from './detect-file-system-api';
9
9
  export { detectFramework, detectFrameworks, detectFrameworkRecord, detectFrameworkVersion, } from './detect-framework';
10
10
  export { getProjectPaths } from './get-project-paths';
@@ -38,6 +38,9 @@ const APPS_WEB_DIR = "apps/web";
38
38
  const BACKEND_DIR = "backend";
39
39
  const SERVICES_DIR = "services";
40
40
  const FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
41
+ const DETECTION_FRAMEWORKS = import_frameworks.default.filter(
42
+ (framework) => !framework.experimental || framework.runtimeFramework
43
+ );
41
44
  async function autoDetectServices(options) {
42
45
  const { fs } = options;
43
46
  const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
@@ -198,7 +201,8 @@ async function detectServiceInDir(fs, dirPath, serviceName) {
198
201
  const serviceFs = fs.chdir(dirPath);
199
202
  const frameworks = await (0, import_detect_framework.detectFrameworks)({
200
203
  fs: serviceFs,
201
- frameworkList: import_frameworks.default
204
+ frameworkList: DETECTION_FRAMEWORKS,
205
+ useExperimentalFrameworks: true
202
206
  });
203
207
  if (frameworks.length > 1) {
204
208
  const frameworkNames = frameworks.map((f) => f.name).join(", ");
@@ -33,6 +33,7 @@ async function detectServices(options) {
33
33
  if (configError) {
34
34
  return {
35
35
  services: [],
36
+ source: "configured",
36
37
  routes: { rewrites: [], defaults: [], crons: [], workers: [] },
37
38
  errors: [configError],
38
39
  warnings: []
@@ -45,6 +46,7 @@ async function detectServices(options) {
45
46
  if (autoResult.errors.length > 0) {
46
47
  return {
47
48
  services: [],
49
+ source: "auto-detected",
48
50
  routes: { rewrites: [], defaults: [], crons: [], workers: [] },
49
51
  errors: autoResult.errors,
50
52
  warnings: []
@@ -59,6 +61,7 @@ async function detectServices(options) {
59
61
  const routes2 = generateServicesRoutes(result2.services);
60
62
  return {
61
63
  services: result2.services,
64
+ source: "auto-detected",
62
65
  routes: routes2,
63
66
  errors: result2.errors,
64
67
  warnings: []
@@ -66,6 +69,7 @@ async function detectServices(options) {
66
69
  }
67
70
  return {
68
71
  services: [],
72
+ source: "auto-detected",
69
73
  routes: { rewrites: [], defaults: [], crons: [], workers: [] },
70
74
  errors: [
71
75
  {
@@ -84,6 +88,7 @@ async function detectServices(options) {
84
88
  const routes = generateServicesRoutes(result.services);
85
89
  return {
86
90
  services: result.services,
91
+ source: "configured",
87
92
  routes,
88
93
  errors: result.errors,
89
94
  warnings: []
@@ -34,11 +34,18 @@ export interface ServicesRoutes {
34
34
  }
35
35
  export interface DetectServicesResult {
36
36
  services: Service[];
37
+ /**
38
+ * Source of service definitions:
39
+ * - `configured`: loaded from explicit project configuration (currently `vercel.json#experimentalServices`)
40
+ * - `auto-detected`: inferred from project structure
41
+ */
42
+ source: DetectServicesSource;
37
43
  /** Routing rules derived from services */
38
44
  routes: ServicesRoutes;
39
45
  errors: ServiceDetectionError[];
40
46
  warnings: ServiceDetectionWarning[];
41
47
  }
48
+ export type DetectServicesSource = 'configured' | 'auto-detected';
42
49
  export interface ServiceDetectionWarning {
43
50
  code: string;
44
51
  message: string;
@@ -22,9 +22,10 @@ export declare function isRouteOwningBuilder(service: ResolvedService): boolean;
22
22
  *
23
23
  * Priority (highest to lowest):
24
24
  * 1. Explicit runtime (user specified in config)
25
- * 2. Framework detection (fastapipython, expressnode)
26
- * 3. Builder detection (@vercel/python → python)
27
- * 4. Entrypoint extension (.py → python, .ts → node)
25
+ * 2. Runtime framework slug (rubyruby, gogo)
26
+ * 3. Framework detection (fastapi → python, express node)
27
+ * 4. Builder detection (@vercel/python → python)
28
+ * 5. Entrypoint extension (.py → python, .ts → node)
28
29
  *
29
30
  * @returns The inferred runtime, or undefined if none can be determined.
30
31
  */
@@ -58,6 +58,9 @@ function inferServiceRuntime(config) {
58
58
  if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
59
59
  return config.runtime;
60
60
  }
61
+ if (config.framework && config.framework in import_types.RUNTIME_BUILDERS) {
62
+ return config.framework;
63
+ }
61
64
  if ((0, import_framework_helpers.isPythonFramework)(config.framework)) {
62
65
  return "python";
63
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "5.8.9",
3
+ "version": "5.8.12",
4
4
  "description": "Vercel filesystem detectors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "minimatch": "3.1.2",
21
21
  "semver": "6.3.1",
22
22
  "@vercel/error-utils": "2.0.3",
23
- "@vercel/routing-utils": "5.3.3",
24
- "@vercel/frameworks": "3.18.0"
23
+ "@vercel/routing-utils": "6.0.0",
24
+ "@vercel/frameworks": "3.19.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.4.3"
35
+ "@vercel/build-utils": "13.6.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node ../../utils/build.mjs",