@mastra/deployer 1.87.0-alpha.11 → 1.87.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.
Files changed (28) hide show
  1. package/dist/{analyze-BjEzp-Bs.js → analyze-DIKFxbzA.js} +14 -2
  2. package/dist/{analyze-NnCa8kOb.cjs → analyze-jJLMXkf6.cjs} +14 -2
  3. package/dist/build/analyze.cjs +1 -1
  4. package/dist/build/analyze.js +1 -1
  5. package/dist/build/index.cjs +3 -3
  6. package/dist/build/index.js +3 -3
  7. package/dist/{build-cBprMNoP.js → build-CXwnWIXm.js} +2 -2
  8. package/dist/{build-OLJdK6FY.cjs → build-DZmcxuif.cjs} +2 -2
  9. package/dist/bundler/index.cjs +1 -1
  10. package/dist/bundler/index.js +1 -1
  11. package/dist/{bundler-_xHFGvEr.cjs → bundler-DVTGknos.cjs} +2 -2
  12. package/dist/{bundler-Cr8qMPp1.js → bundler-S3IP8DEP.js} +2 -2
  13. package/dist/docs/SKILL.md +1 -1
  14. package/dist/docs/assets/SOURCE_MAP.json +9 -9
  15. package/dist/docs/references/docs-deployment-mastra-server.md +1 -1
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.js +3 -3
  18. package/dist/server/index.d.ts +1 -1
  19. package/dist/services/deps.d.ts +8 -0
  20. package/dist/services/index.cjs +1 -1
  21. package/dist/services/index.js +1 -1
  22. package/dist/{services-DgfLvRCc.cjs → services-D4_hO-ga.cjs} +77 -0
  23. package/dist/{services-C4uFF7g6.js → services-D_aEzfmy.js} +77 -0
  24. package/package.json +5 -5
  25. /package/dist/_types/{@mastra_hono@1.7.29-alpha.11 → @mastra_hono@1.7.29-alpha.13}/dist/auth-middleware.d.ts +0 -0
  26. /package/dist/_types/{@mastra_hono@1.7.29-alpha.11 → @mastra_hono@1.7.29-alpha.13}/dist/browser-stream/index.d.ts +0 -0
  27. /package/dist/_types/{@mastra_hono@1.7.29-alpha.11 → @mastra_hono@1.7.29-alpha.13}/dist/index.d.ts +0 -0
  28. /package/dist/_types/{@mastra_hono@1.7.29-alpha.11 → @mastra_hono@1.7.29-alpha.13}/package.json +0 -0
@@ -1,7 +1,7 @@
1
1
  import { n as __toESM, t as __commonJSMin } from "./rolldown-runtime-CO0Nlsmt.js";
2
2
  import { i as MastraError, n as ErrorDomain, r as MastraBaseError, t as ErrorCategory } from "./error-BVvc5jcw.js";
3
3
  import { a as getPackageName, c as isBuiltinModule, f as rollupSafeName, i as getNodeResolveOptions, l as isDependencyPartOfPackage, m as slash, r as getCompiledDepCachePath, s as isBareModuleSpecifier, u as isExternalProtocolImport } from "./utils-C8gwr-ur.js";
4
- import { i as DepsService, o as withPlaceholderVersions } from "./services-C4uFF7g6.js";
4
+ import { i as DepsService, o as withPlaceholderVersions } from "./services-D_aEzfmy.js";
5
5
  import { _ as esbuild, a as mastraToolsAliasPlugin, c as removeDeployer, d as moduleAlias, f as getPackageInfo$1, g as esmShim, h as isOptionalPeerOfImporter, i as mastraInternalAliasPlugin, l as protocolExternalResolver, m as getPackageRootPath, o as tsConfigPaths, p as getPackageMetadata, s as subpathExternalsResolver } from "./bundler-BX2HMBEc.js";
6
6
  import { existsSync, readFileSync } from "fs";
7
7
  import { readFile, writeFile } from "fs/promises";
@@ -729,12 +729,22 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
729
729
  }
730
730
  return depsToOptimize;
731
731
  }
