@mastra/deployer 1.78.1-alpha.0 → 1.79.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/_types/@mastra_hono/dist/browser-stream/index.d.ts +54 -2
  2. package/dist/_types/@mastra_hono/dist/index.d.ts +1 -0
  3. package/dist/{analyze-BP0cLyWH.js → analyze-CFPQzJ-2.js} +166 -23
  4. package/dist/analyze-CFPQzJ-2.js.map +1 -0
  5. package/dist/{analyze-CcyVW_jJ.cjs → analyze-RHscSUJm.cjs} +169 -26
  6. package/dist/analyze-RHscSUJm.cjs.map +1 -0
  7. package/dist/{arktype-aI7TBD0R-DCxjN6oF.cjs → arktype-aI7TBD0R-BP9yJr5x.cjs} +2 -2
  8. package/dist/{arktype-aI7TBD0R-DCxjN6oF.cjs.map → arktype-aI7TBD0R-BP9yJr5x.cjs.map} +1 -1
  9. package/dist/{arktype-aI7TBD0R-BGjyzmsj.js → arktype-aI7TBD0R-cgd8o1cq.js} +2 -2
  10. package/dist/{arktype-aI7TBD0R-BGjyzmsj.js.map → arktype-aI7TBD0R-cgd8o1cq.js.map} +1 -1
  11. package/dist/build/analyze.cjs +1 -1
  12. package/dist/build/analyze.js +1 -1
  13. package/dist/build/bundler.cjs +1 -1
  14. package/dist/build/bundler.js +1 -1
  15. package/dist/build/fs-routing/discover.d.ts.map +1 -1
  16. package/dist/build/index.cjs +5 -5
  17. package/dist/build/index.js +5 -5
  18. package/dist/build/package-info.d.ts.map +1 -1
  19. package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
  20. package/dist/{build-CNYwIKPG.js → build-BPErn9z9.js} +72 -9
  21. package/dist/build-BPErn9z9.js.map +1 -0
  22. package/dist/{build-DGJW5-aB.cjs → build-dI0V50la.cjs} +72 -10
  23. package/dist/build-dI0V50la.cjs.map +1 -0
  24. package/dist/bundler/find-workspaces.d.ts +52 -0
  25. package/dist/bundler/find-workspaces.d.ts.map +1 -0
  26. package/dist/bundler/index.cjs +8 -7
  27. package/dist/bundler/index.cjs.map +1 -1
  28. package/dist/bundler/index.d.ts +1 -1
  29. package/dist/bundler/index.d.ts.map +1 -1
  30. package/dist/bundler/index.js +8 -7
  31. package/dist/bundler/index.js.map +1 -1
  32. package/dist/bundler/workspaceDependencies.d.ts.map +1 -1
  33. package/dist/{bundler-DtMHSv5_.js → bundler-B2N9qjjr.js} +16 -3
  34. package/dist/bundler-B2N9qjjr.js.map +1 -0
  35. package/dist/{bundler-CxslAqI_.cjs → bundler-DdqMsDyv.cjs} +21 -8
  36. package/dist/bundler-DdqMsDyv.cjs.map +1 -0
  37. package/dist/{bundlerOptions-ID9i-l8I.js → bundlerOptions-BHgxhzOz.js} +50 -2
  38. package/dist/bundlerOptions-BHgxhzOz.js.map +1 -0
  39. package/dist/{bundlerOptions-BtMp_x-T.cjs → bundlerOptions-DoMtLtV1.cjs} +52 -2
  40. package/dist/bundlerOptions-DoMtLtV1.cjs.map +1 -0
  41. package/dist/{core-QL_X0T4Y.cjs → core-DLXu5DhR.cjs} +7 -7
  42. package/dist/core-DLXu5DhR.cjs.map +1 -0
  43. package/dist/{core-D3wM1JKp.js → core-DPXkjlFR.js} +7 -7
  44. package/dist/core-DPXkjlFR.js.map +1 -0
  45. package/dist/docs/SKILL.md +1 -1
  46. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  47. package/dist/{effect-QlVUlMFu-DbWuPaWV.js → effect-QlVUlMFu-BcDDX4B1.js} +3 -3
  48. package/dist/{effect-QlVUlMFu-DbWuPaWV.js.map → effect-QlVUlMFu-BcDDX4B1.js.map} +1 -1
  49. package/dist/{effect-QlVUlMFu-B2nZ842E.cjs → effect-QlVUlMFu-DSdymSCI.cjs} +3 -3
  50. package/dist/{effect-QlVUlMFu-B2nZ842E.cjs.map → effect-QlVUlMFu-DSdymSCI.cjs.map} +1 -1
  51. package/dist/{esm-D-wYOO-S.js → esm-Bvuc3c9Z.js} +45 -45
  52. package/dist/{esm-D-wYOO-S.js.map → esm-Bvuc3c9Z.js.map} +1 -1
  53. package/dist/{esm-Ai6osZ1a.cjs → esm-SvpXPPt6.cjs} +45 -45
  54. package/dist/{esm-Ai6osZ1a.cjs.map → esm-SvpXPPt6.cjs.map} +1 -1
  55. package/dist/{index-CLddUTqr-DsGkVS-W.cjs → index-CLddUTqr-BpIkA9jT.cjs} +8 -8
  56. package/dist/{index-CLddUTqr-DsGkVS-W.cjs.map → index-CLddUTqr-BpIkA9jT.cjs.map} +1 -1
  57. package/dist/{index-CLddUTqr-BXqo9et4.js → index-CLddUTqr-CAnnFeRJ.js} +8 -8
  58. package/dist/{index-CLddUTqr-BXqo9et4.js.map → index-CLddUTqr-CAnnFeRJ.js.map} +1 -1
  59. package/dist/index.cjs +3 -3
  60. package/dist/index.js +3 -3
  61. package/dist/server/index.cjs +251 -10
  62. package/dist/server/index.cjs.map +1 -1
  63. package/dist/server/index.d.ts.map +1 -1
  64. package/dist/server/index.js +252 -11
  65. package/dist/server/index.js.map +1 -1
  66. package/dist/services/deps.d.ts +13 -1
  67. package/dist/services/deps.d.ts.map +1 -1
  68. package/dist/services/index.cjs +1 -1
  69. package/dist/services/index.js +1 -1
  70. package/dist/{services-DXqmEy8F.js → services-Ce_5qHk2.js} +140 -7
  71. package/dist/services-Ce_5qHk2.js.map +1 -0
  72. package/dist/{services-D_V7afWX.cjs → services-tWHmAszq.cjs} +150 -5
  73. package/dist/services-tWHmAszq.cjs.map +1 -0
  74. package/dist/{sury-CWZTCd75-OKz7uWLi.js → sury-CWZTCd75-CdrsvbNi.js} +3 -3
  75. package/dist/{sury-CWZTCd75-OKz7uWLi.js.map → sury-CWZTCd75-CdrsvbNi.js.map} +1 -1
  76. package/dist/{sury-CWZTCd75-ChXu4j-p.cjs → sury-CWZTCd75-eYGXWpqb.cjs} +3 -3
  77. package/dist/{sury-CWZTCd75-ChXu4j-p.cjs.map → sury-CWZTCd75-eYGXWpqb.cjs.map} +1 -1
  78. package/dist/{typebox-Dei93FPO-KTtPU745.cjs → typebox-Dei93FPO-B14DOQQD.cjs} +2 -2
  79. package/dist/{typebox-Dei93FPO-KTtPU745.cjs.map → typebox-Dei93FPO-B14DOQQD.cjs.map} +1 -1
  80. package/dist/{typebox-Dei93FPO-C5ACKU09.js → typebox-Dei93FPO-BCfJ-0cP.js} +2 -2
  81. package/dist/{typebox-Dei93FPO-C5ACKU09.js.map → typebox-Dei93FPO-BCfJ-0cP.js.map} +1 -1
  82. package/dist/{valibot--1zFm7rT-BuVb-6oJ.js → valibot--1zFm7rT-CCFD-Qor.js} +3 -3
  83. package/dist/{valibot--1zFm7rT-BuVb-6oJ.js.map → valibot--1zFm7rT-CCFD-Qor.js.map} +1 -1
  84. package/dist/{valibot--1zFm7rT-BeX3W1HK.cjs → valibot--1zFm7rT-aC9oayBT.cjs} +3 -3
  85. package/dist/{valibot--1zFm7rT-BeX3W1HK.cjs.map → valibot--1zFm7rT-aC9oayBT.cjs.map} +1 -1
  86. package/dist/{zod-Bwrt9trS-D5b1oyiT.js → zod-Bwrt9trS-D1WWVzpr.js} +5 -5
  87. package/dist/{zod-Bwrt9trS-D5b1oyiT.js.map → zod-Bwrt9trS-D1WWVzpr.js.map} +1 -1
  88. package/dist/{zod-Bwrt9trS-DGQs9DWc.cjs → zod-Bwrt9trS-OBujxXwV.cjs} +5 -5
  89. package/dist/{zod-Bwrt9trS-DGQs9DWc.cjs.map → zod-Bwrt9trS-OBujxXwV.cjs.map} +1 -1
  90. package/package.json +10 -12
  91. package/dist/analyze-BP0cLyWH.js.map +0 -1
  92. package/dist/analyze-CcyVW_jJ.cjs.map +0 -1
  93. package/dist/build-CNYwIKPG.js.map +0 -1
  94. package/dist/build-DGJW5-aB.cjs.map +0 -1
  95. package/dist/bundler-CxslAqI_.cjs.map +0 -1
  96. package/dist/bundler-DtMHSv5_.js.map +0 -1
  97. package/dist/bundlerOptions-BtMp_x-T.cjs.map +0 -1
  98. package/dist/bundlerOptions-ID9i-l8I.js.map +0 -1
  99. package/dist/core-D3wM1JKp.js.map +0 -1
  100. package/dist/core-QL_X0T4Y.cjs.map +0 -1
  101. package/dist/services-DXqmEy8F.js.map +0 -1
  102. package/dist/services-D_V7afWX.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundlerOptions-BHgxhzOz.js","names":["t","t"],"sources":["../src/build/babel/remove-all-options-except.ts","../src/build/plugins/remove-all-except.ts","../src/build/babel/remove-non-referenced-nodes.ts","../src/build/plugins/remove-unused-references.ts","../src/build/shared/extract-mastra-option.ts","../src/build/bundlerOptions.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport type { NodePath, PluginObject, types } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\n\nexport function removeAllOptionsFromMastraExcept(\n result: { hasCustomConfig: boolean },\n option: keyof MastraConfig,\n logger?: IMastraLogger,\n): PluginObject {\n return {\n name: 'remove-all-except-' + option + '-config',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports, but keep the underlying declarations — the\n // extracted option may reference them (e.g. `export const deployer = ...`\n // used as `new Mastra({ deployer })`). Unreferenced declarations are\n // dropped by the cleanup pass afterwards.\n exit(path) {\n if (path.node.declaration) {\n const [declaration] = path.replaceWith(path.node.declaration);\n // Already traversed — don't requeue, or the NewExpression visitor\n // would append the extracted export a second time.\n declaration.skip();\n } else {\n path.remove();\n }\n },\n },\n\n NewExpression(path, state) {\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 let mastraArgs = t.objectExpression([]);\n if (t.isObjectExpression(path.node.arguments[0])) {\n mastraArgs = path.node.arguments[0];\n }\n\n // Find the config property, skipping SpreadElement nodes\n let configProperty = mastraArgs.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === option,\n );\n let configValue: types.Expression = t.objectExpression([]);\n\n const programPath = path.scope.getProgramParent().path as NodePath<types.Program> | undefined;\n if (!programPath) {\n return;\n }\n\n if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {\n result.hasCustomConfig = true;\n configValue = configProperty.value;\n\n if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {\n const configBinding = state.file.scope.getBinding(option)!;\n\n if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {\n const id = path.scope.generateUidIdentifier(option);\n\n configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init!));\n configValue = id;\n }\n }\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), configValue)]),\n [],\n );\n\n programPath.node.body.push(exportDeclaration);\n },\n\n Program: {\n exit(path) {\n // Add a fallback export if no mastra configuration was found\n const hasExport = path.node.body.some(\n node => node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration',\n );\n\n if (!hasExport) {\n if (logger) {\n logger.warn('Mastra config could not be extracted', {\n option,\n details:\n 'Please make sure your entry file looks like this:\\nexport const mastra = new Mastra({\\n <option>: <value>\\n})',\n });\n }\n\n const fallbackExportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),\n [],\n );\n path.node.body.push(fallbackExportDeclaration);\n }\n },\n },\n },\n } satisfies PluginObject;\n}\n","import { transformAsync } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport type { Plugin, SourceMapInput } from 'rollup';\nimport { removeAllOptionsFromMastraExcept } from '../babel/remove-all-options-except';\n\nexport function removeAllOptionsFromMastraExceptPlugin(\n mastraEntry: string,\n name: keyof MastraConfig,\n result: { hasCustomConfig: boolean },\n options?: { sourcemap?: boolean; logger?: IMastraLogger },\n): Plugin {\n return {\n name: `remove-${name}`,\n transform(code, id) {\n if (id !== mastraEntry) {\n return;\n }\n\n return transformAsync(code, {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [() => removeAllOptionsFromMastraExcept(result, name, options?.logger)],\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 { types as t } from '@babel/core';\nimport type { PluginObject } from '@babel/core';\n\nexport function removeNonReferencedNodes() {\n return {\n name: 'remove-non-referenced-nodes',\n visitor: {\n Program(path) {\n // Get the scope information\n const scope = path.scope;\n\n // Filter body to keep only referenced nodes\n const currentBody = path.get('body');\n const filteredBody = currentBody.filter(childPath => {\n if (childPath.isExportDeclaration()) {\n return true;\n }\n\n // For variable declarations, check if any declared variables are referenced\n if (childPath.isVariableDeclaration()) {\n return childPath.node.declarations.some(decl => {\n if (!t.isIdentifier(decl.id)) {\n return false;\n }\n\n const name = decl.id.name;\n const binding = scope.getBinding(name);\n // Keep if it has references or is exported\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // For function/class declarations, check if they're referenced\n if (childPath.isFunctionDeclaration() || childPath.isClassDeclaration()) {\n if (!t.isIdentifier(childPath.node.id)) {\n return false;\n }\n\n const name = childPath.node.id.name;\n const binding = scope.getBinding(name);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n }\n\n // For imports, check if any imported items are referenced\n if (childPath.isImportDeclaration()) {\n return childPath.node.specifiers.some(specifier => {\n const importedName = specifier.local.name;\n const binding = scope.getBinding(importedName);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // Default to keeping other node types\n return false;\n });\n\n // Replace the program body with filtered nodes\n path.set(\n 'body',\n filteredBody.map(p => p.node),\n );\n },\n },\n } as PluginObject;\n}\n","import { transformAsync } from '@babel/core';\nimport { removeNonReferencedNodes } from '../babel/remove-non-referenced-nodes';\n\nexport async function recursiveRemoveNonReferencedNodes(code: string): Promise<{ code: string; map: any }> {\n const result = await transformAsync(code, {\n babelrc: false,\n configFile: false,\n plugins: [removeNonReferencedNodes],\n });\n\n // keep looping until the code is not changed\n if (result && result.code! !== code) {\n return recursiveRemoveNonReferencedNodes(result!.code!);\n }\n\n return {\n code: result!.code!,\n map: result!.map!,\n };\n}\n","import { realpathSync } from 'node:fs';\nimport { dirname, isAbsolute, sep } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\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 * as pkg from 'empathic/package';\nimport { rollup } from 'rollup';\nimport type { Plugin, RollupOutput } from 'rollup';\nimport { esbuild } from '../plugins/esbuild';\nimport { removeAllOptionsFromMastraExceptPlugin } from '../plugins/remove-all-except';\nimport { recursiveRemoveNonReferencedNodes } from '../plugins/remove-unused-references';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\nimport { getNodeResolveOptions, isBareModuleSpecifier } from '../utils';\n\nconst TS_SOURCE = /\\.tsx?$/;\nconst NODE_MODULES = `${sep}node_modules${sep}`;\n\n/**\n * Packages outside node_modules, such as workspace packages, may ship raw TypeScript (e.g. `exports` pointing to\n * `src/index.ts`), which Node cannot load from the extracted config. Inline those so esbuild transpiles them. Bare\n * imports made from inlined sources stay external but are pinned to the file they resolve to from that source: the\n * extracted config lives in `.mastra/output` and can't see the package's own `node_modules` (e.g. pnpm isolated\n * installs). The app's own imports keep resolving by name.\n */\nfunction typescriptSourcesResolver(entryFile: string): Plugin {\n const appPackageJson = pkg.up({ cwd: dirname(entryFile) });\n const appDir = appPackageJson ? dirname(appPackageJson) : dirname(entryFile);\n // App files keep the entry's path, files resolved by node-resolve are real paths\n const appRoots = [appDir + sep, realpathSync(appDir) + sep];\n const isInlinedSource = (file: string) =>\n isAbsolute(file) && !file.includes(NODE_MODULES) && !appRoots.some(root => file.startsWith(root));\n\n const resolver = nodeResolve({\n ...getNodeResolveOptions('node'),\n extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx'],\n });\n const resolveHook = resolver.resolveId!;\n const resolve = typeof resolveHook === 'function' ? resolveHook : resolveHook.handler;\n\n return {\n ...resolver,\n name: 'typescript-sources-resolver',\n async resolveId(id, importer, options) {\n if (!importer || !isBareModuleSpecifier(id)) {\n return null;\n }\n\n const resolved = await resolve.call(this, id, importer, options);\n if (!resolved || typeof resolved !== 'object' || resolved.external) {\n return null;\n }\n\n if (TS_SOURCE.test(resolved.id) && !resolved.id.includes(NODE_MODULES)) {\n return resolved.id;\n }\n\n return isInlinedSource(importer) ? { id: pathToFileURL(resolved.id).href, external: true } : null;\n },\n };\n}\n\nexport function extractMastraOptionBundler(\n name: keyof MastraConfig,\n entryFile: string,\n result: {\n hasCustomConfig: boolean;\n },\n logger?: IMastraLogger,\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n [`${name}-config`]: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n typescriptSourcesResolver(entryFile),\n // transpile typescript to something we understand\n esbuild(),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n json(),\n removeAllOptionsFromMastraExceptPlugin(entryFile, name, result, { logger }),\n // let esbuild remove all unused imports\n esbuild(),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove it once more\n esbuild(),\n ],\n });\n}\n\nexport async function extractMastraOption<T extends keyof MastraConfig>(\n name: T,\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<{\n bundleOutput: RollupOutput;\n getConfig: () => Promise<MastraConfig[T]>;\n} | null> {\n const result = {\n hasCustomConfig: false,\n };\n\n const bundler = await extractMastraOptionBundler(name, entryFile, result, logger);\n\n const output = await bundler.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (result.hasCustomConfig) {\n const configPath = `${outputDir}/${name}-config.mjs`;\n\n return {\n bundleOutput: output,\n getConfig: () => import(pathToFileURL(configPath).href).then(m => m[name] as MastraConfig[T]),\n };\n }\n\n return null;\n}\n","import type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\n\nexport function getBundlerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('bundler', entryFile, result);\n}\n\nexport async function getBundlerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['bundler'] | null> {\n const result = await extractMastraOption('bundler', entryFile, outputDir, logger);\n\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAgB,iCACd,QACA,QACA,QACc;CACd,OAAO;EACL,MAAM,uBAAuB,SAAS;EACtC,SAAS;GACP,wBAAwB,EAKtB,KAAK,MAAM;IACT,IAAI,KAAK,KAAK,aAAa;KACzB,MAAM,CAAC,eAAe,KAAK,YAAY,KAAK,KAAK,WAAW;KAG5D,YAAY,KAAK;IACnB,OACE,KAAK,OAAO;GAEhB,EACF;GAEA,cAAc,MAAM,OAAO;IAGzB,IAAI,CADsB,KAAK,YAAW,SAAQA,MAAE,qBAAqB,KAAK,IAAI,CAC7D,GACnB;IAGF,MAAM,aAAa,KAAK,WAAW;IAEnC,IAAI,CAACA,MAAE,qBAAqB,UAAU,KAAK,CAACA,MAAE,aAAa,WAAW,EAAE,KAAK,WAAW,GAAG,SAAS,UAClG;IAGF,IAAI,aAAaA,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AAU,CAAC,CAAC,KAAK,CAAC,MAAK,MAAK,EAAE,KAAwB;EAC9F;CACF;CAEA,OAAO;AACT;;;ACnIA,eAAsB,kBACpB,WACA,WACA,QACmC;CACnC,MAAM,SAAS,MAAM,oBAAoB,WAAW,WAAW,WAAW,MAAM;CAEhF,IAAI,CAAC,QACH,OAAO;CAGT,OAAO,OAAO,UAAU;AAC1B"}
@@ -1,5 +1,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_bundler = require("./bundler-CxslAqI_.cjs");
2
+ const require_utils = require("./utils-Bsr_sEcH.cjs");
3
+ const require_bundler = require("./bundler-DdqMsDyv.cjs");
4
+ let fs = require("fs");
5
+ let path = require("path");
6
+ let empathic_package = require("empathic/package");
7
+ empathic_package = require_rolldown_runtime.__toESM(empathic_package, 1);
3
8
  let _babel_core = require("@babel/core");
4
9
  let url = require("url");
5
10
  let _rollup_plugin_commonjs = require("@rollup/plugin-commonjs");
@@ -8,6 +13,8 @@ let _rollup_plugin_json = require("@rollup/plugin-json");
8
13
  _rollup_plugin_json = require_rolldown_runtime.__toESM(_rollup_plugin_json, 1);
9
14
  let rollup = require("rollup");
10
15
  let _optimize_lodash_rollup_plugin = require("@optimize-lodash/rollup-plugin");
16
+ let _rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
17
+ _rollup_plugin_node_resolve = require_rolldown_runtime.__toESM(_rollup_plugin_node_resolve, 1);
11
18
  //#region src/build/babel/remove-all-options-except.ts
12
19
  function removeAllOptionsFromMastraExcept(result, option, logger) {
13
20
  return {
@@ -125,6 +132,48 @@ async function recursiveRemoveNonReferencedNodes(code) {
125
132
  }
126
133
  //#endregion
127
134
  //#region src/build/shared/extract-mastra-option.ts
135
+ const TS_SOURCE = /\.tsx?$/;
136
+ const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
137
+ /**
138
+ * Packages outside node_modules, such as workspace packages, may ship raw TypeScript (e.g. `exports` pointing to
139
+ * `src/index.ts`), which Node cannot load from the extracted config. Inline those so esbuild transpiles them. Bare
140
+ * imports made from inlined sources stay external but are pinned to the file they resolve to from that source: the
141
+ * extracted config lives in `.mastra/output` and can't see the package's own `node_modules` (e.g. pnpm isolated
142
+ * installs). The app's own imports keep resolving by name.
143
+ */
144
+ function typescriptSourcesResolver(entryFile) {
145
+ const appPackageJson = empathic_package.up({ cwd: (0, path.dirname)(entryFile) });
146
+ const appDir = appPackageJson ? (0, path.dirname)(appPackageJson) : (0, path.dirname)(entryFile);
147
+ const appRoots = [appDir + path.sep, (0, fs.realpathSync)(appDir) + path.sep];
148
+ const isInlinedSource = (file) => (0, path.isAbsolute)(file) && !file.includes(NODE_MODULES) && !appRoots.some((root) => file.startsWith(root));
149
+ const resolver = (0, _rollup_plugin_node_resolve.default)({
150
+ ...require_utils.getNodeResolveOptions("node"),
151
+ extensions: [
152
+ ".mjs",
153
+ ".js",
154
+ ".json",
155
+ ".node",
156
+ ".ts",
157
+ ".tsx"
158
+ ]
159
+ });
160
+ const resolveHook = resolver.resolveId;
161
+ const resolve = typeof resolveHook === "function" ? resolveHook : resolveHook.handler;
162
+ return {
163
+ ...resolver,
164
+ name: "typescript-sources-resolver",
165
+ async resolveId(id, importer, options) {
166
+ if (!importer || !require_utils.isBareModuleSpecifier(id)) return null;
167
+ const resolved = await resolve.call(this, id, importer, options);
168
+ if (!resolved || typeof resolved !== "object" || resolved.external) return null;
169
+ if (TS_SOURCE.test(resolved.id) && !resolved.id.includes(NODE_MODULES)) return resolved.id;
170
+ return isInlinedSource(importer) ? {
171
+ id: (0, url.pathToFileURL)(resolved.id).href,
172
+ external: true
173
+ } : null;
174
+ }
175
+ };
176
+ }
128
177
  function extractMastraOptionBundler(name, entryFile, result, logger) {
129
178
  return (0, rollup.rollup)({
130
179
  logLevel: "silent",
@@ -132,6 +181,7 @@ function extractMastraOptionBundler(name, entryFile, result, logger) {
132
181
  treeshake: "smallest",
133
182
  plugins: [
134
183
  require_bundler.tsConfigPaths(),
184
+ typescriptSourcesResolver(entryFile),
135
185
  require_bundler.esbuild(),
136
186
  (0, _optimize_lodash_rollup_plugin.optimizeLodashImports)({ include: "**/*.{js,ts,mjs,cjs}" }),
137
187
  (0, _rollup_plugin_commonjs.default)({
@@ -191,4 +241,4 @@ Object.defineProperty(exports, "getBundlerOptions", {
191
241
  }
192
242
  });
193
243
 
194
- //# sourceMappingURL=bundlerOptions-BtMp_x-T.cjs.map
244
+ //# sourceMappingURL=bundlerOptions-DoMtLtV1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundlerOptions-DoMtLtV1.cjs","names":["t","t","sep","pkg","getNodeResolveOptions","isBareModuleSpecifier","tsConfigPaths","esbuild"],"sources":["../src/build/babel/remove-all-options-except.ts","../src/build/plugins/remove-all-except.ts","../src/build/babel/remove-non-referenced-nodes.ts","../src/build/plugins/remove-unused-references.ts","../src/build/shared/extract-mastra-option.ts","../src/build/bundlerOptions.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport type { NodePath, PluginObject, types } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\n\nexport function removeAllOptionsFromMastraExcept(\n result: { hasCustomConfig: boolean },\n option: keyof MastraConfig,\n logger?: IMastraLogger,\n): PluginObject {\n return {\n name: 'remove-all-except-' + option + '-config',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports, but keep the underlying declarations — the\n // extracted option may reference them (e.g. `export const deployer = ...`\n // used as `new Mastra({ deployer })`). Unreferenced declarations are\n // dropped by the cleanup pass afterwards.\n exit(path) {\n if (path.node.declaration) {\n const [declaration] = path.replaceWith(path.node.declaration);\n // Already traversed — don't requeue, or the NewExpression visitor\n // would append the extracted export a second time.\n declaration.skip();\n } else {\n path.remove();\n }\n },\n },\n\n NewExpression(path, state) {\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 let mastraArgs = t.objectExpression([]);\n if (t.isObjectExpression(path.node.arguments[0])) {\n mastraArgs = path.node.arguments[0];\n }\n\n // Find the config property, skipping SpreadElement nodes\n let configProperty = mastraArgs.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === option,\n );\n let configValue: types.Expression = t.objectExpression([]);\n\n const programPath = path.scope.getProgramParent().path as NodePath<types.Program> | undefined;\n if (!programPath) {\n return;\n }\n\n if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {\n result.hasCustomConfig = true;\n configValue = configProperty.value;\n\n if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {\n const configBinding = state.file.scope.getBinding(option)!;\n\n if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {\n const id = path.scope.generateUidIdentifier(option);\n\n configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init!));\n configValue = id;\n }\n }\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), configValue)]),\n [],\n );\n\n programPath.node.body.push(exportDeclaration);\n },\n\n Program: {\n exit(path) {\n // Add a fallback export if no mastra configuration was found\n const hasExport = path.node.body.some(\n node => node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration',\n );\n\n if (!hasExport) {\n if (logger) {\n logger.warn('Mastra config could not be extracted', {\n option,\n details:\n 'Please make sure your entry file looks like this:\\nexport const mastra = new Mastra({\\n <option>: <value>\\n})',\n });\n }\n\n const fallbackExportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),\n [],\n );\n path.node.body.push(fallbackExportDeclaration);\n }\n },\n },\n },\n } satisfies PluginObject;\n}\n","import { transformAsync } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport type { Plugin, SourceMapInput } from 'rollup';\nimport { removeAllOptionsFromMastraExcept } from '../babel/remove-all-options-except';\n\nexport function removeAllOptionsFromMastraExceptPlugin(\n mastraEntry: string,\n name: keyof MastraConfig,\n result: { hasCustomConfig: boolean },\n options?: { sourcemap?: boolean; logger?: IMastraLogger },\n): Plugin {\n return {\n name: `remove-${name}`,\n transform(code, id) {\n if (id !== mastraEntry) {\n return;\n }\n\n return transformAsync(code, {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [() => removeAllOptionsFromMastraExcept(result, name, options?.logger)],\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 { types as t } from '@babel/core';\nimport type { PluginObject } from '@babel/core';\n\nexport function removeNonReferencedNodes() {\n return {\n name: 'remove-non-referenced-nodes',\n visitor: {\n Program(path) {\n // Get the scope information\n const scope = path.scope;\n\n // Filter body to keep only referenced nodes\n const currentBody = path.get('body');\n const filteredBody = currentBody.filter(childPath => {\n if (childPath.isExportDeclaration()) {\n return true;\n }\n\n // For variable declarations, check if any declared variables are referenced\n if (childPath.isVariableDeclaration()) {\n return childPath.node.declarations.some(decl => {\n if (!t.isIdentifier(decl.id)) {\n return false;\n }\n\n const name = decl.id.name;\n const binding = scope.getBinding(name);\n // Keep if it has references or is exported\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // For function/class declarations, check if they're referenced\n if (childPath.isFunctionDeclaration() || childPath.isClassDeclaration()) {\n if (!t.isIdentifier(childPath.node.id)) {\n return false;\n }\n\n const name = childPath.node.id.name;\n const binding = scope.getBinding(name);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n }\n\n // For imports, check if any imported items are referenced\n if (childPath.isImportDeclaration()) {\n return childPath.node.specifiers.some(specifier => {\n const importedName = specifier.local.name;\n const binding = scope.getBinding(importedName);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // Default to keeping other node types\n return false;\n });\n\n // Replace the program body with filtered nodes\n path.set(\n 'body',\n filteredBody.map(p => p.node),\n );\n },\n },\n } as PluginObject;\n}\n","import { transformAsync } from '@babel/core';\nimport { removeNonReferencedNodes } from '../babel/remove-non-referenced-nodes';\n\nexport async function recursiveRemoveNonReferencedNodes(code: string): Promise<{ code: string; map: any }> {\n const result = await transformAsync(code, {\n babelrc: false,\n configFile: false,\n plugins: [removeNonReferencedNodes],\n });\n\n // keep looping until the code is not changed\n if (result && result.code! !== code) {\n return recursiveRemoveNonReferencedNodes(result!.code!);\n }\n\n return {\n code: result!.code!,\n map: result!.map!,\n };\n}\n","import { realpathSync } from 'node:fs';\nimport { dirname, isAbsolute, sep } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\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 * as pkg from 'empathic/package';\nimport { rollup } from 'rollup';\nimport type { Plugin, RollupOutput } from 'rollup';\nimport { esbuild } from '../plugins/esbuild';\nimport { removeAllOptionsFromMastraExceptPlugin } from '../plugins/remove-all-except';\nimport { recursiveRemoveNonReferencedNodes } from '../plugins/remove-unused-references';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\nimport { getNodeResolveOptions, isBareModuleSpecifier } from '../utils';\n\nconst TS_SOURCE = /\\.tsx?$/;\nconst NODE_MODULES = `${sep}node_modules${sep}`;\n\n/**\n * Packages outside node_modules, such as workspace packages, may ship raw TypeScript (e.g. `exports` pointing to\n * `src/index.ts`), which Node cannot load from the extracted config. Inline those so esbuild transpiles them. Bare\n * imports made from inlined sources stay external but are pinned to the file they resolve to from that source: the\n * extracted config lives in `.mastra/output` and can't see the package's own `node_modules` (e.g. pnpm isolated\n * installs). The app's own imports keep resolving by name.\n */\nfunction typescriptSourcesResolver(entryFile: string): Plugin {\n const appPackageJson = pkg.up({ cwd: dirname(entryFile) });\n const appDir = appPackageJson ? dirname(appPackageJson) : dirname(entryFile);\n // App files keep the entry's path, files resolved by node-resolve are real paths\n const appRoots = [appDir + sep, realpathSync(appDir) + sep];\n const isInlinedSource = (file: string) =>\n isAbsolute(file) && !file.includes(NODE_MODULES) && !appRoots.some(root => file.startsWith(root));\n\n const resolver = nodeResolve({\n ...getNodeResolveOptions('node'),\n extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx'],\n });\n const resolveHook = resolver.resolveId!;\n const resolve = typeof resolveHook === 'function' ? resolveHook : resolveHook.handler;\n\n return {\n ...resolver,\n name: 'typescript-sources-resolver',\n async resolveId(id, importer, options) {\n if (!importer || !isBareModuleSpecifier(id)) {\n return null;\n }\n\n const resolved = await resolve.call(this, id, importer, options);\n if (!resolved || typeof resolved !== 'object' || resolved.external) {\n return null;\n }\n\n if (TS_SOURCE.test(resolved.id) && !resolved.id.includes(NODE_MODULES)) {\n return resolved.id;\n }\n\n return isInlinedSource(importer) ? { id: pathToFileURL(resolved.id).href, external: true } : null;\n },\n };\n}\n\nexport function extractMastraOptionBundler(\n name: keyof MastraConfig,\n entryFile: string,\n result: {\n hasCustomConfig: boolean;\n },\n logger?: IMastraLogger,\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n [`${name}-config`]: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n typescriptSourcesResolver(entryFile),\n // transpile typescript to something we understand\n esbuild(),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n json(),\n removeAllOptionsFromMastraExceptPlugin(entryFile, name, result, { logger }),\n // let esbuild remove all unused imports\n esbuild(),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove it once more\n esbuild(),\n ],\n });\n}\n\nexport async function extractMastraOption<T extends keyof MastraConfig>(\n name: T,\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<{\n bundleOutput: RollupOutput;\n getConfig: () => Promise<MastraConfig[T]>;\n} | null> {\n const result = {\n hasCustomConfig: false,\n };\n\n const bundler = await extractMastraOptionBundler(name, entryFile, result, logger);\n\n const output = await bundler.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (result.hasCustomConfig) {\n const configPath = `${outputDir}/${name}-config.mjs`;\n\n return {\n bundleOutput: output,\n getConfig: () => import(pathToFileURL(configPath).href).then(m => m[name] as MastraConfig[T]),\n };\n }\n\n return null;\n}\n","import type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\n\nexport function getBundlerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('bundler', entryFile, result);\n}\n\nexport async function getBundlerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['bundler'] | null> {\n const result = await extractMastraOption('bundler', entryFile, outputDir, logger);\n\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,SAAgB,iCACd,QACA,QACA,QACc;CACd,OAAO;EACL,MAAM,uBAAuB,SAAS;EACtC,SAAS;GACP,wBAAwB,EAKtB,KAAK,MAAM;IACT,IAAI,KAAK,KAAK,aAAa;KACzB,MAAM,CAAC,eAAe,KAAK,YAAY,KAAK,KAAK,WAAW;KAG5D,YAAY,KAAK;IACnB,OACE,KAAK,OAAO;GAEhB,EACF;GAEA,cAAc,MAAM,OAAO;IA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AA,+BAAA,sBAAA,CAAA,EACpB,SAAS,uBACX,CAAC;IACQ,GAAA,wBAAA,QAAA,CAAA;IACP,YAAY,CAAC,OAAO,KAAK;IACzB,gBAAgB;IAChB,yBAAyB;IACzB,gBAAgB;GAClB,CAAC;IACI,GAAA,oBAAA,QAAA,CAAA;GACL,uCAAuC,WAAW,MAAM,QAAQ,EAAE,OAAO,CAAC;GAE1EA,gBAAAA,QAAQ;GACR;IACE,MAAM;IACN,UAAU,MAAM,IAAI;KAClB,IAAI,OAAO,WACT;KAGF,OAAO,kCAAkC,IAAI;IAC/C;GACF;GAEAA,gBAAAA,QAAQ;EACV;CACF,CAAC;AACH;AAEA,eAAsB,oBACpB,MACA,WACA,WACA,QAIQ;CACR,MAAM,SAAS,EACb,iBAAiB,MACnB;CAIA,MAAM,SAAS,OAAM,MAFC,2BAA2B,MAAM,WAAW,QAAQ,MAAM,EAAA,CAEnD,MAAM;EACjC,KAAK;EACL,QAAQ;EACR,gBAAgB;CAClB,CAAC;CAED,IAAI,OAAO,iBAAiB;EAC1B,MAAM,aAAa,GAAG,UAAU,GAAG,KAAK;EAExC,OAAO;GACL,cAAc;GACd,iBAAiB,QAAA,GAAA,IAAA,cAAA,CAAqB,UAAU,CAAC,CAAC,KAAK,CAAC,MAAK,MAAK,EAAE,KAAwB;EAC9F;CACF;CAEA,OAAO;AACT;;;ACnIA,eAAsB,kBACpB,WACA,WACA,QACmC;CACnC,MAAM,SAAS,MAAM,oBAAoB,WAAW,WAAW,WAAW,MAAM;CAEhF,IAAI,CAAC,QACH,OAAO;CAGT,OAAO,OAAO,UAAU;AAC1B"}
@@ -1,4 +1,4 @@
1
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/util.js
1
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/util.js
2
2
  function getEnumValues(entries) {
3
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
4
4
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -24,17 +24,17 @@ const BIGINT_FORMAT_RANGES = {
24
24
  uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
25
25
  };
26
26
  //#endregion
27
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/regexes.js
27
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/regexes.js
28
28
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
29
29
  const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
30
30
  const integer = /^-?\d+$/;
31
31
  const number = /^-?\d+(?:\.\d+)?$/;
32
32
  //#endregion
33
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/schemas.js
33
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/schemas.js
34
34
  const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
35
35
  const base64urlCharset = /^[A-Za-z0-9_-]*$/;
36
36
  //#endregion
37
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/registries.js
37
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/registries.js
38
38
  var _a;
39
39
  var $ZodRegistry = class {
40
40
  constructor() {
@@ -81,7 +81,7 @@ function registry() {
81
81
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
82
82
  const globalRegistry = globalThis.__zod_globalRegistry;
83
83
  //#endregion
84
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/to-json-schema.js
84
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/to-json-schema.js
85
85
  function assignProps(target, ...sources) {
86
86
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
87
87
  return target;
@@ -510,7 +510,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
510
510
  return finalize(ctx, schema);
511
511
  };
512
512
  //#endregion
513
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.5/6448fd814698825170f93bd428080c609bd45ccbc007f4c2dfd5fac1bb52f28d/node_modules/zod/v4/core/json-schema-processors.js
513
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
514
514
  const narrowMin = (agg, key, value) => {
515
515
  if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
516
516
  };
@@ -1156,4 +1156,4 @@ function toJSONSchema(input, params) {
1156
1156
  //#endregion
1157
1157
  exports.toJSONSchema = toJSONSchema;
1158
1158
 
1159
- //# sourceMappingURL=core-QL_X0T4Y.cjs.map
1159
+ //# sourceMappingURL=core-DLXu5DhR.cjs.map