@vercel/static-build 2.9.1 → 2.9.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/index.js +142 -117
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -21240,7 +21240,6 @@ var require_schemas = __commonJS({
|
|
|
21240
21240
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
21241
21241
|
var schemas_exports = {};
|
|
21242
21242
|
__export2(schemas_exports, {
|
|
21243
|
-
bulkRedirectsSchema: () => bulkRedirectsSchema,
|
|
21244
21243
|
cleanUrlsSchema: () => cleanUrlsSchema,
|
|
21245
21244
|
hasSchema: () => hasSchema,
|
|
21246
21245
|
headersSchema: () => headersSchema,
|
|
@@ -21801,7 +21800,7 @@ var require_schemas = __commonJS({
|
|
|
21801
21800
|
required: ["source", "destination"],
|
|
21802
21801
|
properties: {
|
|
21803
21802
|
source: {
|
|
21804
|
-
description: "A pattern that matches each incoming pathname (excluding querystring).",
|
|
21803
|
+
description: "A pattern that matches each incoming pathname (excluding querystring) or a full URL including domain.",
|
|
21805
21804
|
type: "string",
|
|
21806
21805
|
maxLength: 4096
|
|
21807
21806
|
},
|
|
@@ -21883,44 +21882,6 @@ var require_schemas = __commonJS({
|
|
|
21883
21882
|
description: "When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.",
|
|
21884
21883
|
type: "boolean"
|
|
21885
21884
|
};
|
|
21886
|
-
var bulkRedirectsSchema = {
|
|
21887
|
-
type: "array",
|
|
21888
|
-
description: "A list of bulk redirect definitions.",
|
|
21889
|
-
items: {
|
|
21890
|
-
type: "object",
|
|
21891
|
-
additionalProperties: false,
|
|
21892
|
-
required: ["source", "destination"],
|
|
21893
|
-
properties: {
|
|
21894
|
-
source: {
|
|
21895
|
-
description: "The exact URL path or pattern to match.",
|
|
21896
|
-
type: "string",
|
|
21897
|
-
maxLength: 2048
|
|
21898
|
-
},
|
|
21899
|
-
destination: {
|
|
21900
|
-
description: "The target URL path where traffic should be redirected.",
|
|
21901
|
-
type: "string",
|
|
21902
|
-
maxLength: 2048
|
|
21903
|
-
},
|
|
21904
|
-
permanent: {
|
|
21905
|
-
description: "A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",
|
|
21906
|
-
type: "boolean"
|
|
21907
|
-
},
|
|
21908
|
-
statusCode: {
|
|
21909
|
-
description: "An optional integer to define the status code of the redirect.",
|
|
21910
|
-
type: "integer",
|
|
21911
|
-
enum: [301, 302, 307, 308]
|
|
21912
|
-
},
|
|
21913
|
-
sensitive: {
|
|
21914
|
-
description: "A boolean to toggle between case-sensitive and case-insensitive redirect. When `true`, the redirect is case-sensitive. When `false` the redirect is case-insensitive.",
|
|
21915
|
-
type: "boolean"
|
|
21916
|
-
},
|
|
21917
|
-
query: {
|
|
21918
|
-
description: "Whether the query string should be preserved by the redirect. The default is `false`.",
|
|
21919
|
-
type: "boolean"
|
|
21920
|
-
}
|
|
21921
|
-
}
|
|
21922
|
-
}
|
|
21923
|
-
};
|
|
21924
21885
|
}
|
|
21925
21886
|
});
|
|
21926
21887
|
|
|
@@ -22383,7 +22344,7 @@ var require_types3 = __commonJS({
|
|
|
22383
22344
|
});
|
|
22384
22345
|
module2.exports = __toCommonJS2(types_exports);
|
|
22385
22346
|
var RUNTIME_BUILDERS = {
|
|
22386
|
-
node: "@vercel/
|
|
22347
|
+
node: "@vercel/backends",
|
|
22387
22348
|
python: "@vercel/python",
|
|
22388
22349
|
go: "@vercel/go",
|
|
22389
22350
|
rust: "@vercel/rust",
|
|
@@ -22461,6 +22422,7 @@ var require_utils4 = __commonJS({
|
|
|
22461
22422
|
hasFile: () => hasFile,
|
|
22462
22423
|
inferRuntimeFromFramework: () => inferRuntimeFromFramework,
|
|
22463
22424
|
inferServiceRuntime: () => inferServiceRuntime,
|
|
22425
|
+
isFrontendFramework: () => isFrontendFramework,
|
|
22464
22426
|
isRouteOwningBuilder: () => isRouteOwningBuilder2,
|
|
22465
22427
|
isStaticBuild: () => isStaticBuild2,
|
|
22466
22428
|
readVercelConfig: () => readVercelConfig
|
|
@@ -22526,6 +22488,12 @@ var require_utils4 = __commonJS({
|
|
|
22526
22488
|
}
|
|
22527
22489
|
return void 0;
|
|
22528
22490
|
}
|
|
22491
|
+
function isFrontendFramework(framework) {
|
|
22492
|
+
if (!framework) {
|
|
22493
|
+
return false;
|
|
22494
|
+
}
|
|
22495
|
+
return !inferRuntimeFromFramework(framework);
|
|
22496
|
+
}
|
|
22529
22497
|
function filterFrameworksByRuntime(frameworks2, runtime) {
|
|
22530
22498
|
if (!runtime) {
|
|
22531
22499
|
return [...frameworks2];
|
|
@@ -22836,11 +22804,9 @@ var require_detect_framework = __commonJS({
|
|
|
22836
22804
|
var require_resolve = __commonJS({
|
|
22837
22805
|
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
22838
22806
|
"use strict";
|
|
22839
|
-
var __create2 = Object.create;
|
|
22840
22807
|
var __defProp2 = Object.defineProperty;
|
|
22841
22808
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
22842
22809
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
22843
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
22844
22810
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22845
22811
|
var __export2 = (target, all) => {
|
|
22846
22812
|
for (var name in all)
|
|
@@ -22854,14 +22820,6 @@ var require_resolve = __commonJS({
|
|
|
22854
22820
|
}
|
|
22855
22821
|
return to;
|
|
22856
22822
|
};
|
|
22857
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
22858
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22859
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22860
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22861
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22862
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
22863
|
-
mod
|
|
22864
|
-
));
|
|
22865
22823
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22866
22824
|
var resolve_exports = {};
|
|
22867
22825
|
__export2(resolve_exports, {
|
|
@@ -22872,12 +22830,14 @@ var require_resolve = __commonJS({
|
|
|
22872
22830
|
});
|
|
22873
22831
|
module2.exports = __toCommonJS2(resolve_exports);
|
|
22874
22832
|
var import_path7 = require("path");
|
|
22833
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
|
22875
22834
|
var import_types = require_types3();
|
|
22876
22835
|
var import_utils = require_utils4();
|
|
22877
|
-
var import_frameworks2 =
|
|
22836
|
+
var import_frameworks2 = require_frameworks();
|
|
22878
22837
|
var import_detect_framework = require_detect_framework();
|
|
22879
22838
|
var import_routing_utils = require_dist6();
|
|
22880
|
-
var
|
|
22839
|
+
var import_build_utils22 = require("@vercel/build-utils");
|
|
22840
|
+
var frameworksBySlug = new Map(import_frameworks2.frameworkList.map((f) => [f.slug, f]));
|
|
22881
22841
|
var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
22882
22842
|
function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
22883
22843
|
const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
|
|
@@ -22890,6 +22850,7 @@ var require_resolve = __commonJS({
|
|
|
22890
22850
|
}
|
|
22891
22851
|
var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
22892
22852
|
var DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
|
|
22853
|
+
var ENV_PREFIX_RE = /^[A-Z][A-Z0-9_]*_$/;
|
|
22893
22854
|
function normalizeServiceEntrypoint(entrypoint) {
|
|
22894
22855
|
const normalized = import_path7.posix.normalize(entrypoint);
|
|
22895
22856
|
return normalized === "" ? "." : normalized;
|
|
@@ -22978,7 +22939,7 @@ var require_resolve = __commonJS({
|
|
|
22978
22939
|
runtime
|
|
22979
22940
|
}) {
|
|
22980
22941
|
const serviceFs = workspace === "." ? fs5 : fs5.chdir(workspace);
|
|
22981
|
-
const frameworkCandidates = (0, import_utils.filterFrameworksByRuntime)(import_frameworks2.
|
|
22942
|
+
const frameworkCandidates = (0, import_utils.filterFrameworksByRuntime)(import_frameworks2.frameworkList, runtime);
|
|
22982
22943
|
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
22983
22944
|
fs: serviceFs,
|
|
22984
22945
|
frameworkList: frameworkCandidates
|
|
@@ -23064,6 +23025,15 @@ var require_resolve = __commonJS({
|
|
|
23064
23025
|
serviceName: name
|
|
23065
23026
|
};
|
|
23066
23027
|
}
|
|
23028
|
+
if (config.envPrefix !== void 0) {
|
|
23029
|
+
if (!ENV_PREFIX_RE.test(config.envPrefix)) {
|
|
23030
|
+
return {
|
|
23031
|
+
code: "INVALID_ENV_PREFIX",
|
|
23032
|
+
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_").`,
|
|
23033
|
+
serviceName: name
|
|
23034
|
+
};
|
|
23035
|
+
}
|
|
23036
|
+
}
|
|
23067
23037
|
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
23068
23038
|
return {
|
|
23069
23039
|
code: "INVALID_RUNTIME",
|
|
@@ -23110,6 +23080,7 @@ var require_resolve = __commonJS({
|
|
|
23110
23080
|
function validateServiceEntrypoint(name, config, resolvedEntrypoint) {
|
|
23111
23081
|
if (!resolvedEntrypoint.isDirectory && !config.builder && !config.runtime && !config.framework) {
|
|
23112
23082
|
const runtime = (0, import_utils.inferServiceRuntime)({
|
|
23083
|
+
...config,
|
|
23113
23084
|
entrypoint: resolvedEntrypoint.normalized
|
|
23114
23085
|
});
|
|
23115
23086
|
if (!runtime) {
|
|
@@ -23176,19 +23147,32 @@ var require_resolve = __commonJS({
|
|
|
23176
23147
|
}
|
|
23177
23148
|
}
|
|
23178
23149
|
}
|
|
23179
|
-
const
|
|
23150
|
+
const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
|
|
23180
23151
|
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
23181
23152
|
let builderUse;
|
|
23182
23153
|
let builderSrc;
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
builderUse = framework?.useRuntime?.use || "@vercel/static-build";
|
|
23186
|
-
builderSrc = resolvedEntrypointFile || framework?.useRuntime?.src || "package.json";
|
|
23187
|
-
} else if (config.builder) {
|
|
23154
|
+
const frameworkDefinition = config.framework ? frameworksBySlug.get(config.framework) : void 0;
|
|
23155
|
+
if (config.builder) {
|
|
23188
23156
|
builderUse = config.builder;
|
|
23189
|
-
builderSrc = resolvedEntrypointFile;
|
|
23157
|
+
builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
|
|
23158
|
+
} else if (config.framework) {
|
|
23159
|
+
if (type === "web" && (0, import_build_utils22.isNodeBackendFramework)(config.framework)) {
|
|
23160
|
+
builderUse = "@vercel/backends";
|
|
23161
|
+
} else {
|
|
23162
|
+
builderUse = frameworkDefinition?.useRuntime?.use || "@vercel/static-build";
|
|
23163
|
+
}
|
|
23164
|
+
builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
|
|
23190
23165
|
} else {
|
|
23191
|
-
|
|
23166
|
+
if (!inferredRuntime) {
|
|
23167
|
+
throw new Error(
|
|
23168
|
+
`Could not infer runtime for service "${name}" and no builder or framework were provided.`
|
|
23169
|
+
);
|
|
23170
|
+
}
|
|
23171
|
+
if (inferredRuntime === "node") {
|
|
23172
|
+
builderUse = type === "web" ? "@vercel/backends" : "@vercel/node";
|
|
23173
|
+
} else {
|
|
23174
|
+
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
23175
|
+
}
|
|
23192
23176
|
builderSrc = resolvedEntrypointFile;
|
|
23193
23177
|
}
|
|
23194
23178
|
const normalizedSubdomain = type === "web" && typeof config.subdomain === "string" ? config.subdomain.toLowerCase() : void 0;
|
|
@@ -23200,6 +23184,9 @@ var require_resolve = __commonJS({
|
|
|
23200
23184
|
builderSrc = import_path7.posix.join(workspace, builderSrc);
|
|
23201
23185
|
}
|
|
23202
23186
|
const builderConfig = { zeroConfig: true };
|
|
23187
|
+
if (builderUse === "@vercel/backends") {
|
|
23188
|
+
builderConfig.serviceName = name;
|
|
23189
|
+
}
|
|
23203
23190
|
if (config.memory)
|
|
23204
23191
|
builderConfig.memory = config.memory;
|
|
23205
23192
|
if (config.maxDuration)
|
|
@@ -23243,8 +23230,9 @@ var require_resolve = __commonJS({
|
|
|
23243
23230
|
installCommand: config.installCommand,
|
|
23244
23231
|
schedule: config.schedule,
|
|
23245
23232
|
handlerFunction: moduleAttrParsed?.attrName,
|
|
23246
|
-
|
|
23247
|
-
consumer
|
|
23233
|
+
topics,
|
|
23234
|
+
consumer,
|
|
23235
|
+
envPrefix: config.envPrefix
|
|
23248
23236
|
};
|
|
23249
23237
|
}
|
|
23250
23238
|
async function resolveAllConfiguredServices(services, fs5, routePrefixSource = "configured") {
|
|
@@ -23288,10 +23276,14 @@ var require_resolve = __commonJS({
|
|
|
23288
23276
|
let resolvedConfig = serviceConfig;
|
|
23289
23277
|
if (!serviceConfig.framework && resolvedEntrypoint) {
|
|
23290
23278
|
if (resolvedEntrypoint.isDirectory) {
|
|
23279
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)({
|
|
23280
|
+
...serviceConfig
|
|
23281
|
+
});
|
|
23291
23282
|
const workspace = resolvedEntrypoint.normalized;
|
|
23292
23283
|
const { framework, error } = await detectFrameworkFromWorkspace({
|
|
23293
23284
|
fs: fs5,
|
|
23294
23285
|
workspace,
|
|
23286
|
+
runtime: inferredRuntime,
|
|
23295
23287
|
serviceName: name
|
|
23296
23288
|
});
|
|
23297
23289
|
if (error) {
|
|
@@ -23328,7 +23320,7 @@ var require_resolve = __commonJS({
|
|
|
23328
23320
|
serviceName: name,
|
|
23329
23321
|
runtime: inferredRuntime
|
|
23330
23322
|
});
|
|
23331
|
-
if (detection.framework) {
|
|
23323
|
+
if (!detection.error && detection.framework) {
|
|
23332
23324
|
resolvedConfig = {
|
|
23333
23325
|
...resolvedConfig,
|
|
23334
23326
|
framework: detection.framework
|
|
@@ -23370,11 +23362,9 @@ var require_resolve = __commonJS({
|
|
|
23370
23362
|
var require_auto_detect = __commonJS({
|
|
23371
23363
|
"../fs-detectors/dist/services/auto-detect.js"(exports2, module2) {
|
|
23372
23364
|
"use strict";
|
|
23373
|
-
var __create2 = Object.create;
|
|
23374
23365
|
var __defProp2 = Object.defineProperty;
|
|
23375
23366
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
23376
23367
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
23377
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
23378
23368
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
23379
23369
|
var __export2 = (target, all) => {
|
|
23380
23370
|
for (var name in all)
|
|
@@ -23388,14 +23378,6 @@ var require_auto_detect = __commonJS({
|
|
|
23388
23378
|
}
|
|
23389
23379
|
return to;
|
|
23390
23380
|
};
|
|
23391
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
23392
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23393
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23394
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23395
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23396
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
23397
|
-
mod
|
|
23398
|
-
));
|
|
23399
23381
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
23400
23382
|
var auto_detect_exports = {};
|
|
23401
23383
|
__export2(auto_detect_exports, {
|
|
@@ -23403,20 +23385,20 @@ var require_auto_detect = __commonJS({
|
|
|
23403
23385
|
});
|
|
23404
23386
|
module2.exports = __toCommonJS2(auto_detect_exports);
|
|
23405
23387
|
var import_detect_framework = require_detect_framework();
|
|
23406
|
-
var import_frameworks2 =
|
|
23388
|
+
var import_frameworks2 = require_frameworks();
|
|
23407
23389
|
var FRONTEND_DIR = "frontend";
|
|
23408
23390
|
var APPS_WEB_DIR = "apps/web";
|
|
23409
23391
|
var BACKEND_DIR = "backend";
|
|
23410
23392
|
var SERVICES_DIR = "services";
|
|
23411
23393
|
var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
|
|
23412
|
-
var DETECTION_FRAMEWORKS = import_frameworks2.
|
|
23394
|
+
var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
|
|
23413
23395
|
(framework) => !framework.experimental || framework.runtimeFramework
|
|
23414
23396
|
);
|
|
23415
23397
|
async function autoDetectServices2(options) {
|
|
23416
23398
|
const { fs: fs5 } = options;
|
|
23417
23399
|
const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
23418
23400
|
fs: fs5,
|
|
23419
|
-
frameworkList: import_frameworks2.
|
|
23401
|
+
frameworkList: import_frameworks2.frameworkList
|
|
23420
23402
|
});
|
|
23421
23403
|
if (rootFrameworks.length > 1) {
|
|
23422
23404
|
const frameworkNames = rootFrameworks.map((f) => f.name).join(", ");
|
|
@@ -23441,7 +23423,7 @@ var require_auto_detect = __commonJS({
|
|
|
23441
23423
|
const frontendFs = fs5.chdir(frontendLocation);
|
|
23442
23424
|
const frontendFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
23443
23425
|
fs: frontendFs,
|
|
23444
|
-
frameworkList: import_frameworks2.
|
|
23426
|
+
frameworkList: import_frameworks2.frameworkList
|
|
23445
23427
|
});
|
|
23446
23428
|
if (frontendFrameworks.length > 1) {
|
|
23447
23429
|
const frameworkNames = frontendFrameworks.map((f) => f.name).join(", ");
|
|
@@ -23481,13 +23463,22 @@ var require_auto_detect = __commonJS({
|
|
|
23481
23463
|
};
|
|
23482
23464
|
const backendResult = await detectBackendServices(fs5);
|
|
23483
23465
|
if (backendResult.error) {
|
|
23484
|
-
return {
|
|
23466
|
+
return {
|
|
23467
|
+
services: null,
|
|
23468
|
+
errors: [backendResult.error]
|
|
23469
|
+
};
|
|
23485
23470
|
}
|
|
23486
23471
|
if (Object.keys(backendResult.services).length === 0) {
|
|
23487
|
-
return {
|
|
23472
|
+
return {
|
|
23473
|
+
services: null,
|
|
23474
|
+
errors: []
|
|
23475
|
+
};
|
|
23488
23476
|
}
|
|
23489
23477
|
Object.assign(services, backendResult.services);
|
|
23490
|
-
return {
|
|
23478
|
+
return {
|
|
23479
|
+
services,
|
|
23480
|
+
errors: []
|
|
23481
|
+
};
|
|
23491
23482
|
}
|
|
23492
23483
|
async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation) {
|
|
23493
23484
|
const services = {};
|
|
@@ -23499,7 +23490,10 @@ var require_auto_detect = __commonJS({
|
|
|
23499
23490
|
};
|
|
23500
23491
|
const backendResult = await detectBackendServices(fs5);
|
|
23501
23492
|
if (backendResult.error) {
|
|
23502
|
-
return {
|
|
23493
|
+
return {
|
|
23494
|
+
services: null,
|
|
23495
|
+
errors: [backendResult.error]
|
|
23496
|
+
};
|
|
23503
23497
|
}
|
|
23504
23498
|
if (Object.keys(backendResult.services).length === 0) {
|
|
23505
23499
|
return {
|
|
@@ -23513,7 +23507,10 @@ var require_auto_detect = __commonJS({
|
|
|
23513
23507
|
};
|
|
23514
23508
|
}
|
|
23515
23509
|
Object.assign(services, backendResult.services);
|
|
23516
|
-
return {
|
|
23510
|
+
return {
|
|
23511
|
+
services,
|
|
23512
|
+
errors: []
|
|
23513
|
+
};
|
|
23517
23514
|
}
|
|
23518
23515
|
async function detectBackendServices(fs5) {
|
|
23519
23516
|
const services = {};
|
|
@@ -23638,43 +23635,68 @@ var require_detect_services = __commonJS({
|
|
|
23638
23635
|
{ type: "host", value: { suf: ".vercel.app" } },
|
|
23639
23636
|
{ type: "host", value: { suf: ".vercel.dev" } }
|
|
23640
23637
|
];
|
|
23638
|
+
function emptyRoutes() {
|
|
23639
|
+
return {
|
|
23640
|
+
hostRewrites: [],
|
|
23641
|
+
rewrites: [],
|
|
23642
|
+
defaults: [],
|
|
23643
|
+
crons: [],
|
|
23644
|
+
workers: []
|
|
23645
|
+
};
|
|
23646
|
+
}
|
|
23647
|
+
function withResolvedResult(resolved, inferred = null) {
|
|
23648
|
+
return {
|
|
23649
|
+
services: resolved.services,
|
|
23650
|
+
source: resolved.source,
|
|
23651
|
+
routes: resolved.routes,
|
|
23652
|
+
errors: resolved.errors,
|
|
23653
|
+
warnings: resolved.warnings,
|
|
23654
|
+
resolved,
|
|
23655
|
+
inferred
|
|
23656
|
+
};
|
|
23657
|
+
}
|
|
23658
|
+
function toInferredLayoutConfig(services) {
|
|
23659
|
+
const inferredConfig = {};
|
|
23660
|
+
for (const [name, service] of Object.entries(services)) {
|
|
23661
|
+
const serviceConfig = {};
|
|
23662
|
+
if (typeof service.entrypoint === "string") {
|
|
23663
|
+
serviceConfig.entrypoint = service.entrypoint;
|
|
23664
|
+
}
|
|
23665
|
+
if (typeof service.routePrefix === "string") {
|
|
23666
|
+
serviceConfig.routePrefix = service.routePrefix;
|
|
23667
|
+
}
|
|
23668
|
+
if ((0, import_utils.isFrontendFramework)(service.framework)) {
|
|
23669
|
+
serviceConfig.framework = service.framework;
|
|
23670
|
+
}
|
|
23671
|
+
inferredConfig[name] = serviceConfig;
|
|
23672
|
+
}
|
|
23673
|
+
return inferredConfig;
|
|
23674
|
+
}
|
|
23641
23675
|
async function detectServices2(options) {
|
|
23642
23676
|
const { fs: fs5, workPath } = options;
|
|
23643
23677
|
const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
|
|
23644
23678
|
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
23645
23679
|
if (configError) {
|
|
23646
|
-
return {
|
|
23680
|
+
return withResolvedResult({
|
|
23647
23681
|
services: [],
|
|
23648
23682
|
source: "configured",
|
|
23649
|
-
routes:
|
|
23650
|
-
hostRewrites: [],
|
|
23651
|
-
rewrites: [],
|
|
23652
|
-
defaults: [],
|
|
23653
|
-
crons: [],
|
|
23654
|
-
workers: []
|
|
23655
|
-
},
|
|
23683
|
+
routes: emptyRoutes(),
|
|
23656
23684
|
errors: [configError],
|
|
23657
23685
|
warnings: []
|
|
23658
|
-
};
|
|
23686
|
+
});
|
|
23659
23687
|
}
|
|
23660
23688
|
const configuredServices = vercelConfig?.experimentalServices;
|
|
23661
23689
|
const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
|
|
23662
23690
|
if (!hasConfiguredServices) {
|
|
23663
23691
|
const autoResult = await (0, import_auto_detect.autoDetectServices)({ fs: scopedFs });
|
|
23664
23692
|
if (autoResult.errors.length > 0) {
|
|
23665
|
-
return {
|
|
23693
|
+
return withResolvedResult({
|
|
23666
23694
|
services: [],
|
|
23667
23695
|
source: "auto-detected",
|
|
23668
|
-
routes:
|
|
23669
|
-
hostRewrites: [],
|
|
23670
|
-
rewrites: [],
|
|
23671
|
-
defaults: [],
|
|
23672
|
-
crons: [],
|
|
23673
|
-
workers: []
|
|
23674
|
-
},
|
|
23696
|
+
routes: emptyRoutes(),
|
|
23675
23697
|
errors: autoResult.errors,
|
|
23676
23698
|
warnings: []
|
|
23677
|
-
};
|
|
23699
|
+
});
|
|
23678
23700
|
}
|
|
23679
23701
|
if (autoResult.services) {
|
|
23680
23702
|
const result2 = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
@@ -23683,24 +23705,28 @@ var require_detect_services = __commonJS({
|
|
|
23683
23705
|
"generated"
|
|
23684
23706
|
);
|
|
23685
23707
|
const routes2 = generateServicesRoutes2(result2.services);
|
|
23686
|
-
|
|
23708
|
+
const resolved = {
|
|
23687
23709
|
services: result2.services,
|
|
23688
23710
|
source: "auto-detected",
|
|
23689
23711
|
routes: routes2,
|
|
23690
23712
|
errors: result2.errors,
|
|
23691
23713
|
warnings: []
|
|
23692
23714
|
};
|
|
23715
|
+
const rootWebFrameworkServices = result2.services.filter(
|
|
23716
|
+
(service) => service.type === "web" && service.routePrefix === "/" && typeof service.framework === "string"
|
|
23717
|
+
);
|
|
23718
|
+
const inferred = result2.errors.length === 0 && rootWebFrameworkServices.length === 1 && result2.services.length > 1 ? {
|
|
23719
|
+
source: "layout",
|
|
23720
|
+
config: toInferredLayoutConfig(autoResult.services),
|
|
23721
|
+
services: result2.services,
|
|
23722
|
+
warnings: []
|
|
23723
|
+
} : null;
|
|
23724
|
+
return withResolvedResult(resolved, inferred);
|
|
23693
23725
|
}
|
|
23694
|
-
return {
|
|
23726
|
+
return withResolvedResult({
|
|
23695
23727
|
services: [],
|
|
23696
23728
|
source: "auto-detected",
|
|
23697
|
-
routes:
|
|
23698
|
-
hostRewrites: [],
|
|
23699
|
-
rewrites: [],
|
|
23700
|
-
defaults: [],
|
|
23701
|
-
crons: [],
|
|
23702
|
-
workers: []
|
|
23703
|
-
},
|
|
23729
|
+
routes: emptyRoutes(),
|
|
23704
23730
|
errors: [
|
|
23705
23731
|
{
|
|
23706
23732
|
code: "NO_SERVICES_CONFIGURED",
|
|
@@ -23708,7 +23734,7 @@ var require_detect_services = __commonJS({
|
|
|
23708
23734
|
}
|
|
23709
23735
|
],
|
|
23710
23736
|
warnings: []
|
|
23711
|
-
};
|
|
23737
|
+
});
|
|
23712
23738
|
}
|
|
23713
23739
|
const result = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
23714
23740
|
configuredServices,
|
|
@@ -23716,13 +23742,13 @@ var require_detect_services = __commonJS({
|
|
|
23716
23742
|
"configured"
|
|
23717
23743
|
);
|
|
23718
23744
|
const routes = generateServicesRoutes2(result.services);
|
|
23719
|
-
return {
|
|
23745
|
+
return withResolvedResult({
|
|
23720
23746
|
services: result.services,
|
|
23721
23747
|
source: "configured",
|
|
23722
23748
|
routes,
|
|
23723
23749
|
errors: result.errors,
|
|
23724
23750
|
warnings: []
|
|
23725
|
-
};
|
|
23751
|
+
});
|
|
23726
23752
|
}
|
|
23727
23753
|
function generateServicesRoutes2(services) {
|
|
23728
23754
|
const hostRewrites = [];
|
|
@@ -23796,7 +23822,6 @@ var require_detect_services = __commonJS({
|
|
|
23796
23822
|
check: true
|
|
23797
23823
|
});
|
|
23798
23824
|
}
|
|
23799
|
-
} else {
|
|
23800
23825
|
}
|
|
23801
23826
|
}
|
|
23802
23827
|
const workerServices = services.filter((s) => s.type === "worker");
|
|
@@ -24213,7 +24238,7 @@ var require_detect_builders = __commonJS({
|
|
|
24213
24238
|
var import_minimatch = __toESM2(require_minimatch());
|
|
24214
24239
|
var import_semver2 = require_semver3();
|
|
24215
24240
|
var import_path7 = require("path");
|
|
24216
|
-
var import_frameworks2 =
|
|
24241
|
+
var import_frameworks2 = require_frameworks();
|
|
24217
24242
|
var import_is_official_runtime = require_is_official_runtime();
|
|
24218
24243
|
var import_build_utils5 = require("@vercel/build-utils");
|
|
24219
24244
|
var import_get_services_builders = require_get_services_builders();
|
|
@@ -24221,7 +24246,7 @@ var require_detect_builders = __commonJS({
|
|
|
24221
24246
|
var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
|
|
24222
24247
|
var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
|
|
24223
24248
|
var slugToFramework = new Map(
|
|
24224
|
-
import_frameworks2.
|
|
24249
|
+
import_frameworks2.frameworkList.map((f) => [f.slug, f])
|
|
24225
24250
|
);
|
|
24226
24251
|
function sortFiles(fileA, fileB) {
|
|
24227
24252
|
return fileA.localeCompare(fileB);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ts-morph": "12.0.0",
|
|
17
17
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
18
|
-
"@vercel/
|
|
19
|
-
"@vercel/
|
|
18
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.1.4",
|
|
19
|
+
"@vercel/static-config": "3.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/aws-lambda": "8.10.64",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"rc9": "1.2.0",
|
|
39
39
|
"semver": "7.5.2",
|
|
40
40
|
"tree-kill": "1.2.2",
|
|
41
|
-
"@vercel/build-utils": "13.8.1",
|
|
42
|
-
"@vercel/frameworks": "3.21.1",
|
|
43
|
-
"@vercel/fs-detectors": "5.11.0",
|
|
44
41
|
"@vercel/error-utils": "2.0.3",
|
|
45
|
-
"@vercel/
|
|
42
|
+
"@vercel/build-utils": "13.10.0",
|
|
43
|
+
"@vercel/frameworks": "3.21.1",
|
|
44
|
+
"@vercel/fs-detectors": "5.12.0",
|
|
45
|
+
"@vercel/routing-utils": "6.1.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node ../../utils/build-builder.mjs",
|