@vercel/fs-detectors 6.11.2 → 6.11.4
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/services/resolve-v2.js +18 -3
- package/package.json +2 -2
|
@@ -30,7 +30,14 @@ var import_types = require("./types");
|
|
|
30
30
|
var import_resolve = require("./resolve");
|
|
31
31
|
var import_utils = require("./utils");
|
|
32
32
|
const frameworksBySlug = new Map(import_frameworks.frameworkList.map((f) => [f.slug, f]));
|
|
33
|
-
const
|
|
33
|
+
const MAX_SERVICE_NAME_LENGTH = 64;
|
|
34
|
+
const SERVICE_NAME_REGEX = /^[a-z]([a-z_-]*[a-z])?$/;
|
|
35
|
+
function isValidServiceName(name) {
|
|
36
|
+
return name.length <= MAX_SERVICE_NAME_LENGTH && SERVICE_NAME_REGEX.test(name);
|
|
37
|
+
}
|
|
38
|
+
function getInvalidServiceNameMessage(name) {
|
|
39
|
+
return `Service name "${name}" is invalid. Names must be 1-${MAX_SERVICE_NAME_LENGTH} characters, start and end with a lowercase letter, and contain only lowercase letters, hyphens, and underscores.`;
|
|
40
|
+
}
|
|
34
41
|
const CONTAINER_ENTRYPOINT_CANDIDATES = [
|
|
35
42
|
"Dockerfile.vercel",
|
|
36
43
|
"Containerfile.vercel",
|
|
@@ -122,10 +129,10 @@ async function resolveContainerServiceV2(name, config, normalizedRoot, serviceFs
|
|
|
122
129
|
};
|
|
123
130
|
}
|
|
124
131
|
function validateServiceConfigV2(name, config) {
|
|
125
|
-
if (!
|
|
132
|
+
if (!isValidServiceName(name)) {
|
|
126
133
|
return {
|
|
127
134
|
code: "INVALID_SERVICE_NAME",
|
|
128
|
-
message:
|
|
135
|
+
message: getInvalidServiceNameMessage(name),
|
|
129
136
|
serviceName: name
|
|
130
137
|
};
|
|
131
138
|
}
|
|
@@ -361,6 +368,14 @@ async function resolveAllConfiguredServicesV2(services, fs) {
|
|
|
361
368
|
const serviceNames = new Set(Object.keys(services));
|
|
362
369
|
for (const service of resolved) {
|
|
363
370
|
for (const binding of service.bindings ?? []) {
|
|
371
|
+
if (!isValidServiceName(binding.service)) {
|
|
372
|
+
errors.push({
|
|
373
|
+
code: "INVALID_SERVICE_BINDING_NAME",
|
|
374
|
+
message: `Service "${service.name}" declares an invalid binding service name "${binding.service}". ${getInvalidServiceNameMessage(binding.service)}`,
|
|
375
|
+
serviceName: service.name
|
|
376
|
+
});
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
364
379
|
if (!serviceNames.has(binding.service)) {
|
|
365
380
|
errors.push({
|
|
366
381
|
code: "UNKNOWN_SERVICE_BINDING",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.4",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"semver": "6.3.1",
|
|
22
22
|
"smol-toml": "1.5.2",
|
|
23
23
|
"@vercel/build-utils": "13.32.2",
|
|
24
|
+
"@vercel/frameworks": "3.30.3",
|
|
24
25
|
"@vercel/error-utils": "2.2.0",
|
|
25
|
-
"@vercel/frameworks": "3.30.1",
|
|
26
26
|
"@vercel/routing-utils": "6.4.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|