@vercel/fs-detectors 7.12.4 → 7.14.0-snapshot-c9dfd83f2293

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.
@@ -1,10 +1,15 @@
1
1
  import type { Route } from '@vercel/routing-utils';
2
2
  import { type Framework } from '@vercel/frameworks';
3
- import type { PackageJson, Builder, BuilderFunctions, ProjectSettings } from '@vercel/build-utils';
3
+ import type { PackageJson, Builder, BuilderFunctions, ProjectSettings, ProxyConfig } from '@vercel/build-utils';
4
4
  /**
5
5
  * Pattern for finding all supported middleware files.
6
6
  */
7
7
  export declare const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
8
+ /**
9
+ * Pattern for files that the Vercel platform cares about separately from frameworks.
10
+ * These files are excluded from static file serving.
11
+ */
12
+ export declare const VERCEL_PLATFORM_FILES: string[];
8
13
  export declare const REGEX_VERCEL_PLATFORM_FILES: string;
9
14
  /**
10
15
  * Pattern for non-Vercel platform files.
@@ -20,10 +25,7 @@ export interface ErrorResponse {
20
25
  action?: string;
21
26
  link?: string;
22
27
  }
23
- export interface ProxyConfig {
24
- entrypoint: string;
25
- matcher?: string | string[];
26
- }
28
+ export type { ProxyConfig };
27
29
  export interface Options {
28
30
  tag?: string;
29
31
  functions?: BuilderFunctions;
@@ -63,11 +65,44 @@ export declare function detectBuilders(files: string[], pkg?: PackageJson | unde
63
65
  rewriteRoutes: Route[] | null;
64
66
  errorRoutes: Route[] | null;
65
67
  }>;
68
+ export interface ParsedProxyEntrypoint {
69
+ file: string;
70
+ variable?: string;
71
+ }
72
+ export declare function parseProxyEntrypoint(entrypoint: string): ParsedProxyEntrypoint;
73
+ export interface ResolvedProxy {
74
+ /**
75
+ * `vercel-config`: the `proxy` property in the Vercel config (`vercel.json`, etc.).
76
+ * `file-convention`: a root-level `middleware.js` / `middleware.ts`.
77
+ */
78
+ source: 'vercel-config' | 'file-convention';
79
+ entrypoint: string | null;
80
+ file: string;
81
+ builder: Builder;
82
+ }
83
+ /**
84
+ * Resolves the project's proxy: the `proxy` entrypoint if configured,
85
+ * otherwise a root-level `middleware.js` / `middleware.ts`.
86
+ */
87
+ export declare function resolveProxy(files: string[], options: Options): ResolvedProxy | null;
66
88
  export declare function getProxyBuilder(proxy: ProxyConfig, tag?: string, functions?: BuilderFunctions): Builder;
89
+ export interface ProxyValidationOptions {
90
+ /** Config path named in error messages, eg. `proxy` or `services.api.proxy`. */
91
+ field: string;
92
+ /** Whether the proxy is project level or service level. */
93
+ level: 'project' | 'service';
94
+ }
67
95
  /**
68
96
  * Validates a `proxy` config value in isolation, without knowledge of the
69
97
  * project's files or framework. Also used by the CLI to validate
70
98
  * `vercel.json` before builders are detected.
71
99
  */
