@mastra/deployer 1.79.0-alpha.1 → 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 +245 -6
  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 +246 -7
  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 +11 -13
  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
@@ -1,5 +1,45 @@
1
+ import type { Mastra } from '@mastra/core/mastra';
1
2
  import type { BrowserStreamConfig, BrowserStreamResult } from '@mastra/server/browser-stream';
2
- import type { Env, Hono, Schema } from 'hono';
3
+ import type { Context, Env, Hono, Schema } from 'hono';
4
+ /**
5
+ * Allowed `Origin` values for browser WebSocket upgrades. Accepts the same shape
6
+ * as Hono's `cors.origin` option.
7
+ */
8
+ export type BrowserStreamOrigin = string | string[] | ((origin: string, c: Context) => Promise<string | undefined | null> | string | undefined | null);
9
+ /**
10
+ * Hono-specific browser stream configuration.
11
+ */
12
+ export interface HonoBrowserStreamConfig extends BrowserStreamConfig {
13
+ /**
14
+ * Mastra instance used to authenticate requests to the browser stream routes.
15
+ *
16
+ * Every route registered by {@link setupBrowserStream} — the WebSocket upgrade,
17
+ * the session probe, the close endpoint, and the upgrade-ticket endpoint — is
18
+ * gated by the server auth middleware. Without this, an unauthenticated caller
19
+ * could watch and drive an agent's browser. When the instance has no
20
+ * `server.auth` configured the middleware is a no-op.
21
+ */
22
+ mastra: Mastra;
23
+ /**
24
+ * Origin allowlist for the browser WebSocket upgrade.
25
+ *
26
+ * Browsers always send an `Origin` header on a WebSocket handshake and attach
27
+ * the session cookie to it, so without an allowlist a page on any origin could
28
+ * open a cookie-authenticated stream and drive the agent's browser. When this is
29
+ * set, an upgrade from an origin that isn't allowed is rejected with `403`.
30
+ *
31
+ * Values are matched the way Hono's `cors.origin` matches them: array entries
32
+ * literally, and a callback only approves an origin when it returns that same
33
+ * origin (or `'*'`). The server's own origin always passes, because a CORS
34
+ * allowlist names the *other* origins and never includes the server itself.
35
+ *
36
+ * Requests without an `Origin` header (non-browser clients) are not affected,
37
+ * and the check is skipped entirely when this is unset. The deployer passes the
38
+ * explicitly configured `server.cors.origin` here; its permissive default is
39
+ * left as-is so cross-origin Studio deployments keep working.
40
+ */
41
+ allowedOrigins?: BrowserStreamOrigin;
42
+ }
3
43
  /**
4
44
  * Set up WebSocket-based browser stream endpoint for real-time screencast viewing.
5
45
  *
@@ -9,6 +49,17 @@ import type { Env, Hono, Schema } from 'hono';
9
49
  * - Broadcasts frames to all connected viewers
10
50
  * - Stops screencast when last viewer disconnects
11
51
  *
52
+ * All routes are authenticated with the server's auth configuration. Browsers
53
+ * cannot attach an `Authorization` header to a WebSocket upgrade, so
54
+ * session-cookie providers authenticate from the upgrade request's cookies.
55
+ * Clients that authenticate with a header token instead request a short-lived,
56
+ * single-use ticket from `POST ${apiPrefix}/agents/:agentId/browser/stream-ticket`
57
+ * and pass it to the upgrade as `?ticket=`, which keeps the reusable credential
58
+ * out of the URL. Non-browser clients can pass the token as the `apiKey` query
59
+ * parameter — use a short-lived token, since a URL can be retained in proxy and
60
+ * access logs, and prefer the `Authorization` header on the HTTP routes where the
61
+ * client can set one.
62
+ *
12
63
  * **Note**: Requires `ws` package to be installed. If not available, returns null
13
64
  * and logs a warning. Browser streaming will be disabled but everything else works.
14
65
  *
@@ -24,6 +75,7 @@ import type { Env, Hono, Schema } from 'hono';
24
75
  *
25
76
  * const app = new Hono();
26
77
  * const browserStream = await setupBrowserStream(app, {
78
+ * mastra,
27
79
  * getToolset: (agentId) => browserToolsets.get(agentId),
28
80
  * });
29
81
  *
@@ -31,5 +83,5 @@ import type { Env, Hono, Schema } from 'hono';
31
83
  * browserStream?.injectWebSocket(server);
32
84
  * ```
33
85
  */
