@mastra/deployer 1.0.0-beta.19 → 1.0.0-beta.20

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 (117) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/build/analyze.cjs +2 -2
  3. package/dist/build/analyze.d.ts +2 -1
  4. package/dist/build/analyze.d.ts.map +1 -1
  5. package/dist/build/analyze.js +1 -1
  6. package/dist/build/bundler.cjs +3 -3
  7. package/dist/build/bundler.d.ts +2 -1
  8. package/dist/build/bundler.d.ts.map +1 -1
  9. package/dist/build/bundler.js +1 -1
  10. package/dist/build/index.cjs +16 -12
  11. package/dist/build/index.d.ts +2 -1
  12. package/dist/build/index.d.ts.map +1 -1
  13. package/dist/build/index.js +4 -4
  14. package/dist/build/utils.d.ts +17 -0
  15. package/dist/build/utils.d.ts.map +1 -1
  16. package/dist/build/watcher.d.ts +2 -1
  17. package/dist/build/watcher.d.ts.map +1 -1
  18. package/dist/bundler/index.cjs +3 -3
  19. package/dist/bundler/index.d.ts +3 -0
  20. package/dist/bundler/index.d.ts.map +1 -1
  21. package/dist/bundler/index.js +1 -1
  22. package/dist/{chunk-EGNU46SF.js → chunk-2ZPRZMBN.js} +7 -7
  23. package/dist/chunk-2ZPRZMBN.js.map +1 -0
  24. package/dist/{chunk-BDA7RMRF.js → chunk-4NPMVODD.js} +5 -5
  25. package/dist/chunk-4NPMVODD.js.map +1 -0
  26. package/dist/{chunk-VA2CSOKJ.cjs → chunk-5TYVF4KJ.cjs} +9 -2
  27. package/dist/chunk-5TYVF4KJ.cjs.map +1 -0
  28. package/dist/{chunk-5HTKP372.js → chunk-DBXWQ2CA.js} +7 -7
  29. package/dist/chunk-DBXWQ2CA.js.map +1 -0
  30. package/dist/{chunk-RKUHTSGV.cjs → chunk-HVKR4FT2.cjs} +17 -17
  31. package/dist/chunk-HVKR4FT2.cjs.map +1 -0
  32. package/dist/{chunk-DMISJICL.cjs → chunk-JRUJ546M.cjs} +7 -7
  33. package/dist/chunk-JRUJ546M.cjs.map +1 -0
  34. package/dist/{chunk-4P2LYC33.js → chunk-MCWU6IKS.js} +3 -3
  35. package/dist/{chunk-4P2LYC33.js.map → chunk-MCWU6IKS.js.map} +1 -1
  36. package/dist/{chunk-JBTAD5SZ.js → chunk-NGWTN4SJ.js} +10 -9
  37. package/dist/chunk-NGWTN4SJ.js.map +1 -0
  38. package/dist/{chunk-CRIOGWZD.cjs → chunk-NWQP6PZQ.cjs} +24 -24
  39. package/dist/chunk-NWQP6PZQ.cjs.map +1 -0
  40. package/dist/{chunk-HHA2Y3AS.js → chunk-QAOUDKHK.js} +9 -3
  41. package/dist/chunk-QAOUDKHK.js.map +1 -0
  42. package/dist/{chunk-7SYXFJLS.cjs → chunk-SBGBJ7NB.cjs} +19 -18
  43. package/dist/chunk-SBGBJ7NB.cjs.map +1 -0
  44. package/dist/{chunk-XZWV3NQL.js → chunk-UKP4KHBS.js} +6 -6
  45. package/dist/chunk-UKP4KHBS.js.map +1 -0
  46. package/dist/{chunk-J3FNV5WP.cjs → chunk-Z53UZLS3.cjs} +15 -15
  47. package/dist/chunk-Z53UZLS3.cjs.map +1 -0
  48. package/dist/{chunk-54PQDTM3.cjs → chunk-ZXQ7DOYU.cjs} +4 -4
  49. package/dist/{chunk-54PQDTM3.cjs.map → chunk-ZXQ7DOYU.cjs.map} +1 -1
  50. package/dist/default-u_dwuiYb-JPNIZQKK.cjs +9 -0
  51. package/dist/{default-u_dwuiYb-ZNEZWEPC.cjs.map → default-u_dwuiYb-JPNIZQKK.cjs.map} +1 -1
  52. package/dist/default-u_dwuiYb-RK5OD4MY.js +3 -0
  53. package/dist/{default-u_dwuiYb-IKALPRLV.js.map → default-u_dwuiYb-RK5OD4MY.js.map} +1 -1
  54. package/dist/docs/README.md +32 -0
  55. package/dist/docs/SKILL.md +36 -0
  56. package/dist/docs/SOURCE_MAP.json +27 -0
  57. package/dist/docs/deployer/01-reference.md +93 -0
  58. package/dist/docs/deployment/01-overview.md +60 -0
  59. package/dist/docs/deployment/02-mastra-server.md +70 -0
  60. package/dist/docs/deployment/03-monorepo.md +70 -0
  61. package/dist/docs/deployment/04-cloud-providers.md +17 -0
  62. package/dist/docs/deployment/05-web-framework.md +55 -0
  63. package/dist/docs/deployment/06-workflow-runners.md +11 -0
  64. package/dist/{effect-QlVUlMFu-2KN4AWBH.cjs → effect-QlVUlMFu-HN3LWZSQ.cjs} +4 -4
  65. package/dist/{effect-QlVUlMFu-2KN4AWBH.cjs.map → effect-QlVUlMFu-HN3LWZSQ.cjs.map} +1 -1
  66. package/dist/{effect-QlVUlMFu-MWXQUT6S.js → effect-QlVUlMFu-XOJ2F4UA.js} +3 -3
  67. package/dist/{effect-QlVUlMFu-MWXQUT6S.js.map → effect-QlVUlMFu-XOJ2F4UA.js.map} +1 -1
  68. package/dist/{esm-BLVTLTJW.js → esm-6TGK2CUM.js} +3 -3
  69. package/dist/esm-6TGK2CUM.js.map +1 -0
  70. package/dist/{esm-E3NUCNVN.cjs → esm-SQKX5ABS.cjs} +3 -3
  71. package/dist/esm-SQKX5ABS.cjs.map +1 -0
  72. package/dist/index.cjs +4 -4
  73. package/dist/index.js +2 -2
  74. package/dist/server/index.cjs +73 -47
  75. package/dist/server/index.cjs.map +1 -1
  76. package/dist/server/index.d.ts.map +1 -1
  77. package/dist/server/index.js +72 -47
  78. package/dist/server/index.js.map +1 -1
  79. package/dist/{sury-CWZTCd75-6QYFZXZY.cjs → sury-CWZTCd75-KEHKUXG7.cjs} +4 -4
  80. package/dist/{sury-CWZTCd75-6QYFZXZY.cjs.map → sury-CWZTCd75-KEHKUXG7.cjs.map} +1 -1
  81. package/dist/{sury-CWZTCd75-DAPFEZIA.js → sury-CWZTCd75-L2D76L25.js} +3 -3
  82. package/dist/{sury-CWZTCd75-DAPFEZIA.js.map → sury-CWZTCd75-L2D76L25.js.map} +1 -1
  83. package/dist/{valibot--1zFm7rT-OOWNQW47.cjs → valibot--1zFm7rT-NVADAEQI.cjs} +4 -4
  84. package/dist/{valibot--1zFm7rT-OOWNQW47.cjs.map → valibot--1zFm7rT-NVADAEQI.cjs.map} +1 -1
  85. package/dist/{valibot--1zFm7rT-AASENK42.js → valibot--1zFm7rT-R2UKWLZC.js} +3 -3
  86. package/dist/{valibot--1zFm7rT-AASENK42.js.map → valibot--1zFm7rT-R2UKWLZC.js.map} +1 -1
  87. package/dist/{valibot-D_HTw1Gn-PBXMZJWR.cjs → valibot-D_HTw1Gn-DSFFOUBW.cjs} +4 -4
  88. package/dist/{valibot-D_HTw1Gn-PBXMZJWR.cjs.map → valibot-D_HTw1Gn-DSFFOUBW.cjs.map} +1 -1
  89. package/dist/{valibot-D_HTw1Gn-PCY2UTIB.js → valibot-D_HTw1Gn-KWXWP2TJ.js} +3 -3
  90. package/dist/{valibot-D_HTw1Gn-PCY2UTIB.js.map → valibot-D_HTw1Gn-KWXWP2TJ.js.map} +1 -1
  91. package/dist/validator/custom-resolver.cjs +2 -2
  92. package/dist/validator/custom-resolver.js +1 -1
  93. package/dist/{zod-Bwrt9trS-MTR3E2QO.js → zod-Bwrt9trS-GCUGPBJX.js} +4 -4
  94. package/dist/{zod-Bwrt9trS-MTR3E2QO.js.map → zod-Bwrt9trS-GCUGPBJX.js.map} +1 -1
  95. package/dist/{zod-Bwrt9trS-OXQA54TZ.cjs → zod-Bwrt9trS-ZZHFZ7YQ.cjs} +6 -6
  96. package/dist/{zod-Bwrt9trS-OXQA54TZ.cjs.map → zod-Bwrt9trS-ZZHFZ7YQ.cjs.map} +1 -1
  97. package/dist/{zod-DSgpEGAE-7BIIMWZW.cjs → zod-DSgpEGAE-3CMS4FSB.cjs} +4 -4
  98. package/dist/{zod-DSgpEGAE-7BIIMWZW.cjs.map → zod-DSgpEGAE-3CMS4FSB.cjs.map} +1 -1
  99. package/dist/{zod-DSgpEGAE-UO7OP3J6.js → zod-DSgpEGAE-IPE3O2NQ.js} +3 -3
  100. package/dist/{zod-DSgpEGAE-UO7OP3J6.js.map → zod-DSgpEGAE-IPE3O2NQ.js.map} +1 -1
  101. package/package.json +13 -12
  102. package/dist/chunk-5HTKP372.js.map +0 -1
  103. package/dist/chunk-7SYXFJLS.cjs.map +0 -1
  104. package/dist/chunk-BDA7RMRF.js.map +0 -1
  105. package/dist/chunk-CRIOGWZD.cjs.map +0 -1
  106. package/dist/chunk-DMISJICL.cjs.map +0 -1
  107. package/dist/chunk-EGNU46SF.js.map +0 -1
  108. package/dist/chunk-HHA2Y3AS.js.map +0 -1
  109. package/dist/chunk-J3FNV5WP.cjs.map +0 -1
  110. package/dist/chunk-JBTAD5SZ.js.map +0 -1
  111. package/dist/chunk-RKUHTSGV.cjs.map +0 -1
  112. package/dist/chunk-VA2CSOKJ.cjs.map +0 -1
  113. package/dist/chunk-XZWV3NQL.js.map +0 -1
  114. package/dist/default-u_dwuiYb-IKALPRLV.js +0 -3
  115. package/dist/default-u_dwuiYb-ZNEZWEPC.cjs +0 -9
  116. package/dist/esm-BLVTLTJW.js.map +0 -1
  117. package/dist/esm-E3NUCNVN.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { getInputOptions, nodeModulesExtensionResolver } from './chunk-EGNU46SF.js';