72
- export declare function validateProxyConfig(proxy: ProxyConfig): ErrorResponse | null;
73
- export declare function validateProxy(options: Pick<Options, 'proxy'>, files: string[], framework: string | null | undefined): ErrorResponse | null;
100
+ export declare function validateProxyConfig(proxy: ProxyConfig, { field, level }: ProxyValidationOptions): ErrorResponse | null;
101
+ /**
102
+ * Validates the `proxy` config on its own.
103
+ */
104
+ export declare function validateProxy(options: Pick<Options, 'proxy'>, files: string[], _framework: string | null | undefined, validationOptions: ProxyValidationOptions): ErrorResponse | null;
105
+ /**
106
+ * Validates a resolved proxy against the rest of the project.
107
+ */
108
+ export declare function validateResolvedProxy(proxy: Pick<ResolvedProxy, 'source' | 'entrypoint' | 'file'>, framework: string | null | undefined, { field }: ProxyValidationOptions): ErrorResponse | null;
@@ -321,15 +321,19 @@ __export(detect_builders_exports, {
321
321
  REGEX_MIDDLEWARE_FILES: () => REGEX_MIDDLEWARE_FILES,
322
322
  REGEX_NON_VERCEL_PLATFORM_FILES: () => REGEX_NON_VERCEL_PLATFORM_FILES,
323
323
  REGEX_VERCEL_PLATFORM_FILES: () => REGEX_VERCEL_PLATFORM_FILES,
324
+ VERCEL_PLATFORM_FILES: () => VERCEL_PLATFORM_FILES,
324
325
  builderToFrameworks: () => builderToFrameworks,
325
326
  detectApiDirectory: () => detectApiDirectory,
326
327
  detectApiExtensions: () => detectApiExtensions,
327
328
  detectBuilders: () => detectBuilders,
328
329
  detectOutputDirectory: () => detectOutputDirectory,
329
330
  getProxyBuilder: () => getProxyBuilder,
331
+ parseProxyEntrypoint: () => parseProxyEntrypoint,
332
+ resolveProxy: () => resolveProxy,
330
333
  sortFiles: () => sortFiles,
331
334
  validateProxy: () => validateProxy,
332
- validateProxyConfig: () => validateProxyConfig
335
+ validateProxyConfig: () => validateProxyConfig,
336
+ validateResolvedProxy: () => validateResolvedProxy
333
337
  });
334
338
  module.exports = __toCommonJS(detect_builders_exports);
335
339
  var import_minimatch = __toESM(require("minimatch"));
