@mastra/deployer 1.83.0-alpha.12 → 1.83.0-alpha.13
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/dist/_types/{@mastra_hono@1.7.25-alpha.12 → @mastra_hono@1.7.25-alpha.13}/dist/index.d.ts +2 -0
- package/dist/{analyze-DO5iGgpf.js → analyze-BaYUEglS.js} +67 -20
- package/dist/analyze-BaYUEglS.js.map +1 -0
- package/dist/{analyze-BBFIIBmH.cjs → analyze-UIkyk9Qr.cjs} +66 -19
- package/dist/analyze-UIkyk9Qr.cjs.map +1 -0
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze/externals.d.ts +2 -0
- package/dist/build/analyze/externals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +4 -4
- package/dist/build/index.js +4 -4
- package/dist/build/package-info.d.ts +6 -0
- package/dist/build/package-info.d.ts.map +1 -1
- package/dist/{build-DH0yT1Zp.cjs → build-BNbmUARF.cjs} +4 -4
- package/dist/{build-DH0yT1Zp.cjs.map → build-BNbmUARF.cjs.map} +1 -1
- package/dist/{build-AGyF63xq.js → build-BmIjWY26.js} +4 -4
- package/dist/{build-AGyF63xq.js.map → build-BmIjWY26.js.map} +1 -1
- package/dist/bundler/index.cjs +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{bundler-BZ4fSyJZ.cjs → bundler-B85b7ZGn.cjs} +26 -1
- package/dist/bundler-B85b7ZGn.cjs.map +1 -0
- package/dist/{bundler-CRzGd7dU.cjs → bundler-BpXhdDyV.cjs} +4 -4
- package/dist/{bundler-CRzGd7dU.cjs.map → bundler-BpXhdDyV.cjs.map} +1 -1
- package/dist/{bundler-BadvdlF2.js → bundler-CtCtxgyj.js} +4 -4
- package/dist/{bundler-BadvdlF2.js.map → bundler-CtCtxgyj.js.map} +1 -1
- package/dist/{bundler-DSGZrLqs.js → bundler-DMIpMpLE.js} +21 -2
- package/dist/bundler-DMIpMpLE.js.map +1 -0
- package/dist/{bundlerOptions-DUh9CO6S.js → bundlerOptions-B8nx-_mx.js} +2 -2
- package/dist/{bundlerOptions-DUh9CO6S.js.map → bundlerOptions-B8nx-_mx.js.map} +1 -1
- package/dist/{bundlerOptions-Z4D-MNeR.cjs → bundlerOptions-C_YYCV7O.cjs} +2 -2
- package/dist/{bundlerOptions-Z4D-MNeR.cjs.map → bundlerOptions-C_YYCV7O.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/server/index.cjs +32 -41
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +32 -41
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/analyze-BBFIIBmH.cjs.map +0 -1
- package/dist/analyze-DO5iGgpf.js.map +0 -1
- package/dist/bundler-BZ4fSyJZ.cjs.map +0 -1
- package/dist/bundler-DSGZrLqs.js.map +0 -1
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.12 → @mastra_hono@1.7.25-alpha.13}/dist/auth-middleware.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.12 → @mastra_hono@1.7.25-alpha.13}/dist/browser-stream/index.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.12 → @mastra_hono@1.7.25-alpha.13}/package.json +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-DO5iGgpf.js","names":["spawn","nodeSpawn","getInputPlugins","path","basename","resolve","getPackageInfo","t","t"],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/stacktrace-parser/0.1.11/63406bc765474556691ebd1b24eaa0c5b032f058a26bbaff13797a2780d98220/node_modules/stacktrace-parser/dist/stack-trace-parser.cjs.js","../../_internals/find-workspaces/dist/index.js","../src/bundler/workspaceDependencies.ts","../src/validator/validate.ts","../src/build/analyze/constants.ts","../src/build/analyze/analyzeEntry.ts","../src/build/plugins/hono-alias.ts","../src/build/plugins/module-resolve-map.ts","../src/build/plugins/node-gyp-detector.ts","../src/build/analyze/bundleExternals.ts","../src/build/analyze/externals.ts","../src/build/babel/check-config-export.ts","../src/build/babel/detect-pino-transports.ts","../src/build/analyze.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar UNKNOWN_FUNCTION = '<unknown>';\n/**\n * This parses the different stack traces and puts them into one format\n * This borrows heavily from TraceKit (https://github.com/csnover/TraceKit)\n */\n\nfunction parse(stackString) {\n var lines = stackString.split('\\n');\n return lines.reduce(function (stack, line) {\n var parseResult = parseChrome(line) || parseWinjs(line) || parseGecko(line) || parseNode(line) || parseJSC(line);\n\n if (parseResult) {\n stack.push(parseResult);\n }\n\n return stack;\n }, []);\n}\nvar chromeRe = /^\\s*at (.*?) ?\\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\\/|[a-z]:\\\\|\\\\\\\\).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nvar chromeEvalRe = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\nfunction parseChrome(line) {\n var parts = chromeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n\n var submatch = chromeEvalRe.exec(parts[2]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n\n parts[3] = submatch[2]; // line\n\n parts[4] = submatch[3]; // column\n }\n\n return {\n file: !isNative ? parts[2] : null,\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: isNative ? [parts[2]] : [],\n lineNumber: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar winjsRe = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseWinjs(line) {\n var parts = winjsRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar geckoRe = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nvar geckoEvalRe = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nfunction parseGecko(line) {\n var parts = geckoRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n var submatch = geckoEvalRe.exec(parts[3]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: parts[2] ? parts[2].split(',') : [],\n lineNumber: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar javaScriptCoreRe = /^\\s*(?:([^@]*)(?:\\((.*?)\\))?@)?(\\S.*?):(\\d+)(?::(\\d+))?\\s*$/i;\n\nfunction parseJSC(line) {\n var parts = javaScriptCoreRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[4],\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar nodeRe = /^\\s*at (?:((?:\\[object object\\])?[^\\\\/]+(?: \\[as \\S+\\])?) )?\\(?(.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseNode(line) {\n var parts = nodeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nexports.parse = parse;\n","import { readFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { dirname, join, posix, resolve, sep } from \"path\";\nimport { glob } from \"tinyglobby\";\nimport { parse } from \"yaml\";\n// src/index.ts\n/**\n* Vendored from find-workspaces@0.3.1 (https://github.com/joshuajaco/find-workspaces),\n* MIT licensed, Copyright (c) 2021 Joshua Jacobowitz. See ./LICENSE.\n*\n* Changes from upstream:\n* - Globs with `tinyglobby` instead of `fast-glob`, so the production dependency\n* tree no longer carries `fast-glob` → `micromatch` → `braces`\n* (GHSA-vfj7-8cjw-p6xm, no patched release).\n* - `findWorkspaces` is async.\n* - Globs each pattern's `package.json` so symlinked workspace directories still\n* match, and adds the root explicitly when a pattern declares it, matching what\n* upstream's `fast-glob` directory glob returned.\n*\n* Root detection order is unchanged: `lerna.json`, then `pnpm-workspace.yaml`,\n* then `package.json` (`workspaces` array, `workspaces.packages`, or\n* `bolt.workspaces`).\n*/\nfunction createWorkspacesCache() {\n\treturn {\n\t\troot: /* @__PURE__ */ new Map(),\n\t\tworkspaces: /* @__PURE__ */ new Map(),\n\t\tclear() {\n\t\t\tthis.root.clear();\n\t\t\tthis.workspaces.clear();\n\t\t}\n\t};\n}\n/**\n* Walk up from `dirname` until a directory declaring workspace globs is found.\n* Returns `null` when none is found before `stopDir`.\n*/\nfunction findWorkspacesRoot(dirname, options = {}) {\n\tconst dir = dirname ? resolve(dirname) : process.cwd();\n\tconst stopDir = options.stopDir ? resolve(options.stopDir) : homedir();\n\tconst cache = options.cache;\n\tif (cache) {\n\t\tfor (const [key, value] of cache.root.entries()) if ((dir + sep).startsWith(key + sep)) return value;\n\t}\n\treturn findRoot(dir, stopDir, cache);\n}\n/**\n* List every workspace package under the root that contains `dirname`.\n* Returns `null` when `dirname` is not inside a workspace.\n*/\nasync function findWorkspaces(dirname$1, options = {}) {\n\tconst root = findWorkspacesRoot(dirname$1, options);\n\tif (!root) return null;\n\tconst cached = options.cache?.workspaces.get(root.location);\n\tif (cached) return cached;\n\tconst manifests = await glob(toManifestGlobs(root.globs), {\n\t\tcwd: root.location,\n\t\tabsolute: true,\n\t\tignore: [\"**/node_modules/**\"]\n\t});\n\tconst includesRoot = isRootWorkspace(root.globs);\n\tconst locations = manifests.map((manifest) => toPosix(dirname(manifest)));\n\tif (includesRoot && !locations.includes(root.location)) locations.push(root.location);\n\tconst workspaces = [];\n\tfor (const location of locations) {\n\t\tif (location === root.location && !includesRoot) continue;\n\t\tconst pkg = readJsonFile(location, \"package.json\");\n\t\tif (isObject(pkg) && typeof pkg.name === \"string\") workspaces.push({\n\t\t\tlocation,\n\t\t\tpackage: pkg\n\t\t});\n\t}\n\toptions.cache?.workspaces.set(root.location, workspaces);\n\treturn workspaces;\n}\n/**\n* Glob for each pattern's `package.json` instead of for the directory itself. A\n* directory-only glob does not match a symlink to a directory, so a linked workspace\n* package would be dropped and never packed into the build output. Matching the\n* manifest inside it does, and is also how pnpm resolves its workspaces. Negated\n* patterns are mapped the same way so they keep excluding whole packages.\n*/\nfunction toManifestGlobs(globs) {\n\treturn globs.map((pattern) => {\n\t\tconst negated = pattern.startsWith(\"!\");\n\t\tconst base = (negated ? pattern.slice(1) : pattern).replace(/[\\\\/]+$/, \"\");\n\t\treturn `${negated ? \"!\" : \"\"}${base}/package.json`;\n\t});\n}\n/**\n* Whether the workspace globs declare the root directory itself as a member. A\n* pattern matches the root when nothing is left after removing `.` segments, so\n* `.`, `./`, `.//` and `./.` do, while `**`, `*` and `packages/*` do not. A negated\n* root pattern wins.\n*/\nfunction isRootWorkspace(globs) {\n\tlet included = false;\n\tlet excluded = false;\n\tfor (const pattern of globs) {\n\t\tif (!isRootPattern(pattern.replace(/^!/, \"\"))) continue;\n\t\tif (pattern.startsWith(\"!\")) excluded = true;\n\t\telse included = true;\n\t}\n\treturn included && !excluded;\n}\nfunction isRootPattern(pattern) {\n\treturn braceAlternatives(pattern).some((alternative) => isRootPath(alternative));\n}\n/**\n* Split the first brace group of a glob into its comma-separated alternatives, so\n* `{.,packages/*}` yields `.` and `packages/*`. Nested groups stay intact; only the\n* top level of the first group is split, which is enough to spot a root alternative.\n*/\nfunction braceAlternatives(pattern) {\n\tif (!pattern.startsWith(\"{\")) return [pattern];\n\tlet depth = 0;\n\tlet close = -1;\n\tfor (let i = 0; i < pattern.length; i++) if (pattern[i] === \"{\") depth++;\n\telse if (pattern[i] === \"}\" && --depth === 0) {\n\t\tclose = i;\n\t\tbreak;\n\t}\n\tif (close === -1) return [pattern];\n\tconst rest = pattern.slice(close + 1);\n\treturn pattern.slice(1, close).split(\",\").map((alternative) => alternative + rest);\n}\nfunction isRootPath(pattern) {\n\treturn pattern.split(/[\\\\/]/).filter((segment) => segment !== \"\" && segment !== \".\").join(\"/\") === \"\";\n}\nfunction findRoot(dir, stopDir, cache) {\n\tconst memo = (value) => {\n\t\tcache?.root.set(dir, value);\n\t\treturn value;\n\t};\n\tconst globs = findGlobs(dir);\n\tif (globs) return memo({\n\t\tlocation: toPosix(dir),\n\t\tglobs\n\t});\n\tconst next = resolve(dir, \"..\");\n\tif (next === stopDir || next === dir) return memo(null);\n\treturn findRoot(next, stopDir, cache);\n}\nfunction findGlobs(dir) {\n\treturn resolveLernaGlobs(dir) ?? resolvePnpmGlobs(dir) ?? resolvePackageJsonGlobs(dir);\n}\nfunction resolveLernaGlobs(dir) {\n\tconst lernaJson = readJsonFile(dir, \"lerna.json\");\n\tif (lernaJson === void 0) return null;\n\treturn isObject(lernaJson) && isStringArray(lernaJson.packages) ? lernaJson.packages : null;\n}\nfunction resolvePnpmGlobs(dir) {\n\tconst pnpmWorkspace = readYamlFile(dir, \"pnpm-workspace.yaml\");\n\tif (pnpmWorkspace === void 0) return null;\n\treturn isObject(pnpmWorkspace) && isStringArray(pnpmWorkspace.packages) ? pnpmWorkspace.packages : [\"**\"];\n}\nfunction resolvePackageJsonGlobs(dir) {\n\tconst packageJson = readJsonFile(dir, \"package.json\");\n\tif (!isObject(packageJson)) return null;\n\tif (isStringArray(packageJson.workspaces)) return packageJson.workspaces;\n\tif (isObject(packageJson.workspaces) && isStringArray(packageJson.workspaces.packages)) return packageJson.workspaces.packages;\n\tif (isObject(packageJson.bolt) && isStringArray(packageJson.bolt.workspaces)) return packageJson.bolt.workspaces;\n\treturn null;\n}\nfunction readJsonFile(dir, file) {\n\ttry {\n\t\treturn JSON.parse(readFileSync(join(dir, file), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction readYamlFile(dir, file) {\n\ttry {\n\t\treturn parse(readFileSync(join(dir, file), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction toPosix(path) {\n\treturn path.split(sep).join(posix.sep);\n}\nfunction isObject(value) {\n\treturn !!value && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction isStringArray(value) {\n\treturn Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\nexport { createWorkspacesCache, findWorkspaces, findWorkspacesRoot };\n\n//# sourceMappingURL=index.js.map","import { join, dirname } from 'node:path';\nimport type { IMastraLogger } from '@internal/core/logger';\nimport { findWorkspaces, findWorkspacesRoot, createWorkspacesCache } from '@internal/find-workspaces';\nimport * as pkg from 'empathic/package';\nimport { ensureDir } from 'fs-extra';\nimport { slash } from '../build/utils';\nimport { DepsService } from '../services';\nimport { WORKSPACE_PLACEHOLDER_VERSION, withPlaceholderVersions } from '../services/deps';\n\nexport type WorkspacePackageInfo = {\n location: string;\n dependencies: Record<string, string> | undefined;\n version: string | undefined;\n exports?: unknown;\n};\n\nconst isExportTargetImportable = (target: unknown): boolean => {\n if (!target) return false;\n if (typeof target === 'string') return true;\n if (Array.isArray(target)) return target.some(isExportTargetImportable);\n if (typeof target !== 'object') return false;\n\n return Object.values(target).some(isExportTargetImportable);\n};\n\nexport const hasRootExport = (exportsField: unknown): boolean => {\n if (exportsField === undefined) return true;\n if (typeof exportsField === 'string' || Array.isArray(exportsField)) return isExportTargetImportable(exportsField);\n if (!exportsField || typeof exportsField !== 'object') return false;\n\n const exportMap = exportsField as Record<string, unknown>;\n const exportKeys = Object.keys(exportMap);\n if (exportKeys.length === 0) return false;\n if (Object.prototype.hasOwnProperty.call(exportMap, '.')) return isExportTargetImportable(exportMap['.']);\n if (exportKeys.some(key => key.startsWith('./'))) return false;\n\n return isExportTargetImportable(exportMap);\n};\n\ntype TransitiveDependencyResult = {\n resolutions: Record<string, string>;\n usedWorkspacePackages: Set<string>;\n};\n\n/**\n * Create a shared cache for find-workspaces\n */\nconst workspacesCache = createWorkspacesCache();\n\n/**\n * A utility function around find-workspaces to get information about:\n * - Which workspace packages are available in the project\n * - What is the workspace root location\n * - Is the current package a workspace package\n *\n * Because `findWorkspacesRoot` only traverses up until it finds workspace information, but doesn't check if the current package is even part of the workspace. We rather want to return `null` for these cases because in other code paths we use `workspaceRoot || projectRoot` to determine the root of the project.\n *\n * @params dir - The directory to start searching from (default: `process.cwd()`)\n * @params location - The location of the current package (usually the directory containing the package.json)\n */\nexport async function getWorkspaceInformation({\n dir = process.cwd(),\n mastraEntryFile,\n}: {\n dir?: string;\n mastraEntryFile: string;\n}) {\n // 1) Get the location of the current package and its package.json\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const location = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n\n // 2) Get all workspaces\n const workspaces = await findWorkspaces(dir, { cache: workspacesCache });\n const _workspaceMap = new Map(\n workspaces?.map(workspace => [\n workspace.package.name,\n {\n location: workspace.location,\n dependencies: workspace.package.dependencies,\n version: workspace.package.version,\n exports: workspace.package.exports,\n },\n ]) ?? [],\n );\n\n // 3) Check if the current package is part of the workspace\n const isWorkspacePackage = (workspaces ?? []).some(ws => ws.location === location);\n\n // 4) Get the workspace root only if the current package is part of the workspace\n const workspaceRoot = isWorkspacePackage ? findWorkspacesRoot(dir, { cache: workspacesCache })?.location : undefined;\n\n return {\n // If the current package is not part of the workspace, the bundling down the line shouldn't look at any workspace packages\n workspaceMap: isWorkspacePackage ? _workspaceMap : new Map<string, WorkspacePackageInfo>(),\n workspaceRoot,\n isWorkspacePackage,\n };\n}\n\n/**\n * Collects all transitive workspace dependencies and their TGZ paths\n */\nexport const collectTransitiveWorkspaceDependencies = async ({\n workspaceMap,\n initialDependencies,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n initialDependencies: Set<string>;\n logger: IMastraLogger;\n}): Promise<TransitiveDependencyResult> => {\n const usedWorkspacePackages = new Set<string>();\n const queue: string[] = Array.from(initialDependencies);\n const resolutions: Record<string, string> = {};\n\n while (queue.length > 0) {\n const len = queue.length;\n for (let i = 0; i < len; i += 1) {\n const pkgName = queue.shift();\n if (!pkgName || usedWorkspacePackages.has(pkgName)) {\n continue;\n }\n\n const dep = workspaceMap.get(pkgName);\n if (!dep) continue;\n\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n\n const slugify = (await import('@sindresorhus/slugify')).default;\n const sanitizedName = slugify(pkgName);\n\n const tgzPath = depsService.getWorkspaceDependencyPath({\n pkgName: sanitizedName,\n version: dep.version ?? WORKSPACE_PLACEHOLDER_VERSION,\n });\n resolutions[pkgName] = tgzPath;\n usedWorkspacePackages.add(pkgName);\n\n for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) {\n if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) {\n queue.push(depName);\n }\n }\n }\n }\n\n return { resolutions, usedWorkspacePackages };\n};\n\n/**\n * Creates TGZ packages for workspace dependencies in the workspace-module directory\n */\nexport const packWorkspaceDependencies = async ({\n workspaceMap,\n usedWorkspacePackages,\n bundleOutputDir,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n bundleOutputDir: string;\n logger: IMastraLogger;\n usedWorkspacePackages: Set<string>;\n}): Promise<void> => {\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n\n // package all workspace dependencies\n if (usedWorkspacePackages.size > 0) {\n const slugify = (await import('@sindresorhus/slugify')).default;\n const workspaceDirPath = join(bundleOutputDir, 'workspace-module');\n await ensureDir(workspaceDirPath);\n\n logger.info('Packaging workspace dependencies', { count: usedWorkspacePackages.size });\n\n const batchSize = 5;\n const packages = Array.from(usedWorkspacePackages.values());\n const packageDirs = packages.flatMap(pkgName => {\n const location = workspaceMap.get(pkgName)?.location;\n return location ? [location] : [];\n });\n\n await withPlaceholderVersions(packageDirs, async () => {\n for (let i = 0; i < packages.length; i += batchSize) {\n const batch = packages.slice(i, i + batchSize);\n logger.info(\n `Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(', ')}`,\n );\n await Promise.all(\n batch.map(async pkgName => {\n const dep = workspaceMap.get(pkgName);\n const sanitizedName = slugify(pkgName);\n if (!dep) return;\n\n await depsService.pack({\n dir: dep.location,\n destination: workspaceDirPath,\n sanitizedName,\n version: dep.version ?? WORKSPACE_PLACEHOLDER_VERSION,\n });\n }),\n );\n }\n });\n\n logger.info('Successfully packaged workspace dependencies', { count: usedWorkspacePackages.size });\n }\n};\n","import { spawn as nodeSpawn } from 'node:child_process';\nimport type { SpawnOptions } from 'node:child_process';\nimport { dirname } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\ntype ValidationArgs = {\n message: string;\n type: string;\n stack: string;\n};\n\nexport class ValidationError extends Error {\n public readonly type: string;\n public readonly stack: string;\n constructor(args: ValidationArgs) {\n super(args.message);\n this.type = args.type;\n this.stack = args.stack;\n }\n}\n\n/**\n * Promisified version of Node.js spawn function\n *\n * @param command - The command to run\n * @param args - List of string arguments\n * @param options - Spawn options\n * @returns Promise that resolves with the exit code when the process completes\n */\nfunction spawn(command: string, args: string[] = [], options: SpawnOptions = {}): Promise<void> {\n return new Promise((resolve, reject) => {\n let validationError: ValidationArgs | null = null;\n const childProcess = nodeSpawn(command, args, {\n stdio: ['ignore', 'ignore', 'pipe'],\n ...options,\n });\n\n childProcess.on('error', error => {\n reject(error);\n });\n\n let stderr = '';\n childProcess.stderr?.on('data', message => {\n try {\n validationError = JSON.parse(message.toString());\n } catch {\n stderr += message;\n }\n });\n\n childProcess.on('close', code => {\n if (code === 0) {\n resolve();\n } else if (validationError) {\n reject(new ValidationError(validationError));\n } else {\n reject(new Error(stderr));\n }\n });\n });\n}\n\nexport function validate(\n file: string,\n {\n injectESMShim = false,\n moduleResolveMapLocation,\n stubbedExternals = [],\n }: { injectESMShim?: boolean; moduleResolveMapLocation: string; stubbedExternals?: string[] },\n) {\n let prefixCode = '';\n if (injectESMShim) {\n prefixCode = `import { fileURLToPath } from 'url';\nimport { dirname } from 'path';\n\nglobalThis.__filename = fileURLToPath(import.meta.url);\nglobalThis.__dirname = dirname(__filename);\n `;\n }\n\n // Used to log a proper error we can parse instead of trying to do some fancy string grepping\n function errorHandler(err: Error) {\n console.error(\n JSON.stringify({\n type: err.name,\n message: err.message,\n stack: err.stack,\n }),\n );\n process.exit(1);\n }\n\n return spawn(\n process.execPath,\n [\n '--import',\n import.meta.resolve('@mastra/deployer/loader'),\n '--input-type=module',\n '--enable-source-maps',\n '-e',\n `${prefixCode};import('${pathToFileURL(file).href}').catch(err => {\n ${errorHandler.toString()}\n errorHandler(err);\n })`.replaceAll(/\\n/g, ''),\n ],\n {\n env: {\n ...process.env,\n // oxlint-disable-next-line typescript/no-unnecessary-template-expression -- Preserve string coercion at the child-process environment boundary.\n MODULE_MAP: `${moduleResolveMapLocation}`,\n STUBBED_EXTERNALS: JSON.stringify(stubbedExternals),\n },\n cwd: dirname(file),\n },\n );\n}\n","export const DEPS_TO_IGNORE = ['#tools', 'execa', 'effect', 'sury', '@ast-grep/napi', '@hono/node-ws'];\n\nexport const GLOBAL_EXTERNALS = [\n 'pino',\n 'pino-pretty',\n '@libsql/client',\n 'pg',\n 'libsql',\n '#tools',\n 'typescript',\n 'undici',\n 'readable-stream',\n 'bufferutil',\n 'utf-8-validate',\n 'execa',\n '@ast-grep/napi',\n '@hono/node-ws',\n];\nexport const DEPRECATED_EXTERNALS = ['fastembed', 'nodemailer', 'jsdom', 'sqlite3'];\n","import { pathToFileURL } from 'node:url';\nimport type { IMastraLogger } from '@internal/core/logger';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport virtual from '@rollup/plugin-virtual';\nimport { resolveModule } from 'local-pkg';\nimport { rollup } from 'rollup';\nimport type { OutputChunk, Plugin, SourceMap } from 'rollup';\nimport type { WorkspacePackageInfo } from '../../bundler/workspaceDependencies';\nimport { mastraInternalAliasPlugin, mastraToolsAliasPlugin } from '../bundler';\nimport { getPackageMetadata, getPackageRootPath } from '../package-info';\nimport { esbuild } from '../plugins/esbuild';\nimport { moduleAlias } from '../plugins/module-alias';\nimport { protocolExternalResolver } from '../plugins/protocol-external-resolver';\nimport { removeDeployer } from '../plugins/remove-deployer';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\nimport type { DependencyMetadata } from '../types';\nimport { getPackageName, isBareModuleSpecifier, isDependencyPartOfPackage, slash } from '../utils';\nimport type { BundlerPlatform } from '../utils';\nimport { DEPS_TO_IGNORE } from './constants';\n\nfunction analysisExternals({\n workspaceMap,\n externals,\n externalsPreset,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n externals: string[];\n externalsPreset: boolean;\n}): Plugin {\n return {\n name: 'analysis-externals',\n resolveId(source) {\n if (!isBareModuleSpecifier(source)) {\n return null;\n }\n\n const packageName = getPackageName(source);\n if (packageName && workspaceMap.has(packageName)) {\n return null;\n }\n\n if (externalsPreset || externals.some(external => isDependencyPartOfPackage(source, external))) {\n return { id: source, external: true };\n }\n\n return null;\n },\n };\n}\n\n/**\n * Configures and returns the Rollup plugins needed for analyzing entry files.\n * Sets up module resolution, transpilation, and custom alias handling for Mastra-specific imports.\n */\nfunction getInputPlugins(\n { entry, isVirtualFile }: { entry: string; isVirtualFile: boolean },\n mastraEntry: string,\n {\n sourcemapEnabled,\n env,\n workspaceMap,\n externals,\n externalsPreset,\n alias,\n platform,\n configEntryFile,\n }: {\n sourcemapEnabled: boolean;\n env: Record<string, string>;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n externals: string[];\n externalsPreset: boolean;\n alias: Record<string, string>;\n platform: BundlerPlatform;\n configEntryFile: string;\n },\n): Plugin[] {\n let virtualPlugin = null;\n if (isVirtualFile) {\n virtualPlugin = virtual({\n '#entry': entry,\n });\n entry = '#entry';\n }\n\n const plugins = [];\n if (virtualPlugin) {\n plugins.push(virtualPlugin);\n }\n\n const aliasPlugin = moduleAlias(alias, mastraEntry, platform);\n plugins.push(\n ...[\n protocolExternalResolver(),\n mastraInternalAliasPlugin(mastraEntry),\n ...(aliasPlugin ? [aliasPlugin] : []),\n mastraToolsAliasPlugin(),\n tsConfigPaths(),\n analysisExternals({ workspaceMap, externals, externalsPreset }),\n json(),\n esbuild({ define: env }),\n commonjs({\n strictRequires: 'debug',\n ignoreTryCatch: false,\n transformMixedEsModules: true,\n extensions: ['.js', '.ts'],\n }),\n removeDeployer(configEntryFile, {\n sourcemap: sourcemapEnabled,\n }),\n esbuild(),\n ],\n );\n\n return plugins;\n}\n\n/**\n * Extracts and categorizes dependencies from Rollup output to determine which ones need optimization.\n * Analyzes both static imports and dynamic imports while filtering out Node.js built-ins and ignored dependencies.\n * Identifies workspace packages and resolves package root paths for proper bundling optimization.\n */\nasync function captureDependenciesToOptimize(\n output: OutputChunk,\n workspaceMap: Map<string, WorkspacePackageInfo>,\n projectRoot: string,\n {\n logger,\n mastraEntry,\n shouldCheckTransitiveDependencies,\n env,\n analyzeCache,\n activeEntries,\n externals,\n externalsPreset,\n alias,\n platform,\n configEntryFile,\n }: {\n logger: IMastraLogger;\n mastraEntry: string;\n configEntryFile: string;\n shouldCheckTransitiveDependencies: boolean;\n env: Record<string, string>;\n /** Shared cache to avoid re-analyzing the same entry across recursive calls */\n analyzeCache?: Map<string, AnalyzeEntryResult>;\n /** Resolved entries currently being analyzed in this recursion path */\n activeEntries: Set<string>;\n externals: string[];\n externalsPreset: boolean;\n alias: Record<string, string>;\n platform: BundlerPlatform;\n },\n): Promise<Map<string, DependencyMetadata>> {\n const depsToOptimize = new Map<string, DependencyMetadata>();\n\n if (!output.facadeModuleId) {\n throw new Error(\n 'Something went wrong, we could not find the package name of the entry file. Please open an issue.',\n );\n }\n\n let entryRootPath = projectRoot;\n if (!output.facadeModuleId.startsWith('\\x00virtual:')) {\n entryRootPath = (await getPackageRootPath(output.facadeModuleId)) || projectRoot;\n }\n\n for (const [dependency, bindings] of Object.entries(output.importedBindings)) {\n if (!isBareModuleSpecifier(dependency)) {\n continue;\n }\n\n // The `getPackageName` helper also handles subpaths so we only get the proper package name\n const pkgName = getPackageName(dependency);\n let rootPath: string | null = null;\n let isWorkspace = false;\n let version: string | undefined;\n let packageSpec: string | undefined;\n\n if (pkgName) {\n const metadata = await getPackageMetadata(dependency, entryRootPath);\n rootPath = metadata.rootPath;\n version = metadata.version;\n packageSpec = metadata.packageSpec;\n isWorkspace = workspaceMap.has(pkgName);\n }\n\n const normalizedRootPath = rootPath ? slash(rootPath) : null;\n\n depsToOptimize.set(dependency, {\n exports: bindings,\n rootPath: normalizedRootPath,\n isWorkspace,\n version,\n packageSpec,\n });\n }\n\n const processedWorkspaceEntries = new Set<string>();\n\n /**\n * Recursively discovers transitive workspace dependencies from package manifests.\n */\n async function checkTransitiveDependencies() {\n // Make a copy so that we can safely iterate over it\n const depsSnapshot = new Map(depsToOptimize);\n\n for (const [dep, meta] of depsSnapshot) {\n const pkgName = getPackageName(dep);\n if (!pkgName || !meta.isWorkspace) {\n continue;\n }\n\n const importerFile = output.facadeModuleId!.startsWith('\\x00virtual:')\n ? mastraEntry || projectRoot\n : output.facadeModuleId!;\n const importerPath = pathToFileURL(importerFile).href;\n // Absolute path to the dependency using ESM-compatible resolution\n const resolvedPath = resolveModule(dep, {\n paths: [importerPath],\n });\n\n if (!resolvedPath) {\n logger.warn('Could not resolve path for workspace dependency', { dep });\n continue;\n }\n\n const resolvedEntry = slash(resolvedPath);\n if (processedWorkspaceEntries.has(resolvedEntry) || activeEntries.has(resolvedEntry)) {\n continue;\n }\n\n processedWorkspaceEntries.add(resolvedEntry);\n\n const analysis = await analyzeEntry({ entry: resolvedPath, isVirtualFile: false }, mastraEntry, {\n workspaceMap,\n projectRoot,\n logger,\n sourcemapEnabled: false,\n env,\n shouldCheckTransitiveDependencies: true,\n analyzeCache,\n activeEntries,\n externals,\n externalsPreset,\n alias,\n platform,\n configEntryFile,\n });\n\n if (!analysis?.dependencies) {\n continue;\n }\n\n for (const [innerDep, innerMeta] of analysis.dependencies) {\n if (!innerMeta.isWorkspace) {\n continue;\n }\n\n const existingMeta = depsToOptimize.get(innerDep);\n if (existingMeta) {\n depsToOptimize.set(innerDep, {\n ...existingMeta,\n exports: [...new Set([...existingMeta.exports, ...innerMeta.exports])],\n });\n continue;\n } else {\n depsToOptimize.set(innerDep, {\n exports: innerMeta.exports,\n rootPath: slash(innerMeta.rootPath || ''),\n isWorkspace: true,\n version: innerMeta.version,\n });\n }\n }\n }\n }\n\n if (shouldCheckTransitiveDependencies) {\n await checkTransitiveDependencies();\n }\n\n // #tools is a generated dependency, we don't want our analyzer to handle it\n const dynamicImports = output.dynamicImports.filter(d => !DEPS_TO_IGNORE.includes(d));\n if (dynamicImports.length) {\n for (const dynamicImport of dynamicImports) {\n if (!depsToOptimize.has(dynamicImport) && isBareModuleSpecifier(dynamicImport)) {\n // Try to resolve version for dynamic imports as well\n const pkgName = getPackageName(dynamicImport);\n let version: string | undefined;\n let packageSpec: string | undefined;\n let rootPath: string | null = null;\n\n if (pkgName) {\n const metadata = await getPackageMetadata(dynamicImport, entryRootPath);\n rootPath = metadata.rootPath;\n version = metadata.version;\n packageSpec = metadata.packageSpec;\n }\n\n depsToOptimize.set(dynamicImport, {\n exports: ['*'],\n rootPath: rootPath ? slash(rootPath) : null,\n isWorkspace: false,\n version,\n packageSpec,\n });\n }\n }\n }\n\n return depsToOptimize;\n}\n\n/**\n * Analyzes the entry file to identify external dependencies and their imports. This allows us to treeshake all code that is not used.\n *\n * @param entryConfig - Configuration object for the entry file\n * @param entryConfig.entry - The entry file path or content\n * @param entryConfig.isVirtualFile - Whether the entry is a virtual file (content string) or a file path\n * @param mastraEntry - The mastra entry point\n * @param options - Configuration options for the analysis\n * @param options.logger - Logger instance for debugging\n * @param options.sourcemapEnabled - Whether sourcemaps are enabled\n * @param options.workspaceMap - Map of workspace packages\n * @param options.shouldCheckTransitiveDependencies - Whether to recursively analyze transitive workspace dependencies (default: false)\n * @returns A promise that resolves to an object containing the analyzed dependencies and generated output\n */\n/** Return type of {@link analyzeEntry} */\nexport type AnalyzeEntryResult = {\n dependencies: Map<string, DependencyMetadata>;\n output: {\n code: string;\n map: SourceMap | null;\n };\n};\n\nexport async function analyzeEntry(\n {\n entry,\n isVirtualFile,\n }: {\n entry: string;\n isVirtualFile: boolean;\n },\n mastraEntry: string,\n {\n logger,\n sourcemapEnabled,\n workspaceMap,\n projectRoot,\n env = { 'process.env.NODE_ENV': JSON.stringify('production') },\n shouldCheckTransitiveDependencies = false,\n analyzeCache,\n activeEntries: providedActiveEntries,\n externals = [],\n externalsPreset = false,\n alias = {},\n platform = 'node',\n configEntryFile = mastraEntry,\n }: {\n logger: IMastraLogger;\n sourcemapEnabled: boolean;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n projectRoot: string;\n env?: Record<string, string>;\n shouldCheckTransitiveDependencies?: boolean;\n /** Shared cache to avoid re-analyzing the same entry across recursive calls */\n analyzeCache?: Map<string, AnalyzeEntryResult>;\n /** Resolved entries currently being analyzed in this recursion path */\n activeEntries?: Set<string>;\n /** Dependencies that must remain external during analysis */\n externals?: string[];\n /** Whether all non-workspace dependencies must remain external during analysis */\n externalsPreset?: boolean;\n /** Exact module specifier aliases applied before externalization */\n alias?: Record<string, string>;\n platform?: BundlerPlatform;\n /** File holding `new Mastra({...})`, when `mastraEntry` is a generated wrapper that imports it */\n configEntryFile?: string;\n },\n): Promise<AnalyzeEntryResult> {\n const resolvedEntry = isVirtualFile ? undefined : slash(entry);\n const effectiveAnalyzeCache = analyzeCache ?? new Map<string, AnalyzeEntryResult>();\n // Transitive analysis produces a different result from direct analysis, so cache them separately.\n const externalsCacheKey = JSON.stringify([externalsPreset, [...externals].sort()]);\n const cacheKey = resolvedEntry\n ? `${resolvedEntry}:${shouldCheckTransitiveDependencies ? 'transitive' : 'direct'}:${externalsCacheKey}`\n : undefined;\n if (cacheKey && effectiveAnalyzeCache.has(cacheKey)) {\n return effectiveAnalyzeCache.get(cacheKey)!;\n }\n\n const activeEntries = providedActiveEntries ?? new Set<string>();\n const shouldTrackEntry = Boolean(resolvedEntry && !activeEntries.has(resolvedEntry));\n if (resolvedEntry && shouldTrackEntry) {\n activeEntries.add(resolvedEntry);\n }\n\n try {\n const optimizerBundler = await rollup({\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n input: isVirtualFile ? '#entry' : entry,\n treeshake: false,\n preserveSymlinks: true,\n plugins: getInputPlugins({ entry, isVirtualFile }, mastraEntry, {\n sourcemapEnabled,\n env,\n workspaceMap,\n externals,\n externalsPreset,\n alias,\n platform,\n configEntryFile,\n }),\n external: id => DEPS_TO_IGNORE.some(dep => isDependencyPartOfPackage(id, dep)),\n });\n\n const { output } = await (async () => {\n try {\n return await optimizerBundler.generate({\n format: 'esm',\n inlineDynamicImports: true,\n });\n } finally {\n await optimizerBundler.close();\n }\n })();\n\n const depsToOptimize = await captureDependenciesToOptimize(output[0] as OutputChunk, workspaceMap, projectRoot, {\n logger,\n mastraEntry,\n configEntryFile,\n shouldCheckTransitiveDependencies,\n env,\n analyzeCache: effectiveAnalyzeCache,\n activeEntries,\n externals,\n externalsPreset,\n alias,\n platform,\n });\n\n const result: AnalyzeEntryResult = {\n dependencies: depsToOptimize,\n output: {\n code: output[0].code,\n map: output[0].map as SourceMap,\n },\n };\n\n // Cache the result so recursive calls for the same entry are instant\n if (cacheKey) {\n effectiveAnalyzeCache.set(cacheKey, result);\n }\n\n return result;\n } finally {\n if (resolvedEntry && shouldTrackEntry) {\n activeEntries.delete(resolvedEntry);\n }\n }\n}\n","import { fileURLToPath } from 'node:url';\nimport type { Plugin } from 'rollup';\n\n// hono is imported from deployer, so we need to resolve from here instead of the project root\nexport function aliasHono(): Plugin {\n return {\n name: 'hono-alias',\n resolveId(id: string) {\n if (!id.startsWith('@hono/') && !id.startsWith('hono/') && id !== 'hono' && id !== 'hono-openapi') {\n return;\n }\n\n const path = import.meta.resolve(id);\n return fileURLToPath(path);\n },\n } satisfies Plugin;\n}\n","import { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { Plugin } from 'rollup';\nimport { isDependencyPartOfPackage, slash } from '../utils';\n\nexport function moduleResolveMap(externals: string[], projectRoot: string): Plugin {\n const importMap = new Map<string, string>();\n return {\n name: 'module-resolve-map',\n moduleParsed(info) {\n if (info.importedIds.length === 0 || !info.id) {\n return;\n }\n\n for (const importedId of info.importedIds) {\n for (const external of externals) {\n if (isDependencyPartOfPackage(importedId, external)) {\n // TODO add multi version support\n importMap.set(external, info.id);\n }\n }\n }\n },\n\n async generateBundle(options, bundle) {\n const resolveMap = new Map<string, Map<string, string>>();\n\n // Iterate through all output chunks\n for (const [fileName, chunk] of Object.entries(bundle)) {\n // Only chunks have modules, assets don't\n if (chunk.type === 'chunk') {\n for (const [external, resolvedFrom] of importMap) {\n if (chunk.moduleIds.includes(resolvedFrom)) {\n const fullPath = pathToFileURL(slash(join(projectRoot, fileName))).toString();\n const innerMap = resolveMap.get(fullPath) || new Map<string, string>();\n innerMap.set(external, pathToFileURL(slash(resolvedFrom)).toString());\n resolveMap.set(fullPath, innerMap);\n }\n }\n }\n }\n\n // store all binaries used by a module to show in the error message\n const resolveMapJson = Object.fromEntries(\n Array.from(resolveMap.entries()).map(([key, value]) => [key, Object.fromEntries(value.entries())]),\n );\n\n this.emitFile({\n type: 'asset',\n name: 'module-resolve-map.json',\n source: JSON.stringify(resolveMapJson, null, 2),\n });\n },\n } satisfies Plugin;\n}\n","import { getPackageInfo } from 'local-pkg';\nimport type { Plugin } from 'rollup';\n\nexport function nodeGypDetector(): Plugin {\n const modulesToTrack = new Set<string>();\n const modulesToTrackPackageInfo = new Map<string, ReturnType<typeof getPackageInfo>>();\n\n return {\n name: 'node-gyp-build-detector',\n moduleParsed(info) {\n if (!info.meta?.commonjs?.requires?.length) {\n return;\n }\n\n const hasNodeGypBuild = info.meta.commonjs.requires.some((m: { resolved?: { id: string } }) =>\n m?.resolved?.id.endsWith('node-gyp-build/index.js'),\n );\n if (!hasNodeGypBuild) {\n return;\n }\n\n modulesToTrack.add(info.id);\n modulesToTrackPackageInfo.set(info.id, getPackageInfo(info.id));\n },\n\n async generateBundle(options, bundle) {\n const binaryMapByChunk = new Map<string, Set<string>>();\n // Iterate through all output chunks\n for (const [fileName, chunk] of Object.entries(bundle)) {\n // Only chunks have modules, assets don't\n if (chunk.type === 'chunk') {\n for (const moduleId of chunk.moduleIds) {\n if (modulesToTrackPackageInfo.has(moduleId)) {\n const pkgInfo = await modulesToTrackPackageInfo.get(moduleId)!;\n\n if (!binaryMapByChunk.has(fileName)) {\n binaryMapByChunk.set(fileName, new Set());\n }\n\n if (pkgInfo?.packageJson?.name) {\n binaryMapByChunk.get(fileName)!.add(pkgInfo.packageJson.name);\n }\n }\n }\n }\n }\n\n const binaryMapJson = Object.fromEntries(\n Array.from(binaryMapByChunk.entries()).map(([key, value]) => [key, Array.from(value)]),\n );\n\n // store all binaries used by a module to show in the error message\n this.emitFile({\n type: 'asset',\n name: 'binary-map.json',\n source: JSON.stringify(binaryMapJson, null, 2),\n });\n },\n } satisfies Plugin;\n}\n","import { readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { basename } from 'node:path/posix';\nimport { ErrorCategory, ErrorDomain, MastraBaseError } from '@internal/core/error';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport virtual from '@rollup/plugin-virtual';\nimport * as resolve from 'resolve.exports';\nimport { rollup } from 'rollup';\nimport type { OutputChunk, OutputAsset, Plugin } from 'rollup';\nimport type { WorkspacePackageInfo } from '../../bundler/workspaceDependencies';\nimport { getPackageRootPath, getPackageInfo } from '../package-info';\nimport { esbuild } from '../plugins/esbuild';\nimport { esmShim } from '../plugins/esm-shim';\nimport { aliasHono } from '../plugins/hono-alias';\nimport { moduleAlias } from '../plugins/module-alias';\nimport { moduleResolveMap } from '../plugins/module-resolve-map';\nimport { nodeGypDetector } from '../plugins/node-gyp-detector';\nimport { protocolExternalResolver } from '../plugins/protocol-external-resolver';\nimport { subpathExternalsResolver } from '../plugins/subpath-externals-resolver';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\nimport type { DependencyMetadata } from '../types';\nimport {\n getCompiledDepCachePath,\n getNodeResolveOptions,\n isDependencyPartOfPackage,\n rollupSafeName,\n slash,\n} from '../utils';\nimport type { BundlerPlatform } from '../utils';\nimport { DEPS_TO_IGNORE } from './constants';\nimport type { NormalizedExternals } from './externals';\n\ntype VirtualDependency = {\n name: string;\n virtual: string;\n};\n\nfunction prepareEntryFileName(name: string, rootDir: string) {\n return rollupSafeName(name, rootDir);\n}\n\n/**\n * Creates virtual dependency modules for optimized bundling by generating virtual entry points for each dependency with their specific exports and handling workspace package path resolution.\n */\nexport function createVirtualDependencies(\n depsToOptimize: Map<string, DependencyMetadata>,\n {\n projectRoot,\n workspaceRoot,\n outputDir,\n bundlerOptions,\n }: {\n workspaceRoot: string | null;\n projectRoot: string;\n outputDir: string;\n bundlerOptions?: { isDev?: boolean; externalsPreset?: boolean };\n },\n): {\n optimizedDependencyEntries: Map<string, VirtualDependency>;\n fileNameToDependencyMap: Map<string, string>;\n} {\n const { isDev = false, externalsPreset = false } = bundlerOptions || {};\n const fileNameToDependencyMap = new Map<string, string>();\n const optimizedDependencyEntries = new Map<string, VirtualDependency>();\n const rootDir = workspaceRoot || projectRoot;\n\n for (const [dep, { exports }] of depsToOptimize.entries()) {\n // Use __ as separator to avoid conflicts with hyphens in package names\n // e.g., @inner/inner-tools -> @inner__inner-tools (preserves the hyphen)\n const fileName = dep.replaceAll('/', '__');\n const virtualFile: string[] = [];\n const exportStringBuilder = [];\n\n for (const local of exports) {\n if (local === '*') {\n virtualFile.push(`export * from '${dep}';`);\n continue;\n } else if (local === 'default') {\n exportStringBuilder.push('default');\n } else {\n exportStringBuilder.push(local);\n }\n }\n\n const chunks = [];\n if (exportStringBuilder.length) {\n chunks.push(`{ ${exportStringBuilder.join(', ')} }`);\n }\n if (chunks.length) {\n virtualFile.push(`export ${chunks.join(', ')} from '${dep}';`);\n }\n\n // Determine the entry name based on the complexity of exports\n let entryName = prepareEntryFileName(path.join(outputDir, fileName), rootDir);\n\n fileNameToDependencyMap.set(entryName, dep);\n optimizedDependencyEntries.set(dep, {\n name: entryName,\n virtual: virtualFile.join('\\n'),\n });\n }\n\n // For workspace packages, we still want the dependencies to be imported from the original path\n // We rewrite the path to the original folder inside node_modules/.cache\n if (isDev || externalsPreset) {\n for (const [dep, { isWorkspace, rootPath }] of depsToOptimize.entries()) {\n if (!isWorkspace || !rootPath || !workspaceRoot) {\n continue;\n }\n\n const currentDepPath = optimizedDependencyEntries.get(dep);\n if (!currentDepPath) {\n continue;\n }\n\n const fileName = basename(currentDepPath.name);\n const entryName = prepareEntryFileName(getCompiledDepCachePath(rootPath, fileName), rootDir);\n\n fileNameToDependencyMap.set(entryName, dep);\n optimizedDependencyEntries.set(dep, {\n ...currentDepPath,\n name: entryName,\n });\n }\n }\n\n return { optimizedDependencyEntries, fileNameToDependencyMap };\n}\n\n/**\n * Configures and returns Rollup plugins for bundling external dependencies.\n * Sets up virtual modules, TypeScript compilation, CommonJS transformation, and workspace resolution.\n */\nasync function getInputPlugins(\n virtualDependencies: Map<string, { name: string; virtual: string }>,\n {\n transpilePackages,\n workspaceMap,\n bundlerOptions,\n projectRoot,\n rootDir,\n externals,\n platform,\n alias,\n }: {\n transpilePackages: Set<string>;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n bundlerOptions: { noBundling: boolean };\n projectRoot: string;\n rootDir: string;\n externals: string[];\n platform: BundlerPlatform;\n alias: Record<string, string>;\n },\n) {\n const transpilePackagesMap = new Map<string, string>();\n for (const pkg of transpilePackages) {\n const dir = await getPackageRootPath(pkg);\n\n if (dir) {\n transpilePackagesMap.set(pkg, slash(dir));\n } else {\n transpilePackagesMap.set(pkg, workspaceMap.get(pkg)?.location ?? pkg);\n }\n }\n\n return [\n virtual(\n Array.from(virtualDependencies.entries()).reduce<Record<string, string>>((acc, [dep, virtualDep]) => {\n acc[`#virtual-${dep}`] = virtualDep.virtual;\n return acc;\n }, {}),\n ),\n moduleAlias(alias, path.join(rootDir, 'package.json'), platform),\n tsConfigPaths({ cwd: projectRoot }),\n protocolExternalResolver(),\n subpathExternalsResolver(externals, workspaceMap),\n transpilePackagesMap.size\n ? esbuild({\n format: 'esm',\n include: [\n // Match files from transpilePackages by their actual directory paths\n // but exclude any nested node_modules\n ...[...transpilePackagesMap.values()].map(p => {\n if (path.isAbsolute(p)) {\n return new RegExp(`^${p.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}/(?!.*node_modules).*$`);\n }\n return new RegExp(`\\/${p.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}/(?!.*node_modules).*$`);\n }),\n // Also match workspace packages resolved through node_modules symlinks\n // (common in pnpm workspaces). Match by package name in node_modules path.\n ...[...transpilePackagesMap.keys()].map(pkgName => {\n const escapedPkgName = pkgName.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n return new RegExp(`/node_modules/${escapedPkgName}/(?!.*node_modules).*$`);\n }),\n ],\n // Disable the default /node_modules/ exclusion from rollup-plugin-esbuild.\n // In pnpm workspaces, nodeResolve resolves workspace packages through node_modules\n // symlinks, so the resolved paths contain \"node_modules\". Without this, workspace\n // package .ts files won't be transpiled even if they match the include patterns.\n exclude: [],\n })\n : null,\n bundlerOptions.noBundling\n ? ({\n name: 'alias-optimized-deps',\n async resolveId(id, importer, options) {\n if (!virtualDependencies.has(id)) {\n return null;\n }\n\n const info = virtualDependencies.get(id)!;\n // go from ./node_modules/.cache/index.js to ./pkg\n const packageRootPath = path.join(rootDir, path.dirname(path.dirname(path.dirname(info.name))));\n const pkgJsonBuffer = await readFile(path.join(packageRootPath, 'package.json'), 'utf-8');\n const pkgJson = JSON.parse(pkgJsonBuffer);\n if (!pkgJson) {\n return null;\n }\n\n const pkgName = pkgJson.name || '';\n let resolvedPath: string | undefined = resolve.exports(pkgJson, id.replace(pkgName, '.'))?.[0];\n if (!resolvedPath) {\n resolvedPath = pkgJson!.main ?? 'index.js';\n }\n\n const resolved = await this.resolve(path.posix.join(packageRootPath, resolvedPath!), importer, options);\n return resolved;\n },\n } satisfies Plugin)\n : null,\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n bundlerOptions.noBundling\n ? null\n : nodeResolve({\n ...getNodeResolveOptions(platform),\n rootDir: projectRoot,\n modulePaths: [path.join(rootDir, 'node_modules')],\n }),\n bundlerOptions.noBundling ? esmShim() : null,\n // hono is imported from deployer, so we need to resolve from here instead of the project root\n aliasHono(),\n json(),\n nodeGypDetector(),\n moduleResolveMap(externals, rootDir),\n {\n name: 'not-found-resolver',\n resolveId: {\n order: 'post',\n async handler(id, importer) {\n if (!importer) {\n return null;\n }\n\n if (!id.endsWith('.node')) {\n return null;\n }\n\n const pkgInfo = await getPackageInfo(importer);\n const packageName = pkgInfo?.packageJson?.name || id;\n throw new MastraBaseError({\n id: 'DEPLOYER_BUNDLE_EXTERNALS_MISSING_NATIVE_BUILD',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: {\n importFile: importer,\n packageName,\n },\n text: `We found a possible binary dependency in your bundle. ${id} was not found when imported at ${importer}.\n\nPlease consider adding \\`${packageName}\\` to your externals, or updating this import to not end with \".node\".\n\nexport const mastra = new Mastra({\n bundler: {\n externals: [\"${packageName}\"],\n }\n})`,\n });\n },\n },\n } satisfies Plugin,\n ].filter(Boolean);\n}\n\n/**\n * Executes the Rollup build process for virtual dependencies using configured plugins.\n * Bundles all virtual dependency modules into optimized ESM files with proper external handling.\n */\nasync function buildExternalDependencies(\n virtualDependencies: Map<string, VirtualDependency>,\n {\n externals,\n packagesToTranspile,\n workspaceMap,\n projectRoot,\n rootDir,\n outputDir,\n bundlerOptions,\n platform,\n alias,\n }: {\n externals: string[];\n packagesToTranspile: Set<string>;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n projectRoot: string;\n rootDir: string;\n outputDir: string;\n bundlerOptions: {\n isDev: boolean;\n externalsPreset: boolean;\n };\n platform: BundlerPlatform;\n alias: Record<string, string>;\n },\n) {\n /**\n * If there are no virtual dependencies to bundle, return an empty array to avoid Rollup errors.\n */\n if (virtualDependencies.size === 0) {\n return [] as unknown as [OutputChunk, ...(OutputAsset | OutputChunk)[]];\n }\n\n const noBundling = bundlerOptions.isDev || bundlerOptions.externalsPreset;\n\n const plugins = await getInputPlugins(virtualDependencies, {\n transpilePackages: packagesToTranspile,\n workspaceMap,\n bundlerOptions: {\n noBundling,\n },\n projectRoot,\n rootDir,\n externals,\n platform,\n alias,\n });\n\n const aliasSources = new Set(Object.keys(alias));\n const rollupExternals = externals.filter(external => !aliasSources.has(external));\n\n const bundler = await rollup({\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n input: Array.from(virtualDependencies.entries()).reduce<Record<string, string>>((acc, [dep, virtualDep]) => {\n acc[virtualDep.name] = `#virtual-${dep}`;\n return acc;\n }, {}),\n external: rollupExternals,\n treeshake: noBundling ? false : 'safest',\n plugins,\n });\n\n const outputDirRelative = prepareEntryFileName(outputDir, rootDir);\n\n const { output } = await bundler.write({\n format: 'esm',\n dir: rootDir,\n entryFileNames: '[name].mjs',\n // used to get the filename of the actual error\n sourcemap: true,\n /**\n * Rollup creates chunks for common dependencies, but these chunks are by default written to the root directory instead of respecting the entryFileNames structure.\n * So we want to write them to the `.mastra/output` folder as well.\n */\n chunkFileNames: chunkInfo => {\n /**\n * This whole bunch of logic directly below is for the edge case shown in the e2e-tests/monorepo with \"tinyrainbow\" package. It's used in multiple places in the package and as such Rollup creates a shared chunk for it. During 'mastra dev' / with externals: true, we don't want that chunk to show up in the '.mastra/output' folder (outputDirRelative) but inside <pkg>/node_modules/.cache instead.\n * We only care about this for the \"noBundling\" case!\n */\n if (noBundling) {\n const importedFromPackages = new Set<string>();\n\n for (const moduleId of chunkInfo.moduleIds) {\n const normalized = slash(moduleId);\n for (const [pkgName, pkgInfo] of workspaceMap.entries()) {\n const location = slash(pkgInfo.location);\n if (normalized.startsWith(location)) {\n importedFromPackages.add(pkgName);\n break;\n }\n }\n }\n\n // A chunk spanning multiple workspace packages has no single owning cache dir, so it falls through to the output dir.\n if (importedFromPackages.size === 1) {\n const [pkgName] = importedFromPackages;\n const workspaceLocation = workspaceMap.get(pkgName!)!.location;\n return prepareEntryFileName(getCompiledDepCachePath(workspaceLocation, '[name].mjs'), rootDir);\n }\n }\n\n return `${outputDirRelative}/[name].mjs`;\n },\n assetFileNames: `${outputDirRelative}/[name][extname]`,\n hoistTransitiveImports: false,\n });\n\n await bundler.close();\n\n return output;\n}\n\n/**\n * Recursively searches through Rollup output chunks to find which module imports a specific external dependency.\n * Used to build the module resolution map for proper external dependency tracking.\n */\nfunction findExternalImporter(\n module: OutputChunk,\n external: string,\n allOutputs: OutputChunk[],\n visited = new Set<string>(),\n): OutputChunk | null {\n if (visited.has(module.fileName)) {\n return null;\n }\n\n visited.add(module.fileName);\n const capturedFiles = new Set<string>();\n\n for (const id of [...module.imports, ...module.dynamicImports]) {\n if (isDependencyPartOfPackage(id, external)) {\n return module;\n } else if (id.endsWith('.mjs')) {\n capturedFiles.add(id);\n }\n }\n\n for (const file of capturedFiles) {\n const nextModule = allOutputs.find(o => o.fileName === file);\n if (nextModule) {\n const importer = findExternalImporter(nextModule, external, allOutputs, visited);\n\n if (importer) {\n return importer;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Bundles vendor dependencies identified in the analysis step.\n * Creates virtual modules for each dependency and bundles them using rollup.\n *\n * @param depsToOptimize - Map of dependencies to optimize with their metadata (exported bindings, rootPath, isWorkspace)\n * @param outputDir - Directory where bundled files will be written\n * @param logger - Logger instance for debugging\n * @returns Object containing bundle output and reference map for validation\n */\nexport async function bundleExternals(\n depsToOptimize: Map<string, DependencyMetadata>,\n outputDir: string,\n options: {\n bundlerOptions: NormalizedExternals & {\n isDev?: boolean;\n transpilePackages?: string[];\n alias?: Record<string, string>;\n };\n projectRoot?: string;\n workspaceRoot?: string;\n workspaceMap?: Map<string, WorkspacePackageInfo>;\n platform?: BundlerPlatform;\n },\n) {\n const {\n workspaceRoot = null,\n workspaceMap = new Map(),\n projectRoot = outputDir,\n bundlerOptions,\n platform = 'node',\n } = options;\n const { externalsPreset, mergedExternals, transpilePackages = [], isDev = false, alias = {} } = bundlerOptions;\n\n const workspacePackagesNames = Array.from(workspaceMap.keys());\n const packagesToTranspile = new Set([...transpilePackages, ...workspacePackagesNames]);\n\n /**\n * When externals: true, we need to extract non-workspace deps from depsToOptimize\n * and add them directly to usedExternals instead of bundling them.\n */\n const extractedExternals = new Map<string, string>();\n if (externalsPreset) {\n for (const [dep, metadata] of depsToOptimize.entries()) {\n if (!metadata.isWorkspace) {\n // Add to extracted externals - use rootPath or fallback to package name\n extractedExternals.set(dep, metadata.rootPath ?? dep);\n // Remove from depsToOptimize so it won't be bundled\n depsToOptimize.delete(dep);\n }\n }\n }\n\n const { optimizedDependencyEntries, fileNameToDependencyMap } = createVirtualDependencies(depsToOptimize, {\n workspaceRoot,\n outputDir,\n projectRoot,\n bundlerOptions: {\n isDev,\n externalsPreset,\n },\n });\n\n const output = await buildExternalDependencies(optimizedDependencyEntries, {\n externals: mergedExternals,\n packagesToTranspile,\n workspaceMap,\n projectRoot,\n rootDir: workspaceRoot || projectRoot,\n outputDir,\n bundlerOptions: {\n isDev,\n externalsPreset,\n },\n platform,\n alias,\n });\n\n const moduleResolveMap = new Map<string, Map<string, string>>();\n const filteredChunks = output.filter(o => o.type === 'chunk');\n\n for (const o of filteredChunks.filter(o => o.isEntry || o.isDynamicEntry)) {\n for (const external of mergedExternals) {\n if (DEPS_TO_IGNORE.includes(external)) {\n continue;\n }\n\n const importer = findExternalImporter(o, external, filteredChunks);\n\n if (importer) {\n const fullPath = path.join(workspaceRoot || projectRoot, importer.fileName);\n let innerMap = moduleResolveMap.get(fullPath);\n\n if (!innerMap) {\n innerMap = new Map<string, string>();\n moduleResolveMap.set(fullPath, innerMap);\n }\n\n if (importer.moduleIds.length) {\n innerMap.set(\n external,\n importer.moduleIds[importer.moduleIds.length - 1]?.startsWith('\\x00virtual:#virtual')\n ? importer.moduleIds[importer.moduleIds.length - 2]!\n : importer.moduleIds[importer.moduleIds.length - 1]!,\n );\n }\n }\n }\n }\n\n /**\n * Convert moduleResolveMap to a plain object with prototype-less objects\n */\n const usedExternals = Object.create(null) as Record<string, Record<string, string>>;\n for (const [fullPath, innerMap] of moduleResolveMap) {\n const innerObj = Object.create(null) as Record<string, string>;\n for (const [external, value] of innerMap) {\n innerObj[external] = value;\n }\n usedExternals[fullPath] = innerObj;\n }\n\n /**\n * When externals: true, add the extracted non-workspace deps to usedExternals\n * using a synthetic entry path to track them.\n */\n if (extractedExternals.size > 0) {\n const syntheticPath = path.join(workspaceRoot || projectRoot, '__externals__');\n const externalsObj = Object.create(null) as Record<string, string>;\n for (const [dep, rootPath] of extractedExternals) {\n externalsObj[dep] = rootPath;\n }\n usedExternals[syntheticPath] = externalsObj;\n }\n\n return { output, fileNameToDependencyMap, usedExternals };\n}\n","import { DEPRECATED_EXTERNALS, GLOBAL_EXTERNALS } from './constants';\n\nexport interface NormalizedExternals {\n externalsPreset: boolean;\n mergedExternals: string[];\n}\n\nexport function normalizeExternals(externals?: boolean | string[] | null, defaultPreset = false): NormalizedExternals {\n const explicitExternals = Array.isArray(externals) ? externals : [];\n\n return {\n externalsPreset: externals === true || (defaultPreset && externals !== false),\n mergedExternals: [...new Set([...GLOBAL_EXTERNALS, ...DEPRECATED_EXTERNALS, ...explicitExternals].filter(Boolean))],\n };\n}\n","import { types as t } from '@babel/core';\nimport type { PluginObject } from '@babel/core';\n\nexport function checkConfigExport(result: { hasValidConfig: boolean; projectType?: string }): PluginObject {\n // Track which local variable names are assigned to `new Mastra()`\n const mastraVars = new Set<string>();\n\n return {\n visitor: {\n NewExpression(path) {\n if (!t.isIdentifier(path.node.callee)) {\n return;\n }\n\n const binding = path.scope.getBinding(path.node.callee.name);\n if (\n binding?.path.isImportSpecifier() &&\n t.isIdentifier(binding.path.node.imported, { name: 'MastraFactory' })\n ) {\n result.projectType = 'factory';\n }\n },\n ExportNamedDeclaration(path) {\n const decl = path.node.declaration;\n // 1) export const mastra = new Mastra(...)\n if (t.isVariableDeclaration(decl)) {\n const varDecl = decl.declarations[0];\n if (\n t.isIdentifier(varDecl?.id, { name: 'mastra' }) &&\n t.isNewExpression(varDecl.init) &&\n t.isIdentifier(varDecl.init.callee, { name: 'Mastra' })\n ) {\n result.hasValidConfig = true;\n }\n }\n /**\n * 2) export { foo as mastra }\n * 3) export { mastra }\n * 4) export { mastra, foo }\n */\n if (Array.isArray(path.node.specifiers)) {\n for (const spec of path.node.specifiers) {\n if (\n t.isExportSpecifier(spec) &&\n t.isIdentifier(spec.exported, { name: 'mastra' }) &&\n t.isIdentifier(spec.local) &&\n mastraVars.has(spec.local.name)\n ) {\n result.hasValidConfig = true;\n }\n }\n }\n },\n // For cases 2-4 we need to track whether those variables are assigned to `new Mastra()`\n VariableDeclaration(path) {\n for (const decl of path.node.declarations) {\n if (\n t.isIdentifier(decl.id) &&\n t.isNewExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: 'Mastra' })\n ) {\n mastraVars.add(decl.id.name);\n }\n }\n },\n },\n };\n}\n","import type { PluginObject, NodePath } from '@babel/core';\nimport { types as t } from '@babel/core';\n\n/**\n * Extract string value from a node (supports StringLiteral and TemplateLiteral without expressions)\n */\nfunction getStringValue(node: t.Node | null | undefined): string | null {\n if (!node) return null;\n\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n\n // Handle template literals without expressions: `my-transport`\n if (t.isTemplateLiteral(node) && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0]?.value.cooked ?? null;\n }\n\n return null;\n}\n\n/**\n * Extract target value from an object property\n */\nfunction extractTargetFromProperty(prop: t.ObjectProperty | t.ObjectMethod | t.SpreadElement): string | null {\n if (!t.isObjectProperty(prop)) return null;\n\n const key = prop.key;\n if (t.isIdentifier(key, { name: 'target' }) || (t.isStringLiteral(key) && key.value === 'target')) {\n return getStringValue(prop.value);\n }\n\n return null;\n}\n\n/**\n * Check if a binding came from a pino import/require\n */\nfunction isBindingFromPino(path: NodePath<t.CallExpression>, identifierName: string): boolean {\n const binding = path.scope.getBinding(identifierName);\n if (!binding) {\n // No binding found - could be global `pino` (unlikely but accept literal name)\n return identifierName === 'pino';\n }\n\n const bindingPath = binding.path;\n\n // Import default: import pino from 'pino'\n if (bindingPath.isImportDefaultSpecifier()) {\n const importDecl = bindingPath.parentPath;\n if (importDecl?.isImportDeclaration()) {\n return importDecl.node.source.value === 'pino';\n }\n }\n\n // Import namespace: import * as p from 'pino'\n if (bindingPath.isImportNamespaceSpecifier()) {\n const importDecl = bindingPath.parentPath;\n if (importDecl?.isImportDeclaration()) {\n return importDecl.node.source.value === 'pino';\n }\n }\n\n // Import specifier: import { default as logger } from 'pino'\n if (bindingPath.isImportSpecifier()) {\n const importDecl = bindingPath.parentPath;\n if (importDecl?.isImportDeclaration() && importDecl.node.source.value === 'pino') {\n const imported = bindingPath.node.imported;\n if (t.isIdentifier(imported) && imported.name === 'default') return true;\n if (t.isStringLiteral(imported) && imported.value === 'default') return true;\n }\n return false;\n }\n\n // Require: const pino = require('pino')\n if (bindingPath.isVariableDeclarator()) {\n const init = bindingPath.node.init;\n if (\n t.isCallExpression(init) &&\n t.isIdentifier(init.callee, { name: 'require' }) &&\n init.arguments.length === 1 &&\n t.isStringLiteral(init.arguments[0]) &&\n init.arguments[0].value === 'pino'\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Check if a call expression is a pino.transport() call using scope analysis\n */\nfunction isPinoTransportCall(path: NodePath<t.CallExpression>): boolean {\n const callee = path.node.callee;\n\n // Must be member expression like `something.transport`\n if (!t.isMemberExpression(callee)) return false;\n if (!t.isIdentifier(callee.property, { name: 'transport' })) return false;\n\n // Handle `pino.transport()` or `logger.transport()` where logger is bound to pino\n if (t.isIdentifier(callee.object)) {\n return isBindingFromPino(path, callee.object.name);\n }\n\n // Handle `pino.default.transport()` pattern (namespace import interop)\n if (\n t.isMemberExpression(callee.object) &&\n t.isIdentifier(callee.object.object) &&\n t.isIdentifier(callee.object.property, { name: 'default' })\n ) {\n return isBindingFromPino(path, callee.object.object.name);\n }\n\n return false;\n}\n\n/**\n * Extract transport targets from a pino.transport() argument\n */\nfunction extractTransportsFromArg(arg: t.Node): string[] {\n const targets: string[] = [];\n\n if (!t.isObjectExpression(arg)) return targets;\n\n for (const prop of arg.properties) {\n if (!t.isObjectProperty(prop)) continue;\n\n const key = prop.key;\n const keyName = t.isIdentifier(key) ? key.name : t.isStringLiteral(key) ? key.value : null;\n\n if (keyName === 'target') {\n // Single target: { target: \"package-name\" }\n const value = getStringValue(prop.value);\n if (value) {\n targets.push(value);\n }\n } else if (keyName === 'targets') {\n // Multiple targets: { targets: [{ target: \"pkg1\" }, { target: \"pkg2\" }] }\n if (t.isArrayExpression(prop.value)) {\n for (const element of prop.value.elements) {\n if (t.isObjectExpression(element)) {\n for (const innerProp of element.properties) {\n const targetValue = extractTargetFromProperty(innerProp);\n if (targetValue) {\n targets.push(targetValue);\n }\n }\n }\n }\n }\n }\n }\n\n return targets;\n}\n\n// Also matches `x[transport](`: the detector does not check `computed` on the member expression.\nconst TRANSPORT_CALL_RE = /[.[]\\s*transport\\s*\\]?\\s*[(<]/;\nconst PINO_SOURCE_RE = /['\"]pino['\"]/;\nconst GLOBAL_PINO_TRANSPORT_RE = /\\bpino\\s*(?:\\.\\s*default\\s*)?(?:\\.\\s*transport\\b|\\[\\s*transport\\s*\\])/;\n\n/**\n * Cheap text pre-check so callers can skip a full Babel parse of large bundles.\n * Must stay a superset of what `detectPinoTransports` matches: every match needs a\n * `.transport(` call and either a `'pino'` import/require source or an unbound `pino` identifier.\n */\nexport function mayContainPinoTransport(code: string): boolean {\n if (!code.includes('pino')) return false;\n if (!TRANSPORT_CALL_RE.test(code)) return false;\n return PINO_SOURCE_RE.test(code) || GLOBAL_PINO_TRANSPORT_RE.test(code);\n}\n\n/**\n * Babel plugin to detect pino transport targets in code.\n * Matches patterns like:\n * - pino.transport({ target: \"package-name\" })\n * - pino.transport({ targets: [{ target: \"package-name\" }] })\n * - variable.transport({ target: \"...\" }) where variable is assigned from pino import\n *\n * @param transports - Set to collect detected transport package names\n * @returns Babel plugin object\n */\nexport function detectPinoTransports(transports: Set<string>): PluginObject {\n return {\n name: 'detect-pino-transports',\n visitor: {\n CallExpression(path) {\n if (!isPinoTransportCall(path)) return;\n\n // Process first argument which should be the transport config object\n const firstArg = path.node.arguments[0];\n if (firstArg && !t.isSpreadElement(firstArg)) {\n for (const target of extractTransportsFromArg(firstArg)) {\n transports.add(target);\n }\n }\n },\n },\n };\n}\n","import { existsSync } from 'node:fs';\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { basename, isAbsolute, join, relative } from 'node:path';\nimport { transformAsync, transformSync } from '@babel/core';\nimport { ErrorCategory, ErrorDomain, MastraError } from '@internal/core/error';\nimport type { IMastraLogger } from '@internal/core/logger';\nimport type { OutputAsset, OutputChunk } from 'rollup';\nimport * as stackTraceParser from 'stacktrace-parser';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport type { WorkspacePackageInfo } from '../bundler/workspaceDependencies';\nimport { validate, ValidationError } from '../validator/validate';\nimport { analyzeEntry } from './analyze/analyzeEntry';\nimport { bundleExternals } from './analyze/bundleExternals';\nimport { DEPS_TO_IGNORE } from './analyze/constants';\nimport { normalizeExternals } from './analyze/externals';\nimport { checkConfigExport } from './babel/check-config-export';\nimport { detectPinoTransports, mayContainPinoTransport } from './babel/detect-pino-transports';\nimport { getPackageMetadata } from './package-info';\nimport type { DependencyMetadata, ExternalDependencyInfo, InternalBundlerOptions } from './types';\nimport {\n getPackageName,\n isBareModuleSpecifier,\n isBuiltinModule,\n isDependencyPartOfPackage,\n isExternalProtocolImport,\n slash,\n} from './utils';\nimport type { BundlerPlatform } from './utils';\n\ntype ErrorId =\n | 'DEPLOYER_ANALYZE_MODULE_NOT_FOUND'\n | 'DEPLOYER_ANALYZE_MISSING_NATIVE_BUILD'\n | 'DEPLOYER_ANALYZE_TYPE_ERROR';\n\nfunction preferDependencyInfo(\n existing: ExternalDependencyInfo | undefined,\n incoming: ExternalDependencyInfo,\n): ExternalDependencyInfo {\n return {\n version: incoming.version ?? existing?.version,\n packageSpec: incoming.packageSpec ?? existing?.packageSpec,\n };\n}\n\nasync function resolveDependencyInfo(\n dep: string,\n existing: ExternalDependencyInfo | undefined,\n parentPaths: string[],\n): Promise<ExternalDependencyInfo> {\n if (existing?.version || existing?.packageSpec) {\n return existing;\n }\n\n const packageName = getPackageName(dep);\n const packageNames = [...new Set([dep, packageName].filter(Boolean) as string[])];\n\n for (const parentPath of parentPaths) {\n for (const name of packageNames) {\n const metadata = await getPackageMetadata(name, parentPath);\n if (metadata.version || metadata.packageSpec) {\n return preferDependencyInfo(existing, metadata);\n }\n }\n }\n\n for (const name of packageNames) {\n const metadata = await getPackageMetadata(name);\n if (metadata.version || metadata.packageSpec) {\n return preferDependencyInfo(existing, metadata);\n }\n }\n\n return existing ?? {};\n}\n\nfunction importerParentPaths(importerId: string | undefined, base: string[]): string[] {\n if (!importerId || importerId.startsWith('\\x00') || !isAbsolute(importerId)) {\n return base;\n }\n\n return [...new Set([importerId, ...base])];\n}\n\nfunction getLastConcreteModuleId(moduleIds: string[]): string | undefined {\n return moduleIds.findLast(id => !id.startsWith('\\x00') && isAbsolute(id));\n}\n\nfunction throwExternalDependencyError({\n errorId,\n moduleName,\n packageName,\n messagePrefix,\n}: {\n errorId: ErrorId;\n moduleName: string;\n packageName: string;\n messagePrefix: string;\n}): never {\n throw new MastraError({\n id: errorId,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: {\n importFile: moduleName,\n packageName: packageName,\n },\n text: `${messagePrefix} \\`${packageName}\\` to your externals.\n\nexport const mastra = new Mastra({\n bundler: {\n externals: [\"${packageName}\"],\n }\n})`,\n });\n}\n\nfunction getPackageNameFromBundledModuleName(moduleName: string) {\n // New encoding uses __ to separate path segments (e.g., @inner__inner-tools -> @inner/inner-tools)\n if (moduleName.includes('__')) {\n return moduleName.replaceAll('__', '/');\n }\n\n // Legacy fallback for old format using - as separator\n const chunks = moduleName.split('-');\n\n if (!chunks.length) {\n return moduleName;\n }\n\n if (chunks[0]?.startsWith('@')) {\n return chunks.slice(0, 2).join('/');\n }\n\n return chunks[0];\n}\n\nfunction validateError(\n err: ValidationError | Error,\n file: OutputChunk,\n {\n binaryMapData,\n workspaceMap,\n }: {\n binaryMapData: Record<string, string[]>;\n logger: IMastraLogger;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n },\n) {\n let moduleName: string | undefined | null = null;\n let errorConfig: {\n id: ErrorId;\n messagePrefix: string;\n } | null = null;\n\n if (err instanceof ValidationError) {\n const parsedStack = stackTraceParser.parse(err.stack);\n if (err.type === 'TypeError') {\n const pkgNameRegex = /.*node_modules\\/([^\\/]+)\\//;\n const stacktraceFrame = parsedStack.find(frame => frame.file && pkgNameRegex.test(frame.file));\n if (stacktraceFrame) {\n const match = stacktraceFrame.file!.match(pkgNameRegex);\n moduleName = match?.[1] ?? getPackageNameFromBundledModuleName(basename(file.name));\n } else {\n moduleName = getPackageNameFromBundledModuleName(basename(file.name));\n }\n\n errorConfig = {\n id: 'DEPLOYER_ANALYZE_TYPE_ERROR',\n messagePrefix: `Mastra wasn't able to bundle \"${moduleName}\", might be an older commonJS module. Please add`,\n };\n } else if (err.stack?.includes?.('[ERR_MODULE_NOT_FOUND]')) {\n moduleName = err.message.match(/Cannot find package '([^']+)'/)?.[1];\n\n const parentModuleName = getPackageNameFromBundledModuleName(basename(file.name));\n\n errorConfig = {\n id: 'DEPLOYER_ANALYZE_MODULE_NOT_FOUND',\n messagePrefix: `Mastra wasn't able to build your project, We couldn't load \"${moduleName}\" from \"${parentModuleName}\". Make sure \"${moduleName}\" is installed or add`,\n };\n\n // if they are the same, the feedback we give to our user is not really useful and probably something else went wrong\n if (moduleName === parentModuleName) {\n return;\n }\n }\n }\n\n if (err.message.includes('No native build was found')) {\n const pkgName = getPackageNameFromBundledModuleName(basename(file.name));\n moduleName = binaryMapData[file.fileName]?.[0] ?? pkgName;\n errorConfig = {\n id: 'DEPLOYER_ANALYZE_MISSING_NATIVE_BUILD',\n messagePrefix: 'We found a binary dependency in your bundle but we cannot bundle it yet. Please add',\n };\n }\n\n if (moduleName && workspaceMap.has(moduleName)) {\n throw new MastraError({\n id: 'DEPLOYER_ANALYZE_ERROR_IN_WORKSPACE',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: {\n // importFile: moduleName,\n packageName: moduleName,\n },\n text: `We found an error in the ${moduleName} workspace package. Please find the offending package and fix the error.\n Error: ${err.stack}`,\n });\n }\n\n if (errorConfig && moduleName) {\n throwExternalDependencyError({\n errorId: errorConfig.id,\n moduleName: moduleName!,\n packageName: moduleName!,\n messagePrefix: errorConfig.messagePrefix,\n });\n }\n}\n\nasync function validateFile(\n root: string,\n file: OutputChunk,\n {\n binaryMapData,\n moduleResolveMapLocation,\n logger,\n workspaceMap,\n stubbedExternals,\n }: {\n binaryMapData: Record<string, string[]>;\n moduleResolveMapLocation: string;\n logger: IMastraLogger;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n stubbedExternals: string[];\n },\n) {\n try {\n if (!file.isDynamicEntry && file.isEntry) {\n // validate if the chunk is actually valid, a failsafe to make sure bundling didn't make any mistakes\n await validate(join(root, file.fileName), {\n moduleResolveMapLocation,\n injectESMShim: false,\n stubbedExternals,\n });\n }\n } catch (err) {\n let errorToHandle = err;\n if (\n err instanceof ValidationError &&\n err.type === 'ReferenceError' &&\n (err.message.startsWith('__dirname') || err.message.startsWith('__filename'))\n ) {\n try {\n await validate(join(root, file.fileName), {\n moduleResolveMapLocation,\n injectESMShim: true,\n stubbedExternals,\n });\n errorToHandle = null;\n } catch (err) {\n errorToHandle = err;\n }\n }\n\n if (errorToHandle instanceof Error) {\n validateError(errorToHandle, file, { binaryMapData, logger, workspaceMap });\n }\n }\n}\n\n/**\n * Validates the bundled output by attempting to import each generated module.\n * Tracks external dependencies that couldn't be bundled.\n *\n * @param output - Bundle output from rollup\n * @param reverseVirtualReferenceMap - Map to resolve virtual module names back to original deps\n * @param outputDir - Directory containing the bundled files\n * @param logger - Logger instance for debugging\n * @param workspaceMap - Map of workspace packages that gets directly passed through for later consumption\n * @returns Analysis result containing dependency mappings\n */\nasync function validateOutput(\n {\n output,\n reverseVirtualReferenceMap,\n usedExternals,\n mergedExternals,\n outputDir,\n projectRoot,\n workspaceMap,\n depsVersionInfo,\n }: {\n output: (OutputChunk | OutputAsset)[];\n reverseVirtualReferenceMap: Map<string, string>;\n usedExternals: Record<string, Record<string, string>>;\n mergedExternals: string[];\n outputDir: string;\n projectRoot: string;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n depsVersionInfo: Map<string, ExternalDependencyInfo>;\n },\n logger: IMastraLogger,\n) {\n const result = {\n dependencies: new Map<string, string>(),\n externalDependencies: new Map<string, ExternalDependencyInfo>(),\n workspaceMap,\n };\n\n const externalMetadataParentPaths = [\n projectRoot,\n ...Array.from(workspaceMap.values()).map(pkgInfo => pkgInfo.location),\n ];\n\n // store resolve map for validation\n // we should resolve the version of the deps\n for (const deps of Object.values(usedExternals)) {\n for (const [dep, importerId] of Object.entries(deps)) {\n if (isExternalProtocolImport(dep)) {\n continue;\n }\n\n const pkgName = getPackageName(dep);\n if (pkgName) {\n // Use version info from analysis if available, then resolve from the module that imported the external.\n const versionInfo = depsVersionInfo.get(dep) || depsVersionInfo.get(pkgName);\n const dependencyInfo = await resolveDependencyInfo(\n dep,\n versionInfo,\n importerParentPaths(importerId, externalMetadataParentPaths),\n );\n result.externalDependencies.set(\n pkgName,\n preferDependencyInfo(result.externalDependencies.get(pkgName), dependencyInfo),\n );\n }\n }\n }\n let binaryMapData: Record<string, string[]> = {};\n\n if (existsSync(join(outputDir, 'binary-map.json'))) {\n const binaryMap = await readFile(join(outputDir, 'binary-map.json'), 'utf-8');\n binaryMapData = JSON.parse(binaryMap);\n }\n\n const stubbedExternals = [...new Set([...mergedExternals, ...DEPS_TO_IGNORE, ...result.externalDependencies.keys()])];\n\n for (const file of output) {\n if (file.type === 'asset') {\n continue;\n }\n\n logger.debug('Validating module', { fileName: file.fileName });\n if (file.isEntry && reverseVirtualReferenceMap.has(file.name)) {\n result.dependencies.set(reverseVirtualReferenceMap.get(file.name)!, file.fileName);\n }\n\n // validate if the chunk is actually valid, a failsafe to make sure bundling didn't make any mistakes\n await validateFile(projectRoot, file, {\n binaryMapData,\n moduleResolveMapLocation: join(outputDir, 'module-resolve-map.json'),\n logger,\n workspaceMap,\n stubbedExternals,\n });\n }\n\n return result;\n}\n\n/**\n * Main bundle analysis function that orchestrates the three-step process:\n * 1. Analyze dependencies\n * 2. Bundle dependencies modules\n * 3. Validate generated bundles\n *\n * This helps identify which dependencies need to be externalized vs bundled.\n */\nexport async function analyzeBundle(\n entries: string[],\n mastraEntry: string,\n {\n outputDir,\n projectRoot,\n platform,\n isDev = false,\n bundlerOptions,\n env = { 'process.env.NODE_ENV': JSON.stringify('production') },\n configEntryFile = mastraEntry,\n }: {\n outputDir: string;\n projectRoot: string;\n platform: BundlerPlatform;\n isDev?: boolean;\n bundlerOptions?: Pick<\n InternalBundlerOptions,\n 'externals' | 'externalsPreset' | 'enableSourcemap' | 'dynamicPackages' | 'alias'\n > | null;\n env?: Record<string, string>;\n /**\n * File holding `new Mastra({...})`. Differs from `mastraEntry` when that is the generated\n * file-based agents wrapper, which only imports it.\n */\n configEntryFile?: string;\n },\n logger: IMastraLogger,\n) {\n const mastraConfig = await readFile(configEntryFile, 'utf-8');\n const mastraConfigResult: { hasValidConfig: boolean; projectType?: string } = { hasValidConfig: false };\n\n await transformAsync(mastraConfig, {\n filename: configEntryFile,\n presets: [import.meta.resolve('@babel/preset-typescript')],\n plugins: [() => checkConfigExport(mastraConfigResult)],\n });\n\n if (!mastraConfigResult.hasValidConfig) {\n logger.warn('Invalid Mastra config', {\n details:\n 'Please make sure that your entry file looks like this:\\nexport const mastra = new Mastra({\\n // your options\\n})\\n\\nIf you think your configuration is valid, please open an issue.',\n });\n }\n\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: mastraEntry });\n\n const { externalsPreset, mergedExternals } = normalizeExternals(\n bundlerOptions?.externals,\n bundlerOptions?.externalsPreset,\n );\n const userDynamicPackages = bundlerOptions?.dynamicPackages ?? [];\n\n let index = 0;\n const depsToOptimize = new Map<string, DependencyMetadata>();\n\n // Collect pino transports detected across all entries\n const detectedPinoTransports = new Set<string>();\n\n logger.info('Analyzing dependencies...');\n\n // Track external dependencies with their version info\n const allUsedExternals = new Map<string, ExternalDependencyInfo>();\n // Shared cache prevents re-analyzing the same workspace package across entries and recursive calls.\n const analyzeCache = new Map<string, Awaited<ReturnType<typeof analyzeEntry>>>();\n const activeAnalyzeEntries = new Set<string>();\n for (const entry of entries) {\n const isVirtualFile = entry.includes('\\n') || !existsSync(entry);\n const analyzeResult = await analyzeEntry({ entry, isVirtualFile }, mastraEntry, {\n logger,\n sourcemapEnabled: bundlerOptions?.enableSourcemap ?? false,\n workspaceMap,\n projectRoot,\n env,\n shouldCheckTransitiveDependencies: true,\n analyzeCache,\n activeEntries: activeAnalyzeEntries,\n externals: mergedExternals,\n externalsPreset,\n alias: bundlerOptions?.alias,\n platform,\n configEntryFile,\n });\n\n // The output includes the bundled server code (often several MB), so skip the Babel parse\n // when the text has no possible transport call.\n if (mayContainPinoTransport(analyzeResult.output.code)) {\n transformSync(analyzeResult.output.code, {\n filename: 'pino-detection.js',\n plugins: [() => detectPinoTransports(detectedPinoTransports)],\n configFile: false,\n babelrc: false,\n code: false,\n });\n }\n\n // Write the entry file to the output dir so that we can use it for workspace resolution stuff\n await writeFile(join(outputDir, `entry-${index++}.mjs`), analyzeResult.output.code);\n\n // Merge dependencies from each entry (main, tools, etc.)\n for (const [dep, metadata] of analyzeResult.dependencies.entries()) {\n const isPartOfExternals = mergedExternals.some(external => isDependencyPartOfPackage(dep, external));\n if (isPartOfExternals || (externalsPreset && !metadata.isWorkspace)) {\n // Add all packages coming from src/mastra with their version info\n const pkgName = getPackageName(dep);\n if (pkgName) {\n allUsedExternals.set(pkgName, preferDependencyInfo(allUsedExternals.get(pkgName), metadata));\n }\n continue;\n }\n\n if (depsToOptimize.has(dep)) {\n // Merge with existing exports if dependency already exists\n const existingEntry = depsToOptimize.get(dep)!;\n depsToOptimize.set(dep, {\n ...existingEntry,\n version: metadata.version ?? existingEntry.version,\n packageSpec: metadata.packageSpec ?? existingEntry.packageSpec,\n exports: [...new Set([...existingEntry.exports, ...metadata.exports])],\n });\n } else {\n depsToOptimize.set(dep, metadata);\n }\n }\n }\n\n // Build a map of dependency versions from the full analysis result before dev/externalsPreset pruning.\n // Non-workspace deps are removed from optimization below, but their resolved version/packageSpec metadata\n // is still needed when they become externals.\n const depsVersionInfo = new Map<string, ExternalDependencyInfo>();\n for (const [dep, metadata] of depsToOptimize.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && (metadata.version || metadata.packageSpec)) {\n depsVersionInfo.set(pkgName, preferDependencyInfo(depsVersionInfo.get(pkgName), metadata));\n }\n // Also store by full import path for subpath imports\n if (metadata.version || metadata.packageSpec) {\n depsVersionInfo.set(dep, preferDependencyInfo(depsVersionInfo.get(dep), metadata));\n }\n }\n\n /**\n * Only during `mastra dev` we want to optimize workspace packages. In previous steps we might have added dependencies that are not workspace packages, so we gotta remove them again.\n */\n if (isDev || externalsPreset) {\n for (const [dep, metadata] of depsToOptimize.entries()) {\n if (!metadata.isWorkspace) {\n depsToOptimize.delete(dep);\n }\n }\n }\n\n const sortedDeps = Array.from(depsToOptimize.keys()).sort();\n logger.info('Optimizing dependencies...');\n logger.debug('Sorted dependencies', { deps: sortedDeps });\n\n const { output, fileNameToDependencyMap, usedExternals } = await bundleExternals(depsToOptimize, outputDir, {\n bundlerOptions: {\n externalsPreset,\n mergedExternals,\n isDev,\n alias: bundlerOptions?.alias,\n },\n projectRoot,\n workspaceRoot,\n workspaceMap,\n platform,\n });\n\n // Filesystem-relative workspace paths for filtering workspace imports from rollup output.\n // Normalize to forward slashes so the startsWith check works on Windows where\n // path.relative() produces backslashes but rollup uses forward slashes.\n const relativeWorkspaceFolderPaths = Array.from(workspaceMap.values()).map(pkgInfo =>\n slash(relative(workspaceRoot || projectRoot, pkgInfo.location)),\n );\n\n for (const o of output) {\n if (o.type === 'asset') {\n continue;\n }\n\n const importerId = getLastConcreteModuleId(o.moduleIds);\n\n for (const i of o.imports) {\n if (isBuiltinModule(i)) {\n continue;\n }\n\n // Skip relative imports - they're local chunks, not external packages\n if (i.startsWith('.') || i.startsWith('/')) {\n continue;\n }\n\n if (!isBareModuleSpecifier(i) || isExternalProtocolImport(i)) {\n continue;\n }\n\n // Do not include workspace packages\n if (relativeWorkspaceFolderPaths.some(workspacePath => i.startsWith(workspacePath))) {\n continue;\n }\n\n const pkgName = getPackageName(i);\n\n if (pkgName && workspaceMap.has(pkgName)) {\n continue;\n }\n\n if (pkgName) {\n // Try to get version info from our tracked dependencies, then resolve from the chunk's source module.\n const versionInfo = depsVersionInfo.get(i) || depsVersionInfo.get(pkgName);\n const dependencyInfo = await resolveDependencyInfo(\n i,\n versionInfo,\n importerParentPaths(importerId, [\n projectRoot,\n ...Array.from(workspaceMap.values()).map(pkgInfo => pkgInfo.location),\n ]),\n );\n allUsedExternals.set(pkgName, preferDependencyInfo(allUsedExternals.get(pkgName), dependencyInfo));\n }\n }\n }\n\n const result = await validateOutput(\n {\n output,\n reverseVirtualReferenceMap: fileNameToDependencyMap,\n usedExternals,\n mergedExternals,\n outputDir,\n projectRoot: workspaceRoot || projectRoot,\n workspaceMap,\n depsVersionInfo,\n },\n logger,\n );\n\n /**\n * Build the final set of external dependencies from four sources:\n * 1. result.externalDependencies - externals discovered during bundle validation\n * 2. allUsedExternals - packages detected via static analysis that matched the externals config\n * 3. detectedPinoTransports - pino transports detected by the plugin during bundling\n * 4. userDynamicPackages - user-specified packages loaded dynamically at runtime\n *\n * Prefer entries with version info over entries without\n */\n const mergedExternalDeps = new Map<string, ExternalDependencyInfo>(result.externalDependencies);\n for (const [dep, info] of allUsedExternals) {\n if (isExternalProtocolImport(dep)) {\n continue;\n }\n\n mergedExternalDeps.set(dep, preferDependencyInfo(mergedExternalDeps.get(dep), info));\n }\n\n const externalMetadataParentPaths = [\n projectRoot,\n ...Array.from(workspaceMap.values()).map(pkgInfo => pkgInfo.location),\n // Last resort: resolve from the deployer's own installed location. Some externals are\n // discovered inside externalized packages (e.g. optional dynamic imports like\n // `import('typescript')` in @mastra/core) without being installed in the user's project.\n import.meta.dirname,\n ];\n\n // Retry externals that were discovered without install metadata (e.g. from entry analysis\n // where the package isn't resolvable from the entry's own location).\n for (const [dep, info] of mergedExternalDeps) {\n if (!info.version && !info.packageSpec) {\n mergedExternalDeps.set(dep, await resolveDependencyInfo(dep, info, externalMetadataParentPaths));\n }\n }\n\n // Add pino transports and user dynamic packages\n for (const transport of detectedPinoTransports) {\n if (!mergedExternalDeps.has(transport)) {\n mergedExternalDeps.set(transport, await resolveDependencyInfo(transport, undefined, externalMetadataParentPaths));\n }\n }\n for (const pkg of userDynamicPackages) {\n if (!mergedExternalDeps.has(pkg)) {\n mergedExternalDeps.set(pkg, await resolveDependencyInfo(pkg, undefined, externalMetadataParentPaths));\n }\n }\n\n return {\n ...result,\n externalDependencies: mergedExternalDeps,\n /**\n * Workspace deps that were optimized (after isDev/externalsPreset pruning).\n * Used by the watcher to re-run optimization when workspace sources change.\n */\n depsToOptimize,\n workspaceRoot,\n outputDir,\n ...(mastraConfigResult.projectType ? { projectType: mastraConfigResult.projectType } : {}),\n };\n}\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEA,OAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;CAE5D,IAAI,mBAAmB;;;;;CAMvB,SAAS,MAAM,aAAa;EAE1B,OADY,YAAY,MAAM,IACnB,CAAC,CAAC,OAAO,SAAU,OAAO,MAAM;GACzC,IAAI,cAAc,YAAY,IAAI,KAAK,WAAW,IAAI,KAAK,WAAW,IAAI,KAAK,UAAU,IAAI,KAAK,SAAS,IAAI;GAE/G,IAAI,aACF,MAAM,KAAK,WAAW;GAGxB,OAAO;EACT,GAAG,CAAC,CAAC;CACP;CACA,IAAI,WAAW;CACf,IAAI,eAAe;CAEnB,SAAS,YAAY,MAAM;EACzB,IAAI,QAAQ,SAAS,KAAK,IAAI;EAE9B,IAAI,CAAC,OACH,OAAO;EAGT,IAAI,WAAW,MAAM,MAAM,MAAM,EAAE,CAAC,QAAQ,QAAQ,MAAM;EAE1D,IAAI,SAAS,MAAM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,GAAG,IAAI,CAAC;CACrF;CAEA,MAAM,8BAA8B;EAClC;EACA,GAAG,MAAM,KAAK,aAAa,OAAO,CAAC,CAAC,CAAC,KAAI,YAAW,QAAQ,QAAQ;EAIpE,YAAY;CACd;CAIA,KAAK,MAAM,CAAC,KAAK,SAAS,oBACxB,IAAI,CAAC,KAAK,WAAW,CAAC,KAAK,aACzB,mBAAmB,IAAI,KAAK,MAAM,sBAAsB,KAAK,MAAM,2BAA2B,CAAC;CAKnG,KAAK,MAAM,aAAa,wBACtB,IAAI,CAAC,mBAAmB,IAAI,SAAS,GACnC,mBAAmB,IAAI,WAAW,MAAM,sBAAsB,WAAW,KAAA,GAAW,2BAA2B,CAAC;CAGpH,KAAK,MAAM,OAAO,qBAChB,IAAI,CAAC,mBAAmB,IAAI,GAAG,GAC7B,mBAAmB,IAAI,KAAK,MAAM,sBAAsB,KAAK,KAAA,GAAW,2BAA2B,CAAC;CAIxG,OAAO;EACL,GAAG;EACH,sBAAsB;;;;;EAKtB;EACA;EACA;EACA,GAAI,mBAAmB,cAAc,EAAE,aAAa,mBAAmB,YAAY,IAAI,CAAC;CAC1F;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundler-BZ4fSyJZ.cjs","names":["originalEsbuild","originalEsmShim","statSync","basename","dirname","join","pathExists","readJson","realpathSync","getPackageName","isAbsolute","fileURLToPath","getOriginalPackageInfo","path","findUp","resolve","pathToFileURL","sep","readJSON","getPackageName","pathToFileURL","dirname","sep","getNodeResolveOptions","resolveExports","resolve","resolveModule","rollupAlias","isBareModuleSpecifier","MastraError","ErrorDomain","ErrorCategory","readFile","join","nodeResolve","isBareModuleSpecifier","isExternalProtocolImport","isAbsolute","getPackageName","slash","isExternalProtocolImport","removeDeployer","t","slash","transformAsync","removeDeployerBabelPlugin","isDependencyPartOfPackage","getPackageName","builtinModules","parseTsconfig","createPathsMatcher","slash","fileURLToPath","nodeResolve","getNodeResolveOptions","join","pathToFileURL","optimizeLodashImports","commonjs","json","esbuildMinify","getPackageName"],"sources":["../src/build/plugins/esbuild.ts","../src/build/plugins/esm-shim.ts","../src/build/plugins/local-storage-detector.ts","../src/build/package-info.ts","../src/build/plugins/module-alias.ts","../src/build/plugins/node-modules-extension-resolver.ts","../src/build/plugins/protocol-external-resolver.ts","../src/build/babel/remove-deployer.ts","../src/build/plugins/remove-deployer.ts","../src/build/plugins/subpath-externals-resolver.ts","../src/build/plugins/tsconfig-paths.ts","../src/build/bundler.ts"],"sourcesContent":["import originalEsbuild from 'rollup-plugin-esbuild';\n\nexport function esbuild(options: Parameters<typeof originalEsbuild>[0] = {}) {\n return originalEsbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n ...options,\n });\n}\n","import originalEsmShim from '@rollup/plugin-esm-shim';\nimport type { Plugin } from 'rollup';\n\n// Regex to detect DECLARATIONS of __filename, __dirname\n// Using non-capturing group (?:) for slightly better performance\nconst FilenameDeclarationRegex = /(?:const|let|var)\\s+__filename/;\nconst DirnameDeclarationRegex = /(?:const|let|var)\\s+__dirname/;\n\n/**\n * Custom ESM shim plugin wrapper that respects user-declared __filename/__dirname variables.\n *\n * The original @rollup/plugin-esm-shim would inject shims even when users had already declared\n * their own __filename/__dirname, causing \"Identifier '__filename' has already been declared\" errors.\n *\n * This wrapper checks if the user has already declared these variables and skips the shim injection\n * if so. If either variable is declared, we skip the shim entirely since the original plugin injects\n * both together and we assume users who declare one will also handle the other if needed.\n */\nexport function esmShim(): Plugin {\n const original = originalEsmShim();\n\n return {\n name: 'esm-shim',\n renderChunk(code, chunk, opts, meta) {\n // Fast path: use includes() first to avoid regex if identifiers aren't present\n const hasFilename = code.includes('__filename');\n const hasDirname = code.includes('__dirname');\n\n // If user declared either __filename or __dirname, skip shim injection entirely\n // since the original plugin injects both together\n const userDeclaredFilename = hasFilename && FilenameDeclarationRegex.test(code);\n const userDeclaredDirname = hasDirname && DirnameDeclarationRegex.test(code);\n\n if (userDeclaredFilename || userDeclaredDirname) {\n return null;\n }\n\n // Otherwise, delegate to the original plugin\n if (typeof original.renderChunk === 'function') {\n return original.renderChunk.call(this, code, chunk, opts, meta);\n }\n\n return null;\n },\n };\n}\n\nexport default esmShim;\n","import type { Plugin } from 'rollup';\n\n/**\n * Connection-string-shaped patterns that resolve to the build host and will\n * never work inside the deploy container.\n */\nconst LOCAL_HOST_PATTERNS: Array<{ pattern: RegExp; hint: string }> = [\n {\n pattern: /\\bfile:\\.{1,2}\\/[^\\s'\"`]+\\.(?:db|sqlite)\\b/gi,\n hint: 'LibSQL/SQLite file path relative to the build host',\n },\n {\n pattern: /\\b(?:postgres(?:ql)?|mysql|mongodb|redis|libsql):\\/\\/[^/\\s'\"`]*localhost\\b/gi,\n hint: 'localhost in a connection string',\n },\n {\n pattern: /\\b(?:postgres(?:ql)?|mysql|mongodb|redis|libsql):\\/\\/[^/\\s'\"`]*127\\.0\\.0\\.1\\b/g,\n hint: '127.0.0.1 in a connection string',\n },\n];\n\nexport interface LocalStorageDetection {\n value: string;\n hint: string;\n module: string;\n /**\n * Name of the env var that guards this literal at runtime, when the\n * literal is the fallback arm of a `process.env.X || literal` (or `??`)\n * expression. The CLI preflight uses this to suppress or soften the\n * error when the guarding var is present in the deploy env.\n */\n guardedBy?: string;\n}\n\n/**\n * Unified preflight metadata emitted as `preflight-metadata.json`.\n * Superset of the legacy `preflight-local-paths.json` (which stays emitted\n * for one release so older CLIs keep working with newer deployers).\n */\nexport interface PreflightMetadata {\n version: 1;\n localPaths: LocalStorageDetection[];\n userEnvRefs: string[];\n}\n\n/**\n * Everything under `.mastra/.build/` is deployer-generated pre-bundled\n * dependency code (`@mastra__*.mjs` shims and their shared `chunk-*.mjs`\n * files), never user-authored. These preserve JSDoc examples from the\n * original library source (e.g. `LibSQLStore({ url: 'file:./data.db' })`)\n * which would otherwise trip the host-local detector, and their env var\n * reads are library refs that must not count as user references.\n */\nconst MASTRA_BUILD_DIR = /[\\\\/]\\.mastra[\\\\/]\\.build[\\\\/]/;\n\nconst PROCESS_ENV_DOT = /\\bprocess\\.env\\.([A-Z_][A-Z0-9_]*)\\b/g;\nconst PROCESS_ENV_BRACKET = /\\bprocess\\.env\\[['\"]([A-Z_][A-Z0-9_]*)['\"]\\]/g;\n\n/** Names of the metadata assets emitted into the output dir. */\n// TODO(preflight-metadata): stop emitting the legacy file in the next minor\n// after @mastra/deployer 1.50 — every CLI released alongside 1.50+ reads\n// preflight-metadata.json. Also remove the legacy fallback in the CLI's\n// deploy-preflight.ts at the same time.\nconst LEGACY_LOCAL_PATHS_FILE = 'preflight-local-paths.json';\nconst PREFLIGHT_METADATA_FILE = 'preflight-metadata.json';\nconst WORKERS_CONFIG_FILE = 'workers.json';\n\ninterface ModuleMatch {\n value: string;\n hint: string;\n guardedBy?: string;\n}\n\nfunction collectEnvRefs(code: string): Set<string> {\n const refs = new Set<string>();\n for (const m of code.matchAll(PROCESS_ENV_DOT)) refs.add(m[1]!);\n for (const m of code.matchAll(PROCESS_ENV_BRACKET)) refs.add(m[1]!);\n return refs;\n}\n\n/* ------------------------------------------------------------------ */\n/* AST guard analysis */\n/* ------------------------------------------------------------------ */\n\ninterface AstNode {\n type: string;\n [key: string]: unknown;\n}\n\nfunction isAstNode(v: unknown): v is AstNode {\n return typeof v === 'object' && v !== null && typeof (v as AstNode).type === 'string';\n}\n\nfunction walkAst(node: AstNode, visit: (node: AstNode) => void): void {\n visit(node);\n for (const value of Object.values(node)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n if (isAstNode(item)) walkAst(item, visit);\n }\n } else if (isAstNode(value)) {\n walkAst(value, visit);\n }\n }\n}\n\nfunction propertyName(node: AstNode): string | undefined {\n const key = node.key as AstNode | undefined;\n if (key?.type === 'Identifier' && !node.computed) return key.name as string;\n if (key?.type === 'Literal' && typeof key.value === 'string') return key.value;\n return undefined;\n}\n\ntype JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };\ntype WorkerConfig = { enabled: boolean; [key: string]: JsonValue };\n\ntype WorkersConfig = {\n version: 1;\n orchestration: WorkerConfig;\n scheduler: WorkerConfig;\n backgroundTasks: WorkerConfig;\n custom: string[];\n};\n\nfunction staticJsonValue(node: AstNode): JsonValue | undefined {\n if (node.type === 'Literal') {\n const value = node.value;\n if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n return value;\n }\n return undefined;\n }\n\n if (node.type === 'UnaryExpression' && node.operator === '-') {\n const argument = node.argument as AstNode | undefined;\n const value = argument ? staticJsonValue(argument) : undefined;\n return typeof value === 'number' ? -value : undefined;\n }\n\n if (node.type === 'TemplateLiteral') {\n const expressions = (node.expressions as AstNode[] | undefined) ?? [];\n const quasis = (node.quasis as Array<{ value?: { cooked?: string } }> | undefined) ?? [];\n if (expressions.length === 0) return quasis[0]?.value?.cooked ?? '';\n return undefined;\n }\n\n if (node.type === 'ArrayExpression') {\n const result: JsonValue[] = [];\n for (const element of (node.elements as Array<AstNode | null> | undefined) ?? []) {\n if (!element) return undefined;\n const value = staticJsonValue(element);\n if (value === undefined) return undefined;\n result.push(value);\n }\n return result;\n }\n\n if (node.type === 'ObjectExpression') {\n const result: Record<string, JsonValue> = {};\n for (const property of (node.properties as AstNode[] | undefined) ?? []) {\n if (property.type !== 'Property' || property.kind !== 'init') return undefined;\n const name = propertyName(property);\n const valueNode = property.value as AstNode | undefined;\n if (!name || !valueNode) return undefined;\n const value = staticJsonValue(valueNode);\n if (value === undefined) {\n delete result[name];\n } else {\n result[name] = value;\n }\n }\n return result;\n }\n\n return undefined;\n}\n\nfunction staticObjectValue(node: AstNode | undefined): Record<string, JsonValue> {\n if (!node) return {};\n const value = staticJsonValue(node);\n return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : {};\n}\n\nfunction isConfigured(node: AstNode | undefined): boolean {\n if (!node) return false;\n if (node.type === 'Literal') return node.value !== null && node.value !== false;\n return node.type !== 'Identifier' || node.name !== 'undefined';\n}\n\nfunction unwrapAwait(node: AstNode | undefined): AstNode | undefined {\n return node?.type === 'AwaitExpression' ? (node.argument as AstNode | undefined) : node;\n}\n\nfunction findPreparedConfigSources(ast: AstNode): Map<string, AstNode> {\n const factoryConfigs = new Map<string, AstNode>();\n const preparedConfigs = new Map<string, AstNode>();\n\n walkAst(ast, node => {\n if (node.type !== 'VariableDeclarator') return;\n const id = node.id as AstNode | undefined;\n const init = node.init as AstNode | undefined;\n const callee = init?.type === 'NewExpression' ? (init.callee as AstNode | undefined) : undefined;\n const config = (init?.arguments as AstNode[] | undefined)?.[0];\n if (\n id?.type === 'Identifier' &&\n callee?.type === 'Identifier' &&\n callee.name === 'MastraFactory' &&\n config?.type === 'ObjectExpression'\n ) {\n factoryConfigs.set(id.name as string, config);\n }\n });\n\n walkAst(ast, node => {\n if (node.type !== 'VariableDeclarator') return;\n const id = node.id as AstNode | undefined;\n const init = unwrapAwait(node.init as AstNode | undefined);\n const callee = init?.type === 'CallExpression' ? (init.callee as AstNode | undefined) : undefined;\n const object = callee?.type === 'MemberExpression' ? (callee.object as AstNode | undefined) : undefined;\n const property = callee?.type === 'MemberExpression' ? (callee.property as AstNode | undefined) : undefined;\n const isPrepareCall =\n (property?.type === 'Identifier' && property.name === 'prepare') ||\n (property?.type === 'Literal' && property.value === 'prepare');\n if (id?.type !== 'Identifier' || object?.type !== 'Identifier' || !isPrepareCall) return;\n\n const factoryConfig = factoryConfigs.get(object.name as string);\n if (factoryConfig) preparedConfigs.set(id.name as string, factoryConfig);\n });\n\n return preparedConfigs;\n}\n\nfunction resolvedObjectProperty(\n config: AstNode,\n name: string,\n preparedConfigs: Map<string, AstNode>,\n seen = new Set<AstNode>(),\n): AstNode | undefined {\n if (config.type !== 'ObjectExpression' || seen.has(config)) return undefined;\n seen.add(config);\n\n let value: AstNode | undefined;\n for (const property of (config.properties as AstNode[] | undefined) ?? []) {\n if (property.type === 'Property' && propertyName(property) === name) {\n value = property.value as AstNode | undefined;\n continue;\n }\n if (property.type !== 'SpreadElement') continue;\n\n const argument = property.argument as AstNode | undefined;\n const spreadConfig = argument?.type === 'Identifier' ? preparedConfigs.get(argument.name as string) : undefined;\n if (!spreadConfig) continue;\n const spreadValue = resolvedObjectProperty(spreadConfig, name, preparedConfigs, seen);\n if (spreadValue) value = spreadValue;\n }\n\n return value;\n}\n\n/**\n * Best-effort static extraction of the worker topology configured on a\n * `new Mastra(...)` instance, including `MastraFactory.prepare()` results spread\n * into its constructor. A worker service is only useful when the instance\n * explicitly provides both storage and pubsub so its processes can coordinate.\n * Dynamic values and callbacks are omitted from the display-only manifest.\n */\nfunction findStaticCustomWorkerNames(ast: AstNode, workers: AstNode | undefined): string[] {\n const variableInitializers = new Map<string, AstNode>();\n const classWorkerNames = new Map<string, string>();\n\n walkAst(ast, node => {\n if (node.type === 'VariableDeclarator') {\n const id = node.id as AstNode | undefined;\n const init = node.init as AstNode | undefined;\n if (id?.type === 'Identifier' && init) variableInitializers.set(id.name as string, init);\n return;\n }\n\n if (node.type !== 'ClassDeclaration' && node.type !== 'ClassExpression') return;\n const id = node.id as AstNode | undefined;\n const body = node.body as AstNode | undefined;\n if (id?.type !== 'Identifier' || body?.type !== 'ClassBody') return;\n\n for (const member of (body.body as AstNode[] | undefined) ?? []) {\n if (member.type !== 'PropertyDefinition' || propertyName(member) !== 'name') continue;\n const value = member.value as AstNode | undefined;\n const name = value ? staticJsonValue(value) : undefined;\n if (typeof name === 'string') classWorkerNames.set(id.name as string, name);\n }\n });\n\n const names = new Set<string>();\n const seen = new Set<AstNode>();\n const visit = (node: AstNode | undefined): void => {\n if (!node || seen.has(node)) return;\n seen.add(node);\n\n if (node.type === 'Identifier') {\n visit(variableInitializers.get(node.name as string));\n return;\n }\n if (node.type === 'ArrayExpression') {\n for (const element of (node.elements as Array<AstNode | null> | undefined) ?? []) {\n if (element?.type === 'SpreadElement') {\n visit(element.argument as AstNode | undefined);\n } else {\n visit(element ?? undefined);\n }\n }\n return;\n }\n if (node.type === 'NewExpression') {\n const callee = node.callee as AstNode | undefined;\n const name = callee?.type === 'Identifier' ? classWorkerNames.get(callee.name as string) : undefined;\n if (name) names.add(name);\n return;\n }\n if (node.type === 'ObjectExpression') {\n const name = staticObjectValue(node).name;\n if (typeof name === 'string') names.add(name);\n }\n };\n\n visit(workers);\n for (const builtIn of ['orchestration', 'scheduler', 'backgroundTasks']) names.delete(builtIn);\n return [...names].sort();\n}\n\nfunction findWorkersConfig(ast: AstNode): WorkersConfig | undefined {\n const preparedConfigs = findPreparedConfigSources(ast);\n let workersConfig: WorkersConfig | undefined;\n walkAst(ast, node => {\n if (workersConfig || node.type !== 'NewExpression') return;\n const callee = node.callee as AstNode | undefined;\n if (callee?.type !== 'Identifier' || callee.name !== 'Mastra') return;\n const config = (node.arguments as AstNode[] | undefined)?.[0];\n if (config?.type !== 'ObjectExpression') return;\n\n const storage = resolvedObjectProperty(config, 'storage', preparedConfigs);\n const pubsub = resolvedObjectProperty(config, 'pubsub', preparedConfigs);\n const workers = resolvedObjectProperty(config, 'workers', preparedConfigs);\n if (!isConfigured(storage) || !isConfigured(pubsub) || (workers?.type === 'Literal' && workers.value === false)) {\n return;\n }\n\n const scheduler = staticObjectValue(resolvedObjectProperty(config, 'scheduler', preparedConfigs));\n const backgroundTasks = staticObjectValue(resolvedObjectProperty(config, 'backgroundTasks', preparedConfigs));\n\n workersConfig = {\n version: 1,\n orchestration: { enabled: true },\n scheduler: { ...scheduler, enabled: scheduler.enabled !== false },\n backgroundTasks: { ...backgroundTasks, enabled: backgroundTasks.enabled === true },\n custom: findStaticCustomWorkerNames(ast, workers),\n };\n });\n return workersConfig;\n}\n\n/** Find the first `process.env.X` / `process.env['X']` read inside an expression. */\nfunction findFirstEnvRef(node: AstNode): string | undefined {\n let found: string | undefined;\n walkAst(node, n => {\n if (found !== undefined) return;\n if (n.type !== 'MemberExpression') return;\n const object = n.object as AstNode | undefined;\n if (\n !object ||\n object.type !== 'MemberExpression' ||\n (object.object as AstNode | undefined)?.type !== 'Identifier' ||\n ((object.object as AstNode).name as string) !== 'process' ||\n (object.property as AstNode | undefined)?.type !== 'Identifier' ||\n ((object.property as AstNode).name as string) !== 'env'\n ) {\n return;\n }\n const property = n.property as AstNode | undefined;\n if (property?.type === 'Identifier' && !n.computed) {\n found = property.name as string;\n } else if (property?.type === 'Literal' && typeof property.value === 'string') {\n found = property.value;\n }\n });\n return found;\n}\n\n/**\n * Parse a module and figure out, for each detected local-path value, whether\n * every string literal containing it is the fallback arm of a\n * `process.env.X || <literal>` / `??` expression. Returns a map from\n * detected value to guarding env var name. Values with any unguarded\n * occurrence (or inconsistent guards) are absent — the CLI then errors as\n * before, which is the safe default.\n */\nfunction findGuardedValues(ast: AstNode, values: Set<string>): Map<string, string> {\n const stringLiterals: AstNode[] = [];\n const guardedLiterals = new Map<AstNode, string>();\n\n walkAst(ast, node => {\n if (node.type === 'Literal' && typeof node.value === 'string') {\n stringLiterals.push(node);\n return;\n }\n if (node.type === 'LogicalExpression' && (node.operator === '||' || node.operator === '??')) {\n const right = node.right as AstNode | undefined;\n if (right?.type === 'Literal' && typeof right.value === 'string') {\n const envName = findFirstEnvRef(node.left as AstNode);\n if (envName) guardedLiterals.set(right, envName);\n }\n }\n });\n\n const result = new Map<string, string>();\n for (const value of values) {\n const containing = stringLiterals.filter(lit => (lit.value as string).includes(value));\n if (containing.length === 0) continue;\n const guards = containing.map(lit => guardedLiterals.get(lit));\n const first = guards[0];\n if (first !== undefined && guards.every(g => g === first)) {\n result.set(value, first);\n }\n }\n return result;\n}\n\n/**\n * Rollup plugin that detects host-local storage URLs (e.g. `file:./mastra.db`,\n * `postgres://localhost`) in **user source modules** during bundling, and\n * collects the env vars user code reads via `process.env.X`.\n *\n * Only modules outside `node_modules` (and the deployer's own\n * `.mastra/.build/` pre-bundled files) are inspected, so library code\n * (like Agent Builder prompt templates or JSDoc examples in `@mastra/core`)\n * is naturally excluded. When `rootDir` is given, modules outside it are\n * also excluded — symlinked dependencies (pnpm `link:`/`file:`) resolve to\n * real paths that never contain `node_modules`. Tree-shaken modules are\n * excluded via\n * `generateBundle` — only modules that actually contribute rendered code to\n * the output are reported.\n *\n * When a detected literal is the fallback arm of a `process.env.X || literal`\n * expression, `guardedBy: \"X\"` is recorded so the CLI preflight can apply\n * deploy-time env context instead of hard-erroring on a dead fallback.\n *\n * Three assets are emitted into the output directory:\n * - `preflight-metadata.json` — unified metadata (local paths + user env refs)\n * - `workers.json` — statically extracted worker topology, or `null`\n * - `preflight-local-paths.json` — legacy shape, kept for one release so an\n * older globally-installed CLI paired with a newer project-local deployer\n * doesn't lose the LOCAL_STORAGE_PATH check.\n */\nexport function localStorageDetector(rootDir?: string): Plugin {\n const userModuleMatches = new Map<string, ModuleMatch[]>();\n const userModuleEnvRefs = new Map<string, Set<string>>();\n const userModuleWorkersConfigs = new Map<string, WorkersConfig>();\n let normalizedRoot: string | undefined;\n if (rootDir) {\n let root = rootDir.replace(/\\\\/g, '/');\n while (root.endsWith('/')) root = root.slice(0, -1);\n normalizedRoot = root + '/';\n }\n\n return {\n name: 'mastra-local-storage-detector',\n\n transform(_code, id) {\n if (id.includes('node_modules')) return null;\n if (MASTRA_BUILD_DIR.test(id)) return null;\n // Modules outside the project/workspace root are dependencies resolved\n // through symlinks (pnpm `link:`, `file:`, monorepo dev setups) whose\n // real path escapes `node_modules` — library code, not user code.\n if (normalizedRoot && !id.replace(/\\\\/g, '/').startsWith(normalizedRoot)) return null;\n\n const refs = collectEnvRefs(_code);\n if (refs.size > 0) {\n userModuleEnvRefs.set(id, refs);\n }\n\n const matches: ModuleMatch[] = [];\n for (const { pattern, hint } of LOCAL_HOST_PATTERNS) {\n const re = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');\n for (const m of _code.matchAll(re)) {\n matches.push({ value: m[0], hint });\n }\n }\n\n // Best-effort structural pass: only parse modules that may contain\n // Mastra worker config or need guard analysis for a detected local path.\n // Existing local-path matches remain unguarded on parse failure.\n if (_code.includes('Mastra') || matches.length > 0) {\n try {\n const ast = this.parse(_code) as unknown as AstNode;\n const workersConfig = findWorkersConfig(ast);\n if (workersConfig) {\n userModuleWorkersConfigs.set(id, workersConfig);\n }\n if (matches.length > 0) {\n const guarded = findGuardedValues(ast, new Set(matches.map(m => m.value)));\n for (const match of matches) {\n const guardedBy = guarded.get(match.value);\n if (guardedBy) match.guardedBy = guardedBy;\n }\n }\n } catch {\n // ignore — optional static metadata is best-effort\n }\n }\n\n if (matches.length > 0) {\n userModuleMatches.set(id, matches);\n }\n\n return null;\n },\n\n generateBundle(_, bundle) {\n const detections: LocalStorageDetection[] = [];\n const seen = new Set<string>();\n const userEnvRefs = new Set<string>();\n let workersConfig: WorkersConfig | undefined;\n\n for (const chunk of Object.values(bundle)) {\n if (chunk.type !== 'chunk') continue;\n\n for (const [moduleId, moduleInfo] of Object.entries(chunk.modules)) {\n if (moduleInfo.renderedLength === 0) continue;\n\n for (const ref of userModuleEnvRefs.get(moduleId) ?? []) {\n userEnvRefs.add(ref);\n }\n workersConfig ??= userModuleWorkersConfigs.get(moduleId);\n\n const matches = userModuleMatches.get(moduleId);\n if (!matches) continue;\n\n for (const { value, hint, guardedBy } of matches) {\n const key = `${hint}::${value}`;\n if (seen.has(key)) continue;\n seen.add(key);\n\n detections.push({ value, hint, module: moduleId, ...(guardedBy ? { guardedBy } : {}) });\n }\n }\n }\n\n const metadata: PreflightMetadata = {\n version: 1,\n localPaths: detections,\n userEnvRefs: [...userEnvRefs].sort(),\n };\n\n this.emitFile({\n type: 'asset',\n fileName: PREFLIGHT_METADATA_FILE,\n source: JSON.stringify(metadata),\n });\n\n this.emitFile({\n type: 'asset',\n fileName: WORKERS_CONFIG_FILE,\n source: JSON.stringify(workersConfig ?? null),\n });\n\n // Legacy asset — shape unchanged (no `guardedBy`) for older CLIs.\n this.emitFile({\n type: 'asset',\n fileName: LEGACY_LOCAL_PATHS_FILE,\n source: JSON.stringify(detections.map(({ value, hint, module }) => ({ value, hint, module }))),\n });\n },\n };\n}\n","/**\n * Note: This function depends on local-pkg and should only be used at build-time.\n * It is in a separate file to avoid including local-pkg in runtime code.\n */\n\nimport { realpathSync, statSync } from 'node:fs';\nimport { basename, dirname, isAbsolute, join, resolve, sep } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { findUp } from 'find-up-simple';\nimport { pathExists, readJson, readJSON } from 'fs-extra/esm';\nimport { getPackageInfo as getOriginalPackageInfo } from 'local-pkg';\nimport { getPackageName } from './utils';\n\nfunction isDirectory(path: string) {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\n/**\n * Real path of the package folder Node loads for `packageName` imported from `baseDir`.\n *\n * Copied from `getPackageJSONURL()` in Node.js internals (MIT License, Copyright Node.js contributors):\n * https://github.com/nodejs/node/blob/main/lib/internal/modules/package_json_reader.js\n * Replace with `module.findPackageJSON()` once it is stable and available in every supported Node version. It is\n * experimental (stability 1.1) and missing before Node 22.14.\n *\n * Differs from Node: returns a real path because callers match it against rollup module ids.\n */\nasync function findInstalledPackageRoot(packageName: string, baseDir: string): Promise<string | undefined> {\n // Self-reference: the nearest package.json, without crossing a node_modules folder, wins when it has exports and\n // the same name.\n for (let dir = baseDir; basename(dir) !== 'node_modules'; dir = dirname(dir)) {\n const packageJsonPath = join(dir, 'package.json');\n\n if (await pathExists(packageJsonPath)) {\n const packageJson = await readJson(packageJsonPath, { throws: false });\n\n if (packageJson?.exports != null && packageJson.name === packageName) {\n return realpathSync(dir);\n }\n\n break;\n }\n\n if (dirname(dir) === dir) {\n break;\n }\n }\n\n let dir = baseDir;\n let previousDir: string;\n\n do {\n const candidate = join(dir, 'node_modules', packageName);\n\n if (isDirectory(candidate)) {\n return realpathSync(candidate);\n }\n\n previousDir = dir;\n dir = dirname(dir);\n } while (dir !== previousDir);\n\n return undefined;\n}\n\nexport async function getPackageInfo(\n packageName: string,\n options?: { paths?: string[] },\n): Promise<ReturnType<typeof getOriginalPackageInfo>> {\n // The nearest manifest above a resolved subpath file can be the subpath folder's own package.json with an\n // unrelated name and version, e.g. read-excel-file/node (#28828).\n const name = getPackageName(packageName);\n if (name && !isAbsolute(packageName) && !packageName.startsWith('.')) {\n const baseDirs = options?.paths?.length ? options.paths.map(path => fileURLToPath(path)) : [process.cwd()];\n\n for (const baseDir of baseDirs) {\n const rootPath = await findInstalledPackageRoot(name, baseDir);\n\n if (!rootPath) {\n continue;\n }\n\n const packageJsonPath = join(rootPath, 'package.json');\n\n if (await pathExists(packageJsonPath)) {\n const packageJson = await readJson(packageJsonPath);\n return { name: packageJson.name, version: packageJson.version, rootPath, packageJsonPath, packageJson };\n }\n }\n }\n\n const pkgInfo = await getOriginalPackageInfo(packageName, options);\n\n // A manifest without a version is still the package root when it is named after the requested package. When a\n // file path is requested there is no package name to compare against, so a named manifest is the root unless an\n // ancestor manifest carries the same name (e.g. engine.io-client/build/esm/package.json inside engine.io-client).\n async function isPackageRoot(pkgJson: { name?: string; version?: string } | undefined, manifestDir: string) {\n if (pkgJson?.version) {\n return true;\n }\n if (!isAbsolute(packageName)) {\n return pkgJson?.name === getPackageName(packageName);\n }\n const name = pkgJson?.name;\n return name ? !(await hasAncestorNamed(name, dirname(manifestDir))) : false;\n }\n\n async function hasAncestorNamed(name: string, dir: string): Promise<boolean> {\n const path = await findUp('package.json', { cwd: dir });\n if (!path) {\n return false;\n }\n const parentDir = dirname(path);\n if ((await readJson(path)).name === name) {\n return true;\n }\n return parentDir !== dirname(parentDir) && hasAncestorNamed(name, dirname(parentDir));\n }\n\n async function searchUpForPackageJson(rootPath: string) {\n const path = await findUp('package.json', {\n cwd: rootPath,\n });\n\n if (!path) {\n return undefined;\n }\n\n const pkgJson = await readJson(path);\n\n if (!(await isPackageRoot(pkgJson, dirname(path)))) {\n return searchUpForPackageJson(dirname(rootPath));\n }\n\n return {\n name: pkgJson.name,\n version: pkgJson.version,\n rootPath: dirname(path),\n packageJsonPath: path,\n packageJson: pkgJson,\n };\n }\n\n // A nested manifest (e.g. dist/esm/package.json with only \"type\") is not the package root, so search up for it.\n if (pkgInfo?.rootPath && !(await isPackageRoot(pkgInfo.packageJson, pkgInfo.rootPath))) {\n return searchUpForPackageJson(dirname(pkgInfo.rootPath));\n }\n\n return pkgInfo;\n}\n\n/**\n * Normalize a resolution base path to a directory path.\n *\n * Callers often pass a module file path (e.g. a rollup module id like\n * `node_modules/@mastra/core/dist/chunk-XYZ.js`) as the parent path. mlly (used by local-pkg)\n * also treats each resolution base as a directory candidate (`<base>/_index.js`), which makes it\n * try to read `<file>/package.json`. That fails with ENOTDIR, which mlly does not tolerate\n * (only ENOENT) and local-pkg then logs the raw error to the console. Using the file's directory\n * as the base avoids this while resolving identically.\n */\nfunction toParentDirectoryUrl(parentPath: string): string {\n let fsPath = resolve(parentPath.startsWith('file://') ? fileURLToPath(parentPath) : parentPath);\n\n try {\n if (statSync(fsPath).isFile()) {\n fsPath = dirname(fsPath);\n }\n } catch {\n // non-existent paths are used as-is\n }\n\n // Keep the trailing separator. Without it, URL resolution treats the directory name as a file\n // and starts package lookup from its parent directory.\n return pathToFileURL(`${fsPath}${sep}`).href;\n}\n\n/**\n * Get package root path\n */\nexport async function getPackageRootPath(packageName: string, parentPath?: string): Promise<string | null> {\n let rootPath: string | null;\n\n try {\n let options: { paths?: string[] } | undefined = undefined;\n if (parentPath) {\n options = {\n paths: [toParentDirectoryUrl(parentPath)],\n };\n }\n\n const pkg = await getPackageInfo(packageName, options);\n rootPath = pkg?.rootPath ?? null;\n } catch {\n rootPath = null;\n }\n\n return rootPath;\n}\n\nasync function readPackageMetadata(\n rootPath: string,\n requestedPackageName: string | null,\n): Promise<{ rootPath: string; version?: string; packageSpec?: string }> {\n try {\n const pkgJson = await readJSON(`${rootPath}/package.json`);\n const version = pkgJson.version;\n const actualPackageName = pkgJson.name;\n const packageSpec =\n version && actualPackageName && requestedPackageName && requestedPackageName !== actualPackageName\n ? `npm:${actualPackageName}@${version}`\n : undefined;\n\n return { rootPath, version, packageSpec };\n } catch {\n return { rootPath };\n }\n}\n\nexport async function getPackageMetadata(\n packageName: string,\n parentPath?: string,\n): Promise<{ rootPath: string | null; version?: string; packageSpec?: string }> {\n const requestedPackageName = getPackageName(packageName);\n const packageNames = [...new Set([packageName, requestedPackageName].filter(Boolean) as string[])];\n let firstRootPath: string | null = null;\n\n for (const name of packageNames) {\n const rootPath = await getPackageRootPath(name, parentPath);\n firstRootPath ??= rootPath;\n if (!rootPath) {\n continue;\n }\n\n const metadata = await readPackageMetadata(rootPath, requestedPackageName ?? null);\n if (metadata.version || metadata.packageSpec) {\n return metadata;\n }\n }\n\n return { rootPath: firstRootPath };\n}\n","import { dirname, resolve, sep } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { ErrorCategory, ErrorDomain, MastraError } from '@internal/core/error';\nimport rollupAlias from '@rollup/plugin-alias';\nimport { resolveModule } from 'local-pkg';\nimport * as resolveExports from 'resolve.exports';\nimport type { Plugin, ResolveIdHook } from 'rollup';\nimport { getPackageInfo } from '../package-info';\nimport { getNodeResolveOptions, getPackageName, isBareModuleSpecifier } from '../utils';\nimport type { BundlerPlatform } from '../utils';\n\nfunction exactMatch(specifier: string) {\n return new RegExp(`^${specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`);\n}\n\nasync function resolveBareTarget(id: string, resolveFrom: string, platform: BundlerPlatform) {\n const packageName = getPackageName(id);\n if (!packageName) return undefined;\n\n const resolutionBase = pathToFileURL(`${dirname(resolveFrom)}${sep}`).href;\n const packageInfo = await getPackageInfo(packageName, { paths: [resolutionBase] });\n if (packageInfo?.packageJson.exports) {\n const nodeResolveOptions = getNodeResolveOptions(platform);\n try {\n const [entry] =\n resolveExports.exports(packageInfo.packageJson, id, {\n browser: nodeResolveOptions.browser === true,\n conditions: nodeResolveOptions.exportConditions,\n }) ?? [];\n if (entry) return resolve(packageInfo.rootPath, entry);\n } catch {\n return undefined;\n }\n }\n\n return resolveModule(id, { paths: [resolutionBase] });\n}\n\nexport function moduleAlias(\n alias: Record<string, string>,\n resolveFrom: string,\n platform: BundlerPlatform = 'node',\n): Plugin | null {\n const entries = Object.entries(alias);\n if (entries.length === 0) {\n return null;\n }\n\n const plugin = rollupAlias({\n entries: entries.map(([specifier, target]) => ({\n find: exactMatch(specifier),\n replacement: target,\n customResolver: async function (id, importer, options) {\n const resolveImporter = importer && !importer.startsWith('\\0') ? importer : resolveFrom;\n const resolvedBareTarget = isBareModuleSpecifier(id)\n ? await resolveBareTarget(id, resolveImporter, platform)\n : undefined;\n const resolved = resolvedBareTarget ? undefined : await this.resolve(id, resolveImporter, options);\n\n if (!resolvedBareTarget && !resolved) {\n throw new MastraError({\n id: 'DEPLOYER_ALIAS_TARGET_NOT_FOUND',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: {\n alias: specifier,\n target,\n },\n text: `Could not resolve deployer alias \\`${specifier}\\` to \\`${target}\\`.`,\n });\n }\n\n return resolvedBareTarget ?? resolved;\n },\n })),\n });\n\n return {\n ...plugin,\n name: 'module-alias',\n resolveId: {\n order: 'pre',\n handler: plugin.resolveId as ResolveIdHook,\n },\n };\n}\n","import { readFile } from 'node:fs/promises';\nimport { join, isAbsolute } from 'node:path';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport type { Plugin } from 'rollup';\nimport type { PackageJson } from 'type-fest';\nimport { getPackageRootPath } from '../package-info';\nimport { getPackageName, isExternalProtocolImport, isBareModuleSpecifier, slash } from '../utils';\n\n/**\n * Check if a package has an exports field in its package.json.\n * Results are cached to avoid repeated filesystem reads.\n */\nasync function getPackageJSON(pkgName: string, importer: string): Promise<PackageJson> {\n const pkgRoot = await getPackageRootPath(pkgName, importer);\n if (!pkgRoot) {\n throw new Error(`Package ${pkgName} not found`);\n }\n\n const pkgJSON = JSON.parse(await readFile(join(pkgRoot, 'package.json'), 'utf-8')) as PackageJson;\n return pkgJSON;\n}\n\n/**\n * Rollup plugin that resolves module extensions for external dependencies.\n *\n * This plugin handles ESM compatibility for external imports when node-resolve is not used:\n * - Packages WITH exports field (e.g., hono, date-fns): Keep imports as-is or strip redundant extensions\n * - Packages WITHOUT exports field (e.g., lodash): Add .js extension for direct file imports\n */\nexport function nodeModulesExtensionResolver(): Plugin {\n // Create a single instance of node-resolve to reuse\n const nodeResolvePlugin = nodeResolve();\n\n return {\n name: 'node-modules-extension-resolver',\n async resolveId(id, importer, options) {\n // Only bare package imports are relevant here.\n // Virtual modules (e.g. `\\0virtual:#entry`) are not real filesystem paths, so they can't be\n // used as a resolution base for package lookups.\n if (\n !importer ||\n importer.startsWith('\\0') ||\n !isBareModuleSpecifier(id) ||\n isExternalProtocolImport(id) ||\n isAbsolute(id)\n ) {\n return null;\n }\n\n // Skip direct package imports (e.g., 'lodash', '@mastra/core')\n const parts = id.split('/');\n const isScoped = id.startsWith('@');\n if ((isScoped && parts.length === 2) || (!isScoped && parts.length === 1)) {\n return null;\n }\n\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n try {\n const packageJSON = await getPackageJSON(pkgName, importer);\n // if it has exports, node should be able to rsolve it, if not the exports map is wrong.\n if (packageJSON.exports) {\n return null;\n }\n\n const packageRoot = await getPackageRootPath(pkgName, importer);\n if (!packageRoot) {\n return null;\n }\n\n // @ts-expect-error - handle is part of resolveId signature\n const nodeResolved = await nodeResolvePlugin.resolveId?.handler?.call(this, id, importer, options);\n // if we cannot resolve it, it's not a valid import so we let node handle it\n if (!nodeResolved?.id) {\n return null;\n }\n\n let filePath = nodeResolved.id;\n if (nodeResolved.resolvedBy === 'commonjs--resolver') {\n filePath = filePath.substring(1).split('?')[0];\n }\n\n // Import specifiers always use forward slashes, but both paths are native on Windows.\n const resolvedImportPath = slash(filePath).replace(slash(packageRoot), pkgName);\n\n return {\n id: resolvedImportPath,\n external: true,\n };\n } catch {\n return null;\n }\n },\n };\n}\n","import type { Plugin } from 'rollup';\nimport { isExternalProtocolImport } from '../utils';\n\nexport function protocolExternalResolver({ exclude = ['node:'] }: { exclude?: readonly string[] } = {}): Plugin {\n return {\n name: 'protocol-external-resolver',\n resolveId(id) {\n if (!isExternalProtocolImport(id, exclude)) {\n return null;\n }\n\n return {\n id,\n external: true,\n };\n },\n } satisfies Plugin;\n}\n","import { types as t } from '@babel/core';\nimport type { NodePath, PluginObject, PluginPass } from '@babel/core';\n\ninterface RemoveDeployerState extends PluginPass {\n hasReplaced?: boolean;\n}\n\nexport function removeDeployer(): PluginObject<RemoveDeployerState> {\n // Helper to remove deployer property from an object and clean up its binding\n function removeDeployerFromObject(\n objectExpr: t.ObjectExpression,\n scope: { getBinding: (name: string) => { path?: NodePath } | undefined },\n ): t.ObjectProperty | undefined {\n const deployerProp = objectExpr.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'deployer',\n ) as t.ObjectProperty | undefined;\n\n if (deployerProp) {\n objectExpr.properties = objectExpr.properties.filter(prop => prop !== deployerProp);\n\n // Clean up the deployer binding if it's a reference\n if (t.isIdentifier(deployerProp.value)) {\n const deployerBinding = scope.getBinding(deployerProp.value.name);\n if (deployerBinding) {\n deployerBinding.path?.parentPath?.remove();\n }\n }\n }\n\n return deployerProp;\n }\n\n return {\n name: 'remove-deployer',\n visitor: {\n NewExpression(path, state: RemoveDeployerState) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n if (!state.hasReplaced) {\n state.hasReplaced = true;\n const newMastraObj = t.cloneNode(path.node);\n if (t.isObjectExpression(newMastraObj.arguments[0]) && newMastraObj.arguments[0].properties?.length) {\n const objectArg = newMastraObj.arguments[0];\n let foundDeployer = false;\n\n // First, check for direct deployer property\n const directDeployer = removeDeployerFromObject(objectArg, state.file.scope);\n if (directDeployer) {\n foundDeployer = true;\n }\n\n // Then, check spread elements for deployer properties\n for (const prop of objectArg.properties) {\n if (t.isSpreadElement(prop) && t.isIdentifier(prop.argument)) {\n const spreadBinding = state.file.scope.getBinding(prop.argument.name);\n if (spreadBinding?.path && t.isVariableDeclarator(spreadBinding.path.node)) {\n const init = spreadBinding.path.node.init;\n if (t.isObjectExpression(init)) {\n const spreadDeployer = removeDeployerFromObject(init, state.file.scope);\n if (spreadDeployer) {\n foundDeployer = true;\n }\n }\n }\n }\n }\n\n if (foundDeployer) {\n path.replaceWith(newMastraObj);\n }\n }\n }\n },\n },\n } as PluginObject<RemoveDeployerState>;\n}\n","import { transformAsync } from '@babel/core';\nimport type { Plugin, SourceMapInput } from 'rollup';\n\nimport { removeDeployer as removeDeployerBabelPlugin } from '../babel/remove-deployer';\nimport { slash } from '../utils';\n\nexport function removeDeployer(mastraEntry: string, options?: { sourcemap?: boolean }): Plugin {\n // On Windows `#mastra` resolves to a slash-normalized id, while a relative import of the entry keeps a native one\n const normalizedEntry = slash(mastraEntry);\n\n return {\n name: 'remove-deployer',\n transform(code, id) {\n if (slash(id) !== normalizedEntry) {\n return;\n }\n\n return transformAsync(code, {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeDeployerBabelPlugin],\n sourceMaps: options?.sourcemap,\n }).then(result => ({\n code: result!.code!,\n map: result!.map! as SourceMapInput,\n }));\n },\n } satisfies Plugin;\n}\n","import * as resolve from 'resolve.exports';\nimport type { Plugin } from 'rollup';\nimport type { WorkspacePackageInfo } from '../../bundler/workspaceDependencies';\nimport { getPackageName, isDependencyPartOfPackage } from '../utils';\n\nexport function subpathExternalsResolver(\n externals: string[],\n workspaceMap: Map<string, WorkspacePackageInfo> = new Map(),\n): Plugin {\n return {\n name: 'subpath-externals-resolver',\n resolveId(id) {\n if (id.startsWith('.') || id.startsWith('/')) {\n return null;\n }\n\n const isPartOfExternals = externals.some(external => isDependencyPartOfPackage(id, external));\n if (!isPartOfExternals) {\n return null;\n }\n\n const packageName = getPackageName(id);\n const workspacePackage = packageName ? workspaceMap.get(packageName) : undefined;\n if (packageName && workspacePackage?.exports !== undefined && id !== packageName) {\n const subpath = `.${id.slice(packageName.length)}`;\n try {\n resolve.exports({ name: packageName, exports: workspacePackage.exports }, subpath);\n } catch {\n this.error(`Could not resolve workspace package subpath \"${id}\".`);\n }\n }\n\n return {\n id,\n external: true,\n };\n },\n } satisfies Plugin;\n}\n","import fs from 'node:fs';\nimport { builtinModules } from 'node:module';\nimport path from 'node:path';\nimport { createPathsMatcher, parseTsconfig } from 'get-tsconfig';\nimport type { PathsMatcher } from 'get-tsconfig';\nimport type { Plugin } from 'rollup';\n\nconst PLUGIN_NAME = 'tsconfig-paths';\nconst JS_IMPORT_SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];\nconst CORE_MODULES = new Set([...builtinModules, ...builtinModules.map(moduleName => `node:${moduleName}`)]);\n\nexport type PluginOptions = {\n tsConfigPath?: string;\n respectCoreModule?: boolean;\n localResolve?: boolean;\n cwd?: string;\n};\n\n/**\n * Check if a tsconfig file has path mappings configured.\n * Exported for testing purposes.\n *\n * @param tsConfigPath - Path to the tsconfig.json file\n * @returns true if the tsconfig has paths configured or extends another config, false otherwise\n */\nexport function hasPaths(tsConfigPath: string): boolean {\n try {\n const paths = parseTsconfig(tsConfigPath).compilerOptions?.paths;\n return !!paths && Object.keys(paths).length > 0;\n } catch {\n return false;\n }\n}\n\nexport function tsConfigPaths({\n tsConfigPath,\n respectCoreModule = true,\n localResolve,\n cwd,\n}: PluginOptions = {}): Plugin {\n const matcherCache = new Map<string, { matcher: PathsMatcher | null; patterns: string[] } | null>();\n\n function resolveImportToSourceFile(moduleName: string): string {\n if (fs.existsSync(moduleName) && fs.statSync(moduleName).isFile()) {\n return moduleName;\n }\n\n const parsed = path.parse(moduleName);\n const candidates =\n parsed.ext === '.js'\n ? JS_IMPORT_SOURCE_EXTENSIONS.map(extension => path.join(parsed.dir, `${parsed.name}${extension}`))\n : [\n ...JS_IMPORT_SOURCE_EXTENSIONS.map(extension => `${moduleName}${extension}`),\n ...JS_IMPORT_SOURCE_EXTENSIONS.map(extension => path.join(moduleName, `index${extension}`)),\n ];\n\n return candidates.find(candidate => fs.existsSync(candidate)) ?? moduleName;\n }\n\n // Find tsconfig.json file starting from a directory and walking up\n function findTsConfigForFile(filePath: string): string | null {\n let currentDir = path.dirname(filePath);\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const tsConfigPath = path.join(currentDir, 'tsconfig.json');\n\n if (fs.existsSync(tsConfigPath)) {\n // Check if this tsconfig has path mappings\n if (hasPaths(tsConfigPath)) {\n return tsConfigPath;\n }\n }\n\n // Also check for tsconfig.base.json (common in NX)\n const tsConfigBasePath = path.join(currentDir, 'tsconfig.base.json');\n if (fs.existsSync(tsConfigBasePath)) {\n if (hasPaths(tsConfigBasePath)) {\n return tsConfigBasePath;\n }\n }\n\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n }\n\n function getMatcherForFile(filePath: string): { matcher: PathsMatcher | null; patterns: string[] } | null {\n const configPath = tsConfigPath ?? findTsConfigForFile(filePath);\n if (!configPath) {\n return null;\n }\n\n if (!matcherCache.has(configPath)) {\n const config = parseTsconfig(configPath);\n const patterns = Object.keys(config.compilerOptions?.paths ?? {});\n let matcher: PathsMatcher | null;\n\n try {\n matcher = createPathsMatcher({ path: configPath, config });\n } catch {\n const configWithBaseUrl = {\n ...config,\n compilerOptions: { ...config.compilerOptions, baseUrl: path.dirname(configPath) },\n };\n matcher = createPathsMatcher({ path: configPath, config: configWithBaseUrl });\n }\n\n matcherCache.set(configPath, { matcher, patterns });\n }\n\n return matcherCache.get(configPath) ?? null;\n }\n\n function resolveAliases(request: string, importer: string): string[] {\n if (respectCoreModule && CORE_MODULES.has(request)) {\n return [];\n }\n\n const matchedConfig = getMatcherForFile(importer);\n if (\n !matchedConfig?.patterns.some(pattern => {\n const wildcardIndex = pattern.indexOf('*');\n return wildcardIndex === -1\n ? request === pattern\n : request.startsWith(pattern.slice(0, wildcardIndex)) && request.endsWith(pattern.slice(wildcardIndex + 1));\n })\n ) {\n return [];\n }\n\n return matchedConfig.matcher?.(request) ?? [];\n }\n\n return {\n name: PLUGIN_NAME,\n resolveId: {\n order: 'pre',\n async handler(request, importer, options) {\n if (!importer || request.startsWith('\\0') || importer.charCodeAt(0) === 0) {\n return null;\n }\n\n // Convert relative paths to absolute to ensure proper tsconfig path resolution\n // This allows path aliases to work regardless of how the importer path is provided\n if (!path.isAbsolute(importer)) {\n importer = path.resolve(cwd ?? process.cwd(), importer);\n }\n\n const moduleNames = resolveAliases(request, importer);\n for (const moduleName of moduleNames) {\n const resolvedModuleName = resolveImportToSourceFile(moduleName);\n const resolved = await this.resolve(resolvedModuleName, importer, { skipSelf: true, ...options });\n\n if (resolved) {\n return {\n ...resolved,\n meta: {\n ...resolved.meta,\n [PLUGIN_NAME]: {\n resolved: true,\n },\n },\n };\n }\n }\n\n const resolved = await this.resolve(request, importer, { skipSelf: true, ...options });\n if (!resolved) {\n return null;\n }\n\n // If localResolve is true, we need to check if the importer has been resolved by the tsconfig-paths plugin\n // if so, we need to resolve the request from the importer instead of the root and mark it as external\n if (localResolve) {\n const importerInfo = this.getModuleInfo(importer);\n const importerPluginMeta = importerInfo?.meta?.[PLUGIN_NAME];\n\n if (\n !path.isAbsolute(request) &&\n !request.startsWith('./') &&\n !request.startsWith('../') &&\n importerPluginMeta?.resolved\n ) {\n return {\n ...resolved,\n external: !request.startsWith('hono/') && request !== 'hono',\n };\n }\n }\n\n return {\n ...resolved,\n meta: {\n ...(resolved.meta || {}),\n },\n };\n },\n },\n } satisfies Plugin;\n}\n","import { join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { rollup } from 'rollup';\nimport type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { minify as esbuildMinify } from 'rollup-plugin-esbuild';\nimport type { WorkspacePackageInfo } from '../bundler/workspaceDependencies';\nimport { esbuild } from './plugins/esbuild';\nimport { esmShim } from './plugins/esm-shim';\nimport { localStorageDetector } from './plugins/local-storage-detector';\nimport { moduleAlias } from './plugins/module-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { protocolExternalResolver } from './plugins/protocol-external-resolver';\nimport { removeDeployer } from './plugins/remove-deployer';\nimport { subpathExternalsResolver } from './plugins/subpath-externals-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport type { ExternalDependencyInfo } from './types';\nimport { getPackageName, getNodeResolveOptions, slash } from './utils';\nimport type { BundlerPlatform } from './utils';\n\nexport function mastraInternalAliasPlugin(entryFile: string): Plugin {\n const normalizedEntryFile = slash(entryFile);\n\n return {\n name: 'mastra-internal-alias',\n resolveId: {\n order: 'pre',\n handler(id) {\n if (id === '#server') {\n return slash(fileURLToPath(import.meta.resolve('@mastra/deployer/server')));\n }\n\n if (id.startsWith('@mastra/server/')) {\n return fileURLToPath(import.meta.resolve(id));\n }\n\n if (id === '#mastra') {\n return normalizedEntryFile;\n }\n },\n },\n } satisfies Plugin;\n}\n\nexport function mastraToolsAliasPlugin(): Plugin {\n return {\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 };\n}\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: {\n dependencies: Map<string, string>;\n externalDependencies: Map<string, ExternalDependencyInfo>;\n workspaceMap: Map<string, WorkspacePackageInfo>;\n projectType?: string;\n },\n platform: BundlerPlatform,\n env: Record<string, string> = { 'process.env.NODE_ENV': JSON.stringify('production') },\n {\n sourcemap = false,\n minify = false,\n isDev = false,\n projectRoot,\n workspaceRoot = undefined,\n enableEsmShim = true,\n externalsPreset = false,\n explicitExternals = [],\n alias = {},\n configEntryFile = entryFile,\n }: {\n sourcemap?: boolean;\n minify?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n externalsPreset?: boolean;\n explicitExternals?: string[];\n alias?: Record<string, string>;\n /** File holding `new Mastra({...})`, when `entryFile` is a generated wrapper that imports it */\n configEntryFile?: string;\n },\n): Promise<InputOptions> {\n const nodeResolvePlugin = nodeResolve({\n ...getNodeResolveOptions(platform),\n rootDir: projectRoot,\n modulePaths: workspaceRoot ? [join(workspaceRoot, 'node_modules')] : [],\n });\n\n const externalsCopy = new Set<string>(analyzedBundleInfo.externalDependencies.keys());\n const externals = externalsPreset ? explicitExternals : Array.from(externalsCopy);\n const aliasSources = new Set(Object.keys(alias));\n const rollupExternals = externals.filter(external => !aliasSources.has(external));\n\n return {\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n treeshake: 'smallest',\n preserveSymlinks: true,\n external: externalsPreset ? [] : rollupExternals,\n plugins: [\n protocolExternalResolver(),\n moduleAlias(alias, entryFile, platform),\n subpathExternalsResolver(externals, analyzedBundleInfo.workspaceMap),\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 mastraInternalAliasPlugin(entryFile),\n tsConfigPaths({ cwd: projectRoot }),\n mastraToolsAliasPlugin(),\n esbuild({\n platform,\n define: env,\n }),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts', '.cjs'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n externalsPreset ? nodeModulesExtensionResolver() : nodeResolvePlugin,\n // for debugging\n // {\n // name: 'logger',\n // //@ts-expect-error\n // resolveId(id, ...args) {\n // console.log({ id, args });\n // },\n // // @ts-expect-error\n // transform(code, id) {\n // if (code.includes('class Duplexify ')) {\n // console.log({ duplex: id });\n // }\n // },\n // },\n json(),\n localStorageDetector(workspaceRoot || projectRoot),\n removeDeployer(configEntryFile, { sourcemap }),\n // treeshake unused imports\n esbuild({\n include: configEntryFile,\n platform,\n }),\n // Runs at renderChunk, so the emitted chunks are minified as a whole rather\n // than module by module. Last in the list so nothing transforms after it.\n // `sourceMap` follows the build's own setting: the plugin defaults it to true,\n // which would build a map Rollup then discards on a non-sourcemap build.\n minify ? esbuildMinify({ target: 'node20', sourceMap: sourcemap }) : null,\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\n/**\n * Checks whether a Rollup warning is an UNRESOLVED_IMPORT for a workspace package.\n * Returns the original import specifier if it's a workspace package that leaked\n * through, or undefined if it's not.\n */\nexport function getUnresolvedWorkspaceImport(\n warning: { code: string; source?: string; id?: string },\n workspaceMap: Map<string, WorkspacePackageInfo>,\n): string | undefined {\n if (warning.code !== 'UNRESOLVED_IMPORT') {\n return undefined;\n }\n\n const src = warning.source ?? warning.id ?? '';\n if (!src) {\n return undefined;\n }\n\n const pkgName = getPackageName(src);\n if (pkgName && workspaceMap.has(pkgName)) {\n return src;\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAgB,QAAQ,UAAiD,CAAC,GAAG;CAC3E,QAAA,GAAOA,sBAAAA,QAAAA,CAAgB;EACrB,QAAQ;EACR,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