@vercel/fs-detectors 7.9.6 → 7.9.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { builderToFrameworks, detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, getProxyBuilder, validateProxyConfig, validateProxy, type Options as DetectBuildersOptions, type ProxyConfig, } from './detect-builders';
2
2
  export { detectServices, generateServiceRewrites, generateServicesRoutes, } from './services/detect-services';
3
+ export { detectDaemons } from './services/detect-daemons';
3
4
  export { resolveAllConfiguredServicesV2, resolveConfiguredServiceV2, validateServiceConfigV2, } from './services/resolve-v2';
4
5
  export { resolveAllConfiguredServices } from './services/resolve';
5
6
  export { hasLegacyServicesConfig, migrateExperimentalServices, planExperimentalServicesMigration, } from './services/migrate';
@@ -8,7 +9,7 @@ export { isExperimentalService, isExperimentalServiceV2, } from '@vercel/build-u
8
9
  export { autoDetectServices } from './services/auto-detect';
9
10
  export type { AutoDetectOptions, AutoDetectResult, } from './services/auto-detect';
10
11
  export { isStaticBuild, isRouteOwningBuilder, INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPath, getInternalServiceCronPathPrefix, getInternalServiceWorkerPath, getInternalServiceWorkerPathPrefix, } from './services/utils';
11
- export type { DetectServicesOptions, DetectServicesResult, DetectServicesSource, InferredServiceConfig, InferredServicesConfig, ResolvedServicesResult, InferredServicesResult, ResolvedService, Service, ExperimentalService, ExperimentalServiceV2, ExperimentalServiceV2Config, ExperimentalServicesV2, ExperimentalServiceV2Binding, ServiceBinding, ServiceConfig, Services, ServicesRoutes, ServiceDetectionError, ConfiguredServices, ConfiguredServicesType, } from './services/types';
12
+ export type { DetectServicesOptions, DetectServicesResult, DetectServicesSource, InferredServiceConfig, InferredServicesConfig, ResolvedServicesResult, InferredServicesResult, ResolvedService, Service, ExperimentalService, ExperimentalServiceV2, ExperimentalServiceV2Config, ExperimentalServicesV2, ExperimentalServiceV2Binding, ServiceBinding, ServiceConfig, Services, ServicesRoutes, ServiceDetectionError, ConfiguredServices, ConfiguredServicesType, DetectedDaemon, } from './services/types';
12
13
  export { detectFileSystemAPI } from './detect-file-system-api';
13
14
  export { detectFramework, detectFrameworks, detectFrameworkRecord, detectFrameworkVersion, } from './detect-framework';
