@vercel/fs-detectors 7.14.0-snapshot-224301946cd2 → 7.14.0

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.
@@ -11,6 +11,7 @@ export declare const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
11
11
  */
12
12
  export declare const VERCEL_PLATFORM_FILES: string[];
13
13
  export declare const REGEX_VERCEL_PLATFORM_FILES: string;
14
+ export declare function escapeMinimatchPath(path: string): string;
14
15
  /**
15
16
  * Pattern for non-Vercel platform files.
16
17
  */
@@ -327,6 +327,7 @@ __export(detect_builders_exports, {
327
327
  detectApiExtensions: () => detectApiExtensions,
328
328
  detectBuilders: () => detectBuilders,
329
329
  detectOutputDirectory: () => detectOutputDirectory,
330
+ escapeMinimatchPath: () => escapeMinimatchPath,
330
331
  getProxyBuilder: () => getProxyBuilder,
331
332
  parseProxyEntrypoint: () => parseProxyEntrypoint,
332
333
  resolveProxy: () => resolveProxy,
@@ -1451,6 +1452,7 @@ function sortFilesBySegmentCount(fileA, fileB) {
1451
1452
  detectApiExtensions,
1452
1453
  detectBuilders,
1453
1454
  detectOutputDirectory,
1455
+ escapeMinimatchPath,
1454
1456
  getProxyBuilder,
1455
1457
  parseProxyEntrypoint,
1456
1458
  resolveProxy,
@@ -34,7 +34,6 @@ var import_buildpack_runtimes = require("../buildpack-runtimes");
34
34
  var import_resolve = require("./resolve");
35
35
  var import_utils = require("./utils");
36
36
  var import_detect_builders = require("../detect-builders");
37
- var import_detect_builders2 = require("../detect-builders");
38
37
  const frameworksBySlug = new Map(import_frameworks.frameworkList.map((f) => [f.slug, f]));
39
38
  const MAX_SERVICE_NAME_LENGTH = 64;
40
39
  const SERVICE_NAME_REGEX = /^[a-z]([a-z_-]*[a-z])?$/;
@@ -162,18 +161,23 @@ async function validateServiceProxy(name, config, serviceFs, framework) {
162
161
  field: `services.${name}.proxy`,
163
162
  level: "service"
164
163
  };
165
- const { file } = (0, import_detect_builders2.parseProxyEntrypoint)(proxy.entrypoint);
164
+ const toServiceError = (error2) => ({
165
+ code: error2.code.toUpperCase(),
166
+ message: error2.message,
167
+ serviceName: name
168
+ });
169
+ const configError = (0, import_detect_builders.validateProxyConfig)(proxy, validationOptions);
170
+ if (configError) {
171
+ return toServiceError(configError);
172
+ }
173
+ const { file } = (0, import_detect_builders.parseProxyEntrypoint)(proxy.entrypoint);
166
174
  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)(
175
+ const error = (0, import_detect_builders.validateProxy)({ proxy }, files, framework, validationOptions) ?? (0, import_detect_builders.validateResolvedProxy)(
168
176
  { source: "vercel-config", entrypoint: proxy.entrypoint, file },
169
177
  framework,
170
178
  validationOptions
171
179
  );
172
- return error ? {
173
- code: error.code.toUpperCase(),
174
- message: error.message,
175
- serviceName: name
176
- } : null;
180
+ return error ? toServiceError(error) : null;
177
181
  }
178
182
  function validateServiceConfigV2(name, config) {
179
183
  if (!isValidServiceName(name)) {
@@ -460,8 +464,23 @@ async function resolveConfiguredServiceV2(name, config, fs) {
460
464
  if (builderUse === "@vercel/backends") {
461
465
  builderConfig.serviceName = name;
462
466
  }
467
+ const proxyError = await validateServiceProxy(
468
+ name,
469
+ config,
470
+ serviceFs,
471
+ framework
472
+ );
473
+ if (proxyError) {
474
+ return { error: proxyError };
475
+ }
476
+ const proxyFileExclusions = config.proxy ? [(0, import_detect_builders.escapeMinimatchPath)((0, import_detect_builders.parseProxyEntrypoint)(config.proxy.entrypoint).file)] : [];
463
477
  if (builderUse === "@vercel/static") {
464
- builderConfig.excludeFiles = [...import_detect_builders.VERCEL_PLATFORM_FILES];
478
+ builderConfig.excludeFiles = [
479
+ ...import_detect_builders.VERCEL_PLATFORM_FILES,
480
+ ...proxyFileExclusions
481
+ ];
482
+ } else if (builderUse === "@vercel/static-build" && proxyFileExclusions.length > 0) {
483
+ builderConfig.excludeFiles = proxyFileExclusions;
465
484
  }
466
485
  if (framework) {
467
486
  builderConfig.framework = framework;
@@ -483,15 +502,6 @@ async function resolveConfiguredServiceV2(name, config, fs) {
483
502
  builderConfig.handlerFunction = moduleAttr.attrName;
484
503
  }
485
504
  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
- }
495
505
  return {
496
506
  service: {
497
507
  schema: "experimentalServicesV2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "7.14.0-snapshot-224301946cd2",
3
+ "version": "7.14.0",
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.7.0-snapshot-224301946cd2",
24
- "@vercel/frameworks": "3.35.1",
25
- "@vercel/python-analysis": "0.16.0-snapshot-224301946cd2",
23
+ "@vercel/build-utils": "15.7.0",
26
24
  "@vercel/error-utils": "2.2.1",
27
- "@vercel/routing-utils": "6.6.1"
25
+ "@vercel/routing-utils": "6.6.1",
26
+ "@vercel/python-analysis": "0.16.0",
27
+ "@vercel/frameworks": "3.35.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/glob": "7.2.0",