@vercel/static-build 2.8.39 → 2.8.41
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 +596 -388
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -10383,6 +10383,60 @@ var require_frameworks = __commonJS({
|
|
|
10383
10383
|
}
|
|
10384
10384
|
]
|
|
10385
10385
|
},
|
|
10386
|
+
{
|
|
10387
|
+
name: "Django",
|
|
10388
|
+
slug: "django",
|
|
10389
|
+
experimental: true,
|
|
10390
|
+
logo: "https://api-frameworks.vercel.sh/framework-logos/django.svg",
|
|
10391
|
+
tagline: "Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. ",
|
|
10392
|
+
description: "A Django project served via the Python Runtime.",
|
|
10393
|
+
website: "https://www.djangoproject.com",
|
|
10394
|
+
supersedes: ["python"],
|
|
10395
|
+
useRuntime: { src: "index.py", use: "@vercel/python" },
|
|
10396
|
+
ignoreRuntimes: ["@vercel/python"],
|
|
10397
|
+
detectors: {
|
|
10398
|
+
some: [
|
|
10399
|
+
{
|
|
10400
|
+
path: "requirements.txt",
|
|
10401
|
+
matchContent: "[Dd]jango"
|
|
10402
|
+
},
|
|
10403
|
+
{
|
|
10404
|
+
path: "pyproject.toml",
|
|
10405
|
+
matchContent: "[Dd]jango"
|
|
10406
|
+
},
|
|
10407
|
+
{
|
|
10408
|
+
path: "Pipfile",
|
|
10409
|
+
matchContent: "[Dd]jango"
|
|
10410
|
+
}
|
|
10411
|
+
]
|
|
10412
|
+
},
|
|
10413
|
+
settings: {
|
|
10414
|
+
installCommand: {
|
|
10415
|
+
placeholder: "`pip install -r requirements.txt`"
|
|
10416
|
+
},
|
|
10417
|
+
buildCommand: {
|
|
10418
|
+
placeholder: "None",
|
|
10419
|
+
value: null
|
|
10420
|
+
},
|
|
10421
|
+
devCommand: {
|
|
10422
|
+
placeholder: "None",
|
|
10423
|
+
value: null
|
|
10424
|
+
},
|
|
10425
|
+
outputDirectory: {
|
|
10426
|
+
value: "N/A"
|
|
10427
|
+
}
|
|
10428
|
+
},
|
|
10429
|
+
getOutputDirName: async () => "public",
|
|
10430
|
+
defaultRoutes: [
|
|
10431
|
+
{
|
|
10432
|
+
handle: "filesystem"
|
|
10433
|
+
},
|
|
10434
|
+
{
|
|
10435
|
+
src: "/(.*)",
|
|
10436
|
+
dest: "/"
|
|
10437
|
+
}
|
|
10438
|
+
]
|
|
10439
|
+
},
|
|
10386
10440
|
{
|
|
10387
10441
|
name: "Sanity (v3)",
|
|
10388
10442
|
slug: "sanity-v3",
|
|
@@ -22383,6 +22437,9 @@ var require_utils4 = __commonJS({
|
|
|
22383
22437
|
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
22384
22438
|
return config.runtime;
|
|
22385
22439
|
}
|
|
22440
|
+
if (config.framework && config.framework in import_types.RUNTIME_BUILDERS) {
|
|
22441
|
+
return config.framework;
|
|
22442
|
+
}
|
|
22386
22443
|
if ((0, import_framework_helpers.isPythonFramework)(config.framework)) {
|
|
22387
22444
|
return "python";
|
|
22388
22445
|
}
|
|
@@ -22427,15 +22484,13 @@ var require_utils4 = __commonJS({
|
|
|
22427
22484
|
}
|
|
22428
22485
|
});
|
|
22429
22486
|
|
|
22430
|
-
// ../fs-detectors/dist/
|
|
22431
|
-
var
|
|
22432
|
-
"../fs-detectors/dist/
|
|
22487
|
+
// ../fs-detectors/dist/detect-framework.js
|
|
22488
|
+
var require_detect_framework = __commonJS({
|
|
22489
|
+
"../fs-detectors/dist/detect-framework.js"(exports2, module2) {
|
|
22433
22490
|
"use strict";
|
|
22434
|
-
var __create2 = Object.create;
|
|
22435
22491
|
var __defProp2 = Object.defineProperty;
|
|
22436
22492
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
22437
22493
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
22438
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
22439
22494
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22440
22495
|
var __export2 = (target, all) => {
|
|
22441
22496
|
for (var name in all)
|
|
@@ -22449,131 +22504,440 @@ var require_resolve = __commonJS({
|
|
|
22449
22504
|
}
|
|
22450
22505
|
return to;
|
|
22451
22506
|
};
|
|
22452
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
22453
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22454
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22455
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22456
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22457
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
22458
|
-
mod
|
|
22459
|
-
));
|
|
22460
22507
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22461
|
-
var
|
|
22462
|
-
__export2(
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22508
|
+
var detect_framework_exports = {};
|
|
22509
|
+
__export2(detect_framework_exports, {
|
|
22510
|
+
detectFramework: () => detectFramework2,
|
|
22511
|
+
detectFrameworkRecord: () => detectFrameworkRecord3,
|
|
22512
|
+
detectFrameworkVersion: () => detectFrameworkVersion2,
|
|
22513
|
+
detectFrameworks: () => detectFrameworks2,
|
|
22514
|
+
removeSupersededFrameworks: () => removeSupersededFrameworks
|
|
22466
22515
|
});
|
|
22467
|
-
module2.exports = __toCommonJS2(
|
|
22468
|
-
var
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
var import_routing_utils = require_dist6();
|
|
22473
|
-
var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
|
|
22474
|
-
var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
22475
|
-
function toWorkspaceRelativeEntrypoint(entrypoint, workspace) {
|
|
22476
|
-
const normalizedEntrypoint = import_path7.posix.normalize(entrypoint);
|
|
22477
|
-
if (workspace === ".") {
|
|
22478
|
-
return normalizedEntrypoint;
|
|
22479
|
-
}
|
|
22480
|
-
const workspacePrefix = `${workspace}/`;
|
|
22481
|
-
if (normalizedEntrypoint.startsWith(workspacePrefix)) {
|
|
22482
|
-
return normalizedEntrypoint.slice(workspacePrefix.length);
|
|
22516
|
+
module2.exports = __toCommonJS2(detect_framework_exports);
|
|
22517
|
+
var import_child_process2 = require("child_process");
|
|
22518
|
+
function shouldIncludeExperimentalFrameworks(useExperimentalFrameworks) {
|
|
22519
|
+
if (typeof useExperimentalFrameworks === "boolean") {
|
|
22520
|
+
return useExperimentalFrameworks;
|
|
22483
22521
|
}
|
|
22484
|
-
const
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22522
|
+
const experimentalEnv = process.env.VERCEL_USE_EXPERIMENTAL_FRAMEWORKS;
|
|
22523
|
+
const isEnabled = (val) => val === "1" || typeof val === "string" && val.toLowerCase() === "true";
|
|
22524
|
+
return isEnabled(experimentalEnv);
|
|
22525
|
+
}
|
|
22526
|
+
function filterFrameworkList(frameworkList, useExperimentalFrameworks) {
|
|
22527
|
+
if (shouldIncludeExperimentalFrameworks(useExperimentalFrameworks)) {
|
|
22528
|
+
return frameworkList;
|
|
22490
22529
|
}
|
|
22491
|
-
return
|
|
22530
|
+
return frameworkList.filter((f) => {
|
|
22531
|
+
const experimental = f.experimental;
|
|
22532
|
+
return !experimental;
|
|
22533
|
+
});
|
|
22492
22534
|
}
|
|
22493
|
-
async function
|
|
22494
|
-
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
}) {
|
|
22498
|
-
if (!entrypoint || !runtime) {
|
|
22499
|
-
return void 0;
|
|
22535
|
+
async function matches(fs5, framework) {
|
|
22536
|
+
const { detectors } = framework;
|
|
22537
|
+
if (!detectors) {
|
|
22538
|
+
return;
|
|
22500
22539
|
}
|
|
22501
|
-
const
|
|
22502
|
-
if (
|
|
22503
|
-
return
|
|
22540
|
+
const { every, some } = detectors;
|
|
22541
|
+
if (every !== void 0 && !Array.isArray(every)) {
|
|
22542
|
+
return;
|
|
22504
22543
|
}
|
|
22505
|
-
|
|
22506
|
-
|
|
22507
|
-
dir = ".";
|
|
22544
|
+
if (some !== void 0 && !Array.isArray(some)) {
|
|
22545
|
+
return;
|
|
22508
22546
|
}
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
|
|
22515
|
-
|
|
22547
|
+
const check = async ({
|
|
22548
|
+
path: path6,
|
|
22549
|
+
matchContent,
|
|
22550
|
+
matchPackage
|
|
22551
|
+
}) => {
|
|
22552
|
+
if (matchPackage && matchContent) {
|
|
22553
|
+
throw new Error(
|
|
22554
|
+
`Cannot specify "matchPackage" and "matchContent" in the same detector for "${framework.slug}"`
|
|
22555
|
+
);
|
|
22516
22556
|
}
|
|
22517
|
-
if (
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22557
|
+
if (matchPackage && path6) {
|
|
22558
|
+
throw new Error(
|
|
22559
|
+
`Cannot specify "matchPackage" and "path" in the same detector for "${framework.slug}" because "path" is assumed to be "package.json".`
|
|
22560
|
+
);
|
|
22561
|
+
}
|
|
22562
|
+
if (!path6 && !matchPackage) {
|
|
22563
|
+
throw new Error(
|
|
22564
|
+
`Must specify either "path" or "matchPackage" in detector for "${framework.slug}".`
|
|
22565
|
+
);
|
|
22566
|
+
}
|
|
22567
|
+
if (!path6) {
|
|
22568
|
+
path6 = "package.json";
|
|
22569
|
+
}
|
|
22570
|
+
if (matchPackage) {
|
|
22571
|
+
matchContent = `"(dev)?(d|D)ependencies":\\s*{[^}]*"${matchPackage}":\\s*"(.+?)"[^}]*}`;
|
|
22572
|
+
}
|
|
22573
|
+
if (await fs5.hasPath(path6) === false) {
|
|
22574
|
+
return;
|
|
22575
|
+
}
|
|
22576
|
+
if (matchContent) {
|
|
22577
|
+
if (await fs5.isFile(path6) === false) {
|
|
22578
|
+
return;
|
|
22579
|
+
}
|
|
22580
|
+
const regex = new RegExp(matchContent, "m");
|
|
22581
|
+
const content = await fs5.readFile(path6);
|
|
22582
|
+
const match = content.toString().match(regex);
|
|
22583
|
+
if (!match) {
|
|
22584
|
+
return;
|
|
22585
|
+
}
|
|
22586
|
+
if (matchPackage && match[3]) {
|
|
22587
|
+
return {
|
|
22588
|
+
framework,
|
|
22589
|
+
detectedVersion: match[3]
|
|
22590
|
+
};
|
|
22525
22591
|
}
|
|
22526
22592
|
}
|
|
22527
|
-
}
|
|
22528
|
-
return void 0;
|
|
22529
|
-
}
|
|
22530
|
-
function isReservedServiceRoutePrefix(routePrefix) {
|
|
22531
|
-
const normalized = (0, import_routing_utils.normalizeRoutePrefix)(routePrefix);
|
|
22532
|
-
return normalized === import_utils.INTERNAL_SERVICE_PREFIX || normalized.startsWith(`${import_utils.INTERNAL_SERVICE_PREFIX}/`);
|
|
22533
|
-
}
|
|
22534
|
-
function validateServiceConfig(name, config) {
|
|
22535
|
-
if (!SERVICE_NAME_REGEX.test(name)) {
|
|
22536
|
-
return {
|
|
22537
|
-
code: "INVALID_SERVICE_NAME",
|
|
22538
|
-
message: `Service name "${name}" is invalid. Names must start with a letter, end with an alphanumeric character, and contain only alphanumeric characters, hyphens, and underscores.`,
|
|
22539
|
-
serviceName: name
|
|
22540
|
-
};
|
|
22541
|
-
}
|
|
22542
|
-
if (!config || typeof config !== "object") {
|
|
22543
22593
|
return {
|
|
22544
|
-
|
|
22545
|
-
message: `Service "${name}" has an invalid configuration. Expected an object.`,
|
|
22546
|
-
serviceName: name
|
|
22547
|
-
};
|
|
22548
|
-
}
|
|
22549
|
-
const serviceType = config.type || "web";
|
|
22550
|
-
if (serviceType === "web" && !config.routePrefix) {
|
|
22551
|
-
return {
|
|
22552
|
-
code: "MISSING_ROUTE_PREFIX",
|
|
22553
|
-
message: `Web service "${name}" must specify "routePrefix".`,
|
|
22554
|
-
serviceName: name
|
|
22555
|
-
};
|
|
22556
|
-
}
|
|
22557
|
-
if (serviceType === "web" && config.routePrefix && isReservedServiceRoutePrefix(config.routePrefix)) {
|
|
22558
|
-
return {
|
|
22559
|
-
code: "RESERVED_ROUTE_PREFIX",
|
|
22560
|
-
message: `Web service "${name}" cannot use routePrefix "${config.routePrefix}". The "${import_utils.INTERNAL_SERVICE_PREFIX}" prefix is reserved for internal services routing.`,
|
|
22561
|
-
serviceName: name
|
|
22594
|
+
framework
|
|
22562
22595
|
};
|
|
22596
|
+
};
|
|
22597
|
+
const result = [];
|
|
22598
|
+
if (every) {
|
|
22599
|
+
const everyResult = await Promise.all(every.map((item) => check(item)));
|
|
22600
|
+
result.push(...everyResult);
|
|
22563
22601
|
}
|
|
22564
|
-
if (
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22602
|
+
if (some) {
|
|
22603
|
+
let someResult;
|
|
22604
|
+
for (const item of some) {
|
|
22605
|
+
const itemResult = await check(item);
|
|
22606
|
+
if (itemResult) {
|
|
22607
|
+
someResult = itemResult;
|
|
22608
|
+
break;
|
|
22609
|
+
}
|
|
22610
|
+
}
|
|
22611
|
+
result.push(someResult);
|
|
22570
22612
|
}
|
|
22571
|
-
if (
|
|
22572
|
-
return
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22613
|
+
if (!result.every((res) => !!res)) {
|
|
22614
|
+
return;
|
|
22615
|
+
}
|
|
22616
|
+
const detectedVersion = result.find(
|
|
22617
|
+
(r) => typeof r === "object" && r.detectedVersion
|
|
22618
|
+
)?.detectedVersion;
|
|
22619
|
+
return {
|
|
22620
|
+
framework,
|
|
22621
|
+
detectedVersion
|
|
22622
|
+
};
|
|
22623
|
+
}
|
|
22624
|
+
function removeSupersededFramework(matches2, slug) {
|
|
22625
|
+
const index = matches2.findIndex((f) => f?.slug === slug);
|
|
22626
|
+
const framework = matches2[index];
|
|
22627
|
+
if (framework) {
|
|
22628
|
+
if (framework.supersedes) {
|
|
22629
|
+
for (const slug2 of framework.supersedes) {
|
|
22630
|
+
removeSupersededFramework(matches2, slug2);
|
|
22631
|
+
}
|
|
22632
|
+
}
|
|
22633
|
+
matches2.splice(index, 1);
|
|
22634
|
+
}
|
|
22635
|
+
}
|
|
22636
|
+
function removeSupersededFrameworks(matches2) {
|
|
22637
|
+
for (const match of matches2.slice()) {
|
|
22638
|
+
if (match?.supersedes) {
|
|
22639
|
+
for (const slug of match.supersedes) {
|
|
22640
|
+
removeSupersededFramework(matches2, slug);
|
|
22641
|
+
}
|
|
22642
|
+
}
|
|
22643
|
+
}
|
|
22644
|
+
}
|
|
22645
|
+
async function detectFramework2({
|
|
22646
|
+
fs: fs5,
|
|
22647
|
+
frameworkList,
|
|
22648
|
+
useExperimentalFrameworks
|
|
22649
|
+
}) {
|
|
22650
|
+
const filteredList = filterFrameworkList(
|
|
22651
|
+
frameworkList,
|
|
22652
|
+
useExperimentalFrameworks
|
|
22653
|
+
);
|
|
22654
|
+
const result = await Promise.all(
|
|
22655
|
+
filteredList.map(async (frameworkMatch) => {
|
|
22656
|
+
if (await matches(fs5, frameworkMatch)) {
|
|
22657
|
+
return frameworkMatch;
|
|
22658
|
+
}
|
|
22659
|
+
return null;
|
|
22660
|
+
})
|
|
22661
|
+
);
|
|
22662
|
+
removeSupersededFrameworks(result);
|
|
22663
|
+
return result.find((res) => res !== null)?.slug ?? null;
|
|
22664
|
+
}
|
|
22665
|
+
async function detectFrameworks2({
|
|
22666
|
+
fs: fs5,
|
|
22667
|
+
frameworkList,
|
|
22668
|
+
useExperimentalFrameworks
|
|
22669
|
+
}) {
|
|
22670
|
+
const filteredList = filterFrameworkList(
|
|
22671
|
+
frameworkList,
|
|
22672
|
+
useExperimentalFrameworks
|
|
22673
|
+
);
|
|
22674
|
+
const result = await Promise.all(
|
|
22675
|
+
filteredList.map(async (frameworkMatch) => {
|
|
22676
|
+
if (await matches(fs5, frameworkMatch)) {
|
|
22677
|
+
return frameworkMatch;
|
|
22678
|
+
}
|
|
22679
|
+
return null;
|
|
22680
|
+
})
|
|
22681
|
+
);
|
|
22682
|
+
removeSupersededFrameworks(result);
|
|
22683
|
+
return result.filter((res) => res !== null);
|
|
22684
|
+
}
|
|
22685
|
+
async function detectFrameworkRecord3({
|
|
22686
|
+
fs: fs5,
|
|
22687
|
+
frameworkList,
|
|
22688
|
+
useExperimentalFrameworks
|
|
22689
|
+
}) {
|
|
22690
|
+
const filteredList = filterFrameworkList(
|
|
22691
|
+
frameworkList,
|
|
22692
|
+
useExperimentalFrameworks
|
|
22693
|
+
);
|
|
22694
|
+
const result = await Promise.all(
|
|
22695
|
+
filteredList.map(async (frameworkMatch) => {
|
|
22696
|
+
const matchResult = await matches(fs5, frameworkMatch);
|
|
22697
|
+
if (matchResult) {
|
|
22698
|
+
return {
|
|
22699
|
+
...frameworkMatch,
|
|
22700
|
+
detectedVersion: matchResult?.detectedVersion
|
|
22701
|
+
};
|
|
22702
|
+
}
|
|
22703
|
+
return null;
|
|
22704
|
+
})
|
|
22705
|
+
);
|
|
22706
|
+
removeSupersededFrameworks(result);
|
|
22707
|
+
return result.find((res) => res !== null) ?? null;
|
|
22708
|
+
}
|
|
22709
|
+
function detectFrameworkVersion2(frameworkRecord) {
|
|
22710
|
+
const allDetectors = [
|
|
22711
|
+
...frameworkRecord.detectors?.every || [],
|
|
22712
|
+
...frameworkRecord.detectors?.some || []
|
|
22713
|
+
];
|
|
22714
|
+
const firstMatchPackage = allDetectors.find((d) => d.matchPackage);
|
|
22715
|
+
if (!firstMatchPackage?.matchPackage) {
|
|
22716
|
+
return;
|
|
22717
|
+
}
|
|
22718
|
+
return lookupInstalledVersion(
|
|
22719
|
+
process.execPath,
|
|
22720
|
+
firstMatchPackage.matchPackage
|
|
22721
|
+
);
|
|
22722
|
+
}
|
|
22723
|
+
function lookupInstalledVersion(cwd, packageName) {
|
|
22724
|
+
try {
|
|
22725
|
+
const script = `require('${packageName}/package.json').version`;
|
|
22726
|
+
return (0, import_child_process2.spawnSync)(cwd, ["-p", script], {
|
|
22727
|
+
encoding: "utf-8"
|
|
22728
|
+
}).stdout.trim();
|
|
22729
|
+
} catch (error) {
|
|
22730
|
+
console.debug(
|
|
22731
|
+
`Error looking up version of installed package "${packageName}": ${error}`
|
|
22732
|
+
);
|
|
22733
|
+
}
|
|
22734
|
+
return;
|
|
22735
|
+
}
|
|
22736
|
+
}
|
|
22737
|
+
});
|
|
22738
|
+
|
|
22739
|
+
// ../fs-detectors/dist/services/resolve.js
|
|
22740
|
+
var require_resolve = __commonJS({
|
|
22741
|
+
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
22742
|
+
"use strict";
|
|
22743
|
+
var __create2 = Object.create;
|
|
22744
|
+
var __defProp2 = Object.defineProperty;
|
|
22745
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
22746
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
22747
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
22748
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22749
|
+
var __export2 = (target, all) => {
|
|
22750
|
+
for (var name in all)
|
|
22751
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
22752
|
+
};
|
|
22753
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
22754
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22755
|
+
for (let key of __getOwnPropNames2(from))
|
|
22756
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
22757
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
22758
|
+
}
|
|
22759
|
+
return to;
|
|
22760
|
+
};
|
|
22761
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
22762
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22763
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22764
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22765
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22766
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
22767
|
+
mod
|
|
22768
|
+
));
|
|
22769
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22770
|
+
var resolve_exports = {};
|
|
22771
|
+
__export2(resolve_exports, {
|
|
22772
|
+
resolveAllConfiguredServices: () => resolveAllConfiguredServices,
|
|
22773
|
+
resolveConfiguredService: () => resolveConfiguredService,
|
|
22774
|
+
validateServiceConfig: () => validateServiceConfig,
|
|
22775
|
+
validateServiceEntrypoint: () => validateServiceEntrypoint
|
|
22776
|
+
});
|
|
22777
|
+
module2.exports = __toCommonJS2(resolve_exports);
|
|
22778
|
+
var import_path7 = require("path");
|
|
22779
|
+
var import_types = require_types3();
|
|
22780
|
+
var import_utils = require_utils4();
|
|
22781
|
+
var import_frameworks2 = __toESM2(require_frameworks());
|
|
22782
|
+
var import_detect_framework = require_detect_framework();
|
|
22783
|
+
var import_routing_utils = require_dist6();
|
|
22784
|
+
var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
|
|
22785
|
+
var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
22786
|
+
function normalizeServiceEntrypoint(entrypoint) {
|
|
22787
|
+
const normalized = import_path7.posix.normalize(entrypoint);
|
|
22788
|
+
return normalized === "" ? "." : normalized;
|
|
22789
|
+
}
|
|
22790
|
+
async function resolveEntrypointPath({
|
|
22791
|
+
fs: fs5,
|
|
22792
|
+
serviceName,
|
|
22793
|
+
entrypoint
|
|
22794
|
+
}) {
|
|
22795
|
+
const normalized = normalizeServiceEntrypoint(entrypoint);
|
|
22796
|
+
if (!await fs5.hasPath(normalized)) {
|
|
22797
|
+
return {
|
|
22798
|
+
error: {
|
|
22799
|
+
code: "ENTRYPOINT_NOT_FOUND",
|
|
22800
|
+
message: `Service "${serviceName}" has entrypoint "${entrypoint}" but that path does not exist.`,
|
|
22801
|
+
serviceName
|
|
22802
|
+
}
|
|
22803
|
+
};
|
|
22804
|
+
}
|
|
22805
|
+
return {
|
|
22806
|
+
entrypoint: {
|
|
22807
|
+
normalized,
|
|
22808
|
+
isDirectory: !await fs5.isFile(normalized)
|
|
22809
|
+
}
|
|
22810
|
+
};
|
|
22811
|
+
}
|
|
22812
|
+
function toWorkspaceRelativeEntrypoint(entrypoint, workspace) {
|
|
22813
|
+
const normalizedEntrypoint = import_path7.posix.normalize(entrypoint);
|
|
22814
|
+
if (workspace === ".") {
|
|
22815
|
+
return normalizedEntrypoint;
|
|
22816
|
+
}
|
|
22817
|
+
const workspacePrefix = `${workspace}/`;
|
|
22818
|
+
if (normalizedEntrypoint.startsWith(workspacePrefix)) {
|
|
22819
|
+
return normalizedEntrypoint.slice(workspacePrefix.length);
|
|
22820
|
+
}
|
|
22821
|
+
const relativeEntrypoint = import_path7.posix.relative(
|
|
22822
|
+
workspace,
|
|
22823
|
+
normalizedEntrypoint
|
|
22824
|
+
);
|
|
22825
|
+
if (relativeEntrypoint === "" || relativeEntrypoint.startsWith("..")) {
|
|
22826
|
+
return normalizedEntrypoint;
|
|
22827
|
+
}
|
|
22828
|
+
return relativeEntrypoint;
|
|
22829
|
+
}
|
|
22830
|
+
async function inferWorkspaceFromNearestManifest({
|
|
22831
|
+
fs: fs5,
|
|
22832
|
+
entrypoint,
|
|
22833
|
+
runtime
|
|
22834
|
+
}) {
|
|
22835
|
+
if (!entrypoint || !runtime) {
|
|
22836
|
+
return void 0;
|
|
22837
|
+
}
|
|
22838
|
+
const manifests = import_types.RUNTIME_MANIFESTS[runtime];
|
|
22839
|
+
if (!manifests || manifests.length === 0) {
|
|
22840
|
+
return void 0;
|
|
22841
|
+
}
|
|
22842
|
+
let dir = import_path7.posix.dirname(import_path7.posix.normalize(entrypoint)) || ".";
|
|
22843
|
+
if (dir === "") {
|
|
22844
|
+
dir = ".";
|
|
22845
|
+
}
|
|
22846
|
+
let reachedRoot = false;
|
|
22847
|
+
while (!reachedRoot) {
|
|
22848
|
+
for (const manifest of manifests) {
|
|
22849
|
+
const manifestPath = dir === "." ? manifest : import_path7.posix.join(dir, manifest);
|
|
22850
|
+
if (await (0, import_utils.hasFile)(fs5, manifestPath)) {
|
|
22851
|
+
return dir;
|
|
22852
|
+
}
|
|
22853
|
+
}
|
|
22854
|
+
if (dir === "." || dir === "/") {
|
|
22855
|
+
reachedRoot = true;
|
|
22856
|
+
} else {
|
|
22857
|
+
const parent = import_path7.posix.dirname(dir);
|
|
22858
|
+
if (!parent || parent === dir) {
|
|
22859
|
+
reachedRoot = true;
|
|
22860
|
+
} else {
|
|
22861
|
+
dir = parent;
|
|
22862
|
+
}
|
|
22863
|
+
}
|
|
22864
|
+
}
|
|
22865
|
+
return void 0;
|
|
22866
|
+
}
|
|
22867
|
+
async function detectFrameworkFromWorkspace({
|
|
22868
|
+
fs: fs5,
|
|
22869
|
+
workspace,
|
|
22870
|
+
serviceName
|
|
22871
|
+
}) {
|
|
22872
|
+
const serviceFs = workspace === "." ? fs5 : fs5.chdir(workspace);
|
|
22873
|
+
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
22874
|
+
fs: serviceFs,
|
|
22875
|
+
frameworkList: import_frameworks2.default
|
|
22876
|
+
});
|
|
22877
|
+
if (frameworks2.length > 1) {
|
|
22878
|
+
const frameworkNames = frameworks2.map((f) => f.name).join(", ");
|
|
22879
|
+
return {
|
|
22880
|
+
error: {
|
|
22881
|
+
code: "MULTIPLE_FRAMEWORKS_SERVICE",
|
|
22882
|
+
message: `Multiple frameworks detected in ${workspace === "." ? "project root" : `${workspace}/`}: ${frameworkNames}. Specify "framework" explicitly in experimentalServices.`,
|
|
22883
|
+
serviceName
|
|
22884
|
+
}
|
|
22885
|
+
};
|
|
22886
|
+
}
|
|
22887
|
+
if (frameworks2.length === 1) {
|
|
22888
|
+
return {
|
|
22889
|
+
framework: frameworks2[0].slug ?? void 0
|
|
22890
|
+
};
|
|
22891
|
+
}
|
|
22892
|
+
return {};
|
|
22893
|
+
}
|
|
22894
|
+
function isReservedServiceRoutePrefix(routePrefix) {
|
|
22895
|
+
const normalized = (0, import_routing_utils.normalizeRoutePrefix)(routePrefix);
|
|
22896
|
+
return normalized === import_utils.INTERNAL_SERVICE_PREFIX || normalized.startsWith(`${import_utils.INTERNAL_SERVICE_PREFIX}/`);
|
|
22897
|
+
}
|
|
22898
|
+
function validateServiceConfig(name, config) {
|
|
22899
|
+
if (!SERVICE_NAME_REGEX.test(name)) {
|
|
22900
|
+
return {
|
|
22901
|
+
code: "INVALID_SERVICE_NAME",
|
|
22902
|
+
message: `Service name "${name}" is invalid. Names must start with a letter, end with an alphanumeric character, and contain only alphanumeric characters, hyphens, and underscores.`,
|
|
22903
|
+
serviceName: name
|
|
22904
|
+
};
|
|
22905
|
+
}
|
|
22906
|
+
if (!config || typeof config !== "object") {
|
|
22907
|
+
return {
|
|
22908
|
+
code: "INVALID_SERVICE_CONFIG",
|
|
22909
|
+
message: `Service "${name}" has an invalid configuration. Expected an object.`,
|
|
22910
|
+
serviceName: name
|
|
22911
|
+
};
|
|
22912
|
+
}
|
|
22913
|
+
const serviceType = config.type || "web";
|
|
22914
|
+
if (serviceType === "web" && !config.routePrefix) {
|
|
22915
|
+
return {
|
|
22916
|
+
code: "MISSING_ROUTE_PREFIX",
|
|
22917
|
+
message: `Web service "${name}" must specify "routePrefix".`,
|
|
22918
|
+
serviceName: name
|
|
22919
|
+
};
|
|
22920
|
+
}
|
|
22921
|
+
if (serviceType === "web" && config.routePrefix && isReservedServiceRoutePrefix(config.routePrefix)) {
|
|
22922
|
+
return {
|
|
22923
|
+
code: "RESERVED_ROUTE_PREFIX",
|
|
22924
|
+
message: `Web service "${name}" cannot use routePrefix "${config.routePrefix}". The "${import_utils.INTERNAL_SERVICE_PREFIX}" prefix is reserved for internal services routing.`,
|
|
22925
|
+
serviceName: name
|
|
22926
|
+
};
|
|
22927
|
+
}
|
|
22928
|
+
if ((serviceType === "worker" || serviceType === "cron") && config.routePrefix) {
|
|
22929
|
+
return {
|
|
22930
|
+
code: "INVALID_ROUTE_PREFIX",
|
|
22931
|
+
message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "routePrefix". Only web services should specify "routePrefix".`,
|
|
22932
|
+
serviceName: name
|
|
22933
|
+
};
|
|
22934
|
+
}
|
|
22935
|
+
if (serviceType === "cron" && !config.schedule) {
|
|
22936
|
+
return {
|
|
22937
|
+
code: "MISSING_CRON_SCHEDULE",
|
|
22938
|
+
message: `Cron service "${name}" is missing required "schedule" field.`,
|
|
22939
|
+
serviceName: name
|
|
22940
|
+
};
|
|
22577
22941
|
}
|
|
22578
22942
|
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
22579
22943
|
return {
|
|
@@ -22606,7 +22970,10 @@ var require_resolve = __commonJS({
|
|
|
22606
22970
|
serviceName: name
|
|
22607
22971
|
};
|
|
22608
22972
|
}
|
|
22609
|
-
|
|
22973
|
+
return null;
|
|
22974
|
+
}
|
|
22975
|
+
function validateServiceEntrypoint(name, config, resolvedEntrypoint) {
|
|
22976
|
+
if (!resolvedEntrypoint.isDirectory && !config.builder && !config.runtime && !config.framework) {
|
|
22610
22977
|
const runtime = (0, import_utils.inferServiceRuntime)({ entrypoint: config.entrypoint });
|
|
22611
22978
|
if (!runtime) {
|
|
22612
22979
|
const supported = Object.keys(import_types.ENTRYPOINT_EXTENSIONS).join(", ");
|
|
@@ -22619,22 +22986,52 @@ var require_resolve = __commonJS({
|
|
|
22619
22986
|
}
|
|
22620
22987
|
return null;
|
|
22621
22988
|
}
|
|
22622
|
-
async function resolveConfiguredService(
|
|
22989
|
+
async function resolveConfiguredService(options) {
|
|
22990
|
+
const {
|
|
22991
|
+
name,
|
|
22992
|
+
config,
|
|
22993
|
+
fs: fs5,
|
|
22994
|
+
group,
|
|
22995
|
+
resolvedEntrypoint,
|
|
22996
|
+
routePrefixSource = "configured"
|
|
22997
|
+
} = options;
|
|
22623
22998
|
const type = config.type || "web";
|
|
22624
|
-
const
|
|
22625
|
-
let
|
|
22626
|
-
|
|
22627
|
-
|
|
22999
|
+
const rawEntrypoint = config.entrypoint;
|
|
23000
|
+
let resolvedEntrypointPath = resolvedEntrypoint;
|
|
23001
|
+
if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
|
|
23002
|
+
const resolved = await resolveEntrypointPath({
|
|
23003
|
+
fs: fs5,
|
|
23004
|
+
serviceName: name,
|
|
23005
|
+
entrypoint: rawEntrypoint
|
|
23006
|
+
});
|
|
23007
|
+
resolvedEntrypointPath = resolved.entrypoint;
|
|
23008
|
+
}
|
|
23009
|
+
if (typeof rawEntrypoint === "string" && !resolvedEntrypointPath) {
|
|
23010
|
+
throw new Error(
|
|
23011
|
+
`Failed to resolve entrypoint "${rawEntrypoint}" for service "${name}".`
|
|
23012
|
+
);
|
|
23013
|
+
}
|
|
23014
|
+
const normalizedEntrypoint = resolvedEntrypointPath?.normalized;
|
|
23015
|
+
const entrypointIsDirectory = Boolean(resolvedEntrypointPath?.isDirectory);
|
|
23016
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)({
|
|
23017
|
+
...config,
|
|
23018
|
+
entrypoint: entrypointIsDirectory ? void 0 : normalizedEntrypoint
|
|
23019
|
+
});
|
|
23020
|
+
let workspace = ".";
|
|
23021
|
+
let resolvedEntrypointFile = entrypointIsDirectory || !normalizedEntrypoint ? void 0 : normalizedEntrypoint;
|
|
23022
|
+
if (entrypointIsDirectory && normalizedEntrypoint) {
|
|
23023
|
+
workspace = normalizedEntrypoint;
|
|
23024
|
+
} else {
|
|
22628
23025
|
const inferredWorkspace = await inferWorkspaceFromNearestManifest({
|
|
22629
23026
|
fs: fs5,
|
|
22630
|
-
entrypoint:
|
|
23027
|
+
entrypoint: resolvedEntrypointFile,
|
|
22631
23028
|
runtime: inferredRuntime
|
|
22632
23029
|
});
|
|
22633
23030
|
if (inferredWorkspace) {
|
|
22634
23031
|
workspace = inferredWorkspace;
|
|
22635
|
-
if (
|
|
22636
|
-
|
|
22637
|
-
|
|
23032
|
+
if (resolvedEntrypointFile) {
|
|
23033
|
+
resolvedEntrypointFile = toWorkspaceRelativeEntrypoint(
|
|
23034
|
+
resolvedEntrypointFile,
|
|
22638
23035
|
inferredWorkspace
|
|
22639
23036
|
);
|
|
22640
23037
|
}
|
|
@@ -22647,13 +23044,13 @@ var require_resolve = __commonJS({
|
|
|
22647
23044
|
if (config.framework) {
|
|
22648
23045
|
const framework = frameworksBySlug.get(config.framework);
|
|
22649
23046
|
builderUse = framework?.useRuntime?.use || "@vercel/static-build";
|
|
22650
|
-
builderSrc =
|
|
23047
|
+
builderSrc = resolvedEntrypointFile || framework?.useRuntime?.src || "package.json";
|
|
22651
23048
|
} else if (config.builder) {
|
|
22652
23049
|
builderUse = config.builder;
|
|
22653
|
-
builderSrc =
|
|
23050
|
+
builderSrc = resolvedEntrypointFile;
|
|
22654
23051
|
} else {
|
|
22655
23052
|
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
22656
|
-
builderSrc =
|
|
23053
|
+
builderSrc = resolvedEntrypointFile;
|
|
22657
23054
|
}
|
|
22658
23055
|
const routePrefix = type === "web" && config.routePrefix ? config.routePrefix.startsWith("/") ? config.routePrefix : `/${config.routePrefix}` : void 0;
|
|
22659
23056
|
const isRoot = workspace === ".";
|
|
@@ -22686,8 +23083,9 @@ var require_resolve = __commonJS({
|
|
|
22686
23083
|
type,
|
|
22687
23084
|
group,
|
|
22688
23085
|
workspace,
|
|
22689
|
-
entrypoint:
|
|
23086
|
+
entrypoint: resolvedEntrypointFile,
|
|
22690
23087
|
routePrefix,
|
|
23088
|
+
routePrefixSource: type === "web" && typeof routePrefix === "string" ? routePrefixSource : void 0,
|
|
22691
23089
|
framework: config.framework,
|
|
22692
23090
|
builder: {
|
|
22693
23091
|
src: builderSrc,
|
|
@@ -22702,7 +23100,7 @@ var require_resolve = __commonJS({
|
|
|
22702
23100
|
consumer
|
|
22703
23101
|
};
|
|
22704
23102
|
}
|
|
22705
|
-
async function resolveAllConfiguredServices(services, fs5) {
|
|
23103
|
+
async function resolveAllConfiguredServices(services, fs5, routePrefixSource = "configured") {
|
|
22706
23104
|
const resolved = [];
|
|
22707
23105
|
const errors = [];
|
|
22708
23106
|
const webServicesByRoutePrefix = /* @__PURE__ */ new Map();
|
|
@@ -22713,7 +23111,63 @@ var require_resolve = __commonJS({
|
|
|
22713
23111
|
errors.push(validationError);
|
|
22714
23112
|
continue;
|
|
22715
23113
|
}
|
|
22716
|
-
|
|
23114
|
+
let resolvedEntrypoint;
|
|
23115
|
+
if (typeof serviceConfig.entrypoint === "string") {
|
|
23116
|
+
const resolvedPath = await resolveEntrypointPath({
|
|
23117
|
+
fs: fs5,
|
|
23118
|
+
serviceName: name,
|
|
23119
|
+
entrypoint: serviceConfig.entrypoint
|
|
23120
|
+
});
|
|
23121
|
+
if (resolvedPath.error) {
|
|
23122
|
+
errors.push(resolvedPath.error);
|
|
23123
|
+
continue;
|
|
23124
|
+
}
|
|
23125
|
+
resolvedEntrypoint = resolvedPath.entrypoint;
|
|
23126
|
+
}
|
|
23127
|
+
if (resolvedEntrypoint) {
|
|
23128
|
+
const entrypointError = validateServiceEntrypoint(
|
|
23129
|
+
name,
|
|
23130
|
+
serviceConfig,
|
|
23131
|
+
resolvedEntrypoint
|
|
23132
|
+
);
|
|
23133
|
+
if (entrypointError) {
|
|
23134
|
+
errors.push(entrypointError);
|
|
23135
|
+
continue;
|
|
23136
|
+
}
|
|
23137
|
+
}
|
|
23138
|
+
let resolvedConfig = serviceConfig;
|
|
23139
|
+
const shouldDetectFramework = !serviceConfig.framework && Boolean(resolvedEntrypoint?.isDirectory);
|
|
23140
|
+
if (shouldDetectFramework) {
|
|
23141
|
+
const workspace = resolvedEntrypoint.normalized;
|
|
23142
|
+
const { framework, error } = await detectFrameworkFromWorkspace({
|
|
23143
|
+
fs: fs5,
|
|
23144
|
+
workspace,
|
|
23145
|
+
serviceName: name
|
|
23146
|
+
});
|
|
23147
|
+
if (error) {
|
|
23148
|
+
errors.push(error);
|
|
23149
|
+
continue;
|
|
23150
|
+
}
|
|
23151
|
+
if (!framework) {
|
|
23152
|
+
errors.push({
|
|
23153
|
+
code: "MISSING_SERVICE_FRAMEWORK",
|
|
23154
|
+
message: `Service "${name}" uses directory entrypoint "${serviceConfig.entrypoint}" but no framework could be detected in "${workspace}". Specify "framework" explicitly or use a file entrypoint.`,
|
|
23155
|
+
serviceName: name
|
|
23156
|
+
});
|
|
23157
|
+
continue;
|
|
23158
|
+
}
|
|
23159
|
+
resolvedConfig = {
|
|
23160
|
+
...serviceConfig,
|
|
23161
|
+
framework
|
|
23162
|
+
};
|
|
23163
|
+
}
|
|
23164
|
+
const service = await resolveConfiguredService({
|
|
23165
|
+
name,
|
|
23166
|
+
config: resolvedConfig,
|
|
23167
|
+
fs: fs5,
|
|
23168
|
+
resolvedEntrypoint,
|
|
23169
|
+
routePrefixSource
|
|
23170
|
+
});
|
|
22717
23171
|
if (service.type === "web" && typeof service.routePrefix === "string") {
|
|
22718
23172
|
const normalizedRoutePrefix = (0, import_routing_utils.normalizeRoutePrefix)(service.routePrefix);
|
|
22719
23173
|
const existingServiceName = webServicesByRoutePrefix.get(
|
|
@@ -22736,258 +23190,6 @@ var require_resolve = __commonJS({
|
|
|
22736
23190
|
}
|
|
22737
23191
|
});
|
|
22738
23192
|
|
|
22739
|
-
// ../fs-detectors/dist/detect-framework.js
|
|
22740
|
-
var require_detect_framework = __commonJS({
|
|
22741
|
-
"../fs-detectors/dist/detect-framework.js"(exports2, module2) {
|
|
22742
|
-
"use strict";
|
|
22743
|
-
var __defProp2 = Object.defineProperty;
|
|
22744
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
22745
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
22746
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
22747
|
-
var __export2 = (target, all) => {
|
|
22748
|
-
for (var name in all)
|
|
22749
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
22750
|
-
};
|
|
22751
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
22752
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22753
|
-
for (let key of __getOwnPropNames2(from))
|
|
22754
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
22755
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
22756
|
-
}
|
|
22757
|
-
return to;
|
|
22758
|
-
};
|
|
22759
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
22760
|
-
var detect_framework_exports = {};
|
|
22761
|
-
__export2(detect_framework_exports, {
|
|
22762
|
-
detectFramework: () => detectFramework2,
|
|
22763
|
-
detectFrameworkRecord: () => detectFrameworkRecord3,
|
|
22764
|
-
detectFrameworkVersion: () => detectFrameworkVersion2,
|
|
22765
|
-
detectFrameworks: () => detectFrameworks2,
|
|
22766
|
-
removeSupersededFrameworks: () => removeSupersededFrameworks
|
|
22767
|
-
});
|
|
22768
|
-
module2.exports = __toCommonJS2(detect_framework_exports);
|
|
22769
|
-
var import_child_process2 = require("child_process");
|
|
22770
|
-
function shouldIncludeExperimentalFrameworks(useExperimentalFrameworks) {
|
|
22771
|
-
if (typeof useExperimentalFrameworks === "boolean") {
|
|
22772
|
-
return useExperimentalFrameworks;
|
|
22773
|
-
}
|
|
22774
|
-
const experimentalEnv = process.env.VERCEL_USE_EXPERIMENTAL_FRAMEWORKS;
|
|
22775
|
-
const isEnabled = (val) => val === "1" || typeof val === "string" && val.toLowerCase() === "true";
|
|
22776
|
-
return isEnabled(experimentalEnv);
|
|
22777
|
-
}
|
|
22778
|
-
function filterFrameworkList(frameworkList, useExperimentalFrameworks) {
|
|
22779
|
-
if (shouldIncludeExperimentalFrameworks(useExperimentalFrameworks)) {
|
|
22780
|
-
return frameworkList;
|
|
22781
|
-
}
|
|
22782
|
-
return frameworkList.filter((f) => {
|
|
22783
|
-
const experimental = f.experimental;
|
|
22784
|
-
return !experimental;
|
|
22785
|
-
});
|
|
22786
|
-
}
|
|
22787
|
-
async function matches(fs5, framework) {
|
|
22788
|
-
const { detectors } = framework;
|
|
22789
|
-
if (!detectors) {
|
|
22790
|
-
return;
|
|
22791
|
-
}
|
|
22792
|
-
const { every, some } = detectors;
|
|
22793
|
-
if (every !== void 0 && !Array.isArray(every)) {
|
|
22794
|
-
return;
|
|
22795
|
-
}
|
|
22796
|
-
if (some !== void 0 && !Array.isArray(some)) {
|
|
22797
|
-
return;
|
|
22798
|
-
}
|
|
22799
|
-
const check = async ({
|
|
22800
|
-
path: path6,
|
|
22801
|
-
matchContent,
|
|
22802
|
-
matchPackage
|
|
22803
|
-
}) => {
|
|
22804
|
-
if (matchPackage && matchContent) {
|
|
22805
|
-
throw new Error(
|
|
22806
|
-
`Cannot specify "matchPackage" and "matchContent" in the same detector for "${framework.slug}"`
|
|
22807
|
-
);
|
|
22808
|
-
}
|
|
22809
|
-
if (matchPackage && path6) {
|
|
22810
|
-
throw new Error(
|
|
22811
|
-
`Cannot specify "matchPackage" and "path" in the same detector for "${framework.slug}" because "path" is assumed to be "package.json".`
|
|
22812
|
-
);
|
|
22813
|
-
}
|
|
22814
|
-
if (!path6 && !matchPackage) {
|
|
22815
|
-
throw new Error(
|
|
22816
|
-
`Must specify either "path" or "matchPackage" in detector for "${framework.slug}".`
|
|
22817
|
-
);
|
|
22818
|
-
}
|
|
22819
|
-
if (!path6) {
|
|
22820
|
-
path6 = "package.json";
|
|
22821
|
-
}
|
|
22822
|
-
if (matchPackage) {
|
|
22823
|
-
matchContent = `"(dev)?(d|D)ependencies":\\s*{[^}]*"${matchPackage}":\\s*"(.+?)"[^}]*}`;
|
|
22824
|
-
}
|
|
22825
|
-
if (await fs5.hasPath(path6) === false) {
|
|
22826
|
-
return;
|
|
22827
|
-
}
|
|
22828
|
-
if (matchContent) {
|
|
22829
|
-
if (await fs5.isFile(path6) === false) {
|
|
22830
|
-
return;
|
|
22831
|
-
}
|
|
22832
|
-
const regex = new RegExp(matchContent, "m");
|
|
22833
|
-
const content = await fs5.readFile(path6);
|
|
22834
|
-
const match = content.toString().match(regex);
|
|
22835
|
-
if (!match) {
|
|
22836
|
-
return;
|
|
22837
|
-
}
|
|
22838
|
-
if (matchPackage && match[3]) {
|
|
22839
|
-
return {
|
|
22840
|
-
framework,
|
|
22841
|
-
detectedVersion: match[3]
|
|
22842
|
-
};
|
|
22843
|
-
}
|
|
22844
|
-
}
|
|
22845
|
-
return {
|
|
22846
|
-
framework
|
|
22847
|
-
};
|
|
22848
|
-
};
|
|
22849
|
-
const result = [];
|
|
22850
|
-
if (every) {
|
|
22851
|
-
const everyResult = await Promise.all(every.map((item) => check(item)));
|
|
22852
|
-
result.push(...everyResult);
|
|
22853
|
-
}
|
|
22854
|
-
if (some) {
|
|
22855
|
-
let someResult;
|
|
22856
|
-
for (const item of some) {
|
|
22857
|
-
const itemResult = await check(item);
|
|
22858
|
-
if (itemResult) {
|
|
22859
|
-
someResult = itemResult;
|
|
22860
|
-
break;
|
|
22861
|
-
}
|
|
22862
|
-
}
|
|
22863
|
-
result.push(someResult);
|
|
22864
|
-
}
|
|
22865
|
-
if (!result.every((res) => !!res)) {
|
|
22866
|
-
return;
|
|
22867
|
-
}
|
|
22868
|
-
const detectedVersion = result.find(
|
|
22869
|
-
(r) => typeof r === "object" && r.detectedVersion
|
|
22870
|
-
)?.detectedVersion;
|
|
22871
|
-
return {
|
|
22872
|
-
framework,
|
|
22873
|
-
detectedVersion
|
|
22874
|
-
};
|
|
22875
|
-
}
|
|
22876
|
-
function removeSupersededFramework(matches2, slug) {
|
|
22877
|
-
const index = matches2.findIndex((f) => f?.slug === slug);
|
|
22878
|
-
const framework = matches2[index];
|
|
22879
|
-
if (framework) {
|
|
22880
|
-
if (framework.supersedes) {
|
|
22881
|
-
for (const slug2 of framework.supersedes) {
|
|
22882
|
-
removeSupersededFramework(matches2, slug2);
|
|
22883
|
-
}
|
|
22884
|
-
}
|
|
22885
|
-
matches2.splice(index, 1);
|
|
22886
|
-
}
|
|
22887
|
-
}
|
|
22888
|
-
function removeSupersededFrameworks(matches2) {
|
|
22889
|
-
for (const match of matches2.slice()) {
|
|
22890
|
-
if (match?.supersedes) {
|
|
22891
|
-
for (const slug of match.supersedes) {
|
|
22892
|
-
removeSupersededFramework(matches2, slug);
|
|
22893
|
-
}
|
|
22894
|
-
}
|
|
22895
|
-
}
|
|
22896
|
-
}
|
|
22897
|
-
async function detectFramework2({
|
|
22898
|
-
fs: fs5,
|
|
22899
|
-
frameworkList,
|
|
22900
|
-
useExperimentalFrameworks
|
|
22901
|
-
}) {
|
|
22902
|
-
const filteredList = filterFrameworkList(
|
|
22903
|
-
frameworkList,
|
|
22904
|
-
useExperimentalFrameworks
|
|
22905
|
-
);
|
|
22906
|
-
const result = await Promise.all(
|
|
22907
|
-
filteredList.map(async (frameworkMatch) => {
|
|
22908
|
-
if (await matches(fs5, frameworkMatch)) {
|
|
22909
|
-
return frameworkMatch;
|
|
22910
|
-
}
|
|
22911
|
-
return null;
|
|
22912
|
-
})
|
|
22913
|
-
);
|
|
22914
|
-
removeSupersededFrameworks(result);
|
|
22915
|
-
return result.find((res) => res !== null)?.slug ?? null;
|
|
22916
|
-
}
|
|
22917
|
-
async function detectFrameworks2({
|
|
22918
|
-
fs: fs5,
|
|
22919
|
-
frameworkList,
|
|
22920
|
-
useExperimentalFrameworks
|
|
22921
|
-
}) {
|
|
22922
|
-
const filteredList = filterFrameworkList(
|
|
22923
|
-
frameworkList,
|
|
22924
|
-
useExperimentalFrameworks
|
|
22925
|
-
);
|
|
22926
|
-
const result = await Promise.all(
|
|
22927
|
-
filteredList.map(async (frameworkMatch) => {
|
|
22928
|
-
if (await matches(fs5, frameworkMatch)) {
|
|
22929
|
-
return frameworkMatch;
|
|
22930
|
-
}
|
|
22931
|
-
return null;
|
|
22932
|
-
})
|
|
22933
|
-
);
|
|
22934
|
-
removeSupersededFrameworks(result);
|
|
22935
|
-
return result.filter((res) => res !== null);
|
|
22936
|
-
}
|
|
22937
|
-
async function detectFrameworkRecord3({
|
|
22938
|
-
fs: fs5,
|
|
22939
|
-
frameworkList,
|
|
22940
|
-
useExperimentalFrameworks
|
|
22941
|
-
}) {
|
|
22942
|
-
const filteredList = filterFrameworkList(
|
|
22943
|
-
frameworkList,
|
|
22944
|
-
useExperimentalFrameworks
|
|
22945
|
-
);
|
|
22946
|
-
const result = await Promise.all(
|
|
22947
|
-
filteredList.map(async (frameworkMatch) => {
|
|
22948
|
-
const matchResult = await matches(fs5, frameworkMatch);
|
|
22949
|
-
if (matchResult) {
|
|
22950
|
-
return {
|
|
22951
|
-
...frameworkMatch,
|
|
22952
|
-
detectedVersion: matchResult?.detectedVersion
|
|
22953
|
-
};
|
|
22954
|
-
}
|
|
22955
|
-
return null;
|
|
22956
|
-
})
|
|
22957
|
-
);
|
|
22958
|
-
removeSupersededFrameworks(result);
|
|
22959
|
-
return result.find((res) => res !== null) ?? null;
|
|
22960
|
-
}
|
|
22961
|
-
function detectFrameworkVersion2(frameworkRecord) {
|
|
22962
|
-
const allDetectors = [
|
|
22963
|
-
...frameworkRecord.detectors?.every || [],
|
|
22964
|
-
...frameworkRecord.detectors?.some || []
|
|
22965
|
-
];
|
|
22966
|
-
const firstMatchPackage = allDetectors.find((d) => d.matchPackage);
|
|
22967
|
-
if (!firstMatchPackage?.matchPackage) {
|
|
22968
|
-
return;
|
|
22969
|
-
}
|
|
22970
|
-
return lookupInstalledVersion(
|
|
22971
|
-
process.execPath,
|
|
22972
|
-
firstMatchPackage.matchPackage
|
|
22973
|
-
);
|
|
22974
|
-
}
|
|
22975
|
-
function lookupInstalledVersion(cwd, packageName) {
|
|
22976
|
-
try {
|
|
22977
|
-
const script = `require('${packageName}/package.json').version`;
|
|
22978
|
-
return (0, import_child_process2.spawnSync)(cwd, ["-p", script], {
|
|
22979
|
-
encoding: "utf-8"
|
|
22980
|
-
}).stdout.trim();
|
|
22981
|
-
} catch (error) {
|
|
22982
|
-
console.debug(
|
|
22983
|
-
`Error looking up version of installed package "${packageName}": ${error}`
|
|
22984
|
-
);
|
|
22985
|
-
}
|
|
22986
|
-
return;
|
|
22987
|
-
}
|
|
22988
|
-
}
|
|
22989
|
-
});
|
|
22990
|
-
|
|
22991
23193
|
// ../fs-detectors/dist/services/auto-detect.js
|
|
22992
23194
|
var require_auto_detect = __commonJS({
|
|
22993
23195
|
"../fs-detectors/dist/services/auto-detect.js"(exports2, module2) {
|
|
@@ -23031,6 +23233,9 @@ var require_auto_detect = __commonJS({
|
|
|
23031
23233
|
var BACKEND_DIR = "backend";
|
|
23032
23234
|
var SERVICES_DIR = "services";
|
|
23033
23235
|
var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
|
|
23236
|
+
var DETECTION_FRAMEWORKS = import_frameworks2.default.filter(
|
|
23237
|
+
(framework) => !framework.experimental || framework.runtimeFramework
|
|
23238
|
+
);
|
|
23034
23239
|
async function autoDetectServices2(options) {
|
|
23035
23240
|
const { fs: fs5 } = options;
|
|
23036
23241
|
const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
@@ -23110,7 +23315,7 @@ var require_auto_detect = __commonJS({
|
|
|
23110
23315
|
const serviceName = frontendLocation.split("/").pop() || "frontend";
|
|
23111
23316
|
services[serviceName] = {
|
|
23112
23317
|
framework: frontendFramework.slug ?? void 0,
|
|
23113
|
-
|
|
23318
|
+
entrypoint: frontendLocation,
|
|
23114
23319
|
routePrefix: "/"
|
|
23115
23320
|
};
|
|
23116
23321
|
const backendResult = await detectBackendServices(fs5);
|
|
@@ -23191,7 +23396,8 @@ var require_auto_detect = __commonJS({
|
|
|
23191
23396
|
const serviceFs = fs5.chdir(dirPath);
|
|
23192
23397
|
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
23193
23398
|
fs: serviceFs,
|
|
23194
|
-
frameworkList:
|
|
23399
|
+
frameworkList: DETECTION_FRAMEWORKS,
|
|
23400
|
+
useExperimentalFrameworks: true
|
|
23195
23401
|
});
|
|
23196
23402
|
if (frameworks2.length > 1) {
|
|
23197
23403
|
const frameworkNames = frameworks2.map((f) => f.name).join(", ");
|
|
@@ -23208,7 +23414,7 @@ var require_auto_detect = __commonJS({
|
|
|
23208
23414
|
return {
|
|
23209
23415
|
service: {
|
|
23210
23416
|
framework: framework.slug ?? void 0,
|
|
23211
|
-
|
|
23417
|
+
entrypoint: dirPath,
|
|
23212
23418
|
routePrefix: `/_/${serviceName}`
|
|
23213
23419
|
}
|
|
23214
23420
|
};
|
|
@@ -23276,7 +23482,8 @@ var require_detect_services = __commonJS({
|
|
|
23276
23482
|
if (autoResult.services) {
|
|
23277
23483
|
const result2 = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
23278
23484
|
autoResult.services,
|
|
23279
|
-
scopedFs
|
|
23485
|
+
scopedFs,
|
|
23486
|
+
"generated"
|
|
23280
23487
|
);
|
|
23281
23488
|
const routes2 = generateServicesRoutes2(result2.services);
|
|
23282
23489
|
return {
|
|
@@ -23300,7 +23507,8 @@ var require_detect_services = __commonJS({
|
|
|
23300
23507
|
}
|
|
23301
23508
|
const result = await (0, import_resolve.resolveAllConfiguredServices)(
|
|
23302
23509
|
configuredServices,
|
|
23303
|
-
scopedFs
|
|
23510
|
+
scopedFs,
|
|
23511
|
+
"configured"
|
|
23304
23512
|
);
|
|
23305
23513
|
const routes = generateServicesRoutes2(result.services);
|
|
23306
23514
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.41",
|
|
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.0.139",
|
|
19
|
+
"@vercel/static-config": "3.1.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/aws-lambda": "8.10.64",
|
|
@@ -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.5.0",
|
|
41
42
|
"@vercel/error-utils": "2.0.3",
|
|
42
|
-
"@vercel/frameworks": "3.
|
|
43
|
-
"@vercel/
|
|
44
|
-
"@vercel/fs-detectors": "5.8.8",
|
|
43
|
+
"@vercel/frameworks": "3.19.0",
|
|
44
|
+
"@vercel/fs-detectors": "5.8.10",
|
|
45
45
|
"@vercel/routing-utils": "5.3.3"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|