@mastra/deployer 0.0.0-bundle-studio-cloud-20251222034739 → 0.0.0-bundle-version-20260121132824
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +316 -5
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.d.ts +4 -3
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts +2 -1
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +16 -12
- package/dist/build/index.d.ts +2 -1
- package/dist/build/index.d.ts.map +1 -1
- package/dist/build/index.js +4 -4
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/plugins/tsconfig-paths.d.ts +1 -1
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/build/types.d.ts +13 -0
- package/dist/build/types.d.ts.map +1 -1
- package/dist/build/utils.d.ts +17 -0
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/build/watcher.d.ts +2 -1
- package/dist/build/watcher.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.d.ts +4 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-VA2CSOKJ.cjs → chunk-5TYVF4KJ.cjs} +9 -2
- package/dist/chunk-5TYVF4KJ.cjs.map +1 -0
- package/dist/{chunk-ESR6AK5N.js → chunk-AL5EQ2AN.js} +32 -23
- package/dist/chunk-AL5EQ2AN.js.map +1 -0
- package/dist/{chunk-CRIOGWZD.cjs → chunk-AL6XKOBW.cjs} +97 -41
- package/dist/chunk-AL6XKOBW.cjs.map +1 -0
- package/dist/{chunk-WFIG7I5C.js → chunk-BO7373XT.js} +7 -7
- package/dist/chunk-BO7373XT.js.map +1 -0
- package/dist/{chunk-5HTKP372.js → chunk-DBXWQ2CA.js} +7 -7
- package/dist/chunk-DBXWQ2CA.js.map +1 -0
- package/dist/{chunk-HRCR6OKC.cjs → chunk-FM2JHUBD.cjs} +16 -16
- package/dist/chunk-FM2JHUBD.cjs.map +1 -0
- package/dist/{chunk-DMISJICL.cjs → chunk-JRUJ546M.cjs} +7 -7
- package/dist/chunk-JRUJ546M.cjs.map +1 -0
- package/dist/{chunk-7F6JKGX4.cjs → chunk-KB2G27CA.cjs} +39 -30
- package/dist/chunk-KB2G27CA.cjs.map +1 -0
- package/dist/{chunk-4P2LYC33.js → chunk-MCWU6IKS.js} +3 -3
- package/dist/{chunk-4P2LYC33.js.map → chunk-MCWU6IKS.js.map} +1 -1
- package/dist/{chunk-OVVUJ46G.cjs → chunk-PYLFWTRX.cjs} +18 -20
- package/dist/chunk-PYLFWTRX.cjs.map +1 -0
- package/dist/{chunk-HHA2Y3AS.js → chunk-QAOUDKHK.js} +9 -3
- package/dist/chunk-QAOUDKHK.js.map +1 -0
- package/dist/{chunk-BDA7RMRF.js → chunk-T2RITIJW.js} +78 -21
- package/dist/chunk-T2RITIJW.js.map +1 -0
- package/dist/{chunk-ONWHS3PA.js → chunk-X6FLVHI5.js} +8 -10
- package/dist/chunk-X6FLVHI5.js.map +1 -0
- package/dist/{chunk-54PQDTM3.cjs → chunk-ZXQ7DOYU.cjs} +4 -4
- package/dist/{chunk-54PQDTM3.cjs.map → chunk-ZXQ7DOYU.cjs.map} +1 -1
- package/dist/default-u_dwuiYb-JPNIZQKK.cjs +9 -0
- package/dist/{default-u_dwuiYb-ZNEZWEPC.cjs.map → default-u_dwuiYb-JPNIZQKK.cjs.map} +1 -1
- package/dist/default-u_dwuiYb-RK5OD4MY.js +3 -0
- package/dist/{default-u_dwuiYb-IKALPRLV.js.map → default-u_dwuiYb-RK5OD4MY.js.map} +1 -1
- package/dist/docs/README.md +32 -0
- package/dist/docs/SKILL.md +36 -0
- package/dist/docs/SOURCE_MAP.json +27 -0
- package/dist/docs/deployer/01-reference.md +93 -0
- package/dist/docs/deployment/01-overview.md +64 -0
- package/dist/docs/deployment/02-mastra-server.md +129 -0
- package/dist/docs/deployment/03-monorepo.md +142 -0
- package/dist/docs/deployment/04-cloud-providers.md +17 -0
- package/dist/docs/deployment/05-web-framework.md +55 -0
- package/dist/docs/deployment/06-workflow-runners.md +11 -0
- package/dist/{effect-QlVUlMFu-2KN4AWBH.cjs → effect-QlVUlMFu-HN3LWZSQ.cjs} +4 -4
- package/dist/{effect-QlVUlMFu-2KN4AWBH.cjs.map → effect-QlVUlMFu-HN3LWZSQ.cjs.map} +1 -1
- package/dist/{effect-QlVUlMFu-MWXQUT6S.js → effect-QlVUlMFu-XOJ2F4UA.js} +3 -3
- package/dist/{effect-QlVUlMFu-MWXQUT6S.js.map → effect-QlVUlMFu-XOJ2F4UA.js.map} +1 -1
- package/dist/{esm-BLVTLTJW.js → esm-6TGK2CUM.js} +3 -3
- package/dist/esm-6TGK2CUM.js.map +1 -0
- package/dist/{esm-E3NUCNVN.cjs → esm-SQKX5ABS.cjs} +3 -3
- package/dist/esm-SQKX5ABS.cjs.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +488 -68
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +483 -64
- package/dist/server/index.js.map +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/{sury-CWZTCd75-6QYFZXZY.cjs → sury-CWZTCd75-KEHKUXG7.cjs} +4 -4
- package/dist/{sury-CWZTCd75-6QYFZXZY.cjs.map → sury-CWZTCd75-KEHKUXG7.cjs.map} +1 -1
- package/dist/{sury-CWZTCd75-DAPFEZIA.js → sury-CWZTCd75-L2D76L25.js} +3 -3
- package/dist/{sury-CWZTCd75-DAPFEZIA.js.map → sury-CWZTCd75-L2D76L25.js.map} +1 -1
- package/dist/{valibot--1zFm7rT-OOWNQW47.cjs → valibot--1zFm7rT-NVADAEQI.cjs} +4 -4
- package/dist/{valibot--1zFm7rT-OOWNQW47.cjs.map → valibot--1zFm7rT-NVADAEQI.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-AASENK42.js → valibot--1zFm7rT-R2UKWLZC.js} +3 -3
- package/dist/{valibot--1zFm7rT-AASENK42.js.map → valibot--1zFm7rT-R2UKWLZC.js.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-PBXMZJWR.cjs → valibot-D_HTw1Gn-DSFFOUBW.cjs} +4 -4
- package/dist/{valibot-D_HTw1Gn-PBXMZJWR.cjs.map → valibot-D_HTw1Gn-DSFFOUBW.cjs.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-PCY2UTIB.js → valibot-D_HTw1Gn-KWXWP2TJ.js} +3 -3
- package/dist/{valibot-D_HTw1Gn-PCY2UTIB.js.map → valibot-D_HTw1Gn-KWXWP2TJ.js.map} +1 -1
- package/dist/validator/custom-resolver.cjs +2 -2
- package/dist/validator/custom-resolver.js +1 -1
- package/dist/{zod-Bwrt9trS-MTR3E2QO.js → zod-Bwrt9trS-GCUGPBJX.js} +4 -4
- package/dist/{zod-Bwrt9trS-MTR3E2QO.js.map → zod-Bwrt9trS-GCUGPBJX.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-OXQA54TZ.cjs → zod-Bwrt9trS-ZZHFZ7YQ.cjs} +6 -6
- package/dist/{zod-Bwrt9trS-OXQA54TZ.cjs.map → zod-Bwrt9trS-ZZHFZ7YQ.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-7BIIMWZW.cjs → zod-DSgpEGAE-3CMS4FSB.cjs} +4 -4
- package/dist/{zod-DSgpEGAE-7BIIMWZW.cjs.map → zod-DSgpEGAE-3CMS4FSB.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-UO7OP3J6.js → zod-DSgpEGAE-IPE3O2NQ.js} +3 -3
- package/dist/{zod-DSgpEGAE-UO7OP3J6.js.map → zod-DSgpEGAE-IPE3O2NQ.js.map} +1 -1
- package/package.json +16 -15
- package/dist/chunk-5HTKP372.js.map +0 -1
- package/dist/chunk-7F6JKGX4.cjs.map +0 -1
- package/dist/chunk-BDA7RMRF.js.map +0 -1
- package/dist/chunk-CRIOGWZD.cjs.map +0 -1
- package/dist/chunk-DMISJICL.cjs.map +0 -1
- package/dist/chunk-ESR6AK5N.js.map +0 -1
- package/dist/chunk-HHA2Y3AS.js.map +0 -1
- package/dist/chunk-HRCR6OKC.cjs.map +0 -1
- package/dist/chunk-ONWHS3PA.js.map +0 -1
- package/dist/chunk-OVVUJ46G.cjs.map +0 -1
- package/dist/chunk-VA2CSOKJ.cjs.map +0 -1
- package/dist/chunk-WFIG7I5C.js.map +0 -1
- package/dist/default-u_dwuiYb-IKALPRLV.js +0 -3
- package/dist/default-u_dwuiYb-ZNEZWEPC.cjs +0 -9
- package/dist/esm-BLVTLTJW.js.map +0 -1
- package/dist/esm-E3NUCNVN.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getPackageRootPath, subpathExternalsResolver, tsConfigPaths, esbuild, esmShim, removeDeployer } from './chunk-
|
|
2
|
-
import { isBuiltinModule, getPackageName, slash } from './chunk-
|
|
1
|
+
import { getPackageRootPath, subpathExternalsResolver, tsConfigPaths, esbuild, esmShim, removeDeployer } from './chunk-T2RITIJW.js';
|
|
2
|
+
import { isBuiltinModule, getPackageName, slash } from './chunk-QAOUDKHK.js';
|
|
3
3
|
import alias from '@rollup/plugin-alias';
|
|
4
4
|
import commonjs from '@rollup/plugin-commonjs';
|
|
5
5
|
import json from '@rollup/plugin-json';
|
|
@@ -7,7 +7,7 @@ import nodeResolve2 from '@rollup/plugin-node-resolve';
|
|
|
7
7
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
8
8
|
import { rollup } from 'rollup';
|
|
9
9
|
import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';
|
|
10
|
-
import { join } from 'path';
|
|
10
|
+
import { isAbsolute, join } from 'path';
|
|
11
11
|
import { readFile } from 'fs/promises';
|
|
12
12
|
|
|
13
13
|
async function getPackageJSON(pkgName, importer) {
|
|
@@ -23,7 +23,7 @@ function nodeModulesExtensionResolver() {
|
|
|
23
23
|
return {
|
|
24
24
|
name: "node-modules-extension-resolver",
|
|
25
25
|
async resolveId(id, importer, options) {
|
|
26
|
-
if (!importer || id.startsWith(".") || id.startsWith("/") || isBuiltinModule(id)) {
|
|
26
|
+
if (!importer || id.startsWith(".") || id.startsWith("/") || isBuiltinModule(id) || isAbsolute(id)) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
const parts = id.split("/");
|
|
@@ -46,10 +46,8 @@ function nodeModulesExtensionResolver() {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
let filePath = nodeResolved.id;
|
|
49
|
-
console.log({ nodeResolved });
|
|
50
49
|
if (nodeResolved.resolvedBy === "commonjs--resolver") {
|
|
51
50
|
filePath = filePath.substring(1).split("?")[0];
|
|
52
|
-
console.log({ filePath });
|
|
53
51
|
}
|
|
54
52
|
const resolvedImportPath = filePath.replace(packageRoot, pkgName);
|
|
55
53
|
return {
|
|
@@ -73,14 +71,14 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
73
71
|
enableEsmShim = true,
|
|
74
72
|
externalsPreset = false
|
|
75
73
|
}) {
|
|
76
|
-
let nodeResolvePlugin = platform === "node" ? nodeResolve2({
|
|
74
|
+
let nodeResolvePlugin = platform === "node" || platform === "neutral" ? nodeResolve2({
|
|
77
75
|
preferBuiltins: true,
|
|
78
76
|
exportConditions: ["node"]
|
|
79
77
|
}) : nodeResolve2({
|
|
80
78
|
preferBuiltins: false,
|
|
81
79
|
browser: true
|
|
82
80
|
});
|
|
83
|
-
const externalsCopy = new Set(analyzedBundleInfo.externalDependencies);
|
|
81
|
+
const externalsCopy = new Set(analyzedBundleInfo.externalDependencies.keys());
|
|
84
82
|
const externals = externalsPreset ? [] : Array.from(externalsCopy);
|
|
85
83
|
const normalizedEntryFile = slash(entryFile);
|
|
86
84
|
return {
|
|
@@ -200,5 +198,5 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
export { createBundler, getInputOptions, nodeModulesExtensionResolver };
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-X6FLVHI5.js.map
|
|
202
|
+
//# sourceMappingURL=chunk-X6FLVHI5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/bundler.ts"],"names":["nodeResolve","join"],"mappings":";;;;;;;;;;;;AAYA,eAAe,cAAA,CAAe,SAAiB,QAAA,EAAwC;AACrF,EAAA,MAAM,OAAA,GAAU,MAAM,kBAAA,CAAmB,OAAA,EAAS,QAAQ,CAAA;AAC1D,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,QAAA,EAAW,OAAO,CAAA,UAAA,CAAY,CAAA;AAAA,EAChD;AAEA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,MAAM,QAAA,CAAS,KAAK,OAAA,EAAS,cAAc,CAAA,EAAG,OAAO,CAAC,CAAA;AACjF,EAAA,OAAO,OAAA;AACT;AASO,SAAS,4BAAA,GAAuC;AAErD,EAAA,MAAM,oBAAoBA,YAAA,EAAY;AAEtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,iCAAA;AAAA,IACN,MAAM,SAAA,CAAU,EAAA,EAAI,QAAA,EAAU,OAAA,EAAS;AAErC,MAAA,IAAI,CAAC,QAAA,IAAY,EAAA,CAAG,UAAA,CAAW,GAAG,CAAA,IAAK,EAAA,CAAG,UAAA,CAAW,GAAG,KAAK,eAAA,CAAgB,EAAE,CAAA,IAAK,UA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;AAAA,QACH,MAAA,EAAQ,KAAA;AAAA,QACR,cAAA,EAAgB,YAAA;AAAA,QAChB,cAAA,EAAgB;AAAA,OACjB,CAAA;AAAA,IACH,CAAA;AAAA,IACA,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,EAAM;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-X6FLVHI5.js","sourcesContent":["import { join, isAbsolute } from 'node:path';\nimport { readFile } from 'node:fs/promises';\nimport type { Plugin } from 'rollup';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { getPackageName, isBuiltinModule } from '../utils';\nimport { getPackageRootPath } from '../package-info';\nimport type { PackageJson } from 'type-fest';\n\n/**\n * Check if a package has an exports field in its package.json.\n * Results are cached to avoid repeated filesystem reads.\n */\nasync function getPackageJSON(pkgName: string, importer: string): Promise<PackageJson> {\n const pkgRoot = await getPackageRootPath(pkgName, importer);\n if (!pkgRoot) {\n throw new Error(`Package ${pkgName} not found`);\n }\n\n const pkgJSON = JSON.parse(await readFile(join(pkgRoot, 'package.json'), 'utf-8')) as PackageJson;\n return pkgJSON;\n}\n\n/**\n * Rollup plugin that resolves module extensions for external dependencies.\n *\n * This plugin handles ESM compatibility for external imports when node-resolve is not used:\n * - Packages WITH exports field (e.g., hono, date-fns): Keep imports as-is or strip redundant extensions\n * - Packages WITHOUT exports field (e.g., lodash): Add .js extension for direct file imports\n */\nexport function nodeModulesExtensionResolver(): Plugin {\n // Create a single instance of node-resolve to reuse\n const nodeResolvePlugin = nodeResolve();\n\n return {\n name: 'node-modules-extension-resolver',\n async resolveId(id, importer, options) {\n // Skip relative imports, absolute paths, no importer, or builtin modules\n if (!importer || id.startsWith('.') || id.startsWith('/') || isBuiltinModule(id) || isAbsolute(id)) {\n return null;\n }\n\n // Skip direct package imports (e.g., 'lodash', '@mastra/core')\n const parts = id.split('/');\n const isScoped = id.startsWith('@');\n if ((isScoped && parts.length === 2) || (!isScoped && parts.length === 1)) {\n return null;\n }\n\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n try {\n const packageJSON = await getPackageJSON(pkgName, importer);\n // if it has exports, node should be able to rsolve it, if not the exports map is wrong.\n if (!!packageJSON.exports) {\n return null;\n }\n\n const packageRoot = await getPackageRootPath(pkgName, importer);\n // @ts-expect-error - handle is part of resolveId signature\n const nodeResolved = await nodeResolvePlugin.resolveId?.handler?.call(this, id, importer, options);\n // if we cannot resolve it, it's not a valid import so we let node handle it\n if (!nodeResolved?.id) {\n return null;\n }\n\n let filePath = nodeResolved.id;\n if (nodeResolved.resolvedBy === 'commonjs--resolver') {\n filePath = filePath.substring(1).split('?')[0];\n }\n\n const resolvedImportPath = filePath.replace(packageRoot, pkgName);\n\n return {\n id: resolvedImportPath,\n external: true,\n };\n } catch (err) {\n console.error(err);\n return null;\n }\n },\n };\n}\n","import alias from '@rollup/plugin-alias';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { esmShim } from './plugins/esm-shim';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { rollup, type InputOptions, type OutputOptions, type Plugin } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport { analyzeBundle } from './analyze';\nimport { removeAllOptionsFromMastraExceptPlugin } from './plugins/remove-all-except';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash, type BundlerPlatform } from './utils';\nimport { subpathExternalsResolver } from './plugins/subpath-externals-resolver';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { removeDeployer } from './plugins/remove-deployer';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: BundlerPlatform,\n env: Record<string, string> = { 'process.env.NODE_ENV': JSON.stringify('production') },\n {\n sourcemap = false,\n isDev = false,\n projectRoot,\n workspaceRoot = undefined,\n enableEsmShim = true,\n externalsPreset = false,\n }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n externalsPreset?: boolean;\n },\n): Promise<InputOptions> {\n // For 'neutral' platform (Bun), use similar settings to 'node' for module resolution\n let nodeResolvePlugin =\n platform === 'node' || platform === 'neutral'\n ? nodeResolve({\n preferBuiltins: true,\n exportConditions: ['node'],\n })\n : nodeResolve({\n preferBuiltins: false,\n browser: true,\n });\n\n const externalsCopy = new Set<string>(analyzedBundleInfo.externalDependencies.keys());\n const externals = externalsPreset ? [] : Array.from(externalsCopy);\n\n const normalizedEntryFile = slash(entryFile);\n return {\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n treeshake: 'smallest',\n preserveSymlinks: true,\n external: externals,\n plugins: [\n subpathExternalsResolver(externals),\n {\n name: 'alias-optimized-deps',\n resolveId(id: string) {\n if (!analyzedBundleInfo.dependencies.has(id)) {\n return null;\n }\n\n const filename = analyzedBundleInfo.dependencies.get(id)!;\n const absolutePath = join(workspaceRoot || projectRoot, filename);\n\n // During `mastra dev` we want to keep deps as external\n if (isDev) {\n return {\n id: process.platform === 'win32' ? pathToFileURL(absolutePath).href : absolutePath,\n external: true,\n };\n }\n\n // For production builds return the absolute path as-is so Rollup can handle itself\n return {\n id: absolutePath,\n external: false,\n };\n },\n } satisfies Plugin,\n alias({\n entries: [\n {\n find: /^\\#server$/,\n replacement: slash(fileURLToPath(import.meta.resolve('@mastra/deployer/server'))),\n },\n {\n find: /^\\@mastra\\/server\\/(.*)/,\n replacement: `@mastra/server/$1`,\n customResolver: id => {\n if (id.startsWith('@mastra/server')) {\n return {\n id: fileURLToPath(import.meta.resolve(id)),\n };\n }\n },\n },\n { find: /^\\#mastra$/, replacement: normalizedEntryFile },\n ],\n }),\n tsConfigPaths(),\n {\n name: 'tools-rewriter',\n resolveId(id: string) {\n if (id === '#tools') {\n return {\n id: './tools.mjs',\n external: true,\n };\n }\n },\n } satisfies Plugin,\n esbuild({\n platform,\n define: env,\n }),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n externalsPreset\n ? null\n : commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n externalsPreset ? nodeModulesExtensionResolver() : nodeResolvePlugin,\n // for debugging\n // {\n // name: 'logger',\n // //@ts-ignore\n // resolveId(id, ...args) {\n // console.log({ id, args });\n // },\n // // @ts-ignore\n // transform(code, id) {\n // if (code.includes('class Duplexify ')) {\n // console.log({ duplex: id });\n // }\n // },\n // },\n json(),\n removeDeployer(entryFile, { sourcemap }),\n // treeshake unused imports\n esbuild({\n include: entryFile,\n platform,\n }),\n ].filter(Boolean),\n } satisfies InputOptions;\n}\n\nexport async function createBundler(\n inputOptions: InputOptions,\n outputOptions: Partial<OutputOptions> & { dir: string },\n) {\n const bundler = await rollup(inputOptions);\n\n return {\n write: () => {\n return bundler.write({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n });\n },\n close: () => {\n return bundler.close();\n },\n };\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkJBE6KM7R_cjs = require('./chunk-JBE6KM7R.cjs');
|
|
4
|
-
var
|
|
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
|
|
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-
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
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-
|
|
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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-JPNIZQKK.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"default-u_dwuiYb-
|
|
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.4
|
|
@@ -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.4
|
|
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.4",
|
|
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,64 @@
|
|
|
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/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
|
+
Use this option when you need full control over your infrastructure, long-running processes, or WebSocket connections. The [Mastra server deployment guide](https://mastra.ai/docs/deployment/mastra-server) provides more details.
|
|
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/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
|
+
Use this option for auto-scaling, minimal infrastructure management, or when you're already using one of these platforms.
|
|
35
|
+
|
|
36
|
+
- [Amazon EC2](https://mastra.ai/guides/deployment/amazon-ec2)
|
|
37
|
+
- [AWS Lambda](https://mastra.ai/guides/deployment/aws-lambda)
|
|
38
|
+
- [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
|
|
39
|
+
- [Cloudflare](https://mastra.ai/guides/deployment/cloudflare-deployer)
|
|
40
|
+
- [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
|
|
41
|
+
- [Netlify](https://mastra.ai/guides/deployment/netlify-deployer)
|
|
42
|
+
- [Vercel](https://mastra.ai/guides/deployment/vercel-deployer)
|
|
43
|
+
|
|
44
|
+
### Web Framework
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
Use these guides when adding Mastra to an existing Next.js or Astro application.
|
|
49
|
+
|
|
50
|
+
- [With Next.js on Vercel](https://mastra.ai/docs/deployment/web-framework#with-nextjs-on-vercel)
|
|
51
|
+
- [With Astro on Vercel](https://mastra.ai/docs/deployment/web-framework#with-astro-on-vercel)
|
|
52
|
+
- [With Astro on Netlify](https://mastra.ai/docs/deployment/web-framework#with-astro-on-netlify)
|
|
53
|
+
|
|
54
|
+
### Mastra Cloud
|
|
55
|
+
|
|
56
|
+
We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
|
|
57
|
+
|
|
58
|
+
Learn more in the [Mastra Cloud docs](https://mastra.ai/docs/mastra-cloud/overview).
|
|
59
|
+
|
|
60
|
+
## Workflow Runners
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
Visit the [Workflow Runners guide](https://mastra.ai/docs/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest) for setup instructions.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
> Learn how to build and deploy a Mastra server.
|
|
2
|
+
|
|
3
|
+
# Deploy a Mastra Server
|
|
4
|
+
|
|
5
|
+
Mastra compiles your application into a standalone Node.js server that can run on any platform supporting Node.js, Bun, or Deno.
|
|
6
|
+
|
|
7
|
+
> **Note:**
|
|
8
|
+
|
|
9
|
+
This guide covers deploying the standalone server generated by `mastra build`. If you need to integrate Mastra into an existing Express or Hono application, see [Server Adapters](https://mastra.ai/docs/server/server-adapters) instead.
|
|
10
|
+
|
|
11
|
+
## Building your application
|
|
12
|
+
|
|
13
|
+
Run the build command from your project root:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mastra build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This creates a `.mastra` directory containing your production-ready server.
|
|
20
|
+
|
|
21
|
+
> **Note:**
|
|
22
|
+
|
|
23
|
+
Read the [`mastra build`](https://mastra.ai/reference/cli/mastra#mastra-build) reference for all available flags.
|
|
24
|
+
|
|
25
|
+
## Build output
|
|
26
|
+
|
|
27
|
+
After building, Mastra creates the following structure:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
.mastra/
|
|
31
|
+
├── .build/ # Intermediate build artifacts (module maps, analysis)
|
|
32
|
+
└── output/
|
|
33
|
+
├── index.mjs # Server entry point
|
|
34
|
+
├── mastra.mjs # Your bundled Mastra configuration
|
|
35
|
+
├── tools.mjs # Aggregated tool exports
|
|
36
|
+
├── tools/ # Individual tool bundles
|
|
37
|
+
├── package.json # Production dependencies
|
|
38
|
+
├── node_modules/ # Installed dependencies
|
|
39
|
+
├── .npmrc # Copied from your project (if present)
|
|
40
|
+
├── public/ # Static assets (if src/mastra/public exists)
|
|
41
|
+
└── playground/ # Studio UI (if --studio flag used)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The `output` directory is self-contained. You can copy it to any server and run it directly.
|
|
45
|
+
|
|
46
|
+
## Running the server
|
|
47
|
+
|
|
48
|
+
Start the server using the Mastra CLI:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
mastra start
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or run directly with Node.js:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
node .mastra/output/index.mjs
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `mastra start` command provides additional features:
|
|
61
|
+
- Loads environment variables from `.env.production` and `.env`
|
|
62
|
+
- Provides helpful error messages for missing modules
|
|
63
|
+
- Handles process signals for graceful shutdown
|
|
64
|
+
|
|
65
|
+
> **Note:**
|
|
66
|
+
|
|
67
|
+
Read the [`mastra start`](https://mastra.ai/reference/cli/mastra#mastra-start) reference for all available flags.
|
|
68
|
+
|
|
69
|
+
## Build configuration
|
|
70
|
+
|
|
71
|
+
### Public folder
|
|
72
|
+
|
|
73
|
+
If a `public` folder exists in your Mastra directory (`src/mastra/public`), its contents are copied to the output directory during build. These files are served as static assets by the server.
|
|
74
|
+
|
|
75
|
+
### Mastra configuration
|
|
76
|
+
|
|
77
|
+
The build process respects configuration in your Mastra instance. For server behavior like CORS, timeouts, and middleware, see [server overview](https://mastra.ai/docs/server/mastra-server). For all available options, see the [configuration reference](https://mastra.ai/reference/configuration).
|
|
78
|
+
|
|
79
|
+
## Build process
|
|
80
|
+
|
|
81
|
+
The build follows these steps:
|
|
82
|
+
|
|
83
|
+
1. **Locates entry file**: Finds `index.ts` or `index.js` in your Mastra directory.
|
|
84
|
+
2. **Discovers tools**: Scans for tool files matching `{mastraDir}/tools/**/*.{js,ts}`, excluding test files.
|
|
85
|
+
3. **Analyzes dependencies**: Determines which packages to bundle vs. install externally.
|
|
86
|
+
4. **Bundles code**: Uses Rollup with tree-shaking and optional source maps.
|
|
87
|
+
5. **Generates server**: Creates a Hono-based HTTP server as `index.mjs`.
|
|
88
|
+
6. **Installs dependencies**: Runs `npm install` in the output directory.
|
|
89
|
+
7. **Copies assets**: Copies `public` folder and `.npmrc` if present.
|
|
90
|
+
|
|
91
|
+
## Environment variables
|
|
92
|
+
|
|
93
|
+
| Variable | Description |
|
|
94
|
+
|----------|-------------|
|
|
95
|
+
| `PORT` | Server port (default: `4111`) |
|
|
96
|
+
| `MASTRA_STUDIO_PATH` | Path to Studio build directory (default: `./playground`) |
|
|
97
|
+
| `MASTRA_SKIP_DOTENV` | Skip loading `.env` files when set |
|
|
98
|
+
| `NODE_OPTIONS` | Node.js options (e.g., `--max-old-space-size=4096` for build memory issues) |
|
|
99
|
+
|
|
100
|
+
## Server endpoints
|
|
101
|
+
|
|
102
|
+
The built server exposes endpoints for health checks, agents, workflows, and more:
|
|
103
|
+
|
|
104
|
+
| Endpoint | Description |
|
|
105
|
+
|----------|-------------|
|
|
106
|
+
| `GET /health` | Health check endpoint, returns `200 OK` |
|
|
107
|
+
| `GET /openapi.json` | OpenAPI specification (if `server.build.openAPIDocs` is enabled) |
|
|
108
|
+
| `GET /swagger-ui` | Interactive API documentation (if `server.build.swaggerUI` is enabled) |
|
|
109
|
+
|
|
110
|
+
This list is not exhaustive. To view all endpoints, run `mastra dev` and visit `http://localhost:4111/swagger-ui`.
|
|
111
|
+
|
|
112
|
+
To add your own endpoints, see [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes).
|
|
113
|
+
|
|
114
|
+
## Troubleshooting
|
|
115
|
+
|
|
116
|
+
### Memory errors during build
|
|
117
|
+
|
|
118
|
+
If you encounter `JavaScript heap out of memory` errors:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
NODE_OPTIONS="--max-old-space-size=4096" mastra build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Related
|
|
125
|
+
|
|
126
|
+
- [Server Overview](https://mastra.ai/docs/server/mastra-server) - Configure server behavior, middleware, and authentication
|
|
127
|
+
- [Server Adapters](https://mastra.ai/docs/server/server-adapters) - Use Express or Hono instead of `mastra build`
|
|
128
|
+
- [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes) - Add custom HTTP endpoints
|
|
129
|
+
- [Configuration Reference](https://mastra.ai/reference/configuration) - Full configuration options
|