@vercel/fs-detectors 5.2.6 → 5.2.8

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,12 +1,24 @@
1
1
  import type { Route } from '@vercel/routing-utils';
2
2
  import type { PackageJson, Builder, BuilderFunctions, ProjectSettings } from '@vercel/build-utils';
3
- interface ErrorResponse {
3
+ /**
4
+ * Pattern for finding all supported middleware files.
5
+ */
6
+ export declare const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
7
+ /**
8
+ * Pattern for files that the Vercel platform cares about separately from frameworks.
9
+ */
10
+ export declare const REGEX_VERCEL_PLATFORM_FILES: string;
11
+ /**
12
+ * Pattern for non-Vercel platform files.
13
+ */
14
+ export declare const REGEX_NON_VERCEL_PLATFORM_FILES: string;
15
+ export interface ErrorResponse {
4
16
  code: string;
5
17
  message: string;
6
18
  action?: string;
7
19
  link?: string;
8
20
  }
9
- interface Options {
21
+ export interface Options {
10
22
  tag?: string;
11
23
  functions?: BuilderFunctions;
12
24
  ignoreBuildScript?: boolean;
@@ -28,4 +40,3 @@ export declare function detectBuilders(files: string[], pkg?: PackageJson | unde
28
40
  rewriteRoutes: Route[] | null;
29
41
  errorRoutes: Route[] | null;
30
42
  }>;
31
- export {};
@@ -28,6 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var detect_builders_exports = {};
30
30
  __export(detect_builders_exports, {
31
+ REGEX_MIDDLEWARE_FILES: () => REGEX_MIDDLEWARE_FILES,
32
+ REGEX_NON_VERCEL_PLATFORM_FILES: () => REGEX_NON_VERCEL_PLATFORM_FILES,
33
+ REGEX_VERCEL_PLATFORM_FILES: () => REGEX_VERCEL_PLATFORM_FILES,
31
34
  detectApiDirectory: () => detectApiDirectory,
32
35
  detectApiExtensions: () => detectApiExtensions,
33
36
  detectBuilders: () => detectBuilders,
@@ -40,6 +43,9 @@ var import_semver = require("semver");
40
43
  var import_path = require("path");
41
44
  var import_frameworks = __toESM(require("@vercel/frameworks"));
42
45
  var import_is_official_runtime = require("./is-official-runtime");
46
+ const REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
47
+ const REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
48
+ const REGEX_NON_VERCEL_PLATFORM_FILES = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
43
49
  const slugToFramework = new Map(
44
50
  import_frameworks.default.map((f) => [f.slug, f])
45
51
  );
@@ -196,7 +202,7 @@ async function detectBuilders(files, pkg, options = {}) {
196
202
  } else if (apiBuilders.length && hasNoneApiFiles) {
197
203
  frontendBuilder = {
198
204
  use: "@vercel/static",
199
- src: "!{api/**,package.json,middleware.[jt]s}",
205
+ src: REGEX_NON_VERCEL_PLATFORM_FILES,
200
206
  config: {
201
207
  zeroConfig: true
202
208
  }
@@ -318,7 +324,7 @@ function getApiMatches() {
318
324
  const config = { zeroConfig: true };
319
325
  return [
320
326
  {
321
- src: "middleware.[jt]s",
327
+ src: REGEX_MIDDLEWARE_FILES,
322
328
  use: `@vercel/node`,
323
329
  config: { ...config, middleware: true }
324
330
  },
@@ -765,6 +771,9 @@ function sortFilesBySegmentCount(fileA, fileB) {
765
771
  }
766
772
  // Annotate the CommonJS export names for ESM import in node:
767
773
  0 && (module.exports = {
774
+ REGEX_MIDDLEWARE_FILES,
775
+ REGEX_NON_VERCEL_PLATFORM_FILES,
776
+ REGEX_VERCEL_PLATFORM_FILES,
768
777
  detectApiDirectory,
769
778
  detectApiExtensions,
770
779
  detectBuilders,
package/dist/index.d.ts CHANGED
@@ -11,3 +11,4 @@ export { monorepoManagers } from './monorepos/monorepo-managers';
11
11
  export { isOfficialRuntime, isStaticRuntime } from './is-official-runtime';
12
12
  export { packageManagers } from './package-managers/package-managers';
13
13
  export * from './monorepos/get-monorepo-default-settings';
14
+ export { REGEX_NON_VERCEL_PLATFORM_FILES } from './detect-builders';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __export(src_exports, {
23
23
  GetWorkspaceOptions: () => import_get_workspaces.GetWorkspaceOptions,
24
24
  GetWorkspacePackagePathsOptions: () => import_get_workspace_package_paths.GetWorkspacePackagePathsOptions,
25
25
  LocalFileSystemDetector: () => import_local_file_system_detector.LocalFileSystemDetector,
26
+ REGEX_NON_VERCEL_PLATFORM_FILES: () => import_detect_builders2.REGEX_NON_VERCEL_PLATFORM_FILES,
26
27
  Workspace: () => import_get_workspaces.Workspace,
27
28
  WorkspaceType: () => import_get_workspaces.WorkspaceType,
28
29
  detectApiDirectory: () => import_detect_builders.detectApiDirectory,
@@ -57,12 +58,14 @@ var import_monorepo_managers = require("./monorepos/monorepo-managers");
57
58
  var import_is_official_runtime = require("./is-official-runtime");
58
59
  var import_package_managers = require("./package-managers/package-managers");
59
60
  __reExport(src_exports, require("./monorepos/get-monorepo-default-settings"), module.exports);
61
+ var import_detect_builders2 = require("./detect-builders");
60
62
  // Annotate the CommonJS export names for ESM import in node:
61
63
  0 && (module.exports = {
62
64
  DetectorFilesystem,
63
65
  GetWorkspaceOptions,
64
66
  GetWorkspacePackagePathsOptions,
65
67
  LocalFileSystemDetector,
68
+ REGEX_NON_VERCEL_PLATFORM_FILES,
66
69
  Workspace,
67
70
  WorkspaceType,
68
71
  detectApiDirectory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "5.2.6",
3
+ "version": "5.2.8",
4
4
  "description": "Vercel filesystem detectors",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "license": "Apache-2.0",
16
16
  "dependencies": {
17
17
  "@vercel/error-utils": "2.0.2",
18
- "@vercel/frameworks": "3.1.0",
18
+ "@vercel/frameworks": "3.1.1",
19
19
  "@vercel/routing-utils": "3.1.0",
20
20
  "glob": "8.0.3",
21
21
  "js-yaml": "4.1.0",
@@ -30,7 +30,7 @@
30
30
  "@types/minimatch": "3.0.5",
31
31
  "@types/node": "14.18.33",
32
32
  "@types/semver": "7.3.10",
33
- "@vercel/build-utils": "8.3.5",
33
+ "@vercel/build-utils": "8.3.6",
34
34
  "jest-junit": "16.0.0",
35
35
  "typescript": "4.9.5"
36
36
  },