@vercel/static-build 2.9.0 → 2.9.2
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 +145 -81
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10386,7 +10386,6 @@ var require_frameworks = __commonJS({
|
|
|
10386
10386
|
{
|
|
10387
10387
|
name: "Django",
|
|
10388
10388
|
slug: "django",
|
|
10389
|
-
experimental: true,
|
|
10390
10389
|
logo: "https://api-frameworks.vercel.sh/framework-logos/django.svg",
|
|
10391
10390
|
tagline: "Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. ",
|
|
10392
10391
|
description: "A Django project served via the Python Runtime.",
|
|
@@ -12007,7 +12006,6 @@ var require_frameworks = __commonJS({
|
|
|
12007
12006
|
{
|
|
12008
12007
|
name: "Python",
|
|
12009
12008
|
slug: "python",
|
|
12010
|
-
experimental: true,
|
|
12011
12009
|
runtimeFramework: true,
|
|
12012
12010
|
logo: "https://api-frameworks.vercel.sh/framework-logos/python.svg",
|
|
12013
12011
|
tagline: "Python is a programming language that lets you work quickly and integrate systems more effectively.",
|
|
@@ -12202,7 +12200,6 @@ var require_frameworks = __commonJS({
|
|
|
12202
12200
|
{
|
|
12203
12201
|
name: "Go",
|
|
12204
12202
|
slug: "go",
|
|
12205
|
-
experimental: true,
|
|
12206
12203
|
runtimeFramework: true,
|
|
12207
12204
|
logo: "https://api-frameworks.vercel.sh/framework-logos/go.svg",
|
|
12208
12205
|
tagline: "An open-source programming language supported by Google.",
|
|
@@ -22386,7 +22383,7 @@ var require_types3 = __commonJS({
|
|
|
22386
22383
|
});
|
|
22387
22384
|
module2.exports = __toCommonJS2(types_exports);
|
|
22388
22385
|
var RUNTIME_BUILDERS = {
|
|
22389
|
-
node: "@vercel/
|
|
22386
|
+
node: "@vercel/backends",
|
|
22390
22387
|
python: "@vercel/python",
|
|
22391
22388
|
go: "@vercel/go",
|
|
22392
22389
|
rust: "@vercel/rust",
|
|
@@ -22452,6 +22449,7 @@ var require_utils4 = __commonJS({
|
|
|
22452
22449
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22453
22450
|
var utils_exports = {};
|
|
22454
22451
|
__export2(utils_exports, {
|
|
22452
|
+
INTERNAL_QUEUES_PREFIX: () => INTERNAL_QUEUES_PREFIX,
|
|
22455
22453
|
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX2,
|
|
22456
22454
|
filterFrameworksByRuntime: () => filterFrameworksByRuntime,
|
|
22457
22455
|
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
@@ -22463,6 +22461,7 @@ var require_utils4 = __commonJS({
|
|
|
22463
22461
|
hasFile: () => hasFile,
|
|
22464
22462
|
inferRuntimeFromFramework: () => inferRuntimeFromFramework,
|
|
22465
22463
|
inferServiceRuntime: () => inferServiceRuntime,
|
|
22464
|
+
isFrontendFramework: () => isFrontendFramework,
|
|
22466
22465
|
isRouteOwningBuilder: () => isRouteOwningBuilder2,
|
|
22467
22466
|
isStaticBuild: () => isStaticBuild2,
|
|
22468
22467
|
readVercelConfig: () => readVercelConfig
|
|
@@ -22478,6 +22477,7 @@ var require_utils4 = __commonJS({
|
|
|
22478
22477
|
}
|
|
22479
22478
|
}
|
|
22480
22479
|
var INTERNAL_SERVICE_PREFIX2 = "/_svc";
|
|
22480
|
+
var INTERNAL_QUEUES_PREFIX = "/_svc/_queues";
|
|
22481
22481
|
function getInternalServiceFunctionPath2(serviceName) {
|
|
22482
22482
|
return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/index`;
|
|
22483
22483
|
}
|
|
@@ -22527,6 +22527,12 @@ var require_utils4 = __commonJS({
|
|
|
22527
22527
|
}
|
|
22528
22528
|
return void 0;
|
|
22529
22529
|
}
|
|
22530
|
+
function isFrontendFramework(framework) {
|
|
22531
|
+
if (!framework) {
|
|
22532
|
+
return false;
|
|
22533
|
+
}
|
|
22534
|
+
return !inferRuntimeFromFramework(framework);
|
|
22535
|
+
}
|
|
22530
22536
|
function filterFrameworksByRuntime(frameworks2, runtime) {
|
|
22531
22537
|
if (!runtime) {
|
|
22532
22538
|
return [...frameworks2];
|
|
@@ -22837,11 +22843,9 @@ var require_detect_framework = __commonJS({
|
|
|
22837
22843
|
var require_resolve = __commonJS({
|
|
22838
22844
|
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
22839
22845
|
"use strict";
|
|
22840
|
-
var __create2 = Object.create;
|
|
22841
22846
|
var __defProp2 = Object.defineProperty;
|
|
22842
22847
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
22843
22848
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
22844
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
22845
22849
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22846
22850
|
var __export2 = (target, all) => {
|
|
22847
22851
|
for (var name in all)
|
|
@@ -22855,14 +22859,6 @@ var require_resolve = __commonJS({
|
|
|
22855
22859
|
}
|
|
22856
22860
|
return to;
|
|
22857
22861
|
};
|
|
22858
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
22859
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22860
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22861
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22862
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22863
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
22864
|
-
mod
|
|
22865
|
-
));
|
|
22866
22862
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22867
22863
|
var resolve_exports = {};
|
|
22868
22864
|
__export2(resolve_exports, {
|
|
@@ -22875,10 +22871,11 @@ var require_resolve = __commonJS({
|
|
|
22875
22871
|
var import_path7 = require("path");
|
|
22876
22872
|
var import_types = require_types3();
|
|
22877
22873
|
var import_utils = require_utils4();
|
|
22878
|
-
var import_frameworks2 =
|
|
22874
|
+
var import_frameworks2 = require_frameworks();
|
|
22879
22875
|
var import_detect_framework = require_detect_framework();
|
|
22880
22876
|
var import_routing_utils = require_dist6();
|
|
22881
|
-
var
|
|
22877
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
|
22878
|
+
var frameworksBySlug = new Map(import_frameworks2.frameworkList.map((f) => [f.slug, f]));
|
|
22882
22879
|
var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
22883
22880
|
function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
22884
22881
|
const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
|
|
@@ -22979,7 +22976,7 @@ var require_resolve = __commonJS({
|
|
|
22979
22976
|
runtime
|
|
22980
22977
|
}) {
|
|
22981
22978
|
const serviceFs = workspace === "." ? fs5 : fs5.chdir(workspace);
|
|
22982
|
-
const frameworkCandidates = (0, import_utils.filterFrameworksByRuntime)(import_frameworks2.
|
|
22979
|
+
const frameworkCandidates = (0, import_utils.filterFrameworksByRuntime)(import_frameworks2.frameworkList, runtime);
|
|
22983
22980
|
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
22984
22981
|
fs: serviceFs,
|
|
22985
22982
|
frameworkList: frameworkCandidates
|
|
@@ -23111,6 +23108,7 @@ var require_resolve = __commonJS({
|
|
|
23111
23108
|
function validateServiceEntrypoint(name, config, resolvedEntrypoint) {
|
|
23112
23109
|
if (!resolvedEntrypoint.isDirectory && !config.builder && !config.runtime && !config.framework) {
|
|
23113
23110
|
const runtime = (0, import_utils.inferServiceRuntime)({
|
|
23111
|
+
...config,
|
|
23114
23112
|
entrypoint: resolvedEntrypoint.normalized
|
|
23115
23113
|
});
|
|
23116
23114
|
if (!runtime) {
|
|
@@ -23181,15 +23179,28 @@ var require_resolve = __commonJS({
|
|
|
23181
23179
|
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
23182
23180
|
let builderUse;
|
|
23183
23181
|
let builderSrc;
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
builderUse = framework?.useRuntime?.use || "@vercel/static-build";
|
|
23187
|
-
builderSrc = resolvedEntrypointFile || framework?.useRuntime?.src || "package.json";
|
|
23188
|
-
} else if (config.builder) {
|
|
23182
|
+
const frameworkDefinition = config.framework ? frameworksBySlug.get(config.framework) : void 0;
|
|
23183
|
+
if (config.builder) {
|
|
23189
23184
|
builderUse = config.builder;
|
|
23190
|
-
builderSrc = resolvedEntrypointFile;
|
|
23185
|
+
builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
|
|
23186
|
+
} else if (config.framework) {
|
|
23187
|
+
if (type === "web" && (0, import_build_utils5.isNodeBackendFramework)(config.framework)) {
|
|
23188
|
+
builderUse = "@vercel/backends";
|
|
23189
|
+
} else {
|
|
23190
|
+
builderUse = frameworkDefinition?.useRuntime?.use || "@vercel/static-build";
|
|
23191
|
+
}
|
|
23192
|
+
builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
|
|
23191
23193
|
} else {
|
|
23192
|
-
|
|
23194
|
+
if (!inferredRuntime) {
|
|
23195
|
+
throw new Error(
|
|
23196
|
+
`Could not infer runtime for service "${name}" and no builder or framework were provided.`
|
|
23197
|
+
);
|
|
23198
|
+
}
|
|
23199
|
+
if (inferredRuntime === "node") {
|
|
23200
|
+
builderUse = type === "web" ? "@vercel/backends" : "@vercel/node";
|
|
23201
|
+
} else {
|
|
23202
|
+
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
23203
|
+
}
|
|
23193
23204
|
builderSrc = resolvedEntrypointFile;
|
|
23194
23205
|
}
|
|
23195
23206
|
const normalizedSubdomain = type === "web" && typeof config.subdomain === "string" ? config.subdomain.toLowerCase() : void 0;
|
|
@@ -23201,6 +23212,9 @@ var require_resolve = __commonJS({
|
|
|
23201
23212
|
builderSrc = import_path7.posix.join(workspace, builderSrc);
|
|
23202
23213
|
}
|
|
23203
23214
|
const builderConfig = { zeroConfig: true };
|
|
23215
|
+
if (builderUse === "@vercel/backends") {
|
|
23216
|
+
builderConfig.serviceName = name;
|
|
23217
|
+
}
|
|
23204
23218
|
if (config.memory)
|
|
23205
23219
|
builderConfig.memory = config.memory;
|
|
23206
23220
|
if (config.maxDuration)
|
|
@@ -23289,10 +23303,14 @@ var require_resolve = __commonJS({
|
|
|
23289
23303
|
let resolvedConfig = serviceConfig;
|
|
23290
23304
|
if (!serviceConfig.framework && resolvedEntrypoint) {
|
|
23291
23305
|
if (resolvedEntrypoint.isDirectory) {
|
|
23306
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)({
|
|
23307
|
+
...serviceConfig
|
|
23308
|
+
});
|
|
23292
23309
|
const workspace = resolvedEntrypoint.normalized;
|
|
23293
23310
|
const { framework, error } = await detectFrameworkFromWorkspace({
|
|
23294
23311
|
fs: fs5,
|
|
23295
23312
|
workspace,
|
|
23313
|
+
runtime: inferredRuntime,
|
|
23296
23314
|
serviceName: name
|
|
23297
23315
|
});
|
|
23298
23316
|
if (error) {
|
|
@@ -23329,7 +23347,7 @@ var require_resolve = __commonJS({
|
|
|
23329
23347
|
serviceName: name,
|
|
23330
23348
|
runtime: inferredRuntime
|
|
23331
23349
|
});
|
|
23332
|
-
if (detection.framework) {
|
|
23350
|
+
if (!detection.error && detection.framework) {
|
|
23333
23351
|
resolvedConfig = {
|
|
23334
23352
|
...resolvedConfig,
|
|
23335
23353
|
framework: detection.framework
|
|
@@ -23371,11 +23389,9 @@ var require_resolve = __commonJS({
|
|
|
23371
23389
|
var require_auto_detect = __commonJS({
|
|
23372
23390
|
"../fs-detectors/dist/services/auto-detect.js"(exports2, module2) {
|
|
23373
23391
|
"use strict";
|
|
23374
|
-
var __create2 = Object.create;
|
|
23375
23392
|
var __defProp2 = Object.defineProperty;
|
|
23376
23393
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
23377
23394
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
23378
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
23379
23395
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
23380
23396
|
var __export2 = (target, all) => {
|
|
23381
23397
|
for (var name in all)
|
|
@@ -23389,14 +23405,6 @@ var require_auto_detect = __commonJS({
|
|
|
23389
23405
|
}
|
|
23390
23406
|
return to;
|
|
23391
23407
|
};
|
|
23392
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
23393
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23394
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23395
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23396
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23397
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
23398
|
-
mod
|
|
23399
|
-
));
|
|
23400
23408
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
23401
23409
|
var auto_detect_exports = {};
|
|
23402
23410
|
__export2(auto_detect_exports, {
|
|
@@ -23404,20 +23412,20 @@ var require_auto_detect = __commonJS({
|
|
|
23404
23412
|
});
|
|
23405
23413
|
module2.exports = __toCommonJS2(auto_detect_exports);
|
|
23406
23414
|
var import_detect_framework = require_detect_framework();
|
|
23407
|
-
var import_frameworks2 =
|
|
23415
|
+
var import_frameworks2 = require_frameworks();
|
|
23408
23416
|
var FRONTEND_DIR = "frontend";
|
|
23409
23417
|
var APPS_WEB_DIR = "apps/web";
|
|
23410
23418
|
var BACKEND_DIR = "backend";
|
|
23411
23419
|
var SERVICES_DIR = "services";
|
|
23412
23420
|
var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
|
|
23413
|
-
var DETECTION_FRAMEWORKS = import_frameworks2.
|
|
23421
|
+
var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
|
|
23414
23422
|
(framework) => !framework.experimental || framework.runtimeFramework
|
|
23415
23423
|
);
|
|
23416
23424
|
async function autoDetectServices2(options) {
|
|
23417
23425
|
const { fs: fs5 } = options;
|
|
23418
23426
|
const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
23419
23427
|
fs: fs5,
|
|
23420
|
-
frameworkList: import_frameworks2.
|
|
23428
|
+
frameworkList: import_frameworks2.frameworkList
|
|
23421
23429
|
});
|
|
23422
23430
|
if (rootFrameworks.length > 1) {
|
|
23423
23431
|
const frameworkNames = rootFrameworks.map((f) => f.name).join(", ");
|
|
@@ -23442,7 +23450,7 @@ var require_auto_detect = __commonJS({
|
|
|
23442
23450
|
const frontendFs = fs5.chdir(frontendLocation);
|
|
23443
23451
|
const frontendFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
23444
23452
|
fs: frontendFs,
|
|
23445
|
-
frameworkList: import_frameworks2.
|
|
23453
|
+
frameworkList: import_frameworks2.frameworkList
|
|
23446
23454
|
});
|
|
23447
23455
|
if (frontendFrameworks.length > 1) {
|
|
23448
23456
|
const frameworkNames = frontendFrameworks.map((f) => f.name).join(", ");
|
|
@@ -23482,13 +23490,22 @@ var require_auto_detect = __commonJS({
|
|
|
23482
23490
|
};
|
|
23483
23491
|
const backendResult = await detectBackendServices(fs5);
|
|
23484
23492
|
if (backendResult.error) {
|
|
23485
|
-
return {
|
|
23493
|
+
return {
|
|
23494
|
+
services: null,
|
|
23495
|
+
errors: [backendResult.error]
|
|
23496
|
+
};
|
|
23486
23497
|
}
|
|
23487
23498
|
if (Object.keys(backendResult.services).length === 0) {
|
|
23488
|
-
return {
|
|
23499
|
+
return {
|
|
23500
|
+
services: null,
|
|
23501
|
+
errors: []
|
|
23502
|
+
};
|
|
23489
23503
|
}
|
|
23490
23504
|
Object.assign(services, backendResult.services);
|
|
23491
|
-
return {
|
|
23505
|
+
return {
|
|
23506
|
+
services,
|
|
23507
|
+
errors: []
|
|
23508
|
+
};
|
|
23492
23509
|
}
|
|
23493
23510
|
async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation) {
|
|
23494
23511
|
const services = {};
|
|
@@ -23500,7 +23517,10 @@ var require_auto_detect = __commonJS({
|
|
|
23500
23517
|
};
|
|
23501
23518
|
const backendResult = await detectBackendServices(fs5);
|
|
23502
23519
|
if (backendResult.error) {
|
|
23503
|
-
return {
|
|
23520
|
+
return {
|
|
23521
|
+
services: null,
|
|
23522
|
+
errors: [backendResult.error]
|
|
23523
|
+
};
|
|
23504
23524
|
}
|
|
23505
23525
|
if (Object.keys(backendResult.services).length === 0) {
|
|
23506
23526
|
return {
|
|
@@ -23514,7 +23534,10 @@ var require_auto_detect = __commonJS({
|
|
|
23514
23534
|
};
|
|
23515
23535
|
}
|
|
23516
23536
|
Object.assign(services, backendResult.services);
|
|
23517
|
-
return {
|
|
23537
|
+
return {
|
|
23538
|
+
services,
|
|
23539
|
+
errors: []
|
|
23540
|
+
};
|
|
23518
23541
|
}
|
|
23519
23542
|
async function detectBackendServices(fs5) {
|
|
23520
23543
|
const services = {};
|
|
@@ -23639,43 +23662,68 @@ var require_detect_services = __commonJS({
|
|
|
23639
23662
|
{ type: "host", value: { suf: ".vercel.app" } },
|
|
23640
23663
|
{ type: "host", value: { suf: ".vercel.dev" } }
|
|
23641
23664
|
];
|
|
23665
|
+
function emptyRoutes() {
|
|
23666
|
+
return {
|
|
23667
|
+
hostRewrites: [],
|
|
23668
|
+
rewrites: [],
|
|
23669
|
+
defaults: [],
|
|
23670
|
+
crons: [],
|
|
23671
|
+
workers: []
|
|
23672
|
+
};
|
|
23673
|
+
}
|
|
23674
|
+
function withResolvedResult(resolved, inferred = null) {
|
|
23675
|
+
return {
|
|
23676
|
+
services: resolved.services,
|
|
23677
|
+
source: resolved.source,
|
|
23678
|
+
routes: resolved.routes,
|
|
23679
|
+
errors: resolved.errors,
|
|
23680
|
+
warnings: resolved.warnings,
|
|
23681
|
+
resolved,
|
|
23682
|
+
inferred
|
|
23683
|
+
};
|
|
23684
|
+
}
|
|
23685
|
+
function toInferredLayoutConfig(services) {
|
|
23686
|
+
const inferredConfig = {};
|
|
23687
|
+
for (const [name, service] of Object.entries(services)) {
|
|
23688
|
+
const serviceConfig = {};
|
|
23689
|
+
if (typeof service.entrypoint === "string") {
|
|
23690
|
+
serviceConfig.entrypoint = service.entrypoint;
|
|
23691
|
+
}
|
|
23692
|
+
if (typeof service.routePrefix === "string") {
|
|
23693
|
+
serviceConfig.routePrefix = service.routePrefix;
|
|
23694
|
+
}
|
|
23695
|
+
if ((0, import_utils.isFrontendFramework)(service.framework)) {
|
|
23696
|
+
serviceConfig.framework = service.framework;
|
|
23697
|
+
}
|
|
23698
|
+
inferredConfig[name] = serviceConfig;
|
|
23699
|
+
}
|
|
23700
|
+
return inferredConfig;
|
|
23701
|
+
}
|
|
23642
23702
|
async function detectServices2(options) {
|
|
23643
23703
|
const { fs: fs5, workPath } = options;
|
|
23644
23704
|
const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
|
|
23645
23705
|
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
23646
23706
|
if (configError) {
|
|
23647
|
-
return {
|
|
23707
|
+
return withResolvedResult({
|
|
23648
23708
|
services: [],
|
|
23649
23709
|
source: "configured",
|
|
23650
|
-
routes:
|
|
23651
|
-
hostRewrites: [],
|
|
23652
|
-
rewrites: [],
|
|
23653
|
-
defaults: [],
|
|
23654
|
-
crons: [],
|
|
23655
|
-
workers: []
|
|
23656
|
-
},
|
|
23710
|
+
routes: emptyRoutes(),
|
|
23657
23711
|
errors: [configError],
|
|
23658
23712
|
warnings: []
|
|
23659
|
-
};
|
|
23713
|
+
});
|
|
23660
23714
|
}
|
|
23661
23715
|
const configuredServices = vercelConfig?.experimentalServices;
|
|
23662
23716
|
const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
|
|
23663
23717
|
if (!hasConfiguredServices) {
|
|
23664
23718
|
const autoResult = await (0, import_auto_detect.autoDetectServices)({ fs: scopedFs });
|
|
23665
23719
|
if (autoResult.errors.length > 0) {
|
|
23666
|
-
return {
|
|
23720
|
+
return withResolvedResult({
|
|
23667
23721
|
services: [],
|
|
23668
23722
|
source: "auto-detected",
|
|
23669
|
-
routes:
|
|
23670
|
-
hostRewrites: [],
|
|
23671
|
-
rewrites: [],
|
|
23672
|
-
defaults: [],
|
|
23673
|
-
crons: [],
|
|
23674
|
-
workers: []
|
|
23675
|
-
},
|
|
23723
|
+
routes: emptyRoutes(),
|
|
23676
23724
|
errors: autoResult.errors,
|
|
23677
23725
|
warnings: []
|
|
23678
|
-
};
|
|
23726
|
+
});
|
|
23679
23727
|
}
|
|
23680
23728
|
if (autoResult.services) {
|
|
23681
23729
|
const result2 = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
@@ -23684,24 +23732,28 @@ var require_detect_services = __commonJS({
|
|
|
23684
23732
|
"generated"
|
|
23685
23733
|
);
|
|
23686
23734
|
const routes2 = generateServicesRoutes2(result2.services);
|
|
23687
|
-
|
|
23735
|
+
const resolved = {
|
|
23688
23736
|
services: result2.services,
|
|
23689
23737
|
source: "auto-detected",
|
|
23690
23738
|
routes: routes2,
|
|
23691
23739
|
errors: result2.errors,
|
|
23692
23740
|
warnings: []
|
|
23693
23741
|
};
|
|
23742
|
+
const rootWebFrameworkServices = result2.services.filter(
|
|
23743
|
+
(service) => service.type === "web" && service.routePrefix === "/" && typeof service.framework === "string"
|
|
23744
|
+
);
|
|
23745
|
+
const inferred = result2.errors.length === 0 && rootWebFrameworkServices.length === 1 && result2.services.length > 1 ? {
|
|
23746
|
+
source: "layout",
|
|
23747
|
+
config: toInferredLayoutConfig(autoResult.services),
|
|
23748
|
+
services: result2.services,
|
|
23749
|
+
warnings: []
|
|
23750
|
+
} : null;
|
|
23751
|
+
return withResolvedResult(resolved, inferred);
|
|
23694
23752
|
}
|
|
23695
|
-
return {
|
|
23753
|
+
return withResolvedResult({
|
|
23696
23754
|
services: [],
|
|
23697
23755
|
source: "auto-detected",
|
|
23698
|
-
routes:
|
|
23699
|
-
hostRewrites: [],
|
|
23700
|
-
rewrites: [],
|
|
23701
|
-
defaults: [],
|
|
23702
|
-
crons: [],
|
|
23703
|
-
workers: []
|
|
23704
|
-
},
|
|
23756
|
+
routes: emptyRoutes(),
|
|
23705
23757
|
errors: [
|
|
23706
23758
|
{
|
|
23707
23759
|
code: "NO_SERVICES_CONFIGURED",
|
|
@@ -23709,7 +23761,7 @@ var require_detect_services = __commonJS({
|
|
|
23709
23761
|
}
|
|
23710
23762
|
],
|
|
23711
23763
|
warnings: []
|
|
23712
|
-
};
|
|
23764
|
+
});
|
|
23713
23765
|
}
|
|
23714
23766
|
const result = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
23715
23767
|
configuredServices,
|
|
@@ -23717,13 +23769,13 @@ var require_detect_services = __commonJS({
|
|
|
23717
23769
|
"configured"
|
|
23718
23770
|
);
|
|
23719
23771
|
const routes = generateServicesRoutes2(result.services);
|
|
23720
|
-
return {
|
|
23772
|
+
return withResolvedResult({
|
|
23721
23773
|
services: result.services,
|
|
23722
23774
|
source: "configured",
|
|
23723
23775
|
routes,
|
|
23724
23776
|
errors: result.errors,
|
|
23725
23777
|
warnings: []
|
|
23726
|
-
};
|
|
23778
|
+
});
|
|
23727
23779
|
}
|
|
23728
23780
|
function generateServicesRoutes2(services) {
|
|
23729
23781
|
const hostRewrites = [];
|
|
@@ -23735,6 +23787,7 @@ var require_detect_services = __commonJS({
|
|
|
23735
23787
|
(s) => s.type === "web" && typeof s.routePrefix === "string"
|
|
23736
23788
|
).sort((a, b) => b.routePrefix.length - a.routePrefix.length);
|
|
23737
23789
|
const allWebPrefixes = getWebRoutePrefixes(sortedWebServices);
|
|
23790
|
+
const explicitHostPrefixGuard = getExplicitHostPrefixNegativeLookahead(allWebPrefixes);
|
|
23738
23791
|
for (const service of sortedWebServices) {
|
|
23739
23792
|
const { routePrefix } = service;
|
|
23740
23793
|
const normalizedPrefix = routePrefix.slice(1);
|
|
@@ -23742,7 +23795,6 @@ var require_detect_services = __commonJS({
|
|
|
23742
23795
|
const hostCondition = getHostCondition(service);
|
|
23743
23796
|
if (hostCondition && routePrefix !== "/") {
|
|
23744
23797
|
const normalizedRoutePrefix = (0, import_routing_utils.normalizeRoutePrefix)(routePrefix);
|
|
23745
|
-
const escapedPrefix = escapeRegex(normalizedRoutePrefix.slice(1));
|
|
23746
23798
|
hostRewrites.push({
|
|
23747
23799
|
src: "^/$",
|
|
23748
23800
|
dest: normalizedRoutePrefix,
|
|
@@ -23751,7 +23803,9 @@ var require_detect_services = __commonJS({
|
|
|
23751
23803
|
check: true
|
|
23752
23804
|
});
|
|
23753
23805
|
hostRewrites.push({
|
|
23754
|
-
|
|
23806
|
+
// Preserve explicit service prefixes so canonical paths like /_/api
|
|
23807
|
+
// keep routing to their target service even on another service's host.
|
|
23808
|
+
src: `^/${explicitHostPrefixGuard}(.*)$`,
|
|
23755
23809
|
dest: `${normalizedRoutePrefix}/$1`,
|
|
23756
23810
|
has: hostCondition,
|
|
23757
23811
|
missing: PREVIEW_DOMAIN_MISSING,
|
|
@@ -23795,7 +23849,6 @@ var require_detect_services = __commonJS({
|
|
|
23795
23849
|
check: true
|
|
23796
23850
|
});
|
|
23797
23851
|
}
|
|
23798
|
-
} else {
|
|
23799
23852
|
}
|
|
23800
23853
|
}
|
|
23801
23854
|
const workerServices = services.filter((s) => s.type === "worker");
|
|
@@ -23842,6 +23895,16 @@ var require_detect_services = __commonJS({
|
|
|
23842
23895
|
}
|
|
23843
23896
|
return Array.from(unique);
|
|
23844
23897
|
}
|
|
23898
|
+
function getExplicitHostPrefixNegativeLookahead(routePrefixes) {
|
|
23899
|
+
const explicitPrefixes = routePrefixes.map(import_routing_utils.normalizeRoutePrefix).filter((prefix) => prefix !== "/").sort((a, b) => b.length - a.length).map((prefix) => escapeRegex(prefix.slice(1)));
|
|
23900
|
+
if (explicitPrefixes.length === 0) {
|
|
23901
|
+
return "";
|
|
23902
|
+
}
|
|
23903
|
+
if (explicitPrefixes.length === 1) {
|
|
23904
|
+
return `(?!${explicitPrefixes[0]}(?:/|$))`;
|
|
23905
|
+
}
|
|
23906
|
+
return `(?!(?:${explicitPrefixes.join("|")})(?:/|$))`;
|
|
23907
|
+
}
|
|
23845
23908
|
function getHostCondition(service) {
|
|
23846
23909
|
if (service.type !== "web") {
|
|
23847
23910
|
return void 0;
|
|
@@ -24202,7 +24265,7 @@ var require_detect_builders = __commonJS({
|
|
|
24202
24265
|
var import_minimatch = __toESM2(require_minimatch());
|
|
24203
24266
|
var import_semver2 = require_semver3();
|
|
24204
24267
|
var import_path7 = require("path");
|
|
24205
|
-
var import_frameworks2 =
|
|
24268
|
+
var import_frameworks2 = require_frameworks();
|
|
24206
24269
|
var import_is_official_runtime = require_is_official_runtime();
|
|
24207
24270
|
var import_build_utils5 = require("@vercel/build-utils");
|
|
24208
24271
|
var import_get_services_builders = require_get_services_builders();
|
|
@@ -24210,7 +24273,7 @@ var require_detect_builders = __commonJS({
|
|
|
24210
24273
|
var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
|
|
24211
24274
|
var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
|
|
24212
24275
|
var slugToFramework = new Map(
|
|
24213
|
-
import_frameworks2.
|
|
24276
|
+
import_frameworks2.frameworkList.map((f) => [f.slug, f])
|
|
24214
24277
|
);
|
|
24215
24278
|
function sortFiles(fileA, fileB) {
|
|
24216
24279
|
return fileA.localeCompare(fileB);
|
|
@@ -24241,9 +24304,10 @@ var require_detect_builders = __commonJS({
|
|
|
24241
24304
|
return publicBuilder ? publicBuilder.src.replace("/**/*", "") : null;
|
|
24242
24305
|
}
|
|
24243
24306
|
async function detectBuilders2(files, pkg, options = {}) {
|
|
24244
|
-
const { projectSettings = {} } = options;
|
|
24307
|
+
const { experimentalServices: services, projectSettings = {} } = options;
|
|
24245
24308
|
const { framework } = projectSettings;
|
|
24246
|
-
|
|
24309
|
+
const hasServicesConfig = services != null && typeof services === "object";
|
|
24310
|
+
if (hasServicesConfig || framework === "services") {
|
|
24247
24311
|
return (0, import_get_services_builders.getServicesBuilders)({
|
|
24248
24312
|
workPath: options.workPath
|
|
24249
24313
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ts-morph": "12.0.0",
|
|
17
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.1.2",
|
|
17
18
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
18
|
-
"@vercel/gatsby-plugin-vercel-builder": "2.1.0",
|
|
19
19
|
"@vercel/static-config": "3.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -38,10 +38,10 @@
|
|
|
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.
|
|
42
|
-
"@vercel/frameworks": "3.
|
|
41
|
+
"@vercel/build-utils": "13.8.2",
|
|
42
|
+
"@vercel/frameworks": "3.21.1",
|
|
43
43
|
"@vercel/error-utils": "2.0.3",
|
|
44
|
-
"@vercel/fs-detectors": "5.
|
|
44
|
+
"@vercel/fs-detectors": "5.11.2",
|
|
45
45
|
"@vercel/routing-utils": "6.0.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|