@vercel/fs-detectors 6.7.5 → 6.7.6
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/detect-builders.d.ts +1 -2
- package/dist/detect-builders.js +3 -3
- package/dist/services/auto-detect.js +2 -2
- package/dist/services/detect-services.js +7 -15
- package/dist/services/get-services-builders.d.ts +1 -1
- package/dist/services/get-services-builders.js +2 -2
- package/dist/services/resolve.d.ts +2 -2
- package/dist/services/types.d.ts +5 -5
- package/dist/services/utils.d.ts +1 -6
- package/dist/services/utils.js +2 -26
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Route } from '@vercel/routing-utils';
|
|
2
|
-
import type { PackageJson, Builder, BuilderFunctions,
|
|
2
|
+
import type { PackageJson, Builder, BuilderFunctions, ExperimentalServices, ProjectSettings, Service } from '@vercel/build-utils';
|
|
3
3
|
/**
|
|
4
4
|
* Pattern for finding all supported middleware files.
|
|
5
5
|
*/
|
|
@@ -22,7 +22,6 @@ export interface ErrorResponse {
|
|
|
22
22
|
export interface Options {
|
|
23
23
|
tag?: string;
|
|
24
24
|
functions?: BuilderFunctions;
|
|
25
|
-
services?: Services;
|
|
26
25
|
experimentalServices?: ExperimentalServices;
|
|
27
26
|
ignoreBuildScript?: boolean;
|
|
28
27
|
projectSettings?: ProjectSettings;
|
package/dist/detect-builders.js
CHANGED
|
@@ -92,10 +92,10 @@ function detectOutputDirectory(builders) {
|
|
|
92
92
|
return publicBuilder ? publicBuilder.src.replace("/**/*", "") : null;
|
|
93
93
|
}
|
|
94
94
|
async function detectBuilders(files, pkg, options = {}) {
|
|
95
|
-
const {
|
|
95
|
+
const { experimentalServices, projectSettings = {} } = options;
|
|
96
96
|
const { framework } = projectSettings;
|
|
97
|
-
const configuredServices =
|
|
98
|
-
const configuredServicesType =
|
|
97
|
+
const configuredServices = experimentalServices;
|
|
98
|
+
const configuredServicesType = "experimentalServices";
|
|
99
99
|
const hasServicesConfig = configuredServices != null && typeof configuredServices === "object";
|
|
100
100
|
if (hasServicesConfig || framework === "services") {
|
|
101
101
|
return (0, import_get_services_builders.getServicesBuilders)({
|
|
@@ -88,8 +88,8 @@ async function autoDetectServices(options) {
|
|
|
88
88
|
warnings: [],
|
|
89
89
|
errors: [
|
|
90
90
|
{
|
|
91
|
-
code: "
|
|
92
|
-
message: "No services detected. Configure
|
|
91
|
+
code: "NO_EXPERIMENTAL_SERVICES_CONFIGURED",
|
|
92
|
+
message: "No services detected. Configure `experimentalServices` in vercel.json or ensure a framework exists at project root, frontend/, or apps/web/."
|
|
93
93
|
}
|
|
94
94
|
]
|
|
95
95
|
};
|
|
@@ -90,8 +90,7 @@ async function detectServices(options) {
|
|
|
90
90
|
fs,
|
|
91
91
|
workPath,
|
|
92
92
|
detectEntrypoint,
|
|
93
|
-
configuredServices: providedConfiguredServices
|
|
94
|
-
configuredServicesType
|
|
93
|
+
configuredServices: providedConfiguredServices
|
|
95
94
|
} = options;
|
|
96
95
|
const scopedFs = workPath ? fs.chdir(workPath) : fs;
|
|
97
96
|
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
@@ -106,8 +105,7 @@ async function detectServices(options) {
|
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
107
|
const hasProvidedConfiguredServices = providedConfiguredServices && Object.keys(providedConfiguredServices).length > 0;
|
|
109
|
-
const
|
|
110
|
-
const configuredServices = hasProvidedConfiguredServices ? providedConfiguredServices : hasNonEmptyPublicServicesConfig ? vercelConfig?.services : vercelConfig?.experimentalServices;
|
|
108
|
+
const configuredServices = hasProvidedConfiguredServices ? providedConfiguredServices : vercelConfig?.experimentalServices;
|
|
111
109
|
const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
|
|
112
110
|
if (!hasConfiguredServices) {
|
|
113
111
|
const detectors = [
|
|
@@ -129,8 +127,8 @@ async function detectServices(options) {
|
|
|
129
127
|
routes: emptyRoutes(),
|
|
130
128
|
errors: [
|
|
131
129
|
{
|
|
132
|
-
code: "
|
|
133
|
-
message: "No services configured. Add `
|
|
130
|
+
code: "NO_EXPERIMENTAL_SERVICES_CONFIGURED",
|
|
131
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
134
132
|
}
|
|
135
133
|
],
|
|
136
134
|
warnings: []
|
|
@@ -139,20 +137,14 @@ async function detectServices(options) {
|
|
|
139
137
|
const result = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
140
138
|
configuredServices,
|
|
141
139
|
scopedFs,
|
|
142
|
-
"configured"
|
|
143
|
-
{
|
|
144
|
-
requireFileEntrypointForBackendRuntimes: Boolean(
|
|
145
|
-
hasNonEmptyPublicServicesConfig
|
|
146
|
-
)
|
|
147
|
-
}
|
|
140
|
+
"configured"
|
|
148
141
|
);
|
|
149
142
|
const routes = generateServicesRoutes(result.services);
|
|
150
143
|
return withResolvedResult({
|
|
151
144
|
services: result.services,
|
|
152
145
|
source: "configured",
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
useImplicitEnvInjection: !hasNonEmptyPublicServicesConfig,
|
|
146
|
+
// experimentalServices uses the legacy `{NAME}_URL` injection.
|
|
147
|
+
useImplicitEnvInjection: true,
|
|
156
148
|
routes,
|
|
157
149
|
errors: result.errors,
|
|
158
150
|
warnings: []
|
|
@@ -10,7 +10,7 @@ export interface ErrorResponse {
|
|
|
10
10
|
export interface GetServicesBuildersOptions {
|
|
11
11
|
workPath?: string;
|
|
12
12
|
configuredServices?: ConfiguredServices;
|
|
13
|
-
configuredServicesType?: '
|
|
13
|
+
configuredServicesType?: 'experimentalServices';
|
|
14
14
|
projectFramework?: string | null;
|
|
15
15
|
}
|
|
16
16
|
export interface ServicesBuildersResult {
|
|
@@ -102,8 +102,8 @@ async function getServicesBuilders(options) {
|
|
|
102
102
|
builders: null,
|
|
103
103
|
errors: [
|
|
104
104
|
{
|
|
105
|
-
code: "
|
|
106
|
-
message: "No services configured. Add `
|
|
105
|
+
code: "NO_EXPERIMENTAL_SERVICES_CONFIGURED",
|
|
106
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
107
107
|
}
|
|
108
108
|
],
|
|
109
109
|
warnings: warningResponses,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Service, ConfiguredServices, ExperimentalServiceConfig,
|
|
1
|
+
import type { Service, ConfiguredServices, ExperimentalServiceConfig, ServiceDetectionError } from './types';
|
|
2
2
|
import type { DetectorFilesystem } from '../detectors/filesystem';
|
|
3
|
-
type ConfiguredServiceConfig =
|
|
3
|
+
type ConfiguredServiceConfig = ExperimentalServiceConfig;
|
|
4
4
|
interface ResolvedEntrypointPath {
|
|
5
5
|
normalized: string;
|
|
6
6
|
isDirectory: boolean;
|
package/dist/services/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Route } from '@vercel/routing-utils';
|
|
2
|
-
import type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, ExperimentalServiceGroups, ExperimentalServices,
|
|
2
|
+
import type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, ExperimentalServiceGroups, ExperimentalServices, ServiceRuntime, ServiceType, ServiceRefEnvVar, Service, Builder } from '@vercel/build-utils';
|
|
3
3
|
import type { DetectorFilesystem } from '../detectors/filesystem';
|
|
4
|
-
export type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, ExperimentalServiceGroups, ExperimentalServices,
|
|
4
|
+
export type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, ExperimentalServiceGroups, ExperimentalServices, ServiceRuntime, ServiceType, ServiceRefEnvVar, Service, Builder, };
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use `Service` instead
|
|
7
7
|
*/
|
|
@@ -9,7 +9,7 @@ export type ResolvedService = Service;
|
|
|
9
9
|
export interface DetectServicesOptions {
|
|
10
10
|
fs: DetectorFilesystem;
|
|
11
11
|
configuredServices?: ConfiguredServices;
|
|
12
|
-
configuredServicesType?: '
|
|
12
|
+
configuredServicesType?: 'experimentalServices';
|
|
13
13
|
/**
|
|
14
14
|
* Working directory path (relative to fs root).
|
|
15
15
|
* If provided, vercel.json is read from this path.
|
|
@@ -42,7 +42,7 @@ export interface ServicesRoutes {
|
|
|
42
42
|
*/
|
|
43
43
|
workers: Route[];
|
|
44
44
|
}
|
|
45
|
-
export type ConfiguredServices =
|
|
45
|
+
export type ConfiguredServices = ExperimentalServices;
|
|
46
46
|
export type InferredServicesConfig = ExperimentalServices;
|
|
47
47
|
export interface ResolvedServicesResult {
|
|
48
48
|
services: Service[];
|
|
@@ -61,7 +61,7 @@ export interface InferredServicesResult {
|
|
|
61
61
|
export interface DetectServicesResult extends ResolvedServicesResult {
|
|
62
62
|
/**
|
|
63
63
|
* Source of service definitions:
|
|
64
|
-
* - `configured`: loaded from explicit project configuration (`vercel.json#
|
|
64
|
+
* - `configured`: loaded from explicit project configuration (`vercel.json#experimentalServices`)
|
|
65
65
|
* - `auto-detected`: inferred from project structure
|
|
66
66
|
*/
|
|
67
67
|
resolved: ResolvedServicesResult;
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceCronPath } from '@vercel/build-utils';
|
|
2
2
|
import type { Framework } from '@vercel/frameworks';
|
|
3
3
|
import type { DetectorFilesystem } from '../detectors/filesystem';
|
|
4
|
-
import type { ServiceRuntime, ExperimentalServices,
|
|
4
|
+
import type { ServiceRuntime, ExperimentalServices, ServiceDetectionError, ServiceDetectionWarning, ResolvedService } from './types';
|
|
5
5
|
export declare const DETECTION_FRAMEWORKS: Framework[];
|
|
6
6
|
export { INTERNAL_SERVICE_PREFIX, getInternalServiceFunctionPath, getInternalServiceCronPathPrefix, getInternalServiceCronPath, };
|
|
7
7
|
export declare function hasFile(fs: DetectorFilesystem, filePath: string): Promise<boolean>;
|
|
8
|
-
export declare function isPublicServicesEnabled(): boolean;
|
|
9
|
-
export declare function validateServicesConfigGate(config: {
|
|
10
|
-
services?: Services;
|
|
11
|
-
} | null | undefined): ServiceDetectionError | null;
|
|
12
8
|
/**
|
|
13
9
|
* Reserved internal namespace used by the dev queue proxy.
|
|
14
10
|
*/
|
|
@@ -59,7 +55,6 @@ export declare function inferServiceRuntime(config: {
|
|
|
59
55
|
}): ServiceRuntime | undefined;
|
|
60
56
|
export interface ReadVercelConfigResult {
|
|
61
57
|
config: {
|
|
62
|
-
services?: Services;
|
|
63
58
|
experimentalServices?: ExperimentalServices;
|
|
64
59
|
} | null;
|
|
65
60
|
error: ServiceDetectionError | null;
|
package/dist/services/utils.js
CHANGED
|
@@ -44,11 +44,9 @@ __export(utils_exports, {
|
|
|
44
44
|
inferRuntimeFromFramework: () => inferRuntimeFromFramework,
|
|
45
45
|
inferServiceRuntime: () => inferServiceRuntime,
|
|
46
46
|
isFrontendFramework: () => isFrontendFramework,
|
|
47
|
-
isPublicServicesEnabled: () => isPublicServicesEnabled,
|
|
48
47
|
isRouteOwningBuilder: () => isRouteOwningBuilder,
|
|
49
48
|
isStaticBuild: () => isStaticBuild,
|
|
50
|
-
readVercelConfig: () => readVercelConfig
|
|
51
|
-
validateServicesConfigGate: () => validateServicesConfigGate
|
|
49
|
+
readVercelConfig: () => readVercelConfig
|
|
52
50
|
});
|
|
53
51
|
module.exports = __toCommonJS(utils_exports);
|
|
54
52
|
var import_framework_helpers = require("@vercel/build-utils/dist/framework-helpers");
|
|
@@ -65,18 +63,6 @@ async function hasFile(fs, filePath) {
|
|
|
65
63
|
return false;
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
|
-
function isPublicServicesEnabled() {
|
|
69
|
-
return process.env.VERCEL_USE_SERVICES === "1" || process.env.VERCEL_USE_SERVICES?.toLowerCase() === "true";
|
|
70
|
-
}
|
|
71
|
-
function validateServicesConfigGate(config) {
|
|
72
|
-
if (config?.services !== void 0 && !isPublicServicesEnabled()) {
|
|
73
|
-
return {
|
|
74
|
-
code: "INVALID_VERCEL_CONFIG",
|
|
75
|
-
message: "Invalid vercel.json - should NOT have additional property `services`. Please remove it."
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
66
|
const INTERNAL_QUEUES_PREFIX = "/_svc/_queues";
|
|
81
67
|
function normalizeInternalServiceEntrypoint(entrypoint) {
|
|
82
68
|
const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
|
|
@@ -161,10 +147,6 @@ async function readVercelConfig(fs) {
|
|
|
161
147
|
try {
|
|
162
148
|
const content = await fs.readFile("vercel.json");
|
|
163
149
|
const config = JSON.parse(content.toString());
|
|
164
|
-
const gateError = validateServicesConfigGate(config);
|
|
165
|
-
if (gateError) {
|
|
166
|
-
return { config: null, error: gateError };
|
|
167
|
-
}
|
|
168
150
|
return { config, error: null };
|
|
169
151
|
} catch {
|
|
170
152
|
return {
|
|
@@ -182,10 +164,6 @@ async function readVercelConfig(fs) {
|
|
|
182
164
|
const { parse: tomlParse } = await import("smol-toml");
|
|
183
165
|
const content = await fs.readFile("vercel.toml");
|
|
184
166
|
const config = tomlParse(content.toString());
|
|
185
|
-
const gateError = validateServicesConfigGate(config);
|
|
186
|
-
if (gateError) {
|
|
187
|
-
return { config: null, error: gateError };
|
|
188
|
-
}
|
|
189
167
|
return { config, error: null };
|
|
190
168
|
} catch {
|
|
191
169
|
return {
|
|
@@ -252,9 +230,7 @@ function combineBuildCommand(buildCommand, preDeployCommand) {
|
|
|
252
230
|
inferRuntimeFromFramework,
|
|
253
231
|
inferServiceRuntime,
|
|
254
232
|
isFrontendFramework,
|
|
255
|
-
isPublicServicesEnabled,
|
|
256
233
|
isRouteOwningBuilder,
|
|
257
234
|
isStaticBuild,
|
|
258
|
-
readVercelConfig
|
|
259
|
-
validateServicesConfigGate
|
|
235
|
+
readVercelConfig
|
|
260
236
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "6.7.
|
|
3
|
+
"version": "6.7.6",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"smol-toml": "1.5.2",
|
|
23
|
-
"@vercel/build-utils": "13.26.
|
|
24
|
-
"@vercel/frameworks": "3.
|
|
23
|
+
"@vercel/build-utils": "13.26.6",
|
|
24
|
+
"@vercel/frameworks": "3.27.0",
|
|
25
25
|
"@vercel/routing-utils": "6.2.0",
|
|
26
|
-
"@vercel/error-utils": "2.
|
|
26
|
+
"@vercel/error-utils": "2.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/glob": "7.2.0",
|