@vercel/static-build 2.9.7 → 2.9.9

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 +353 -6
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -11131,6 +11131,34 @@ var require_frameworks = __commonJS({
11131
11131
  },
11132
11132
  getOutputDirName: async () => "public"
11133
11133
  },
11134
+ {
11135
+ name: "Mastra",
11136
+ slug: "mastra",
11137
+ logo: "https://api-frameworks.vercel.sh/framework-logos/mastra.svg",
11138
+ darkModeLogo: "https://api-frameworks.vercel.sh/framework-logos/mastra-dark.svg",
11139
+ tagline: "Build AI agents with a modern TypeScript stack",
11140
+ description: "Mastra is a framework for building AI-powered apps and agents with workflows, memory, streaming, evals, tracing, and Studio, an interactive UI for dev and testing.",
11141
+ website: "https://mastra.ai",
11142
+ detectors: {
11143
+ every: [{ matchPackage: "mastra" }]
11144
+ },
11145
+ settings: {
11146
+ installCommand: {
11147
+ placeholder: "`yarn install`, `pnpm install`, `npm install`, or `bun install`"
11148
+ },
11149
+ buildCommand: {
11150
+ placeholder: "`npm run build` or `mastra build`",
11151
+ value: "mastra build"
11152
+ },
11153
+ devCommand: {
11154
+ value: "mastra dev"
11155
+ },
11156
+ outputDirectory: {
11157
+ value: ".mastra"
11158
+ }
11159
+ },
11160
+ getOutputDirName: async () => ".mastra"
11161
+ },
11134
11162
  {
11135
11163
  name: "Other",
11136
11164
  slug: null,
@@ -22453,6 +22481,278 @@ var require_auto_detect = __commonJS({
22453
22481
  }
22454
22482
  });
22455
22483
 