14
15
  export { getProjectPaths } from './get-project-paths';
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ __export(src_exports, {
32
32
  detectApiDirectory: () => import_detect_builders.detectApiDirectory,
33
33
  detectApiExtensions: () => import_detect_builders.detectApiExtensions,
34
34
  detectBuilders: () => import_detect_builders.detectBuilders,
35
+ detectDaemons: () => import_detect_daemons.detectDaemons,
35
36
  detectFileSystemAPI: () => import_detect_file_system_api.detectFileSystemAPI,
36
37
  detectFramework: () => import_detect_framework.detectFramework,
37
38
  detectFrameworkRecord: () => import_detect_framework.detectFrameworkRecord,
@@ -74,6 +75,7 @@ __export(src_exports, {
74
75
  module.exports = __toCommonJS(src_exports);
75
76
  var import_detect_builders = require("./detect-builders");
76
77
  var import_detect_services = require("./services/detect-services");
78
+ var import_detect_daemons = require("./services/detect-daemons");
77
79
  var import_resolve_v2 = require("./services/resolve-v2");
78
80
  var import_resolve = require("./services/resolve");
79
81
  var import_migrate = require("./services/migrate");
@@ -110,6 +112,7 @@ var import_detect_instrumentation = require("./detect-instrumentation");
110
112
  detectApiDirectory,
111
113
  detectApiExtensions,
112
114
  detectBuilders,
115
+ detectDaemons,
113
116
  detectFileSystemAPI,
114
117
  detectFramework,
115
118
  detectFrameworkRecord,
@@ -0,0 +1,19 @@
1
+ import type { DetectorFilesystem } from '../detectors/filesystem';
2
+ import type { DetectedDaemon } from './types';
3
+ /**
4
+ * Read the daemons in `vercel.json#daemons` (or `vercel.toml`) from `fs`.
5
+ *
6
+ * This reads the same files as `detectServices` does when it isn't given
7
+ * `configuredServices`. A caller that passes services from an already loaded
8
+ * config (e.g. a compiled `vercel.ts`) should read that config's `daemons`
9
+ * instead, so services and daemons come from the same config.
10
+ *
11
+ * Safe on unvalidated config: a `daemons` that isn't an object yields no
12
+ * daemons, an `entrypoint` that isn't a string is left out, and an unreadable
13
+ * config yields no daemons (`detectServices` reports the parse error).
14
+ */
15
+ export declare function detectDaemons({ fs, workPath, }: {
16
+ fs: DetectorFilesystem;
17
+ /** Working directory path (relative to fs root) to read the config from. */
18
+ workPath?: string;
19
+ }): Promise<DetectedDaemon[]>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var detect_daemons_exports = {};
20
+ __export(detect_daemons_exports, {
21
+ detectDaemons: () => detectDaemons
22
+ });
23
+ module.exports = __toCommonJS(detect_daemons_exports);
24
+ var import_build_utils = require("@vercel/build-utils");
25
+ var import_utils = require("./utils");
26
+ async function detectDaemons({
27
+ fs,
28
+ workPath
29
+ }) {
30
+ const { config } = await (0, import_utils.readVercelConfig)(workPath ? fs.chdir(workPath) : fs);
31
+ return getDetectedDaemons(config);
32
+ }
33
+ function getDetectedDaemons(config) {
34
+ const daemons = config?.daemons;
35
+ return (0, import_build_utils.getDaemonNames)(config).map((name) => {
36
+ const daemon = daemons?.[name];
37
+ const entrypoint = typeof daemon === "object" && daemon !== null ? daemon.entrypoint : void 0;
38
+ return typeof entrypoint === "string" ? { name, entrypoint } : { name };
39
+ });
40
+ }
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ detectDaemons
44
+ });
@@ -8,7 +8,7 @@ export declare function parsePyModuleAttrEntrypoint(entrypoint: string): {
8
8
  attrName: string;
9
9
  filePath: string;
10
10
  } | null;
11
- /** Recognize explicit Dockerfile/Containerfile paths, including suffixed names. */
11
+ /** Recognize explicit Dockerfile/Containerfile paths, with the name anywhere in the basename. */
12
12
  export declare function isDockerfileEntrypoint(entrypoint: string): boolean;
13
13
  /**
14
14
  * Strip trailing slashes from a posixPath.normalize'd path.
@@ -38,9 +38,7 @@ function parsePyModuleAttrEntrypoint(entrypoint) {
38
38
  };
39
39
  }
40
40
  function isDockerfileEntrypoint(entrypoint) {
41
- return /^(docker|container)file(\..+)?$/i.test(
42
- import_path.posix.basename(entrypoint)
43
- );
41
+ return /(docker|container)file/i.test(import_path.posix.basename(entrypoint));
44
42
  }
45
43
  function stripTrailingSlash(p) {
46
44
  const stripped = p.replace(/\/+$/, "");
@@ -100,6 +100,12 @@ export interface DetectServicesResult extends ResolvedServicesResult {
100
100
  resolved: ResolvedServicesResult;
101
101
  inferred: InferredServicesResult | null;
102
102
  }
103
+ /** A `vercel.json#daemons` entry as written in the config, before validation. */
104
+ export interface DetectedDaemon {
105
+ name: string;
106
+ /** The daemon's `entrypoint` (e.g. `Dockerfile`), if it's a string. */
107
+ entrypoint?: string;
108
+ }
103
109
  export type DetectServicesSource = 'configured' | 'auto-detected';
104
110
  export interface ServiceDetectionWarning {
105
111
  code: string;
@@ -22,6 +22,8 @@ export interface ReadVercelConfigResult {
22
22
  experimentalServices?: ExperimentalServices;
23
23
  services?: Services;
24
24
  experimentalServicesV2?: ExperimentalServicesV2;
25
+ /** Unvalidated; read by `detectDaemons`. */
26
+ daemons?: unknown;
25
27
  } | null;
26
28
  error: ServiceDetectionError | null;
27
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/fs-detectors",
3
- "version": "7.9.6",
3
+ "version": "7.9.8",
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": "14.20.1",
23
+ "@vercel/build-utils": "14.21.1",
24
24
  "@vercel/error-utils": "2.2.1",
25
+ "@vercel/routing-utils": "6.6.0",
25
26
  "@vercel/frameworks": "3.35.0",
26
- "@vercel/python-analysis": "0.14.0",
27
- "@vercel/routing-utils": "6.6.0"
27
+ "@vercel/python-analysis": "0.15.0"
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.1.14"
36
+ "@vercel-internals/runtimes": "1.1.16"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node build.mjs",