@vercel/fs-detectors 6.7.8 → 6.8.1
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 -1
- package/dist/detect-builders.js +13 -6
- package/dist/services/detect-services.js +6 -6
- package/dist/services/get-services-builders.d.ts +4 -0
- package/dist/services/get-services-builders.js +21 -2
- package/dist/services/types.d.ts +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Route } from '@vercel/routing-utils';
|
|
2
|
-
import type { PackageJson, Builder, BuilderFunctions, ExperimentalServices, ProjectSettings, Service
|
|
2
|
+
import type { PackageJson, Builder, BuilderFunctions, ExperimentalServices, ExperimentalServicesV2, ProjectSettings, Service } from '@vercel/build-utils';
|
|
3
3
|
/**
|
|
4
4
|
* Pattern for finding all supported middleware files.
|
|
5
5
|
*/
|
package/dist/detect-builders.js
CHANGED
|
@@ -93,21 +93,27 @@ function detectOutputDirectory(builders) {
|
|
|
93
93
|
}
|
|
94
94
|
async function detectBuilders(files, pkg, options = {}) {
|
|
95
95
|
const {
|
|
96
|
-
experimentalServices,
|
|
96
|
+
experimentalServices: experimentalServicesV1,
|
|
97
97
|
experimentalServicesV2,
|
|
98
98
|
projectSettings = {}
|
|
99
99
|
} = options;
|
|
100
100
|
const { framework } = projectSettings;
|
|
101
|
-
const configuredServices =
|
|
102
|
-
const configuredServicesType =
|
|
101
|
+
const configuredServices = experimentalServicesV2 ?? experimentalServicesV1;
|
|
102
|
+
const configuredServicesType = experimentalServicesV2 ? "experimentalServicesV2" : "experimentalServices";
|
|
103
103
|
const hasServicesConfig = configuredServices != null && typeof configuredServices === "object";
|
|
104
104
|
if (hasServicesConfig || framework === "services") {
|
|
105
|
-
|
|
105
|
+
const result = await (0, import_get_services_builders.getServicesBuilders)({
|
|
106
106
|
workPath: options.workPath,
|
|
107
107
|
configuredServices,
|
|
108
108
|
configuredServicesType,
|
|
109
109
|
projectFramework: framework
|
|
110
110
|
});
|
|
111
|
+
if (configuredServices != null) {
|
|
112
|
+
result.warnings.push(
|
|
113
|
+
...(0, import_get_services_builders.warnIgnoredDirectories)(files, configuredServices)
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
111
117
|
}
|
|
112
118
|
const errors = [];
|
|
113
119
|
const warnings = [];
|
|
@@ -490,10 +496,11 @@ function validateFunctions({ functions = {} }) {
|
|
|
490
496
|
message: "Function must contain at least one property."
|
|
491
497
|
};
|
|
492
498
|
}
|
|
493
|
-
|
|
499
|
+
const maxDurationLimit = (0, import_build_utils.getMaxDurationLimit)();
|
|
500
|
+
if (func.maxDuration !== void 0 && func.maxDuration !== "max" && (func.maxDuration < 1 || maxDurationLimit !== void 0 && func.maxDuration > maxDurationLimit || !Number.isInteger(func.maxDuration))) {
|
|
494
501
|
return {
|
|
495
502
|
code: "invalid_function_duration",
|
|
496
|
-
message:
|
|
503
|
+
message: maxDurationLimit !== void 0 ? `Functions must have a maxDuration between 1 and ${maxDurationLimit}, or "max".` : 'Functions must have a positive integer maxDuration, or "max".'
|
|
497
504
|
};
|
|
498
505
|
}
|
|
499
506
|
if (func.memory !== void 0 && (func.memory < 128 || func.memory > 10240)) {
|
|
@@ -92,7 +92,7 @@ async function detectServices(options) {
|
|
|
92
92
|
workPath,
|
|
93
93
|
detectEntrypoint,
|
|
94
94
|
configuredServices: providedConfiguredServices,
|
|
95
|
-
configuredServicesType
|
|
95
|
+
configuredServicesType: providedConfiguredServicesType
|
|
96
96
|
} = options;
|
|
97
97
|
const scopedFs = workPath ? fs.chdir(workPath) : fs;
|
|
98
98
|
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
@@ -107,7 +107,7 @@ async function detectServices(options) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
const hasProvidedConfiguredServices = providedConfiguredServices && Object.keys(providedConfiguredServices).length > 0;
|
|
110
|
-
const experimentalServicesV2 = hasProvidedConfiguredServices &&
|
|
110
|
+
const experimentalServicesV2 = hasProvidedConfiguredServices && providedConfiguredServicesType === "experimentalServicesV2" ? providedConfiguredServices : hasProvidedConfiguredServices ? void 0 : vercelConfig?.experimentalServicesV2;
|
|
111
111
|
if (experimentalServicesV2 && Object.keys(experimentalServicesV2).length > 0) {
|
|
112
112
|
const result2 = await (0, import_resolve_v2.resolveAllConfiguredServicesV2)(
|
|
113
113
|
experimentalServicesV2,
|
|
@@ -124,9 +124,9 @@ async function detectServices(options) {
|
|
|
124
124
|
warnings: []
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
127
|
+
const experimentalServicesV1 = hasProvidedConfiguredServices ? providedConfiguredServices : vercelConfig?.experimentalServices;
|
|
128
|
+
const hasExperimentalServicesV1 = experimentalServicesV1 && Object.keys(experimentalServicesV1).length > 0;
|
|
129
|
+
if (!hasExperimentalServicesV1) {
|
|
130
130
|
const detectors = [
|
|
131
131
|
{ detect: import_detect_railway.detectRailwayServices, source: "railway" },
|
|
132
132
|
{ detect: import_detect_render.detectRenderServices, source: "render" },
|
|
@@ -154,7 +154,7 @@ async function detectServices(options) {
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
const result = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
157
|
-
|
|
157
|
+
experimentalServicesV1,
|
|
158
158
|
scopedFs,
|
|
159
159
|
"configured"
|
|
160
160
|
);
|
|
@@ -33,3 +33,7 @@ export interface ServicesBuildersResult {
|
|
|
33
33
|
* the shape expected by `detectBuilders` when `framework === 'services'`.
|
|
34
34
|
*/
|
|
35
35
|
export declare function getServicesBuilders(options: GetServicesBuildersOptions): Promise<ServicesBuildersResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns warnings for ignored directories that are not covered by services
|
|
38
|
+
*/
|
|
39
|
+
export declare function warnIgnoredDirectories(files: string[], configuredServices: ConfiguredServices): ErrorResponse[];
|
|
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var get_services_builders_exports = {};
|
|
20
20
|
__export(get_services_builders_exports, {
|
|
21
|
-
getServicesBuilders: () => getServicesBuilders
|
|
21
|
+
getServicesBuilders: () => getServicesBuilders,
|
|
22
|
+
warnIgnoredDirectories: () => warnIgnoredDirectories
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(get_services_builders_exports);
|
|
24
25
|
var import_detect_services = require("./detect-services");
|
|
@@ -134,7 +135,25 @@ async function getServicesBuilders(options) {
|
|
|
134
135
|
useImplicitEnvInjection: result.useImplicitEnvInjection
|
|
135
136
|
};
|
|
136
137
|
}
|
|
138
|
+
function warnIgnoredDirectories(files, configuredServices) {
|
|
139
|
+
const warnings = [];
|
|
140
|
+
if (files.some((f) => f.startsWith("api/"))) {
|
|
141
|
+
const serviceCoversApi = Object.values(configuredServices).some((service) => {
|
|
142
|
+
const root = service.root ?? ".";
|
|
143
|
+
const entrypoint = service.entrypoint ?? "";
|
|
144
|
+
return root === "api" || root.startsWith("api/") || root === "." && entrypoint.startsWith("api/");
|
|
145
|
+
});
|
|
146
|
+
if (!serviceCoversApi) {
|
|
147
|
+
warnings.push({
|
|
148
|
+
code: "api_dir_ignored",
|
|
149
|
+
message: "The `api/` directory will not be built because `experimentalServices` is configured. To serve these files, declare them as a service in your `vercel.json`."
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return warnings;
|
|
154
|
+
}
|
|
137
155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
138
156
|
0 && (module.exports = {
|
|
139
|
-
getServicesBuilders
|
|
157
|
+
getServicesBuilders,
|
|
158
|
+
warnIgnoredDirectories
|
|
140
159
|
});
|
package/dist/services/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, ExperimentalServiceV2Config, ExperimentalServiceGroups, ExperimentalServices, ExperimentalServicesV2, ExperimentalServiceV2Binding, ExperimentalService, ExperimentalServiceV2, ServiceRuntime, ServiceType, ServiceRefEnvVar, Service, Builder } from '@vercel/build-utils';
|
|
3
3
|
import type { DetectorFilesystem } from '../detectors/filesystem';
|
|
4
4
|
export type { DetectEntrypointFn, EnvVar, EnvVars, ExperimentalServiceConfig, ExperimentalServiceGroups, ExperimentalServices, ExperimentalServiceV2Config, ExperimentalServicesV2, ExperimentalServiceV2Binding, ExperimentalService, ExperimentalServiceV2, ServiceRuntime, ServiceType, ServiceRefEnvVar, Service, Builder, };
|
|
5
5
|
/**
|
|
@@ -62,7 +62,7 @@ export interface InferredServicesResult {
|
|
|
62
62
|
export interface DetectServicesResult extends ResolvedServicesResult {
|
|
63
63
|
/**
|
|
64
64
|
* Source of service definitions:
|
|
65
|
-
* - `configured`: loaded from explicit project configuration (`vercel.json#experimentalServices`)
|
|
65
|
+
* - `configured`: loaded from explicit project configuration (`vercel.json#experimentalServices` or `vercel.json#experimentalServicesV2`)
|
|
66
66
|
* - `auto-detected`: inferred from project structure
|
|
67
67
|
*/
|
|
68
68
|
resolved: ResolvedServicesResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.1",
|
|
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/
|
|
24
|
-
"@vercel/
|
|
25
|
-
"@vercel/
|
|
26
|
-
"@vercel/
|
|
23
|
+
"@vercel/build-utils": "13.28.0",
|
|
24
|
+
"@vercel/frameworks": "3.28.0",
|
|
25
|
+
"@vercel/routing-utils": "6.2.0",
|
|
26
|
+
"@vercel/error-utils": "2.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/glob": "7.2.0",
|