2
- import { getWorkspaceInformation, analyzeBundle, tsConfigPaths, aliasHono, extractMastraOption } from './chunk-BDA7RMRF.js';
3
- import { slash, getPackageName } from './chunk-HHA2Y3AS.js';
1
+ import { getInputOptions, nodeModulesExtensionResolver } from './chunk-2ZPRZMBN.js';
2
+ import { getWorkspaceInformation, analyzeBundle, tsConfigPaths, aliasHono, extractMastraOption } from './chunk-4NPMVODD.js';
3
+ import { slash, getPackageName } from './chunk-QAOUDKHK.js';
4
4
  import { watch } from 'rollup';
5
5
  import { dirname, posix } from 'path';
6
6
  import * as pkg from 'empathic/package';
@@ -16,7 +16,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
16
16
  {
17
17
  outputDir: posix.join(process.cwd(), ".mastra", ".build"),
18
18
  projectRoot: workspaceRoot || process.cwd(),
19
- platform: "node",
19
+ platform,
20
20
  isDev: true
21
21
  },
22
22
  noopLogger
@@ -84,5 +84,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
84
84
  }
85
85
 
86
86
  export { createWatcher, getInputOptions2 as getInputOptions, getServerOptions };
87
- //# sourceMappingURL=chunk-XZWV3NQL.js.map
88
- //# sourceMappingURL=chunk-XZWV3NQL.js.map
87
+ //# sourceMappingURL=chunk-UKP4KHBS.js.map
88
+ //# sourceMappingURL=chunk-UKP4KHBS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions"],"mappings":"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","file":"chunk-UKP4KHBS.js","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkRKUHTSGV_cjs = require('./chunk-RKUHTSGV.cjs');
4
- var chunkCRIOGWZD_cjs = require('./chunk-CRIOGWZD.cjs');
5
- var chunkVA2CSOKJ_cjs = require('./chunk-VA2CSOKJ.cjs');
3
+ var chunkHVKR4FT2_cjs = require('./chunk-HVKR4FT2.cjs');
4
+ var chunkNWQP6PZQ_cjs = require('./chunk-NWQP6PZQ.cjs');
5
+ var chunk5TYVF4KJ_cjs = require('./chunk-5TYVF4KJ.cjs');
6
6
  var rollup = require('rollup');
