@vercel/fs-detectors 5.11.3 → 5.12.0
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.js +17 -5
- package/package.json +3 -3
package/dist/services/resolve.js
CHANGED
|
@@ -25,12 +25,13 @@ __export(resolve_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(resolve_exports);
|
|
27
27
|
var import_path = require("path");
|
|
28
|
+
var import_build_utils = require("@vercel/build-utils");
|
|
28
29
|
var import_types = require("./types");
|
|
29
30
|
var import_utils = require("./utils");
|
|
30
31
|
var import_frameworks = require("@vercel/frameworks");
|
|
31
32
|
var import_detect_framework = require("../detect-framework");
|
|
32
33
|
var import_routing_utils = require("@vercel/routing-utils");
|
|
33
|
-
var
|
|
34
|
+
var import_build_utils2 = require("@vercel/build-utils");
|
|
34
35
|
const frameworksBySlug = new Map(import_frameworks.frameworkList.map((f) => [f.slug, f]));
|
|
35
36
|
const PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
36
37
|
function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
@@ -44,6 +45,7 @@ function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
|
44
45
|
}
|
|
45
46
|
const SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
46
47
|
const DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
|
|
48
|
+
const ENV_PREFIX_RE = /^[A-Z][A-Z0-9_]*_$/;
|
|
47
49
|
function normalizeServiceEntrypoint(entrypoint) {
|
|
48
50
|
const normalized = import_path.posix.normalize(entrypoint);
|
|
49
51
|
return normalized === "" ? "." : normalized;
|
|
@@ -218,6 +220,15 @@ function validateServiceConfig(name, config) {
|
|
|
218
220
|
serviceName: name
|
|
219
221
|
};
|
|
220
222
|
}
|
|
223
|
+
if (config.envPrefix !== void 0) {
|
|
224
|
+
if (!ENV_PREFIX_RE.test(config.envPrefix)) {
|
|
225
|
+
return {
|
|
226
|
+
code: "INVALID_ENV_PREFIX",
|
|
227
|
+
message: `Service "${name}" has invalid envPrefix "${config.envPrefix}". Must start with an uppercase letter, contain only uppercase letters, digits, and underscores, and end with "_" (e.g., "MY_SERVICE_").`,
|
|
228
|
+
serviceName: name
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
221
232
|
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
222
233
|
return {
|
|
223
234
|
code: "INVALID_RUNTIME",
|
|
@@ -331,7 +342,7 @@ async function resolveConfiguredService(options) {
|
|
|
331
342
|
}
|
|
332
343
|
}
|
|
333
344
|
}
|
|
334
|
-
const
|
|
345
|
+
const topics = type === "worker" ? (0, import_build_utils.getWorkerTopics)(config) : config.topics;
|
|
335
346
|
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
336
347
|
let builderUse;
|
|
337
348
|
let builderSrc;
|
|
@@ -340,7 +351,7 @@ async function resolveConfiguredService(options) {
|
|
|
340
351
|
builderUse = config.builder;
|
|
341
352
|
builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
|
|
342
353
|
} else if (config.framework) {
|
|
343
|
-
if (type === "web" && (0,
|
|
354
|
+
if (type === "web" && (0, import_build_utils2.isNodeBackendFramework)(config.framework)) {
|
|
344
355
|
builderUse = "@vercel/backends";
|
|
345
356
|
} else {
|
|
346
357
|
builderUse = frameworkDefinition?.useRuntime?.use || "@vercel/static-build";
|
|
@@ -414,8 +425,9 @@ async function resolveConfiguredService(options) {
|
|
|
414
425
|
installCommand: config.installCommand,
|
|
415
426
|
schedule: config.schedule,
|
|
416
427
|
handlerFunction: moduleAttrParsed?.attrName,
|
|
417
|
-
|
|
418
|
-
consumer
|
|
428
|
+
topics,
|
|
429
|
+
consumer,
|
|
430
|
+
envPrefix: config.envPrefix
|
|
419
431
|
};
|
|
420
432
|
}
|
|
421
433
|
async function resolveAllConfiguredServices(services, fs, routePrefixSource = "configured") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/fs-detectors",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "Vercel filesystem detectors",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"json5": "2.2.2",
|
|
20
20
|
"minimatch": "3.1.2",
|
|
21
21
|
"semver": "6.3.1",
|
|
22
|
+
"@vercel/build-utils": "13.10.0",
|
|
22
23
|
"@vercel/error-utils": "2.0.3",
|
|
23
|
-
"@vercel/routing-utils": "6.
|
|
24
|
-
"@vercel/build-utils": "13.8.2",
|
|
24
|
+
"@vercel/routing-utils": "6.1.1",
|
|
25
25
|
"@vercel/frameworks": "3.21.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|