34
- export declare function setupBrowserStream<E extends Env, S extends Schema, B extends string>(app: Hono<E, S, B>, config: BrowserStreamConfig): Promise<BrowserStreamResult | null>;
86
+ export declare function setupBrowserStream<E extends Env, S extends Schema, B extends string>(app: Hono<E, S, B>, config: HonoBrowserStreamConfig): Promise<BrowserStreamResult | null>;
35
87
  //# sourceMappingURL=index.d.ts.map
@@ -8,6 +8,7 @@ import type { Context, HonoRequest, MiddlewareHandler } from 'hono';
8
8
  export { createAuthMiddleware } from './auth-middleware.js';
9
9
  export type { HonoAuthMiddlewareOptions } from './auth-middleware.js';
10
10
  export { setupBrowserStream } from './browser-stream/index.js';
11
+ export type { HonoBrowserStreamConfig } from './browser-stream/index.js';
11
12
  export type HonoVariables = {
12
13
  mastra: Mastra;
13
14
  requestContext: RequestContext;
@@ -1,18 +1,20 @@
1
1
  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-Bl3Lm7SI.js";
2
- import { i as DepsService } from "./services-DXqmEy8F.js";
3
- import { a as mastraToolsAliasPlugin, c as removeDeployer, d as moduleAlias, f as getPackageInfo$1, g as esbuild, h as esmShim, i as mastraInternalAliasPlugin, l as protocolExternalResolver, m as getPackageRootPath, o as tsConfigPaths, p as getPackageMetadata, s as subpathExternalsResolver } from "./bundler-DtMHSv5_.js";
4
- import { existsSync } from "fs";
2
+ import { i as DepsService, o as withPlaceholderVersions } from "./services-Ce_5qHk2.js";
3
+ import { a as mastraToolsAliasPlugin, c as removeDeployer, d as moduleAlias, f as getPackageInfo$1, g as esbuild, h as esmShim, i as mastraInternalAliasPlugin, l as protocolExternalResolver, m as getPackageRootPath, o as tsConfigPaths, p as getPackageMetadata, s as subpathExternalsResolver } from "./bundler-B2N9qjjr.js";
4
+ import { existsSync, readFileSync } from "fs";
5
5
  import { readFile, writeFile } from "fs/promises";
6
6
  import * as path$1 from "path";
7
- import { basename, dirname, isAbsolute, join, relative } from "path";
7
+ import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from "path";
8
8
  import { ErrorCategory, ErrorDomain, MastraBaseError, MastraError } from "@mastra/core/error";
9
9
  import virtual from "@rollup/plugin-virtual";
10
10
  import * as pkg from "empathic/package";
11
+ import { glob } from "tinyglobby";
11
12
  import { transformAsync, transformSync, types } from "@babel/core";
12
- import { createWorkspacesCache, findWorkspaces, findWorkspacesRoot } from "find-workspaces";
13
13
  import { ensureDir } from "fs-extra";
14
14
  import { spawn } from "child_process";
15
15
  import { fileURLToPath, pathToFileURL } from "url";
16
+ import { parse } from "yaml";
17
+ import { homedir } from "os";
16
18
  import commonjs from "@rollup/plugin-commonjs";
17
19
  import json from "@rollup/plugin-json";
18
20
  import { getPackageInfo, resolveModule } from "local-pkg";
@@ -44,7 +46,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
44
46
  enumerable: true
45
47
  }) : target, mod));
46
48
  //#endregion
47
- //#region src/bundler/workspaceDependencies.ts
49
+ //#region src/bundler/find-workspaces.ts
48
50
  var import_stack_trace_parser_cjs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
49
51
  Object.defineProperty(exports, "__esModule", { value: true });
50
52
  var UNKNOWN_FUNCTION = "<unknown>";
@@ -139,6 +141,142 @@ var import_stack_trace_parser_cjs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __c
139
141
  exports.parse = parse;
140
142
  })))(), 1);
