@vercel/fs-detectors 6.7.2 → 6.7.3

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.
@@ -44,12 +44,6 @@ function emptyRoutes() {
44
44
  workers: []
45
45
  };
46
46
  }
47
- function isEnvVars(env) {
48
- if (!env)
49
- return false;
50
- const first = Object.values(env)[0];
51
- return typeof first === "object" && first !== null;
52
- }
53
47
  function withResolvedResult(resolved, inferred = null) {
54
48
  return {
55
49
  services: resolved.services,
@@ -142,8 +136,7 @@ async function detectServices(options) {
142
136
  {
143
137
  requireFileEntrypointForBackendRuntimes: Boolean(
144
138
  hasNonEmptyPublicServicesConfig
145
- ),
146
- rootEnv: isEnvVars(vercelConfig?.env) ? vercelConfig?.env : void 0
139
+ )
147
140
  }
148
141
  );
149
142
  const routes = generateServicesRoutes(result.services);
@@ -1,4 +1,4 @@
1
- import type { EnvVars, Service, ConfiguredServices, ExperimentalServiceConfig, ServiceConfig, ServiceDetectionError } from './types';
1
+ import type { Service, ConfiguredServices, ExperimentalServiceConfig, ServiceConfig, ServiceDetectionError } from './types';
2
2
  import type { DetectorFilesystem } from '../detectors/filesystem';
3
3
  type ConfiguredServiceConfig = (ServiceConfig | ExperimentalServiceConfig) & Partial<ExperimentalServiceConfig>;
4
4
  interface ResolvedEntrypointPath {
@@ -18,12 +18,6 @@ interface ResolveConfiguredServiceOptions {
18
18
  }
19
19
  interface ResolveAllConfiguredServicesOptions {
20
20
  requireFileEntrypointForBackendRuntimes?: boolean;
21
- /**
22
- * Optional top-level `env` (from vercel.json `env`). Per-service `env`
23
- * values take precedence; entries here are folded into every service that
24
- * doesn't already define the same name.
25
- */
26
- rootEnv?: EnvVars;
27
21
  }
28
22
  /**
29
23
  * Validate a service configuration from vercel.json services.
@@ -840,23 +840,12 @@ async function resolveAllConfiguredServices(services, fs, routePrefixSource = "c
840
840
  for (const service of resolved) {
841
841
  if (!service.env)
842
842
  continue;
843
- validateEnvRefs(
844
- service.env,
845
- `Service "${service.name}" env`,
846
- servicesByName,
847
- errors,
848
- service.name
849
- );
850
- }
851
- if (options.rootEnv) {
852
- validateEnvRefs(options.rootEnv, "env", servicesByName, errors);
853
- for (const service of resolved) {
854
- service.env = { ...options.rootEnv, ...service.env ?? {} };
855
- }
843
+ validateEnvRefs(service.env, service.name, servicesByName, errors);
856
844
  }
857
845
  return { services: resolved, errors };
858
846
  }
859
- function validateEnvRefs(env, pathPrefix, servicesByName, errors, serviceName) {
847
+ function validateEnvRefs(env, serviceName, servicesByName, errors) {
848
+ const pathPrefix = `Service "${serviceName}" env`;
860
849
  for (const [envVarName, envVar] of Object.entries(env)) {
861
850
  if (envVar.type !== "service-ref")
862
851
  continue;
@@ -866,7 +855,7 @@ function validateEnvRefs(env, pathPrefix, servicesByName, errors, serviceName) {
866
855
  errors.push({
867
856
  code: "UNKNOWN_SERVICE_REF",
868
857
  message: `${pathPrefix}["${envVarName}"] references unknown service "${refName}".`,
869
- ...serviceName ? { serviceName } : {}
858
+ serviceName
870
859
  });
871
860
  continue;
872
861
  }
@@ -874,7 +863,7 @@ function validateEnvRefs(env, pathPrefix, servicesByName, errors, serviceName) {
874
863
  errors.push({
875
864
  code: "INVALID_SERVICE_REF_TYPE",
876
865
  message: `${pathPrefix}["${envVarName}"] references service "${refName}" which is a ${target.type} service and has no URL. Only web services can be referenced.`,
877
- ...serviceName ? { serviceName } : {}
866
+ serviceName
878
867
  });
879
868
  }
880
869
  }
@@ -1,7 +1,7 @@
1
1
  import { INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceCronPath } from '@vercel/build-utils';
2
2
  import type { Framework } from '@vercel/frameworks';
3
3
  import type { DetectorFilesystem } from '../detectors/filesystem';
4
- import type { EnvVars, ServiceRuntime, ExperimentalServices, Services, ServiceDetectionError, ServiceDetectionWarning, ResolvedService } from './types';
4
+ import type { ServiceRuntime, ExperimentalServices, Services, ServiceDetectionError, ServiceDetectionWarning, ResolvedService } from './types';
5
5
  export declare const DETECTION_FRAMEWORKS: Framework[];
6
6
  export { INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceCronPath, };
7
7
  export declare function hasFile(fs: DetectorFilesystem, filePath: string): Promise<boolean>;
@@ -61,7 +61,6 @@ export interface ReadVercelConfigResult {
61
61
  config: {
62
62
  services?: Services;
63
63
  experimentalServices?: ExperimentalServices;
64
- env?: Record<string, string> | EnvVars;
65
64
  } | null;
66
65
  error: ServiceDetectionError | null;
67
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "6.7.2",
3
+ "version": "6.7.3",
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.26.3",
23
+ "@vercel/error-utils": "2.1.0",
24
+ "@vercel/build-utils": "13.26.4",
24
25
  "@vercel/routing-utils": "6.2.0",
25
- "@vercel/frameworks": "3.26.1",
26
- "@vercel/error-utils": "2.1.0"
26
+ "@vercel/frameworks": "3.26.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/glob": "7.2.0",