@vercel/static-build 10.0.2 → 11.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +471 -380
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -19035,226 +19035,6 @@ var require_semver3 = __commonJS({
19035
19035
  }
19036
19036
  });
19037
19037
 
19038
- // ../../internals/runtimes/dist/constants.js
19039
- var require_constants2 = __commonJS({
19040
- "../../internals/runtimes/dist/constants.js"(exports, module2) {
19041
- "use strict";
19042
- var __defProp2 = Object.defineProperty;
19043
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19044
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
19045
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19046
- var __export2 = (target, all) => {
19047
- for (var name in all)
19048
- __defProp2(target, name, { get: all[name], enumerable: true });
19049
- };
19050
- var __copyProps2 = (to, from, except, desc) => {
19051
- if (from && typeof from === "object" || typeof from === "function") {
19052
- for (let key of __getOwnPropNames2(from))
19053
- if (!__hasOwnProp2.call(to, key) && key !== except)
19054
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19055
- }
19056
- return to;
19057
- };
19058
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19059
- var constants_exports = {};
19060
- __export2(constants_exports, {
19061
- BUILDER_RUNTIMES: () => BUILDER_RUNTIMES,
19062
- CONTAINER_ENTRYPOINT_CANDIDATES: () => CONTAINER_ENTRYPOINT_CANDIDATES,
19063
- ENTRYPOINT_EXTENSIONS: () => ENTRYPOINT_EXTENSIONS,
19064
- ROUTE_OWNING_BUILDERS: () => ROUTE_OWNING_BUILDERS,
19065
- RUNTIME_BUILDERS: () => RUNTIME_BUILDERS,
19066
- RUNTIME_MANIFESTS: () => RUNTIME_MANIFESTS,
19067
- STATIC_BUILDERS: () => STATIC_BUILDERS
19068
- });
19069
- module2.exports = __toCommonJS2(constants_exports);
19070
- var RUNTIME_BUILDERS = {
19071
- node: "@vercel/backends",
19072
- python: "@vercel/python",
19073
- go: "@vercel/go",
19074
- rust: "@vercel/rust",
19075
- ruby: "@vercel/ruby",
19076
- container: "@vercel/container"
19077
- };
19078
- var RUNTIME_MANIFESTS = {
19079
- node: ["package.json"],
19080
- python: [
19081
- "pyproject.toml",
19082
- "requirements.txt",
19083
- "Pipfile",
19084
- "pylock.yml",
19085
- "uv.lock",
19086
- "setup.py"
19087
- ],
19088
- go: ["go.mod"],
19089
- ruby: ["Gemfile"],
19090
- rust: ["Cargo.toml"]
19091
- };
19092
- var ENTRYPOINT_EXTENSIONS = {
19093
- ".ts": "node",
19094
- ".mts": "node",
19095
- ".js": "node",
19096
- ".mjs": "node",
19097
- ".cjs": "node",
19098
- ".py": "python",
19099
- ".go": "go",
19100
- ".rs": "rust",
19101
- ".rb": "ruby",
19102
- ".ru": "ruby"
19103
- };
19104
- var BUILDER_RUNTIMES = Object.fromEntries(
19105
- Object.entries(RUNTIME_BUILDERS).map(([runtime, builder]) => [
19106
- builder,
19107
- runtime
19108
- ])
19109
- );
19110
- var STATIC_BUILDERS = /* @__PURE__ */ new Set([
19111
- "@vercel/static-build",
19112
- "@vercel/static"
19113
- ]);
19114
- var ROUTE_OWNING_BUILDERS = /* @__PURE__ */ new Set([
19115
- "@vercel/next",
19116
- "@vercel/backends"
19117
- ]);
19118
- var CONTAINER_ENTRYPOINT_CANDIDATES = [
19119
- "Dockerfile.vercel",
19120
- "Containerfile.vercel",
19121
- "Dockerfile",
19122
- "Containerfile"
19123
- ];
19124
- }
19125
- });
19126
-
19127
- // ../../internals/runtimes/dist/framework.js
19128
- var require_framework = __commonJS({
19129
- "../../internals/runtimes/dist/framework.js"(exports, module2) {
19130
- "use strict";
19131
- var __defProp2 = Object.defineProperty;
19132
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19133
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
19134
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19135
- var __export2 = (target, all) => {
19136
- for (var name in all)
19137
- __defProp2(target, name, { get: all[name], enumerable: true });
19138
- };
19139
- var __copyProps2 = (to, from, except, desc) => {
19140
- if (from && typeof from === "object" || typeof from === "function") {
19141
- for (let key of __getOwnPropNames2(from))
19142
- if (!__hasOwnProp2.call(to, key) && key !== except)
19143
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19144
- }
19145
- return to;
19146
- };
19147
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19148
- var framework_exports = {};
19149
- __export2(framework_exports, {
19150
- DETECTION_FRAMEWORKS: () => DETECTION_FRAMEWORKS,
19151
- filterFrameworksByRuntime: () => filterFrameworksByRuntime,
19152
- frameworksBySlug: () => frameworksBySlug,
19153
- inferBuilderRuntimeFromFramework: () => inferBuilderRuntimeFromFramework,
19154
- inferRuntimeFromFramework: () => inferRuntimeFromFramework,
19155
- isBFFFramework: () => isBFFFramework,
19156
- isFrontendFramework: () => isFrontendFramework
19157
- });
19158
- module2.exports = __toCommonJS2(framework_exports);
19159
- var import_build_utils5 = require("@vercel/build-utils");
19160
- var import_frameworks2 = require_frameworks();
19161
- var import_constants = require_constants2();
19162
- var frameworksBySlug = new Map(
19163
- import_frameworks2.frameworkList.flatMap((f) => typeof f.slug === "string" ? [[f.slug, f]] : [])
19164
- );
19165
- var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
19166
- (framework) => !framework.experimental || framework.runtimeFramework
19167
- );
19168
- function inferRuntimeFromFramework(framework) {
19169
- if (!framework)
19170
- return void 0;
19171
- if (framework in import_constants.RUNTIME_BUILDERS)
19172
- return framework;
19173
- if ((0, import_build_utils5.isPythonFramework)(framework))
19174
- return "python";
19175
- if ((0, import_build_utils5.isBackendFramework)(framework))
19176
- return "node";
19177
- return void 0;
19178
- }
19179
- var STATIC_BUILDER_RUNTIMES = {
19180
- hugo: "go",
19181
- jekyll: "ruby",
19182
- middleman: "ruby",
19183
- zola: "rust"
19184
- };
19185
- function inferBuilderRuntimeFromFramework(framework) {
19186
- if (!framework || framework === "container" || framework === "services")
19187
- return void 0;
19188
- const f = frameworksBySlug.get(framework);
19189
- const declaredBuilder = f?.useRuntime?.use;
19190
- if (declaredBuilder)
19191
- return import_constants.BUILDER_RUNTIMES[declaredBuilder];
19192
- const detectorItems = [
19193
- ...f?.detectors?.every ?? [],
19194
- ...f?.detectors?.some ?? []
19195
- ];
19196
- return STATIC_BUILDER_RUNTIMES[framework] ?? (detectorItems.some((d) => d.matchPackage !== void 0) ? "node" : void 0);
19197
- }
19198
- function isFrontendFramework(framework) {
19199
- return !!framework && !inferRuntimeFromFramework(framework);
19200
- }
19201
- var BFF_FRAMEWORKS = /* @__PURE__ */ new Set([
19202
- "nextjs",
19203
- "nuxtjs",
19204
- "sveltekit",
19205
- "remix",
19206
- "solidstart"
19207
- ]);
19208
- function isBFFFramework(framework) {
19209
- return !!framework && BFF_FRAMEWORKS.has(framework);
19210
- }
19211
- function filterFrameworksByRuntime(frameworks2, runtime) {
19212
- if (!runtime)
19213
- return [...frameworks2];
19214
- return frameworks2.filter((f) => inferRuntimeFromFramework(f.slug) === runtime);
19215
- }
19216
- }
19217
- });
19218
-
19219
- // ../fs-detectors/dist/is-official-runtime.js
19220
- var require_is_official_runtime = __commonJS({
19221
- "../fs-detectors/dist/is-official-runtime.js"(exports, module2) {
19222
- "use strict";
19223
- var __defProp2 = Object.defineProperty;
19224
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
19225
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
19226
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
19227
- var __export2 = (target, all) => {
19228
- for (var name in all)
19229
- __defProp2(target, name, { get: all[name], enumerable: true });
19230
- };
19231
- var __copyProps2 = (to, from, except, desc) => {
19232
- if (from && typeof from === "object" || typeof from === "function") {
19233
- for (let key of __getOwnPropNames2(from))
19234
- if (!__hasOwnProp2.call(to, key) && key !== except)
19235
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
19236
- }
19237
- return to;
19238
- };
19239
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
19240
- var is_official_runtime_exports = {};
19241
- __export2(is_official_runtime_exports, {
19242
- isOfficialRuntime: () => isOfficialRuntime2,
19243
- isStaticRuntime: () => isStaticRuntime2
19244
- });
19245
- module2.exports = __toCommonJS2(is_official_runtime_exports);
19246
- var isOfficialRuntime2 = (desired, name) => {
19247
- if (typeof name !== "string") {
19248
- return false;
19249
- }
19250
- return name === `@vercel/${desired}` || name === `@now/${desired}` || name.startsWith(`@vercel/${desired}@`) || name.startsWith(`@now/${desired}@`);
19251
- };
19252
- var isStaticRuntime2 = (name) => {
19253
- return isOfficialRuntime2("static", name);
19254
- };
19255
- }
19256
- });
19257
-
19258
19038
  // ../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/commonjs/index.js