732
+ /**
733
+ * Rollup transform caches carried through a single analysis run, keyed by the run's shared
734
+ * `analyzeCache` and then by sourcemap mode (sourcemap and non-sourcemap builds produce different
735
+ * module transforms, so they cannot share a cache). The `WeakMap` key scopes reuse to one run:
736
+ * nothing outlives the run's analyzer, and separate concurrent runs never share a cache.
737
+ */
738
+ const rollupCachesByAnalyzeCache = /* @__PURE__ */ new WeakMap();
732
739
  async function analyzeEntry({ entry, isVirtualFile }, mastraEntry, { logger, sourcemapEnabled, workspaceMap, projectRoot, env = { "process.env.NODE_ENV": JSON.stringify("production") }, shouldCheckTransitiveDependencies = false, analyzeCache, activeEntries: providedActiveEntries, externals = [], externalsPreset = false, alias = {}, platform = "node", configEntryFile = mastraEntry }) {
733
740
  const resolvedEntry = isVirtualFile ? void 0 : slash(entry);
734
741
  const effectiveAnalyzeCache = analyzeCache ?? /* @__PURE__ */ new Map();
735
742
  const externalsCacheKey = JSON.stringify([externalsPreset, [...externals].sort()]);
736
743
  const cacheKey = resolvedEntry ? `${resolvedEntry}:${shouldCheckTransitiveDependencies ? "transitive" : "direct"}:${externalsCacheKey}` : void 0;
737
744
  if (cacheKey && effectiveAnalyzeCache.has(cacheKey)) return effectiveAnalyzeCache.get(cacheKey);
745
+ const rollupCaches = rollupCachesByAnalyzeCache.get(effectiveAnalyzeCache) ?? /* @__PURE__ */ new Map();
746
+ rollupCachesByAnalyzeCache.set(effectiveAnalyzeCache, rollupCaches);
747
+ const previousRollupCache = rollupCaches.get(sourcemapEnabled);
738
748
  const activeEntries = providedActiveEntries ?? /* @__PURE__ */ new Set();
739
749
  const shouldTrackEntry = Boolean(resolvedEntry && !activeEntries.has(resolvedEntry));
740
750
  if (resolvedEntry && shouldTrackEntry) activeEntries.add(resolvedEntry);
@@ -758,8 +768,10 @@ async function analyzeEntry({ entry, isVirtualFile }, mastraEntry, { logger, sou
758
768
  platform,
759
769
  configEntryFile
760
770
  }).concat(collectDynamicImporters(dynamicImporters)),
761
- external: (id) => DEPS_TO_IGNORE.some((dep) => isDependencyPartOfPackage(id, dep))
771
+ external: (id) => DEPS_TO_IGNORE.some((dep) => isDependencyPartOfPackage(id, dep)),
772
+ cache: previousRollupCache
762
773
  });
