@vercel/fs-detectors 6.7.3 → 6.7.4

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.
@@ -95,11 +95,13 @@ async function detectBuilders(files, pkg, options = {}) {
95
95
  const { services, experimentalServices, projectSettings = {} } = options;
96
96
  const { framework } = projectSettings;
97
97
  const configuredServices = services ?? experimentalServices;
98
+ const configuredServicesType = services != null ? "services" : "experimentalServices";
98
99
  const hasServicesConfig = configuredServices != null && typeof configuredServices === "object";
99
100
  if (hasServicesConfig || framework === "services") {
100
101
  return (0, import_get_services_builders.getServicesBuilders)({
101
102
  workPath: options.workPath,
102
103
  configuredServices,
104
+ configuredServicesType,
103
105
  projectFramework: framework
104
106
  });
105
107
  }
@@ -86,7 +86,13 @@ function toInferredLayoutConfig(services) {
86
86
  return inferredConfig;
87
87
  }
88
88
  async function detectServices(options) {
89
- const { fs, workPath, detectEntrypoint } = options;
89
+ const {
90
+ fs,
91
+ workPath,
92
+ detectEntrypoint,
93
+ configuredServices: providedConfiguredServices,
94
+ configuredServicesType
95
+ } = options;
90
96
  const scopedFs = workPath ? fs.chdir(workPath) : fs;
91
97
  const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
92
98
  if (configError) {
@@ -99,8 +105,9 @@ async function detectServices(options) {
99
105
  warnings: []
100
106
  });
101
107
  }
102
- const hasNonEmptyPublicServicesConfig = vercelConfig?.services && Object.keys(vercelConfig.services).length > 0;
103
- const configuredServices = hasNonEmptyPublicServicesConfig ? vercelConfig.services : vercelConfig?.experimentalServices;
108
+ const hasProvidedConfiguredServices = providedConfiguredServices && Object.keys(providedConfiguredServices).length > 0;
109
+ const hasNonEmptyPublicServicesConfig = hasProvidedConfiguredServices && configuredServicesType === "services" || !hasProvidedConfiguredServices && vercelConfig?.services && Object.keys(vercelConfig.services).length > 0;
110
+ const configuredServices = hasProvidedConfiguredServices ? providedConfiguredServices : hasNonEmptyPublicServicesConfig ? vercelConfig?.services : vercelConfig?.experimentalServices;
104
111
  const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
105
112
  if (!hasConfiguredServices) {
106
113
  const detectors = [
@@ -1,6 +1,6 @@
1
1
  import type { Route } from '@vercel/routing-utils';
2
- import type { Builder, ExperimentalServices } from '@vercel/build-utils';
3
- import type { ResolvedService } from './types';
2
+ import type { Builder } from '@vercel/build-utils';
3
+ import type { ConfiguredServices, ResolvedService } from './types';
4
4
  export interface ErrorResponse {
5
5
  code: string;
6
6
  message: string;
@@ -9,7 +9,8 @@ export interface ErrorResponse {
9
9
  }
10
10
  export interface GetServicesBuildersOptions {
11
11
  workPath?: string;
12
- configuredServices?: ExperimentalServices;
12
+ configuredServices?: ConfiguredServices;
13
+ configuredServicesType?: 'services' | 'experimentalServices';
13
14
  projectFramework?: string | null;
14
15
  }
15
16
  export interface ServicesBuildersResult {
@@ -28,7 +28,12 @@ function isExperimentalServicesAutoDetectionEnabled() {
28
28
  return env === "1" || env?.toLowerCase() === "true";
29
29
  }
30
30
  async function getServicesBuilders(options) {
31
- const { workPath, configuredServices, projectFramework } = options;
31
+ const {
32
+ workPath,
33
+ configuredServices,
34
+ configuredServicesType,
35
+ projectFramework
36
+ } = options;
32
37
  const hasServiceDefinitions = configuredServices != null && Object.keys(configuredServices).length > 0;
33
38
  if (projectFramework === "services" && !hasServiceDefinitions && !isExperimentalServicesAutoDetectionEnabled()) {
34
39
  return {
@@ -67,7 +72,11 @@ async function getServicesBuilders(options) {
67
72
  };
68
73
  }
69
74
  const fs = new import_local_file_system_detector.LocalFileSystemDetector(workPath);
70
- const result = await (0, import_detect_services.detectServices)({ fs });
75
+ const result = await (0, import_detect_services.detectServices)({
76
+ fs,
77
+ configuredServices,
78
+ configuredServicesType
79
+ });
71
80
  const warningResponses = result.warnings.map((w) => ({
72
81
  code: w.code,
73
82
  message: w.message
@@ -8,6 +8,8 @@ export type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, Ex
8
8
  export type ResolvedService = Service;
9
9
  export interface DetectServicesOptions {
10
10
  fs: DetectorFilesystem;
11
+ configuredServices?: ConfiguredServices;
12
+ configuredServicesType?: 'services' | 'experimentalServices';
11
13
  /**
12
14
  * Working directory path (relative to fs root).
13
15
  * If provided, vercel.json is read from this path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "6.7.3",
3
+ "version": "6.7.4",
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/error-utils": "2.1.0",
24
23
  "@vercel/build-utils": "13.26.4",
25
- "@vercel/routing-utils": "6.2.0",
26
- "@vercel/frameworks": "3.26.1"
24
+ "@vercel/error-utils": "2.1.0",
25
+ "@vercel/frameworks": "3.26.1",
26
+ "@vercel/routing-utils": "6.2.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/glob": "7.2.0",