7
7
  var path = require('path');
8
8
  var pkg = require('empathic/package');
@@ -30,27 +30,27 @@ var pkg__namespace = /*#__PURE__*/_interopNamespace(pkg);
30
30
 
31
31
  async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
32
32
  const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(entryFile) });
33
- const projectRoot = closestPkgJson ? path.dirname(chunkVA2CSOKJ_cjs.slash(closestPkgJson)) : chunkVA2CSOKJ_cjs.slash(process.cwd());
34
- const { workspaceMap, workspaceRoot } = await chunkCRIOGWZD_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
35
- const analyzeEntryResult = await chunkCRIOGWZD_cjs.analyzeBundle(
33
+ const projectRoot = closestPkgJson ? path.dirname(chunk5TYVF4KJ_cjs.slash(closestPkgJson)) : chunk5TYVF4KJ_cjs.slash(process.cwd());
34
+ const { workspaceMap, workspaceRoot } = await chunkNWQP6PZQ_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
35
+ const analyzeEntryResult = await chunkNWQP6PZQ_cjs.analyzeBundle(
36
36
  [entryFile],
37
37
  entryFile,
38
38
  {
39
39
  outputDir: path.posix.join(process.cwd(), ".mastra", ".build"),
40
40
  projectRoot: workspaceRoot || process.cwd(),
41
- platform: "node",
41
+ platform,
42
42
  isDev: true
43
43
  },
44
44
  logger.noopLogger
45
45
  );
46
46
  const deps = /* @__PURE__ */ new Map();
47
47
  for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {
48
- const pkgName = chunkVA2CSOKJ_cjs.getPackageName(dep);
48
+ const pkgName = chunk5TYVF4KJ_cjs.getPackageName(dep);
49
49
  if (pkgName && workspaceMap.has(pkgName)) {
50
50
  deps.set(dep, metadata);
51
51
  }
52
52
  }
53
- const inputOptions = await chunkRKUHTSGV_cjs.getInputOptions(
53
+ const inputOptions = await chunkHVKR4FT2_cjs.getInputOptions(
54
54
  entryFile,
55
55
  {
56
56
  dependencies: deps,
@@ -69,7 +69,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
69
69
  }
70
70
  if (plugin?.name === "tsconfig-paths") {
71
71
  plugins.push(
72
- chunkCRIOGWZD_cjs.tsConfigPaths({
72
+ chunkNWQP6PZQ_cjs.tsConfigPaths({
73
73
  localResolve: true
74
74
  })
75
75
  );
@@ -78,8 +78,8 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
78
78
  plugins.push(plugin);
79
79
  });
80
80
  inputOptions.plugins = plugins;
81
- inputOptions.plugins.push(chunkCRIOGWZD_cjs.aliasHono());
82
- inputOptions.plugins.push(chunkRKUHTSGV_cjs.nodeModulesExtensionResolver());
81
+ inputOptions.plugins.push(chunkNWQP6PZQ_cjs.aliasHono());
82
+ inputOptions.plugins.push(chunkHVKR4FT2_cjs.nodeModulesExtensionResolver());
83
83
  }
84
84
  return inputOptions;
85
85
  }
@@ -98,7 +98,7 @@ async function createWatcher(inputOptions, outputOptions) {
98
98
 
99
99
  // src/build/serverOptions.ts
100
100
  async function getServerOptions(entryFile, outputDir, logger) {
101
- const result = await chunkCRIOGWZD_cjs.extractMastraOption("server", entryFile, outputDir, logger);
101
+ const result = await chunkNWQP6PZQ_cjs.extractMastraOption("server", entryFile, outputDir, logger);
102
102
  if (!result) {
103
103
  return null;
104
104
  }
@@ -108,5 +108,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
108
108
  exports.createWatcher = createWatcher;
109
109
  exports.getInputOptions = getInputOptions2;
110
110
  exports.getServerOptions = getServerOptions;
111
- //# sourceMappingURL=chunk-J3FNV5WP.cjs.map
112
- //# sourceMappingURL=chunk-J3FNV5WP.cjs.map
111
+ //# sourceMappingURL=chunk-Z53UZLS3.cjs.map
112
+ //# sourceMappingURL=chunk-Z53UZLS3.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions","pkg","dirname","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","getPackageName","tsConfigPaths","aliasHono","nodeModulesExtensionResolver","watch","extractMastraOption"],"mappings":"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","file":"chunk-Z53UZLS3.cjs","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkJBE6KM7R_cjs = require('./chunk-JBE6KM7R.cjs');
4
- var chunkDMISJICL_cjs = require('./chunk-DMISJICL.cjs');
4
+ var chunkJRUJ546M_cjs = require('./chunk-JRUJ546M.cjs');
5
5
 
6
6
  // ../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_54b5e515d9ef28e1ec1313d6d3effba2/node_modules/@standard-community/standard-openapi/dist/default-u_dwuiYb.js
7
7
  function getToOpenAPISchemaFn() {
8
8
  return async (schema, context) => chunkJBE6KM7R_cjs.convertToOpenAPISchema(
9
- await chunkDMISJICL_cjs.toJsonSchema(schema, context.options),
9
+ await chunkJRUJ546M_cjs.toJsonSchema(schema, context.options),
10
10
  context
11
11
  );
12
12
  }
13
13
 
14
14
  exports.getToOpenAPISchemaFn = getToOpenAPISchemaFn;
15
- //# sourceMappingURL=chunk-54PQDTM3.cjs.map
16
- //# sourceMappingURL=chunk-54PQDTM3.cjs.map
15
+ //# sourceMappingURL=chunk-ZXQ7DOYU.cjs.map
16
+ //# sourceMappingURL=chunk-ZXQ7DOYU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_54b5e515d9ef28e1ec1313d6d3effba2/node_modules/@standard-community/standard-openapi/dist/default-u_dwuiYb.js"],"names":["convertToOpenAPISchema","toJsonSchema"],"mappings":";;;;;;AAGA,SAAS,oBAAA,GAAuB;AAC9B,EAAA,OAAO,OAAO,QAAQ,OAAA,KAAYA,wCAAA;AAAA,IAChC,MAAMC,8BAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,OAAO,CAAA;AAAA,IAC1C;AAAA,GACF;AACF","file":"chunk-54PQDTM3.cjs","sourcesContent":["import { toJsonSchema } from '@standard-community/standard-json';\nimport { convertToOpenAPISchema } from './vendors/convert.js';\n\nfunction getToOpenAPISchemaFn() {\n return async (schema, context) => convertToOpenAPISchema(\n await toJsonSchema(schema, context.options),\n context\n );\n}\n\nexport { getToOpenAPISchemaFn as default };\n"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_54b5e515d9ef28e1ec1313d6d3effba2/node_modules/@standard-community/standard-openapi/dist/default-u_dwuiYb.js"],"names":["convertToOpenAPISchema","toJsonSchema"],"mappings":";;;;;;AAGA,SAAS,oBAAA,GAAuB;AAC9B,EAAA,OAAO,OAAO,QAAQ,OAAA,KAAYA,wCAAA;AAAA,IAChC,MAAMC,8BAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,OAAO,CAAA;AAAA,IAC1C;AAAA,GACF;AACF","file":"chunk-ZXQ7DOYU.cjs","sourcesContent":["import { toJsonSchema } from '@standard-community/standard-json';\nimport { convertToOpenAPISchema } from './vendors/convert.js';\n\nfunction getToOpenAPISchemaFn() {\n return async (schema, context) => convertToOpenAPISchema(\n await toJsonSchema(schema, context.options),\n context\n );\n}\n\nexport { getToOpenAPISchemaFn as default };\n"]}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var chunkZXQ7DOYU_cjs = require('./chunk-ZXQ7DOYU.cjs');
4
+
5
+
6
+
7
+ module.exports = chunkZXQ7DOYU_cjs.getToOpenAPISchemaFn;
8
+ //# sourceMappingURL=default-u_dwuiYb-JPNIZQKK.cjs.map
9
+ //# sourceMappingURL=default-u_dwuiYb-JPNIZQKK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-ZNEZWEPC.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-JPNIZQKK.cjs"}
@@ -0,0 +1,3 @@
1
+ export { getToOpenAPISchemaFn as default } from './chunk-MCWU6IKS.js';
2
+ //# sourceMappingURL=default-u_dwuiYb-RK5OD4MY.js.map
3
+ //# sourceMappingURL=default-u_dwuiYb-RK5OD4MY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-IKALPRLV.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-RK5OD4MY.js"}
@@ -0,0 +1,32 @@
1
+ # @mastra/deployer Documentation
2
+
3
+ > Embedded documentation for coding agents
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Read the skill overview
9
+ cat docs/SKILL.md
10
+
11
+ # Get the source map
12
+ cat docs/SOURCE_MAP.json
13
+
14
+ # Read topic documentation
15
+ cat docs/<topic>/01-overview.md
16
+ ```
17
+
18
+ ## Structure
19
+
20
+ ```
21
+ docs/
22
+ ├── SKILL.md # Entry point
23
+ ├── README.md # This file
24
+ ├── SOURCE_MAP.json # Export index
25
+ ├── deployer/ (1 files)
26
+ ├── deployment/ (6 files)
27
+ ```
28
+
29
+ ## Version
30
+
31
+ Package: @mastra/deployer
32
+ Version: 1.0.0-beta.20
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: mastra-deployer-docs
3
+ description: Documentation for @mastra/deployer. Includes links to type definitions and readable implementation code in dist/.
4
+ ---
5
+
6
+ # @mastra/deployer Documentation
7
+
8
+ > **Version**: 1.0.0-beta.20
9
+ > **Package**: @mastra/deployer
10
+
11
+ ## Quick Navigation
12
+
13
+ Use SOURCE_MAP.json to find any export:
14
+
15
+ ```bash
16
+ cat docs/SOURCE_MAP.json
17
+ ```
18
+
19
+ Each export maps to:
20
+ - **types**: `.d.ts` file with JSDoc and API signatures
21
+ - **implementation**: `.js` chunk file with readable source
22
+ - **docs**: Conceptual documentation in `docs/`
23
+
24
+ ## Top Exports
25
+
26
+ - Deps: dist/index.d.ts
27
+ - FileService: dist/index.d.ts
28
+ - createChildProcessLogger: dist/index.d.ts
29
+ - createPinoStream: dist/index.d.ts
30
+
31
+ See SOURCE_MAP.json for the complete list.
32
+
33
+ ## Available Topics
34
+
35
+ - [Deployer](deployer/) - 1 file(s)
36
+ - [Deployment](deployment/) - 6 file(s)
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": "1.0.0-beta.20",
3
+ "package": "@mastra/deployer",
4
+ "exports": {
5
+ "Deps": {
6
+ "types": "dist/index.d.ts",
7
+ "implementation": "dist/chunk-DPDWM7HQ.js",
8
+ "line": 60
9
+ },
10
+ "FileService": {
11
+ "types": "dist/index.d.ts",
12
+ "implementation": "dist/chunk-DPDWM7HQ.js",
13
+ "line": 337
14
+ },
15
+ "createChildProcessLogger": {
16
+ "types": "dist/index.d.ts",
17
+ "implementation": "dist/chunk-DPDWM7HQ.js",
18
+ "line": 24
19
+ },
20
+ "createPinoStream": {
21
+ "types": "dist/index.d.ts",
22
+ "implementation": "dist/chunk-DPDWM7HQ.js",
23
+ "line": 12
24
+ }
25
+ },
26
+ "modules": {}
27
+ }
@@ -0,0 +1,93 @@
1
+ # Deployer API Reference
2
+
3
+ > API reference for deployer - 1 entries
4
+
5
+
6
+ ---
7
+
8
+ ## Reference: Deployer
9
+
10
+ > Documentation for the Deployer abstract class, which handles packaging and deployment of Mastra applications.
11
+
12
+ The Deployer handles the deployment of standalone Mastra applications by packaging code, managing environment files, and serving applications using the Hono framework. Concrete implementations must define the deploy method for specific deployment targets.
13
+
14
+ ## Usage Example
15
+
16
+ ```typescript
17
+ import { Deployer } from "@mastra/deployer";
18
+
19
+ // Create a custom deployer by extending the abstract Deployer class
20
+ class CustomDeployer extends Deployer {
21
+ constructor() {
22
+ super({ name: "custom-deployer" });
23
+ }
24
+
25
+ // Implement the abstract deploy method
26
+ async deploy(outputDirectory: string): Promise<void> {
27
+ // Prepare the output directory
28
+ await this.prepare(outputDirectory);
29
+
30
+ // Bundle the application
31
+ await this._bundle("server.ts", "mastra.ts", outputDirectory);
32
+
33
+ // Custom deployment logic
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Parameters
39
+
40
+ ### Constructor Parameters
41
+
42
+ ### deploy Parameters
43
+
44
+ ## Methods
45
+
46
+ ## Inherited Methods from Bundler
47
+
48
+ The Deployer class inherits the following key methods from the Bundler class:
49
+
50
+ ## Core Concepts
51
+
52
+ ### Deployment Lifecycle
53
+
54
+ The Deployer abstract class implements a structured deployment lifecycle:
55
+
56
+ 1. **Initialization**: The deployer is initialized with a name and creates a Deps instance for dependency management.
57
+ 2. **Environment Setup**: The `getEnvFiles` method identifies environment files (.env.production, .env) to be used during deployment.
58
+ 3. **Preparation**: The `prepare` method (inherited from Bundler) cleans the output directory and creates necessary subdirectories.
59
+ 4. **Bundling**: The `_bundle` method (inherited from Bundler) packages the application code and its dependencies.
60
+ 5. **Deployment**: The abstract `deploy` method is implemented by subclasses to handle the actual deployment process.
61
+
62
+ ### Environment File Management
63
+
64
+ The Deployer class includes built-in support for environment file management through the `getEnvFiles` method. This method:
65
+
66
+ - Looks for environment files in a predefined order (.env.production, .env)
67
+ - Uses the FileService to find the first existing file
68
+ - Returns an array of found environment files
69
+ - Returns an empty array if no environment files are found
70
+
71
+ ```typescript
72
+ getEnvFiles(): Promise<string[]> {
73
+ const possibleFiles = ['.env.production', '.env.local', '.env'];
74
+
75
+ try {
76
+ const fileService = new FileService();
77
+ const envFile = fileService.getFirstExistingFile(possibleFiles);
78
+
79
+ return Promise.resolve([envFile]);
80
+ } catch {}
81
+
82
+ return Promise.resolve([]);
83
+ }
84
+ ```
85
+
86
+ ### Bundling and Deployment Relationship
87
+
88
+ The Deployer class extends the Bundler class, establishing a clear relationship between bundling and deployment:
89
+
90
+ 1. **Bundling as a Prerequisite**: Bundling is a prerequisite step for deployment, where the application code is packaged into a deployable format.
91
+ 2. **Shared Infrastructure**: Both bundling and deployment share common infrastructure like dependency management and file system operations.
92
+ 3. **Specialized Deployment Logic**: While bundling focuses on code packaging, deployment adds environment-specific logic for deploying the bundled code.
93
+ 4. **Extensibility**: The abstract `deploy` method allows for creating specialized deployers for different target environments.
@@ -0,0 +1,60 @@
1
+ > Learn about different deployment options for your Mastra applications
2
+
3
+ # Deployment Overview
4
+
5
+ Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use Mastra Cloud for managed hosting.
6
+
7
+ ## Runtime support
8
+
9
+ Mastra can run against any of these runtime environments:
10
+
11
+ - Node.js `v22.13.0` or later
12
+ - Bun
13
+ - Deno
14
+ - Cloudflare
15
+
16
+ ## Deployment Options
17
+
18
+ ### Mastra Server
19
+
20
+ Mastra provides a [server](https://mastra.ai/docs/v1/server/mastra-server) powered by Hono that can be deployed independently. Use the `mastra build` command to build your application and deploy the output to your preferred VM, container, or PaaS platform.
21
+
22
+ Visit the [Mastra server deployment guide](https://mastra.ai/docs/v1/deployment/mastra-server).
23
+
24
+ ### Monorepo
25
+
26
+ Deploy a Mastra server as part of a monorepo setup, following the same approach as standalone deployment.
27
+
28
+ Read about [monorepo deployment](https://mastra.ai/docs/v1/deployment/monorepo).
29
+
30
+ ### Cloud Providers
31
+
32
+ Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the build and deployment process.
33
+
34
+ - [Amazon EC2](https://mastra.ai/guides/v1/deployment/amazon-ec2)
35
+ - [AWS Lambda](https://mastra.ai/guides/v1/deployment/aws-lambda)
36
+ - [Azure App Services](https://mastra.ai/guides/v1/deployment/azure-app-services)
37
+ - [Cloudflare](https://mastra.ai/guides/v1/deployment/cloudflare-deployer)
38
+ - [Digital Ocean](https://mastra.ai/guides/v1/deployment/digital-ocean)
39
+ - [Netlify](https://mastra.ai/guides/v1/deployment/netlify-deployer)
40
+ - [Vercel](https://mastra.ai/guides/v1/deployment/vercel-deployer)
41
+
42
+ ### Web Framework
43
+
44
+ When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. The guides below cover framework-specific configuration requirements for deployment:
45
+
46
+ - [With Next.js on Vercel](https://mastra.ai/docs/v1/deployment/web-framework#with-nextjs-on-vercel)
47
+ - [With Astro on Vercel](https://mastra.ai/docs/v1/deployment/web-framework#with-astro-on-vercel)
48
+ - [With Astro on Netlify](https://mastra.ai/docs/v1/deployment/web-framework#with-astro-on-netlify)
49
+
50
+ ### Mastra Cloud
51
+
52
+ We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
53
+
54
+ Learn more in the [Mastra Cloud docs](https://mastra.ai/docs/v1/mastra-cloud/overview).
55
+
56
+ ## Workflow Runners
57
+
58
+ Mastra workflows run using the built-in execution engine by default. For production workloads requiring managed infrastructure, workflows can also be deployed to specialized platforms like [Inngest](https://www.inngest.com) that provide step memoization, automatic retries, and real-time monitoring.
59
+
60
+ Visit the [Workflow Runners guide](https://mastra.ai/docs/v1/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/guides/v1/deployment/inngest) for setup instructions.
@@ -0,0 +1,70 @@
1
+ > Learn how to build a Mastra server with build settings and deployment options.
2
+
3
+ # Deploy a Mastra Server
4
+
5
+ Mastra runs as a standard Node.js server and can be deployed across a wide range of environments.
6
+
7
+ ## Default project structure
8
+
9
+ The [getting started guide](https://mastra.ai/guides/v1/getting-started/quickstart) scaffolds a project with sensible defaults to help you begin quickly. By default, the CLI organizes application files under the `src/mastra/` directory, resulting in a structure similar to the following:
10
+
11
+ ```
12
+ src/
13
+ └── mastra/
14
+ ├── agents/
15
+ ├── tools/
16
+ ├── workflows/
17
+ └── index.ts
18
+ package.json
19
+ tsconfig.json
20
+ ```
21
+
22
+ ## Building
23
+
24
+ The `mastra build` command starts the build process:
25
+
26
+ ```bash
27
+ mastra build
28
+ ```
29
+
30
+ ### Customizing the input directory
31
+
32
+ If your Mastra files are located elsewhere, use the `--dir` flag to specify the custom location. The `--dir` flag tells Mastra where to find your entry point file (`index.ts` or `index.js`) and related directories.
33
+
34
+ ```bash
35
+ mastra build --dir ./my-project/mastra
36
+ ```
37
+
38
+ ## Build process
39
+
40
+ The build process follows these steps:
41
+
42
+ 1. **Locates entry file**: Finds `index.ts` or `index.js` in your specified directory (default: `src/mastra/`).
43
+ 2. **Creates build directory**: Generates a `.mastra/` directory containing:
44
+ - **`.build`**: Contains dependency analysis, bundled dependencies, and build configuration files.
45
+ - **`output`**: Contains the production-ready application bundle with `index.mjs` and project-specific files.
46
+ 3. **Copies static assets**: Copies the `public/` folder contents to the `output` directory for serving static files.
47
+ 4. **Bundles code**: Uses Rollup with tree shaking and source maps for optimization.
48
+ 5. **Generates server**: Creates a [Hono](https://hono.dev) HTTP server ready for deployment.
49
+
50
+ ### Build output structure
51
+
52
+ After building, Mastra creates a `.mastra/` directory with the following structure:
53
+
54
+ ```
55
+ .mastra/
56
+ ├── .build/
57
+ └── output/
58
+ ```
59
+
60
+ ### `public` folder
61
+
62
+ If a `public` folder exists in `src/mastra`, its contents are copied into the `.build/output` directory during the build process.
63
+
64
+ ## Running the Server
65
+
66
+ Start the HTTP server:
67
+
68
+ ```bash
69
+ node .mastra/output/index.mjs
70
+ ```
@@ -0,0 +1,70 @@
1
+ > Learn how to deploy Mastra applications that are part of a monorepo setup
2
+
3
+ # Deploy in a Monorepo
4
+
5
+ Deploying Mastra in a monorepo follows the same approach as deploying a standalone application. While some [Cloud](https://mastra.ai/guides/v1/deployment) or [Serverless Platform](https://mastra.ai/guides/v1/deployment) providers may introduce extra requirements, the core setup is the same.
6
+
7
+ ## Supported monorepos
8
+
9
+ Mastra works with:
10
+
11
+ - npm workspaces
12
+ - pnpm workspaces
13
+ - Yarn workspaces
14
+ - Turborepo
15
+
16
+ Known limitations:
17
+
18
+ - Bun workspaces - partial support; known issues
19
+ - Nx - You can use Nx's [supported dependency strategies](https://nx.dev/concepts/decisions/dependency-management) but you need to have `package.json` files inside your workspace packages
20
+
21
+ ## Example monorepo
22
+
23
+ In this example, the Mastra application is located at `apps/api`.
24
+
25
+ ```
26
+ apps/
27
+ ├── api/
28
+ │ ├── src/
29
+ │ │ └── mastra/
30
+ │ │ ├── agents/
31
+ │ │ ├── tools/
32
+ │ │ ├── workflows/
33
+ │ │ └── index.ts
34
+ │ ├── package.json
35
+ │ └── tsconfig.json
36
+ └── web/
37
+ packages/
38
+ ├── ui/
39
+ └── utils/
40
+ package.json
41
+ ```
42
+
43
+ ## Environment variables
44
+
45
+ Environment variables like `OPENAI_API_KEY` should be stored in an `.env` file at the root of the Mastra application `(apps/api)`, for example:
46
+
47
+ ```
48
+ api/
49
+ ├── src/
50
+ │ └── mastra/
51
+ ├── .env
52
+ ├── package.json
53
+ └── tsconfig.json
54
+ ```
55
+
56
+ ## Deployment configuration
57
+
58
+ The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](https://mastra.ai/docs/v1/mastra-cloud/overview). While the interface may differ between providers, the configuration remains the same.
59
+
60
+ ![Deployment configuration](/img/monorepo/monorepo-mastra-cloud.jpg)
61
+
62
+ > **Note:**
63
+ Make sure the correct package (e.g. `apps/api`) is selected as the deploy target. Selecting the wrong project root is a common deployment issue in monorepos.
64
+
65
+ ## Dependency management
66
+
67
+ In a monorepo, keep dependencies consistent to avoid version conflicts and build errors.
68
+
69
+ - Use a **single lockfile** at the project root so all packages resolve the same versions.
70
+ - Align versions of **shared libraries** (like Mastra or frameworks) to prevent duplicates.
@@ -0,0 +1,17 @@
1
+ > Deploy your Mastra applications to cloud providers
2
+
3
+ # Deploy to Cloud Providers
4
+
5
+ Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the deployment process.
6
+
7
+ ## Supported Cloud Providers
8
+
9
+ The following guides show how to deploy Mastra to specific cloud providers:
10
+
11
+ - [Amazon EC2](https://mastra.ai/guides/v1/deployment/amazon-ec2)
12
+ - [AWS Lambda](https://mastra.ai/guides/v1/deployment/aws-lambda)
13
+ - [Azure App Services](https://mastra.ai/guides/v1/deployment/azure-app-services)
14
+ - [Cloudflare](https://mastra.ai/guides/v1/deployment/cloudflare-deployer)
15
+ - [Digital Ocean](https://mastra.ai/guides/v1/deployment/digital-ocean)
16
+ - [Netlify](https://mastra.ai/guides/v1/deployment/netlify-deployer)
17
+ - [Vercel](https://mastra.ai/guides/v1/deployment/vercel-deployer)