@mastra/deployer 1.58.0-alpha.3 → 1.58.0-alpha.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 1.58.0-alpha.4
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `bundler.entries` so `mastra build` can emit extra process entries next to the server bundle. ([#20850](https://github.com/mastra-ai/mastra/pull/20850))
8
+
9
+ A Mastra app that runs a second long-running process, such as a LiveKit voice worker, previously had to bundle that process with its own toolchain because `mastra build` only emitted `index.mjs`. Declare the extra entries in your Mastra config instead:
10
+
11
+ ```typescript title="src/mastra/index.ts"
12
+ export const mastra = new Mastra({
13
+ bundler: {
14
+ entries: { 'voice-worker': './voice-worker.ts' },
15
+ externals: true,
16
+ },
17
+ });
18
+ ```
19
+
20
+ `mastra build` now emits `.mastra/output/voice-worker.mjs` beside `.mastra/output/index.mjs`. Both share one output directory, one `package.json`, and one dependency install, so a single build produces one deployable artifact you start with different commands:
21
+
22
+ ```bash
23
+ node .mastra/output/index.mjs # server
24
+ node .mastra/output/voice-worker.mjs start # worker
25
+ ```
26
+
27
+ Dependencies imported only by an extra entry are analyzed too, so they land in the generated `package.json` and resolve at runtime.
28
+
29
+ Entry names may contain `/` to nest the output, but cannot be `index` (the server bundle), `tools` (the tool aggregator), or start with `tools/` (tool bundles).
30
+
31
+ ### Patch Changes
32
+
33
+ - Fixed user-registered middleware (`serverMiddleware` and `server.middleware`) being able to return a 401 for framework-public routes such as the Studio sign-in endpoints. ([#20989](https://github.com/mastra-ai/mastra/pull/20989))
34
+
35
+ The deployer now wraps every user middleware with `skipIfFrameworkPublic` from `@mastra/hono`, so requests to routes declared public via `createPublicRoute()` / `requiresAuth: false` always reach their handler.
36
+
37
+ - Updated dependencies [[`c271cae`](https://github.com/mastra-ai/mastra/commit/c271caebd0add9f5d610db0fdb75915fb2b71c18), [`76e5132`](https://github.com/mastra-ai/mastra/commit/76e51328dbc0749c8304e6b3f21e4401f451b081), [`0282e16`](https://github.com/mastra-ai/mastra/commit/0282e16115538c8e9b248b90f0748eb01cb5dc98)]:
38
+ - @mastra/server@1.58.0-alpha.4
39
+ - @mastra/core@1.58.0-alpha.4
40
+
3
41
  ## 1.58.0-alpha.3
4
42
 
5
43
  ### Patch Changes
@@ -3,7 +3,7 @@ import type { Mastra } from '@mastra/core/mastra';
3
3
  import type { RequestContext } from '@mastra/core/request-context';
4
4
  import type { InMemoryTaskStore } from '@mastra/server/a2a/store';
5
5
  import type { ParsedRequestParams, ServerRoute } from '@mastra/server/server-adapter';
6
- import { MastraServer as MastraServerBase } from '@mastra/server/server-adapter';
6
+ import { MASTRA_FRAMEWORK_PUBLIC_KEY, MastraServer as MastraServerBase } from '@mastra/server/server-adapter';
7
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';
@@ -16,7 +16,30 @@ export type HonoVariables = {
16
16
  taskStore: InMemoryTaskStore;
17
17
  customRouteAuthConfig?: Map<string, boolean>;
18
18
  cachedBody?: unknown;
19
+ /**
20
+ * True when the current request targets a route the framework has declared
21
+ * public (`requiresAuth: false`). Adapter authors MUST wrap user-registered
22
+ * middleware with {@link skipIfFrameworkPublic} so that user middleware
23
+ * cannot 401 these routes.
24
+ */
25
+ [MASTRA_FRAMEWORK_PUBLIC_KEY]?: boolean;
19
26
  };
27
+ export { MASTRA_FRAMEWORK_PUBLIC_KEY } from '@mastra/server/server-adapter';
28
+ /**
29
+ * Wrap a Hono middleware handler so it becomes a no-op for framework-public
30
+ * routes (routes registered with `requiresAuth: false`).
31
+ *
32
+ * Adapters that expose user-provided middleware — for example `serverMiddleware`
33
+ * on the Mastra instance or `server.middleware` in Mastra config — MUST wrap
34
+ * those handlers with this before registering them. This is the framework's
35
+ * guarantee that user middleware cannot accidentally (or intentionally) 401
36
+ * routes the framework needs to keep reachable (e.g. Studio sign-in endpoints).
37
+ *
38
+ * The framework-public flag is computed once per request by
39
+ * {@link MastraServer.registerContextMiddleware} and stashed on the Hono
40
+ * context under `MASTRA_FRAMEWORK_PUBLIC_KEY`.
41
+ */
42
+ export declare const skipIfFrameworkPublic: (handler: MiddlewareHandler) => MiddlewareHandler;
20
43
  export type HonoBindings = {};
21
44
  /**
22
45
  * Generic handler function type compatible across Hono versions.
@@ -29,6 +29,12 @@ export interface BundlerOptions {
29
29
  enableEsmShim: boolean;
30
30
  externals: boolean | string[];
31
31
  dynamicPackages?: string[];
32
+ /**
33
+ * Extra process entries to emit beside the server bundle, as output name ->
34
+ * absolute source path. Already resolved and validated against the user's
35
+ * `bundler.entries` config; see `resolveExtraEntries`.
36
+ */
37
+ entries?: Record<string, string>;
32
38
  }
33
39
  /**
34
40
  * Version information for an external dependency
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolves the user's `bundler.entries` config into the absolute source paths the
3
+ * bundler emits beside the server bundle.
4
+ *
5
+ * Names become output filenames (`<name>.mjs` via rollup's `entryFileNames`), so they
6
+ * are rejected when they would collide with the server or tool bundles, or when they
7
+ * would escape the output directory. Paths resolve relative to the Mastra directory —
8
+ * the directory holding the entry file — so they read the same way as the imports
9
+ * already in that file.
10
+ */
11
+ export declare function resolveExtraEntries(entries: Record<string, string> | undefined, mastraEntryFile: string): Record<string, string>;
12
+ //# sourceMappingURL=entries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/bundler/entries.ts"],"names":[],"mappings":"AAyBA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,eAAe,EAAE,MAAM,GACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyExB"}
@@ -1,507 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("../rolldown-runtime-emK7D4bc.cjs");
3
- const require_analyze = require("../analyze-D100622N.cjs");
4
- const require_utils = require("../utils-O98BGdnP.cjs");
5
- const require_services = require("../services-_ksvysL5.cjs");
6
- const require_bundler = require("../bundler-u9WOUtpl.cjs");
7
- const require_bundlerOptions = require("../bundlerOptions-CYRir4LE.cjs");
8
- let child_process = require("child_process");
9
- let fs = require("fs");
10
- let fs_promises = require("fs/promises");
11
- let path = require("path");
12
- let _mastra_core_bundler = require("@mastra/core/bundler");
13
- let _mastra_core_error = require("@mastra/core/error");
14
- let _rollup_plugin_virtual = require("@rollup/plugin-virtual");
15
- _rollup_plugin_virtual = require_rolldown_runtime.__toESM(_rollup_plugin_virtual, 1);
16
- let empathic_package = require("empathic/package");
17
- empathic_package = require_rolldown_runtime.__toESM(empathic_package, 1);
18
- let fs_extra_esm = require("fs-extra/esm");
19
- fs_extra_esm = require_rolldown_runtime.__toESM(fs_extra_esm, 1);
20
- let tinyglobby = require("tinyglobby");
21
- //#region src/bundler/index.ts
22
- const IS_DEFAULT = Symbol("IS_DEFAULT");
23
- const NPM_ALIAS_PREFIX = "npm:";
24
- /** Characters a registry range or dist tag can contain. Protocols need `:`, git shorthand needs `/` or `#`. */
25
- const REGISTRY_SPEC_PATTERN = /^[A-Za-z0-9.+_^~><=*|!\s-]+$/;
26
- const PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+$/;
27
- const TARBALL_SUFFIX_PATTERN = /\.(?:tgz|tar\.gz|tar)$/i;
28
- /** npm reads a value starting like this as a path, whatever follows. A bare `~` is a semver range. */
29
- const FILE_SPEC_PREFIX_PATTERN = /^(?:\.|~[/\\]|[/\\]|[A-Za-z]:[/\\])/;
30
- /** A range admitting any published version: `*`, `x`, `>=0`, and any union containing one. */
31
- const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)\s*(?:[*xX]|>=?\s*0(?:\.0)*(?:\.0)*)\s*(?:$|\|\|)/;
32
- const toStringRecord = (value) => {
33
- if (!value || typeof value !== "object" || Array.isArray(value)) return {};
34
- return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
35
- };
36
- /**
37
- * True when a specifier is something the isolated install in `.mastra/output` can resolve from the
38
- * registry: a semver range, a dist tag, a wildcard, or an npm alias whose target is a registry
39
- * package and range.
40
- *
41
- * This is an allowlist rather than a denylist of known protocols, so an unfamiliar protocol is
42
- * rejected without this code having to know it exists. The output directory is not a workspace, has
43
- * no catalog definitions and has a different relative-path base, so `catalog:`, `workspace:`,
44
- * `file:`, `link:` and git specifiers are all either uninstallable there or point somewhere else.
45
- */
46
- const isRegistryVersionSpec = (spec) => {
47
- if (FILE_SPEC_PREFIX_PATTERN.test(spec) || TARBALL_SUFFIX_PATTERN.test(spec)) return false;
48
- if (spec.startsWith(NPM_ALIAS_PREFIX)) {
49
- const alias = spec.slice(4);
50
- const rangeSeparator = alias.lastIndexOf("@");
51
- const name = rangeSeparator > 0 ? alias.slice(0, rangeSeparator) : alias;
52
- const range = rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : "*";
53
- return PACKAGE_NAME_PATTERN.test(name) && isRegistryVersionSpec(range);
54
- }
55
- return REGISTRY_SPEC_PATTERN.test(spec);
56
- };
57
- /**
58
- * True when a specifier names a version the output install can be held to.
59
- *
60
- * A range admitting anything (`*`, `latest`, `>=0`, an alias with no range) is looser than the
61
- * version already resolved, so writing it would let a later install pull something the bundle was
62
- * never analyzed against.
63
- */
64
- const isBoundedVersionSpec = (spec) => {
65
- const range = spec.startsWith(NPM_ALIAS_PREFIX) ? (() => {
66
- const alias = spec.slice(4);
67
- const rangeSeparator = alias.lastIndexOf("@");
68
- return rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : "";
69
- })() : spec;
70
- return /\d/.test(range) && !UNBOUNDED_RANGE_PATTERN.test(range);
71
- };
72
- const readManifest = async (manifestPath) => {
73
- if (!manifestPath) return;
74
- try {
75
- const manifest = await (0, fs_extra_esm.readJSON)(manifestPath);
76
- return manifest && typeof manifest === "object" ? manifest : void 0;
77
- } catch {
78
- return;
79
- }
80
- };
81
- /** Collect the package names a manifest's resolution fields pin, ignoring their values. */
82
- const collectManifestPinnedNames = (manifest, pinned) => {
83
- const pnpmSection = manifest?.pnpm;
84
- const records = [
85
- manifest?.overrides,
86
- manifest?.resolutions,
87
- pnpmSection && typeof pnpmSection === "object" ? pnpmSection.overrides : void 0
88
- ];
89
- for (const record of records) if (record && typeof record === "object" && !Array.isArray(record)) for (const key of Object.keys(record)) pinned.add(key);
90
- };
91
- /**
92
- * Collect the names under a top-level `overrides:` block in `pnpm-workspace.yaml`.
93
- *
94
- * pnpm moved overrides out of `package.json` into this file, so a workspace on a current pnpm keeps
95
- * them only here. Reading names off the indented block avoids a YAML dependency, the same tradeoff
96
- * `copyPnpmWorkspaceSettings` already makes for the top-level keys it copies.
97
- */
98
- const collectPnpmWorkspacePinnedNames = (source, pinned) => {
99
- const lines = source.split(/\r?\n/);
100
- let insideOverrides = false;
101
- for (const line of lines) {
102
- if (/^\S/.test(line)) {
103
- insideOverrides = /^overrides:\s*$/.test(line);
104
- continue;
105
- }
106
- if (!insideOverrides) continue;
107
- const key = /^\s+(?:'([^']+)'|"([^"]+)"|([^'"\s:][^:]*?))\s*:/.exec(line);
108
- if (key) pinned.add((key[1] ?? key[2] ?? key[3] ?? "").trim());
109
- }
110
- };
111
- /**
112
- * Read the constraints the source app declared.
113
- *
114
- * `dependencies` come from the manifest at `projectRoot`, the package the build was invoked for and
115
- * whose directory receives the output, falling back to the manifest above the entry file. Anchoring
116
- * on `projectRoot` rather than the entry file keeps the answer deterministic when the entry handed
117
- * to the bundler is a generated wrapper rather than the app's own source file.
118
- *
119
- * Resolution-field names are collected from both that manifest and the workspace root, including the
120
- * root `pnpm-workspace.yaml`, because a name pinned anywhere means the resolved version may have been
121
- * chosen deliberately rather than hoisted by accident.
122
- */
123
- const getSourceDependencyConstraints = async ({ projectRoot, mastraEntryFile, workspaceRoot }) => {
124
- const manifestPaths = [empathic_package.up({ cwd: projectRoot }), empathic_package.up({ cwd: (0, path.dirname)(mastraEntryFile) })].filter((entry, index, entries) => !!entry && entries.indexOf(entry) === index);
125
- if (workspaceRoot) manifestPaths.push((0, path.join)(workspaceRoot, "package.json"));
126
- const pinnedByResolutionField = /* @__PURE__ */ new Set();
127
- let dependencies;
128
- for (const manifestPath of manifestPaths) {
129
- const manifest = await readManifest(manifestPath);
130
- if (!manifest) continue;
131
- dependencies ??= toStringRecord(manifest.dependencies);
132
- collectManifestPinnedNames(manifest, pinnedByResolutionField);
133
- }
134
- if (workspaceRoot) try {
135
- collectPnpmWorkspacePinnedNames(await (0, fs_promises.readFile)((0, path.join)(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"), pinnedByResolutionField);
136
- } catch {}
137
- return {
138
- dependencies: dependencies ?? {},
139
- pinnedByResolutionField
140
- };
141
- };
142
- const findDeclaredConstraint = (constraints, dependencyName) => {
143
- const names = [dependencyName, require_utils.getPackageName(dependencyName)].filter((name, index, all) => !!name && all.indexOf(name) === index);
144
- for (const name of names) if (constraints.pinnedByResolutionField.has(name)) return;
145
- for (const name of names) {
146
- const declared = (constraints.dependencies[name] ?? "").trim();
147
- if (declared && isBoundedVersionSpec(declared) && isRegistryVersionSpec(declared)) return declared;
148
- }
149
- };
150
- /**
151
- * Prefer the constraint the app declared over the version resolved from `node_modules`.
152
- *
153
- * The resolved version is whatever the install happened to hoist, so an app declaring `zod: ^4.3.6`
154
- * next to a hoisted `zod@3.25.76` gets the hoisted version written into the output manifest and the
155
- * isolated install then locks it in.
156
- */
157
- const applySourceDependencyRange = (dependencyName, dependencyInfo, constraints) => {
158
- const declared = findDeclaredConstraint(constraints, dependencyName);
159
- if (!declared) return dependencyInfo;
160
- if (declared.startsWith(NPM_ALIAS_PREFIX)) return {
161
- ...dependencyInfo,
162
- packageSpec: declared
163
- };
164
- if (dependencyInfo.packageSpec) return dependencyInfo;
165
- return {
166
- ...dependencyInfo,
167
- version: declared
168
- };
169
- };
170
- var Bundler = class extends _mastra_core_bundler.MastraBundler {
171
- analyzeOutputDir = ".build";
172
- outputDir = "output";
173
- platform = "node";
174
- constructor(name, component = "BUNDLER") {
175
- super({
176
- name,
177
- component
178
- });
179
- }
180
- async prepare(outputDirectory) {
181
- await (0, fs_extra_esm.emptyDir)(outputDirectory);
182
- await (0, fs_extra_esm.ensureDir)((0, path.join)(outputDirectory, this.analyzeOutputDir));
183
- await (0, fs_extra_esm.ensureDir)((0, path.join)(outputDirectory, this.outputDir));
184
- }
185
- async writePackageJson(outputDirectory, dependencies, resolutions) {
186
- this.logger.debug("Writing project's package.json");
187
- await (0, fs_extra_esm.ensureDir)(outputDirectory);
188
- const pkgPath = (0, path.join)(outputDirectory, "package.json");
189
- const dependenciesMap = /* @__PURE__ */ new Map();
190
- for (const [key, value] of dependencies.entries()) {
191
- const dependencyValue = typeof value === "string" ? value : value.packageSpec ?? value.version ?? "latest";
192
- if (key.startsWith("@")) {
193
- const pkgChunks = key.split("/");
194
- dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, dependencyValue);
195
- } else {
196
- const pkgName = key.split("/")[0] || key;
197
- dependenciesMap.set(pkgName, dependencyValue);
198
- }
199
- }
200
- await (0, fs_promises.writeFile)(pkgPath, JSON.stringify({
201
- name: "server",
202
- version: "1.0.0",
203
- private: true,
204
- type: "module",
205
- main: "index.mjs",
206
- scripts: { start: "node ./index.mjs" },
207
- dependencies: Object.fromEntries(dependenciesMap.entries()),
208
- ...Object.keys(resolutions ?? {}).length > 0 && { resolutions }
209
- }, null, 2));
210
- }
211
- createBundler(inputOptions, outputOptions) {
212
- return require_bundler.createBundler(inputOptions, outputOptions);
213
- }
214
- async getUserBundlerOptions(mastraEntryFile, outputDirectory) {
215
- const defaultBundlerOptions = {
216
- externals: [],
217
- sourcemap: false,
218
- transpilePackages: [],
219
- [IS_DEFAULT]: true
220
- };
221
- try {
222
- return await require_bundlerOptions.getBundlerOptions(mastraEntryFile, outputDirectory) ?? defaultBundlerOptions;
223
- } catch (error) {
224
- this.logger.debug("Failed to get bundler options, sourcemap will be disabled", { error });
225
- }
226
- return defaultBundlerOptions;
227
- }
228
- async analyze(entry, mastraFile, outputDirectory) {
229
- return await require_analyze.analyzeBundle([].concat(entry), mastraFile, {
230
- outputDir: (0, path.join)(outputDirectory, this.analyzeOutputDir),
231
- projectRoot: outputDirectory,
232
- platform: this.platform
233
- }, this.logger);
234
- }
235
- pnpmNodeLinker;
236
- async installDependencies(outputDirectory, rootDir = process.cwd(), pnpmOverrides) {
237
- const deps = new require_services.DepsService(rootDir);
238
- deps.__setLogger(this.logger);
239
- await deps.install({
240
- dir: (0, path.join)(outputDirectory, this.outputDir),
241
- pnpmOverrides,
242
- pnpmNodeLinker: this.pnpmNodeLinker
243
- });
244
- }
245
- /**
246
- * Generate a package-lock.json for the output directory so that deploy targets
247
- * can use `npm ci` instead of `npm install`, skipping version resolution entirely.
248
- * This is a lockfile-only operation — no packages are downloaded.
249
- *
250
- * Temporarily moves node_modules out of the way because pnpm's symlink-based
251
- * layout confuses npm's arborist, then restores it afterwards so that
252
- * `mastra start` (or wrangler) can still resolve dependencies at runtime.
253
- */
254
- async generateNpmLockfile(outputDir) {
255
- const nodeModules = (0, path.join)(outputDir, "node_modules");
256
- const nodeModulesTmp = (0, path.join)(outputDir, "node_modules.__tmp");
257
- let movedNodeModules = false;
258
- try {
259
- if (await fs_extra_esm.default.pathExists(nodeModules)) {
260
- await fs_extra_esm.default.move(nodeModules, nodeModulesTmp, { overwrite: true });
261
- movedNodeModules = true;
262
- }
263
- (0, child_process.execSync)("npm install --package-lock-only --force", {
264
- cwd: outputDir,
265
- stdio: "pipe",
266
- timeout: 6e4
267
- });
268
- } catch {
269
- this.logger.warn("Failed to generate package-lock.json — deploy will fall back to npm install");
270
- } finally {
271
- if (movedNodeModules) {
272
- await (0, fs_promises.rm)(nodeModules, {
273
- recursive: true,
274
- force: true
275
- });
276
- await fs_extra_esm.default.move(nodeModulesTmp, nodeModules, { overwrite: true });
277
- }
278
- }
279
- }
280
- async copyPublic(mastraDir, outputDirectory) {
281
- const publicDir = (0, path.join)(mastraDir, "public");
282
- try {
283
- await (0, fs_promises.stat)(publicDir);
284
- } catch {
285
- return;
286
- }
287
- await (0, fs_extra_esm.copy)(publicDir, (0, path.join)(outputDirectory, this.outputDir));
288
- }
289
- async copyDOTNPMRC({ rootDir = process.cwd(), outputDirectory }) {
290
- const sourceDotNpmRcPath = (0, path.join)(rootDir, ".npmrc");
291
- const targetDotNpmRcPath = (0, path.join)(outputDirectory, this.outputDir, ".npmrc");
292
- try {
293
- await (0, fs_promises.stat)(sourceDotNpmRcPath);
294
- await (0, fs_extra_esm.copy)(sourceDotNpmRcPath, targetDotNpmRcPath);
295
- } catch {
296
- return;
297
- }
298
- }
299
- /**
300
- * Writes the `mastra-project.json` deployment marker for Software Factory
301
- * projects after public assets have been copied. Verifies that the Factory
302
- * SPA (`factory/index.html`) exists in the output before emitting the marker.
303
- */
304
- async writeFactoryMarker(outputDirectory) {
305
- const outputDir = (0, path.join)(outputDirectory, this.outputDir);
306
- if (!(0, fs.existsSync)((0, path.join)(outputDir, "factory", "index.html"))) throw new _mastra_core_error.MastraError({
307
- id: "DEPLOYER_BUNDLER_FACTORY_UI_MISSING",
308
- text: "Software Factory project detected but factory/index.html was not found after copying the prebuilt Factory UI.",
309
- domain: _mastra_core_error.ErrorDomain.DEPLOYER,
310
- category: _mastra_core_error.ErrorCategory.SYSTEM
311
- });
312
- await (0, fs_promises.writeFile)((0, path.join)(outputDir, "mastra-project.json"), JSON.stringify({
313
- schemaVersion: 1,
314
- projectType: "factory",
315
- assets: { ui: "factory" }
316
- }, null, 2));
317
- this.logger.info("Wrote mastra-project.json for Software Factory project");
318
- }
319
- async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, { enableSourcemap, enableEsmShim, externals }) {
320
- const { workspaceRoot } = await require_analyze.getWorkspaceInformation({ mastraEntryFile });
321
- const closestPkgJson = empathic_package.up({ cwd: (0, path.dirname)(mastraEntryFile) });
322
- const projectRoot = closestPkgJson ? (0, path.dirname)(closestPkgJson) : process.cwd();
323
- const inputOptions = await require_bundler.getInputOptions(mastraEntryFile, analyzedBundleInfo, this.platform, { "process.env.NODE_ENV": JSON.stringify("production") }, {
324
- sourcemap: enableSourcemap,
325
- workspaceRoot,
326
- projectRoot,
327
- enableEsmShim,
328
- externalsPreset: externals === true
329
- });
330
- const isVirtual = serverFile.includes("\n") || !(0, fs.existsSync)(serverFile);
331
- const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
332
- if (isVirtual) {
333
- inputOptions.input = {
334
- index: "#entry",
335
- ...toolsInputOptions
336
- };
337
- if (Array.isArray(inputOptions.plugins)) inputOptions.plugins.unshift((0, _rollup_plugin_virtual.default)({ "#entry": serverFile }));
338
- else inputOptions.plugins = [(0, _rollup_plugin_virtual.default)({ "#entry": serverFile })];
339
- } else inputOptions.input = {
340
- index: serverFile,
341
- ...toolsInputOptions
342
- };
343
- return inputOptions;
344
- }
345
- getAllToolPaths(mastraDir, toolsPaths = []) {
346
- const normalizedMastraDir = require_utils.slash(mastraDir);
347
- const defaultPaths = [path.posix.join(normalizedMastraDir, "tools/**/*.{js,ts}"), ...[`!${path.posix.join(normalizedMastraDir, "tools/**/*.{test,spec}.{js,ts}")}`, `!${path.posix.join(normalizedMastraDir, "tools/**/__tests__/**")}`]];
348
- if (toolsPaths.length === 0) return [defaultPaths];
349
- return [...toolsPaths, defaultPaths];
350
- }
351
- async listToolsInputOptions(toolsPaths) {
352
- const inputs = {};
353
- for (const toolPath of toolsPaths) {
354
- const expandedPaths = await (0, tinyglobby.glob)(toolPath, {
355
- absolute: true,
356
- expandDirectories: false
357
- });
358
- for (const path$1 of expandedPaths) if (await fs_extra_esm.default.pathExists(path$1)) {
359
- const entryFile = new require_services.FileService().getFirstExistingFile([
360
- (0, path.join)(path$1, "index.ts"),
361
- (0, path.join)(path$1, "index.js"),
362
- path$1
363
- ]);
364
- if (!entryFile || (await (0, fs_promises.stat)(entryFile)).isDirectory()) {
365
- this.logger.warn("No entry file found, skipping", { path: path$1 });
366
- continue;
367
- }
368
- const uniqueToolID = crypto.randomUUID();
369
- const normalizedEntryFile = entryFile.replaceAll("\\", "/");
370
- inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;
371
- } else this.logger.warn("Tool path does not exist, skipping", { path: path$1 });
372
- }
373
- return inputs;
374
- }
375
- async _bundle(serverFile, mastraEntryFile, { projectRoot, outputDirectory, enableEsmShim = true }, toolsPaths = [], bundleLocation = (0, path.join)(outputDirectory, this.outputDir)) {
376
- const analyzeDir = (0, path.join)(outputDirectory, this.analyzeOutputDir);
377
- const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);
378
- const internalBundlerOptions = {
379
- enableSourcemap: !!bundlerOptions.sourcemap,
380
- externals: bundlerOptions.externals ?? [],
381
- enableEsmShim,
382
- dynamicPackages: bundlerOptions.dynamicPackages
383
- };
384
- let analyzedBundleInfo;
385
- try {
386
- const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);
387
- analyzedBundleInfo = await require_analyze.analyzeBundle([serverFile, ...Object.values(resolvedToolsPaths)], mastraEntryFile, {
388
- outputDir: analyzeDir,
389
- projectRoot,
390
- platform: this.platform,
391
- bundlerOptions: internalBundlerOptions
392
- }, this.logger);
393
- } catch (error) {
394
- const message = error instanceof Error ? error.message : String(error);
395
- if (error instanceof _mastra_core_error.MastraError) throw error;
396
- throw new _mastra_core_error.MastraError({
397
- id: "DEPLOYER_BUNDLER_ANALYZE_FAILED",
398
- text: `Failed to analyze Mastra application: ${message}`,
399
- domain: _mastra_core_error.ErrorDomain.DEPLOYER,
400
- category: _mastra_core_error.ErrorCategory.SYSTEM
401
- }, error);
402
- }
403
- const { workspaceRoot } = await require_analyze.getWorkspaceInformation({
404
- dir: projectRoot,
405
- mastraEntryFile
406
- });
407
- const sourceDependencyConstraints = await getSourceDependencyConstraints({
408
- projectRoot,
409
- mastraEntryFile,
410
- workspaceRoot
411
- });
412
- const dependenciesToInstall = /* @__PURE__ */ new Map();
413
- for (const [dep, depInfo] of analyzedBundleInfo.externalDependencies) {
414
- if (analyzedBundleInfo.workspaceMap.has(dep) || !require_utils.isBareModuleSpecifier(dep)) continue;
415
- dependenciesToInstall.set(dep, applySourceDependencyRange(dep, depInfo, sourceDependencyConstraints));
416
- }
417
- const initialWorkspaceDependencies = /* @__PURE__ */ new Set();
418
- for (const dep of analyzedBundleInfo.dependencies.keys()) {
419
- const pkgName = require_utils.getPackageName(dep);
420
- if (pkgName && analyzedBundleInfo.workspaceMap.has(pkgName)) initialWorkspaceDependencies.add(pkgName);
421
- }
422
- const transitiveWorkspaceDependencies = require_analyze.collectTransitiveWorkspaceDependencies({
423
- workspaceMap: analyzedBundleInfo.workspaceMap,
424
- initialDependencies: initialWorkspaceDependencies,
425
- logger: this.logger
426
- });
427
- for (const [dep, packageSpec] of Object.entries(transitiveWorkspaceDependencies.resolutions)) dependenciesToInstall.set(dep, {
428
- version: analyzedBundleInfo.workspaceMap.get(dep)?.version,
429
- packageSpec
430
- });
431
- try {
432
- await this.writePackageJson((0, path.join)(outputDirectory, this.outputDir), dependenciesToInstall, transitiveWorkspaceDependencies.resolutions);
433
- if (transitiveWorkspaceDependencies.usedWorkspacePackages.size > 0) await require_analyze.packWorkspaceDependencies({
434
- workspaceMap: analyzedBundleInfo.workspaceMap,
435
- usedWorkspacePackages: transitiveWorkspaceDependencies.usedWorkspacePackages,
436
- bundleOutputDir: (0, path.join)(outputDirectory, this.outputDir),
437
- logger: this.logger
438
- });
439
- this.logger.info("Bundling Mastra application");
440
- const inputOptions = await this.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, internalBundlerOptions);
441
- await (await this.createBundler({
442
- ...inputOptions,
443
- logLevel: inputOptions.logLevel === "silent" ? "warn" : inputOptions.logLevel,
444
- onwarn: (warning) => {
445
- if (warning.code === "CIRCULAR_DEPENDENCY") {
446
- if (warning.ids?.[0]?.includes("node_modules")) return;
447
- this.logger.warn("Circular dependency found", { dependency: warning.message.replace("Circular dependency: ", "") });
448
- }
449
- }
450
- }, {
451
- dir: bundleLocation,
452
- manualChunks: { mastra: ["#mastra"] },
453
- sourcemap: internalBundlerOptions.enableSourcemap
454
- })).write();
455
- const toolImports = [];
456
- const toolsExports = [];
457
- Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).forEach((key, index) => {
458
- const toolExport = `tool${index}`;
459
- toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);
460
- toolsExports.push(toolExport);
461
- });
462
- await (0, fs_promises.writeFile)((0, path.join)(bundleLocation, "tools.mjs"), `${toolImports.join("\n")}
463
-
464
- export const tools = [${toolsExports.join(", ")}]`);
465
- this.logger.info("Bundling Mastra done");
466
- this.logger.info("Copying public files");
467
- await this.copyPublic((0, path.dirname)(mastraEntryFile), outputDirectory);
468
- this.logger.info("Done copying public files");
469
- if (analyzedBundleInfo.projectType === "factory") await this.writeFactoryMarker(outputDirectory);
470
- this.logger.info("Copying .npmrc file");
471
- await this.copyDOTNPMRC({
472
- outputDirectory,
473
- rootDir: projectRoot
474
- });
475
- this.logger.info("Done copying .npmrc file");
476
- this.logger.info("Installing dependencies");
477
- await this.installDependencies(outputDirectory, projectRoot, transitiveWorkspaceDependencies.resolutions);
478
- this.logger.info("Done installing dependencies");
479
- if (Object.keys(transitiveWorkspaceDependencies.resolutions).length === 0) {
480
- this.logger.info("Generating package-lock.json for deploy");
481
- await this.generateNpmLockfile((0, path.join)(outputDirectory, this.outputDir));
482
- this.logger.info("Done generating package-lock.json");
483
- } else this.logger.warn("Skipping package-lock.json generation because the output contains packed workspace dependencies");
484
- } catch (error) {
485
- if (error instanceof _mastra_core_error.MastraError && error.id === "DEPLOYER_BUNDLER_FACTORY_UI_MISSING") throw error;
486
- throw new _mastra_core_error.MastraError({
487
- id: "DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED",
488
- text: `Failed during bundler bundle stage: ${error instanceof Error ? error.message : String(error)}`,
489
- domain: _mastra_core_error.ErrorDomain.DEPLOYER,
490
- category: _mastra_core_error.ErrorCategory.SYSTEM
491
- }, error);
492
- }
493
- }
494
- async lint(_entryFile, _outputDirectory, toolsPaths) {
495
- const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
496
- const toolsLength = Object.keys(toolsInputOptions).length;
497
- if (toolsLength > 0) this.logger.info("Found tools", { count: toolsLength });
498
- }
499
- };
500
- //#endregion
501
- exports.Bundler = Bundler;
502
- exports.IS_DEFAULT = IS_DEFAULT;
503
- exports.applySourceDependencyRange = applySourceDependencyRange;
504
- exports.getSourceDependencyConstraints = getSourceDependencyConstraints;
505
- exports.isRegistryVersionSpec = isRegistryVersionSpec;
506
-
507
- //# sourceMappingURL=index.cjs.map
2
+ const require_bundler = require("../bundler-COBoQziJ.cjs");
3
+ exports.Bundler = require_bundler.Bundler;
4
+ exports.IS_DEFAULT = require_bundler.IS_DEFAULT;
5
+ exports.applySourceDependencyRange = require_bundler.applySourceDependencyRange;
6
+ exports.getSourceDependencyConstraints = require_bundler.getSourceDependencyConstraints;
7
+ exports.isRegistryVersionSpec = require_bundler.isRegistryVersionSpec;
@@ -102,7 +102,7 @@ export declare abstract class Bundler extends MastraBundler {
102
102
  * SPA (`factory/index.html`) exists in the output before emitting the marker.
103
103
  */
104
104
  protected writeFactoryMarker(outputDirectory: string): Promise<void>;
105
- protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: (string | string[])[], { enableSourcemap, enableEsmShim, externals }: BundlerOptions): Promise<InputOptions>;
105
+ protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: (string | string[])[], { enableSourcemap, enableEsmShim, externals, entries }: BundlerOptions): Promise<InputOptions>;
106
106
  getAllToolPaths(mastraDir: string, toolsPaths?: (string | string[])[]): (string | string[])[];
107
107
  listToolsInputOptions(toolsPaths: (string | string[])[]): Promise<Record<string, string>>;
108
108
  protected _bundle(serverFile: string, mastraEntryFile: string, { projectRoot, outputDirectory, enableEsmShim, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAUtD,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,UAAU,eAAuB,CAAC;AAY/C;;;;;;;;GAQG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,uBAAuB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtC,CAAC;AAYF;;;;;;;;;GASG;AACH,eAAO,MAAM,qB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