@vercel/fs-detectors 7.9.5 → 7.9.7
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 +2 -1
- package/dist/index.js +3 -0
- package/dist/services/detect-daemons.d.ts +19 -0
- package/dist/services/detect-daemons.js +44 -0
- package/dist/services/runtimes/entrypoint.d.ts +1 -4
- package/dist/services/runtimes/entrypoint.js +1 -7
- package/dist/services/types.d.ts +6 -0
- package/dist/services/utils.d.ts +2 -0
- package/package.json +3 -3
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,10 +8,7 @@ export declare function parsePyModuleAttrEntrypoint(entrypoint: string): {
|
|
|
8
8
|
attrName: string;
|
|
9
9
|
filePath: string;
|
|
10
10
|
} | null;
|
|
11
|
-
/**
|
|
12
|
-
* Returns true if the path names a blessed Dockerfile or Containerfile.
|
|
13
|
-
* Suffixed names like `Dockerfile.prod` are intentionally not matched.
|
|
14
|
-
*/
|
|
11
|
+
/** Recognize explicit Dockerfile/Containerfile paths, with the name anywhere in the basename. */
|
|
15
12
|
export declare function isDockerfileEntrypoint(entrypoint: string): boolean;
|
|
16
13
|
/**
|
|
17
14
|
* Strip trailing slashes from a posixPath.normalize'd path.
|
|
@@ -24,7 +24,6 @@ __export(entrypoint_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(entrypoint_exports);
|
|
26
26
|
var import_path = require("path");
|
|
27
|
-
var import_constants = require("./constants");
|
|
28
27
|
const PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
29
28
|
function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
30
29
|
const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
|
|
@@ -38,13 +37,8 @@ function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
|
38
37
|
filePath: modulePart.replace(/\./g, "/") + ".py"
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
const CONTAINER_ENTRYPOINT_BASENAMES = new Set(
|
|
42
|
-
import_constants.CONTAINER_ENTRYPOINT_CANDIDATES.map((name) => name.toLowerCase())
|
|
43
|
-
);
|
|
44
40
|
function isDockerfileEntrypoint(entrypoint) {
|
|
45
|
-
return
|
|
46
|
-
import_path.posix.basename(entrypoint).toLowerCase()
|
|
47
|
-
);
|
|
41
|
+
return /(docker|container)file/i.test(import_path.posix.basename(entrypoint));
|
|
48
42
|
}
|
|
49
43
|
function stripTrailingSlash(p) {
|
|
50
44
|
const stripped = p.replace(/\/+$/, "");
|
package/dist/services/types.d.ts
CHANGED
|
@@ -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;
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "7.9.7",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"smol-toml": "1.5.2",
|
|
23
|
-
"@vercel/build-utils": "14.
|
|
23
|
+
"@vercel/build-utils": "14.21.0",
|
|
24
24
|
"@vercel/error-utils": "2.2.1",
|
|
25
25
|
"@vercel/frameworks": "3.35.0",
|
|
26
26
|
"@vercel/python-analysis": "0.14.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.
|
|
36
|
+
"@vercel-internals/runtimes": "1.1.15"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "node build.mjs",
|