22484
+ // ../fs-detectors/dist/services/detect-railway.js
22485
+ var require_detect_railway = __commonJS({
22486
+ "../fs-detectors/dist/services/detect-railway.js"(exports, module2) {
22487
+ "use strict";
22488
+ var __create2 = Object.create;
22489
+ var __defProp2 = Object.defineProperty;
22490
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
22491
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
22492
+ var __getProtoOf2 = Object.getPrototypeOf;
22493
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
22494
+ var __export2 = (target, all) => {
22495
+ for (var name in all)
22496
+ __defProp2(target, name, { get: all[name], enumerable: true });
22497
+ };
22498
+ var __copyProps2 = (to, from, except, desc) => {
22499
+ if (from && typeof from === "object" || typeof from === "function") {
22500
+ for (let key of __getOwnPropNames2(from))
22501
+ if (!__hasOwnProp2.call(to, key) && key !== except)
22502
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
22503
+ }
22504
+ return to;
22505
+ };
22506
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
22507
+ // If the importer is in node compatibility mode or this is not an ESM
22508
+ // file that has been converted to a CommonJS file using a Babel-
22509
+ // compatible transform (i.e. "__esModule" has not been set), then set
22510
+ // "default" to the CommonJS "module.exports" for node compatibility.
22511
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
22512
+ mod
22513
+ ));
22514
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
22515
+ var detect_railway_exports = {};
22516
+ __export2(detect_railway_exports, {
22517
+ detectRailwayServices: () => detectRailwayServices
22518
+ });
22519
+ module2.exports = __toCommonJS2(detect_railway_exports);
22520
+ var import_path7 = require("path");
22521
+ var import_smol_toml = __toESM2(require_dist());
22522
+ var import_frameworks2 = require_frameworks();
22523
+ var import_detect_framework = require_detect_framework();
22524
+ var import_utils = require_utils4();
22525
+ var RAILWAY_JSON = "railway.json";
22526
+ var RAILWAY_TOML = "railway.toml";
22527
+ var MAX_SCAN_DEPTH = 5;
22528
+ var SKIP_DIRS = /* @__PURE__ */ new Set([
22529
+ ".hg",
22530
+ ".git",
22531
+ ".svn",
22532
+ ".cache",
22533
+ ".next",
22534
+ ".now",
22535
+ ".vercel",
22536
+ ".venv",
22537
+ ".yarn",
22538
+ ".turbo",
22539
+ ".output",
22540
+ "node_modules",
22541
+ "__pycache__",
22542
+ "venv",
22543
+ "CVS"
22544
+ ]);
22545
+ var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
22546
+ (framework) => !framework.experimental || framework.runtimeFramework
22547
+ );
22548
+ async function detectRailwayServices(options) {
22549
+ const { fs: fs5 } = options;
22550
+ const { configs, warnings } = await findRailwayConfigs(fs5);
22551
+ if (configs.length === 0) {
22552
+ return { services: null, errors: [], warnings };
22553
+ }
22554
+ const services = {};
22555
+ const serviceDirs = /* @__PURE__ */ new Map();
22556
+ const errors = [];
22557
+ for (const cf of configs) {
22558
+ const serviceFs = cf.dirPath === "." ? fs5 : fs5.chdir(cf.dirPath);
22559
+ const dirLabel = cf.dirPath === "." ? "root" : cf.dirPath;
22560
+ const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
22561
+ fs: serviceFs,
22562
+ frameworkList: DETECTION_FRAMEWORKS,
22563
+ useExperimentalFrameworks: true
22564
+ });
22565
+ if (cf.config.deploy?.cronSchedule) {
22566
+ const schedule = cf.config.deploy.cronSchedule;
22567
+ const runtime = frameworks2.length === 1 ? (0, import_utils.inferRuntimeFromFramework)(frameworks2[0].slug) : void 0;
22568
+ const hint = {
22569
+ type: "cron",
22570
+ schedule,
22571
+ entrypoint: "<path-to-handler>"
22572
+ };
22573
+ if (runtime) {
22574
+ hint.runtime = runtime;
22575
+ }
22576
+ warnings.push({
22577
+ code: "RAILWAY_CRON_HINT",
22578
+ message: `Found Railway cron in ${dirLabel}/ (schedule: "${schedule}"). Vercel crons work with a file entrypoint. You can add the following to define this cron service:
22579
+ "${deriveServiceName(cf.dirPath)}": ${JSON.stringify(hint, null, 2)}`
22580
+ });
22581
+ continue;
22582
+ }
22583
+ const serviceName = deriveServiceName(cf.dirPath);
22584
+ const existingDir = serviceDirs.get(serviceName);
22585
+ if (existingDir) {
22586
+ errors.push({
22587
+ code: "DUPLICATE_SERVICE",
22588
+ message: `Duplicate service name "${serviceName}" derived from ${existingDir}/ and ${dirLabel}/. Rename one of the directories to avoid conflicts.`,
22589
+ serviceName
22590
+ });
22591
+ continue;
22592
+ }
22593
+ serviceDirs.set(serviceName, dirLabel);
22594
+ if (frameworks2.length === 0) {
22595
+ warnings.push({
22596
+ code: "SERVICE_SKIPPED",
22597
+ message: `Skipped service in ${dirLabel}/: no framework detected. Configure it manually in experimentalServices.`
22598
+ });
22599
+ continue;
22600
+ }
22601
+ if (frameworks2.length > 1) {
22602
+ const names = frameworks2.map((f) => f.name).join(", ");
22603
+ errors.push({
22604
+ code: "MULTIPLE_FRAMEWORKS_SERVICE",
22605
+ message: `Multiple frameworks detected in ${dirLabel}/: ${names}. Use explicit experimentalServices config.`,
22606
+ serviceName
22607
+ });
22608
+ continue;
22609
+ }
22610
+ const framework = frameworks2[0];
22611
+ let serviceConfig = {};
22612
+ serviceConfig.framework = framework.slug ?? void 0;
22613
+ if (cf.dirPath !== ".") {
22614
+ serviceConfig.entrypoint = cf.dirPath;
22615
+ }
22616
+ const buildCommand = combineBuildCommand(
22617
+ cf.config.build?.buildCommand,
22618
+ cf.config.deploy?.preDeployCommand
22619
+ );
22620
+ if (buildCommand) {
22621
+ serviceConfig.buildCommand = buildCommand;
22622
+ }
22623
+ services[serviceName] = serviceConfig;
22624
+ }
22625
+ if (errors.length > 0) {
22626
+ return { services: null, errors, warnings };
22627
+ }
22628
+ const serviceNames = Object.keys(services);
22629
+ if (serviceNames.length === 0) {
22630
+ return { services: null, errors: [], warnings };
22631
+ }
22632
+ warnings.push(...assignRoutePrefixes(services));
22633
+ return { services, errors: [], warnings };
22634
+ }
22635
+ async function findRailwayConfigs(fs5, dirPath = ".", depth = 0) {
22636
+ const configs = [];
22637
+ const warnings = [];
22638
+ const readResult = await readRailwayConfigRaw(fs5, dirPath);
22639
+ warnings.push(...readResult.warnings);
22640
+ const { config, warning } = tryParseRailwayConfig(readResult.raw);
22641
+ if (warning) {
22642
+ warnings.push(warning);
22643
+ }
22644
+ if (config) {
22645
+ configs.push({ dirPath, config });
22646
+ }
22647
+ if (depth >= MAX_SCAN_DEPTH) {
22648
+ return { configs, warnings };
22649
+ }
22650
+ const readPath = dirPath === "." ? "/" : dirPath;
22651
+ let entries;
22652
+ try {
22653
+ entries = await fs5.readdir(readPath);
22654
+ } catch {
22655
+ return { configs, warnings };
22656
+ }
22657
+ for (const entry of entries) {
22658
+ if (entry.type !== "dir" || SKIP_DIRS.has(entry.name)) {
22659
+ continue;
22660
+ }
22661
+ const childPath = dirPath === "." ? entry.name : import_path7.posix.join(dirPath, entry.name);
22662
+ const child = await findRailwayConfigs(fs5, childPath, depth + 1);
22663
+ configs.push(...child.configs);
22664
+ warnings.push(...child.warnings);
22665
+ }
22666
+ return { configs, warnings };
22667
+ }
22668
+ async function readRailwayConfigRaw(fs5, dirPath) {
22669
+ const warnings = [];
22670
+ for (const filename of [RAILWAY_JSON, RAILWAY_TOML]) {
22671
+ const filePath = dirPath === "." ? filename : import_path7.posix.join(dirPath, filename);
22672
+ try {
22673
+ const exists = await fs5.isFile(filePath);
22674
+ if (!exists)
22675
+ continue;
22676
+ } catch {
22677
+ continue;
22678
+ }
22679
+ try {
22680
+ const buf = await fs5.readFile(filePath);
22681
+ return {
22682
+ raw: { path: filePath, content: buf.toString("utf-8") },
22683
+ warnings
22684
+ };
22685
+ } catch (err) {
22686
+ warnings.push({
22687
+ code: "RAILWAY_CONFIG_ERROR",
22688
+ message: `Failed to read ${filePath}: ${err instanceof Error ? err.message : String(err)}`
22689
+ });
22690
+ }
22691
+ }
22692
+ return { raw: null, warnings };
22693
+ }
22694
+ function tryParseRailwayConfig(raw) {
22695
+ if (!raw) {
22696
+ return { config: null };
22697
+ }
22698
+ try {
22699
+ const config = raw.path.endsWith(".toml") ? import_smol_toml.default.parse(raw.content) : JSON.parse(raw.content);
22700
+ return { config };
22701
+ } catch (err) {
22702
+ return {
22703
+ config: null,
22704
+ warning: {
22705
+ code: "RAILWAY_PARSE_ERROR",
22706
+ message: `Failed to parse ${raw.path}: ${err instanceof Error ? err.message : String(err)}`
22707
+ }
22708
+ };
22709
+ }
22710
+ }
22711
+ function deriveServiceName(dirPath) {
22712
+ if (dirPath === ".") {
22713
+ return "web";
22714
+ }
22715
+ const segments = dirPath.split("/");
22716
+ return segments[segments.length - 1];
22717
+ }
22718
+ function combineBuildCommand(buildCommand, preDeployCommand) {
22719
+ const preDeploy = Array.isArray(preDeployCommand) ? preDeployCommand.join(" && ") : preDeployCommand;
22720
+ if (preDeploy && buildCommand) {
22721
+ return `${buildCommand} && ${preDeploy}`;
22722
+ } else if (preDeploy) {
22723
+ return preDeploy;
22724
+ } else {
22725
+ return buildCommand;
22726
+ }
22727
+ }
22728
+ function assignRoutePrefixes(services) {
22729
+ const warnings = [];
22730
+ const names = Object.keys(services);
22731
+ if (names.length === 1) {
22732
+ services[names[0]].routePrefix = "/";
22733
+ return warnings;
22734
+ }
22735
+ const frontendNames = names.filter(
22736
+ (name) => (0, import_utils.isFrontendFramework)(services[name].framework)
22737
+ );
22738
+ let rootName = null;
22739
+ if (frontendNames.length === 1) {
22740
+ rootName = frontendNames[0];
22741
+ } else if (frontendNames.length > 1) {
22742
+ rootName = frontendNames.find((n) => n === "frontend" || n === "web") ?? frontendNames.sort()[0];
22743
+ warnings.push({
22744
+ code: "MULTIPLE_FRONTENDS",
22745
+ message: `Multiple frontend services detected (${frontendNames.join(", ")}). "${rootName}" was assigned routePrefix "/". Adjust manually if a different service should be the root.`
22746
+ });
22747
+ }
22748
+ for (const name of names) {
22749
+ services[name].routePrefix = name === rootName ? "/" : `/_/${name}`;
22750
+ }
22751
+ return warnings;
22752
+ }
22753
+ }
22754
+ });
22755
+
22456
22756
  // ../fs-detectors/dist/services/detect-services.js