774
+ if (optimizerBundler.cache) rollupCaches.set(sourcemapEnabled, optimizerBundler.cache);
763
775
  const { output } = await (async () => {
764
776
  try {
765
777
  return await optimizerBundler.generate({
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
2
  const require_error = require("./error-CR4whExy.cjs");
3
3
  const require_utils = require("./utils-CDNA_ewa.cjs");
4
- const require_services = require("./services-DgfLvRCc.cjs");
4
+ const require_services = require("./services-D4_hO-ga.cjs");
5
5
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
6
6
  let fs = require("fs");
7
7
  let fs_promises = require("fs/promises");
@@ -737,12 +737,22 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
737
737
  }
738
738
  return depsToOptimize;
739
739
  }
740
+ /**
741
+ * Rollup transform caches carried through a single analysis run, keyed by the run's shared
742
+ * `analyzeCache` and then by sourcemap mode (sourcemap and non-sourcemap builds produce different
743
+ * module transforms, so they cannot share a cache). The `WeakMap` key scopes reuse to one run:
744
+ * nothing outlives the run's analyzer, and separate concurrent runs never share a cache.
745
+ */
746
+ const rollupCachesByAnalyzeCache = /* @__PURE__ */ new WeakMap();
740
747
  async function analyzeEntry({ entry, isVirtualFile }, mastraEntry, { logger, sourcemapEnabled, workspaceMap, projectRoot, env = { "process.env.NODE_ENV": JSON.stringify("production") }, shouldCheckTransitiveDependencies = false, analyzeCache, activeEntries: providedActiveEntries, externals = [], externalsPreset = false, alias = {}, platform = "node", configEntryFile = mastraEntry }) {
741
748
  const resolvedEntry = isVirtualFile ? void 0 : require_utils.slash(entry);
742
749
  const effectiveAnalyzeCache = analyzeCache ?? /* @__PURE__ */ new Map();
743
750
  const externalsCacheKey = JSON.stringify([externalsPreset, [...externals].sort()]);
744
751
  const cacheKey = resolvedEntry ? `${resolvedEntry}:${shouldCheckTransitiveDependencies ? "transitive" : "direct"}:${externalsCacheKey}` : void 0;
745
752
  if (cacheKey && effectiveAnalyzeCache.has(cacheKey)) return effectiveAnalyzeCache.get(cacheKey);
753
+ const rollupCaches = rollupCachesByAnalyzeCache.get(effectiveAnalyzeCache) ?? /* @__PURE__ */ new Map();
754
+ rollupCachesByAnalyzeCache.set(effectiveAnalyzeCache, rollupCaches);
755
+ const previousRollupCache = rollupCaches.get(sourcemapEnabled);
746
756
  const activeEntries = providedActiveEntries ?? /* @__PURE__ */ new Set();
747
757
  const shouldTrackEntry = Boolean(resolvedEntry && !activeEntries.has(resolvedEntry));
748
758
  if (resolvedEntry && shouldTrackEntry) activeEntries.add(resolvedEntry);
@@ -766,8 +776,10 @@ async function analyzeEntry({ entry, isVirtualFile }, mastraEntry, { logger, sou
766
776
  platform,
767
777
  configEntryFile
768
778
  }).concat(collectDynamicImporters(dynamicImporters)),
769
- external: (id) => DEPS_TO_IGNORE.some((dep) => require_utils.isDependencyPartOfPackage(id, dep))
779
+ external: (id) => DEPS_TO_IGNORE.some((dep) => require_utils.isDependencyPartOfPackage(id, dep)),
780
+ cache: previousRollupCache
770
781
  });
782
+ if (optimizerBundler.cache) rollupCaches.set(sourcemapEnabled, optimizerBundler.cache);
771
783
  const { output } = await (async () => {
772
784
  try {
773
785
  return await optimizerBundler.generate({
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_analyze = require("../analyze-NnCa8kOb.cjs");
2
+ const require_analyze = require("../analyze-jJLMXkf6.cjs");
3
3
  exports.analyzeBundle = require_analyze.analyzeBundle;
@@ -1 +1 @@
1
- export { t as analyzeBundle } from "../analyze-BjEzp-Bs.js";
1
+ export { t as analyzeBundle } from "../analyze-DIKFxbzA.js";
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_services = require("../services-DgfLvRCc.cjs");
3
- const require_analyze = require("../analyze-NnCa8kOb.cjs");
2
+ const require_services = require("../services-D4_hO-ga.cjs");
3
+ const require_analyze = require("../analyze-jJLMXkf6.cjs");
4
4
  const require_utils = require("../utils-CDNA_ewa.cjs");
5
5
  const require_bundler = require("../bundler-N6zbYjHG.cjs");
6
6
  const require_bundlerOptions = require("../bundlerOptions-CNcBNp_E.cjs");
7
- const require_build = require("../build-OLJdK6FY.cjs");
7
+ const require_build = require("../build-DZmcxuif.cjs");
8
8
  exports.Deps = require_services.Deps;
9
9
  exports.FileService = require_services.FileService;
10
10
  exports.analyzeBundle = require_analyze.analyzeBundle;
@@ -1,7 +1,7 @@
1
- import { r as Deps, t as FileService } from "../services-C4uFF7g6.js";
2
- import { t as analyzeBundle } from "../analyze-BjEzp-Bs.js";
1
+ import { r as Deps, t as FileService } from "../services-D_aEzfmy.js";
2
+ import { t as analyzeBundle } from "../analyze-DIKFxbzA.js";
3
3
  import { d as normalizeStudioBase, n as escapeStudioHtmlValue, o as injectStudioHtmlConfig, t as detectRuntime } from "../utils-C8gwr-ur.js";
4
4
  import { n as getInputOptions, t as createBundler } from "../bundler-BX2HMBEc.js";
5
5
  import { n as extractMastraOption, t as getBundlerOptions } from "../bundlerOptions-c8B4wLqe.js";
6
- import { a as generateFsWorkflowsCodegen, c as discoverFsWorkflows, d as createWatcher, f as getInputOptions$1, i as generateFsAgentsModule, l as getServerOptions, n as prepareFsAgentsEntry, o as discoverFsAgents, r as writeFsAgentsEntry, s as discoverFsSingleton, t as mirrorFsAgentWorkspaces, u as analyzeEntryProjectType } from "../build-cBprMNoP.js";
6
+ import { a as generateFsWorkflowsCodegen, c as discoverFsWorkflows, d as createWatcher, f as getInputOptions$1, i as generateFsAgentsModule, l as getServerOptions, n as prepareFsAgentsEntry, o as discoverFsAgents, r as writeFsAgentsEntry, s as discoverFsSingleton, t as mirrorFsAgentWorkspaces, u as analyzeEntryProjectType } from "../build-CXwnWIXm.js";
7
7
  export { Deps, FileService, analyzeBundle, analyzeEntryProjectType, createBundler, createWatcher, detectRuntime, discoverFsAgents, discoverFsSingleton, discoverFsWorkflows, escapeStudioHtmlValue, extractMastraOption, generateFsAgentsModule, generateFsWorkflowsCodegen, getInputOptions as getBundlerInputOptions, getBundlerOptions, getServerOptions, getInputOptions$1 as getWatcherInputOptions, injectStudioHtmlConfig, mirrorFsAgentWorkspaces, normalizeStudioBase, prepareFsAgentsEntry, writeFsAgentsEntry };
@@ -1,6 +1,6 @@
1
1
  import { n as getInputOptions$1, o as tsConfigPaths, u as nodeModulesExtensionResolver } from "./bundler-BX2HMBEc.js";
2
- import { f as noopLogger } from "./services-C4uFF7g6.js";
3
- import { a as normalizeExternals, i as aliasHono, n as checkConfigExport, r as bundleExternals, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-BjEzp-Bs.js";
2
+ import { f as noopLogger } from "./services-D_aEzfmy.js";
3
+ import { a as normalizeExternals, i as aliasHono, n as checkConfigExport, r as bundleExternals, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-DIKFxbzA.js";
4
4
  import { a as getPackageName, m as slash } from "./utils-C8gwr-ur.js";
5
5
  import { n as extractMastraOption } from "./bundlerOptions-c8B4wLqe.js";
6
6
  import { existsSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
2
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
3
- const require_services = require("./services-DgfLvRCc.cjs");
4
- const require_analyze = require("./analyze-NnCa8kOb.cjs");
3
+ const require_services = require("./services-D4_hO-ga.cjs");
4
+ const require_analyze = require("./analyze-jJLMXkf6.cjs");
5
5
  const require_utils = require("./utils-CDNA_ewa.cjs");
6
6
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
7
7
  let fs = require("fs");
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_bundler = require("../bundler-_xHFGvEr.cjs");
2
+ const require_bundler = require("../bundler-DVTGknos.cjs");
3
3
  exports.Bundler = require_bundler.Bundler;
4
4
  exports.IS_DEFAULT = require_bundler.IS_DEFAULT;
5
5
  exports.applySourceDependencyRange = require_bundler.applySourceDependencyRange;
@@ -1 +1 @@
1
- export { t as Bundler, n as IS_DEFAULT, r as applySourceDependencyRange, i as getSourceDependencyConstraints, a as isRegistryVersionSpec } from "../bundler-Cr8qMPp1.js";
1
+ export { t as Bundler, n as IS_DEFAULT, r as applySourceDependencyRange, i as getSourceDependencyConstraints, a as isRegistryVersionSpec } from "../bundler-S3IP8DEP.js";
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
- const require_services = require("./services-DgfLvRCc.cjs");
2
+ const require_services = require("./services-D4_hO-ga.cjs");
3
3
  const require_error = require("./error-CR4whExy.cjs");
4
- const require_analyze = require("./analyze-NnCa8kOb.cjs");
4
+ const require_analyze = require("./analyze-jJLMXkf6.cjs");
5
5
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
6
6
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
7
7
  const require_utils = require("./utils-CDNA_ewa.cjs");
@@ -1,6 +1,6 @@
1
- import { d as MastraBase, i as DepsService, t as FileService } from "./services-C4uFF7g6.js";
1
+ import { d as MastraBase, i as DepsService, t as FileService } from "./services-D_aEzfmy.js";
2
2
  import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-BVvc5jcw.js";
3
- import { c as packWorkspaceDependencies, o as collectTransitiveWorkspaceDependencies, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-BjEzp-Bs.js";
3
+ import { c as packWorkspaceDependencies, o as collectTransitiveWorkspaceDependencies, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-DIKFxbzA.js";
4
4
  import { n as getInputOptions, r as getUnresolvedWorkspaceImport, t as createBundler } from "./bundler-BX2HMBEc.js";
5
5
  import { t as getBundlerOptions } from "./bundlerOptions-c8B4wLqe.js";
6
6
  import { a as getPackageName, m as slash, p as shouldSkipInstall, s as isBareModuleSpecifier } from "./utils-C8gwr-ur.js";
@@ -3,7 +3,7 @@ name: mastra-deployer
3
3
  description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/deployer"
6
- version: "1.87.0-alpha.11"
6
+ version: "1.87.0-alpha.13"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.87.0-alpha.11",
2
+ "version": "1.87.0-alpha.13",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {
5
5
  "Deployer": {
@@ -9,22 +9,22 @@
9
9
  },
10
10
  "Deps": {
11
11
  "types": "dist/services/deps.d.ts",
12
- "implementation": "dist/services-C4uFF7g6.js",
13
- "line": 859
12
+ "implementation": "dist/services-D_aEzfmy.js",
13
+ "line": 883
14
14
  },
15
15
  "FileService": {
16
16
  "types": "dist/services/fs.d.ts",
17
- "implementation": "dist/services-C4uFF7g6.js",
18
- "line": 1290
17
+ "implementation": "dist/services-D_aEzfmy.js",
18
+ "line": 1367
19
19
  },
20
20
  "createChildProcessLogger": {
21
21
  "types": "dist/deploy/log.d.ts",
22
- "implementation": "dist/services-C4uFF7g6.js",
22
+ "implementation": "dist/services-D_aEzfmy.js",
23
23
  "line": 339
24
24
  },
25
25
  "createPinoStream": {
26
26
  "types": "dist/deploy/log.d.ts",
27
- "implementation": "dist/services-C4uFF7g6.js",
27
+ "implementation": "dist/services-D_aEzfmy.js",
28
28
  "line": 303
29
29
  },
30
30
  "getDeployer": {
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "toWindowsShellArg": {
36
36
  "types": "dist/deploy/log.d.ts",
37
- "implementation": "dist/services-C4uFF7g6.js",
37
+ "implementation": "dist/services-D_aEzfmy.js",
38
38
  "line": 326
39
39
  },
40
40
  "toWindowsShellArgs": {
41
41
  "types": "dist/deploy/log.d.ts",
42
- "implementation": "dist/services-C4uFF7g6.js",
42
+ "implementation": "dist/services-D_aEzfmy.js",
43
43
  "line": 333
44
44
  }
45
45
  },
@@ -34,7 +34,7 @@ After building, Mastra creates the following structure:
34
34
  ├── node_modules/ # Installed dependencies
35
35
  ├── .npmrc # Copied from your project (if present)
36
36
  ├── <static assets> # Contents of src/mastra/public, merged into the output root
37
- └── playground/ # Studio UI (if --studio flag used)
37
+ └── studio/ # Studio UI (if --studio flag used)
38
38
  ```
39
39
 
40
40
  The `output` directory is self-contained. You can copy it to any server and run it directly.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_bundler = require("./bundler-_xHFGvEr.cjs");
3
- const require_services = require("./services-DgfLvRCc.cjs");
4
- require("./build-OLJdK6FY.cjs");
2
+ const require_bundler = require("./bundler-DVTGknos.cjs");
3
+ const require_services = require("./services-D4_hO-ga.cjs");
4
+ require("./build-DZmcxuif.cjs");
5
5
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
6
6
  // src/deploy/base.ts
7
7
  var Deployer = class extends require_bundler.Bundler {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as Bundler } from "./bundler-Cr8qMPp1.js";
2
- import { c as createPinoStream, i as DepsService, l as toWindowsShellArg, r as Deps, s as createChildProcessLogger, t as FileService, u as toWindowsShellArgs } from "./services-C4uFF7g6.js";
3
- import "./build-cBprMNoP.js";
1
+ import { t as Bundler } from "./bundler-S3IP8DEP.js";
2
+ import { c as createPinoStream, i as DepsService, l as toWindowsShellArg, r as Deps, s as createChildProcessLogger, t as FileService, u as toWindowsShellArgs } from "./services-D_aEzfmy.js";
3
+ import "./build-CXwnWIXm.js";
4
4
  import { n as extractMastraOption } from "./bundlerOptions-c8B4wLqe.js";
5
5
  // src/deploy/base.ts
6
6
  var Deployer = class extends Bundler {
@@ -1,5 +1,5 @@
1
1
  import type { Mastra } from '@mastra/core/mastra';
2
- import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.29-alpha.11/dist/index.js';
2
+ import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.29-alpha.13/dist/index.js';
3
3
  import { Hono } from 'hono';
4
4
  import type { ServerBundleOptions } from './types.js';
5
5
  type Bindings = HonoBindings;
@@ -90,6 +90,14 @@ export declare class Deps extends MastraBase {
90
90
  * output's package.json so `bun install` preserves patches in the bundled output.
91
91
  */
92
92
  private copyBunPatchesToOutput;
93
+ /**
94
+ * Copies the top-level overrides of the source workspace root into the output package.json, so the
95
+ * output install keeps the versions the project pinned (#29311). Bun reads `overrides` when it is an
96
+ * object and `resolutions` otherwise. Packed workspace tarballs win over a source override for the same
97
+ * package, including a parent-scoped key (`parent>name` or `parent/name`) that targets a packed package.
98
+ * Other parent-scoped keys are copied. Object-form nested overrides and version-qualified selectors are not copied.
99
+ */
100
+ private copyBunOverridesToOutput;
93
101
  private getNpmArgs;
94
102
  /**
95
103
  * Depending on whether we want to install or add a package, this function returns the appropriate commands.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_services = require("../services-DgfLvRCc.cjs");
2
+ const require_services = require("../services-D4_hO-ga.cjs");
3
3
  exports.DepsService = require_services.DepsService;
4
4
  exports.EnvService = require_services.EnvService;
5
5
  exports.FileService = require_services.FileService;
@@ -1 +1 @@
1
- export { i as DepsService, n as EnvService, t as FileService } from "../services-C4uFF7g6.js";
1
+ export { i as DepsService, n as EnvService, t as FileService } from "../services-D_aEzfmy.js";
@@ -529,6 +529,13 @@ function removeSignalHandlers() {
529
529
  }
530
530
  const PNPM_PATCHES_DIR = "pnpm-patches";
531
531
  const BUN_PATCHES_DIR = "bun-patches";
532
+ const BUN_DEPENDENCY_FIELDS = [
533
+ "optionalDependencies",
534
+ "devDependencies",
535
+ "dependencies",
536
+ "peerDependencies"
537
+ ];
538
+ const BUN_LOCAL_TARBALL_SPEC = /^(?![a-z][\w+.-]*:).*\.(?:tgz|tar|tar\.gz)$/i;
532
539
  const PNPM_CONFIG_KEYS_TO_COPY = /* @__PURE__ */ new Set([
533
540
  "allowBuilds",
534
541
  "onlyBuiltDependencies",
@@ -803,6 +810,23 @@ function retargetAppScopedOverrides(overrides, app, outputName) {
803
810
  }
804
811
  return retargeted;
805
812
  }
813
+ /**
814
+ * Splits a Bun override key into its package names: `parent>name` selectors on `>` (trimmed, as Bun does)
815
+ * and `parent/name` paths on `/`, keeping `@scope/name` together. The last name is the overridden package.
816
+ */
817
+ function parseBunOverrideKey(key) {
818
+ const names = [];
819
+ if (key.includes(">")) names.push(...key.split(">").map((name) => name.trim()));
820
+ else for (const segment of key.split("/")) {
821
+ const last = names.at(-1);
822
+ if (last?.startsWith("@") && !last.includes("/")) names[names.length - 1] = `${last}/${segment}`;
823
+ else names.push(segment);
824
+ }
825
+ return {
826
+ target: names.at(-1) ?? key,
827
+ versioned: names.some((name) => name.includes("@", 1))
828
+ };
829
+ }
806
830
  function resolveCatalogSpec(workspace, name, spec) {
807
831
  const catalogName = spec.slice(8) || "default";
808
832
  const catalogs = isRecord(workspace.catalogs) ? workspace.catalogs : {};
@@ -1106,6 +1130,58 @@ var Deps = class extends MastraBase {
1106
1130
  outputPkg.patchedDependencies = rewritten;
1107
1131
  await (0, fs_extra_esm.writeJSON)(outputPackageJsonPath, outputPkg, { spaces: 2 });
1108
1132
  }
1133
+ /**
1134
+ * Copies the top-level overrides of the source workspace root into the output package.json, so the
1135
+ * output install keeps the versions the project pinned (#29311). Bun reads `overrides` when it is an
1136
+ * object and `resolutions` otherwise. Packed workspace tarballs win over a source override for the same
1137
+ * package, including a parent-scoped key (`parent>name` or `parent/name`) that targets a packed package.
1138
+ * Other parent-scoped keys are copied. Object-form nested overrides and version-qualified selectors are not copied.
1139
+ */
1140
+ async copyBunOverridesToOutput(dir) {
1141
+ if (!this.lockFile) return;
1142
+ const sourceRoot = path.default.resolve(path.default.dirname(this.lockFile.path));
1143
+ if ([sourceRoot, path.default.resolve(this.rootDir)].includes(path.default.resolve(dir))) return;
1144
+ const rootPkg = await (0, fs_extra_esm.readJSON)(path.default.join(sourceRoot, "package.json")).catch(() => void 0);
1145
+ if (!isRecord(rootPkg)) return;
1146
+ const field = isRecord(rootPkg.overrides) ? "overrides" : "resolutions";
1147
+ const sourceOverrides = rootPkg[field];
1148
+ if (!isRecord(sourceOverrides)) return;
1149
+ const outputPackageJsonPath = path.default.join(dir, "package.json");
1150
+ const outputPkg = await (0, fs_extra_esm.readJSON)(outputPackageJsonPath).catch(() => ({}));
1151
+ if (!isRecord(outputPkg)) return;
1152
+ const packed = isRecord(outputPkg.resolutions) ? outputPkg.resolutions : {};
1153
+ const workspace = {
1154
+ ...rootPkg,
1155
+ ...isRecord(rootPkg.workspaces) ? rootPkg.workspaces : {}
1156
+ };
1157
+ const copied = {};
1158
+ for (const [key, value] of Object.entries(sourceOverrides)) {
1159
+ const { target, versioned } = parseBunOverrideKey(key);
1160
+ if (Object.hasOwn(packed, target)) {
1161
+ if (target !== key) this.logger.debug(`Not copying Bun override "${key}" into the build output: "${target}" is a packed workspace package.`);
1162
+ continue;
1163
+ }
1164
+ if (typeof value !== "string" || versioned) {
1165
+ this.logger.debug(`Not copying Bun override "${key}" into the build output: nested and version-qualified overrides are not copied.`);
1166
+ continue;
1167
+ }
1168
+ const toSpec = (candidate) => typeof candidate === "string" ? candidate.trim() : void 0;
1169
+ const referenced = value.startsWith("$") ? value.slice(1) : void 0;
1170
+ let spec = toSpec(referenced ? BUN_DEPENDENCY_FIELDS.map((depField) => rootPkg[depField]).filter(isRecord).find((deps) => Object.hasOwn(deps, referenced))?.[referenced] : value);
1171
+ if (spec?.startsWith("catalog:")) spec = toSpec(resolveCatalogSpec(workspace, target, spec));
1172
+ if (!spec || SOURCE_WORKSPACE_SPEC.test(spec) || BUN_LOCAL_TARBALL_SPEC.test(spec)) {
1173
+ this.logger.warn(`Skipping Bun override "${key}": "${value}" can't be resolved in the build output.`);
1174
+ continue;
1175
+ }
1176
+ copied[key] = spec;
1177
+ }
1178
+ if (Object.keys(copied).length === 0) return;
1179
+ outputPkg[field] = {
1180
+ ...copied,
1181
+ ...packed
1182
+ };
1183
+ await (0, fs_extra_esm.writeJSON)(outputPackageJsonPath, outputPkg, { spaces: 2 });
1184
+ }
1109
1185
  getNpmArgs(options) {
1110
1186
  const args = [];
1111
1187
  if (options.cpu) args.push(`--cpu=${options.cpu.join(",")}`);
@@ -1157,6 +1233,7 @@ var Deps = class extends MastraBase {
1157
1233
  await this.copyYarnPatches(dir);
1158
1234
  break;
1159
1235
  case "bun":
1236
+ await this.copyBunOverridesToOutput(dir);
1160
1237
  await this.copyBunPatchesToOutput(dir);
1161
1238
  break;
1162
1239
  case "npm": if (architecture) args = this.getNpmArgs(architecture);
@@ -523,6 +523,13 @@ function removeSignalHandlers() {
523
523
  }
524
524
  const PNPM_PATCHES_DIR = "pnpm-patches";
525
525
  const BUN_PATCHES_DIR = "bun-patches";
526
+ const BUN_DEPENDENCY_FIELDS = [
527
+ "optionalDependencies",
528
+ "devDependencies",
529
+ "dependencies",
530
+ "peerDependencies"
531
+ ];
532
+ const BUN_LOCAL_TARBALL_SPEC = /^(?![a-z][\w+.-]*:).*\.(?:tgz|tar|tar\.gz)$/i;
526
533
  const PNPM_CONFIG_KEYS_TO_COPY = /* @__PURE__ */ new Set([
527
534
  "allowBuilds",
528
535
  "onlyBuiltDependencies",
@@ -797,6 +804,23 @@ function retargetAppScopedOverrides(overrides, app, outputName) {
797
804
  }
798
805
  return retargeted;
799
806
  }
807
+ /**
808
+ * Splits a Bun override key into its package names: `parent>name` selectors on `>` (trimmed, as Bun does)
809
+ * and `parent/name` paths on `/`, keeping `@scope/name` together. The last name is the overridden package.
810
+ */
811
+ function parseBunOverrideKey(key) {
812
+ const names = [];
813
+ if (key.includes(">")) names.push(...key.split(">").map((name) => name.trim()));
814
+ else for (const segment of key.split("/")) {
815
+ const last = names.at(-1);
816
+ if (last?.startsWith("@") && !last.includes("/")) names[names.length - 1] = `${last}/${segment}`;
817
+ else names.push(segment);
818
+ }
819
+ return {
820
+ target: names.at(-1) ?? key,
821
+ versioned: names.some((name) => name.includes("@", 1))
822
+ };
823
+ }
800
824
  function resolveCatalogSpec(workspace, name, spec) {
801
825
  const catalogName = spec.slice(8) || "default";
802
826
  const catalogs = isRecord(workspace.catalogs) ? workspace.catalogs : {};
@@ -1100,6 +1124,58 @@ var Deps = class extends MastraBase {
1100
1124
  outputPkg.patchedDependencies = rewritten;
1101
1125
  await writeJSON(outputPackageJsonPath, outputPkg, { spaces: 2 });
1102
1126
  }
1127
+ /**
1128
+ * Copies the top-level overrides of the source workspace root into the output package.json, so the
1129
+ * output install keeps the versions the project pinned (#29311). Bun reads `overrides` when it is an
1130
+ * object and `resolutions` otherwise. Packed workspace tarballs win over a source override for the same
1131
+ * package, including a parent-scoped key (`parent>name` or `parent/name`) that targets a packed package.
1132
+ * Other parent-scoped keys are copied. Object-form nested overrides and version-qualified selectors are not copied.
1133
+ */
1134
+ async copyBunOverridesToOutput(dir) {
1135
+ if (!this.lockFile) return;
1136
+ const sourceRoot = path.resolve(path.dirname(this.lockFile.path));
1137
+ if ([sourceRoot, path.resolve(this.rootDir)].includes(path.resolve(dir))) return;
1138
+ const rootPkg = await readJSON(path.join(sourceRoot, "package.json")).catch(() => void 0);
1139
+ if (!isRecord(rootPkg)) return;
1140
+ const field = isRecord(rootPkg.overrides) ? "overrides" : "resolutions";
1141
+ const sourceOverrides = rootPkg[field];
1142
+ if (!isRecord(sourceOverrides)) return;
1143
+ const outputPackageJsonPath = path.join(dir, "package.json");
1144
+ const outputPkg = await readJSON(outputPackageJsonPath).catch(() => ({}));
1145
+ if (!isRecord(outputPkg)) return;
1146
+ const packed = isRecord(outputPkg.resolutions) ? outputPkg.resolutions : {};
1147
+ const workspace = {
1148
+ ...rootPkg,
1149
+ ...isRecord(rootPkg.workspaces) ? rootPkg.workspaces : {}
1150
+ };
1151
+ const copied = {};
1152
+ for (const [key, value] of Object.entries(sourceOverrides)) {
1153
+ const { target, versioned } = parseBunOverrideKey(key);
1154
+ if (Object.hasOwn(packed, target)) {
1155
+ if (target !== key) this.logger.debug(`Not copying Bun override "${key}" into the build output: "${target}" is a packed workspace package.`);
1156
+ continue;
1157
+ }
1158
+ if (typeof value !== "string" || versioned) {
1159
+ this.logger.debug(`Not copying Bun override "${key}" into the build output: nested and version-qualified overrides are not copied.`);
1160
+ continue;
1161
+ }
1162
+ const toSpec = (candidate) => typeof candidate === "string" ? candidate.trim() : void 0;
1163
+ const referenced = value.startsWith("$") ? value.slice(1) : void 0;
1164
+ let spec = toSpec(referenced ? BUN_DEPENDENCY_FIELDS.map((depField) => rootPkg[depField]).filter(isRecord).find((deps) => Object.hasOwn(deps, referenced))?.[referenced] : value);
1165
+ if (spec?.startsWith("catalog:")) spec = toSpec(resolveCatalogSpec(workspace, target, spec));
1166
+ if (!spec || SOURCE_WORKSPACE_SPEC.test(spec) || BUN_LOCAL_TARBALL_SPEC.test(spec)) {
1167
+ this.logger.warn(`Skipping Bun override "${key}": "${value}" can't be resolved in the build output.`);
1168
+ continue;
1169
+ }
1170
+ copied[key] = spec;
1171
+ }
1172
+ if (Object.keys(copied).length === 0) return;
1173
+ outputPkg[field] = {
1174
+ ...copied,
1175
+ ...packed
1176
+ };
1177
+ await writeJSON(outputPackageJsonPath, outputPkg, { spaces: 2 });
1178
+ }
1103
1179
  getNpmArgs(options) {
1104
1180
  const args = [];
1105
1181
  if (options.cpu) args.push(`--cpu=${options.cpu.join(",")}`);
@@ -1151,6 +1227,7 @@ var Deps = class extends MastraBase {
1151
1227
  await this.copyYarnPatches(dir);
1152
1228
  break;
1153
1229
  case "bun":
1230
+ await this.copyBunOverridesToOutput(dir);
1154
1231
  await this.copyBunPatchesToOutput(dir);
1155
1232
  break;
1156
1233
  case "npm": if (architecture) args = this.getNpmArgs(architecture);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "1.87.0-alpha.11",
3
+ "version": "1.87.0-alpha.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -114,7 +114,7 @@
114
114
  "tinyglobby": "^0.2.17",
115
115
  "ws": "^8.23.0",
116
116
  "yaml": "^2.9.1",
117
- "@mastra/server": "1.87.0-alpha.11"
117
+ "@mastra/server": "1.87.0-alpha.13"
118
118
  },
119
119
  "devDependencies": {
120
120
  "@hono/node-server": "^2.1.3",
@@ -140,9 +140,9 @@
140
140
  "@internal/lint": "0.0.152",
141
141
  "@internal/types-builder": "0.0.127",
142
142
  "@mastra/agent-browser": "0.7.1-alpha.0",
143
- "@mastra/core": "1.87.0-alpha.11",
144
- "@mastra/hono": "1.7.29-alpha.11",
145
- "@mastra/mcp": "^2.11.1-alpha.1"
143
+ "@mastra/core": "1.87.0-alpha.13",
144
+ "@mastra/hono": "1.7.29-alpha.13",
145
+ "@mastra/mcp": "^2.12.0-alpha.2"
146
146
  },
147
147
  "peerDependencies": {
148
148
  "@mastra/core": ">=1.85.1-0 <2.0.0-0"