@mastra/deployer 0.24.0 → 1.0.0-beta.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.
- package/CHANGELOG.md +240 -95
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +10 -15
- package/dist/build/index.d.ts +0 -1
- package/dist/build/index.d.ts.map +1 -1
- package/dist/build/index.js +3 -4
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.ts +2 -2
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-OART5HV7.cjs → chunk-AQAOWLJJ.cjs} +29 -124
- package/dist/chunk-AQAOWLJJ.cjs.map +1 -0
- package/dist/{chunk-IAEJ3C3J.cjs → chunk-C74EXQSL.cjs} +12 -12
- package/dist/chunk-C74EXQSL.cjs.map +1 -0
- package/dist/{chunk-CVRN2K4O.js → chunk-H3LLQ2MW.js} +12 -12
- package/dist/chunk-H3LLQ2MW.js.map +1 -0
- package/dist/{chunk-FD5X42ZU.js → chunk-HQJR52M7.js} +4 -4
- package/dist/{chunk-FD5X42ZU.js.map → chunk-HQJR52M7.js.map} +1 -1
- package/dist/{chunk-NSINCI76.cjs → chunk-IL2VLNIJ.cjs} +9 -9
- package/dist/{chunk-NSINCI76.cjs.map → chunk-IL2VLNIJ.cjs.map} +1 -1
- package/dist/{chunk-XHLN6E4D.js → chunk-OFUWEVGF.js} +3 -3
- package/dist/{chunk-XHLN6E4D.js.map → chunk-OFUWEVGF.js.map} +1 -1
- package/dist/{chunk-Z546LAA6.cjs → chunk-TDWIGFVF.cjs} +14 -14
- package/dist/{chunk-Z546LAA6.cjs.map → chunk-TDWIGFVF.cjs.map} +1 -1
- package/dist/{chunk-VDRZB7JQ.js → chunk-WBAWUM7Z.js} +23 -116
- package/dist/chunk-WBAWUM7Z.js.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.js +2 -2
- package/dist/server/handlers/health.d.ts +5 -0
- package/dist/server/handlers/health.d.ts.map +1 -0
- package/dist/server/handlers/prompt.d.ts.map +1 -1
- package/dist/server/handlers/routes/agent-builder/handlers.d.ts +5 -2
- package/dist/server/handlers/routes/agent-builder/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/agent-builder/router.d.ts.map +1 -1
- package/dist/server/handlers/routes/agents/handlers.d.ts +21 -143
- package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
- package/dist/server/handlers/routes/logs/handlers.d.ts +3 -3
- package/dist/server/handlers/routes/logs/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/mcp/handlers.d.ts +1 -1
- package/dist/server/handlers/routes/mcp/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/memory/handlers.d.ts +2 -4
- package/dist/server/handlers/routes/memory/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/memory/router.d.ts.map +1 -1
- package/dist/server/handlers/routes/observability/handlers.d.ts +3 -3
- package/dist/server/handlers/routes/observability/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/observability/router.d.ts.map +1 -1
- package/dist/server/handlers/routes/scores/handlers.d.ts +8 -6
- package/dist/server/handlers/routes/scores/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/tools/handlers.d.ts +1 -1
- package/dist/server/handlers/routes/tools/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/handlers.d.ts +2 -4
- package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
- package/dist/server/handlers/utils/query-parsers.d.ts +15 -0
- package/dist/server/handlers/utils/query-parsers.d.ts.map +1 -1
- package/dist/server/index.cjs +1207 -1559
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1214 -1566
- package/dist/server/index.js.map +1 -1
- package/dist/server/welcome.d.ts +1 -1
- package/dist/server/welcome.d.ts.map +1 -1
- package/package.json +12 -16
- package/dist/build/babel/remove-all-options-telemetry.d.ts +0 -5
- package/dist/build/babel/remove-all-options-telemetry.d.ts.map +0 -1
- package/dist/build/customInstrumentation.d.ts +0 -10
- package/dist/build/customInstrumentation.d.ts.map +0 -1
- package/dist/build/telemetry.d.ts +0 -8
- package/dist/build/telemetry.d.ts.map +0 -1
- package/dist/chunk-AJX72IGP.cjs +0 -28
- package/dist/chunk-AJX72IGP.cjs.map +0 -1
- package/dist/chunk-B2Q76NIL.js +0 -26
- package/dist/chunk-B2Q76NIL.js.map +0 -1
- package/dist/chunk-CVRN2K4O.js.map +0 -1
- package/dist/chunk-IAEJ3C3J.cjs.map +0 -1
- package/dist/chunk-OART5HV7.cjs.map +0 -1
- package/dist/chunk-VDRZB7JQ.js.map +0 -1
- package/dist/server/handlers/routes/telemetry/handlers.d.ts +0 -4
- package/dist/server/handlers/routes/telemetry/handlers.d.ts.map +0 -1
- package/dist/server/handlers/routes/telemetry/router.d.ts +0 -3
- package/dist/server/handlers/routes/telemetry/router.d.ts.map +0 -1
- package/dist/server/handlers/routes/workflows/legacyWorkflows.d.ts +0 -11
- package/dist/server/handlers/routes/workflows/legacyWorkflows.d.ts.map +0 -1
- package/dist/templates/instrumentation-template.js +0 -172
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getInputOptions } from './chunk-
|
|
2
|
-
import { slash, getWorkspaceInformation, analyzeBundle, getPackageName, tsConfigPaths, aliasHono, extractMastraOption, removeAllOptionsFromMastraExcept } from './chunk-
|
|
1
|
+
import { getInputOptions } from './chunk-OFUWEVGF.js';
|
|
2
|
+
import { slash, getWorkspaceInformation, analyzeBundle, getPackageName, tsConfigPaths, aliasHono, extractMastraOption, removeAllOptionsFromMastraExcept } from './chunk-H3LLQ2MW.js';
|
|
3
3
|
import { watch } from 'rollup';
|
|
4
4
|
import { dirname, posix, extname } from 'path';
|
|
5
5
|
import * as pkg from 'empathic/package';
|
|
@@ -164,5 +164,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export { createWatcher, getInputOptions2 as getInputOptions, getServerOptions };
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
168
|
-
//# sourceMappingURL=chunk-
|
|
167
|
+
//# sourceMappingURL=chunk-HQJR52M7.js.map
|
|
168
|
+
//# sourceMappingURL=chunk-HQJR52M7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["resolved","getInputOptions","dirname"],"mappings":";;;;;;;;;;AAYA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACE,cAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5B,cAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,SAAS,WAAA,CAAY,IAAY,QAAA,EAAkB;AACjD,EAAA,IAAI;AACF,IAAA,OAAO,WAAA,CAAY,UAAU,EAAE,CAAA;AAAA,EACjC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,4BAAA,GAAuC;AACrD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,iCAAA;AAAA,IACN,SAAA,CAAU,IAAI,QAAA,EAAU;AAEtB,MAAA,IAAI,EAAA,CAAG,WAAW,GAAG,CAAA,IAAK,GAAG,UAAA,CAAW,GAAG,CAAA,IAAK,CAAC,QAAA,EAAU;AACzD,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA,IAAI,eAAA,CAAgB,EAAE,CAAA,EAAG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A,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,SAAA,EAAW,CAAA;AAErC,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,4BAAA,EAA8B,CAAA;AAAA,EAC1D;AAEA,EAAA,OAAO,YAAA;AACT;AAEA,eAAsB,aAAA,CAAc,cAA4B,aAAA,EAA8B;AAC5F,EAAA,MAAM,OAAA,GAAU,MAAM,KAAA,CAAM;AAAA,IAC1B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACjGO,SAAS,4BAAA,CAA6B,QAAsC,MAAA,EAAwB;AACzG,EAAA,OAAO,gCAAA,CAAiC,MAAA,EAAQ,QAAA,EAAU,MAAM,CAAA;AAClE;;;ACSA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAM,mBAAA;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,4BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-FD5X42ZU.js","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["resolved","getInputOptions","dirname"],"mappings":";;;;;;;;;;AAYA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACE,cAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5B,cAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,S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AAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-HQJR52M7.js","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkC74EXQSL_cjs = require('./chunk-C74EXQSL.cjs');
|
|
4
4
|
var alias = require('@rollup/plugin-alias');
|
|
5
5
|
var commonjs = require('@rollup/plugin-commonjs');
|
|
6
6
|
var json = require('@rollup/plugin-json');
|
|
@@ -45,7 +45,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const externals = Array.from(externalsCopy);
|
|
48
|
-
const normalizedEntryFile =
|
|
48
|
+
const normalizedEntryFile = chunkC74EXQSL_cjs.slash(entryFile);
|
|
49
49
|
return {
|
|
50
50
|
logLevel: process.env.MASTRA_BUNDLER_DEBUG === "true" ? "debug" : "silent",
|
|
51
51
|
treeshake: "smallest",
|
|
@@ -76,7 +76,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
76
76
|
entries: [
|
|
77
77
|
{
|
|
78
78
|
find: /^\#server$/,
|
|
79
|
-
replacement:
|
|
79
|
+
replacement: chunkC74EXQSL_cjs.slash(url.fileURLToPath(undefined("@mastra/deployer/server")))
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
find: /^\@mastra\/server\/(.*)/,
|
|
@@ -92,7 +92,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
92
92
|
{ find: /^\#mastra$/, replacement: normalizedEntryFile }
|
|
93
93
|
]
|
|
94
94
|
}),
|
|
95
|
-
|
|
95
|
+
chunkC74EXQSL_cjs.tsConfigPaths(),
|
|
96
96
|
{
|
|
97
97
|
name: "tools-rewriter",
|
|
98
98
|
resolveId(id) {
|
|
@@ -104,7 +104,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
|
|
107
|
+
chunkC74EXQSL_cjs.esbuild({
|
|
108
108
|
platform,
|
|
109
109
|
define: env
|
|
110
110
|
}),
|
|
@@ -135,9 +135,9 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
135
135
|
// },
|
|
136
136
|
// },
|
|
137
137
|
json__default.default(),
|
|
138
|
-
|
|
138
|
+
chunkC74EXQSL_cjs.removeDeployer(entryFile, { sourcemap }),
|
|
139
139
|
// treeshake unused imports
|
|
140
|
-
|
|
140
|
+
chunkC74EXQSL_cjs.esbuild({
|
|
141
141
|
include: entryFile,
|
|
142
142
|
platform
|
|
143
143
|
})
|
|
@@ -163,5 +163,5 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
163
163
|
|
|
164
164
|
exports.createBundler = createBundler;
|
|
165
165
|
exports.getInputOptions = getInputOptions;
|
|
166
|
-
//# sourceMappingURL=chunk-
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-IL2VLNIJ.cjs.map
|
|
167
|
+
//# sourceMappingURL=chunk-IL2VLNIJ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/bundler.ts"],"names":["nodeResolve","slash","join","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,eAAA,CACpB,SAAA,EACA,kBAAA,EACA,QAAA,EACA,GAAA,GAA8B,EAAE,sBAAA,EAAwB,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA,EAAE,EACrF;AAAA,EACE,SAAA,GAAY,KAAA;AAAA,EACZ,KAAA,GAAQ,KAAA;AAAA,EACR,WAAA;AAAA,EACA,aAAA,GAAgB,MAAA;AAAA,EAChB,aAAA,GAAgB;AAClB,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ChB,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-
|
|
1
|
+
{"version":3,"sources":["../src/build/bundler.ts"],"names":["nodeResolve","slash","join","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,eAAA,CACpB,SAAA,EACA,kBAAA,EACA,QAAA,EACA,GAAA,GAA8B,EAAE,sBAAA,EAAwB,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA,EAAE,EACrF;AAAA,EACE,SAAA,GAAY,KAAA;AAAA,EACZ,KAAA,GAAQ,KAAA;AAAA,EACR,WAAA;AAAA,EACA,aAAA,GAAgB,MAAA;AAAA,EAChB,aAAA,GAAgB;AAClB,CAAA,EAOuB;AACvB,EAAA,IAAI,iBAAA,GACF,QAAA,KAAa,MAAA,GACTA,4BAAA,CAAY;AAAA,IACV,cAAA,EAAgB,IAAA;AAAA,IAChB,gBAAA,EAAkB,CAAC,MAAM;AAAA,GAC1B,IACDA,4BAAA,CAAY;AAAA,IACV,cAAA,EAAgB,KAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACV,CAAA;AAEP,EAAA,MAAM,aAAA,uBAAoB,GAAA,EAAY;AAEtC,EAAA,KAAA,MAAW,QAAA,IAAY,mBAAmB,oBAAA,EAAsB;AAC9D,IAAA,IAAI,QAAA,CAAS,UAAA,CAAW,GAAG,CAAA,EAAG;AAC5B,MAAA,MAAM,CAAC,KAAA,EAAO,IAAI,IAAI,QAAA,CAAS,KAAA,CAAM,KAAK,CAAC,CAAA;AAC3C,MAAA,aAAA,CAAc,GAAA,CAAI,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,CAAA;AACpC,MAAA,aAAA,CAAc,G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AA;AAAA,MAC5B,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAeAC,qBAAA,EAAK;AAAA,MACLC,gCAAA,CAAe,SAAA,EAAW,EAAE,SAAA,EAAW,CAAA;AAAA;AAAA,MAEvCL,yBAAA,CAAQ;AAAA,QACN,OAAA,EAAS,SAAA;AAAA,QACT;AAAA,OACD;AAAA,KACH,CAAE,OAAO,OAAO;AAAA,GAClB;AACF;AAEA,eAAsB,aAAA,CACpB,cACA,aAAA,EACA;AACA,EAAA,MAAM,OAAA,GAAU,MAAMM,aAAA,CAAO,YAAY,CAAA;AAEzC,EAAA,OAAO;AAAA,IACL,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,CAAM;AAAA,QACnB,GAAG,aAAA;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-IL2VLNIJ.cjs","sourcesContent":["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 '@rollup/plugin-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 { removeDeployer } from './plugins/remove-deployer';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: 'node' | 'browser',\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 }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n },\n): Promise<InputOptions> {\n let nodeResolvePlugin =\n platform === 'node'\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>();\n // make all nested imports external from the same package\n for (const external of analyzedBundleInfo.externalDependencies) {\n if (external.startsWith('@')) {\n const [scope, name] = external.split('/', 3);\n externalsCopy.add(`${scope}/${name}`);\n externalsCopy.add(`${scope}/${name}/*`);\n } else {\n externalsCopy.add(external);\n externalsCopy.add(`${external}/*`);\n }\n }\n\n const externals = 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 {\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 commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n 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,4 +1,4 @@
|
|
|
1
|
-
import { slash, tsConfigPaths, esbuild, removeDeployer } from './chunk-
|
|
1
|
+
import { slash, tsConfigPaths, esbuild, removeDeployer } from './chunk-H3LLQ2MW.js';
|
|
2
2
|
import alias from '@rollup/plugin-alias';
|
|
3
3
|
import commonjs from '@rollup/plugin-commonjs';
|
|
4
4
|
import json from '@rollup/plugin-json';
|
|
@@ -152,5 +152,5 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
export { createBundler, getInputOptions };
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-OFUWEVGF.js.map
|
|
156
|
+
//# sourceMappingURL=chunk-OFUWEVGF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/bundler.ts"],"names":[],"mappings":";;;;;;;;;;;AAeA,eAAsB,eAAA,CACpB,SAAA,EACA,kBAAA,EACA,QAAA,EACA,GAAA,GAA8B,EAAE,sBAAA,EAAwB,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA,EAAE,EACrF;AAAA,EACE,SAAA,GAAY,KAAA;AAAA,EACZ,KAAA,GAAQ,KAAA;AAAA,EACR,WAAA;AAAA,EACA,aAAA,GAAgB,MAAA;AAAA,EAChB,aAAA,GAAgB;AAClB,CAAA,EAOuB;AACvB,EAAA,IAAI,iBAAA,GACF,QAAA,KAAa,MAAA,GACT,WAAA,CAAY;AAAA,IACV,cAAA,EAAgB,IAAA;AAAA,IAChB,gBAAA,EAAkB,CAAC,MAAM;AAAA,GAC1B,IACD,WAAA,CAAY;AAAA,IACV,cAAA,EAAgB,KAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACV,CAAA;AAEP,EAAA,MAAM,aAAA,uBAAoB,GAAA,EAAY;AAEtC,EAAA,KAAA,MAAW,QAAA,IAAY,mBAAmB,oBAAA,EAAsB;AAC9D,IAAA,IAAI,QAAA,CAAS,UAAA,CAAW,GAAG,CAAA,EAAG;AAC5B,MAAA,MAAM,CAAC,KAAA,EAAO,IAAI,IAAI,QAAA,CAAS,KAAA,CAAM,KAAK,CAAC,CAAA;AAC3C,MAAA,aAAA,CAAc,GAAA,CAAI,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,CAAA;AACpC,MAAA,aAAA,CAAc,GAAA,CAAI,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAA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ollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport esmShim from '@rollup/plugin-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 { removeDeployer } from './plugins/remove-deployer';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: 'node' | 'browser',\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 }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n },\n): Promise<InputOptions> {\n let nodeResolvePlugin =\n platform === 'node'\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>();\n // make all nested imports external from the same package\n for (const external of analyzedBundleInfo.externalDependencies) {\n if (external.startsWith('@')) {\n const [scope, name] = external.split('/', 3);\n externalsCopy.add(`${scope}/${name}`);\n externalsCopy.add(`${scope}/${name}/*`);\n } else {\n externalsCopy.add(external);\n externalsCopy.add(`${external}/*`);\n }\n }\n\n const externals = 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 {\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 commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n 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,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIL2VLNIJ_cjs = require('./chunk-IL2VLNIJ.cjs');
|
|
4
|
+
var chunkC74EXQSL_cjs = require('./chunk-C74EXQSL.cjs');
|
|
5
5
|
var rollup = require('rollup');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var pkg = require('empathic/package');
|
|
@@ -80,7 +80,7 @@ function nodeModulesExtensionResolver() {
|
|
|
80
80
|
for (const ext of [".mjs", ".js", ".cjs"]) {
|
|
81
81
|
const resolved2 = safeResolve(id + ext, importer);
|
|
82
82
|
if (resolved2) {
|
|
83
|
-
const pkgName =
|
|
83
|
+
const pkgName = chunkC74EXQSL_cjs.getPackageName(id);
|
|
84
84
|
if (!pkgName) {
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
@@ -102,9 +102,9 @@ function nodeModulesExtensionResolver() {
|
|
|
102
102
|
}
|
|
103
103
|
async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
|
|
104
104
|
const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(entryFile) });
|
|
105
|
-
const projectRoot = closestPkgJson ? path.dirname(
|
|
106
|
-
const { workspaceMap, workspaceRoot } = await
|
|
107
|
-
const analyzeEntryResult = await
|
|
105
|
+
const projectRoot = closestPkgJson ? path.dirname(chunkC74EXQSL_cjs.slash(closestPkgJson)) : chunkC74EXQSL_cjs.slash(process.cwd());
|
|
106
|
+
const { workspaceMap, workspaceRoot } = await chunkC74EXQSL_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
|
|
107
|
+
const analyzeEntryResult = await chunkC74EXQSL_cjs.analyzeBundle(
|
|
108
108
|
[entryFile],
|
|
109
109
|
entryFile,
|
|
110
110
|
{
|
|
@@ -117,12 +117,12 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
117
117
|
);
|
|
118
118
|
const deps = /* @__PURE__ */ new Map();
|
|
119
119
|
for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {
|
|
120
|
-
const pkgName =
|
|
120
|
+
const pkgName = chunkC74EXQSL_cjs.getPackageName(dep);
|
|
121
121
|
if (pkgName && workspaceMap.has(pkgName)) {
|
|
122
122
|
deps.set(dep, metadata);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const inputOptions = await
|
|
125
|
+
const inputOptions = await chunkIL2VLNIJ_cjs.getInputOptions(
|
|
126
126
|
entryFile,
|
|
127
127
|
{
|
|
128
128
|
dependencies: deps,
|
|
@@ -141,7 +141,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
141
141
|
}
|
|
142
142
|
if (plugin?.name === "tsconfig-paths") {
|
|
143
143
|
plugins.push(
|
|
144
|
-
|
|
144
|
+
chunkC74EXQSL_cjs.tsConfigPaths({
|
|
145
145
|
localResolve: true
|
|
146
146
|
})
|
|
147
147
|
);
|
|
@@ -150,7 +150,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
150
150
|
plugins.push(plugin);
|
|
151
151
|
});
|
|
152
152
|
inputOptions.plugins = plugins;
|
|
153
|
-
inputOptions.plugins.push(
|
|
153
|
+
inputOptions.plugins.push(chunkC74EXQSL_cjs.aliasHono());
|
|
154
154
|
inputOptions.plugins.push(nodeModulesExtensionResolver());
|
|
155
155
|
}
|
|
156
156
|
return inputOptions;
|
|
@@ -170,12 +170,12 @@ async function createWatcher(inputOptions, outputOptions) {
|
|
|
170
170
|
|
|
171
171
|
// src/build/babel/remove-all-options-server.ts
|
|
172
172
|
function removeAllOptionsExceptServer(result, logger) {
|
|
173
|
-
return
|
|
173
|
+
return chunkC74EXQSL_cjs.removeAllOptionsFromMastraExcept(result, "server", logger);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// src/build/serverOptions.ts
|
|
177
177
|
async function getServerOptions(entryFile, outputDir, logger) {
|
|
178
|
-
const result = await
|
|
178
|
+
const result = await chunkC74EXQSL_cjs.extractMastraOption(
|
|
179
179
|
"server",
|
|
180
180
|
entryFile,
|
|
181
181
|
removeAllOptionsExceptServer,
|
|
@@ -191,5 +191,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
|
|
|
191
191
|
exports.createWatcher = createWatcher;
|
|
192
192
|
exports.getInputOptions = getInputOptions2;
|
|
193
193
|
exports.getServerOptions = getServerOptions;
|
|
194
|
-
//# sourceMappingURL=chunk-
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-TDWIGFVF.cjs.map
|
|
195
|
+
//# sourceMappingURL=chunk-TDWIGFVF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","pathToFileURL","resolved","getPackageName","dirname","getInputOptions","pkg","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACEA,uBAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5BA,uBAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,SAAS,WAAA,CAAY,IAAY,QAAA,EAAkB;AACjD,EAAA,IAAI;AACF,IAAA,OAAOC,4BAAA,CAAY,UAAU,EAAE,CAAA;AAAA,EACjC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,I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AAC1B","file":"chunk-Z546LAA6.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","pathToFileURL","resolved","getPackageName","dirname","getInputOptions","pkg","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACEA,uBAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5BA,uBAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,SAAS,WAAA,CAAY,IAAY,QAAA,EAAkB;AACjD,EAAA,IAAI;AACF,IAAA,OAAOC,4BAAA,CAAY,UAAU,EAAE,CAAA;AAAA,EACjC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,4BAAA,GAAuC;AACrD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,iCAAA;AAAA,IACN,SAAA,CAAU,IAAI,QAAA,EAAU;AAEtB,MAAA,IAAI,EAAA,CAAG,WAAW,GAAG,CAAA,IAAK,GAAG,UAAA,CAAW,GAAG,CAAA,IAAK,CAAC,QAAA,EAAU;AACzD,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA,IAAI,eAAA,CAAgB,EAAE,CAAA,EAAG;AACvB,QAAA,OAAO,IAAA;AAAA,MACT;AAGA,MAAA,IAAI,EAAA,CAAG,WAAW,GAAG,CAAA,IAAK,GAAG,KAAA,CAAM,GAAG,CAAA,CAAE,MAAA,KAAW,CAAA,EAAG;AACpD,QAAA,OAAO,IAAA;AAAA,MACT;AAGA,MAAA,IAAI,CAAC,EAAA,CAAG,UAAA,CAAW,GAAG,CAAA,IAA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,MAAMC,YAAA,CAAM;AAAA,IAC1B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACjGO,SAAS,4BAAA,CAA6B,QAAsC,MAAA,EAAwB;AACzG,EAAA,OAAOC,kDAAA,CAAiC,MAAA,EAAQ,QAAA,EAAU,MAAM,CAAA;AAClE;;;ACSA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAMC,qCAAA;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,4BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-TDWIGFVF.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
@@ -1,55 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { analyzeBundle, getWorkspaceInformation, getBundlerOptions, getPackageRootPath, esbuild } from './chunk-CVRN2K4O.js';
|
|
1
|
+
import { createBundler, getInputOptions } from './chunk-OFUWEVGF.js';
|
|
2
|
+
import { analyzeBundle, getWorkspaceInformation, slash, getBundlerOptions, getPackageRootPath } from './chunk-H3LLQ2MW.js';
|
|
4
3
|
import { DepsService, FileService } from './chunk-5QFG6SCM.js';
|
|
5
4
|
import { existsSync } from 'fs';
|
|
6
5
|
import { writeFile, stat } from 'fs/promises';
|
|
7
|
-
import { join, dirname } from 'path';
|
|
8
|
-
import { fileURLToPath } from 'url';
|
|
6
|
+
import { join, dirname, posix } from 'path';
|
|
9
7
|
import { MastraBundler } from '@mastra/core/bundler';
|
|
10
8
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
11
9
|
import virtual from '@rollup/plugin-virtual';
|
|
12
10
|
import * as pkg from 'empathic/package';
|
|
13
11
|
import fsExtra, { emptyDir, ensureDir, copy, readJSON } from 'fs-extra/esm';
|
|
14
12
|
import { glob } from 'tinyglobby';
|
|
15
|
-
import { rollup } from 'rollup';
|
|
16
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
17
13
|
|
|
18
|
-
function getCustomInstrumentationBundler(entryFile, result) {
|
|
19
|
-
return rollup({
|
|
20
|
-
logLevel: "silent",
|
|
21
|
-
input: {
|
|
22
|
-
instrumentation: entryFile
|
|
23
|
-
},
|
|
24
|
-
treeshake: false,
|
|
25
|
-
plugins: [
|
|
26
|
-
// transpile typescript to something we understand
|
|
27
|
-
esbuild(),
|
|
28
|
-
commonjs({
|
|
29
|
-
extensions: [".js", ".ts"],
|
|
30
|
-
strictRequires: "strict",
|
|
31
|
-
transformMixedEsModules: true,
|
|
32
|
-
ignoreTryCatch: false
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
async function writeCustomInstrumentation(entryFile, outputDir, options = {}) {
|
|
38
|
-
const result = {
|
|
39
|
-
hasCustomConfig: false
|
|
40
|
-
};
|
|
41
|
-
const bundle = await getCustomInstrumentationBundler(entryFile);
|
|
42
|
-
const { output } = await bundle.write({
|
|
43
|
-
dir: outputDir,
|
|
44
|
-
format: "es",
|
|
45
|
-
entryFileNames: "[name].mjs",
|
|
46
|
-
sourcemap: options.sourcemap
|
|
47
|
-
});
|
|
48
|
-
const externals = output[0].imports.filter((x) => !x.startsWith("./"));
|
|
49
|
-
return { ...result, externalDependencies: externals };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// src/bundler/index.ts
|
|
53
14
|
var Bundler = class extends MastraBundler {
|
|
54
15
|
analyzeOutputDir = ".build";
|
|
55
16
|
outputDir = "output";
|
|
@@ -61,15 +22,6 @@ var Bundler = class extends MastraBundler {
|
|
|
61
22
|
await ensureDir(join(outputDirectory, this.analyzeOutputDir));
|
|
62
23
|
await ensureDir(join(outputDirectory, this.outputDir));
|
|
63
24
|
}
|
|
64
|
-
async writeInstrumentationFile(outputDirectory, customInstrumentationFile) {
|
|
65
|
-
const instrumentationFile = join(outputDirectory, "instrumentation.mjs");
|
|
66
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
67
|
-
if (customInstrumentationFile) {
|
|
68
|
-
await copy(customInstrumentationFile, instrumentationFile);
|
|
69
|
-
} else {
|
|
70
|
-
await copy(join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
25
|
async writePackageJson(outputDirectory, dependencies, resolutions) {
|
|
74
26
|
this.logger.debug(`Writing project's package.json`);
|
|
75
27
|
await ensureDir(outputDirectory);
|
|
@@ -84,16 +36,6 @@ var Bundler = class extends MastraBundler {
|
|
|
84
36
|
dependenciesMap.set(pkgName, value);
|
|
85
37
|
}
|
|
86
38
|
}
|
|
87
|
-
dependenciesMap.set("@opentelemetry/core", "^2.0.1");
|
|
88
|
-
dependenciesMap.set("@opentelemetry/api", "^1.9.0");
|
|
89
|
-
dependenciesMap.set("@opentelemetry/auto-instrumentations-node", "^0.59.0");
|
|
90
|
-
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-grpc", "^0.201.0");
|
|
91
|
-
dependenciesMap.set("@opentelemetry/exporter-trace-otlp-http", "^0.201.0");
|
|
92
|
-
dependenciesMap.set("@opentelemetry/resources", "^2.0.1");
|
|
93
|
-
dependenciesMap.set("@opentelemetry/sdk-node", "^0.201.0");
|
|
94
|
-
dependenciesMap.set("@opentelemetry/sdk-trace-base", "^2.0.1");
|
|
95
|
-
dependenciesMap.set("@opentelemetry/semantic-conventions", "^1.33.0");
|
|
96
|
-
dependenciesMap.set("@opentelemetry/instrumentation", "^0.202.0");
|
|
97
39
|
await writeFile(
|
|
98
40
|
pkgPath,
|
|
99
41
|
JSON.stringify(
|
|
@@ -104,7 +46,7 @@ var Bundler = class extends MastraBundler {
|
|
|
104
46
|
type: "module",
|
|
105
47
|
main: "index.mjs",
|
|
106
48
|
scripts: {
|
|
107
|
-
start: "node
|
|
49
|
+
start: "node ./index.mjs"
|
|
108
50
|
},
|
|
109
51
|
author: "Mastra",
|
|
110
52
|
license: "ISC",
|
|
@@ -178,7 +120,7 @@ var Bundler = class extends MastraBundler {
|
|
|
178
120
|
{ sourcemap: enableSourcemap, workspaceRoot, projectRoot, enableEsmShim }
|
|
179
121
|
);
|
|
180
122
|
const isVirtual = serverFile.includes("\n") || existsSync(serverFile);
|
|
181
|
-
const toolsInputOptions = await this.
|
|
123
|
+
const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
|
|
182
124
|
if (isVirtual) {
|
|
183
125
|
inputOptions.input = { index: "#entry", ...toolsInputOptions };
|
|
184
126
|
if (Array.isArray(inputOptions.plugins)) {
|
|
@@ -191,7 +133,20 @@ var Bundler = class extends MastraBundler {
|
|
|
191
133
|
}
|
|
192
134
|
return inputOptions;
|
|
193
135
|
}
|
|
194
|
-
|
|
136
|
+
getAllToolPaths(mastraDir, toolsPaths = []) {
|
|
137
|
+
const normalizedMastraDir = slash(mastraDir);
|
|
138
|
+
const defaultToolsPath = posix.join(normalizedMastraDir, "tools/**/*.{js,ts}");
|
|
139
|
+
const defaultToolsIgnorePaths = [
|
|
140
|
+
`!${posix.join(normalizedMastraDir, "tools/**/*.{test,spec}.{js,ts}")}`,
|
|
141
|
+
`!${posix.join(normalizedMastraDir, "tools/**/__tests__/**")}`
|
|
142
|
+
];
|
|
143
|
+
const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];
|
|
144
|
+
if (toolsPaths.length === 0) {
|
|
145
|
+
return [defaultPaths];
|
|
146
|
+
}
|
|
147
|
+
return [...toolsPaths, defaultPaths];
|
|
148
|
+
}
|
|
149
|
+
async listToolsInputOptions(toolsPaths) {
|
|
195
150
|
const inputs = {};
|
|
196
151
|
for (const toolPath of toolsPaths) {
|
|
197
152
|
const expandedPaths = await glob(toolPath, {
|
|
@@ -236,7 +191,7 @@ var Bundler = class extends MastraBundler {
|
|
|
236
191
|
}
|
|
237
192
|
let analyzedBundleInfo;
|
|
238
193
|
try {
|
|
239
|
-
const resolvedToolsPaths = await this.
|
|
194
|
+
const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);
|
|
240
195
|
analyzedBundleInfo = await analyzeBundle(
|
|
241
196
|
[serverFile, ...Object.values(resolvedToolsPaths)],
|
|
242
197
|
mastraEntryFile,
|
|
@@ -265,55 +220,7 @@ var Bundler = class extends MastraBundler {
|
|
|
265
220
|
error
|
|
266
221
|
);
|
|
267
222
|
}
|
|
268
|
-
let externalDependencies;
|
|
269
|
-
try {
|
|
270
|
-
const result = await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));
|
|
271
|
-
externalDependencies = result?.externalDependencies ?? [];
|
|
272
|
-
} catch (error) {
|
|
273
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
274
|
-
throw new MastraError(
|
|
275
|
-
{
|
|
276
|
-
id: "DEPLOYER_BUNDLER_TELEMETRY_FAILED",
|
|
277
|
-
text: `Failed to write telemetry config: ${message}`,
|
|
278
|
-
domain: ErrorDomain.DEPLOYER,
|
|
279
|
-
category: ErrorCategory.SYSTEM
|
|
280
|
-
},
|
|
281
|
-
error
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
const mastraFolder = dirname(mastraEntryFile);
|
|
285
|
-
const fileService = new FileService();
|
|
286
|
-
const customInstrumentation = fileService.getFirstExistingFileOrUndefined([
|
|
287
|
-
join(mastraFolder, "instrumentation.js"),
|
|
288
|
-
join(mastraFolder, "instrumentation.ts"),
|
|
289
|
-
join(mastraFolder, "instrumentation.mjs")
|
|
290
|
-
]);
|
|
291
|
-
try {
|
|
292
|
-
if (customInstrumentation) {
|
|
293
|
-
const result = await writeCustomInstrumentation(customInstrumentation, join(outputDirectory, this.outputDir), {
|
|
294
|
-
sourcemap
|
|
295
|
-
});
|
|
296
|
-
externalDependencies = [...externalDependencies, ...result.externalDependencies];
|
|
297
|
-
await this.writeInstrumentationFile(join(outputDirectory, this.outputDir), customInstrumentation);
|
|
298
|
-
} else {
|
|
299
|
-
await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));
|
|
300
|
-
}
|
|
301
|
-
} catch (error) {
|
|
302
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
303
|
-
throw new MastraError(
|
|
304
|
-
{
|
|
305
|
-
id: "DEPLOYER_BUNDLER_INSTRUMENTATION_FILE_FAILED",
|
|
306
|
-
text: `Failed to write instrumentation file: ${message}, ${customInstrumentation ? ` Found custom instrumentation file: ${customInstrumentation}` : ""}`,
|
|
307
|
-
domain: ErrorDomain.DEPLOYER,
|
|
308
|
-
category: ErrorCategory.SYSTEM
|
|
309
|
-
},
|
|
310
|
-
error
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
223
|
const dependenciesToInstall = /* @__PURE__ */ new Map();
|
|
314
|
-
for (const external of externalDependencies) {
|
|
315
|
-
dependenciesToInstall.set(external, "latest");
|
|
316
|
-
}
|
|
317
224
|
for (const dep of analyzedBundleInfo.externalDependencies) {
|
|
318
225
|
try {
|
|
319
226
|
if (analyzedBundleInfo.workspaceMap.has(dep)) {
|
|
@@ -396,7 +303,7 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
396
303
|
}
|
|
397
304
|
}
|
|
398
305
|
async lint(_entryFile, _outputDirectory, toolsPaths) {
|
|
399
|
-
const toolsInputOptions = await this.
|
|
306
|
+
const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
|
|
400
307
|
const toolsLength = Object.keys(toolsInputOptions).length;
|
|
401
308
|
if (toolsLength > 0) {
|
|
402
309
|
this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? "tool" : "tools"}`);
|
|
@@ -405,5 +312,5 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
405
312
|
};
|
|
406
313
|
|
|
407
314
|
export { Bundler };
|
|
408
|
-
//# sourceMappingURL=chunk-
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
315
|
+
//# sourceMappingURL=chunk-WBAWUM7Z.js.map
|
|
316
|
+
//# sourceMappingURL=chunk-WBAWUM7Z.js.map
|