141
143
  /**
144
+ * Monorepo workspace discovery.
145
+ *
146
+ * Replaces the `find-workspaces` package with the same API, so that the
147
+ * production dependency tree no longer carries `fast-glob` → `micromatch` →
148
+ * `braces` (GHSA-vfj7-8cjw-p6xm, no patched release). Globbing goes through
149
+ * `tinyglobby`, which the deployer already uses for bundling.
150
+ *
151
+ * Root detection order matches `find-workspaces`: `lerna.json`, then
152
+ * `pnpm-workspace.yaml`, then `package.json` (`workspaces` array,
153
+ * `workspaces.packages`, or `bolt.workspaces`).
154
+ */
155
+ function createWorkspacesCache() {
156
+ return {
157
+ root: /* @__PURE__ */ new Map(),
158
+ workspaces: /* @__PURE__ */ new Map(),
159
+ clear() {
160
+ this.root.clear();
161
+ this.workspaces.clear();
162
+ }
163
+ };
164
+ }
165
+ /**
166
+ * Walk up from `dirname` until a directory declaring workspace globs is found.
167
+ * Returns `null` when none is found before `stopDir`.
168
+ */
169
+ function findWorkspacesRoot(dirname, options = {}) {
170
+ const dir = dirname ? resolve(dirname) : process.cwd();
171
+ const stopDir = options.stopDir ? resolve(options.stopDir) : homedir();
172
+ const cache = options.cache;
173
+ if (cache) {
174
+ for (const [key, value] of cache.root.entries()) if ((dir + sep).startsWith(key + sep)) return value;
175
+ }
176
+ return findRoot(dir, stopDir, cache);
177
+ }
178
+ /**
179
+ * List every workspace package under the root that contains `dirname`.
180
+ * Returns `null` when `dirname` is not inside a workspace.
181
+ */
182
+ async function findWorkspaces(dirname$1, options = {}) {
183
+ const root = findWorkspacesRoot(dirname$1, options);
184
+ if (!root) return null;
185
+ const cached = options.cache?.workspaces.get(root.location);
186
+ if (cached) return cached;
187
+ const manifests = await glob(toManifestGlobs(root.globs), {
188
+ cwd: root.location,
189
+ absolute: true,
190
+ ignore: ["**/node_modules/**"]
191
+ });
192
+ const workspaces = [];
193
+ for (const manifest of manifests) {
194
+ const location = toPosix(dirname(manifest));
195
+ if (location === root.location) continue;
196
+ const pkg = readJsonFile(location, "package.json");
197
+ if (isObject(pkg) && typeof pkg.name === "string") workspaces.push({
198
+ location,
199
+ package: pkg
200
+ });
201
+ }
202
+ options.cache?.workspaces.set(root.location, workspaces);
203
+ return workspaces;
204
+ }
205
+ /**
206
+ * Glob for each pattern's `package.json` instead of for the directory itself. A
207
+ * directory-only glob does not match a symlink to a directory, so a linked workspace
208
+ * package would be dropped and never packed into the build output. Matching the
209
+ * manifest inside it does, and is also how pnpm resolves its workspaces. Negated
210
+ * patterns are mapped the same way so they keep excluding whole packages.
211
+ */
212
+ function toManifestGlobs(globs) {
213
+ return globs.map((pattern) => {
214
+ const negated = pattern.startsWith("!");
215
+ const base = (negated ? pattern.slice(1) : pattern).replace(/[\\/]+$/, "");
216
+ return `${negated ? "!" : ""}${base}/package.json`;
217
+ });
218
+ }
219
+ function findRoot(dir, stopDir, cache) {
220
+ const memo = (value) => {
221
+ cache?.root.set(dir, value);
222
+ return value;
223
+ };
224
+ const globs = findGlobs(dir);
225
+ if (globs) return memo({
226
+ location: toPosix(dir),
227
+ globs
228
+ });
229
+ const next = resolve(dir, "..");
230
+ if (next === stopDir || next === dir) return memo(null);
231
+ return findRoot(next, stopDir, cache);
232
+ }
233
+ function findGlobs(dir) {
234
+ return resolveLernaGlobs(dir) ?? resolvePnpmGlobs(dir) ?? resolvePackageJsonGlobs(dir);
235
+ }
236
+ function resolveLernaGlobs(dir) {
237
+ const lernaJson = readJsonFile(dir, "lerna.json");
238
+ if (lernaJson === void 0) return null;
239
+ return isObject(lernaJson) && isStringArray(lernaJson.packages) ? lernaJson.packages : null;
240
+ }
241
+ function resolvePnpmGlobs(dir) {
242
+ const pnpmWorkspace = readYamlFile(dir, "pnpm-workspace.yaml");
243
+ if (pnpmWorkspace === void 0) return null;
244
+ return isObject(pnpmWorkspace) && isStringArray(pnpmWorkspace.packages) ? pnpmWorkspace.packages : ["**"];
245
+ }
246
+ function resolvePackageJsonGlobs(dir) {
247
+ const packageJson = readJsonFile(dir, "package.json");
248
+ if (!isObject(packageJson)) return null;
249
+ if (isStringArray(packageJson.workspaces)) return packageJson.workspaces;
250
+ if (isObject(packageJson.workspaces) && isStringArray(packageJson.workspaces.packages)) return packageJson.workspaces.packages;
251
+ if (isObject(packageJson.bolt) && isStringArray(packageJson.bolt.workspaces)) return packageJson.bolt.workspaces;
252
+ return null;
253
+ }
254
+ function readJsonFile(dir, file) {
255
+ try {
256
+ return JSON.parse(readFileSync(join(dir, file), "utf8"));
257
+ } catch {
258
+ return;
259
+ }
260
+ }
261
+ function readYamlFile(dir, file) {
262
+ try {
263
+ return parse(readFileSync(join(dir, file), "utf8"));
264
+ } catch {
265
+ return;
266
+ }
267
+ }
268
+ function toPosix(path) {
269
+ return path.split(sep).join(posix.sep);
270
+ }
271
+ function isObject(value) {
272
+ return !!value && typeof value === "object" && !Array.isArray(value);
273
+ }
274
+ function isStringArray(value) {
275
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
276
+ }
277
+ //#endregion
278
+ //#region src/bundler/workspaceDependencies.ts
279
+ /**
142
280
  * Create a shared cache for find-workspaces
143
281
  */
