@vercel/static-build 2.8.28 → 2.8.30
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 +1019 -479
- package/package.json +7 -7
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,152 @@ 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
|
+
isStaticBuild: () => isStaticBuild2,
|
|
19757
|
+
readVercelConfig: () => readVercelConfig
|
|
19758
|
+
});
|
|
19759
|
+
module2.exports = __toCommonJS2(utils_exports);
|
|
19760
|
+
var import_framework_helpers = require("@vercel/build-utils/dist/framework-helpers");
|
|
19761
|
+
var import_types = require_types2();
|
|
19762
|
+
function getBuilderForRuntime(runtime) {
|
|
19763
|
+
const builder = import_types.RUNTIME_BUILDERS[runtime];
|
|
19764
|
+
if (!builder) {
|
|
19765
|
+
throw new Error(`Unknown runtime: ${runtime}`);
|
|
19766
|
+
}
|
|
19767
|
+
return builder;
|
|
19768
|
+
}
|
|
19769
|
+
function isStaticBuild2(service) {
|
|
19770
|
+
return import_types.STATIC_BUILDERS.has(service.builder.use);
|
|
19771
|
+
}
|
|
19772
|
+
function inferServiceRuntime(config) {
|
|
19773
|
+
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
19774
|
+
return config.runtime;
|
|
19775
|
+
}
|
|
19776
|
+
if ((0, import_framework_helpers.isPythonFramework)(config.framework)) {
|
|
19777
|
+
return "python";
|
|
19778
|
+
}
|
|
19779
|
+
if ((0, import_framework_helpers.isBackendFramework)(config.framework)) {
|
|
19780
|
+
return "node";
|
|
19781
|
+
}
|
|
19782
|
+
if (config.builder) {
|
|
19783
|
+
for (const [runtime, builderName] of Object.entries(import_types.RUNTIME_BUILDERS)) {
|
|
19784
|
+
if (config.builder === builderName) {
|
|
19785
|
+
return runtime;
|
|
19786
|
+
}
|
|
19787
|
+
}
|
|
19788
|
+
}
|
|
19789
|
+
if (config.entrypoint) {
|
|
19790
|
+
for (const [ext, runtime] of Object.entries(import_types.ENTRYPOINT_EXTENSIONS)) {
|
|
19791
|
+
if (config.entrypoint.endsWith(ext)) {
|
|
19792
|
+
return runtime;
|
|
19793
|
+
}
|
|
19794
|
+
}
|
|
19795
|
+
}
|
|
19796
|
+
return void 0;
|
|
19797
|
+
}
|
|
19798
|
+
async function readVercelConfig(fs5) {
|
|
19799
|
+
const hasVercelJson = await fs5.hasPath("vercel.json");
|
|
19800
|
+
if (!hasVercelJson) {
|
|
19801
|
+
return { config: null, error: null };
|
|
19802
|
+
}
|
|
19803
|
+
try {
|
|
19804
|
+
const content = await fs5.readFile("vercel.json");
|
|
19805
|
+
const config = JSON.parse(content.toString());
|
|
19806
|
+
return { config, error: null };
|
|
19807
|
+
} catch {
|
|
19808
|
+
return {
|
|
19809
|
+
config: null,
|
|
19810
|
+
error: {
|
|
19811
|
+
code: "INVALID_VERCEL_JSON",
|
|
19812
|
+
message: "Failed to parse vercel.json. Ensure it contains valid JSON."
|
|
19813
|
+
}
|
|
19814
|
+
};
|
|
19815
|
+
}
|
|
19816
|
+
}
|
|
19817
|
+
}
|
|
19818
|
+
});
|
|
19819
|
+
|
|
19820
|
+
// ../fs-detectors/dist/services/resolve.js
|
|
19821
|
+
var require_resolve = __commonJS({
|
|
19822
|
+
"../fs-detectors/dist/services/resolve.js"(exports2, module2) {
|
|
19536
19823
|
"use strict";
|
|
19537
19824
|
var __create2 = Object.create;
|
|
19538
19825
|
var __defProp2 = Object.defineProperty;
|
|
@@ -19561,61 +19848,666 @@ var require_detect_builders = __commonJS({
|
|
|
19561
19848
|
mod
|
|
19562
19849
|
));
|
|
19563
19850
|
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
|
|
19851
|
+
var resolve_exports = {};
|
|
19852
|
+
__export2(resolve_exports, {
|
|
19853
|
+
resolveAllConfiguredServices: () => resolveAllConfiguredServices,
|
|
19854
|
+
resolveConfiguredService: () => resolveConfiguredService,
|
|
19855
|
+
validateServiceConfig: () => validateServiceConfig
|
|
19574
19856
|
});
|
|
19575
|
-
module2.exports = __toCommonJS2(
|
|
19576
|
-
var import_minimatch = __toESM2(require_minimatch());
|
|
19577
|
-
var import_semver2 = require_semver3();
|
|
19857
|
+
module2.exports = __toCommonJS2(resolve_exports);
|
|
19578
19858
|
var import_path7 = require("path");
|
|
19859
|
+
var import_types = require_types2();
|
|
19860
|
+
var import_utils = require_utils4();
|
|
19579
19861
|
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
|
-
}
|
|
19862
|
+
var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
|
|
19863
|
+
function validateServiceConfig(name, config) {
|
|
19864
|
+
if (!config || typeof config !== "object") {
|
|
19865
|
+
return {
|
|
19866
|
+
code: "INVALID_SERVICE_CONFIG",
|
|
19867
|
+
message: `Service "${name}" has an invalid configuration. Expected an object.`,
|
|
19868
|
+
serviceName: name
|
|
19869
|
+
};
|
|
19609
19870
|
}
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19871
|
+
const serviceType = config.type || "web";
|
|
19872
|
+
if (serviceType === "web" && !config.routePrefix) {
|
|
19873
|
+
return {
|
|
19874
|
+
code: "MISSING_ROUTE_PREFIX",
|
|
19875
|
+
message: `Web service "${name}" must specify "routePrefix".`,
|
|
19876
|
+
serviceName: name
|
|
19877
|
+
};
|
|
19878
|
+
}
|
|
19879
|
+
if ((serviceType === "worker" || serviceType === "cron") && config.routePrefix) {
|
|
19880
|
+
return {
|
|
19881
|
+
code: "INVALID_ROUTE_PREFIX",
|
|
19882
|
+
message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "routePrefix". Only web services should specify "routePrefix".`,
|
|
19883
|
+
serviceName: name
|
|
19884
|
+
};
|
|
19885
|
+
}
|
|
19886
|
+
if (serviceType === "cron" && !config.schedule) {
|
|
19887
|
+
return {
|
|
19888
|
+
code: "MISSING_CRON_SCHEDULE",
|
|
19889
|
+
message: `Cron service "${name}" is missing required "schedule" field.`,
|
|
19890
|
+
serviceName: name
|
|
19891
|
+
};
|
|
19892
|
+
}
|
|
19893
|
+
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
19894
|
+
return {
|
|
19895
|
+
code: "INVALID_RUNTIME",
|
|
19896
|
+
message: `Service "${name}" has invalid runtime "${config.runtime}".`,
|
|
19897
|
+
serviceName: name
|
|
19898
|
+
};
|
|
19899
|
+
}
|
|
19900
|
+
if (config.framework && !frameworksBySlug.has(config.framework)) {
|
|
19901
|
+
return {
|
|
19902
|
+
code: "INVALID_FRAMEWORK",
|
|
19903
|
+
message: `Service "${name}" has invalid framework "${config.framework}".`,
|
|
19904
|
+
serviceName: name
|
|
19905
|
+
};
|
|
19906
|
+
}
|
|
19907
|
+
const hasFramework = Boolean(config.framework);
|
|
19908
|
+
const hasBuilderOrRuntime = Boolean(config.builder || config.runtime);
|
|
19909
|
+
const hasEntrypoint = Boolean(config.entrypoint);
|
|
19910
|
+
if (!hasFramework && !hasBuilderOrRuntime && !hasEntrypoint) {
|
|
19911
|
+
return {
|
|
19912
|
+
code: "MISSING_SERVICE_CONFIG",
|
|
19913
|
+
message: `Service "${name}" must specify "framework", "entrypoint", or both "builder"/"runtime" with "entrypoint".`,
|
|
19914
|
+
serviceName: name
|
|
19915
|
+
};
|
|
19916
|
+
}
|
|
19917
|
+
if (hasBuilderOrRuntime && !hasFramework && !hasEntrypoint) {
|
|
19918
|
+
return {
|
|
19919
|
+
code: "MISSING_ENTRYPOINT",
|
|
19920
|
+
message: `Service "${name}" must specify "entrypoint" when using "${config.builder ? "builder" : "runtime"}".`,
|
|
19921
|
+
serviceName: name
|
|
19922
|
+
};
|
|
19923
|
+
}
|
|
19924
|
+
if (hasEntrypoint && !hasBuilderOrRuntime && !hasFramework) {
|
|
19925
|
+
const runtime = (0, import_utils.inferServiceRuntime)({ entrypoint: config.entrypoint });
|
|
19926
|
+
if (!runtime) {
|
|
19927
|
+
const supported = Object.keys(import_types.ENTRYPOINT_EXTENSIONS).join(", ");
|
|
19928
|
+
return {
|
|
19929
|
+
code: "UNSUPPORTED_ENTRYPOINT",
|
|
19930
|
+
message: `Service "${name}" has unsupported entrypoint "${config.entrypoint}". Use a supported extension (${supported}) or specify "builder", "framework", or "runtime".`,
|
|
19931
|
+
serviceName: name
|
|
19932
|
+
};
|
|
19933
|
+
}
|
|
19934
|
+
}
|
|
19935
|
+
return null;
|
|
19936
|
+
}
|
|
19937
|
+
function resolveConfiguredService(name, config, group) {
|
|
19938
|
+
const type = config.type || "web";
|
|
19939
|
+
const workspace = config.workspace || ".";
|
|
19940
|
+
const topic = type === "worker" ? config.topic || "default" : config.topic;
|
|
19941
|
+
const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
|
|
19942
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)(config);
|
|
19943
|
+
let builderUse;
|
|
19944
|
+
let builderSrc;
|
|
19945
|
+
if (config.framework) {
|
|
19946
|
+
const framework = frameworksBySlug.get(config.framework);
|
|
19947
|
+
builderUse = framework?.useRuntime?.use || "@vercel/static-build";
|
|
19948
|
+
builderSrc = config.entrypoint || framework?.useRuntime?.src || "package.json";
|
|
19949
|
+
} else if (config.builder) {
|
|
19950
|
+
builderUse = config.builder;
|
|
19951
|
+
builderSrc = config.entrypoint;
|
|
19952
|
+
} else {
|
|
19953
|
+
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
19954
|
+
builderSrc = config.entrypoint;
|
|
19955
|
+
}
|
|
19956
|
+
const routePrefix = type === "web" && config.routePrefix ? config.routePrefix.startsWith("/") ? config.routePrefix : `/${config.routePrefix}` : void 0;
|
|
19957
|
+
const isRoot = workspace === ".";
|
|
19958
|
+
if (!isRoot && !builderSrc.startsWith(workspace + "/")) {
|
|
19959
|
+
builderSrc = import_path7.posix.join(workspace, builderSrc);
|
|
19960
|
+
}
|
|
19961
|
+
const builderConfig = {};
|
|
19962
|
+
if (config.memory)
|
|
19963
|
+
builderConfig.memory = config.memory;
|
|
19964
|
+
if (config.maxDuration)
|
|
19965
|
+
builderConfig.maxDuration = config.maxDuration;
|
|
19966
|
+
if (config.includeFiles)
|
|
19967
|
+
builderConfig.includeFiles = config.includeFiles;
|
|
19968
|
+
if (config.excludeFiles)
|
|
19969
|
+
builderConfig.excludeFiles = config.excludeFiles;
|
|
19970
|
+
const isStaticBuild2 = import_types.STATIC_BUILDERS.has(builderUse);
|
|
19971
|
+
const runtime = isStaticBuild2 ? void 0 : inferredRuntime;
|
|
19972
|
+
if (routePrefix) {
|
|
19973
|
+
const stripped = routePrefix.startsWith("/") ? routePrefix.slice(1) : routePrefix;
|
|
19974
|
+
builderConfig.routePrefix = stripped || ".";
|
|
19975
|
+
}
|
|
19976
|
+
if (config.framework) {
|
|
19977
|
+
builderConfig.framework = config.framework;
|
|
19978
|
+
}
|
|
19979
|
+
return {
|
|
19980
|
+
name,
|
|
19981
|
+
type,
|
|
19982
|
+
group,
|
|
19983
|
+
workspace,
|
|
19984
|
+
entrypoint: config.entrypoint,
|
|
19985
|
+
routePrefix,
|
|
19986
|
+
framework: config.framework,
|
|
19987
|
+
builder: {
|
|
19988
|
+
src: builderSrc,
|
|
19989
|
+
use: builderUse,
|
|
19990
|
+
config: Object.keys(builderConfig).length > 0 ? builderConfig : void 0
|
|
19991
|
+
},
|
|
19992
|
+
runtime,
|
|
19993
|
+
buildCommand: config.buildCommand,
|
|
19994
|
+
installCommand: config.installCommand,
|
|
19995
|
+
schedule: config.schedule,
|
|
19996
|
+
topic,
|
|
19997
|
+
consumer
|
|
19998
|
+
};
|
|
19999
|
+
}
|
|
20000
|
+
function resolveAllConfiguredServices(services) {
|
|
20001
|
+
const resolved = [];
|
|
20002
|
+
const errors = [];
|
|
20003
|
+
for (const name of Object.keys(services)) {
|
|
20004
|
+
const serviceConfig = services[name];
|
|
20005
|
+
const validationError = validateServiceConfig(name, serviceConfig);
|
|
20006
|
+
if (validationError) {
|
|
20007
|
+
errors.push(validationError);
|
|
20008
|
+
continue;
|
|
20009
|
+
}
|
|
20010
|
+
const service = resolveConfiguredService(name, serviceConfig);
|
|
20011
|
+
resolved.push(service);
|
|
20012
|
+
}
|
|
20013
|
+
return { services: resolved, errors };
|
|
20014
|
+
}
|
|
20015
|
+
}
|
|
20016
|
+
});
|
|
20017
|
+
|
|
20018
|
+
// ../fs-detectors/dist/services/detect-services.js
|
|
20019
|
+
var require_detect_services = __commonJS({
|
|
20020
|
+
"../fs-detectors/dist/services/detect-services.js"(exports2, module2) {
|
|
20021
|
+
"use strict";
|
|
20022
|
+
var __defProp2 = Object.defineProperty;
|
|
20023
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20024
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20025
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20026
|
+
var __export2 = (target, all) => {
|
|
20027
|
+
for (var name in all)
|
|
20028
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20029
|
+
};
|
|
20030
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20031
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20032
|
+
for (let key of __getOwnPropNames2(from))
|
|
20033
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20034
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20035
|
+
}
|
|
20036
|
+
return to;
|
|
20037
|
+
};
|
|
20038
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20039
|
+
var detect_services_exports = {};
|
|
20040
|
+
__export2(detect_services_exports, {
|
|
20041
|
+
detectServices: () => detectServices2,
|
|
20042
|
+
generateServicesRoutes: () => generateServicesRoutes2
|
|
20043
|
+
});
|
|
20044
|
+
module2.exports = __toCommonJS2(detect_services_exports);
|
|
20045
|
+
var import_utils = require_utils4();
|
|
20046
|
+
var import_resolve = require_resolve();
|
|
20047
|
+
async function detectServices2(options) {
|
|
20048
|
+
const { fs: fs5, workPath } = options;
|
|
20049
|
+
const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
|
|
20050
|
+
const { config: vercelConfig, error: configError } = await (0, import_utils.readVercelConfig)(scopedFs);
|
|
20051
|
+
if (configError) {
|
|
20052
|
+
return {
|
|
20053
|
+
services: [],
|
|
20054
|
+
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
20055
|
+
errors: [configError],
|
|
20056
|
+
warnings: []
|
|
20057
|
+
};
|
|
20058
|
+
}
|
|
20059
|
+
const configuredServices = vercelConfig?.experimentalServices;
|
|
20060
|
+
const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
|
|
20061
|
+
if (!hasConfiguredServices) {
|
|
20062
|
+
return {
|
|
20063
|
+
services: [],
|
|
20064
|
+
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
20065
|
+
errors: [
|
|
20066
|
+
{
|
|
20067
|
+
code: "NO_SERVICES_CONFIGURED",
|
|
20068
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
20069
|
+
}
|
|
20070
|
+
],
|
|
20071
|
+
warnings: []
|
|
20072
|
+
};
|
|
20073
|
+
}
|
|
20074
|
+
const result = (0, import_resolve.resolveAllConfiguredServices)(configuredServices);
|
|
20075
|
+
const routes = generateServicesRoutes2(result.services);
|
|
20076
|
+
return {
|
|
20077
|
+
services: result.services,
|
|
20078
|
+
routes,
|
|
20079
|
+
errors: result.errors,
|
|
20080
|
+
warnings: []
|
|
20081
|
+
};
|
|
20082
|
+
}
|
|
20083
|
+
function generateServicesRoutes2(services) {
|
|
20084
|
+
const rewrites = [];
|
|
20085
|
+
const defaults = [];
|
|
20086
|
+
const crons = [];
|
|
20087
|
+
const workers = [];
|
|
20088
|
+
const sortedWebServices = services.filter(
|
|
20089
|
+
(s) => s.type === "web" && typeof s.routePrefix === "string"
|
|
20090
|
+
).sort((a, b) => b.routePrefix.length - a.routePrefix.length);
|
|
20091
|
+
for (const service of sortedWebServices) {
|
|
20092
|
+
const { routePrefix } = service;
|
|
20093
|
+
const normalizedPrefix = routePrefix.slice(1);
|
|
20094
|
+
if ((0, import_utils.isStaticBuild)(service)) {
|
|
20095
|
+
if (routePrefix === "/") {
|
|
20096
|
+
defaults.push({ handle: "filesystem" });
|
|
20097
|
+
defaults.push({ src: "/(.*)", dest: "/index.html" });
|
|
20098
|
+
} else {
|
|
20099
|
+
rewrites.push({
|
|
20100
|
+
src: `^/${normalizedPrefix}(?:/.*)?$`,
|
|
20101
|
+
dest: `/${normalizedPrefix}/index.html`
|
|
20102
|
+
});
|
|
20103
|
+
}
|
|
20104
|
+
} else {
|
|
20105
|
+
const builderSrc = service.builder.src || routePrefix;
|
|
20106
|
+
const functionPath = builderSrc.startsWith("/") ? builderSrc : `/${builderSrc}`;
|
|
20107
|
+
if (routePrefix === "/") {
|
|
20108
|
+
defaults.push({ src: "^/(.*)$", dest: functionPath, check: true });
|
|
20109
|
+
} else {
|
|
20110
|
+
rewrites.push({
|
|
20111
|
+
src: `^/${normalizedPrefix}(?:/.*)?$`,
|
|
20112
|
+
dest: functionPath,
|
|
20113
|
+
check: true
|
|
20114
|
+
});
|
|
20115
|
+
}
|
|
20116
|
+
}
|
|
20117
|
+
}
|
|
20118
|
+
return { rewrites, defaults, crons, workers };
|
|
20119
|
+
}
|
|
20120
|
+
}
|
|
20121
|
+
});
|
|
20122
|
+
|
|
20123
|
+
// ../fs-detectors/dist/detectors/filesystem.js
|
|
20124
|
+
var require_filesystem = __commonJS({
|
|
20125
|
+
"../fs-detectors/dist/detectors/filesystem.js"(exports2, module2) {
|
|
20126
|
+
"use strict";
|
|
20127
|
+
var __defProp2 = Object.defineProperty;
|
|
20128
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20129
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20130
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20131
|
+
var __export2 = (target, all) => {
|
|
20132
|
+
for (var name in all)
|
|
20133
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20134
|
+
};
|
|
20135
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20136
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20137
|
+
for (let key of __getOwnPropNames2(from))
|
|
20138
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20139
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20140
|
+
}
|
|
20141
|
+
return to;
|
|
20142
|
+
};
|
|
20143
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20144
|
+
var filesystem_exports = {};
|
|
20145
|
+
__export2(filesystem_exports, {
|
|
20146
|
+
DetectorFilesystem: () => DetectorFilesystem2
|
|
20147
|
+
});
|
|
20148
|
+
module2.exports = __toCommonJS2(filesystem_exports);
|
|
20149
|
+
var import_path7 = require("path");
|
|
20150
|
+
var DetectorFilesystem2 = class {
|
|
20151
|
+
constructor() {
|
|
20152
|
+
this.hasPath = async (path6) => {
|
|
20153
|
+
let p = this.pathCache.get(path6);
|
|
20154
|
+
if (!p) {
|
|
20155
|
+
p = this._hasPath(path6);
|
|
20156
|
+
this.pathCache.set(path6, p);
|
|
20157
|
+
}
|
|
20158
|
+
return p;
|
|
20159
|
+
};
|
|
20160
|
+
this.isFile = async (name) => {
|
|
20161
|
+
let p = this.fileCache.get(name);
|
|
20162
|
+
if (!p) {
|
|
20163
|
+
p = this._isFile(name);
|
|
20164
|
+
this.fileCache.set(name, p);
|
|
20165
|
+
}
|
|
20166
|
+
return p;
|
|
20167
|
+
};
|
|
20168
|
+
this.readFile = async (name) => {
|
|
20169
|
+
let p = this.readFileCache.get(name);
|
|
20170
|
+
if (!p) {
|
|
20171
|
+
p = this._readFile(name);
|
|
20172
|
+
this.readFileCache.set(name, p);
|
|
20173
|
+
}
|
|
20174
|
+
return p;
|
|
20175
|
+
};
|
|
20176
|
+
this.readdir = async (dirPath, options) => {
|
|
20177
|
+
let p = this.readdirCache.get(dirPath);
|
|
20178
|
+
if (!p) {
|
|
20179
|
+
p = this._readdir(dirPath);
|
|
20180
|
+
this.readdirCache.set(dirPath, p);
|
|
20181
|
+
}
|
|
20182
|
+
const directoryContent = await p;
|
|
20183
|
+
const directoryFiles = /* @__PURE__ */ new Set();
|
|
20184
|
+
for (const file of directoryContent) {
|
|
20185
|
+
if (file.type === "file") {
|
|
20186
|
+
this.fileCache.set(file.path, Promise.resolve(true));
|
|
20187
|
+
this.pathCache.set(file.path, Promise.resolve(true));
|
|
20188
|
+
directoryFiles.add(file.name);
|
|
20189
|
+
}
|
|
20190
|
+
}
|
|
20191
|
+
if (options?.potentialFiles) {
|
|
20192
|
+
const filesInReaddirDir = options.potentialFiles.filter(
|
|
20193
|
+
(path6) => (0, import_path7.basename)(path6) === path6
|
|
20194
|
+
);
|
|
20195
|
+
const filesThatDoNotExist = filesInReaddirDir.filter(
|
|
20196
|
+
(path6) => !directoryFiles.has(path6)
|
|
20197
|
+
);
|
|
20198
|
+
for (const filePath of filesThatDoNotExist) {
|
|
20199
|
+
const fullFilePath = dirPath === "/" ? filePath : import_path7.posix.join(dirPath, filePath);
|
|
20200
|
+
this.fileCache.set(fullFilePath, Promise.resolve(false));
|
|
20201
|
+
this.pathCache.set(fullFilePath, Promise.resolve(false));
|
|
20202
|
+
}
|
|
20203
|
+
}
|
|
20204
|
+
return p;
|
|
20205
|
+
};
|
|
20206
|
+
this.chdir = (name) => {
|
|
20207
|
+
return this._chdir(name);
|
|
20208
|
+
};
|
|
20209
|
+
this.writeFile = async (name, content) => {
|
|
20210
|
+
this.readFileCache.set(name, Promise.resolve(Buffer.from(content)));
|
|
20211
|
+
this.fileCache.set(name, Promise.resolve(true));
|
|
20212
|
+
this.pathCache.set(name, Promise.resolve(true));
|
|
20213
|
+
};
|
|
20214
|
+
this.pathCache = /* @__PURE__ */ new Map();
|
|
20215
|
+
this.fileCache = /* @__PURE__ */ new Map();
|
|
20216
|
+
this.readFileCache = /* @__PURE__ */ new Map();
|
|
20217
|
+
this.readdirCache = /* @__PURE__ */ new Map();
|
|
20218
|
+
}
|
|
20219
|
+
};
|
|
20220
|
+
}
|
|
20221
|
+
});
|
|
20222
|
+
|
|
20223
|
+
// ../fs-detectors/dist/detectors/local-file-system-detector.js
|
|
20224
|
+
var require_local_file_system_detector = __commonJS({
|
|
20225
|
+
"../fs-detectors/dist/detectors/local-file-system-detector.js"(exports2, module2) {
|
|
20226
|
+
"use strict";
|
|
20227
|
+
var __create2 = Object.create;
|
|
20228
|
+
var __defProp2 = Object.defineProperty;
|
|
20229
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20230
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20231
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
20232
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20233
|
+
var __export2 = (target, all) => {
|
|
20234
|
+
for (var name in all)
|
|
20235
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20236
|
+
};
|
|
20237
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20238
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20239
|
+
for (let key of __getOwnPropNames2(from))
|
|
20240
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20241
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20242
|
+
}
|
|
20243
|
+
return to;
|
|
20244
|
+
};
|
|
20245
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
20246
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20247
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20248
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20249
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20250
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
20251
|
+
mod
|
|
20252
|
+
));
|
|
20253
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20254
|
+
var local_file_system_detector_exports = {};
|
|
20255
|
+
__export2(local_file_system_detector_exports, {
|
|
20256
|
+
LocalFileSystemDetector: () => LocalFileSystemDetector3
|
|
20257
|
+
});
|
|
20258
|
+
module2.exports = __toCommonJS2(local_file_system_detector_exports);
|
|
20259
|
+
var import_promises = __toESM2(require("fs/promises"));
|
|
20260
|
+
var import_path7 = require("path");
|
|
20261
|
+
var import_filesystem = require_filesystem();
|
|
20262
|
+
var import_error_utils3 = require_dist();
|
|
20263
|
+
var LocalFileSystemDetector3 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
|
|
20264
|
+
constructor(rootPath) {
|
|
20265
|
+
super();
|
|
20266
|
+
this.rootPath = rootPath;
|
|
20267
|
+
}
|
|
20268
|
+
async _hasPath(name) {
|
|
20269
|
+
try {
|
|
20270
|
+
await import_promises.default.stat(this.getFilePath(name));
|
|
20271
|
+
return true;
|
|
20272
|
+
} catch (err) {
|
|
20273
|
+
if ((0, import_error_utils3.isErrnoException)(err) && err.code === "ENOENT") {
|
|
20274
|
+
return false;
|
|
20275
|
+
}
|
|
20276
|
+
throw err;
|
|
20277
|
+
}
|
|
20278
|
+
}
|
|
20279
|
+
_readFile(name) {
|
|
20280
|
+
return import_promises.default.readFile(this.getFilePath(name));
|
|
20281
|
+
}
|
|
20282
|
+
async _isFile(name) {
|
|
20283
|
+
const stat = await import_promises.default.stat(this.getFilePath(name));
|
|
20284
|
+
return stat.isFile();
|
|
20285
|
+
}
|
|
20286
|
+
async _readdir(dir) {
|
|
20287
|
+
const dirPath = this.getFilePath(dir);
|
|
20288
|
+
const entries = await import_promises.default.readdir(dirPath, { withFileTypes: true });
|
|
20289
|
+
const result = [];
|
|
20290
|
+
for (const entry of entries) {
|
|
20291
|
+
let type;
|
|
20292
|
+
if (entry.isFile()) {
|
|
20293
|
+
type = "file";
|
|
20294
|
+
} else if (entry.isDirectory()) {
|
|
20295
|
+
type = "dir";
|
|
20296
|
+
} else {
|
|
20297
|
+
continue;
|
|
20298
|
+
}
|
|
20299
|
+
result.push({
|
|
20300
|
+
name: entry.name,
|
|
20301
|
+
path: (0, import_path7.join)(this.getRelativeFilePath(dir), entry.name),
|
|
20302
|
+
type
|
|
20303
|
+
});
|
|
20304
|
+
}
|
|
20305
|
+
return result;
|
|
20306
|
+
}
|
|
20307
|
+
_chdir(name) {
|
|
20308
|
+
return new _LocalFileSystemDetector(this.getFilePath(name));
|
|
20309
|
+
}
|
|
20310
|
+
getRelativeFilePath(name) {
|
|
20311
|
+
return name.startsWith(this.rootPath) ? (0, import_path7.relative)(this.rootPath, name) : name;
|
|
20312
|
+
}
|
|
20313
|
+
getFilePath(name) {
|
|
20314
|
+
return (0, import_path7.join)(this.rootPath, this.getRelativeFilePath(name));
|
|
20315
|
+
}
|
|
20316
|
+
};
|
|
20317
|
+
}
|
|
20318
|
+
});
|
|
20319
|
+
|
|
20320
|
+
// ../fs-detectors/dist/services/get-services-builders.js
|
|
20321
|
+
var require_get_services_builders = __commonJS({
|
|
20322
|
+
"../fs-detectors/dist/services/get-services-builders.js"(exports2, module2) {
|
|
20323
|
+
"use strict";
|
|
20324
|
+
var __defProp2 = Object.defineProperty;
|
|
20325
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20326
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20327
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20328
|
+
var __export2 = (target, all) => {
|
|
20329
|
+
for (var name in all)
|
|
20330
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20331
|
+
};
|
|
20332
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20333
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20334
|
+
for (let key of __getOwnPropNames2(from))
|
|
20335
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20336
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20337
|
+
}
|
|
20338
|
+
return to;
|
|
20339
|
+
};
|
|
20340
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20341
|
+
var get_services_builders_exports = {};
|
|
20342
|
+
__export2(get_services_builders_exports, {
|
|
20343
|
+
getServicesBuilders: () => getServicesBuilders2
|
|
20344
|
+
});
|
|
20345
|
+
module2.exports = __toCommonJS2(get_services_builders_exports);
|
|
20346
|
+
var import_detect_services = require_detect_services();
|
|
20347
|
+
var import_local_file_system_detector = require_local_file_system_detector();
|
|
20348
|
+
async function getServicesBuilders2(options) {
|
|
20349
|
+
const { workPath } = options;
|
|
20350
|
+
if (!workPath) {
|
|
20351
|
+
return {
|
|
20352
|
+
builders: null,
|
|
20353
|
+
errors: [
|
|
20354
|
+
{
|
|
20355
|
+
code: "MISSING_WORK_PATH",
|
|
20356
|
+
message: "workPath is required for services detection."
|
|
20357
|
+
}
|
|
20358
|
+
],
|
|
20359
|
+
warnings: [],
|
|
20360
|
+
defaultRoutes: null,
|
|
20361
|
+
redirectRoutes: null,
|
|
20362
|
+
rewriteRoutes: null,
|
|
20363
|
+
errorRoutes: null
|
|
20364
|
+
};
|
|
20365
|
+
}
|
|
20366
|
+
const fs5 = new import_local_file_system_detector.LocalFileSystemDetector(workPath);
|
|
20367
|
+
const result = await (0, import_detect_services.detectServices)({ fs: fs5 });
|
|
20368
|
+
const warningResponses = result.warnings.map((w) => ({
|
|
20369
|
+
code: w.code,
|
|
20370
|
+
message: w.message
|
|
20371
|
+
}));
|
|
20372
|
+
if (result.errors.length > 0) {
|
|
20373
|
+
return {
|
|
20374
|
+
builders: null,
|
|
20375
|
+
errors: result.errors.map((e) => ({
|
|
20376
|
+
code: e.code,
|
|
20377
|
+
message: e.message
|
|
20378
|
+
})),
|
|
20379
|
+
warnings: warningResponses,
|
|
20380
|
+
defaultRoutes: null,
|
|
20381
|
+
redirectRoutes: null,
|
|
20382
|
+
rewriteRoutes: null,
|
|
20383
|
+
errorRoutes: null
|
|
20384
|
+
};
|
|
20385
|
+
}
|
|
20386
|
+
if (result.services.length === 0) {
|
|
20387
|
+
return {
|
|
20388
|
+
builders: null,
|
|
20389
|
+
errors: [
|
|
20390
|
+
{
|
|
20391
|
+
code: "NO_SERVICES_CONFIGURED",
|
|
20392
|
+
message: "No services configured. Add `experimentalServices` to vercel.json."
|
|
20393
|
+
}
|
|
20394
|
+
],
|
|
20395
|
+
warnings: warningResponses,
|
|
20396
|
+
defaultRoutes: null,
|
|
20397
|
+
redirectRoutes: null,
|
|
20398
|
+
rewriteRoutes: null,
|
|
20399
|
+
errorRoutes: null
|
|
20400
|
+
};
|
|
20401
|
+
}
|
|
20402
|
+
const builders = result.services.map((service) => service.builder);
|
|
20403
|
+
return {
|
|
20404
|
+
builders: builders.length > 0 ? builders : null,
|
|
20405
|
+
errors: null,
|
|
20406
|
+
warnings: warningResponses,
|
|
20407
|
+
defaultRoutes: result.routes.defaults.length > 0 ? result.routes.defaults : null,
|
|
20408
|
+
redirectRoutes: [],
|
|
20409
|
+
rewriteRoutes: result.routes.rewrites.length > 0 ? result.routes.rewrites : null,
|
|
20410
|
+
errorRoutes: [],
|
|
20411
|
+
services: result.services
|
|
20412
|
+
};
|
|
20413
|
+
}
|
|
20414
|
+
}
|
|
20415
|
+
});
|
|
20416
|
+
|
|
20417
|
+
// ../fs-detectors/dist/detect-builders.js
|
|
20418
|
+
var require_detect_builders = __commonJS({
|
|
20419
|
+
"../fs-detectors/dist/detect-builders.js"(exports2, module2) {
|
|
20420
|
+
"use strict";
|
|
20421
|
+
var __create2 = Object.create;
|
|
20422
|
+
var __defProp2 = Object.defineProperty;
|
|
20423
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
20424
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
20425
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
20426
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
20427
|
+
var __export2 = (target, all) => {
|
|
20428
|
+
for (var name in all)
|
|
20429
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20430
|
+
};
|
|
20431
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
20432
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20433
|
+
for (let key of __getOwnPropNames2(from))
|
|
20434
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
20435
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
20436
|
+
}
|
|
20437
|
+
return to;
|
|
20438
|
+
};
|
|
20439
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
20440
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20441
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20442
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20443
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20444
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
20445
|
+
mod
|
|
20446
|
+
));
|
|
20447
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
20448
|
+
var detect_builders_exports = {};
|
|
20449
|
+
__export2(detect_builders_exports, {
|
|
20450
|
+
REGEX_MIDDLEWARE_FILES: () => REGEX_MIDDLEWARE_FILES,
|
|
20451
|
+
REGEX_NON_VERCEL_PLATFORM_FILES: () => REGEX_NON_VERCEL_PLATFORM_FILES2,
|
|
20452
|
+
REGEX_VERCEL_PLATFORM_FILES: () => REGEX_VERCEL_PLATFORM_FILES,
|
|
20453
|
+
detectApiDirectory: () => detectApiDirectory2,
|
|
20454
|
+
detectApiExtensions: () => detectApiExtensions2,
|
|
20455
|
+
detectBuilders: () => detectBuilders2,
|
|
20456
|
+
detectOutputDirectory: () => detectOutputDirectory2,
|
|
20457
|
+
sortFiles: () => sortFiles
|
|
20458
|
+
});
|
|
20459
|
+
module2.exports = __toCommonJS2(detect_builders_exports);
|
|
20460
|
+
var import_minimatch = __toESM2(require_minimatch());
|
|
20461
|
+
var import_semver2 = require_semver3();
|
|
20462
|
+
var import_path7 = require("path");
|
|
20463
|
+
var import_frameworks2 = __toESM2(require_frameworks());
|
|
20464
|
+
var import_is_official_runtime = require_is_official_runtime();
|
|
20465
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
|
20466
|
+
var import_get_services_builders = require_get_services_builders();
|
|
20467
|
+
var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
|
|
20468
|
+
var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
|
|
20469
|
+
var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
|
|
20470
|
+
var slugToFramework = new Map(
|
|
20471
|
+
import_frameworks2.default.map((f) => [f.slug, f])
|
|
20472
|
+
);
|
|
20473
|
+
function sortFiles(fileA, fileB) {
|
|
20474
|
+
return fileA.localeCompare(fileB);
|
|
20475
|
+
}
|
|
20476
|
+
function detectApiExtensions2(builders) {
|
|
20477
|
+
return new Set(
|
|
20478
|
+
builders.filter(
|
|
20479
|
+
(b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith("api/"))
|
|
20480
|
+
).map((b) => (0, import_path7.extname)(b.src)).filter(Boolean)
|
|
20481
|
+
);
|
|
20482
|
+
}
|
|
20483
|
+
function detectApiDirectory2(builders) {
|
|
20484
|
+
const found = builders.some(
|
|
20485
|
+
(b) => b.config && b.config.zeroConfig && b.src?.startsWith("api/")
|
|
20486
|
+
);
|
|
20487
|
+
return found ? "api" : null;
|
|
20488
|
+
}
|
|
20489
|
+
function getPublicBuilder(builders) {
|
|
20490
|
+
for (const builder of builders) {
|
|
20491
|
+
if (typeof builder.src === "string" && (0, import_is_official_runtime.isOfficialRuntime)("static", builder.use) && /^.*\/\*\*\/\*$/.test(builder.src) && builder.config?.zeroConfig === true) {
|
|
20492
|
+
return builder;
|
|
20493
|
+
}
|
|
20494
|
+
}
|
|
20495
|
+
return null;
|
|
20496
|
+
}
|
|
20497
|
+
function detectOutputDirectory2(builders) {
|
|
20498
|
+
const publicBuilder = getPublicBuilder(builders);
|
|
20499
|
+
return publicBuilder ? publicBuilder.src.replace("/**/*", "") : null;
|
|
20500
|
+
}
|
|
20501
|
+
async function detectBuilders2(files, pkg, options = {}) {
|
|
20502
|
+
const { projectSettings = {} } = options;
|
|
20503
|
+
const { framework } = projectSettings;
|
|
20504
|
+
if (framework === "services") {
|
|
20505
|
+
return (0, import_get_services_builders.getServicesBuilders)({
|
|
20506
|
+
workPath: options.workPath
|
|
20507
|
+
});
|
|
20508
|
+
}
|
|
20509
|
+
const errors = [];
|
|
20510
|
+
const warnings = [];
|
|
19619
20511
|
let apiBuilders = [];
|
|
19620
20512
|
let frontendBuilder = null;
|
|
19621
20513
|
const functionError = validateFunctions(options);
|
|
@@ -19639,8 +20531,7 @@ var require_detect_builders = __commonJS({
|
|
|
19639
20531
|
usedFunctions.add(key);
|
|
19640
20532
|
};
|
|
19641
20533
|
const absolutePathCache = /* @__PURE__ */ new Map();
|
|
19642
|
-
const {
|
|
19643
|
-
const { buildCommand, outputDirectory, framework } = projectSettings;
|
|
20534
|
+
const { buildCommand, outputDirectory } = projectSettings;
|
|
19644
20535
|
const frameworkConfig = slugToFramework.get(framework || "");
|
|
19645
20536
|
const ignoreRuntimes = new Set(frameworkConfig?.ignoreRuntimes);
|
|
19646
20537
|
const withTag = options.tag ? `@${options.tag}` : "";
|
|
@@ -19942,7 +20833,9 @@ var require_detect_builders = __commonJS({
|
|
|
19942
20833
|
const f = slugToFramework.get(framework || "");
|
|
19943
20834
|
if (f && f.useRuntime) {
|
|
19944
20835
|
const { src, use } = f.useRuntime;
|
|
19945
|
-
|
|
20836
|
+
const shouldUseUnifiedBackend = (0, import_build_utils5.isExperimentalBackendsEnabled)() && import_build_utils5.BACKEND_BUILDERS.includes(use);
|
|
20837
|
+
const finalUse = shouldUseUnifiedBackend ? import_build_utils5.UNIFIED_BACKEND_BUILDER : use;
|
|
20838
|
+
return { src, use: `${finalUse}${withTag}`, config };
|
|
19946
20839
|
}
|
|
19947
20840
|
const entrypoints = /* @__PURE__ */ new Set([
|
|
19948
20841
|
"package.json",
|
|
@@ -20285,230 +21178,68 @@ var require_detect_builders = __commonJS({
|
|
|
20285
21178
|
src: `^/api/(.+)${extGroup}$`,
|
|
20286
21179
|
dest: "/api/$1",
|
|
20287
21180
|
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;
|
|
21181
|
+
});
|
|
21182
|
+
}
|
|
21183
|
+
}
|
|
21184
|
+
rewriteRoutes.push(...dynamicRoutes);
|
|
21185
|
+
const hasApiBuild = apiBuilders.find((builder) => {
|
|
21186
|
+
return builder.src?.startsWith("api/");
|
|
21187
|
+
});
|
|
21188
|
+
if (typeof ignoreRuntimes === "undefined" && hasApiBuild) {
|
|
21189
|
+
rewriteRoutes.push({
|
|
21190
|
+
src: "^/api(/.*)?$",
|
|
21191
|
+
status: 404
|
|
21192
|
+
});
|
|
21193
|
+
}
|
|
21194
|
+
} else {
|
|
21195
|
+
defaultRoutes.push(...apiRoutes);
|
|
21196
|
+
if (apiRoutes.length) {
|
|
21197
|
+
defaultRoutes.push({
|
|
21198
|
+
status: 404,
|
|
21199
|
+
src: "^/api(/.*)?$"
|
|
21200
|
+
});
|
|
20506
21201
|
}
|
|
20507
|
-
const resolved = (0, import_resolve.resolveService)(name, serviceConfig);
|
|
20508
|
-
services.push(resolved);
|
|
20509
21202
|
}
|
|
20510
21203
|
}
|
|
20511
|
-
|
|
21204
|
+
if (outputDirectory && frontendBuilder && !options.featHandleMiss && (0, import_is_official_runtime.isOfficialRuntime)("static", frontendBuilder.use)) {
|
|
21205
|
+
defaultRoutes.push({
|
|
21206
|
+
src: "/(.*)",
|
|
21207
|
+
dest: `/${outputDirectory}/$1`
|
|
21208
|
+
});
|
|
21209
|
+
}
|
|
21210
|
+
if (options.featHandleMiss && !isNextjs && !isGatsby) {
|
|
21211
|
+
errorRoutes.push({
|
|
21212
|
+
status: 404,
|
|
21213
|
+
src: "^(?!/api).*$",
|
|
21214
|
+
dest: options.cleanUrls ? "/404" : "/404.html"
|
|
21215
|
+
});
|
|
21216
|
+
}
|
|
21217
|
+
return {
|
|
21218
|
+
defaultRoutes,
|
|
21219
|
+
redirectRoutes,
|
|
21220
|
+
rewriteRoutes,
|
|
21221
|
+
errorRoutes
|
|
21222
|
+
};
|
|
21223
|
+
}
|
|
21224
|
+
function sortFilesBySegmentCount(fileA, fileB) {
|
|
21225
|
+
const lengthA = fileA.split("/").length;
|
|
21226
|
+
const lengthB = fileB.split("/").length;
|
|
21227
|
+
if (lengthA > lengthB) {
|
|
21228
|
+
return -1;
|
|
21229
|
+
}
|
|
21230
|
+
if (lengthA < lengthB) {
|
|
21231
|
+
return 1;
|
|
21232
|
+
}
|
|
21233
|
+
const countSegments = (prev, segment) => getSegmentName(segment) ? prev + 1 : 0;
|
|
21234
|
+
const segmentLengthA = fileA.split("/").reduce(countSegments, 0);
|
|
21235
|
+
const segmentLengthB = fileB.split("/").reduce(countSegments, 0);
|
|
21236
|
+
if (segmentLengthA > segmentLengthB) {
|
|
21237
|
+
return 1;
|
|
21238
|
+
}
|
|
21239
|
+
if (segmentLengthA < segmentLengthB) {
|
|
21240
|
+
return -1;
|
|
21241
|
+
}
|
|
21242
|
+
return fileA.localeCompare(fileB);
|
|
20512
21243
|
}
|
|
20513
21244
|
}
|
|
20514
21245
|
});
|
|
@@ -21039,203 +21770,6 @@ var require_get_project_paths = __commonJS({
|
|
|
21039
21770
|
}
|
|
21040
21771
|
});
|
|
21041
21772
|
|
|
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
21773
|
// ../fs-detectors/dist/workspaces/workspace-managers.js
|
|
21240
21774
|
var require_workspace_managers = __commonJS({
|
|
21241
21775
|
"../fs-detectors/dist/workspaces/workspace-managers.js"(exports2, module2) {
|
|
@@ -28402,11 +28936,14 @@ var require_dist4 = __commonJS({
|
|
|
28402
28936
|
detectFrameworks: () => import_detect_framework.detectFrameworks,
|
|
28403
28937
|
detectInstrumentation: () => import_detect_instrumentation.detectInstrumentation,
|
|
28404
28938
|
detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
|
|
28405
|
-
detectServices: () =>
|
|
28939
|
+
detectServices: () => import_detect_services.detectServices,
|
|
28940
|
+
generateServicesRoutes: () => import_detect_services.generateServicesRoutes,
|
|
28406
28941
|
getProjectPaths: () => import_get_project_paths.getProjectPaths,
|
|
28942
|
+
getServicesBuilders: () => import_get_services_builders.getServicesBuilders,
|
|
28407
28943
|
getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
|
|
28408
28944
|
getWorkspaces: () => import_get_workspaces.getWorkspaces,
|
|
28409
28945
|
isOfficialRuntime: () => import_is_official_runtime.isOfficialRuntime,
|
|
28946
|
+
isStaticBuild: () => import_utils.isStaticBuild,
|
|
28410
28947
|
isStaticRuntime: () => import_is_official_runtime.isStaticRuntime,
|
|
28411
28948
|
monorepoManagers: () => import_monorepo_managers.monorepoManagers,
|
|
28412
28949
|
packageManagers: () => import_package_managers.packageManagers,
|
|
@@ -28414,7 +28951,9 @@ var require_dist4 = __commonJS({
|
|
|
28414
28951
|
});
|
|
28415
28952
|
module2.exports = __toCommonJS2(src_exports2);
|
|
28416
28953
|
var import_detect_builders = require_detect_builders();
|
|
28417
|
-
var
|
|
28954
|
+
var import_detect_services = require_detect_services();
|
|
28955
|
+
var import_utils = require_utils4();
|
|
28956
|
+
var import_get_services_builders = require_get_services_builders();
|
|
28418
28957
|
var import_detect_file_system_api = require_detect_file_system_api();
|
|
28419
28958
|
var import_detect_framework = require_detect_framework();
|
|
28420
28959
|
var import_get_project_paths = require_get_project_paths();
|
|
@@ -29519,8 +30058,9 @@ var build = async ({
|
|
|
29519
30058
|
meta = {}
|
|
29520
30059
|
}) => {
|
|
29521
30060
|
await (0, import_build_utils4.download)(files, workPath, meta);
|
|
29522
|
-
const
|
|
29523
|
-
const
|
|
30061
|
+
const routePrefix = config.routePrefix;
|
|
30062
|
+
const mountpoint = routePrefix ? routePrefix.replace(/^\//, "") || "." : import_path6.default.dirname(entrypoint);
|
|
30063
|
+
const entrypointDir = import_path6.default.join(workPath, import_path6.default.dirname(entrypoint));
|
|
29524
30064
|
let distPath = import_path6.default.join(
|
|
29525
30065
|
workPath,
|
|
29526
30066
|
import_path6.default.dirname(entrypoint),
|