@@ -455,7 +459,18 @@ function detectOutputDirectory(builders) {
455
459
  async function detectBuilders(files, pkg, options = {}) {
456
460
  const { projectSettings = {} } = options;
457
461
  const { framework } = projectSettings;
458
- const proxyError = validateProxy(options, files, framework);
462
+ const proxyValidationOptions = {
463
+ field: "proxy",
464
+ level: "project"
465
+ };
466
+ const proxyConfigError = validateProxy(
467
+ options,
468
+ files,
469
+ framework,
470
+ proxyValidationOptions
471
+ );
472
+ const proxy = proxyConfigError ? null : resolveProxy(files, options);
473
+ const proxyError = proxyConfigError ?? (proxy && validateResolvedProxy(proxy, framework, proxyValidationOptions));
459
474
  if (proxyError) {
460
475
  return {
461
476
  builders: null,
@@ -492,7 +507,6 @@ async function detectBuilders(files, pkg, options = {}) {
492
507
  usedFunctions.add(key);
493
508
  };
494
509
  const absolutePathCache = /* @__PURE__ */ new Map();
495
- const proxy = resolveProxy(files, options);
496
510
  const reservedFiles = getReservedFiles(options);
497
511
  const claimedFiles = /* @__PURE__ */ new Set([
498
512
  ...proxy?.source === "vercel-config" ? [proxy.file] : [],
@@ -864,11 +878,11 @@ function getApiMatches() {
864
878
  { src: "api/**/*.rs", use: `@vercel/rust`, config }
865
879
  ];
866
880
  }
867
- function validateProxyConfig(proxy) {
881
+ function validateProxyConfig(proxy, { field, level }) {
868
882
  if (typeof proxy !== "object" || typeof proxy.entrypoint !== "string" || !proxy.entrypoint) {
869
883
  return {
870
884
  code: "invalid_proxy",
871
- message: "The `proxy` property must contain an `entrypoint` string."
885
+ message: `The \`${field}\` property must contain an \`entrypoint\` string.`
872
886
  };
873
887
  }
874
888
  const { file, variable } = parseProxyEntrypoint(proxy.entrypoint);
@@ -878,19 +892,19 @@ function validateProxyConfig(proxy) {
878
892
  if (file.startsWith("/") || file.includes("\\") || segments.includes(".") || segments.includes("..") || /[?#\u0000-\u001f]/.test(file)) {
879
893
  return {
880
894
  code: "invalid_proxy_entrypoint",
881
- message: "The `proxy.entrypoint` path must be relative to the project root and cannot contain traversal, query, fragment, or control characters."
895
+ message: `The \`${field}.entrypoint\` path must be relative to the ${level} root and cannot contain traversal, query, fragment, or control characters.`
882
896
  };
883
897
  }
884
898
  if (!isPythonForm && !isJsForm) {
885
899
  return {
886
900
  code: "invalid_proxy_entrypoint",
887
- message: "The `proxy.entrypoint` must be a `.js` or `.ts` file path, or a Python `module:attr`."
901
+ message: `The \`${field}.entrypoint\` must be a \`.js\` or \`.ts\` file path, or a Python \`module:attr\`.`
888
902
  };
889
903
  }
890
904
  if (isPythonForm && !variable) {
891
905
  return {
892
906
  code: "invalid_proxy_entrypoint",
893
- message: "Python proxy entrypoints must use `module:attr` syntax, not a plain `.py` path."
907
+ message: `The \`${field}.entrypoint\` must use Python \`module:attr\` syntax, not a plain \`.py\` path.`
894
908
  };
895
909
  }
896
910
  if (proxy.matcher !== void 0) {
@@ -900,18 +914,19 @@ function validateProxyConfig(proxy) {
900
914
  )) {
901
915
  return {
902
916
  code: "invalid_proxy_matcher",
903
- message: "The `proxy.matcher` value must be a path matcher starting with `/`, or an array of path matchers starting with `/`."
917
+ message: `The \`${field}.matcher\` value must be a path matcher starting with \`/\`, or an array of path matchers starting with \`/\`.`
904
918
  };
905
919
  }
906
920
  }
907
921
  return null;
908
922
  }
909
- function validateProxy(options, files, framework) {
923
+ function validateProxy(options, files, _framework, validationOptions) {
910
924
  const { proxy } = options;
911
925
  if (!proxy) {
912
926
  return null;
913
927
  }
914
- const configError = validateProxyConfig(proxy);
928
+ const { field } = validationOptions;
929
+ const configError = validateProxyConfig(proxy, validationOptions);
915
930
  if (configError) {
916
931
  return configError;
917
932
  }
@@ -919,21 +934,24 @@ function validateProxy(options, files, framework) {
919
934
  if (!files.includes(file)) {
920
935
  return {
921
936
  code: "proxy_entrypoint_not_found",
922
- message: `The proxy entrypoint \`${proxy.entrypoint}\` does not exist.`
937
+ message: `The \`${field}.entrypoint\` \`${proxy.entrypoint}\` does not exist.`
923
938
  };
924
939
  }
940
+ return null;
941
+ }
942
+ function validateResolvedProxy(proxy, framework, { field }) {
925
943
  const appRuntime = (0, import_framework.inferBuilderRuntimeFromFramework)(framework);
926
- const proxyRuntime = import_constants.ENTRYPOINT_EXTENSIONS[(0, import_path.extname)(file)];
944
+ const proxyRuntime = import_constants.ENTRYPOINT_EXTENSIONS[(0, import_path.extname)(proxy.file)];
927
945
  if (appRuntime !== void 0 && proxyRuntime !== void 0 && appRuntime !== proxyRuntime) {
928
946
  return {
929
947
  code: "proxy_runtime_mismatch",
930
- message: `The proxy entrypoint \`${proxy.entrypoint}\` uses the ${proxyRuntime} runtime, but the app uses the ${appRuntime} runtime. The proxy and app must use the same runtime.`
948
+ message: proxy.source === "vercel-config" ? `The \`${field}.entrypoint\` \`${proxy.entrypoint}\` uses the ${proxyRuntime} runtime, but the app uses the ${appRuntime} runtime. The proxy and app must use the same runtime.` : `The middleware \`${proxy.file}\` uses the ${proxyRuntime} runtime, but the app uses the ${appRuntime} runtime. The middleware and app must use the same runtime.`
931
949
  };
932
950
  }
933
- if (framework === "nextjs" || framework === "astro") {
951
+ if (proxy.source === "vercel-config" && (framework === "nextjs" || framework === "astro")) {
934
952
  return {
935
953
  code: "proxy_framework_conflict",
936
- message: `The \`proxy\` property cannot be used with ${framework === "nextjs" ? "Next.js" : "Astro"} because the framework builds its own routing middleware.`
954
+ message: `The \`${field}\` property cannot be used with ${framework === "nextjs" ? "Next.js" : "Astro"} because the framework builds its own routing middleware.`
937
955
  };
938
956
  }
939
957
  return null;
@@ -1427,13 +1445,17 @@ function sortFilesBySegmentCount(fileA, fileB) {
1427
1445
  REGEX_MIDDLEWARE_FILES,
1428
1446
  REGEX_NON_VERCEL_PLATFORM_FILES,
1429
1447
  REGEX_VERCEL_PLATFORM_FILES,
1448
+ VERCEL_PLATFORM_FILES,
1430
1449
  builderToFrameworks,
1431
1450
  detectApiDirectory,
1432
1451
  detectApiExtensions,
1433
1452
  detectBuilders,
1434
1453
  detectOutputDirectory,
1435
1454
  getProxyBuilder,
1455
+ parseProxyEntrypoint,
1456
+ resolveProxy,
1436
1457
  sortFiles,
1437
1458
  validateProxy,
1438
- validateProxyConfig
1459
+ validateProxyConfig,
1460
+ validateResolvedProxy
1439
1461
  });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { builderToFrameworks, detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, getProxyBuilder, validateProxyConfig, validateProxy, type Options as DetectBuildersOptions, type ProxyConfig, } from './detect-builders';
1
+ export { builderToFrameworks, detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, getProxyBuilder, validateProxyConfig, validateProxy, resolveProxy, validateResolvedProxy, type Options as DetectBuildersOptions, type ProxyConfig, type ResolvedProxy, } from './detect-builders';
2
2
  export { detectServices, generateServiceRewrites, generateServicesRoutes, } from './services/detect-services';
3
3
  export { detectDaemons } from './services/detect-daemons';
4
4
  export { resolveAllConfiguredServicesV2, resolveConfiguredServiceV2, validateServiceConfigV2, } from './services/resolve-v2';
package/dist/index.js CHANGED
@@ -66,9 +66,11 @@ __export(src_exports, {
66
66
  resolveAllConfiguredServices: () => import_resolve.resolveAllConfiguredServices,
67
67
  resolveAllConfiguredServicesV2: () => import_resolve_v2.resolveAllConfiguredServicesV2,
68
68
  resolveConfiguredServiceV2: () => import_resolve_v2.resolveConfiguredServiceV2,
69
+ resolveProxy: () => import_detect_builders.resolveProxy,
69
70
  resolveWorkspacePackageTargets: () => import_resolve_workspace_package_targets.resolveWorkspacePackageTargets,
70
71
  validateProxy: () => import_detect_builders.validateProxy,
71
72
  validateProxyConfig: () => import_detect_builders.validateProxyConfig,
73
+ validateResolvedProxy: () => import_detect_builders.validateResolvedProxy,
72
74
  validateServiceConfigV2: () => import_resolve_v2.validateServiceConfigV2,
73
75
  workspaceManagers: () => import_workspace_managers.workspaceManagers
74
76
  });
@@ -146,9 +148,11 @@ var import_detect_instrumentation = require("./detect-instrumentation");
146
148
  resolveAllConfiguredServices,
147
149
  resolveAllConfiguredServicesV2,
148
150
  resolveConfiguredServiceV2,
151
+ resolveProxy,
149
152
  resolveWorkspacePackageTargets,
150
153
  validateProxy,
151
154
  validateProxyConfig,
155
+ validateResolvedProxy,
152
156
  validateServiceConfigV2,
153
157
  workspaceManagers,
154
158
  ...require("./monorepos/get-monorepo-default-settings")
@@ -33,6 +33,8 @@ var import_entrypoint = require("./runtimes/entrypoint");
33
33
  var import_buildpack_runtimes = require("../buildpack-runtimes");
34
34
  var import_resolve = require("./resolve");
35
35
  var import_utils = require("./utils");
36
+ var import_detect_builders = require("../detect-builders");
37
+ var import_detect_builders2 = require("../detect-builders");
36
38
  const frameworksBySlug = new Map(import_frameworks.frameworkList.map((f) => [f.slug, f]));
37
39
  const MAX_SERVICE_NAME_LENGTH = 64;
38
40
  const SERVICE_NAME_REGEX = /^[a-z]([a-z_-]*[a-z])?$/;
@@ -106,6 +108,15 @@ async function resolveContainerServiceV2(name, config, normalizedRoot, serviceFs
106
108
  }
107
109
  }
108
110
  const builderSrc = isRoot ? dockerfile : import_path.posix.join(normalizedRoot, dockerfile);
111
+ const proxyError = await validateServiceProxy(
112
+ name,
113
+ config,
114
+ serviceFs,
115
+ void 0
116
+ );
117
+ if (proxyError) {
118
+ return { error: proxyError };
119
+ }
109
120
  const builderConfig = { zeroConfig: true };
110
121
  if (!isRoot) {
111
122
  builderConfig.workspace = normalizedRoot;
@@ -132,6 +143,7 @@ async function resolveContainerServiceV2(name, config, normalizedRoot, serviceFs
132
143
  },
133
144
  bindings: config.bindings,
134
145
  functions: config.functions,
146
+ proxy: config.proxy,
135
147
  headers: config.headers,
136
148
  redirects: config.redirects,
137
149
  rewrites: config.rewrites,
@@ -141,6 +153,28 @@ async function resolveContainerServiceV2(name, config, normalizedRoot, serviceFs
141
153
  }
142
154
  };
143
155
  }
156
+ async function validateServiceProxy(name, config, serviceFs, framework) {
157
+ const { proxy } = config;
158
+ if (!proxy) {
159
+ return null;
160
+ }
161
+ const validationOptions = {
162
+ field: `services.${name}.proxy`,
163
+ level: "service"
164
+ };
165
+ const { file } = (0, import_detect_builders2.parseProxyEntrypoint)(proxy.entrypoint);
166
+ const files = await (0, import_utils.hasFile)(serviceFs, file) ? [file] : [];
167
+ const error = (0, import_detect_builders2.validateProxy)({ proxy }, files, framework, validationOptions) ?? (0, import_detect_builders2.validateResolvedProxy)(
168
+ { source: "vercel-config", entrypoint: proxy.entrypoint, file },
169
+ framework,
170
+ validationOptions
171
+ );
172
+ return error ? {
173
+ code: error.code.toUpperCase(),
174
+ message: error.message,
175
+ serviceName: name
176
+ } : null;
177
+ }
144
178
  function validateServiceConfigV2(name, config) {
145
179
  if (!isValidServiceName(name)) {
146
180
  return {
@@ -156,25 +190,30 @@ function validateServiceConfigV2(name, config) {
156
190
  serviceName: name
157
191
  };
158
192
  }
159
- if (typeof config.root !== "string" || config.root.length === 0) {
193
+ if (config.image !== void 0) {
194
+ const imageError = validateImageServiceConfigV2(name, config);
195
+ if (imageError)
196
+ return imageError;
197
+ } else if (typeof config.root !== "string" || config.root.length === 0) {
160
198
  return {
161
199
  code: "MISSING_ROOT",
162
- message: `Service "${name}" must specify a "root".`,
200
+ message: `Service "${name}" must specify a "root" or an "image".`,
163
201
  serviceName: name
164
202
  };
165
203
  }
166
- const normalizedRoot = import_path.posix.normalize(config.root);
204
+ const root = config.root ?? ".";
205
+ const normalizedRoot = import_path.posix.normalize(root);
167
206
  if (normalizedRoot.startsWith("/")) {
168
207
  return {
169
208
  code: "INVALID_ROOT",
170
- message: `Service "${name}" has invalid "root" "${config.root}". Must be a relative path.`,
209
+ message: `Service "${name}" has invalid "root" "${root}". Must be a relative path.`,
171
210
  serviceName: name
172
211
  };
173
212
  }
174
213
  if (normalizedRoot === ".." || normalizedRoot.startsWith("../")) {
175
214
  return {
176
215
  code: "INVALID_ROOT",
177
- message: `Service "${name}" has invalid "root" "${config.root}". Must not escape the project root.`,
216
+ message: `Service "${name}" has invalid "root" "${root}". Must not escape the project root.`,
178
217
  serviceName: name
179
218
  };
180
219
  }
@@ -204,8 +243,92 @@ function validateServiceConfigV2(name, config) {
204
243
  }
205
244
  return null;
206
245
  }
246
+ function validateImageServiceConfigV2(name, config) {
247
+ const invalid = (message) => ({
248
+ code: "INVALID_SERVICE_CONFIG",
249
+ message,
250
+ serviceName: name
251
+ });
252
+ const imageProblem = (0, import_build_utils.getVcrImageProblem)(config.image);
253
+ if (imageProblem) {
254
+ return invalid(`Service "${name}" has invalid "image": it ${imageProblem}`);
255
+ }
256
+ const conflicts = import_build_utils.SERVICE_IMAGE_BUILD_SETTINGS.filter(
257
+ (field) => config[field] !== void 0
258
+ );
259
+ if (conflicts.length > 0) {
260
+ const fields = conflicts.map((field) => `"${field}"`).join(", ");
261
+ return invalid(
262
+ `Service "${name}" sets "image", so it isn't built and can't set ${fields}.`
263
+ );
264
+ }
265
+ if (config.runtime !== void 0 && config.runtime !== "container") {
266
+ return invalid(
267
+ `Service "${name}" sets "image", so its "runtime" can only be "container".`
268
+ );
269
+ }
270
+ if (config.functions !== void 0) {
271
+ return invalid(
272
+ `Service "${name}" sets "image", so it can't set "functions". The functions configuration isn't supported for image services.`
273
+ );
274
+ }
275
+ if (config.proxy !== void 0) {
276
+ return invalid(
277
+ `Service "${name}" sets "image", so it can't set "proxy". A proxy isn't supported for image services.`
278
+ );
279
+ }
280
+ return null;
281
+ }
282
+ function resolveImageServiceV2(name, config, normalizedRoot) {
283
+ const isRoot = normalizedRoot === ".";
284
+ const command = normalizeContainerCommand(config.command);
285
+ const image = (0, import_build_utils.normalizeVcrImageRef)(config.image);
286
+ const builderConfig = {
287
+ zeroConfig: true,
288
+ handler: image
289
+ };
290
+ if (!isRoot) {
291
+ builderConfig.workspace = normalizedRoot;
292
+ }
293
+ if (command) {
294
+ builderConfig.command = command;
295
+ }
296
+ return {
297
+ service: {
298
+ schema: "experimentalServicesV2",
299
+ name,
300
+ root: normalizedRoot,
301
+ runtime: "container",
302
+ image,
303
+ command,
304
+ builder: {
305
+ // Names no file, but must be unique per build and must not look like a
306
+ // Dockerfile.
307
+ src: import_path.posix.join(normalizedRoot, `.vercel/images/${name}/<image>`),
308
+ use: "@vercel/container",
309
+ config: builderConfig
310
+ },
311
+ bindings: config.bindings,
312
+ headers: config.headers,
313
+ redirects: config.redirects,
314
+ rewrites: config.rewrites,
315
+ routes: config.routes,
316
+ cleanUrls: config.cleanUrls,
317
+ trailingSlash: config.trailingSlash
318
+ }
319
+ };
320
+ }
207
321
  async function resolveConfiguredServiceV2(name, config, fs) {
208
- const normalizedRoot = (0, import_entrypoint.stripTrailingSlash)(import_path.posix.normalize(config.root));
322
+ const normalizedRoot = (0, import_entrypoint.stripTrailingSlash)(
323
+ import_path.posix.normalize(config.root ?? ".")
324
+ );
325
+ if (config.image !== void 0) {
326
+ return resolveImageServiceV2(
327
+ name,
328
+ { ...config, image: config.image },
329
+ normalizedRoot
330
+ );
331
+ }
209
332
  const serviceFsResult = normalizedRoot === "." ? { fs } : await (0, import_resolve.getServiceFs)(fs, name, normalizedRoot);
210
333
  if (serviceFsResult.error) {
211
334
  return { error: serviceFsResult.error };
@@ -337,6 +460,9 @@ async function resolveConfiguredServiceV2(name, config, fs) {
337
460
  if (builderUse === "@vercel/backends") {
338
461
  builderConfig.serviceName = name;
339
462
  }
463
+ if (builderUse === "@vercel/static") {
464
+ builderConfig.excludeFiles = [...import_detect_builders.VERCEL_PLATFORM_FILES];
465
+ }
340
466
  if (framework) {
341
467
  builderConfig.framework = framework;
342
468
  }
@@ -357,6 +483,15 @@ async function resolveConfiguredServiceV2(name, config, fs) {
357
483
  builderConfig.handlerFunction = moduleAttr.attrName;
358
484
  }
359
485
  const runtime = import_constants.STATIC_BUILDERS.has(builderUse) ? void 0 : inferredRuntime;
486
+ const proxyError = await validateServiceProxy(
487
+ name,
488
+ config,
489
+ serviceFs,
490
+ framework
491
+ );
492
+ if (proxyError) {
493
+ return { error: proxyError };
494
+ }
360
495
  return {
361
496
  service: {
362
497
  schema: "experimentalServicesV2",
@@ -377,6 +512,7 @@ async function resolveConfiguredServiceV2(name, config, fs) {
377
512
  outputDirectory: config.outputDirectory,
378
513
  bindings: config.bindings,
379
514
  functions: config.functions,
515
+ proxy: config.proxy,
380
516
  headers: config.headers,
381
517
  redirects: config.redirects,
382
518
  rewrites: config.rewrites,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "7.12.4",
3
+ "version": "7.14.0-snapshot-c9dfd83f2293",
4
4
  "description": "Vercel filesystem detectors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,11 +20,11 @@
20
20
  "minimatch": "3.1.2",
21
21
  "semver": "6.3.1",
22
22
  "smol-toml": "1.5.2",
23
- "@vercel/build-utils": "15.5.0",
23
+ "@vercel/build-utils": "15.7.0-snapshot-c9dfd83f2293",
24
24
  "@vercel/error-utils": "2.2.1",
25
- "@vercel/frameworks": "3.35.0",
26
- "@vercel/routing-utils": "6.6.1",
27
- "@vercel/python-analysis": "0.15.3"
25
+ "@vercel/frameworks": "3.35.1",
26
+ "@vercel/python-analysis": "0.15.4",
27
+ "@vercel/routing-utils": "6.6.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/glob": "7.2.0",
@@ -33,7 +33,7 @@
33
33
  "@types/node": "20.11.0",
34
34
  "@types/semver": "7.3.10",
35
35
  "vitest": "4.1.10",
36
- "@vercel-internals/runtimes": "1.2.12"
36
+ "@vercel-internals/runtimes": "1.2.14"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node build.mjs",