19259
19039
  var require_commonjs = __commonJS({
19260
19040
  "../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/commonjs/index.js"(exports) {
@@ -32342,9 +32122,9 @@ ${issues}`,
32342
32122
  }
32343
32123
  });
32344
32124
 
32345
- // ../fs-detectors/dist/python.js
32346
- var require_python = __commonJS({
32347
- "../fs-detectors/dist/python.js"(exports, module2) {
32125
+ // ../fs-detectors/dist/detect-builders.js
32126
+ var require_detect_builders = __commonJS({
32127
+ "../fs-detectors/dist/detect-builders.js"(exports, module2) {
32348
32128
  "use strict";
32349
32129
  var __create2 = Object.create;
32350
32130
  var __defProp2 = Object.defineProperty;
@@ -32352,6 +32132,9 @@ var require_python = __commonJS({
32352
32132
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
32353
32133
  var __getProtoOf2 = Object.getPrototypeOf;
32354
32134
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
32135
+ var __commonJS2 = (cb, mod) => function __require() {
32136
+ return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
32137
+ };
32355
32138
  var __export2 = (target, all) => {
32356
32139
  for (var name in all)
32357
32140
  __defProp2(target, name, { get: all[name], enumerable: true });
@@ -32373,107 +32156,264 @@ var require_python = __commonJS({
32373
32156
  mod
32374
32157
  ));
32375
32158
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
32376
- var python_exports = {};
32377
- __export2(python_exports, {
32378
- isPythonEntrypoint: () => isPythonEntrypoint
32379
- });
32380
- module2.exports = __toCommonJS2(python_exports);
32381
- var import_fs5 = __toESM2(require("fs"));
32382
- var import_build_utils5 = require("@vercel/build-utils");
32383
- var import_python_analysis = require_dist5();
32384
- async function isPythonEntrypoint(fsPath) {
32385
- try {
32386
- const content = await import_fs5.default.promises.readFile(fsPath, "utf-8");
32387
- return await (0, import_python_analysis.findAppOrHandler)(content) !== null;
32388
- } catch (err) {
32389
- (0, import_build_utils5.debug)(`Failed to check Python entrypoint: ${err}`);
32390
- return false;
32391
- }
32392
- }
32393
- }
32394
- });
32395
-
32396
- // ../fs-detectors/dist/buildpack-runtimes.js
32397
- var require_buildpack_runtimes = __commonJS({
32398
- "../fs-detectors/dist/buildpack-runtimes.js"(exports, module2) {
32399
- "use strict";
32400
- var __defProp2 = Object.defineProperty;
32401
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
32402
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
32403
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
32404
- var __export2 = (target, all) => {
32405
- for (var name in all)
32406
- __defProp2(target, name, { get: all[name], enumerable: true });
32407
- };
32408
- var __copyProps2 = (to, from, except, desc) => {
32409
- if (from && typeof from === "object" || typeof from === "function") {
32410
- for (let key of __getOwnPropNames2(from))
32411
- if (!__hasOwnProp2.call(to, key) && key !== except)
32412
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
32159
+ var require_constants3 = __commonJS2({
32160
+ "../../internals/runtimes/dist/constants.js"(exports2, module22) {
32161
+ "use strict";
32162
+ var __defProp22 = Object.defineProperty;
32163
+ var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
32164
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
32165
+ var __hasOwnProp22 = Object.prototype.hasOwnProperty;
32166
+ var __export22 = (target, all) => {
32167
+ for (var name in all)
32168
+ __defProp22(target, name, { get: all[name], enumerable: true });
32169
+ };
32170
+ var __copyProps22 = (to, from, except, desc) => {
32171
+ if (from && typeof from === "object" || typeof from === "function") {
32172
+ for (let key of __getOwnPropNames22(from))
32173
+ if (!__hasOwnProp22.call(to, key) && key !== except)
32174
+ __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
32175
+ }
32176
+ return to;
32177
+ };
32178
+ var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
32179
+ var constants_exports = {};
32180
+ __export22(constants_exports, {
32181
+ BUILDER_RUNTIMES: () => BUILDER_RUNTIMES,
32182
+ CONTAINER_ENTRYPOINT_CANDIDATES: () => CONTAINER_ENTRYPOINT_CANDIDATES,
32183
+ ENTRYPOINT_EXTENSIONS: () => ENTRYPOINT_EXTENSIONS2,
32184
+ ROUTE_OWNING_BUILDERS: () => ROUTE_OWNING_BUILDERS,
32185
+ RUNTIME_BUILDERS: () => RUNTIME_BUILDERS,
32186
+ RUNTIME_MANIFESTS: () => RUNTIME_MANIFESTS,
32187
+ STATIC_BUILDERS: () => STATIC_BUILDERS
32188
+ });
32189
+ module22.exports = __toCommonJS22(constants_exports);
32190
+ var RUNTIME_BUILDERS = {
32191
+ node: "@vercel/backends",
32192
+ python: "@vercel/python",
32193
+ go: "@vercel/go",
32194
+ rust: "@vercel/rust",
32195
+ ruby: "@vercel/ruby",
32196
+ container: "@vercel/container"
32197
+ };
32198
+ var RUNTIME_MANIFESTS = {
32199
+ node: ["package.json"],
32200
+ python: [
32201
+ "pyproject.toml",
32202
+ "requirements.txt",
32203
+ "Pipfile",
32204
+ "pylock.yml",
32205
+ "uv.lock",
32206
+ "setup.py"
32207
+ ],
32208
+ go: ["go.mod"],
32209
+ ruby: ["Gemfile"],
32210
+ rust: ["Cargo.toml"]
32211
+ };
32212
+ var ENTRYPOINT_EXTENSIONS2 = {
32213
+ ".ts": "node",
32214
+ ".mts": "node",
32215
+ ".js": "node",
32216
+ ".mjs": "node",
32217
+ ".cjs": "node",
32218
+ ".py": "python",
32219
+ ".go": "go",
32220
+ ".rs": "rust",
32221
+ ".rb": "ruby",
32222
+ ".ru": "ruby"
32223
+ };
32224
+ var BUILDER_RUNTIMES = Object.fromEntries(
32225
+ Object.entries(RUNTIME_BUILDERS).map(([runtime, builder]) => [
32226
+ builder,
32227
+ runtime
32228
+ ])
32229
+ );
32230
+ var STATIC_BUILDERS = /* @__PURE__ */ new Set([
32231
+ "@vercel/static-build",
32232
+ "@vercel/static"
32233
+ ]);
32234
+ var ROUTE_OWNING_BUILDERS = /* @__PURE__ */ new Set([
32235
+ "@vercel/next",
32236
+ "@vercel/backends"
32237
+ ]);
32238
+ var CONTAINER_ENTRYPOINT_CANDIDATES = [
32239
+ "Dockerfile.vercel",
32240
+ "Containerfile.vercel",
32241
+ "Dockerfile",
32242
+ "Containerfile"
32243
+ ];
32413
32244
  }
32414
- return to;
32415
- };
32416
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
32417
- var buildpack_runtimes_exports = {};
32418
- __export2(buildpack_runtimes_exports, {
32419
- BUILDPACK_PROJECT_MARKERS: () => BUILDPACK_PROJECT_MARKERS,
32420
- hasBuildpackProjectMarker: () => hasBuildpackProjectMarker,
32421
- isBuildpackRuntimeEnabled: () => isBuildpackRuntimeEnabled,
32422
- toBuildpackRuntime: () => toBuildpackRuntime
32423
32245
  });
32424
- module2.exports = __toCommonJS2(buildpack_runtimes_exports);
32425
- var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([["ruby", ["Gemfile"]]]);
32426
- function isBuildpackRuntimeEnabled(runtime) {
32427
- return process.env[`VERCEL_EXPERIMENTAL_BUILDPACK_${runtime.toUpperCase()}`] === "1";
32428
- }
32429
- function toBuildpackRuntime(runtime) {
32430
- if (!runtime || !BUILDPACK_PROJECT_MARKERS.has(runtime) || !isBuildpackRuntimeEnabled(runtime)) {
32431
- return void 0;
32432
- }
32433
- return runtime;
32434
- }
32435
- async function hasBuildpackProjectMarker(runtime, hasFile) {
32436
- for (const marker of BUILDPACK_PROJECT_MARKERS.get(runtime) ?? []) {
32437
- if (await hasFile(marker)) {
32438
- return true;
32246
+ var require_entrypoint2 = __commonJS2({
32247
+ "../../internals/runtimes/dist/entrypoint.js"(exports2, module22) {
32248
+ "use strict";
32249
+ var __defProp22 = Object.defineProperty;
32250
+ var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
32251
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
32252
+ var __hasOwnProp22 = Object.prototype.hasOwnProperty;
32253
+ var __export22 = (target, all) => {
32254
+ for (var name in all)
32255
+ __defProp22(target, name, { get: all[name], enumerable: true });
32256
+ };
32257
+ var __copyProps22 = (to, from, except, desc) => {
32258
+ if (from && typeof from === "object" || typeof from === "function") {
32259
+ for (let key of __getOwnPropNames22(from))
32260
+ if (!__hasOwnProp22.call(to, key) && key !== except)
32261
+ __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
32262
+ }
32263
+ return to;
32264
+ };
32265
+ var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
32266
+ var entrypoint_exports = {};
32267
+ __export22(entrypoint_exports, {
32268
+ SCHEDULE_ENTRYPOINT_FORMS_HINT: () => SCHEDULE_ENTRYPOINT_FORMS_HINT,
32269
+ isDockerfileEntrypoint: () => isDockerfileEntrypoint,
32270
+ parsePyModuleAttrEntrypoint: () => parsePyModuleAttrEntrypoint2,
32271
+ parseScheduleEntrypoint: () => parseScheduleEntrypoint,
32272
+ stripTrailingSlash: () => stripTrailingSlash
32273
+ });
32274
+ module22.exports = __toCommonJS22(entrypoint_exports);
32275
+ var import_path22 = require("path");
32276
+ var import_constants2 = require_constants3();
32277
+ var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
32278
+ var NODE_FILE_ENTRYPOINT_RE = /^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?:[\w@+.-]+\/)*[\w@+.-]+\.[cm]?[jt]s$/;
32279
+ var NODE_DECLARATION_ENTRYPOINT_RE = /\.d\.[cm]?ts$/;
32280
+ function parsePyModuleAttrEntrypoint2(entrypoint) {
32281
+ const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
32282
+ if (!match)
32283
+ return null;
32284
+ const [, modulePart, attrName] = match;
32285
+ if (!modulePart || !attrName)
32286
+ return null;
32287
+ return {
32288
+ attrName,
32289
+ filePath: modulePart.replace(/\./g, "/") + ".py",
32290
+ moduleName: modulePart
32291
+ };
32292
+ }
32293
+ var SCHEDULE_ENTRYPOINT_FORMS_HINT = 'Use a source file path like "jobs/nightly.ts" or a Python "module.path:function" reference.';
32294
+ function parseScheduleEntrypoint(entrypoint) {
32295
+ const python = parsePyModuleAttrEntrypoint2(entrypoint);
32296
+ if (python) {
32297
+ return { runtime: "python", ...python };
32298
+ }
32299
+ if (NODE_FILE_ENTRYPOINT_RE.test(entrypoint) && !NODE_DECLARATION_ENTRYPOINT_RE.test(entrypoint)) {
32300
+ return { runtime: "node", filePath: entrypoint };
32301
+ }
32302
+ return null;
32303
+ }
32304
+ var CONTAINER_ENTRYPOINT_BASENAMES = new Set(
32305
+ import_constants2.CONTAINER_ENTRYPOINT_CANDIDATES.map((name) => name.toLowerCase())
32306
+ );
32307
+ function isDockerfileEntrypoint(entrypoint) {
32308
+ return CONTAINER_ENTRYPOINT_BASENAMES.has(
32309
+ import_path22.posix.basename(entrypoint).toLowerCase()
32310
+ );
32311
+ }
32312
+ function stripTrailingSlash(p) {
32313
+ const stripped = p.replace(/\/+$/, "");
32314
+ return stripped === "" ? "." : stripped;
32439
32315
  }
32440
32316
  }
32441
- return false;
32442
- }
32443
- }
32444
- });
32445
-
32446
- // ../fs-detectors/dist/detect-builders.js
32447
- var require_detect_builders = __commonJS({
32448
- "../fs-detectors/dist/detect-builders.js"(exports, module2) {
32449
- "use strict";
32450
- var __create2 = Object.create;
32451
- var __defProp2 = Object.defineProperty;
32452
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
32453
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
32454
- var __getProtoOf2 = Object.getPrototypeOf;
32455
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
32456
- var __export2 = (target, all) => {
32457
- for (var name in all)
32458
- __defProp2(target, name, { get: all[name], enumerable: true });
32459
- };
32460
- var __copyProps2 = (to, from, except, desc) => {
32461
- if (from && typeof from === "object" || typeof from === "function") {
32462
- for (let key of __getOwnPropNames2(from))
32463
- if (!__hasOwnProp2.call(to, key) && key !== except)
32464
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
32317
+ });
32318
+ var require_framework2 = __commonJS2({
32319
+ "../../internals/runtimes/dist/framework.js"(exports2, module22) {
32320
+ "use strict";
32321
+ var __defProp22 = Object.defineProperty;
32322
+ var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
32323
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
32324
+ var __hasOwnProp22 = Object.prototype.hasOwnProperty;
32325
+ var __export22 = (target, all) => {
32326
+ for (var name in all)
32327
+ __defProp22(target, name, { get: all[name], enumerable: true });
32328
+ };
32329
+ var __copyProps22 = (to, from, except, desc) => {
32330
+ if (from && typeof from === "object" || typeof from === "function") {
32331
+ for (let key of __getOwnPropNames22(from))
32332
+ if (!__hasOwnProp22.call(to, key) && key !== except)
32333
+ __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
32334
+ }
32335
+ return to;
32336
+ };
32337
+ var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
32338
+ var framework_exports = {};
32339
+ __export22(framework_exports, {
32340
+ DETECTION_FRAMEWORKS: () => DETECTION_FRAMEWORKS,
32341
+ filterFrameworksByRuntime: () => filterFrameworksByRuntime,
32342
+ frameworksBySlug: () => frameworksBySlug,
32343
+ inferBuilderRuntimeFromFramework: () => inferBuilderRuntimeFromFramework2,
32344
+ inferRuntimeFromFramework: () => inferRuntimeFromFramework,
32345
+ inferServerRuntimeFromFramework: () => inferServerRuntimeFromFramework,
32346
+ isBFFFramework: () => isBFFFramework,
32347
+ isFrontendFramework: () => isFrontendFramework
32348
+ });
32349
+ module22.exports = __toCommonJS22(framework_exports);
32350
+ var import_build_utils32 = require("@vercel/build-utils");
32351
+ var import_frameworks22 = require_frameworks();
32352
+ var import_constants2 = require_constants3();
32353
+ var frameworksBySlug = new Map(
32354
+ import_frameworks22.frameworkList.flatMap((f) => typeof f.slug === "string" ? [[f.slug, f]] : [])
32355
+ );
32356
+ var DETECTION_FRAMEWORKS = import_frameworks22.frameworkList.filter(
32357
+ (framework) => !framework.experimental || framework.runtimeFramework
32358
+ );
32359
+ function inferRuntimeFromFramework(framework) {
32360
+ if (!framework)
32361
+ return void 0;
32362
+ if (framework in import_constants2.RUNTIME_BUILDERS)
32363
+ return framework;
32364
+ if ((0, import_build_utils32.isPythonFramework)(framework))
32365
+ return "python";
32366
+ if ((0, import_build_utils32.isBackendFramework)(framework))
32367
+ return "node";
32368
+ return void 0;
32369
+ }
32370
+ var STATIC_BUILDER_RUNTIMES = {
32371
+ hugo: "go",
32372
+ jekyll: "ruby",
32373
+ middleman: "ruby",
32374
+ zola: "rust"
32375
+ };
32376
+ function inferServerRuntimeFromFramework(framework) {
32377
+ if (!framework || framework === "services")
32378
+ return void 0;
32379
+ const builder = frameworksBySlug.get(framework)?.useRuntime?.use;
32380
+ if (!builder)
32381
+ return void 0;
32382
+ return import_constants2.BUILDER_RUNTIMES[builder] ?? "node";
32383
+ }
32384
+ function inferBuilderRuntimeFromFramework2(framework) {
32385
+ if (!framework || framework === "container" || framework === "services")
32386
+ return void 0;
32387
+ const f = frameworksBySlug.get(framework);
32388
+ const declaredBuilder = f?.useRuntime?.use;
32389
+ if (declaredBuilder)
32390
+ return import_constants2.BUILDER_RUNTIMES[declaredBuilder];
32391
+ const detectorItems = [
32392
+ ...f?.detectors?.every ?? [],
32393
+ ...f?.detectors?.some ?? []
32394
+ ];
32395
+ return STATIC_BUILDER_RUNTIMES[framework] ?? (detectorItems.some((d) => d.matchPackage !== void 0) ? "node" : void 0);
32396
+ }
32397
+ function isFrontendFramework(framework) {
32398
+ return !!framework && !inferRuntimeFromFramework(framework);
32399
+ }
32400
+ var BFF_FRAMEWORKS = /* @__PURE__ */ new Set([
32401
+ "nextjs",
32402
+ "nuxtjs",
32403
+ "sveltekit",
32404
+ "remix",
32405
+ "solidstart"
32406
+ ]);
32407
+ function isBFFFramework(framework) {
32408
+ return !!framework && BFF_FRAMEWORKS.has(framework);
32409
+ }
32410
+ function filterFrameworksByRuntime(frameworks2, runtime) {
32411
+ if (!runtime)
32412
+ return [...frameworks2];
32413
+ return frameworks2.filter((f) => inferRuntimeFromFramework(f.slug) === runtime);
32414
+ }
32465
32415
  }
32466
- return to;
32467
- };
32468
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
32469
- // If the importer is in node compatibility mode or this is not an ESM
32470
- // file that has been converted to a CommonJS file using a Babel-
32471
- // compatible transform (i.e. "__esModule" has not been set), then set
32472
- // "default" to the CommonJS "module.exports" for node compatibility.
32473
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
32474
- mod
32475
- ));
32476
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
32416
+ });
32477
32417
  var detect_builders_exports = {};
32478
32418
  __export2(detect_builders_exports, {
32479
32419
  REGEX_MIDDLEWARE_FILES: () => REGEX_MIDDLEWARE_FILES,
@@ -32491,15 +32431,41 @@ var require_detect_builders = __commonJS({
32491
32431
  });
32492
32432
  module2.exports = __toCommonJS2(detect_builders_exports);
32493
32433
  var import_minimatch = __toESM2(require_minimatch());
32434
+ var import_entrypoint = __toESM2(require_entrypoint2());
32494
32435
  var import_semver2 = require_semver3();
32495
32436
  var import_path7 = require("path");
32496
32437
  var import_frameworks2 = require_frameworks();
32497
- var import_framework = require_framework();
32498
- var import_constants = require_constants2();
32499
- var import_is_official_runtime = require_is_official_runtime();
32438
+ var import_framework = __toESM2(require_framework2());
32439
+ var import_constants = __toESM2(require_constants3());
32440
+ var isOfficialRuntime2 = (desired, name) => {
32441
+ if (typeof name !== "string") {
32442
+ return false;
32443
+ }
32444
+ return name === `@vercel/${desired}` || name === `@now/${desired}` || name.startsWith(`@vercel/${desired}@`) || name.startsWith(`@now/${desired}@`);
32445
+ };
32446
+ var import_build_utils22 = require("@vercel/build-utils");
32447
+ var import_fs5 = __toESM2(require("fs"));
32500
32448
  var import_build_utils5 = require("@vercel/build-utils");
32501
- var import_python = require_python();
32502
- var import_buildpack_runtimes = require_buildpack_runtimes();
32449
+ var import_python_analysis = require_dist5();
32450
+ async function isPythonEntrypoint(fsPath) {
32451
+ try {
32452
+ const content = await import_fs5.default.promises.readFile(fsPath, "utf-8");
32453
+ return await (0, import_python_analysis.findAppOrHandler)(content) !== null;
32454
+ } catch (err) {
32455
+ (0, import_build_utils5.debug)(`Failed to check Python entrypoint: ${err}`);
32456
+ return false;
32457
+ }
32458
+ }
32459
+ var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([["ruby", ["Gemfile"]]]);
32460
+ function isBuildpackRuntimeEnabled(runtime) {
32461
+ return process.env[`VERCEL_EXPERIMENTAL_BUILDPACK_${runtime.toUpperCase()}`] === "1";
32462
+ }
32463
+ function toBuildpackRuntime(runtime) {
32464
+ if (!runtime || !BUILDPACK_PROJECT_MARKERS.has(runtime) || !isBuildpackRuntimeEnabled(runtime)) {
32465
+ return void 0;
32466
+ }
32467
+ return runtime;
32468
+ }
32503
32469
  var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
32504
32470
  var VERCEL_PLATFORM_FILES = [
32505
32471
  "api/**",
@@ -32558,7 +32524,7 @@ var require_detect_builders = __commonJS({
32558
32524
  }
32559
32525
  function getPublicBuilder(builders) {
32560
32526
  for (const builder of builders) {
32561
- if (typeof builder.src === "string" && (0, import_is_official_runtime.isOfficialRuntime)("static", builder.use) && /^.*\/\*\*\/\*$/.test(builder.src) && builder.config?.zeroConfig === true) {
32527
+ if (typeof builder.src === "string" && isOfficialRuntime2("static", builder.use) && /^.*\/\*\*\/\*$/.test(builder.src) && builder.config?.zeroConfig === true) {
32562
32528
  return builder;
32563
32529
  }
32564
32530
  }
@@ -32608,6 +32574,13 @@ var require_detect_builders = __commonJS({
32608
32574
  usedFunctions.add(key);
32609
32575
  };
32610
32576
  const absolutePathCache = /* @__PURE__ */ new Map();
32577
+ const proxyFile = options.proxy ? parseProxyEntrypoint(options.proxy.entrypoint).file : null;
32578
+ const reservedFunctionFiles = options.reservedFunctionFiles ?? [];
32579
+ const claimedFiles = /* @__PURE__ */ new Set([
32580
+ ...proxyFile !== null ? [proxyFile] : [],
32581
+ ...reservedFunctionFiles
32582
+ ]);
32583
+ const hasReservedFunctions = reservedFunctionFiles.length > 0;
32611
32584
  const { buildCommand, outputDirectory } = projectSettings;
32612
32585
  const frameworkConfig = import_framework.frameworksBySlug.get(framework || "");
32613
32586
  const rustStaticOutput = isRustStaticOutput(framework, projectSettings);
@@ -32634,7 +32607,7 @@ var require_detect_builders = __commonJS({
32634
32607
  const apiRoutes = [];
32635
32608
  const dynamicRoutes = [];
32636
32609
  for (const fileName of sortedFiles) {
32637
- if (fileName === options.proxy?.entrypoint) {
32610
+ if (claimedFiles.has(fileName)) {
32638
32611
  continue;
32639
32612
  }
32640
32613
  const apiBuilder = await maybeGetApiBuilder(fileName, apiMatches, options);
@@ -32698,7 +32671,7 @@ var require_detect_builders = __commonJS({
32698
32671
  options
32699
32672
  );
32700
32673
  } else {
32701
- if (pkg && !makeFrontendStatic && !apiBuilders.length && !options.ignoreBuildScript) {
32674
+ if (pkg && !makeFrontendStatic && !apiBuilders.length && !hasReservedFunctions && !options.ignoreBuildScript) {
32702
32675
  errors.push(getMissingBuildScriptError());
32703
32676
  return {
32704
32677
  errors,
@@ -32719,19 +32692,17 @@ var require_detect_builders = __commonJS({
32719
32692
  outputDirectory: usedOutputDirectory
32720
32693
  }
32721
32694
  };
32722
- } else if (apiBuilders.length && hasNoneApiFiles) {
32695
+ } else if ((apiBuilders.length || hasReservedFunctions) && hasNoneApiFiles) {
32723
32696
  frontendBuilder = {
32724
32697
  use: "@vercel/static",
32725
- src: getStaticFilesPattern(
32726
- options.proxy ? [options.proxy.entrypoint] : []
32727
- ),
32698
+ src: getStaticFilesPattern([...claimedFiles]),
32728
32699
  config: {
32729
32700
  zeroConfig: true
32730
32701
  }
32731
32702
  };
32732
32703
  }
32733
32704
  }
32734
- if (options.proxy && frontendBuilder && (0, import_is_official_runtime.isOfficialRuntime)("next", frontendBuilder.use)) {
32705
+ if (options.proxy && frontendBuilder && isOfficialRuntime2("next", frontendBuilder.use)) {
32735
32706
  return {
32736
32707
  builders: null,
32737
32708
  errors: [
@@ -32750,6 +32721,7 @@ var require_detect_builders = __commonJS({
32750
32721
  const unusedFunctionError = checkUnusedFunctions(
32751
32722
  frontendBuilder,
32752
32723
  usedFunctions,
32724
+ claimedFiles,
32753
32725
  options
32754
32726
  );
32755
32727
  if (unusedFunctionError) {
@@ -32774,7 +32746,7 @@ var require_detect_builders = __commonJS({
32774
32746
  builders.push(...apiBuilders);
32775
32747
  }
32776
32748
  if (frontendBuilder) {
32777
- if ((0, import_is_official_runtime.isOfficialRuntime)("express", frontendBuilder?.use) || (0, import_is_official_runtime.isOfficialRuntime)("hono", frontendBuilder?.use) || (0, import_is_official_runtime.isOfficialRuntime)("python", frontendBuilder?.use) || (0, import_is_official_runtime.isOfficialRuntime)("go", frontendBuilder?.use) || (0, import_is_official_runtime.isOfficialRuntime)("backends", frontendBuilder?.use)) {
32749
+ if (isOfficialRuntime2("express", frontendBuilder?.use) || isOfficialRuntime2("hono", frontendBuilder?.use) || isOfficialRuntime2("python", frontendBuilder?.use) || isOfficialRuntime2("go", frontendBuilder?.use) || isOfficialRuntime2("backends", frontendBuilder?.use)) {
32778
32750
  builders.push({
32779
32751
  src: "public/**/*",
32780
32752
  use: "@vercel/static",
@@ -32785,7 +32757,7 @@ var require_detect_builders = __commonJS({
32785
32757
  });
32786
32758
  }
32787
32759
  builders.push(frontendBuilder);
32788
- if (hasNextApiFiles && apiBuilders.some((b) => (0, import_is_official_runtime.isOfficialRuntime)("node", b.use))) {
32760
+ if (hasNextApiFiles && apiBuilders.some((b) => isOfficialRuntime2("node", b.use))) {
32789
32761
  warnings.push({
32790
32762
  code: "conflicting_files",
32791
32763
  message: "When using Next.js, it is recommended to place JavaScript Functions inside of the `pages/api` (provided by Next.js) directory instead of `api` (provided by Vercel). Other languages (Python, Go, etc) should still go in the `api` directory.",
@@ -32834,7 +32806,7 @@ var require_detect_builders = __commonJS({
32834
32806
  }
32835
32807
  if (fileName.endsWith(".py") && options.workPath) {
32836
32808
  const fsPath = (0, import_path7.join)(options.workPath, fileName);
32837
- const isEntrypoint = await (0, import_python.isPythonEntrypoint)(fsPath);
32809
+ const isEntrypoint = await isPythonEntrypoint(fsPath);
32838
32810
  if (!isEntrypoint) {
32839
32811
  return null;
32840
32812
  }
@@ -32842,7 +32814,7 @@ var require_detect_builders = __commonJS({
32842
32814
  const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
32843
32815
  if (fileName.startsWith("api/") && process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
32844
32816
  const fsPath = (0, import_path7.join)(options.workPath, fileName);
32845
- const isEntrypoint = await (0, import_build_utils5.isNodeEntrypoint)({ fsPath });
32817
+ const isEntrypoint = await (0, import_build_utils22.isNodeEntrypoint)({ fsPath });
32846
32818
  if (!isEntrypoint) {
32847
32819
  return null;
32848
32820
  }
@@ -32886,14 +32858,25 @@ var require_detect_builders = __commonJS({
32886
32858
  const func = keys.find((key) => key === fileName || (0, import_minimatch.default)(fileName, key));
32887
32859
  return func ? { fnPattern: func, func: functions[func] } : { fnPattern: null, func: null };
32888
32860
  }
32861
+ function parseProxyEntrypoint(entrypoint) {
32862
+ if (process.env.VERCEL_PYTHON_PROXY) {
32863
+ const parsed = (0, import_entrypoint.parsePyModuleAttrEntrypoint)(entrypoint);
32864
+ if (parsed)
32865
+ return { file: parsed.filePath, variable: parsed.attrName };
32866
+ }
32867
+ return { file: entrypoint };
32868
+ }
32889
32869
  function getProxyBuilder2(proxy, tag, functions = {}) {
32890
- const { fnPattern, func } = getFunction(proxy.entrypoint, { functions });
32870
+ const { file, variable } = parseProxyEntrypoint(proxy.entrypoint);
32871
+ const isPython = (0, import_path7.extname)(file) === ".py";
32872
+ const { fnPattern, func } = getFunction(file, { functions });
32891
32873
  const runtime = func?.runtime;
32892
32874
  const config = {
32893
32875
  zeroConfig: true,
32894
32876
  middleware: true,
32895
- ...!runtime ? { middlewareRuntime: "nodejs" } : {},
32896
- ...proxy.matcher ? { middlewareMatcher: proxy.matcher } : {}
32877
+ ...!runtime && !isPython ? { middlewareRuntime: "nodejs" } : {},
32878
+ ...proxy.matcher ? { middlewareMatcher: proxy.matcher } : {},
32879
+ ...variable ? { handlerFunction: variable } : {}
32897
32880
  };
32898
32881
  if (fnPattern && func) {
32899
32882
  config.functions = { [fnPattern]: func };
@@ -32904,9 +32887,10 @@ var require_detect_builders = __commonJS({
32904
32887
  config.excludeFiles = func.excludeFiles;
32905
32888
  }
32906
32889
  }
32890
+ const defaultRuntime = isPython ? `@vercel/python${tag ? `@${tag}` : ""}` : `@vercel/node${tag ? `@${tag}` : ""}`;
32907
32891
  return {
32908
- src: proxy.entrypoint,
32909
- use: runtime || `@vercel/node${tag ? `@${tag}` : ""}`,
32892
+ src: file,
32893
+ use: runtime || defaultRuntime,
32910
32894
  config
32911
32895
  };
32912
32896
  }
@@ -32929,21 +32913,29 @@ var require_detect_builders = __commonJS({
32929
32913
  if (typeof proxy !== "object" || typeof proxy.entrypoint !== "string" || !proxy.entrypoint) {
32930
32914
  return {
32931
32915
  code: "invalid_proxy",
32932
- message: "The `proxy` property must contain an `entrypoint` string that references a `.js` or `.ts` file."
32916
+ message: "The `proxy` property must contain an `entrypoint` string."
32933
32917
  };
32934
32918
  }
32935
- const entrypoint = proxy.entrypoint;
32936
- const segments = entrypoint.split("/");
32937
- if (entrypoint.startsWith("/") || entrypoint.includes("\\") || segments.includes(".") || segments.includes("..") || /[?#\u0000-\u001f]/.test(entrypoint)) {
32919
+ const { file, variable } = parseProxyEntrypoint(proxy.entrypoint);
32920
+ const isPythonForm = (0, import_path7.extname)(file) === ".py";
32921
+ const isJsForm = /\.(?:js|ts)$/.test(file) && !file.endsWith(".d.ts");
32922
+ const segments = file.split("/");
32923
+ if (file.startsWith("/") || file.includes("\\") || segments.includes(".") || segments.includes("..") || /[?#\u0000-\u001f]/.test(file)) {
32938
32924
  return {
32939
32925
  code: "invalid_proxy_entrypoint",
32940
32926
  message: "The `proxy.entrypoint` path must be relative to the project root and cannot contain traversal, query, fragment, or control characters."
32941
32927
  };
32942
32928
  }
32943
- if (!/\.(?:js|ts)$/.test(entrypoint) || entrypoint.endsWith(".d.ts")) {
32929
+ if (!isPythonForm && !isJsForm) {
32930
+ return {
32931
+ code: "invalid_proxy_entrypoint",
32932
+ message: "The `proxy.entrypoint` must be a `.js` or `.ts` file path, or a Python `module:attr`."
32933
+ };
32934
+ }
32935
+ if (isPythonForm && !variable) {
32944
32936
  return {
32945
32937
  code: "invalid_proxy_entrypoint",
32946
- message: "The `proxy.entrypoint` path must end in `.js` or `.ts` and reference an executable file."
32938
+ message: "Python proxy entrypoints must use `module:attr` syntax, not a plain `.py` path."
32947
32939
  };
32948
32940
  }
32949
32941
  if (proxy.matcher !== void 0) {
@@ -32968,10 +32960,11 @@ var require_detect_builders = __commonJS({
32968
32960
  if (configError) {
32969
32961
  return configError;
32970
32962
  }
32971
- if (!files.includes(proxy.entrypoint)) {
32963
+ const { file } = parseProxyEntrypoint(proxy.entrypoint);
32964
+ if (!files.includes(file)) {
32972
32965
  return {
32973
32966
  code: "proxy_entrypoint_not_found",
32974
- message: `The proxy entrypoint \`${proxy.entrypoint}\` does not exist. Set \`proxy.entrypoint\` to an existing \`.js\` or \`.ts\` file.`
32967
+ message: `The proxy entrypoint \`${proxy.entrypoint}\` does not exist.`
32975
32968
  };
32976
32969
  }
32977
32970
  if (framework === "nextjs" || framework === "astro") {
@@ -32981,7 +32974,8 @@ var require_detect_builders = __commonJS({
32981
32974
  };
32982
32975
  }
32983
32976
  const appRuntime = (0, import_framework.inferBuilderRuntimeFromFramework)(framework);
32984
- const proxyRuntime = import_constants.ENTRYPOINT_EXTENSIONS[(0, import_path7.extname)(proxy.entrypoint)];
32977
+ const { file: proxyFile } = parseProxyEntrypoint(proxy.entrypoint);
32978
+ const proxyRuntime = import_constants.ENTRYPOINT_EXTENSIONS[(0, import_path7.extname)(proxyFile)];
32985
32979
  if (appRuntime !== void 0 && proxyRuntime !== void 0 && appRuntime !== proxyRuntime) {
32986
32980
  return {
32987
32981
  code: "proxy_runtime_mismatch",
@@ -33044,8 +33038,8 @@ var require_detect_builders = __commonJS({
33044
33038
  }
33045
33039
  const f = import_framework.frameworksBySlug.get(framework || "");
33046
33040
  if (f && f.useRuntime && !isRustStaticOutput(framework, projectSettings)) {
33047
- const buildpackRuntime = (0, import_buildpack_runtimes.toBuildpackRuntime)(framework);
33048
- if (buildpackRuntime && (import_buildpack_runtimes.BUILDPACK_PROJECT_MARKERS.get(buildpackRuntime) ?? []).some(
33041
+ const buildpackRuntime = toBuildpackRuntime(framework);
33042
+ if (buildpackRuntime && (BUILDPACK_PROJECT_MARKERS.get(buildpackRuntime) ?? []).some(
33049
33043
  (marker) => files.includes(marker)
33050
33044
  )) {
33051
33045
  config.buildpack = buildpackRuntime;
@@ -33056,8 +33050,8 @@ var require_detect_builders = __commonJS({
33056
33050
  };
33057
33051
  }
33058
33052
  const { src, use } = f.useRuntime;
33059
- const shouldUseUnifiedBackend = (0, import_build_utils5.isExperimentalBackendsEnabled)() && import_build_utils5.BACKEND_BUILDERS.includes(use);
33060
- const finalUse = shouldUseUnifiedBackend ? import_build_utils5.UNIFIED_BACKEND_BUILDER : use;
33053
+ const shouldUseUnifiedBackend = (0, import_build_utils22.isExperimentalBackendsEnabled)() && import_build_utils22.BACKEND_BUILDERS.includes(use);
33054
+ const finalUse = shouldUseUnifiedBackend ? import_build_utils22.UNIFIED_BACKEND_BUILDER : use;
33061
33055
  return { src, use: `${finalUse}${withTag}`, config };
33062
33056
  }
33063
33057
  const entrypoints = /* @__PURE__ */ new Set([
@@ -33102,7 +33096,7 @@ var require_detect_builders = __commonJS({
33102
33096
  message: "Function must contain at least one property."
33103
33097
  };
33104
33098
  }
33105
- const maxDurationLimit = (0, import_build_utils5.getMaxDurationLimit)();
33099
+ const maxDurationLimit = (0, import_build_utils22.getMaxDurationLimit)();
33106
33100
  if (func.maxDuration !== void 0 && func.maxDuration !== "max" && (func.maxDuration < 1 || maxDurationLimit !== void 0 && func.maxDuration > maxDurationLimit || !Number.isInteger(func.maxDuration))) {
33107
33101
  return {
33108
33102
  code: "invalid_function_duration",
@@ -33149,14 +33143,22 @@ var require_detect_builders = __commonJS({
33149
33143
  }
33150
33144
  return null;
33151
33145
  }
33152
- function checkUnusedFunctions(frontendBuilder, usedFunctions, options) {
33146
+ function checkUnusedFunctions(frontendBuilder, usedFunctions, claimedFiles, options) {
33153
33147
  const unusedFunctions = new Set(
33154
33148
  Object.keys(options.functions || {}).filter((key) => !usedFunctions.has(key))
33155
33149
  );
33150
+ for (const fnKey of unusedFunctions) {
33151
+ for (const filePath of claimedFiles) {
33152
+ if (filePath === fnKey || (0, import_minimatch.default)(filePath, fnKey)) {
33153
+ unusedFunctions.delete(fnKey);
33154
+ break;
33155
+ }
33156
+ }
33157
+ }
33156
33158
  if (!unusedFunctions.size) {
33157
33159
  return null;
33158
33160
  }
33159
- if (frontendBuilder && (0, import_is_official_runtime.isOfficialRuntime)("next", frontendBuilder.use)) {
33161
+ if (frontendBuilder && isOfficialRuntime2("next", frontendBuilder.use)) {
33160
33162
  for (const fnKey of unusedFunctions.values()) {
33161
33163
  if (fnKey.startsWith("pages/") || fnKey.startsWith("src/pages") || fnKey.startsWith("app/") || fnKey.startsWith("src/app/") || fnKey.startsWith("middleware") || fnKey.startsWith("src/middleware")) {
33162
33164
  unusedFunctions.delete(fnKey);
@@ -33170,7 +33172,7 @@ var require_detect_builders = __commonJS({
33170
33172
  }
33171
33173
  }
33172
33174
  }
33173
- if (frontendBuilder && ((0, import_is_official_runtime.isOfficialRuntime)("express", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("hono", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("python", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("backends", frontendBuilder.use))) {
33175
+ if (frontendBuilder && (isOfficialRuntime2("express", frontendBuilder.use) || isOfficialRuntime2("hono", frontendBuilder.use) || isOfficialRuntime2("python", frontendBuilder.use) || isOfficialRuntime2("backends", frontendBuilder.use))) {
33174
33176
  return null;
33175
33177
  }
33176
33178
  if (unusedFunctions.size) {
@@ -33360,7 +33362,7 @@ var require_detect_builders = __commonJS({
33360
33362
  const errorRoutes = [];
33361
33363
  const framework = frontendBuilder?.config?.framework || "";
33362
33364
  const isGatsby = framework === "gatsby";
33363
- const isNextjs = framework === "nextjs" || (0, import_is_official_runtime.isOfficialRuntime)("next", frontendBuilder?.use);
33365
+ const isNextjs = framework === "nextjs" || isOfficialRuntime2("next", frontendBuilder?.use);
33364
33366
  const ignoreRuntimes = import_framework.frameworksBySlug.get(framework)?.ignoreRuntimes;
33365
33367
  if (apiRoutes && apiRoutes.length > 0) {
33366
33368
  if (options.featHandleMiss) {
@@ -33409,7 +33411,7 @@ var require_detect_builders = __commonJS({
33409
33411
  }
33410
33412
  }
33411
33413
  }
33412
- if (outputDirectory && frontendBuilder && !options.featHandleMiss && (0, import_is_official_runtime.isOfficialRuntime)("static", frontendBuilder.use)) {
33414
+ if (outputDirectory && frontendBuilder && !options.featHandleMiss && isOfficialRuntime2("static", frontendBuilder.use)) {
33413
33415
  defaultRoutes.push({
33414
33416
  src: "/(.*)",
33415
33417
  dest: `/${outputDirectory}/$1`
@@ -36231,8 +36233,58 @@ var require_dist8 = __commonJS({
36231
36233
  }
36232
36234
  });
36233
36235
 
36236
+ // ../fs-detectors/dist/buildpack-runtimes.js
36237
+ var require_buildpack_runtimes = __commonJS({
36238
+ "../fs-detectors/dist/buildpack-runtimes.js"(exports, module2) {
36239
+ "use strict";
36240
+ var __defProp2 = Object.defineProperty;
36241
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
36242
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
36243
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36244
+ var __export2 = (target, all) => {
36245
+ for (var name in all)
36246
+ __defProp2(target, name, { get: all[name], enumerable: true });
36247
+ };
36248
+ var __copyProps2 = (to, from, except, desc) => {
36249
+ if (from && typeof from === "object" || typeof from === "function") {
36250
+ for (let key of __getOwnPropNames2(from))
36251
+ if (!__hasOwnProp2.call(to, key) && key !== except)
36252
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
36253
+ }
36254
+ return to;
36255
+ };
36256
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36257
+ var buildpack_runtimes_exports = {};
36258
+ __export2(buildpack_runtimes_exports, {
36259
+ BUILDPACK_PROJECT_MARKERS: () => BUILDPACK_PROJECT_MARKERS,
36260
+ hasBuildpackProjectMarker: () => hasBuildpackProjectMarker,
36261
+ isBuildpackRuntimeEnabled: () => isBuildpackRuntimeEnabled,
36262
+ toBuildpackRuntime: () => toBuildpackRuntime
36263
+ });
36264
+ module2.exports = __toCommonJS2(buildpack_runtimes_exports);
36265
+ var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([["ruby", ["Gemfile"]]]);
36266
+ function isBuildpackRuntimeEnabled(runtime) {
36267
+ return process.env[`VERCEL_EXPERIMENTAL_BUILDPACK_${runtime.toUpperCase()}`] === "1";
36268
+ }
36269
+ function toBuildpackRuntime(runtime) {
36270
+ if (!runtime || !BUILDPACK_PROJECT_MARKERS.has(runtime) || !isBuildpackRuntimeEnabled(runtime)) {
36271
+ return void 0;
36272
+ }
36273
+ return runtime;
36274
+ }
36275
+ async function hasBuildpackProjectMarker(runtime, hasFile) {
36276
+ for (const marker of BUILDPACK_PROJECT_MARKERS.get(runtime) ?? []) {
36277
+ if (await hasFile(marker)) {
36278
+ return true;
36279
+ }
36280
+ }
36281
+ return false;
36282
+ }
36283
+ }
36284
+ });
36285
+
36234
36286
  // ../fs-detectors/dist/services/runtimes/constants.js
36235
- var require_constants3 = __commonJS({
36287
+ var require_constants2 = __commonJS({
36236
36288
  "../fs-detectors/dist/services/runtimes/constants.js"(exports, module2) {
36237
36289
  "use strict";
36238
36290
  var __defProp2 = Object.defineProperty;
@@ -36314,7 +36366,7 @@ var require_constants3 = __commonJS({
36314
36366
  });
36315
36367
 
36316
36368
  // ../fs-detectors/dist/services/runtimes/framework.js
36317
- var require_framework2 = __commonJS({
36369
+ var require_framework = __commonJS({
36318
36370
  "../fs-detectors/dist/services/runtimes/framework.js"(exports, module2) {
36319
36371
  "use strict";
36320
36372
  var __defProp2 = Object.defineProperty;
@@ -36345,7 +36397,7 @@ var require_framework2 = __commonJS({
36345
36397
  module2.exports = __toCommonJS2(framework_exports);
36346
36398
  var import_build_utils5 = require("@vercel/build-utils");
36347
36399
  var import_frameworks2 = require_frameworks();
36348
- var import_constants = require_constants3();
36400
+ var import_constants = require_constants2();
36349
36401
  var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
36350
36402
  (framework) => !framework.experimental || framework.runtimeFramework
36351
36403
  );
@@ -37339,8 +37391,8 @@ var require_utils5 = __commonJS({
37339
37391
  });
37340
37392
  module2.exports = __toCommonJS2(utils_exports);
37341
37393
  var import_build_utils5 = require("@vercel/build-utils");
37342
- var import_constants = require_constants3();
37343
- var import_framework = require_framework2();
37394
+ var import_constants = require_constants2();
37395
+ var import_framework = require_framework();
37344
37396
  async function hasFile(fs5, filePath) {
37345
37397
  try {
37346
37398
  return await fs5.isFile(filePath);
@@ -37464,8 +37516,8 @@ var require_runtime = __commonJS({
37464
37516
  inferRuntime: () => inferRuntime
37465
37517
  });
37466
37518
  module2.exports = __toCommonJS2(runtime_exports);
37467
- var import_constants = require_constants3();
37468
- var import_framework = require_framework2();
37519
+ var import_constants = require_constants2();
37520
+ var import_framework = require_framework();
37469
37521
  function getBuilderForRuntime(runtime) {
37470
37522
  const builder = import_constants.RUNTIME_BUILDERS[runtime];
37471
37523
  if (!builder)
@@ -37528,7 +37580,7 @@ var require_entrypoint = __commonJS({
37528
37580
  });
37529
37581
  module2.exports = __toCommonJS2(entrypoint_exports);
37530
37582
  var import_path7 = require("path");
37531
- var import_constants = require_constants3();
37583
+ var import_constants = require_constants2();
37532
37584
  var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
37533
37585
  function parsePyModuleAttrEntrypoint(entrypoint) {
37534
37586
  const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
@@ -37846,9 +37898,9 @@ var require_resolve = __commonJS({
37846
37898
  module2.exports = __toCommonJS2(resolve_exports);
37847
37899
  var import_path7 = require("path");
37848
37900
  var import_build_utils5 = require("@vercel/build-utils");
37849
- var import_constants = require_constants3();
37901
+ var import_constants = require_constants2();
37850
37902
  var import_buildpack_runtimes = require_buildpack_runtimes();
37851
- var import_framework = require_framework2();
37903
+ var import_framework = require_framework();
37852
37904
  var import_runtime3 = require_runtime();
37853
37905
  var import_entrypoint = require_entrypoint();
37854
37906
  var import_utils = require_utils5();
@@ -38748,8 +38800,8 @@ var require_resolve_v2 = __commonJS({
38748
38800
  var import_path7 = require("path");
38749
38801
  var import_build_utils5 = require("@vercel/build-utils");
38750
38802
  var import_frameworks2 = require_frameworks();
38751
- var import_constants = require_constants3();
38752
- var import_framework = require_framework2();
38803
+ var import_constants = require_constants2();
38804
+ var import_framework = require_framework();
38753
38805
  var import_runtime3 = require_runtime();
38754
38806
  var import_entrypoint = require_entrypoint();
38755
38807
  var import_buildpack_runtimes = require_buildpack_runtimes();
@@ -38970,7 +39022,7 @@ var require_resolve_v2 = __commonJS({
38970
39022
  }
38971
39023
  };
38972
39024
  }
38973
- const buildpackRuntime = flaggedBuildpackRuntime && !entrypointFile && !(0, import_framework.isFrontendFramework)(framework) && await (0, import_buildpack_runtimes.hasBuildpackProjectMarker)(
39025
+ const buildpackRuntime = flaggedBuildpackRuntime && (!entrypointFile || flaggedBuildpackRuntime === "ruby" && entrypointFile === "config.ru") && !(0, import_framework.isFrontendFramework)(framework) && await (0, import_buildpack_runtimes.hasBuildpackProjectMarker)(
38974
39026
  flaggedBuildpackRuntime,
38975
39027
  (marker) => (0, import_utils.hasFile)(serviceFs, marker)
38976
39028
  ) ? flaggedBuildpackRuntime : void 0;
@@ -39152,7 +39204,7 @@ var require_auto_detect = __commonJS({
39152
39204
  module2.exports = __toCommonJS2(auto_detect_exports);
39153
39205
  var import_detect_framework = require_detect_framework();
39154
39206
  var import_frameworks2 = require_frameworks();
39155
- var import_framework = require_framework2();
39207
+ var import_framework = require_framework();
39156
39208
  var import_utils = require_utils5();
39157
39209
  var FRONTEND_DIR = "frontend";
39158
39210
  var APPS_WEB_DIR = "apps/web";
@@ -39434,7 +39486,7 @@ var require_detect_railway = __commonJS({
39434
39486
  var import_path7 = require("path");
39435
39487
  var import_smol_toml = __toESM2(require_dist());
39436
39488
  var import_detect_framework = require_detect_framework();
39437
- var import_framework = require_framework2();
39489
+ var import_framework = require_framework();
39438
39490
  var import_utils = require_utils5();
39439
39491
  var RAILWAY_JSON = "railway.json";
39440
39492
  var RAILWAY_TOML = "railway.toml";
@@ -42543,8 +42595,8 @@ var require_detect_render = __commonJS({
42543
42595
  module2.exports = __toCommonJS2(detect_render_exports);
42544
42596
  var import_js_yaml = __toESM2(require_js_yaml4());
42545
42597
  var import_detect_framework = require_detect_framework();
42546
- var import_constants = require_constants3();
42547
- var import_framework = require_framework2();
42598
+ var import_constants = require_constants2();
42599
+ var import_framework = require_framework();
42548
42600
  var import_utils = require_utils5();
42549
42601
  var RENDER_YAML = "render.yaml";
42550
42602
  var SERVICE_TYPE_MAP = {
@@ -42765,7 +42817,7 @@ var require_detect_procfile = __commonJS({
42765
42817
  });
42766
42818
  module2.exports = __toCommonJS2(detect_procfile_exports);
42767
42819
  var import_detect_framework = require_detect_framework();
42768
- var import_framework = require_framework2();
42820
+ var import_framework = require_framework();
42769
42821
  var import_utils = require_utils5();
42770
42822
  var PROCFILE = "Procfile";
42771
42823
  var PROCFILE_LINE_RE = /^\s*([A-Za-z_][A-Za-z0-9_-]*):\s*(.+)/;
@@ -43021,7 +43073,7 @@ var require_detect_services = __commonJS({
43021
43073
  var import_build_utils5 = require("@vercel/build-utils");
43022
43074
  var import_routing_utils = require_dist8();
43023
43075
  var import_buildpack_runtimes = require_buildpack_runtimes();
43024
- var import_framework = require_framework2();
43076
+ var import_framework = require_framework();
43025
43077
  var import_utils = require_utils5();
43026
43078
  var import_resolve = require_resolve();
43027
43079
  var import_resolve_v2 = require_resolve_v2();
@@ -43450,7 +43502,7 @@ var require_migrate = __commonJS({
43450
43502
  module2.exports = __toCommonJS2(migrate_exports);
43451
43503
  var import_path7 = require("path");
43452
43504
  var import_frameworks2 = require_frameworks();
43453
- var import_constants = require_constants3();
43505
+ var import_constants = require_constants2();
43454
43506
  var import_resolve = require_resolve();
43455
43507
  var import_resolve_v2 = require_resolve_v2();
43456
43508
  var import_utils = require_utils5();
@@ -48304,6 +48356,45 @@ var require_monorepo_managers = __commonJS({
48304
48356
  }
48305
48357
  });
48306
48358
 
48359
+ // ../fs-detectors/dist/is-official-runtime.js
48360
+ var require_is_official_runtime = __commonJS({
48361
+ "../fs-detectors/dist/is-official-runtime.js"(exports, module2) {
48362
+ "use strict";
48363
+ var __defProp2 = Object.defineProperty;
48364
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
48365
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
48366
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
48367
+ var __export2 = (target, all) => {
48368
+ for (var name in all)
48369
+ __defProp2(target, name, { get: all[name], enumerable: true });
48370
+ };
48371
+ var __copyProps2 = (to, from, except, desc) => {
48372
+ if (from && typeof from === "object" || typeof from === "function") {
48373
+ for (let key of __getOwnPropNames2(from))
48374
+ if (!__hasOwnProp2.call(to, key) && key !== except)
48375
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
48376
+ }
48377
+ return to;
48378
+ };
48379
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
48380
+ var is_official_runtime_exports = {};
48381
+ __export2(is_official_runtime_exports, {
48382
+ isOfficialRuntime: () => isOfficialRuntime2,
48383
+ isStaticRuntime: () => isStaticRuntime2
48384
+ });
48385
+ module2.exports = __toCommonJS2(is_official_runtime_exports);
48386
+ var isOfficialRuntime2 = (desired, name) => {
48387
+ if (typeof name !== "string") {
48388
+ return false;
48389
+ }
48390
+ return name === `@vercel/${desired}` || name === `@now/${desired}` || name.startsWith(`@vercel/${desired}@`) || name.startsWith(`@now/${desired}@`);
48391
+ };
48392
+ var isStaticRuntime2 = (name) => {
48393
+ return isOfficialRuntime2("static", name);
48394
+ };
48395
+ }
48396
+ });
48397
+
48307
48398
  // ../fs-detectors/dist/package-managers/package-managers.js
48308
48399
  var require_package_managers = __commonJS({
48309
48400
  "../fs-detectors/dist/package-managers/package-managers.js"(exports, module2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "10.0.2",
3
+ "version": "11.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
- "@vercel/gatsby-plugin-vercel-builder": "2.2.58",
18
17
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.12",
18
+ "@vercel/gatsby-plugin-vercel-builder": "2.2.59",
19
19
  "@vercel/static-config": "3.4.3"
20
20
  },
21
21
  "peerDependencies": {
22
- "@vercel/build-utils": "14.10.2"
22
+ "@vercel/build-utils": "14.11.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/aws-lambda": "8.10.64",
@@ -41,10 +41,10 @@
41
41
  "tree-kill": "1.2.2",
42
42
  "vitest": "4.1.10",
43
43
  "@vercel/error-utils": "2.2.1",
44
+ "@vercel/build-utils": "14.11.0",
44
45
  "@vercel/frameworks": "3.34.0",
45
- "@vercel/build-utils": "14.10.2",
46
- "@vercel/routing-utils": "6.6.0",
47
- "@vercel/fs-detectors": "7.6.1"
46
+ "@vercel/fs-detectors": "7.7.0",
47
+ "@vercel/routing-utils": "6.6.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "node ../../utils/build-builder.mjs",