@vercel/static-build 2.8.27 → 2.8.29
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 +1003 -478
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -11994,6 +11994,150 @@ var require_frameworks = __commonJS({
|
|
|
11994
11994
|
}
|
|
11995
11995
|
]
|
|
11996
11996
|
},
|
|
11997
|
+
{
|
|
11998
|
+
name: "Ruby",
|
|
11999
|
+
slug: "ruby",
|
|
12000
|
+
experimental: true,
|
|
12001
|
+
runtimeFramework: true,
|
|
12002
|
+
logo: "https://api-frameworks.vercel.sh/framework-logos/ruby.svg",
|
|
12003
|
+
tagline: "A dynamic, open source programming language with a focus on simplicity and productivity.",
|
|
12004
|
+
description: "A generic Ruby application deployed as a serverless function.",
|
|
12005
|
+
website: "https://www.ruby-lang.org",
|
|
12006
|
+
useRuntime: { src: "config.ru", use: "@vercel/ruby" },
|
|
12007
|
+
ignoreRuntimes: ["@vercel/ruby"],
|
|
12008
|
+
detectors: {
|
|
12009
|
+
every: [
|
|
12010
|
+
{
|
|
12011
|
+
path: "config.ru"
|
|
12012
|
+
},
|
|
12013
|
+
{
|
|
12014
|
+
path: "Gemfile"
|
|
12015
|
+
}
|
|
12016
|
+
]
|
|
12017
|
+
},
|
|
12018
|
+
settings: {
|
|
12019
|
+
installCommand: {
|
|
12020
|
+
placeholder: "`bundle install`"
|
|
12021
|
+
},
|
|
12022
|
+
buildCommand: {
|
|
12023
|
+
placeholder: "None",
|
|
12024
|
+
value: null
|
|
12025
|
+
},
|
|
12026
|
+
devCommand: {
|
|
12027
|
+
placeholder: "None",
|
|
12028
|
+
value: null
|
|
12029
|
+
},
|
|
12030
|
+
outputDirectory: {
|
|
12031
|
+
value: "N/A"
|
|
12032
|
+
}
|
|
12033
|
+
},
|
|
12034
|
+
getOutputDirName: async () => "public",
|
|
12035
|
+
defaultRoutes: [
|
|
12036
|
+
{
|
|
12037
|
+
handle: "filesystem"
|
|
12038
|
+
},
|
|
12039
|
+
{
|
|
12040
|
+
src: "/(.*)",
|
|
12041
|
+
dest: "/config"
|
|
12042
|
+
}
|
|
12043
|
+
]
|
|
12044
|
+
},
|
|
12045
|
+
{
|
|
12046
|
+
name: "Rust",
|
|
12047
|
+
slug: "rust",
|
|
12048
|
+
experimental: true,
|
|
12049
|
+
runtimeFramework: true,
|
|
12050
|
+
logo: "https://api-frameworks.vercel.sh/framework-logos/rust.svg",
|
|
12051
|
+
tagline: "A language empowering everyone to build reliable and efficient software.",
|
|
12052
|
+
description: "A generic Rust application deployed as a serverless function.",
|
|
12053
|
+
website: "https://www.rust-lang.org",
|
|
12054
|
+
useRuntime: { src: "src/main.rs", use: "@vercel/rust" },
|
|
12055
|
+
ignoreRuntimes: ["@vercel/rust"],
|
|
12056
|
+
detectors: {
|
|
12057
|
+
every: [
|
|
12058
|
+
{
|
|
12059
|
+
path: "Cargo.toml"
|
|
12060
|
+
},
|
|
12061
|
+
{
|
|
12062
|
+
path: "src/main.rs"
|
|
12063
|
+
}
|
|
12064
|
+
]
|
|
12065
|
+
},
|
|
12066
|
+
settings: {
|
|
12067
|
+
installCommand: {
|
|
12068
|
+
placeholder: "None"
|
|
12069
|
+
},
|
|
12070
|
+
buildCommand: {
|
|
12071
|
+
placeholder: "None",
|
|
12072
|
+
value: null
|
|
12073
|
+
},
|
|
12074
|
+
devCommand: {
|
|
12075
|
+
placeholder: "`cargo run`",
|
|
12076
|
+
value: null
|
|
12077
|
+
},
|
|
12078
|
+
outputDirectory: {
|
|
12079
|
+
value: "N/A"
|
|
12080
|
+
}
|
|
12081
|
+
},
|
|
12082
|
+
getOutputDirName: async () => "public",
|
|
12083
|
+
defaultRoutes: [
|
|
12084
|
+
{
|
|
12085
|
+
handle: "filesystem"
|
|
12086
|
+
},
|
|
12087
|
+
{
|
|
12088
|
+
src: "/(.*)",
|
|
12089
|
+
dest: "/src/main"
|
|
12090
|
+
}
|
|
12091
|
+
]
|
|
12092
|
+
},
|
|
12093
|
+
{
|
|
12094
|
+
name: "Node",
|
|
12095
|
+
slug: "node",
|
|
12096
|
+
experimental: true,
|
|
12097
|
+
runtimeFramework: true,
|
|
12098
|
+
logo: "https://api-frameworks.vercel.sh/framework-logos/node.svg",
|
|
12099
|
+
tagline: "Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.",
|
|
12100
|
+
description: "A generic Node.js application deployed as a serverless function.",
|
|
12101
|
+
website: "https://nodejs.org",
|
|
12102
|
+
useRuntime: { src: "server.ts", use: "@vercel/backends" },
|
|
12103
|
+
ignoreRuntimes: ["@vercel/node"],
|
|
12104
|
+
detectors: {
|
|
12105
|
+
every: [
|
|
12106
|
+
{
|
|
12107
|
+
path: "server.ts"
|
|
12108
|
+
},
|
|
12109
|
+
{
|
|
12110
|
+
path: "package.json"
|
|
12111
|
+
}
|
|
12112
|
+
]
|
|
12113
|
+
},
|
|
12114
|
+
settings: {
|
|
12115
|
+
installCommand: {
|
|
12116
|
+
placeholder: "`yarn install`, `pnpm install`, `npm install`, or `bun install`"
|
|
12117
|
+
},
|
|
12118
|
+
buildCommand: {
|
|
12119
|
+
placeholder: "None",
|
|
12120
|
+
value: null
|
|
12121
|
+
},
|
|
12122
|
+
devCommand: {
|
|
12123
|
+
placeholder: "`npm run dev` or `npx ts-node server.ts`",
|
|
12124
|
+
value: null
|
|
12125
|
+
},
|
|
12126
|
+
outputDirectory: {
|
|
12127
|
+
value: "N/A"
|
|
12128
|
+
}
|
|
12129
|
+
},
|
|
12130
|
+
getOutputDirName: async () => "public",
|
|
12131
|
+
defaultRoutes: [
|
|
12132
|
+
{
|
|
12133
|
+
handle: "filesystem"
|
|
12134
|
+
},
|
|
12135
|
+
{
|
|
12136
|
+
src: "/(.*)",
|
|
12137
|
+
dest: "/"
|
|
12138
|
+
}
|
|
12139
|
+
]
|
|
12140
|
+
},
|
|
11997
12141
|
{
|
|
11998
12142
|
name: "Services",
|
|
11999
12143
|
slug: "services",
|
|
@@ -19530,9 +19674,148 @@ var require_is_official_runtime = __commonJS({
|
|
|
19530
19674
|
}
|
|
19531
19675
|
});
|
|
19532
19676
|
|
|
19533
|
-
// ../fs-detectors/dist/
|
|
19534
|
-
var
|
|
19535
|
-
"../fs-detectors/dist/
|
|
19677
|
+
// ../fs-detectors/dist/services/types.js
|
|
19678
|
+
var require_types2 = __commonJS({
|
|
19679
|
+
"../fs-detectors/dist/services/types.js"(exports2, module2) {
|
|
19680
|
+
"use strict";
|
|
19681
|
+
var __defProp2 = Object.defineProperty;
|
|
19682
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
19683
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
19684
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
19685
|
+
var __export2 = (target, all) => {
|
|
19686
|
+
for (var name in all)
|
|
19687
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
19688
|
+
};
|
|
19689
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
19690
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19691
|
+
for (let key of __getOwnPropNames2(from))
|
|
19692
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
19693
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
19694
|
+
}
|
|
19695
|
+
return to;
|
|
19696
|
+
};
|
|
19697
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
19698
|
+
var types_exports = {};
|
|
19699
|
+
__export2(types_exports, {
|
|
19700
|
+
ENTRYPOINT_EXTENSIONS: () => ENTRYPOINT_EXTENSIONS,
|
|
19701
|
+
RUNTIME_BUILDERS: () => RUNTIME_BUILDERS,
|
|
19702
|
+
STATIC_BUILDERS: () => STATIC_BUILDERS
|
|
19703
|
+
});
|
|
19704
|
+
module2.exports = __toCommonJS2(types_exports);
|
|
19705
|
+
var RUNTIME_BUILDERS = {
|
|
19706
|
+
node: "@vercel/node",
|
|
19707
|
+
python: "@vercel/python",
|
|
19708
|
+
go: "@vercel/go",
|
|
19709
|
+
rust: "@vercel/rust",
|
|
19710
|
+
ruby: "@vercel/ruby"
|
|
19711
|
+
};
|
|
19712
|
+
var ENTRYPOINT_EXTENSIONS = {
|
|
19713
|
+
".ts": "node",
|
|
19714
|
+
".mts": "node",
|
|
19715
|
+
".js": "node",
|
|
19716
|
+
".mjs": "node",
|
|
19717
|
+
".cjs": "node",
|
|
19718
|
+
".py": "python",
|
|
19719
|
+
".go": "go",
|
|
19720
|
+
".rs": "rust",
|
|
19721
|
+
".rb": "ruby",
|
|
19722
|
+
".ru": "ruby"
|
|
19723
|
+
};
|
|
19724
|
+
var STATIC_BUILDERS = /* @__PURE__ */ new Set([
|
|
19725
|
+
"@vercel/static-build",
|
|
19726
|
+
"@vercel/static"
|
|
19727
|
+
]);
|
|
19728
|
+
}
|
|
19729
|
+
});
|
|
19730
|
+
|
|
19731
|
+
// ../fs-detectors/dist/services/utils.js
|
|
19732
|
+
var require_utils4 = __commonJS({
|
|
19733
|
+
"../fs-detectors/dist/services/utils.js"(exports2, module2) {
|
|
19734
|
+
"use strict";
|
|
19735
|
+
var __defProp2 = Object.defineProperty;
|
|
19736
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
19737
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
19738
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
19739
|
+
var __export2 = (target, all) => {
|
|
19740
|
+
for (var name in all)
|
|
19741
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
19742
|
+
};
|
|
19743
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
19744
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19745
|
+
for (let key of __getOwnPropNames2(from))
|
|
19746
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
19747
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
19748
|
+
}
|
|
19749
|
+
return to;
|
|
19750
|
+
};
|
|
19751
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
19752
|
+
var utils_exports = {};
|
|
19753
|
+
__export2(utils_exports, {
|
|
19754
|
+
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
19755
|
+
inferServiceRuntime: () => inferServiceRuntime,
|
|
19756
|
+
readVercelConfig: () => readVercelConfig
|
|
19757
|
+
});
|
|
19758
|
+
module2.exports = __toCommonJS2(utils_exports);
|
|
19759
|
+
var import_framework_helpers = require("@vercel/build-utils/dist/framework-helpers");
|
|
19760
|
+
var import_types = require_types2();
|
|
19761
|
+
function getBuilderForRuntime(runtime) {
|
|
19762
|
+
const builder = import_types.RUNTIME_BUILDERS[runtime];
|
|
19763
|
+
if (!builder) {
|
|
19764
|
+
throw new Error(`Unknown runtime: ${runtime}`);
|
|
19765
|
+
}
|
|
19766
|
+
return builder;
|
|
19767
|
+
}
|
|
19768
|
+
function inferServiceRuntime(config) {
|
|
19769
|
+
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
19770
|
+
return config.runtime;
|
|
19771
|
+
}
|
|
19772
|
+
if ((0, import_framework_helpers.isPythonFramework)(config.framework)) {
|
|
19773
|
+
return "python";
|
|
19774
|
+
}
|
|
19775
|
+
if ((0, import_framework_helpers.isBackendFramework)(config.framework)) {
|
|
19776
|
+
return "node";
|
|
19777
|
+
}
|
|
19778
|
+
if (config.builder) {
|
|
19779
|
+
for (const [runtime, builderName] of Object.entries(import_types.RUNTIME_BUILDERS)) {
|
|
19780
|
+
if (config.builder === builderName) {
|
|
19781
|
+
return runtime;
|
|
19782
|
+
}
|
|
19783
|
+
}
|
|
19784
|
+
}
|
|
19785
|
+
if (config.entrypoint) {
|
|
19786
|
+
for (const [ext, runtime] of Object.entries(import_types.ENTRYPOINT_EXTENSIONS)) {
|
|
19787
|
+
if (config.entrypoint.endsWith(ext)) {
|
|
19788
|
+
return runtime;
|
|
19789
|
+
}
|
|
19790
|
+
}
|
|
19791
|
+
}
|
|
19792
|
+
return void 0;
|
|
19793
|
+
}
|
|
19794
|
+
async function readVercelConfig(fs5) {
|
|
19795
|
+
const hasVercelJson = await fs5.hasPath("vercel.json");
|
|
19796
|
+
if (!hasVercelJson) {
|
|
19797
|
+
return { config: null, error: null };
|
|
19798
|
+
}
|
|
19799
|
+
try {
|
|
19800
|
+
const content = await fs5.readFile("vercel.json");
|
|
19801
|
+
const config = JSON.parse(content.toString());
|
|
19802
|
+
return { config, error: null };
|
|
19803
|
+
} catch {
|
|
19804
|
+
return {
|
|
19805
|
+
config: null,
|
|
19806
|
+
error: {
|
|
19807
|
+
code: "INVALID_VERCEL_JSON",
|
|
19808
|
+
message: "Failed to parse vercel.json. Ensure it contains valid JSON."
|
|
19809
|
+
}
|
|
19810
|
+
};
|
|
19811
|
+
}
|
|
19812
|
+
}
|
|
19813
|
+
}
|
|
19814
|
+
});
|
|
19815
|
+
|
|
19816
|
+
// ../fs-detectors/dist/services/resolve.js
|
|
19817
|
+
var require_resolve = __commonJS({
|
|
19818
|
+
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
19536
19819
|
"use strict";
|
|
19537
19820
|
var __create2 = Object.create;
|
|
19538
19821
|
var __defProp2 = Object.defineProperty;
|
|
@@ -19561,62 +19844,659 @@ var require_detect_builders = __commonJS({
|
|
|
19561
19844
|
mod
|
|
19562
19845
|
));
|
|
19563
19846
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
19564
|
-
var
|
|
19565
|
-
__export2(
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
detectApiDirectory: () => detectApiDirectory2,
|
|
19570
|
-
detectApiExtensions: () => detectApiExtensions2,
|
|
19571
|
-
detectBuilders: () => detectBuilders2,
|
|
19572
|
-
detectOutputDirectory: () => detectOutputDirectory2,
|
|
19573
|
-
sortFiles: () => sortFiles
|
|
19847
|
+
var resolve_exports = {};
|
|
19848
|
+
__export2(resolve_exports, {
|
|
19849
|
+
resolveAllConfiguredServices: () => resolveAllConfiguredServices,
|
|
19850
|
+
resolveConfiguredService: () => resolveConfiguredService,
|
|
19851
|
+
validateServiceConfig: () => validateServiceConfig
|
|
19574
19852
|
});
|
|
19575
|
-
module2.exports = __toCommonJS2(
|
|
19576
|
-
var import_minimatch = __toESM2(require_minimatch());
|
|
19577
|
-
var import_semver2 = require_semver3();
|
|
19853
|
+
module2.exports = __toCommonJS2(resolve_exports);
|
|
19578
19854
|
var import_path7 = require("path");
|
|
19855
|
+
var import_types = require_types2();
|
|
19856
|
+
var import_utils = require_utils4();
|
|
19579
19857
|
var import_frameworks2 = __toESM2(require_frameworks());
|
|
19580
|
-
var
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
function sortFiles(fileA, fileB) {
|
|
19589
|
-
return fileA.localeCompare(fileB);
|
|
19590
|
-
}
|
|
19591
|
-
function detectApiExtensions2(builders) {
|
|
19592
|
-
return new Set(
|
|
19593
|
-
builders.filter(
|
|
19594
|
-
(b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith("api/"))
|
|
19595
|
-
).map((b) => (0, import_path7.extname)(b.src)).filter(Boolean)
|
|
19596
|
-
);
|
|
19597
|
-
}
|
|
19598
|
-
function detectApiDirectory2(builders) {
|
|
19599
|
-
const found = builders.some(
|
|
19600
|
-
(b) => b.config && b.config.zeroConfig && b.src?.startsWith("api/")
|
|
19601
|
-
);
|
|
19602
|
-
return found ? "api" : null;
|
|
19603
|
-
}
|
|
19604
|
-
function getPublicBuilder(builders) {
|
|
19605
|
-
for (const builder of builders) {
|
|
19606
|
-
if (typeof builder.src === "string" && (0, import_is_official_runtime.isOfficialRuntime)("static", builder.use) && /^.*\/\*\*\/\*$/.test(builder.src) && builder.config?.zeroConfig === true) {
|
|
19607
|
-
return builder;
|
|
19608
|
-
}
|
|
19858
|
+
var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
|
|
19859
|
+
function validateServiceConfig(name, config) {
|
|
19860
|
+
if (!config || typeof config !== "object") {
|
|
19861
|
+
return {
|
|
19862
|
+
code: "INVALID_SERVICE_CONFIG",
|
|
19863
|
+
message: `Service "${name}" has an invalid configuration. Expected an object.`,
|
|
19864
|
+
serviceName: name
|
|
19865
|
+
};
|
|
19609
19866
|
}
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19867
|
+
const serviceType = config.type || "web";
|
|
19868
|
+
if (serviceType === "web" && !config.routePrefix) {
|
|
19869
|
+
return {
|
|
19870
|
+
code: "MISSING_ROUTE_PREFIX",
|
|
19871
|
+
message: `Web service "${name}" must specify "routePrefix".`,
|
|
19872
|
+
serviceName: name
|
|
19873
|
+
};
|
|
19874
|
+
}
|
|
19875
|
+
if ((serviceType === "worker" || serviceType === "cron") && config.routePrefix) {
|
|
19876
|
+
return {
|
|
19877
|
+
code: "INVALID_ROUTE_PREFIX",
|
|
19878
|
+
message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "routePrefix". Only web services should specify "routePrefix".`,
|
|
19879
|
+
serviceName: name
|
|
19880
|
+
};
|
|
19881
|
+
}
|
|
19882
|
+
if (serviceType === "cron" && !config.schedule) {
|
|
19883
|
+
return {
|
|
19884
|
+
code: "MISSING_CRON_SCHEDULE",
|
|
19885
|
+
message: `Cron service "${name}" is missing required "schedule" field.`,
|
|
19886
|
+
serviceName: name
|
|
19887
|
+
};
|
|
19888
|
+
}
|
|
19889
|
+
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
19890
|
+
return {
|
|
19891
|
+
code: "INVALID_RUNTIME",
|
|
19892
|
+
message: `Service "${name}" has invalid runtime "${config.runtime}".`,
|
|
19893
|
+
serviceName: name
|
|
19894
|
+
};
|
|
19895
|
+
}
|
|
19896
|
+
if (config.framework && !frameworksBySlug.has(config.framework)) {
|
|
19897
|
+
return {
|
|
19898
|
+
code: "INVALID_FRAMEWORK",
|
|
19899
|
+
message: `Service "${name}" has invalid framework "${config.framework}".`,
|
|
19900
|
+
serviceName: name
|
|
19901
|
+
};
|
|
19902
|
+
}
|
|
19903
|
+
const hasFramework = Boolean(config.framework);
|
|
19904
|
+
const hasBuilderOrRuntime = Boolean(config.builder || config.runtime);
|
|
19905
|
+
const hasEntrypoint = Boolean(config.entrypoint);
|
|
19906
|
+
if (!hasFramework && !hasBuilderOrRuntime && !hasEntrypoint) {
|
|
19907
|
+
return {
|
|
19908
|
+
code: "MISSING_SERVICE_CONFIG",
|
|
19909
|
+
message: `Service "${name}" must specify "framework", "entrypoint", or both "builder"/"runtime" with "entrypoint".`,
|
|
19910
|
+
serviceName: name
|
|
19911
|
+
};
|
|
19912
|
+
}
|
|
19913
|
+
if (hasBuilderOrRuntime && !hasFramework && !hasEntrypoint) {
|
|
19914
|
+
return {
|
|
19915
|
+
code: "MISSING_ENTRYPOINT",
|
|
19916
|
+
message: `Service "${name}" must specify "entrypoint" when using "${config.builder ? "builder" : "runtime"}".`,
|
|
19917
|
+
serviceName: name
|
|
19918
|
+
};
|
|
19919
|
+
}
|
|
19920
|
+
if (hasEntrypoint && !hasBuilderOrRuntime && !hasFramework) {
|
|
19921
|
+
const runtime = (0, import_utils.inferServiceRuntime)({ entrypoint: config.entrypoint });
|
|
19922
|
+
if (!runtime) {
|
|
19923
|
+
const supported = Object.keys(import_types.ENTRYPOINT_EXTENSIONS).join(", ");
|
|
19924
|
+
return {
|
|
19925
|
+
code: "UNSUPPORTED_ENTRYPOINT",
|
|
19926
|
+
message: `Service "${name}" has unsupported entrypoint "${config.entrypoint}". Use a supported extension (${supported}) or specify "builder", "framework", or "runtime".`,
|
|
19927
|
+
serviceName: name
|
|
19928
|
+
};
|
|
19929
|
+
}
|
|
19930
|
+
}
|
|
19931
|
+
return null;
|
|
19932
|
+
}
|
|
19933
|
+
function resolveConfiguredService(name, config, group) {
|
|
19934
|
+
const type = config.type || "web";
|
|
19935
|
+
const workspace = config.workspace || ".";
|
|
19936
|
+
const topic = type === "worker" ? config.topic || "default" : config.topic;
|
|
19937
|
+
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
19938
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)(config);
|
|
19939
|
+
let builderUse;
|
|
19940
|
+
let builderSrc;
|
|
19941
|
+
if (config.framework) {
|
|
19942
|
+
const framework = frameworksBySlug.get(config.framework);
|
|
19943
|
+
builderUse = framework?.useRuntime?.use || "@vercel/static-build";
|
|
19944
|
+
builderSrc = config.entrypoint || framework?.useRuntime?.src || "package.json";
|
|
19945
|
+
} else if (config.builder) {
|
|
19946
|
+
builderUse = config.builder;
|
|
19947
|
+
builderSrc = config.entrypoint;
|
|
19948
|
+
} else {
|
|
19949
|
+
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
19950
|
+
builderSrc = config.entrypoint;
|
|
19951
|
+
}
|
|
19952
|
+
const routePrefix = type === "web" ? config.routePrefix : void 0;
|
|
19953
|
+
const isRoot = workspace === ".";
|
|
19954
|
+
if (!isRoot && !builderSrc.startsWith(workspace + "/")) {
|
|
19955
|
+
builderSrc = import_path7.posix.join(workspace, builderSrc);
|
|
19956
|
+
}
|
|
19957
|
+
const builderConfig = {};
|
|
19958
|
+
if (config.memory)
|
|
19959
|
+
builderConfig.memory = config.memory;
|
|
19960
|
+
if (config.maxDuration)
|
|
19961
|
+
builderConfig.maxDuration = config.maxDuration;
|
|
19962
|
+
if (config.includeFiles)
|
|
19963
|
+
builderConfig.includeFiles = config.includeFiles;
|
|
19964
|
+
if (config.excludeFiles)
|
|
19965
|
+
builderConfig.excludeFiles = config.excludeFiles;
|
|
19966
|
+
const isStaticBuild = import_types.STATIC_BUILDERS.has(builderUse);
|
|
19967
|
+
const runtime = isStaticBuild ? void 0 : inferredRuntime;
|
|
19968
|
+
return {
|
|
19969
|
+
name,
|
|
19970
|
+
type,
|
|
19971
|
+
group,
|
|
19972
|
+
workspace,
|
|
19973
|
+
entrypoint: config.entrypoint,
|
|
19974
|
+
routePrefix,
|
|
19975
|
+
framework: config.framework,
|
|
19976
|
+
builder: {
|
|
19977
|
+
src: builderSrc,
|
|
19978
|
+
use: builderUse,
|
|
19979
|
+
config: Object.keys(builderConfig).length > 0 ? builderConfig : void 0
|
|
19980
|
+
},
|
|
19981
|
+
runtime,
|
|
19982
|
+
buildCommand: config.buildCommand,
|
|
19983
|
+
installCommand: config.installCommand,
|
|
19984
|
+
schedule: config.schedule,
|
|
19985
|
+
topic,
|
|
19986
|
+
consumer
|
|
19987
|
+
};
|
|
19988
|
+
}
|
|
19989
|
+
function resolveAllConfiguredServices(services) {
|
|
19990
|
+
const resolved = [];
|
|
19991
|
+
const errors = [];
|
|
19992
|
+
for (const name of Object.keys(services)) {
|
|
19993
|
+
const serviceConfig = services[name];
|
|
19994
|
+
const validationError = validateServiceConfig(name, serviceConfig);
|
|
19995
|
+
if (validationError) {
|
|
19996
|
+
errors.push(validationError);
|
|
19997
|
+
continue;
|
|
19998
|
+
}
|
|
19999
|
+
const service = resolveConfiguredService(name, serviceConfig);
|
|
20000
|
+
resolved.push(service);
|
|
20001
|
+
}
|
|
20002
|
+
return { services: resolved, errors };
|
|
20003
|
+
}
|
|
20004
|
+
}
|
|
20005
|
+
});
|
|
20006
|
+
|
|
20007
|
+
// ../fs-detectors/dist/services/detect-services.js
|
|
20008
|
+
var require_detect_services = __commonJS({
|
|
20009
|
+
"../fs-detectors/dist/services/detect-services.js"(exports2, module2) {
|
|
20010
|
+
"use strict";
|
|
20011
|
+
var __defProp2 = Object.defineProperty;
|
|
20012
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20013
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20014
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20015
|
+
var __export2 = (target, all) => {
|
|
20016
|
+
for (var name in all)
|
|
20017
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20018
|
+
};
|
|
20019
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20020
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20021
|
+
for (let key of __getOwnPropNames2(from))
|
|
20022
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20023
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20024
|
+
}
|
|
20025
|
+
return to;
|
|
20026
|
+
};
|
|
20027
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20028
|
+
var detect_services_exports = {};
|
|
20029
|
+
__export2(detect_services_exports, {
|
|
20030
|
+
detectServices: () => detectServices2,
|
|
20031
|
+
generateServicesRoutes: () => generateServicesRoutes2
|
|
20032
|
+
});
|
|
20033
|
+
module2.exports = __toCommonJS2(detect_services_exports);
|
|
20034
|
+
var import_utils = require_utils4();
|
|
20035
|
+
var import_resolve = require_resolve();
|
|
20036
|
+
async function detectServices2(options) {
|
|
20037
|
+
const { fs: fs5, workPath } = options;
|
|
20038
|
+
const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
|
|
20039
|
+
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
20040
|
+
if (configError) {
|
|
20041
|
+
return {
|
|
20042
|
+
services: [],
|
|
20043
|
+
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
20044
|
+
errors: [configError],
|
|
20045
|
+
warnings: []
|
|
20046
|
+
};
|
|
20047
|
+
}
|
|
20048
|
+
const configuredServices = vercelConfig?.experimentalServices;
|
|
20049
|
+
const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
|
|
20050
|
+
if (!hasConfiguredServices) {
|
|
20051
|
+
return {
|
|
20052
|
+
services: [],
|
|
20053
|
+
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
20054
|
+
errors: [
|
|
20055
|
+
{
|
|
20056
|
+
code: "NO_SERVICES_CONFIGURED",
|
|
20057
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
20058
|
+
}
|
|
20059
|
+
],
|
|
20060
|
+
warnings: []
|
|
20061
|
+
};
|
|
20062
|
+
}
|
|
20063
|
+
const result = (0, import_resolve.resolveAllConfiguredServices)(configuredServices);
|
|
20064
|
+
const routes = generateServicesRoutes2(result.services);
|
|
20065
|
+
return {
|
|
20066
|
+
services: result.services,
|
|
20067
|
+
routes,
|
|
20068
|
+
errors: result.errors,
|
|
20069
|
+
warnings: []
|
|
20070
|
+
};
|
|
20071
|
+
}
|
|
20072
|
+
function generateServicesRoutes2(services) {
|
|
20073
|
+
const rewrites = [];
|
|
20074
|
+
const defaults = [];
|
|
20075
|
+
const crons = [];
|
|
20076
|
+
const workers = [];
|
|
20077
|
+
const webServices = services.filter(
|
|
20078
|
+
(s) => s.type === "web" && typeof s.routePrefix === "string"
|
|
20079
|
+
);
|
|
20080
|
+
const sortedWebServices = [...webServices].sort((a, b) => {
|
|
20081
|
+
if (a.routePrefix === "/")
|
|
20082
|
+
return 1;
|
|
20083
|
+
if (b.routePrefix === "/")
|
|
20084
|
+
return -1;
|
|
20085
|
+
return b.routePrefix.length - a.routePrefix.length;
|
|
20086
|
+
});
|
|
20087
|
+
for (const service of sortedWebServices) {
|
|
20088
|
+
const { routePrefix, builder } = service;
|
|
20089
|
+
const builderSrc = builder.src || routePrefix;
|
|
20090
|
+
const functionPath = builderSrc.startsWith("/") ? builderSrc : `/${builderSrc}`;
|
|
20091
|
+
if (routePrefix === "/") {
|
|
20092
|
+
defaults.push({
|
|
20093
|
+
src: "^/(.*)$",
|
|
20094
|
+
dest: functionPath,
|
|
20095
|
+
check: true
|
|
20096
|
+
});
|
|
20097
|
+
} else {
|
|
20098
|
+
const normalizedPrefix = routePrefix.startsWith("/") ? routePrefix.slice(1) : routePrefix;
|
|
20099
|
+
rewrites.push({
|
|
20100
|
+
src: `^/${normalizedPrefix}(?:/.*)?$`,
|
|
20101
|
+
dest: functionPath,
|
|
20102
|
+
check: true
|
|
20103
|
+
});
|
|
20104
|
+
}
|
|
20105
|
+
}
|
|
20106
|
+
return { rewrites, defaults, crons, workers };
|
|
20107
|
+
}
|
|
20108
|
+
}
|
|
20109
|
+
});
|
|
20110
|
+
|
|
20111
|
+
// ../fs-detectors/dist/detectors/filesystem.js
|
|
20112
|
+
var require_filesystem = __commonJS({
|
|
20113
|
+
"../fs-detectors/dist/detectors/filesystem.js"(exports2, module2) {
|
|
20114
|
+
"use strict";
|
|
20115
|
+
var __defProp2 = Object.defineProperty;
|
|
20116
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20117
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20118
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20119
|
+
var __export2 = (target, all) => {
|
|
20120
|
+
for (var name in all)
|
|
20121
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20122
|
+
};
|
|
20123
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20124
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20125
|
+
for (let key of __getOwnPropNames2(from))
|
|
20126
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20127
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20128
|
+
}
|
|
20129
|
+
return to;
|
|
20130
|
+
};
|
|
20131
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20132
|
+
var filesystem_exports = {};
|
|
20133
|
+
__export2(filesystem_exports, {
|
|
20134
|
+
DetectorFilesystem: () => DetectorFilesystem2
|
|
20135
|
+
});
|
|
20136
|
+
module2.exports = __toCommonJS2(filesystem_exports);
|
|
20137
|
+
var import_path7 = require("path");
|
|
20138
|
+
var DetectorFilesystem2 = class {
|
|
20139
|
+
constructor() {
|
|
20140
|
+
this.hasPath = async (path6) => {
|
|
20141
|
+
let p = this.pathCache.get(path6);
|
|
20142
|
+
if (!p) {
|
|
20143
|
+
p = this._hasPath(path6);
|
|
20144
|
+
this.pathCache.set(path6, p);
|
|
20145
|
+
}
|
|
20146
|
+
return p;
|
|
20147
|
+
};
|
|
20148
|
+
this.isFile = async (name) => {
|
|
20149
|
+
let p = this.fileCache.get(name);
|
|
20150
|
+
if (!p) {
|
|
20151
|
+
p = this._isFile(name);
|
|
20152
|
+
this.fileCache.set(name, p);
|
|
20153
|
+
}
|
|
20154
|
+
return p;
|
|
20155
|
+
};
|
|
20156
|
+
this.readFile = async (name) => {
|
|
20157
|
+
let p = this.readFileCache.get(name);
|
|
20158
|
+
if (!p) {
|
|
20159
|
+
p = this._readFile(name);
|
|
20160
|
+
this.readFileCache.set(name, p);
|
|
20161
|
+
}
|
|
20162
|
+
return p;
|
|
20163
|
+
};
|
|
20164
|
+
this.readdir = async (dirPath, options) => {
|
|
20165
|
+
let p = this.readdirCache.get(dirPath);
|
|
20166
|
+
if (!p) {
|
|
20167
|
+
p = this._readdir(dirPath);
|
|
20168
|
+
this.readdirCache.set(dirPath, p);
|
|
20169
|
+
}
|
|
20170
|
+
const directoryContent = await p;
|
|
20171
|
+
const directoryFiles = /* @__PURE__ */ new Set();
|
|
20172
|
+
for (const file of directoryContent) {
|
|
20173
|
+
if (file.type === "file") {
|
|
20174
|
+
this.fileCache.set(file.path, Promise.resolve(true));
|
|
20175
|
+
this.pathCache.set(file.path, Promise.resolve(true));
|
|
20176
|
+
directoryFiles.add(file.name);
|
|
20177
|
+
}
|
|
20178
|
+
}
|
|
20179
|
+
if (options?.potentialFiles) {
|
|
20180
|
+
const filesInReaddirDir = options.potentialFiles.filter(
|
|
20181
|
+
(path6) => (0, import_path7.basename)(path6) === path6
|
|
20182
|
+
);
|
|
20183
|
+
const filesThatDoNotExist = filesInReaddirDir.filter(
|
|
20184
|
+
(path6) => !directoryFiles.has(path6)
|
|
20185
|
+
);
|
|
20186
|
+
for (const filePath of filesThatDoNotExist) {
|
|
20187
|
+
const fullFilePath = dirPath === "/" ? filePath : import_path7.posix.join(dirPath, filePath);
|
|
20188
|
+
this.fileCache.set(fullFilePath, Promise.resolve(false));
|
|
20189
|
+
this.pathCache.set(fullFilePath, Promise.resolve(false));
|
|
20190
|
+
}
|
|
20191
|
+
}
|
|
20192
|
+
return p;
|
|
20193
|
+
};
|
|
20194
|
+
this.chdir = (name) => {
|
|
20195
|
+
return this._chdir(name);
|
|
20196
|
+
};
|
|
20197
|
+
this.writeFile = async (name, content) => {
|
|
20198
|
+
this.readFileCache.set(name, Promise.resolve(Buffer.from(content)));
|
|
20199
|
+
this.fileCache.set(name, Promise.resolve(true));
|
|
20200
|
+
this.pathCache.set(name, Promise.resolve(true));
|
|
20201
|
+
};
|
|
20202
|
+
this.pathCache = /* @__PURE__ */ new Map();
|
|
20203
|
+
this.fileCache = /* @__PURE__ */ new Map();
|
|
20204
|
+
this.readFileCache = /* @__PURE__ */ new Map();
|
|
20205
|
+
this.readdirCache = /* @__PURE__ */ new Map();
|
|
20206
|
+
}
|
|
20207
|
+
};
|
|
20208
|
+
}
|
|
20209
|
+
});
|
|
20210
|
+
|
|
20211
|
+
// ../fs-detectors/dist/detectors/local-file-system-detector.js
|
|
20212
|
+
var require_local_file_system_detector = __commonJS({
|
|
20213
|
+
"../fs-detectors/dist/detectors/local-file-system-detector.js"(exports2, module2) {
|
|
20214
|
+
"use strict";
|
|
20215
|
+
var __create2 = Object.create;
|
|
20216
|
+
var __defProp2 = Object.defineProperty;
|
|
20217
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20218
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20219
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
20220
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20221
|
+
var __export2 = (target, all) => {
|
|
20222
|
+
for (var name in all)
|
|
20223
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20224
|
+
};
|
|
20225
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20226
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20227
|
+
for (let key of __getOwnPropNames2(from))
|
|
20228
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20229
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20230
|
+
}
|
|
20231
|
+
return to;
|
|
20232
|
+
};
|
|
20233
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
20234
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20235
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20236
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20237
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20238
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
20239
|
+
mod
|
|
20240
|
+
));
|
|
20241
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20242
|
+
var local_file_system_detector_exports = {};
|
|
20243
|
+
__export2(local_file_system_detector_exports, {
|
|
20244
|
+
LocalFileSystemDetector: () => LocalFileSystemDetector3
|
|
20245
|
+
});
|
|
20246
|
+
module2.exports = __toCommonJS2(local_file_system_detector_exports);
|
|
20247
|
+
var import_promises = __toESM2(require("fs/promises"));
|
|
20248
|
+
var import_path7 = require("path");
|
|
20249
|
+
var import_filesystem = require_filesystem();
|
|
20250
|
+
var import_error_utils3 = require_dist();
|
|
20251
|
+
var LocalFileSystemDetector3 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
|
|
20252
|
+
constructor(rootPath) {
|
|
20253
|
+
super();
|
|
20254
|
+
this.rootPath = rootPath;
|
|
20255
|
+
}
|
|
20256
|
+
async _hasPath(name) {
|
|
20257
|
+
try {
|
|
20258
|
+
await import_promises.default.stat(this.getFilePath(name));
|
|
20259
|
+
return true;
|
|
20260
|
+
} catch (err) {
|
|
20261
|
+
if ((0, import_error_utils3.isErrnoException)(err) && err.code === "ENOENT") {
|
|
20262
|
+
return false;
|
|
20263
|
+
}
|
|
20264
|
+
throw err;
|
|
20265
|
+
}
|
|
20266
|
+
}
|
|
20267
|
+
_readFile(name) {
|
|
20268
|
+
return import_promises.default.readFile(this.getFilePath(name));
|
|
20269
|
+
}
|
|
20270
|
+
async _isFile(name) {
|
|
20271
|
+
const stat = await import_promises.default.stat(this.getFilePath(name));
|
|
20272
|
+
return stat.isFile();
|
|
20273
|
+
}
|
|
20274
|
+
async _readdir(dir) {
|
|
20275
|
+
const dirPath = this.getFilePath(dir);
|
|
20276
|
+
const entries = await import_promises.default.readdir(dirPath, { withFileTypes: true });
|
|
20277
|
+
const result = [];
|
|
20278
|
+
for (const entry of entries) {
|
|
20279
|
+
let type;
|
|
20280
|
+
if (entry.isFile()) {
|
|
20281
|
+
type = "file";
|
|
20282
|
+
} else if (entry.isDirectory()) {
|
|
20283
|
+
type = "dir";
|
|
20284
|
+
} else {
|
|
20285
|
+
continue;
|
|
20286
|
+
}
|
|
20287
|
+
result.push({
|
|
20288
|
+
name: entry.name,
|
|
20289
|
+
path: (0, import_path7.join)(this.getRelativeFilePath(dir), entry.name),
|
|
20290
|
+
type
|
|
20291
|
+
});
|
|
20292
|
+
}
|
|
20293
|
+
return result;
|
|
20294
|
+
}
|
|
20295
|
+
_chdir(name) {
|
|
20296
|
+
return new _LocalFileSystemDetector(this.getFilePath(name));
|
|
20297
|
+
}
|
|
20298
|
+
getRelativeFilePath(name) {
|
|
20299
|
+
return name.startsWith(this.rootPath) ? (0, import_path7.relative)(this.rootPath, name) : name;
|
|
20300
|
+
}
|
|
20301
|
+
getFilePath(name) {
|
|
20302
|
+
return (0, import_path7.join)(this.rootPath, this.getRelativeFilePath(name));
|
|
20303
|
+
}
|
|
20304
|
+
};
|
|
20305
|
+
}
|
|
20306
|
+
});
|
|
20307
|
+
|
|
20308
|
+
// ../fs-detectors/dist/services/get-services-builders.js
|
|
20309
|
+
var require_get_services_builders = __commonJS({
|
|
20310
|
+
"../fs-detectors/dist/services/get-services-builders.js"(exports2, module2) {
|
|
20311
|
+
"use strict";
|
|
20312
|
+
var __defProp2 = Object.defineProperty;
|
|
20313
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20314
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20315
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20316
|
+
var __export2 = (target, all) => {
|
|
20317
|
+
for (var name in all)
|
|
20318
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20319
|
+
};
|
|
20320
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20321
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20322
|
+
for (let key of __getOwnPropNames2(from))
|
|
20323
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20324
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20325
|
+
}
|
|
20326
|
+
return to;
|
|
20327
|
+
};
|
|
20328
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20329
|
+
var get_services_builders_exports = {};
|
|
20330
|
+
__export2(get_services_builders_exports, {
|
|
20331
|
+
getServicesBuilders: () => getServicesBuilders2
|
|
20332
|
+
});
|
|
20333
|
+
module2.exports = __toCommonJS2(get_services_builders_exports);
|
|
20334
|
+
var import_detect_services = require_detect_services();
|
|
20335
|
+
var import_local_file_system_detector = require_local_file_system_detector();
|
|
20336
|
+
async function getServicesBuilders2(options) {
|
|
20337
|
+
const { workPath } = options;
|
|
20338
|
+
if (!workPath) {
|
|
20339
|
+
return {
|
|
20340
|
+
builders: null,
|
|
20341
|
+
errors: [
|
|
20342
|
+
{
|
|
20343
|
+
code: "MISSING_WORK_PATH",
|
|
20344
|
+
message: "workPath is required for services detection."
|
|
20345
|
+
}
|
|
20346
|
+
],
|
|
20347
|
+
warnings: [],
|
|
20348
|
+
defaultRoutes: null,
|
|
20349
|
+
redirectRoutes: null,
|
|
20350
|
+
rewriteRoutes: null,
|
|
20351
|
+
errorRoutes: null
|
|
20352
|
+
};
|
|
20353
|
+
}
|
|
20354
|
+
const fs5 = new import_local_file_system_detector.LocalFileSystemDetector(workPath);
|
|
20355
|
+
const result = await (0, import_detect_services.detectServices)({ fs: fs5 });
|
|
20356
|
+
const warningResponses = result.warnings.map((w) => ({
|
|
20357
|
+
code: w.code,
|
|
20358
|
+
message: w.message
|
|
20359
|
+
}));
|
|
20360
|
+
if (result.errors.length > 0) {
|
|
20361
|
+
return {
|
|
20362
|
+
builders: null,
|
|
20363
|
+
errors: result.errors.map((e) => ({
|
|
20364
|
+
code: e.code,
|
|
20365
|
+
message: e.message
|
|
20366
|
+
})),
|
|
20367
|
+
warnings: warningResponses,
|
|
20368
|
+
defaultRoutes: null,
|
|
20369
|
+
redirectRoutes: null,
|
|
20370
|
+
rewriteRoutes: null,
|
|
20371
|
+
errorRoutes: null
|
|
20372
|
+
};
|
|
20373
|
+
}
|
|
20374
|
+
if (result.services.length === 0) {
|
|
20375
|
+
return {
|
|
20376
|
+
builders: null,
|
|
20377
|
+
errors: [
|
|
20378
|
+
{
|
|
20379
|
+
code: "NO_SERVICES_CONFIGURED",
|
|
20380
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
20381
|
+
}
|
|
20382
|
+
],
|
|
20383
|
+
warnings: warningResponses,
|
|
20384
|
+
defaultRoutes: null,
|
|
20385
|
+
redirectRoutes: null,
|
|
20386
|
+
rewriteRoutes: null,
|
|
20387
|
+
errorRoutes: null
|
|
20388
|
+
};
|
|
20389
|
+
}
|
|
20390
|
+
const builders = result.services.map((service) => service.builder);
|
|
20391
|
+
return {
|
|
20392
|
+
builders: builders.length > 0 ? builders : null,
|
|
20393
|
+
errors: null,
|
|
20394
|
+
warnings: warningResponses,
|
|
20395
|
+
defaultRoutes: result.routes.defaults.length > 0 ? result.routes.defaults : null,
|
|
20396
|
+
redirectRoutes: [],
|
|
20397
|
+
rewriteRoutes: result.routes.rewrites.length > 0 ? result.routes.rewrites : null,
|
|
20398
|
+
errorRoutes: [],
|
|
20399
|
+
services: result.services
|
|
20400
|
+
};
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
});
|
|
20404
|
+
|
|
20405
|
+
// ../fs-detectors/dist/detect-builders.js
|
|
20406
|
+
var require_detect_builders = __commonJS({
|
|
20407
|
+
"../fs-detectors/dist/detect-builders.js"(exports2, module2) {
|
|
20408
|
+
"use strict";
|
|
20409
|
+
var __create2 = Object.create;
|
|
20410
|
+
var __defProp2 = Object.defineProperty;
|
|
20411
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20412
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20413
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
20414
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20415
|
+
var __export2 = (target, all) => {
|
|
20416
|
+
for (var name in all)
|
|
20417
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20418
|
+
};
|
|
20419
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20420
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20421
|
+
for (let key of __getOwnPropNames2(from))
|
|
20422
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20423
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20424
|
+
}
|
|
20425
|
+
return to;
|
|
20426
|
+
};
|
|
20427
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
20428
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20429
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20430
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20431
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20432
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
20433
|
+
mod
|
|
20434
|
+
));
|
|
20435
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20436
|
+
var detect_builders_exports = {};
|
|
20437
|
+
__export2(detect_builders_exports, {
|
|
20438
|
+
REGEX_MIDDLEWARE_FILES: () => REGEX_MIDDLEWARE_FILES,
|
|
20439
|
+
REGEX_NON_VERCEL_PLATFORM_FILES: () => REGEX_NON_VERCEL_PLATFORM_FILES2,
|
|
20440
|
+
REGEX_VERCEL_PLATFORM_FILES: () => REGEX_VERCEL_PLATFORM_FILES,
|
|
20441
|
+
detectApiDirectory: () => detectApiDirectory2,
|
|
20442
|
+
detectApiExtensions: () => detectApiExtensions2,
|
|
20443
|
+
detectBuilders: () => detectBuilders2,
|
|
20444
|
+
detectOutputDirectory: () => detectOutputDirectory2,
|
|
20445
|
+
sortFiles: () => sortFiles
|
|
20446
|
+
});
|
|
20447
|
+
module2.exports = __toCommonJS2(detect_builders_exports);
|
|
20448
|
+
var import_minimatch = __toESM2(require_minimatch());
|
|
20449
|
+
var import_semver2 = require_semver3();
|
|
20450
|
+
var import_path7 = require("path");
|
|
20451
|
+
var import_frameworks2 = __toESM2(require_frameworks());
|
|
20452
|
+
var import_is_official_runtime = require_is_official_runtime();
|
|
20453
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
|
20454
|
+
var import_get_services_builders = require_get_services_builders();
|
|
20455
|
+
var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
|
|
20456
|
+
var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
|
|
20457
|
+
var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
|
|
20458
|
+
var slugToFramework = new Map(
|
|
20459
|
+
import_frameworks2.default.map((f) => [f.slug, f])
|
|
20460
|
+
);
|
|
20461
|
+
function sortFiles(fileA, fileB) {
|
|
20462
|
+
return fileA.localeCompare(fileB);
|
|
20463
|
+
}
|
|
20464
|
+
function detectApiExtensions2(builders) {
|
|
20465
|
+
return new Set(
|
|
20466
|
+
builders.filter(
|
|
20467
|
+
(b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith("api/"))
|
|
20468
|
+
).map((b) => (0, import_path7.extname)(b.src)).filter(Boolean)
|
|
20469
|
+
);
|
|
20470
|
+
}
|
|
20471
|
+
function detectApiDirectory2(builders) {
|
|
20472
|
+
const found = builders.some(
|
|
20473
|
+
(b) => b.config && b.config.zeroConfig && b.src?.startsWith("api/")
|
|
20474
|
+
);
|
|
20475
|
+
return found ? "api" : null;
|
|
20476
|
+
}
|
|
20477
|
+
function getPublicBuilder(builders) {
|
|
20478
|
+
for (const builder of builders) {
|
|
20479
|
+
if (typeof builder.src === "string" && (0, import_is_official_runtime.isOfficialRuntime)("static", builder.use) && /^.*\/\*\*\/\*$/.test(builder.src) && builder.config?.zeroConfig === true) {
|
|
20480
|
+
return builder;
|
|
20481
|
+
}
|
|
20482
|
+
}
|
|
20483
|
+
return null;
|
|
20484
|
+
}
|
|
20485
|
+
function detectOutputDirectory2(builders) {
|
|
20486
|
+
const publicBuilder = getPublicBuilder(builders);
|
|
20487
|
+
return publicBuilder ? publicBuilder.src.replace("/**/*", "") : null;
|
|
20488
|
+
}
|
|
20489
|
+
async function detectBuilders2(files, pkg, options = {}) {
|
|
20490
|
+
const { projectSettings = {} } = options;
|
|
20491
|
+
const { framework } = projectSettings;
|
|
20492
|
+
if (framework === "services") {
|
|
20493
|
+
return (0, import_get_services_builders.getServicesBuilders)({
|
|
20494
|
+
workPath: options.workPath
|
|
20495
|
+
});
|
|
20496
|
+
}
|
|
20497
|
+
const errors = [];
|
|
20498
|
+
const warnings = [];
|
|
20499
|
+
let apiBuilders = [];
|
|
19620
20500
|
let frontendBuilder = null;
|
|
19621
20501
|
const functionError = validateFunctions(options);
|
|
19622
20502
|
if (functionError) {
|
|
@@ -19639,8 +20519,7 @@ var require_detect_builders = __commonJS({
|
|
|
19639
20519
|
usedFunctions.add(key);
|
|
19640
20520
|
};
|
|
19641
20521
|
const absolutePathCache = /* @__PURE__ */ new Map();
|
|
19642
|
-
const {
|
|
19643
|
-
const { buildCommand, outputDirectory, framework } = projectSettings;
|
|
20522
|
+
const { buildCommand, outputDirectory } = projectSettings;
|
|
19644
20523
|
const frameworkConfig = slugToFramework.get(framework || "");
|
|
19645
20524
|
const ignoreRuntimes = new Set(frameworkConfig?.ignoreRuntimes);
|
|
19646
20525
|
const withTag = options.tag ? `@${options.tag}` : "";
|
|
@@ -19942,7 +20821,9 @@ var require_detect_builders = __commonJS({
|
|
|
19942
20821
|
const f = slugToFramework.get(framework || "");
|
|
19943
20822
|
if (f && f.useRuntime) {
|
|
19944
20823
|
const { src, use } = f.useRuntime;
|
|
19945
|
-
|
|
20824
|
+
const shouldUseUnifiedBackend = (0, import_build_utils5.isExperimentalBackendsEnabled)() && import_build_utils5.BACKEND_BUILDERS.includes(use);
|
|
20825
|
+
const finalUse = shouldUseUnifiedBackend ? import_build_utils5.UNIFIED_BACKEND_BUILDER : use;
|
|
20826
|
+
return { src, use: `${finalUse}${withTag}`, config };
|
|
19946
20827
|
}
|
|
19947
20828
|
const entrypoints = /* @__PURE__ */ new Set([
|
|
19948
20829
|
"package.json",
|
|
@@ -20285,230 +21166,68 @@ var require_detect_builders = __commonJS({
|
|
|
20285
21166
|
src: `^/api/(.+)${extGroup}$`,
|
|
20286
21167
|
dest: "/api/$1",
|
|
20287
21168
|
check: true
|
|
20288
|
-
});
|
|
20289
|
-
}
|
|
20290
|
-
}
|
|
20291
|
-
rewriteRoutes.push(...dynamicRoutes);
|
|
20292
|
-
const hasApiBuild = apiBuilders.find((builder) => {
|
|
20293
|
-
return builder.src?.startsWith("api/");
|
|
20294
|
-
});
|
|
20295
|
-
if (typeof ignoreRuntimes === "undefined" && hasApiBuild) {
|
|
20296
|
-
rewriteRoutes.push({
|
|
20297
|
-
src: "^/api(/.*)?$",
|
|
20298
|
-
status: 404
|
|
20299
|
-
});
|
|
20300
|
-
}
|
|
20301
|
-
} else {
|
|
20302
|
-
defaultRoutes.push(...apiRoutes);
|
|
20303
|
-
if (apiRoutes.length) {
|
|
20304
|
-
defaultRoutes.push({
|
|
20305
|
-
status: 404,
|
|
20306
|
-
src: "^/api(/.*)?$"
|
|
20307
|
-
});
|
|
20308
|
-
}
|
|
20309
|
-
}
|
|
20310
|
-
}
|
|
20311
|
-
if (outputDirectory && frontendBuilder && !options.featHandleMiss && (0, import_is_official_runtime.isOfficialRuntime)("static", frontendBuilder.use)) {
|
|
20312
|
-
defaultRoutes.push({
|
|
20313
|
-
src: "/(.*)",
|
|
20314
|
-
dest: `/${outputDirectory}/$1`
|
|
20315
|
-
});
|
|
20316
|
-
}
|
|
20317
|
-
if (options.featHandleMiss && !isNextjs && !isGatsby) {
|
|
20318
|
-
errorRoutes.push({
|
|
20319
|
-
status: 404,
|
|
20320
|
-
src: "^(?!/api).*$",
|
|
20321
|
-
dest: options.cleanUrls ? "/404" : "/404.html"
|
|
20322
|
-
});
|
|
20323
|
-
}
|
|
20324
|
-
return {
|
|
20325
|
-
defaultRoutes,
|
|
20326
|
-
redirectRoutes,
|
|
20327
|
-
rewriteRoutes,
|
|
20328
|
-
errorRoutes
|
|
20329
|
-
};
|
|
20330
|
-
}
|
|
20331
|
-
function sortFilesBySegmentCount(fileA, fileB) {
|
|
20332
|
-
const lengthA = fileA.split("/").length;
|
|
20333
|
-
const lengthB = fileB.split("/").length;
|
|
20334
|
-
if (lengthA > lengthB) {
|
|
20335
|
-
return -1;
|
|
20336
|
-
}
|
|
20337
|
-
if (lengthA < lengthB) {
|
|
20338
|
-
return 1;
|
|
20339
|
-
}
|
|
20340
|
-
const countSegments = (prev, segment) => getSegmentName(segment) ? prev + 1 : 0;
|
|
20341
|
-
const segmentLengthA = fileA.split("/").reduce(countSegments, 0);
|
|
20342
|
-
const segmentLengthB = fileB.split("/").reduce(countSegments, 0);
|
|
20343
|
-
if (segmentLengthA > segmentLengthB) {
|
|
20344
|
-
return 1;
|
|
20345
|
-
}
|
|
20346
|
-
if (segmentLengthA < segmentLengthB) {
|
|
20347
|
-
return -1;
|
|
20348
|
-
}
|
|
20349
|
-
return fileA.localeCompare(fileB);
|
|
20350
|
-
}
|
|
20351
|
-
}
|
|
20352
|
-
});
|
|
20353
|
-
|
|
20354
|
-
// ../fs-detectors/dist/services/resolve.js
|
|
20355
|
-
var require_resolve = __commonJS({
|
|
20356
|
-
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
20357
|
-
"use strict";
|
|
20358
|
-
var __defProp2 = Object.defineProperty;
|
|
20359
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20360
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20361
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20362
|
-
var __export2 = (target, all) => {
|
|
20363
|
-
for (var name in all)
|
|
20364
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20365
|
-
};
|
|
20366
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
20367
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20368
|
-
for (let key of __getOwnPropNames2(from))
|
|
20369
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20370
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20371
|
-
}
|
|
20372
|
-
return to;
|
|
20373
|
-
};
|
|
20374
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20375
|
-
var resolve_exports = {};
|
|
20376
|
-
__export2(resolve_exports, {
|
|
20377
|
-
resolveService: () => resolveService,
|
|
20378
|
-
validateServiceConfig: () => validateServiceConfig
|
|
20379
|
-
});
|
|
20380
|
-
module2.exports = __toCommonJS2(resolve_exports);
|
|
20381
|
-
function validateServiceConfig(name, config) {
|
|
20382
|
-
if (config.type === "cron" && !config.schedule) {
|
|
20383
|
-
return {
|
|
20384
|
-
code: "MISSING_CRON_SCHEDULE",
|
|
20385
|
-
message: `Cron service "${name}" is missing required "schedule" field`,
|
|
20386
|
-
serviceName: name
|
|
20387
|
-
};
|
|
20388
|
-
}
|
|
20389
|
-
return null;
|
|
20390
|
-
}
|
|
20391
|
-
function resolveService(name, config, group) {
|
|
20392
|
-
const type = config.type || "web";
|
|
20393
|
-
const workspace = config.workspace || ".";
|
|
20394
|
-
const topic = type === "worker" ? config.topic || "default" : config.topic;
|
|
20395
|
-
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
20396
|
-
return {
|
|
20397
|
-
name,
|
|
20398
|
-
type,
|
|
20399
|
-
group,
|
|
20400
|
-
workspace,
|
|
20401
|
-
entrypoint: config.entrypoint,
|
|
20402
|
-
routePrefix: config.routePrefix,
|
|
20403
|
-
framework: config.framework,
|
|
20404
|
-
builder: config.builder,
|
|
20405
|
-
runtime: config.runtime,
|
|
20406
|
-
buildCommand: config.buildCommand,
|
|
20407
|
-
installCommand: config.installCommand,
|
|
20408
|
-
memory: config.memory,
|
|
20409
|
-
maxDuration: config.maxDuration,
|
|
20410
|
-
includeFiles: config.includeFiles,
|
|
20411
|
-
excludeFiles: config.excludeFiles,
|
|
20412
|
-
schedule: config.schedule,
|
|
20413
|
-
topic,
|
|
20414
|
-
consumer
|
|
20415
|
-
};
|
|
20416
|
-
}
|
|
20417
|
-
}
|
|
20418
|
-
});
|
|
20419
|
-
|
|
20420
|
-
// ../fs-detectors/dist/services/types.js
|
|
20421
|
-
var require_types2 = __commonJS({
|
|
20422
|
-
"../fs-detectors/dist/services/types.js"(exports2, module2) {
|
|
20423
|
-
"use strict";
|
|
20424
|
-
var __defProp2 = Object.defineProperty;
|
|
20425
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20426
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20427
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20428
|
-
var __export2 = (target, all) => {
|
|
20429
|
-
for (var name in all)
|
|
20430
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20431
|
-
};
|
|
20432
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
20433
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20434
|
-
for (let key of __getOwnPropNames2(from))
|
|
20435
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20436
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20437
|
-
}
|
|
20438
|
-
return to;
|
|
20439
|
-
};
|
|
20440
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20441
|
-
var types_exports = {};
|
|
20442
|
-
__export2(types_exports, {
|
|
20443
|
-
RUNTIME_BUILDERS: () => RUNTIME_BUILDERS
|
|
20444
|
-
});
|
|
20445
|
-
module2.exports = __toCommonJS2(types_exports);
|
|
20446
|
-
var RUNTIME_BUILDERS = {
|
|
20447
|
-
node: "@vercel/node",
|
|
20448
|
-
python: "@vercel/python",
|
|
20449
|
-
go: "@vercel/go",
|
|
20450
|
-
rust: "@vercel/rust",
|
|
20451
|
-
ruby: "@vercel/ruby"
|
|
20452
|
-
};
|
|
20453
|
-
}
|
|
20454
|
-
});
|
|
20455
|
-
|
|
20456
|
-
// ../fs-detectors/dist/services/index.js
|
|
20457
|
-
var require_services = __commonJS({
|
|
20458
|
-
"../fs-detectors/dist/services/index.js"(exports2, module2) {
|
|
20459
|
-
"use strict";
|
|
20460
|
-
var __defProp2 = Object.defineProperty;
|
|
20461
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20462
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20463
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20464
|
-
var __export2 = (target, all) => {
|
|
20465
|
-
for (var name in all)
|
|
20466
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20467
|
-
};
|
|
20468
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
20469
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20470
|
-
for (let key of __getOwnPropNames2(from))
|
|
20471
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20472
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20473
|
-
}
|
|
20474
|
-
return to;
|
|
20475
|
-
};
|
|
20476
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
20477
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20478
|
-
var services_exports = {};
|
|
20479
|
-
__export2(services_exports, {
|
|
20480
|
-
detectServices: () => detectServices2
|
|
20481
|
-
});
|
|
20482
|
-
module2.exports = __toCommonJS2(services_exports);
|
|
20483
|
-
var import_resolve = require_resolve();
|
|
20484
|
-
__reExport(services_exports, require_types2(), module2.exports);
|
|
20485
|
-
__reExport(services_exports, require_resolve(), module2.exports);
|
|
20486
|
-
async function detectServices2(options) {
|
|
20487
|
-
const { fs: fs5, workPath = "" } = options;
|
|
20488
|
-
const services = [];
|
|
20489
|
-
const errors = [];
|
|
20490
|
-
const configPath = workPath ? `${workPath}/vercel.json` : "vercel.json";
|
|
20491
|
-
let experimentalServices;
|
|
20492
|
-
try {
|
|
20493
|
-
const configBuffer = await fs5.readFile(configPath);
|
|
20494
|
-
const config = JSON.parse(configBuffer.toString("utf-8"));
|
|
20495
|
-
experimentalServices = config.experimentalServices;
|
|
20496
|
-
} catch {
|
|
20497
|
-
return { services, errors };
|
|
20498
|
-
}
|
|
20499
|
-
if (experimentalServices && typeof experimentalServices === "object") {
|
|
20500
|
-
for (const name of Object.keys(experimentalServices)) {
|
|
20501
|
-
const serviceConfig = experimentalServices[name];
|
|
20502
|
-
const validationError = (0, import_resolve.validateServiceConfig)(name, serviceConfig);
|
|
20503
|
-
if (validationError) {
|
|
20504
|
-
errors.push(validationError);
|
|
20505
|
-
continue;
|
|
21169
|
+
});
|
|
21170
|
+
}
|
|
21171
|
+
}
|
|
21172
|
+
rewriteRoutes.push(...dynamicRoutes);
|
|
21173
|
+
const hasApiBuild = apiBuilders.find((builder) => {
|
|
21174
|
+
return builder.src?.startsWith("api/");
|
|
21175
|
+
});
|
|
21176
|
+
if (typeof ignoreRuntimes === "undefined" && hasApiBuild) {
|
|
21177
|
+
rewriteRoutes.push({
|
|
21178
|
+
src: "^/api(/.*)?$",
|
|
21179
|
+
status: 404
|
|
21180
|
+
});
|
|
21181
|
+
}
|
|
21182
|
+
} else {
|
|
21183
|
+
defaultRoutes.push(...apiRoutes);
|
|
21184
|
+
if (apiRoutes.length) {
|
|
21185
|
+
defaultRoutes.push({
|
|
21186
|
+
status: 404,
|
|
21187
|
+
src: "^/api(/.*)?$"
|
|
21188
|
+
});
|
|
20506
21189
|
}
|
|
20507
|
-
const resolved = (0, import_resolve.resolveService)(name, serviceConfig);
|
|
20508
|
-
services.push(resolved);
|
|
20509
21190
|
}
|
|
20510
21191
|
}
|
|
20511
|
-
|
|
21192
|
+
if (outputDirectory && frontendBuilder && !options.featHandleMiss && (0, import_is_official_runtime.isOfficialRuntime)("static", frontendBuilder.use)) {
|
|
21193
|
+
defaultRoutes.push({
|
|
21194
|
+
src: "/(.*)",
|
|
21195
|
+
dest: `/${outputDirectory}/$1`
|
|
21196
|
+
});
|
|
21197
|
+
}
|
|
21198
|
+
if (options.featHandleMiss && !isNextjs && !isGatsby) {
|
|
21199
|
+
errorRoutes.push({
|
|
21200
|
+
status: 404,
|
|
21201
|
+
src: "^(?!/api).*$",
|
|
21202
|
+
dest: options.cleanUrls ? "/404" : "/404.html"
|
|
21203
|
+
});
|
|
21204
|
+
}
|
|
21205
|
+
return {
|
|
21206
|
+
defaultRoutes,
|
|
21207
|
+
redirectRoutes,
|
|
21208
|
+
rewriteRoutes,
|
|
21209
|
+
errorRoutes
|
|
21210
|
+
};
|
|
21211
|
+
}
|
|
21212
|
+
function sortFilesBySegmentCount(fileA, fileB) {
|
|
21213
|
+
const lengthA = fileA.split("/").length;
|
|
21214
|
+
const lengthB = fileB.split("/").length;
|
|
21215
|
+
if (lengthA > lengthB) {
|
|
21216
|
+
return -1;
|
|
21217
|
+
}
|
|
21218
|
+
if (lengthA < lengthB) {
|
|
21219
|
+
return 1;
|
|
21220
|
+
}
|
|
21221
|
+
const countSegments = (prev, segment) => getSegmentName(segment) ? prev + 1 : 0;
|
|
21222
|
+
const segmentLengthA = fileA.split("/").reduce(countSegments, 0);
|
|
21223
|
+
const segmentLengthB = fileB.split("/").reduce(countSegments, 0);
|
|
21224
|
+
if (segmentLengthA > segmentLengthB) {
|
|
21225
|
+
return 1;
|
|
21226
|
+
}
|
|
21227
|
+
if (segmentLengthA < segmentLengthB) {
|
|
21228
|
+
return -1;
|
|
21229
|
+
}
|
|
21230
|
+
return fileA.localeCompare(fileB);
|
|
20512
21231
|
}
|
|
20513
21232
|
}
|
|
20514
21233
|
});
|
|
@@ -21039,203 +21758,6 @@ var require_get_project_paths = __commonJS({
|
|
|
21039
21758
|
}
|
|
21040
21759
|
});
|
|
21041
21760
|
|
|
21042
|
-
// ../fs-detectors/dist/detectors/filesystem.js
|
|
21043
|
-
var require_filesystem = __commonJS({
|
|
21044
|
-
"../fs-detectors/dist/detectors/filesystem.js"(exports2, module2) {
|
|
21045
|
-
"use strict";
|
|
21046
|
-
var __defProp2 = Object.defineProperty;
|
|
21047
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
21048
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
21049
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
21050
|
-
var __export2 = (target, all) => {
|
|
21051
|
-
for (var name in all)
|
|
21052
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
21053
|
-
};
|
|
21054
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
21055
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21056
|
-
for (let key of __getOwnPropNames2(from))
|
|
21057
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
21058
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
21059
|
-
}
|
|
21060
|
-
return to;
|
|
21061
|
-
};
|
|
21062
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
21063
|
-
var filesystem_exports = {};
|
|
21064
|
-
__export2(filesystem_exports, {
|
|
21065
|
-
DetectorFilesystem: () => DetectorFilesystem2
|
|
21066
|
-
});
|
|
21067
|
-
module2.exports = __toCommonJS2(filesystem_exports);
|
|
21068
|
-
var import_path7 = require("path");
|
|
21069
|
-
var DetectorFilesystem2 = class {
|
|
21070
|
-
constructor() {
|
|
21071
|
-
this.hasPath = async (path6) => {
|
|
21072
|
-
let p = this.pathCache.get(path6);
|
|
21073
|
-
if (!p) {
|
|
21074
|
-
p = this._hasPath(path6);
|
|
21075
|
-
this.pathCache.set(path6, p);
|
|
21076
|
-
}
|
|
21077
|
-
return p;
|
|
21078
|
-
};
|
|
21079
|
-
this.isFile = async (name) => {
|
|
21080
|
-
let p = this.fileCache.get(name);
|
|
21081
|
-
if (!p) {
|
|
21082
|
-
p = this._isFile(name);
|
|
21083
|
-
this.fileCache.set(name, p);
|
|
21084
|
-
}
|
|
21085
|
-
return p;
|
|
21086
|
-
};
|
|
21087
|
-
this.readFile = async (name) => {
|
|
21088
|
-
let p = this.readFileCache.get(name);
|
|
21089
|
-
if (!p) {
|
|
21090
|
-
p = this._readFile(name);
|
|
21091
|
-
this.readFileCache.set(name, p);
|
|
21092
|
-
}
|
|
21093
|
-
return p;
|
|
21094
|
-
};
|
|
21095
|
-
this.readdir = async (dirPath, options) => {
|
|
21096
|
-
let p = this.readdirCache.get(dirPath);
|
|
21097
|
-
if (!p) {
|
|
21098
|
-
p = this._readdir(dirPath);
|
|
21099
|
-
this.readdirCache.set(dirPath, p);
|
|
21100
|
-
}
|
|
21101
|
-
const directoryContent = await p;
|
|
21102
|
-
const directoryFiles = /* @__PURE__ */ new Set();
|
|
21103
|
-
for (const file of directoryContent) {
|
|
21104
|
-
if (file.type === "file") {
|
|
21105
|
-
this.fileCache.set(file.path, Promise.resolve(true));
|
|
21106
|
-
this.pathCache.set(file.path, Promise.resolve(true));
|
|
21107
|
-
directoryFiles.add(file.name);
|
|
21108
|
-
}
|
|
21109
|
-
}
|
|
21110
|
-
if (options?.potentialFiles) {
|
|
21111
|
-
const filesInReaddirDir = options.potentialFiles.filter(
|
|
21112
|
-
(path6) => (0, import_path7.basename)(path6) === path6
|
|
21113
|
-
);
|
|
21114
|
-
const filesThatDoNotExist = filesInReaddirDir.filter(
|
|
21115
|
-
(path6) => !directoryFiles.has(path6)
|
|
21116
|
-
);
|
|
21117
|
-
for (const filePath of filesThatDoNotExist) {
|
|
21118
|
-
const fullFilePath = dirPath === "/" ? filePath : import_path7.posix.join(dirPath, filePath);
|
|
21119
|
-
this.fileCache.set(fullFilePath, Promise.resolve(false));
|
|
21120
|
-
this.pathCache.set(fullFilePath, Promise.resolve(false));
|
|
21121
|
-
}
|
|
21122
|
-
}
|
|
21123
|
-
return p;
|
|
21124
|
-
};
|
|
21125
|
-
this.chdir = (name) => {
|
|
21126
|
-
return this._chdir(name);
|
|
21127
|
-
};
|
|
21128
|
-
this.writeFile = async (name, content) => {
|
|
21129
|
-
this.readFileCache.set(name, Promise.resolve(Buffer.from(content)));
|
|
21130
|
-
this.fileCache.set(name, Promise.resolve(true));
|
|
21131
|
-
this.pathCache.set(name, Promise.resolve(true));
|
|
21132
|
-
};
|
|
21133
|
-
this.pathCache = /* @__PURE__ */ new Map();
|
|
21134
|
-
this.fileCache = /* @__PURE__ */ new Map();
|
|
21135
|
-
this.readFileCache = /* @__PURE__ */ new Map();
|
|
21136
|
-
this.readdirCache = /* @__PURE__ */ new Map();
|
|
21137
|
-
}
|
|
21138
|
-
};
|
|
21139
|
-
}
|
|
21140
|
-
});
|
|
21141
|
-
|
|
21142
|
-
// ../fs-detectors/dist/detectors/local-file-system-detector.js
|
|
21143
|
-
var require_local_file_system_detector = __commonJS({
|
|
21144
|
-
"../fs-detectors/dist/detectors/local-file-system-detector.js"(exports2, module2) {
|
|
21145
|
-
"use strict";
|
|
21146
|
-
var __create2 = Object.create;
|
|
21147
|
-
var __defProp2 = Object.defineProperty;
|
|
21148
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
21149
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
21150
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
21151
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
21152
|
-
var __export2 = (target, all) => {
|
|
21153
|
-
for (var name in all)
|
|
21154
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
21155
|
-
};
|
|
21156
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
21157
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21158
|
-
for (let key of __getOwnPropNames2(from))
|
|
21159
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
21160
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
21161
|
-
}
|
|
21162
|
-
return to;
|
|
21163
|
-
};
|
|
21164
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
21165
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21166
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21167
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21168
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21169
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
21170
|
-
mod
|
|
21171
|
-
));
|
|
21172
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
21173
|
-
var local_file_system_detector_exports = {};
|
|
21174
|
-
__export2(local_file_system_detector_exports, {
|
|
21175
|
-
LocalFileSystemDetector: () => LocalFileSystemDetector3
|
|
21176
|
-
});
|
|
21177
|
-
module2.exports = __toCommonJS2(local_file_system_detector_exports);
|
|
21178
|
-
var import_promises = __toESM2(require("fs/promises"));
|
|
21179
|
-
var import_path7 = require("path");
|
|
21180
|
-
var import_filesystem = require_filesystem();
|
|
21181
|
-
var import_error_utils3 = require_dist();
|
|
21182
|
-
var LocalFileSystemDetector3 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
|
|
21183
|
-
constructor(rootPath) {
|
|
21184
|
-
super();
|
|
21185
|
-
this.rootPath = rootPath;
|
|
21186
|
-
}
|
|
21187
|
-
async _hasPath(name) {
|
|
21188
|
-
try {
|
|
21189
|
-
await import_promises.default.stat(this.getFilePath(name));
|
|
21190
|
-
return true;
|
|
21191
|
-
} catch (err) {
|
|
21192
|
-
if ((0, import_error_utils3.isErrnoException)(err) && err.code === "ENOENT") {
|
|
21193
|
-
return false;
|
|
21194
|
-
}
|
|
21195
|
-
throw err;
|
|
21196
|
-
}
|
|
21197
|
-
}
|
|
21198
|
-
_readFile(name) {
|
|
21199
|
-
return import_promises.default.readFile(this.getFilePath(name));
|
|
21200
|
-
}
|
|
21201
|
-
async _isFile(name) {
|
|
21202
|
-
const stat = await import_promises.default.stat(this.getFilePath(name));
|
|
21203
|
-
return stat.isFile();
|
|
21204
|
-
}
|
|
21205
|
-
async _readdir(dir) {
|
|
21206
|
-
const dirPath = this.getFilePath(dir);
|
|
21207
|
-
const entries = await import_promises.default.readdir(dirPath, { withFileTypes: true });
|
|
21208
|
-
const result = [];
|
|
21209
|
-
for (const entry of entries) {
|
|
21210
|
-
let type;
|
|
21211
|
-
if (entry.isFile()) {
|
|
21212
|
-
type = "file";
|
|
21213
|
-
} else if (entry.isDirectory()) {
|
|
21214
|
-
type = "dir";
|
|
21215
|
-
} else {
|
|
21216
|
-
continue;
|
|
21217
|
-
}
|
|
21218
|
-
result.push({
|
|
21219
|
-
name: entry.name,
|
|
21220
|
-
path: (0, import_path7.join)(this.getRelativeFilePath(dir), entry.name),
|
|
21221
|
-
type
|
|
21222
|
-
});
|
|
21223
|
-
}
|
|
21224
|
-
return result;
|
|
21225
|
-
}
|
|
21226
|
-
_chdir(name) {
|
|
21227
|
-
return new _LocalFileSystemDetector(this.getFilePath(name));
|
|
21228
|
-
}
|
|
21229
|
-
getRelativeFilePath(name) {
|
|
21230
|
-
return name.startsWith(this.rootPath) ? (0, import_path7.relative)(this.rootPath, name) : name;
|
|
21231
|
-
}
|
|
21232
|
-
getFilePath(name) {
|
|
21233
|
-
return (0, import_path7.join)(this.rootPath, this.getRelativeFilePath(name));
|
|
21234
|
-
}
|
|
21235
|
-
};
|
|
21236
|
-
}
|
|
21237
|
-
});
|
|
21238
|
-
|
|
21239
21761
|
// ../fs-detectors/dist/workspaces/workspace-managers.js
|
|
21240
21762
|
var require_workspace_managers = __commonJS({
|
|
21241
21763
|
"../fs-detectors/dist/workspaces/workspace-managers.js"(exports2, module2) {
|
|
@@ -28402,8 +28924,10 @@ var require_dist4 = __commonJS({
|
|
|
28402
28924
|
detectFrameworks: () => import_detect_framework.detectFrameworks,
|
|
28403
28925
|
detectInstrumentation: () => import_detect_instrumentation.detectInstrumentation,
|
|
28404
28926
|
detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
|
|
28405
|
-
detectServices: () =>
|
|
28927
|
+
detectServices: () => import_detect_services.detectServices,
|
|
28928
|
+
generateServicesRoutes: () => import_detect_services.generateServicesRoutes,
|
|
28406
28929
|
getProjectPaths: () => import_get_project_paths.getProjectPaths,
|
|
28930
|
+
getServicesBuilders: () => import_get_services_builders.getServicesBuilders,
|
|
28407
28931
|
getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
|
|
28408
28932
|
getWorkspaces: () => import_get_workspaces.getWorkspaces,
|
|
28409
28933
|
isOfficialRuntime: () => import_is_official_runtime.isOfficialRuntime,
|
|
@@ -28414,7 +28938,8 @@ var require_dist4 = __commonJS({
|
|
|
28414
28938
|
});
|
|
28415
28939
|
module2.exports = __toCommonJS2(src_exports2);
|
|
28416
28940
|
var import_detect_builders = require_detect_builders();
|
|
28417
|
-
var
|
|
28941
|
+
var import_detect_services = require_detect_services();
|
|
28942
|
+
var import_get_services_builders = require_get_services_builders();
|
|
28418
28943
|
var import_detect_file_system_api = require_detect_file_system_api();
|
|
28419
28944
|
var import_detect_framework = require_detect_framework();
|
|
28420
28945
|
var import_get_project_paths = require_get_project_paths();
|