22457
22757
  var require_detect_services = __commonJS({
22458
22758
  "../fs-detectors/dist/services/detect-services.js"(exports, module2) {
@@ -22484,6 +22784,7 @@ var require_detect_services = __commonJS({
22484
22784
  var import_utils = require_utils4();
22485
22785
  var import_resolve = require_resolve();
22486
22786
  var import_auto_detect = require_auto_detect();
22787
+ var import_detect_railway = require_detect_railway();
22487
22788
  var PREVIEW_DOMAIN_MISSING = [
22488
22789
  { type: "host", value: { suf: ".vercel.app" } },
22489
22790
  { type: "host", value: { suf: ".vercel.dev" } }
@@ -22521,6 +22822,9 @@ var require_detect_services = __commonJS({
22521
22822
  if ((0, import_utils.isFrontendFramework)(service.framework)) {
22522
22823
  serviceConfig.framework = service.framework;
22523
22824
  }
22825
+ if (typeof service.buildCommand === "string") {
22826
+ serviceConfig.buildCommand = service.buildCommand;
22827
+ }
22524
22828
  inferredConfig[name] = serviceConfig;
22525
22829
  }
22526
22830
  return inferredConfig;
@@ -22541,17 +22845,41 @@ var require_detect_services = __commonJS({
22541
22845
  const configuredServices = vercelConfig?.experimentalServices;
22542
22846
  const hasConfiguredServices = configuredServices && Object.keys(configuredServices).length > 0;
22543
22847
  if (!hasConfiguredServices) {
22544
- const autoResult = await (0, import_auto_detect.autoDetectServices)({ fs: scopedFs });
22545
- if (autoResult.errors.length > 0) {
22848
+ const railwayResult = await (0, import_detect_railway.detectRailwayServices)({ fs: scopedFs });
22849
+ if (railwayResult.errors.length > 0) {
22546
22850
  return withResolvedResult({
22547
22851
  services: [],
22548
22852
  source: "auto-detected",
22549
22853
  routes: emptyRoutes(),
22550
- errors: autoResult.errors,
22551
- warnings: []
22854
+ errors: railwayResult.errors,
22855
+ warnings: railwayResult.warnings
22552
22856
  });
22553
22857
  }
22554
- if (autoResult.services) {
22858
+ if (railwayResult.services) {
22859
+ const result2 = await (0, import_resolve.resolveAllConfiguredServices)(
22860
+ railwayResult.services,
22861
+ scopedFs,
22862
+ "generated"
22863
+ );
22864
+ const inferred = result2.errors.length === 0 && result2.services.length > 0 ? {
22865
+ source: "railway",
22866
+ config: toInferredLayoutConfig(railwayResult.services),
22867
+ services: result2.services,
22868
+ warnings: railwayResult.warnings
22869
+ } : null;
22870
+ return withResolvedResult(
22871
+ {
22872
+ services: [],
22873
+ source: "auto-detected",
22874
+ routes: emptyRoutes(),
22875
+ errors: result2.errors,
22876
+ warnings: railwayResult.warnings
22877
+ },
22878
+ inferred
22879
+ );
22880
+ }
22881
+ const autoResult = await (0, import_auto_detect.autoDetectServices)({ fs: scopedFs });
22882
+ if (autoResult.services && autoResult.errors.length === 0) {
22555
22883
  const result2 = await (0, import_resolve.resolveAllConfiguredServices)(
22556
22884
  autoResult.services,
22557
22885
  scopedFs,
@@ -22575,6 +22903,14 @@ var require_detect_services = __commonJS({
22575
22903
  warnings: []
22576
22904
  } : null;
22577
22905
  return withResolvedResult(resolved, inferred);
22906
+ } else if (autoResult.errors.length > 0) {
22907
+ return withResolvedResult({
22908
+ services: [],
22909
+ source: "auto-detected",
22910
+ routes: emptyRoutes(),
22911
+ errors: autoResult.errors,
22912
+ warnings: []
22913
+ });
22578
22914
  }
22579
22915
  return withResolvedResult({
22580
22916
  services: [],
@@ -31076,6 +31412,15 @@ var require_get_monorepo_default_settings = __commonJS({
31076
31412
  }
31077
31413
  return !import_semver2.default.intersects(turboSemVer, "<1.8.0");
31078
31414
  }
31415
+ function supportsFilter(turboSemVer) {
31416
+ if (!turboSemVer) {
31417
+ return true;
31418
+ }
31419
+ if (!import_semver2.default.validRange(turboSemVer)) {
31420
+ return true;
31421
+ }
31422
+ return !import_semver2.default.intersects(turboSemVer, "<=1.1.0");
31423
+ }
31079
31424
  async function getMonorepoDefaultSettings(projectName, projectPath, relativeToRoot, detectorFilesystem) {
31080
31425
  const [monorepoManager, packageManager] = await Promise.all([
31081
31426
  (0, import_detect_framework.detectFramework)({
@@ -31126,8 +31471,10 @@ var require_get_monorepo_default_settings = __commonJS({
31126
31471
  if (projectPath) {
31127
31472
  if (supportsRootCommand(turboSemVer)) {
31128
31473
  buildCommand = `turbo run build`;
31129
- } else {
31474
+ } else if (supportsFilter(turboSemVer)) {
31130
31475
  buildCommand = `cd ${relativeToRoot} && turbo run build --filter={${projectPath}}...`;
31476
+ } else {
31477
+ buildCommand = `cd ${relativeToRoot} && turbo run build --scope=${projectName}`;
31131
31478
  }
31132
31479
  }
31133
31480
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.9.7",
3
+ "version": "2.9.9",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
+ "@vercel/gatsby-plugin-vercel-builder": "2.1.9",
17
18
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
18
- "@vercel/gatsby-plugin-vercel-builder": "2.1.7",
19
19
  "@vercel/static-config": "3.2.0"
20
20
  },
21
21
  "devDependencies": {
@@ -38,11 +38,11 @@
38
38
  "rc9": "1.2.0",
39
39
  "semver": "7.5.2",
40
40
  "tree-kill": "1.2.2",
41
- "@vercel/build-utils": "13.12.1",
42
- "@vercel/frameworks": "3.22.0",
43
41
  "@vercel/error-utils": "2.0.3",
42
+ "@vercel/frameworks": "3.23.0",
43
+ "@vercel/fs-detectors": "5.14.3",
44
44
  "@vercel/routing-utils": "6.1.1",
45
- "@vercel/fs-detectors": "5.13.0"
45
+ "@vercel/build-utils": "13.13.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",