@mastra/deployer 1.2.0 → 1.3.0-alpha.1

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 (63) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
  3. package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
  4. package/dist/build/analyze.cjs +2 -2
  5. package/dist/build/analyze.d.ts.map +1 -1
  6. package/dist/build/analyze.js +1 -1
  7. package/dist/build/bundler.cjs +3 -3
  8. package/dist/build/bundler.js +1 -1
  9. package/dist/build/index.cjs +11 -11
  10. package/dist/build/index.js +4 -4
  11. package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
  12. package/dist/build/watcher.d.ts +3 -1
  13. package/dist/build/watcher.d.ts.map +1 -1
  14. package/dist/bundler/index.cjs +3 -3
  15. package/dist/bundler/index.js +1 -1
  16. package/dist/{chunk-5QWVKP4X.js → chunk-3WL6HPU3.js} +3 -3
  17. package/dist/{chunk-5QWVKP4X.js.map → chunk-3WL6HPU3.js.map} +1 -1
  18. package/dist/{chunk-CWEG55RE.js → chunk-AMZJCH64.js} +48 -44
  19. package/dist/chunk-AMZJCH64.js.map +1 -0
  20. package/dist/{chunk-DIQKRYF4.js → chunk-BZLFGOSU.js} +17 -9
  21. package/dist/chunk-BZLFGOSU.js.map +1 -0
  22. package/dist/{chunk-Q6OWS3YN.cjs → chunk-E4SQOERA.cjs} +48 -44
  23. package/dist/chunk-E4SQOERA.cjs.map +1 -0
  24. package/dist/{chunk-MOCLE4XM.cjs → chunk-IZHNO3GK.cjs} +24 -16
  25. package/dist/chunk-IZHNO3GK.cjs.map +1 -0
  26. package/dist/{chunk-4CCXXH5X.cjs → chunk-K7J2W7DJ.cjs} +7 -7
  27. package/dist/{chunk-4CCXXH5X.cjs.map → chunk-K7J2W7DJ.cjs.map} +1 -1
  28. package/dist/{chunk-O45P6AJF.js → chunk-KNINPAM6.js} +6 -6
  29. package/dist/{chunk-O45P6AJF.js.map → chunk-KNINPAM6.js.map} +1 -1
  30. package/dist/{chunk-GRQR3MP7.js → chunk-KRRQVSI7.js} +3 -3
  31. package/dist/{chunk-GRQR3MP7.js.map → chunk-KRRQVSI7.js.map} +1 -1
  32. package/dist/{chunk-5KBGEH2B.cjs → chunk-P3YQIQSD.cjs} +43 -23
  33. package/dist/chunk-P3YQIQSD.cjs.map +1 -0
  34. package/dist/{chunk-T3HNSYJE.cjs → chunk-R2SIOO54.cjs} +11 -11
  35. package/dist/{chunk-T3HNSYJE.cjs.map → chunk-R2SIOO54.cjs.map} +1 -1
  36. package/dist/{chunk-UA7HQFWN.js → chunk-T3QYAGU3.js} +32 -12
  37. package/dist/chunk-T3QYAGU3.js.map +1 -0
  38. package/dist/{chunk-MYKZPGDB.cjs → chunk-YA6TH3CS.cjs} +14 -14
  39. package/dist/{chunk-MYKZPGDB.cjs.map → chunk-YA6TH3CS.cjs.map} +1 -1
  40. package/dist/docs/SKILL.md +19 -24
  41. package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
  42. package/dist/docs/{deployment/04-cloud-providers.md → references/docs-deployment-cloud-providers.md} +2 -4
  43. package/dist/docs/{deployment/02-mastra-server.md → references/docs-deployment-mastra-server.md} +16 -23
  44. package/dist/docs/{deployment/03-monorepo.md → references/docs-deployment-monorepo.md} +12 -12
  45. package/dist/docs/{deployment/01-overview.md → references/docs-deployment-overview.md} +5 -7
  46. package/dist/docs/{deployment/05-web-framework.md → references/docs-deployment-web-framework.md} +4 -7
  47. package/dist/docs/{deployment/06-workflow-runners.md → references/docs-deployment-workflow-runners.md} +1 -3
  48. package/dist/docs/{deployer/01-reference.md → references/reference-deployer.md} +19 -12
  49. package/dist/index.cjs +4 -4
  50. package/dist/index.js +2 -2
  51. package/dist/server/index.cjs +73 -41
  52. package/dist/server/index.cjs.map +1 -1
  53. package/dist/server/index.d.ts.map +1 -1
  54. package/dist/server/index.js +74 -42
  55. package/dist/server/index.js.map +1 -1
  56. package/package.json +9 -10
  57. package/dist/chunk-5KBGEH2B.cjs.map +0 -1
  58. package/dist/chunk-CWEG55RE.js.map +0 -1
  59. package/dist/chunk-DIQKRYF4.js.map +0 -1
  60. package/dist/chunk-MOCLE4XM.cjs.map +0 -1
  61. package/dist/chunk-Q6OWS3YN.cjs.map +0 -1
  62. package/dist/chunk-UA7HQFWN.js.map +0 -1
  63. package/dist/docs/README.md +0 -32
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bundler/index.ts"],"names":["MastraBundler","emptyDir","ensureDir","join","writeFile","createBundler","getBundlerOptions","analyzeBundle","DepsService","stat","copy","getWorkspaceInformation","pkg","dirname","getInputOptions","existsSync","virtual","slash","posix","glob","path","fsExtra","FileService","error","MastraError","ErrorDomain","ErrorCategory","getPackageRootPath","readJSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,UAAA,0BAAoB,YAAY;AAEtC,IAAe,OAAA,GAAf,cAA+BA,qBAAA,CAAc;AAAA,EACxC,gBAAA,GAAmB,QAAA;AAAA,EACnB,SAAA,GAAY,QAAA;AAAA,EACZ,QAAA,GAA4B,MAAA;AAAA,EAEtC,WAAA,CAAY,IAAA,EAAc,SAAA,GAAoC,SAAA,EAAW;AACvE,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AAAA,EAC3B;AAAA,EAEA,MAAM,QAAQ,eAAA,EAAwC;AAEpD,IAAA,MAAMC,iBAAS,eAAe,CAAA;AAE9B,IAAA,MAAMC,iBAAA,CAAUC,SAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,gBAAgB,CAAC,CAAA;AAC5D,IAAA,MAAMD,iBAAA,CAAUC,SAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,EACvD;AAAA,EAEA,MAAM,gBAAA,CACJ,eAAA,EACA,YAAA,EACA,WAAA,EACA;AACA,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B,UAAU,CAAA;AACrE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-MYKZPGDB.cjs","sourcesContent":["import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport type { Config } from '@mastra/core/mastra';\nimport virtual from '@rollup/plugin-virtual';\nimport * as pkg from 'empathic/package';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport type { InputOptions, OutputOptions } from 'rollup';\nimport { glob } from 'tinyglobby';\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { getPackageRootPath } from '../build/package-info';\nimport type { BundlerOptions } from '../build/types';\nimport type { BundlerPlatform } from '../build/utils';\nimport { slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\n\nexport type { BundlerOptions } from '../build/types';\nexport type { BundlerPlatform } from '../build/utils';\n\nexport const IS_DEFAULT = Symbol('IS_DEFAULT');\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n protected platform: BundlerPlatform = 'node';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const defaultBundlerOptions: Config['bundler'] = {\n externals: [],\n sourcemap: false,\n transpilePackages: [],\n [IS_DEFAULT]: true,\n } as const;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n\n return bundlerOptions ?? defaultBundlerOptions;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n return defaultBundlerOptions;\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n {\n outputDir: join(outputDirectory, this.analyzeOutputDir),\n projectRoot: outputDirectory,\n platform: this.platform,\n },\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap, enableEsmShim, externals }: BundlerOptions,\n ) {\n const { workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile });\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const projectRoot = closestPkgJson ? dirname(closestPkgJson) : process.cwd();\n\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n this.platform,\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: enableSourcemap, workspaceRoot, projectRoot, enableEsmShim, externalsPreset: externals === true },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n getAllToolPaths(mastraDir: string, toolsPaths: (string | string[])[] = []): (string | string[])[] {\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedMastraDir = slash(mastraDir);\n\n // Prepare default tools paths with glob patterns\n const defaultToolsPath = posix.join(normalizedMastraDir, 'tools/**/*.{js,ts}');\n const defaultToolsIgnorePaths = [\n `!${posix.join(normalizedMastraDir, 'tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'tools/**/__tests__/**')}`,\n ];\n\n // Combine default path with ignore patterns\n const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];\n\n // If no tools paths provided, use only the default paths\n if (toolsPaths.length === 0) {\n return [defaultPaths];\n }\n\n // If tools paths are provided, add the default paths to ensure standard tools are always included\n return [...toolsPaths, defaultPaths];\n }\n\n async listToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await glob(toolPath, {\n absolute: true,\n expandDirectories: false,\n });\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedEntryFile = entryFile.replaceAll('\\\\', '/');\n inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n {\n projectRoot,\n outputDirectory,\n enableEsmShim = true,\n }: {\n projectRoot: string;\n outputDirectory: string;\n enableEsmShim?: boolean;\n },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n\n const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n const internalBundlerOptions: BundlerOptions = {\n enableSourcemap: !!bundlerOptions.sourcemap,\n externals: bundlerOptions.externals ?? [],\n enableEsmShim,\n };\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: this.platform,\n bundlerOptions: internalBundlerOptions,\n },\n this.logger,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof MastraError) {\n throw error;\n }\n\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n for (const [dep, depInfo] of analyzedBundleInfo.externalDependencies) {\n if (analyzedBundleInfo.workspaceMap.has(dep)) {\n continue;\n }\n\n let version = depInfo.version;\n let actualPackageName: string | undefined;\n\n // Read package.json to get actual package name (for alias detection) and version if not pre-resolved\n try {\n // First try to resolve from the project root (provides correct context for monorepos)\n let rootPath = await getPackageRootPath(dep, projectRoot);\n\n // If not found in user's project, try resolving from deployer's location\n // This handles packages like hono that are provided by @mastra/deployer\n if (!rootPath) {\n rootPath = await getPackageRootPath(dep, import.meta.dirname);\n }\n\n if (rootPath) {\n const pkg = await readJSON(`${rootPath}/package.json`);\n actualPackageName = pkg.name;\n // Use pre-resolved version if available, otherwise use from package.json\n if (!version) {\n version = pkg.version;\n }\n }\n } catch {\n // Resolution failed, will use 'latest' for version\n }\n\n // Default to 'latest' if still no version\n version = version || 'latest';\n\n // Check if this is an npm alias (import name differs from actual package name)\n // e.g., importing \"ai-v5\" which resolves to package \"ai\"\n // or importing \"@ai-sdk/openai-v5\" which resolves to \"@ai-sdk/openai\"\n // In this case, write npm alias syntax: \"ai-v5\": \"npm:ai@5.0.93\"\n const isAlias = actualPackageName && dep !== actualPackageName;\n\n if (isAlias) {\n dependenciesToInstall.set(dep, `npm:${actualPackageName}@${version}`);\n } else {\n dependenciesToInstall.set(dep, version);\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);\n\n this.logger.info('Bundling Mastra application');\n\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n internalBundlerOptions,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap: internalBundlerOptions.enableSourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory, rootDir: projectRoot });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory, projectRoot);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/bundler/index.ts"],"names":["MastraBundler","emptyDir","ensureDir","join","writeFile","createBundler","getBundlerOptions","analyzeBundle","DepsService","stat","copy","getWorkspaceInformation","pkg","dirname","getInputOptions","existsSync","virtual","slash","posix","glob","path","fsExtra","FileService","error","MastraError","ErrorDomain","ErrorCategory","getPackageRootPath","readJSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,UAAA,0BAAoB,YAAY;AAEtC,IAAe,OAAA,GAAf,cAA+BA,qBAAA,CAAc;AAAA,EACxC,gBAAA,GAAmB,QAAA;AAAA,EACnB,SAAA,GAAY,QAAA;AAAA,EACZ,QAAA,GAA4B,MAAA;AAAA,EAEtC,WAAA,CAAY,IAAA,EAAc,SAAA,GAAoC,SAAA,EAAW;AACv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GAAU,OAAOA,OAAK,CAAA;AACrE,MAAA,MAAM,IAAIC,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,sCAAA;AAAA,UACJ,IAAA,EAAM,uCAAuC,OAAO,CAAA,CAAA;AAAA,UACpD,QAAQC,iBAAA,CAAY,QAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc;AAAA,SAC1B;AAAA,QACAH;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CAAK,UAAA,EAAoB,gBAAA,EAA0B,UAAA,EAAkD;AACzG,IAAA,MAAM,iBAAA,GAAoB,MAAM,IAAA,CAAK,qBAAA,CAAsB,UAAU,CAAA;AACrE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-YA6TH3CS.cjs","sourcesContent":["import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport type { Config } from '@mastra/core/mastra';\nimport virtual from '@rollup/plugin-virtual';\nimport * as pkg from 'empathic/package';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport type { InputOptions, OutputOptions } from 'rollup';\nimport { glob } from 'tinyglobby';\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { getPackageRootPath } from '../build/package-info';\nimport type { BundlerOptions } from '../build/types';\nimport type { BundlerPlatform } from '../build/utils';\nimport { slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\n\nexport type { BundlerOptions } from '../build/types';\nexport type { BundlerPlatform } from '../build/utils';\n\nexport const IS_DEFAULT = Symbol('IS_DEFAULT');\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n protected platform: BundlerPlatform = 'node';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const defaultBundlerOptions: Config['bundler'] = {\n externals: [],\n sourcemap: false,\n transpilePackages: [],\n [IS_DEFAULT]: true,\n } as const;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n\n return bundlerOptions ?? defaultBundlerOptions;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n return defaultBundlerOptions;\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n {\n outputDir: join(outputDirectory, this.analyzeOutputDir),\n projectRoot: outputDirectory,\n platform: this.platform,\n },\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap, enableEsmShim, externals }: BundlerOptions,\n ) {\n const { workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile });\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const projectRoot = closestPkgJson ? dirname(closestPkgJson) : process.cwd();\n\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n this.platform,\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: enableSourcemap, workspaceRoot, projectRoot, enableEsmShim, externalsPreset: externals === true },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n getAllToolPaths(mastraDir: string, toolsPaths: (string | string[])[] = []): (string | string[])[] {\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedMastraDir = slash(mastraDir);\n\n // Prepare default tools paths with glob patterns\n const defaultToolsPath = posix.join(normalizedMastraDir, 'tools/**/*.{js,ts}');\n const defaultToolsIgnorePaths = [\n `!${posix.join(normalizedMastraDir, 'tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'tools/**/__tests__/**')}`,\n ];\n\n // Combine default path with ignore patterns\n const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];\n\n // If no tools paths provided, use only the default paths\n if (toolsPaths.length === 0) {\n return [defaultPaths];\n }\n\n // If tools paths are provided, add the default paths to ensure standard tools are always included\n return [...toolsPaths, defaultPaths];\n }\n\n async listToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await glob(toolPath, {\n absolute: true,\n expandDirectories: false,\n });\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedEntryFile = entryFile.replaceAll('\\\\', '/');\n inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n {\n projectRoot,\n outputDirectory,\n enableEsmShim = true,\n }: {\n projectRoot: string;\n outputDirectory: string;\n enableEsmShim?: boolean;\n },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n\n const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n const internalBundlerOptions: BundlerOptions = {\n enableSourcemap: !!bundlerOptions.sourcemap,\n externals: bundlerOptions.externals ?? [],\n enableEsmShim,\n };\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: this.platform,\n bundlerOptions: internalBundlerOptions,\n },\n this.logger,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof MastraError) {\n throw error;\n }\n\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n for (const [dep, depInfo] of analyzedBundleInfo.externalDependencies) {\n if (analyzedBundleInfo.workspaceMap.has(dep)) {\n continue;\n }\n\n let version = depInfo.version;\n let actualPackageName: string | undefined;\n\n // Read package.json to get actual package name (for alias detection) and version if not pre-resolved\n try {\n // First try to resolve from the project root (provides correct context for monorepos)\n let rootPath = await getPackageRootPath(dep, projectRoot);\n\n // If not found in user's project, try resolving from deployer's location\n // This handles packages like hono that are provided by @mastra/deployer\n if (!rootPath) {\n rootPath = await getPackageRootPath(dep, import.meta.dirname);\n }\n\n if (rootPath) {\n const pkg = await readJSON(`${rootPath}/package.json`);\n actualPackageName = pkg.name;\n // Use pre-resolved version if available, otherwise use from package.json\n if (!version) {\n version = pkg.version;\n }\n }\n } catch {\n // Resolution failed, will use 'latest' for version\n }\n\n // Default to 'latest' if still no version\n version = version || 'latest';\n\n // Check if this is an npm alias (import name differs from actual package name)\n // e.g., importing \"ai-v5\" which resolves to package \"ai\"\n // or importing \"@ai-sdk/openai-v5\" which resolves to \"@ai-sdk/openai\"\n // In this case, write npm alias syntax: \"ai-v5\": \"npm:ai@5.0.93\"\n const isAlias = actualPackageName && dep !== actualPackageName;\n\n if (isAlias) {\n dependenciesToInstall.set(dep, `npm:${actualPackageName}@${version}`);\n } else {\n dependenciesToInstall.set(dep, version);\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);\n\n this.logger.info('Bundling Mastra application');\n\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n internalBundlerOptions,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap: internalBundlerOptions.enableSourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory, rootDir: projectRoot });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory, projectRoot);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
@@ -1,36 +1,31 @@
1
1
  ---
2
- name: mastra-deployer-docs
3
- description: Documentation for @mastra/deployer. Includes links to type definitions and readable implementation code in dist/.
2
+ name: mastra-deployer
3
+ description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
+ metadata:
5
+ package: "@mastra/deployer"
6
+ version: "1.3.0-alpha.1"
4
7
  ---
5
8
 
6
- # @mastra/deployer Documentation
9
+ ## When to use
7
10
 
8
- > **Version**: 1.2.0
9
- > **Package**: @mastra/deployer
11
+ Use this skill whenever you are working with @mastra/deployer to obtain the domain-specific knowledge.
10
12
 
11
- ## Quick Navigation
13
+ ## How to use
12
14
 
13
- Use SOURCE_MAP.json to find any export:
15
+ Read the individual reference documents for detailed explanations and code examples.
14
16
 
15
- ```bash
16
- cat docs/SOURCE_MAP.json
17
- ```
17
+ ### Docs
18
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/`
19
+ - [Deploy to Cloud Providers](references/docs-deployment-cloud-providers.md) - Deploy your Mastra applications to cloud providers
20
+ - [Deploy a Mastra Server](references/docs-deployment-mastra-server.md) - Learn how to build and deploy a Mastra server.
21
+ - [Deploy in a Monorepo](references/docs-deployment-monorepo.md) - Learn how to deploy Mastra applications that are part of a monorepo setup
22
+ - [Deployment Overview](references/docs-deployment-overview.md) - Learn about different deployment options for your Mastra applications
23
+ - [Deploy with a Web Framework](references/docs-deployment-web-framework.md) - Learn how Mastra can be deployed when integrated with a Web Framework
24
+ - [Workflow Runners](references/docs-deployment-workflow-runners.md) - Deploy Mastra workflows to specialized workflow execution platforms
23
25
 
24
- ## Top Exports
26
+ ### Reference
25
27
 
26
- - Deps: dist/index.d.ts
27
- - FileService: dist/index.d.ts
28
- - createChildProcessLogger: dist/index.d.ts
29
- - createPinoStream: dist/index.d.ts
28
+ - [Reference: Deployer](references/reference-deployer.md) - Documentation for the Deployer abstract class, which handles packaging and deployment of Mastra applications.
30
29
 
31
- See SOURCE_MAP.json for the complete list.
32
30
 
33
- ## Available Topics
34
-
35
- - [Deployer](deployer/) - 1 file(s)
36
- - [Deployment](deployment/) - 6 file(s)
31
+ Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.3.0-alpha.1",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {
5
5
  "Deps": {
@@ -1,5 +1,3 @@
1
- > Deploy your Mastra applications to cloud providers
2
-
3
1
  # Deploy to Cloud Providers
4
2
 
5
3
  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.
@@ -13,5 +11,5 @@ The following guides show how to deploy Mastra to specific cloud providers:
13
11
  - [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
14
12
  - [Cloudflare](https://mastra.ai/guides/deployment/cloudflare-deployer)
15
13
  - [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
16
- - [Netlify](https://mastra.ai/guides/deployment/netlify-deployer)
17
- - [Vercel](https://mastra.ai/guides/deployment/vercel-deployer)
14
+ - [Netlify](https://mastra.ai/guides/deployment/netlify)
15
+ - [Vercel](https://mastra.ai/guides/deployment/vercel)
@@ -1,12 +1,8 @@
1
- > Learn how to build and deploy a Mastra server.
2
-
3
1
  # Deploy a Mastra Server
4
2
 
5
3
  Mastra compiles your application into a standalone Node.js server that can run on any platform supporting Node.js, Bun, or Deno.
6
4
 
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.
5
+ > **Tip:** 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
6
 
11
7
  ## Building your application
12
8
 
@@ -18,15 +14,13 @@ mastra build
18
14
 
19
15
  This creates a `.mastra` directory containing your production-ready server.
20
16
 
21
- > **Note:**
22
-
23
- Read the [`mastra build`](https://mastra.ai/reference/cli/mastra#mastra-build) reference for all available flags.
17
+ > **Info:** Read the [`mastra build`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
24
18
 
25
19
  ## Build output
26
20
 
27
21
  After building, Mastra creates the following structure:
28
22
 
29
- ```
23
+ ```text
30
24
  .mastra/
31
25
  ├── .build/ # Intermediate build artifacts (module maps, analysis)
32
26
  └── output/
@@ -58,13 +52,12 @@ node .mastra/output/index.mjs
58
52
  ```
59
53
 
60
54
  The `mastra start` command provides additional features:
55
+
61
56
  - Loads environment variables from `.env.production` and `.env`
62
57
  - Provides helpful error messages for missing modules
63
58
  - Handles process signals for graceful shutdown
64
59
 
65
- > **Note:**
66
-
67
- Read the [`mastra start`](https://mastra.ai/reference/cli/mastra#mastra-start) reference for all available flags.
60
+ > **Info:** Read the [`mastra start`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
68
61
 
69
62
  ## Build configuration
70
63
 
@@ -90,22 +83,22 @@ The build follows these steps:
90
83
 
91
84
  ## Environment variables
92
85
 
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) |
86
+ | Variable | Description |
87
+ | -------------------- | --------------------------------------------------------------------------- |
88
+ | `PORT` | Server port (default: `4111`) |
89
+ | `MASTRA_STUDIO_PATH` | Path to Studio build directory (default: `./playground`) |
90
+ | `MASTRA_SKIP_DOTENV` | Skip loading `.env` files when set |
91
+ | `NODE_OPTIONS` | Node.js options (e.g., `--max-old-space-size=4096` for build memory issues) |
99
92
 
100
93
  ## Server endpoints
101
94
 
102
95
  The built server exposes endpoints for health checks, agents, workflows, and more:
103
96
 
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) |
97
+ | Endpoint | Description |
98
+ | ------------------- | ---------------------------------------------------------------------- |
99
+ | `GET /health` | Health check endpoint, returns `200 OK` |
100
+ | `GET /openapi.json` | OpenAPI specification (if `server.build.openAPIDocs` is enabled) |
101
+ | `GET /swagger-ui` | Interactive API documentation (if `server.build.swaggerUI` is enabled) |
109
102
 
110
103
  This list is not exhaustive. To view all endpoints, run `mastra dev` and visit `http://localhost:4111/swagger-ui`.
111
104
 
@@ -1,5 +1,3 @@
1
- > Learn how to deploy Mastra applications that are part of a monorepo setup
2
-
3
1
  # Deploy in a Monorepo
4
2
 
5
3
  Deploying Mastra in a monorepo follows the same process as a standalone application. This guide covers monorepo-specific considerations. For the core build and deployment steps, see [Deploy a Mastra Server](https://mastra.ai/docs/deployment/mastra-server).
@@ -22,7 +20,7 @@ Known limitations:
22
20
 
23
21
  In this example, the Mastra application is located at `apps/api`:
24
22
 
25
- ```
23
+ ```text
26
24
  apps/
27
25
  ├── api/
28
26
  │ ├── src/
@@ -46,25 +44,25 @@ Use your monorepo tool to run the build command from the correct package. There'
46
44
 
47
45
  Examples:
48
46
 
49
- **npm:**
47
+ **npm**:
50
48
 
51
49
  ```bash
52
50
  npm run build --workspace=apps/api
53
51
  ```
54
52
 
55
- **pnpm:**
53
+ **pnpm**:
56
54
 
57
55
  ```bash
58
56
  pnpm --filter api run build
59
57
  ```
60
58
 
61
- **yarn:**
59
+ **yarn**:
62
60
 
63
61
  ```bash
64
62
  yarn workspace api build
65
63
  ```
66
64
 
67
- **turborepo:**
65
+ **Turborepo**:
68
66
 
69
67
  ```bash
70
68
  turbo run build --filter=api
@@ -72,7 +70,7 @@ turbo run build --filter=api
72
70
 
73
71
  Your package's `build` script should run `mastra build`:
74
72
 
75
- ```json title="apps/api/package.json"
73
+ ```json
76
74
  {
77
75
  "scripts": {
78
76
  "build": "mastra build"
@@ -87,9 +85,9 @@ When your Mastra application imports from other workspace packages, Mastra handl
87
85
  - If the package is pre-compiled (e.g., built with `tsc` or `tsdown`), Mastra imports the compiled JavaScript
88
86
  - If the package contains uncompiled TypeScript, Mastra transpiles it during the build
89
87
 
90
- For most setups, this works without configuration. If you encounter issues with workspace package imports, add the package to [`transpilePackages`](https://mastra.ai/reference/configuration#bundlertranspilepackages):
88
+ For most setups, this works without configuration. If you encounter issues with workspace package imports, add the package to [`transpilePackages`](https://mastra.ai/reference/configuration):
91
89
 
92
- ```typescript title="src/mastra/index.ts"
90
+ ```typescript
93
91
  export const mastra = new Mastra({
94
92
  bundler: {
95
93
  transpilePackages: ["@my-org/utils"],
@@ -111,7 +109,7 @@ Most providers let you specify the root directory in their dashboard or configur
111
109
 
112
110
  The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](https://mastra.ai/docs/mastra-cloud/overview). While the interface may differ between providers, the configuration remains the same.
113
111
 
114
- ![Deployment configuration](/img/monorepo/monorepo-mastra-cloud.jpg)
112
+ ![Deployment configuration](/assets/images/monorepo-mastra-cloud-6bd3d30cb0ef7c255c8d8bb43aeff4ec.jpg)
115
113
 
116
114
  ## Dependency management
117
115
 
@@ -125,6 +123,7 @@ Keep dependencies consistent to avoid version conflicts and build errors:
125
123
  ### Workspace package not found
126
124
 
127
125
  If Mastra can't resolve a workspace package, ensure:
126
+
128
127
  - The package is listed in your `package.json` dependencies
129
128
  - Your lockfile is up to date (`pnpm install`, `npm install`, etc.)
130
129
  - The package has a valid `main` or `exports` field in its `package.json`
@@ -132,8 +131,9 @@ If Mastra can't resolve a workspace package, ensure:
132
131
  ### TypeScript errors from workspace packages
133
132
 
134
133
  If you see type errors from uncompiled workspace packages, either:
134
+
135
135
  - Build the package first (recommended for faster Mastra builds)
136
- - Add the package to [`transpilePackages`](https://mastra.ai/reference/configuration#bundlertranspilepackages) in your Mastra config
136
+ - Add the package to [`transpilePackages`](https://mastra.ai/reference/configuration) in your Mastra config
137
137
 
138
138
  ## Related
139
139
 
@@ -1,5 +1,3 @@
1
- > Learn about different deployment options for your Mastra applications
2
-
3
1
  # Deployment Overview
4
2
 
5
3
  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.
@@ -38,8 +36,8 @@ Use this option for auto-scaling, minimal infrastructure management, or when you
38
36
  - [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
39
37
  - [Cloudflare](https://mastra.ai/guides/deployment/cloudflare-deployer)
40
38
  - [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)
39
+ - [Netlify](https://mastra.ai/guides/deployment/netlify)
40
+ - [Vercel](https://mastra.ai/guides/deployment/vercel)
43
41
 
44
42
  ### Web Framework
45
43
 
@@ -47,9 +45,9 @@ When Mastra is integrated with a web framework, it deploys alongside your applic
47
45
 
48
46
  Use these guides when adding Mastra to an existing Next.js or Astro application.
49
47
 
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)
48
+ - [With Next.js on Vercel](https://mastra.ai/docs/deployment/web-framework)
49
+ - [With Astro on Vercel](https://mastra.ai/docs/deployment/web-framework)
50
+ - [With Astro on Netlify](https://mastra.ai/docs/deployment/web-framework)
53
51
 
54
52
  ### Mastra Cloud
55
53
 
@@ -1,11 +1,8 @@
1
- > Learn how Mastra can be deployed when integrated with a Web Framework
2
-
3
1
  # Deploy with a Web Framework
4
2
 
5
3
  When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.
6
4
 
7
- > **Note:**
8
- If you're deploying to a cloud provider, remove any usage of [LibSQLStore](https://mastra.ai/reference/storage/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and is not compatible with serverless platforms.
5
+ > **Warning:** If you're deploying to a cloud provider, remove any usage of [LibSQLStore](https://mastra.ai/reference/storage/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and is not compatible with serverless platforms.
9
6
 
10
7
  Integration guides:
11
8
 
@@ -16,7 +13,7 @@ Integration guides:
16
13
 
17
14
  If you've integrated Mastra with Next.js [by following our guide](https://mastra.ai/guides/getting-started/next-js) and plan to deploy to Vercel, add `serverExternalPackages: ["@mastra/*"]` to your `next.config.ts`:
18
15
 
19
- ```typescript {4} title="next.config.ts"
16
+ ```typescript
20
17
  import type { NextConfig } from "next";
21
18
 
22
19
  const nextConfig: NextConfig = {
@@ -30,7 +27,7 @@ export default nextConfig;
30
27
 
31
28
  If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/guides/getting-started/astro) and plan to deploy to Vercel, add the Vercel adapter and server output to your `astro.config.mjs`:
32
29
 
33
- ```javascript {2,5-6} title="astro.config.mjs"
30
+ ```javascript
34
31
  import { defineConfig } from "astro/config";
35
32
  import vercel from "@astrojs/vercel";
36
33
 
@@ -44,7 +41,7 @@ export default defineConfig({
44
41
 
45
42
  If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/guides/getting-started/astro) and plan to deploy to Netlify, add the Netlify adapter and server output to your `astro.config.mjs`:
46
43
 
47
- ```javascript {2,5-6} title="astro.config.mjs"
44
+ ```javascript
48
45
  import { defineConfig } from "astro/config";
49
46
  import netlify from "@astrojs/netlify";
50
47
 
@@ -1,8 +1,6 @@
1
- > Deploy Mastra workflows to specialized workflow execution platforms
2
-
3
1
  # Workflow Runners
4
2
 
5
- Mastra [workflows](../workflows/overview.mdx) can be executed using the built-in workflow runner or deployed to specialized workflow execution platforms that handle orchestration, monitoring, and reliability.
3
+ Mastra [workflows](https://mastra.ai/docs/workflows/overview) can be executed using the built-in workflow runner or deployed to specialized workflow execution platforms that handle orchestration, monitoring, and reliability.
6
4
 
7
5
  ## Inngest
8
6
 
@@ -1,28 +1,19 @@
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.
1
+ # Deployer
11
2
 
12
3
  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
4
 
14
5
  ## Usage Example
15
6
 
7
+ If you want to create a custom deployer, you can extend the abstract `Deployer` class and implement the `deploy` method with your specific deployment logic. Here's an example:
8
+
16
9
  ```typescript
17
10
  import { Deployer } from "@mastra/deployer";
18
11
 
19
- // Create a custom deployer by extending the abstract Deployer class
20
12
  class CustomDeployer extends Deployer {
21
13
  constructor() {
22
14
  super({ name: "custom-deployer" });
23
15
  }
24
16
 
25
- // Implement the abstract deploy method
26
17
  async deploy(outputDirectory: string): Promise<void> {
27
18
  // Prepare the output directory
28
19
  await this.prepare(outputDirectory);
@@ -39,14 +30,30 @@ class CustomDeployer extends Deployer {
39
30
 
40
31
  ### Constructor Parameters
41
32
 
33
+ **args:** (`object`): Configuration options for the Deployer.
34
+
35
+ **args.name:** (`string`): A unique name for the deployer instance.
36
+
42
37
  ### deploy Parameters
43
38
 
39
+ **outputDirectory:** (`string`): The directory where the bundled and deployment-ready application will be output.
40
+
44
41
  ## Methods
45
42
 
43
+ **getEnvFiles:** (`() => Promise<string[]>`): Returns a list of environment files to be used during deployment. By default, it looks for '.env.production' and '.env' files.
44
+
45
+ **deploy:** (`(outputDirectory: string) => Promise<void>`): Abstract method that must be implemented by subclasses. Handles the deployment process to the specified output directory.
46
+
46
47
  ## Inherited Methods from Bundler
47
48
 
48
49
  The Deployer class inherits the following key methods from the Bundler class:
49
50
 
51
+ **prepare:** (`(outputDirectory: string) => Promise<void>`): Prepares the output directory by cleaning it and creating necessary subdirectories.
52
+
53
+ **writePackageJson:** (`(outputDirectory: string, dependencies: Map<string, string>) => Promise<void>`): Generates a package.json file in the output directory with the specified dependencies.
54
+
55
+ **\_bundle:** (`(serverFile: string, mastraEntryFile: string, outputDirectory: string, bundleLocation?: string) => Promise<void>`): Bundles the application using the specified server and Mastra entry files.
56
+
50
57
  ## Core Concepts
51
58
 
52
59
  ### Deployment Lifecycle
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkMYKZPGDB_cjs = require('./chunk-MYKZPGDB.cjs');
4
- var chunk4CCXXH5X_cjs = require('./chunk-4CCXXH5X.cjs');
3
+ var chunkYA6TH3CS_cjs = require('./chunk-YA6TH3CS.cjs');
4
+ var chunkK7J2W7DJ_cjs = require('./chunk-K7J2W7DJ.cjs');
5
5
  var chunkJVBCN3RH_cjs = require('./chunk-JVBCN3RH.cjs');
6
6
 
7
7
  // src/deploy/base.ts
8
- var Deployer = class extends chunkMYKZPGDB_cjs.Bundler {
8
+ var Deployer = class extends chunkYA6TH3CS_cjs.Bundler {
9
9
  deps = new chunkJVBCN3RH_cjs.DepsService();
10
10
  constructor(args) {
11
11
  super(args.name, "DEPLOYER");
@@ -25,7 +25,7 @@ var Deployer = class extends chunkMYKZPGDB_cjs.Bundler {
25
25
 
26
26
  // src/build/deployer.ts
27
27
  async function getDeployer(entryFile, outputDir, logger) {
28
- const result = await chunk4CCXXH5X_cjs.extractMastraOption("deployer", entryFile, outputDir, logger);
28
+ const result = await chunkK7J2W7DJ_cjs.extractMastraOption("deployer", entryFile, outputDir, logger);
29
29
  if (!result) {
30
30
  return null;
31
31
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Bundler } from './chunk-O45P6AJF.js';
2
- import { extractMastraOption } from './chunk-5QWVKP4X.js';
1
+ import { Bundler } from './chunk-KNINPAM6.js';
2
+ import { extractMastraOption } from './chunk-3WL6HPU3.js';
3
3
  import { DepsService, FileService } from './chunk-DPDWM7HQ.js';
4
4
  export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-DPDWM7HQ.js';
5
5