144
282
  const workspacesCache = createWorkspacesCache();
@@ -193,7 +331,7 @@ const collectTransitiveWorkspaceDependencies = async ({ workspaceMap, initialDep
193
331
  const sanitizedName = slugify(pkgName);
194
332
  resolutions[pkgName] = depsService.getWorkspaceDependencyPath({
195
333
  pkgName: sanitizedName,
196
- version: dep.version
334
+ version: dep.version ?? "0.0.0"
197
335
  });
198
336
  usedWorkspacePackages.add(pkgName);
199
337
  for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) queue.push(depName);
@@ -219,21 +357,26 @@ const packWorkspaceDependencies = async ({ workspaceMap, usedWorkspacePackages,
219
357
  logger.info("Packaging workspace dependencies", { count: usedWorkspacePackages.size });
220
358
  const batchSize = 5;
221
359
  const packages = Array.from(usedWorkspacePackages.values());
222
- for (let i = 0; i < packages.length; i += batchSize) {
223
- const batch = packages.slice(i, i + batchSize);
224
- logger.info(`Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(", ")}`);
225
- await Promise.all(batch.map(async (pkgName) => {
226
- const dep = workspaceMap.get(pkgName);
227
- const sanitizedName = slugify(pkgName);
228
- if (!dep) return;
229
- await depsService.pack({
230
- dir: dep.location,
231
- destination: workspaceDirPath,
232
- sanitizedName,
233
- version: dep.version
234
- });
235
- }));
236
- }
360
+ await withPlaceholderVersions(packages.flatMap((pkgName) => {
361
+ const location = workspaceMap.get(pkgName)?.location;
362
+ return location ? [location] : [];
363
+ }), async () => {
364
+ for (let i = 0; i < packages.length; i += batchSize) {
365
+ const batch = packages.slice(i, i + batchSize);
366
+ logger.info(`Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(", ")}`);
367
+ await Promise.all(batch.map(async (pkgName) => {
368
+ const dep = workspaceMap.get(pkgName);
369
+ const sanitizedName = slugify(pkgName);
370
+ if (!dep) return;
371
+ await depsService.pack({
372
+ dir: dep.location,
373
+ destination: workspaceDirPath,
374
+ sanitizedName,
375
+ version: dep.version ?? "0.0.0"
376
+ });
377
+ }));
378
+ }
379
+ });
237
380
  logger.info("Successfully packaged workspace dependencies", { count: usedWorkspacePackages.size });
238
381
  }
239
382
  };
@@ -1459,4 +1602,4 @@ async function analyzeBundle(entries, mastraEntry, { outputDir, projectRoot, pla
1459
1602
  //#endregion
1460
1603
  export { aliasHono as a, packWorkspaceDependencies as c, bundleExternals as i, checkConfigExport as n, collectTransitiveWorkspaceDependencies as o, normalizeExternals as r, getWorkspaceInformation as s, analyzeBundle as t };
1461
1604
 
1462
- //# sourceMappingURL=analyze-BP0cLyWH.js.map
1605
+ //# sourceMappingURL=analyze-CFPQzJ-2.js.map