@mastra/deployer 1.79.0-alpha.1 → 1.79.0-alpha.11
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/dist/browser-stream/index.d.ts +54 -2
- package/dist/_types/@mastra_hono/dist/index.d.ts +1 -0
- package/dist/{analyze-CcyVW_jJ.cjs → analyze-Cb5JJp7Y.cjs} +178 -31
- package/dist/analyze-Cb5JJp7Y.cjs.map +1 -0
- package/dist/{analyze-BP0cLyWH.js → analyze-CbVhoukh.js} +175 -28
- package/dist/analyze-CbVhoukh.js.map +1 -0
- package/dist/{arktype-aI7TBD0R-DCxjN6oF.cjs → arktype-aI7TBD0R-BP9yJr5x.cjs} +2 -2
- package/dist/arktype-aI7TBD0R-BP9yJr5x.cjs.map +1 -0
- package/dist/{arktype-aI7TBD0R-BGjyzmsj.js → arktype-aI7TBD0R-cgd8o1cq.js} +2 -2
- package/dist/arktype-aI7TBD0R-cgd8o1cq.js.map +1 -0
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.js +1 -2
- package/dist/build/bundler.cjs +1 -1
- package/dist/build/bundler.js +1 -2
- package/dist/build/fs-routing/discover.d.ts.map +1 -1
- package/dist/build/index.cjs +6 -6
- package/dist/build/index.js +5 -5
- package/dist/build/package-info.d.ts.map +1 -1
- package/dist/build/plugins/tsconfig-paths.d.ts +4 -3
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
- package/dist/{build-DGJW5-aB.cjs → build-DGwrw0dD.cjs} +112 -50
- package/dist/build-DGwrw0dD.cjs.map +1 -0
- package/dist/{build-CNYwIKPG.js → build-qnakIZAs.js} +72 -9
- package/dist/build-qnakIZAs.js.map +1 -0
- package/dist/bundler/find-workspaces.d.ts +52 -0
- package/dist/bundler/find-workspaces.d.ts.map +1 -0
- package/dist/bundler/index.cjs +27 -19
- package/dist/bundler/index.cjs.map +1 -1
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +25 -17
- package/dist/bundler/index.js.map +1 -1
- package/dist/bundler/workspaceDependencies.d.ts.map +1 -1
- package/dist/{bundler-DtMHSv5_.js → bundler-BUqyRuGu.js} +78 -69
- package/dist/bundler-BUqyRuGu.js.map +1 -0
- package/dist/{bundler-CxslAqI_.cjs → bundler-Dpd5nkcu.cjs} +84 -76
- package/dist/bundler-Dpd5nkcu.cjs.map +1 -0
- package/dist/{bundlerOptions-BtMp_x-T.cjs → bundlerOptions-DHcbcD1a.cjs} +53 -3
- package/dist/bundlerOptions-DHcbcD1a.cjs.map +1 -0
- package/dist/{bundlerOptions-ID9i-l8I.js → bundlerOptions-DMxva0Sp.js} +50 -2
- package/dist/bundlerOptions-DMxva0Sp.js.map +1 -0
- package/dist/{core-D3wM1JKp.js → core-75DLMtZL.js} +23 -19
- package/dist/core-75DLMtZL.js.map +1 -0
- package/dist/{core-QL_X0T4Y.cjs → core-XnTfh3E_.cjs} +23 -19
- package/dist/core-XnTfh3E_.cjs.map +1 -0
- package/dist/dist-DYm9bBZO.js.map +1 -1
- package/dist/dist-twPJIvYf.cjs.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{effect-QlVUlMFu-B2nZ842E.cjs → effect-QlVUlMFu-CC0Mpf1v.cjs} +3 -3
- package/dist/{effect-QlVUlMFu-B2nZ842E.cjs.map → effect-QlVUlMFu-CC0Mpf1v.cjs.map} +1 -1
- package/dist/{effect-QlVUlMFu-DbWuPaWV.js → effect-QlVUlMFu-Cvay38Oi.js} +3 -3
- package/dist/{effect-QlVUlMFu-DbWuPaWV.js.map → effect-QlVUlMFu-Cvay38Oi.js.map} +1 -1
- package/dist/{esm-D-wYOO-S.js → esm-ClsnEB2d.js} +111 -113
- package/dist/{esm-D-wYOO-S.js.map → esm-ClsnEB2d.js.map} +1 -1
- package/dist/{esm-Ai6osZ1a.cjs → esm-D74qc_jV.cjs} +111 -113
- package/dist/{esm-Ai6osZ1a.cjs.map → esm-D74qc_jV.cjs.map} +1 -1
- package/dist/{index-CLddUTqr-BXqo9et4.js → index-CLddUTqr-86A1rnBL.js} +8 -8
- package/dist/{index-CLddUTqr-BXqo9et4.js.map → index-CLddUTqr-86A1rnBL.js.map} +1 -1
- package/dist/{index-CLddUTqr-DsGkVS-W.cjs → index-CLddUTqr-D0GzVJyg.cjs} +8 -8
- package/dist/{index-CLddUTqr-DsGkVS-W.cjs.map → index-CLddUTqr-D0GzVJyg.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/{rolldown-runtime-emK7D4bc.cjs → rolldown-runtime-Gi87jfEt.cjs} +2 -2
- package/dist/server/index.cjs +338 -84
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +316 -62
- package/dist/server/index.js.map +1 -1
- package/dist/services/deps.d.ts +13 -1
- package/dist/services/deps.d.ts.map +1 -1
- package/dist/services/index.cjs +1 -1
- package/dist/services/index.js +1 -2
- package/dist/{services-DXqmEy8F.js → services-183Omg3U.js} +167 -31
- package/dist/services-183Omg3U.js.map +1 -0
- package/dist/{services-D_V7afWX.cjs → services-C1jM_6ta.cjs} +180 -31
- package/dist/services-C1jM_6ta.cjs.map +1 -0
- package/dist/{sury-CWZTCd75-ChXu4j-p.cjs → sury-CWZTCd75-TIJwZAOz.cjs} +3 -3
- package/dist/{sury-CWZTCd75-ChXu4j-p.cjs.map → sury-CWZTCd75-TIJwZAOz.cjs.map} +1 -1
- package/dist/{sury-CWZTCd75-OKz7uWLi.js → sury-CWZTCd75-r5hgAI0o.js} +3 -3
- package/dist/{sury-CWZTCd75-OKz7uWLi.js.map → sury-CWZTCd75-r5hgAI0o.js.map} +1 -1
- package/dist/{typebox-Dei93FPO-KTtPU745.cjs → typebox-Dei93FPO-B14DOQQD.cjs} +2 -2
- package/dist/typebox-Dei93FPO-B14DOQQD.cjs.map +1 -0
- package/dist/{typebox-Dei93FPO-C5ACKU09.js → typebox-Dei93FPO-BCfJ-0cP.js} +2 -2
- package/dist/typebox-Dei93FPO-BCfJ-0cP.js.map +1 -0
- package/dist/{utils-Bsr_sEcH.cjs → utils-C-gJcJAo.cjs} +4 -4
- package/dist/utils-C-gJcJAo.cjs.map +1 -0
- package/dist/{valibot--1zFm7rT-BeX3W1HK.cjs → valibot--1zFm7rT-BiQdCU9y.cjs} +3 -3
- package/dist/{valibot--1zFm7rT-BeX3W1HK.cjs.map → valibot--1zFm7rT-BiQdCU9y.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-BuVb-6oJ.js → valibot--1zFm7rT-CU_2XLpq.js} +3 -3
- package/dist/{valibot--1zFm7rT-BuVb-6oJ.js.map → valibot--1zFm7rT-CU_2XLpq.js.map} +1 -1
- package/dist/validator/custom-resolver.cjs +1 -1
- package/dist/validator/custom-resolver.cjs.map +1 -1
- package/dist/validator/loader.cjs.map +1 -1
- package/dist/validator/loader.js.map +1 -1
- package/dist/{zod-Bwrt9trS-D5b1oyiT.js → zod-Bwrt9trS-BurSNK0g.js} +5 -5
- package/dist/{zod-Bwrt9trS-D5b1oyiT.js.map → zod-Bwrt9trS-BurSNK0g.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-DGQs9DWc.cjs → zod-Bwrt9trS-Kv0hKWrV.cjs} +5 -5
- package/dist/{zod-Bwrt9trS-DGQs9DWc.cjs.map → zod-Bwrt9trS-Kv0hKWrV.cjs.map} +1 -1
- package/package.json +11 -14
- package/dist/analyze-BP0cLyWH.js.map +0 -1
- package/dist/analyze-CcyVW_jJ.cjs.map +0 -1
- package/dist/arktype-aI7TBD0R-BGjyzmsj.js.map +0 -1
- package/dist/arktype-aI7TBD0R-DCxjN6oF.cjs.map +0 -1
- package/dist/build-CNYwIKPG.js.map +0 -1
- package/dist/build-DGJW5-aB.cjs.map +0 -1
- package/dist/bundler-CxslAqI_.cjs.map +0 -1
- package/dist/bundler-DtMHSv5_.js.map +0 -1
- package/dist/bundlerOptions-BtMp_x-T.cjs.map +0 -1
- package/dist/bundlerOptions-ID9i-l8I.js.map +0 -1
- package/dist/core-D3wM1JKp.js.map +0 -1
- package/dist/core-QL_X0T4Y.cjs.map +0 -1
- package/dist/services-DXqmEy8F.js.map +0 -1
- package/dist/services-D_V7afWX.cjs.map +0 -1
- package/dist/typebox-Dei93FPO-C5ACKU09.js.map +0 -1
- package/dist/typebox-Dei93FPO-KTtPU745.cjs.map +0 -1
- package/dist/utils-Bsr_sEcH.cjs.map +0 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as getNodeResolveOptions, s as isBareModuleSpecifier } from "./utils-Bl3Lm7SI.js";
|
|
2
|
+
import { g as esbuild, o as tsConfigPaths } from "./bundler-BUqyRuGu.js";
|
|
3
|
+
import { realpathSync } from "fs";
|
|
4
|
+
import { dirname, isAbsolute, sep } from "path";
|
|
5
|
+
import * as pkg from "empathic/package";
|
|
2
6
|
import { transformAsync, types } from "@babel/core";
|
|
3
7
|
import { pathToFileURL } from "url";
|
|
4
8
|
import commonjs from "@rollup/plugin-commonjs";
|
|
5
9
|
import json from "@rollup/plugin-json";
|
|
6
10
|
import { rollup } from "rollup";
|
|
7
11
|
import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
|
|
12
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
8
13
|
//#region src/build/babel/remove-all-options-except.ts
|
|
9
14
|
function removeAllOptionsFromMastraExcept(result, option, logger) {
|
|
10
15
|
return {
|
|
@@ -122,6 +127,48 @@ async function recursiveRemoveNonReferencedNodes(code) {
|
|
|
122
127
|
}
|
|
123
128
|
//#endregion
|
|
124
129
|
//#region src/build/shared/extract-mastra-option.ts
|
|
130
|
+
const TS_SOURCE = /\.tsx?$/;
|
|
131
|
+
const NODE_MODULES = `${sep}node_modules${sep}`;
|
|
132
|
+
/**
|
|
133
|
+
* Packages outside node_modules, such as workspace packages, may ship raw TypeScript (e.g. `exports` pointing to
|
|
134
|
+
* `src/index.ts`), which Node cannot load from the extracted config. Inline those so esbuild transpiles them. Bare
|
|
135
|
+
* imports made from inlined sources stay external but are pinned to the file they resolve to from that source: the
|
|
136
|
+
* extracted config lives in `.mastra/output` and can't see the package's own `node_modules` (e.g. pnpm isolated
|
|
137
|
+
* installs). The app's own imports keep resolving by name.
|
|
138
|
+
*/
|
|
139
|
+
function typescriptSourcesResolver(entryFile) {
|
|
140
|
+
const appPackageJson = pkg.up({ cwd: dirname(entryFile) });
|
|
141
|
+
const appDir = appPackageJson ? dirname(appPackageJson) : dirname(entryFile);
|
|
142
|
+
const appRoots = [appDir + sep, realpathSync(appDir) + sep];
|
|
143
|
+
const isInlinedSource = (file) => isAbsolute(file) && !file.includes(NODE_MODULES) && !appRoots.some((root) => file.startsWith(root));
|
|
144
|
+
const resolver = nodeResolve({
|
|
145
|
+
...getNodeResolveOptions("node"),
|
|
146
|
+
extensions: [
|
|
147
|
+
".mjs",
|
|
148
|
+
".js",
|
|
149
|
+
".json",
|
|
150
|
+
".node",
|
|
151
|
+
".ts",
|
|
152
|
+
".tsx"
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
const resolveHook = resolver.resolveId;
|
|
156
|
+
const resolve = typeof resolveHook === "function" ? resolveHook : resolveHook.handler;
|
|
157
|
+
return {
|
|
158
|
+
...resolver,
|
|
159
|
+
name: "typescript-sources-resolver",
|
|
160
|
+
async resolveId(id, importer, options) {
|
|
161
|
+
if (!importer || !isBareModuleSpecifier(id)) return null;
|
|
162
|
+
const resolved = await resolve.call(this, id, importer, options);
|
|
163
|
+
if (!resolved || typeof resolved !== "object" || resolved.external) return null;
|
|
164
|
+
if (TS_SOURCE.test(resolved.id) && !resolved.id.includes(NODE_MODULES)) return resolved.id;
|
|
165
|
+
return isInlinedSource(importer) ? {
|
|
166
|
+
id: pathToFileURL(resolved.id).href,
|
|
167
|
+
external: true
|
|
168
|
+
} : null;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
125
172
|
function extractMastraOptionBundler(name, entryFile, result, logger) {
|
|
126
173
|
return rollup({
|
|
127
174
|
logLevel: "silent",
|
|
@@ -129,6 +176,7 @@ function extractMastraOptionBundler(name, entryFile, result, logger) {
|
|
|
129
176
|
treeshake: "smallest",
|
|
130
177
|
plugins: [
|
|
131
178
|
tsConfigPaths(),
|
|
179
|
+
typescriptSourcesResolver(entryFile),
|
|
132
180
|
esbuild(),
|
|
133
181
|
optimizeLodashImports({ include: "**/*.{js,ts,mjs,cjs}" }),
|
|
134
182
|
commonjs({
|
|
@@ -177,4 +225,4 @@ async function getBundlerOptions(entryFile, outputDir, logger) {
|
|
|
177
225
|
//#endregion
|
|
178
226
|
export { extractMastraOption as n, getBundlerOptions as t };
|
|
179
227
|
|
|
180
|
-
//# sourceMappingURL=bundlerOptions-
|
|
228
|
+
//# sourceMappingURL=bundlerOptions-DMxva0Sp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerOptions-DMxva0Sp.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,iC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AAE,OAAO,CAAC;GAE1E,QAAQ;GACR;IACE,MAAM;IACN,UAAU,MAAM,IAAI;KAClB,IAAI,OAAO,WACT;KAGF,OAAO,kCAAkC,IAAI;IAC/C;GACF;GAEA,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,OAAO,cAAc,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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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;
|
|
@@ -446,8 +446,10 @@ function finalize(ctx, schema) {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
449
|
-
if (ctx.external) {} else if (Object.keys(defs).length > 0)
|
|
450
|
-
|
|
449
|
+
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
450
|
+
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
451
|
+
else result.definitions = defs;
|
|
452
|
+
}
|
|
451
453
|
try {
|
|
452
454
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
453
455
|
Object.defineProperty(finalized, "~standard", {
|
|
@@ -510,7 +512,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
510
512
|
return finalize(ctx, schema);
|
|
511
513
|
};
|
|
512
514
|
//#endregion
|
|
513
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.
|
|
515
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod/4.6.7/4c9f15c99caaca8b83ba8ab68f247a75121c86fb7e498876ed36daccd0f3d3ce/node_modules/zod/v4/core/json-schema-processors.js
|
|
514
516
|
const narrowMin = (agg, key, value) => {
|
|
515
517
|
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
516
518
|
};
|
|
@@ -620,16 +622,18 @@ const numberProcessor = (schema, ctx, _json, params) => {
|
|
|
620
622
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
621
623
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
622
624
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
623
|
-
if (exMin)
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
625
|
+
if (exMin) {
|
|
626
|
+
if (legacy) {
|
|
627
|
+
json.minimum = exclusiveMinimum;
|
|
628
|
+
json.exclusiveMinimum = true;
|
|
629
|
+
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
630
|
+
} else if (typeof minimum === "number") json.minimum = minimum;
|
|
631
|
+
if (exMax) {
|
|
632
|
+
if (legacy) {
|
|
633
|
+
json.maximum = exclusiveMaximum;
|
|
634
|
+
json.exclusiveMaximum = true;
|
|
635
|
+
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
636
|
+
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
633
637
|
if (multipleOf) {
|
|
634
638
|
const divisors = /* @__PURE__ */ new Set();
|
|
635
639
|
for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
|
|
@@ -1156,4 +1160,4 @@ function toJSONSchema(input, params) {
|
|
|
1156
1160
|
//#endregion
|
|
1157
1161
|
export { toJSONSchema };
|
|
1158
1162
|
|
|
1159
|
-
//# sourceMappingURL=core-
|
|
1163
|
+
//# sourceMappingURL=core-75DLMtZL.js.map
|