@mastra/deployer 0.3.0-alpha.6 → 0.3.0-alpha.8

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.
@@ -66,7 +66,7 @@ export declare abstract class Bundler extends MastraBundler {
66
66
  constructor(name: string, component?: 'BUNDLER' | 'DEPLOYER');
67
67
  prepare(outputDirectory: string): Promise<void>;
68
68
  writeInstrumentationFile(outputDirectory: string): Promise<void>;
69
- writePackageJson(outputDirectory: string, dependencies: Map<string, string>): Promise<void>;
69
+ writePackageJson(outputDirectory: string, dependencies: Map<string, string>, resolutions?: Record<string, string>): Promise<void>;
70
70
  protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & {
71
71
  dir: string;
72
72
  }): Promise<{
@@ -85,6 +85,15 @@ export declare abstract class Bundler extends MastraBundler {
85
85
  protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
86
86
  }
87
87
 
88
+ /**
89
+ * Collects all transitive workspace dependencies and their TGZ paths
90
+ */
91
+ export declare const collectTransitiveWorkspaceDependencies: ({ workspaceMap, initialDependencies, logger, }: {
92
+ workspaceMap: Map<string, WorkspacePackageInfo>;
93
+ initialDependencies: Set<string>;
94
+ logger: Logger;
95
+ }) => TransitiveDependencyResult;
96
+
88
97
  declare function createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & {
89
98
  dir: string;
90
99
  }): Promise<{
@@ -136,6 +145,16 @@ declare function createWatcher(inputOptions: InputOptions, outputOptions: Output
136
145
  export { createWatcher }
137
146
  export { createWatcher as createWatcher_alias_1 }
138
147
 
148
+ /**
149
+ * Creates a map of workspace packages with their metadata for dependency resolution
150
+ * @returns Map of package names to their location, dependencies and version
151
+ */
152
+ export declare const createWorkspacePackageMap: () => Promise<Map<string, {
153
+ location: string;
154
+ dependencies: Record<string, string> | undefined;
155
+ version: string | undefined;
156
+ }>>;
157
+
139
158
  export declare function deleteIndex(c: Context): Promise<Response>;
140
159
 
141
160
  export declare function deleteThreadHandler(c: Context): Promise<Response>;
@@ -158,6 +177,14 @@ declare class Deps extends MastraBase {
158
177
  constructor(rootDir?: string);
159
178
  private findLockFile;
160
179
  private getPackageManager;
180
+ getWorkspaceDependencyPath({ pkgName, version }: {
181
+ pkgName: string;
182
+ version: string;
183
+ }): string;
184
+ pack({ dir, destination }: {
185
+ dir: string;
186
+ destination: string;
187
+ }): Promise<unknown>;
161
188
  private writePnpmConfig;
162
189
  private writeYarnConfig;
163
190
  private getNpmArgs;
@@ -279,11 +306,11 @@ testPath?: string | undefined;
279
306
  }[];
280
307
  }, ContentfulStatusCode, "json">>;
281
308
 
282
- declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser'): Promise<InputOptions>;
309
+ declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string>): Promise<InputOptions>;
283
310
  export { getInputOptions as getBundlerInputOptions }
284
311
  export { getInputOptions }
285
312
 
286
- declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser'): Promise<InputOptions>;
313
+ declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string>): Promise<InputOptions>;
287
314
  export { getInputOptions_2 as getInputOptions_alias_1 }
288
315
  export { getInputOptions_2 as getWatcherInputOptions }
289
316
 
@@ -382,6 +409,16 @@ export declare function listenHandler(c: Context): Promise<Response>;
382
409
 
383
410
  export declare function listIndexes(c: Context): Promise<Response>;
384
411
 
412
+ /**
413
+ * Creates TGZ packages for workspace dependencies in the workspace-module directory
414
+ */
415
+ export declare const packWorkspaceDependencies: ({ workspaceMap, usedWorkspacePackages, bundleOutputDir, logger, }: {
416
+ workspaceMap: Map<string, WorkspacePackageInfo>;
417
+ bundleOutputDir: string;
418
+ logger: Logger;
419
+ usedWorkspacePackages: Set<string>;
420
+ }) => Promise<void>;
421
+
385
422
  export declare function pino(): {
386
423
  name: string;
387
424
  resolveId(this: PluginContext, id: string, importee: string | undefined): Promise<{
@@ -455,6 +492,11 @@ export declare function streamGenerateHandler(c: Context): Promise<Response | un
455
492
 
456
493
  export declare function streamGenerateHandler_alias_1(c: Context): Promise<Response | undefined>;
457
494
 
495
+ declare type TransitiveDependencyResult = {
496
+ resolutions: Record<string, string>;
497
+ usedWorkspacePackages: Set<string>;
498
+ };
499
+
458
500
  export declare function tsConfigPaths({ tsConfigPath, respectCoreModule }?: PluginOptions): Plugin;
459
501
 
460
502
  export declare function updateThreadHandler(c: Context): Promise<Response>;
@@ -481,6 +523,12 @@ declare type Variables = {
481
523
 
482
524
  export declare function watchWorkflowHandler(c: Context): Response | Promise<Response>;
483
525
 
526
+ declare type WorkspacePackageInfo = {
527
+ location: string;
528
+ dependencies: Record<string, string> | undefined;
529
+ version: string | undefined;
530
+ };
531
+
484
532
  declare function writeTelemetryConfig(entryFile: string, outputDir: string): Promise<{
485
533
  hasCustomConfig: boolean;
486
534
  }>;
@@ -66,7 +66,7 @@ export declare abstract class Bundler extends MastraBundler {
66
66
  constructor(name: string, component?: 'BUNDLER' | 'DEPLOYER');
67
67
  prepare(outputDirectory: string): Promise<void>;
68
68
  writeInstrumentationFile(outputDirectory: string): Promise<void>;
69
- writePackageJson(outputDirectory: string, dependencies: Map<string, string>): Promise<void>;
69
+ writePackageJson(outputDirectory: string, dependencies: Map<string, string>, resolutions?: Record<string, string>): Promise<void>;
70
70
  protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & {
71
71
  dir: string;
72
72
  }): Promise<{
@@ -85,6 +85,15 @@ export declare abstract class Bundler extends MastraBundler {
85
85
  protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
86
86
  }
87
87
 
88
+ /**
89
+ * Collects all transitive workspace dependencies and their TGZ paths
90
+ */
91
+ export declare const collectTransitiveWorkspaceDependencies: ({ workspaceMap, initialDependencies, logger, }: {
92
+ workspaceMap: Map<string, WorkspacePackageInfo>;
93
+ initialDependencies: Set<string>;
94
+ logger: Logger;
95
+ }) => TransitiveDependencyResult;
96
+
88
97
  declare function createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & {
89
98
  dir: string;
90
99
  }): Promise<{
@@ -136,6 +145,16 @@ declare function createWatcher(inputOptions: InputOptions, outputOptions: Output
136
145
  export { createWatcher }
137
146
  export { createWatcher as createWatcher_alias_1 }
138
147
 
148
+ /**
149
+ * Creates a map of workspace packages with their metadata for dependency resolution
150
+ * @returns Map of package names to their location, dependencies and version
151
+ */
152
+ export declare const createWorkspacePackageMap: () => Promise<Map<string, {
153
+ location: string;
154
+ dependencies: Record<string, string> | undefined;
155
+ version: string | undefined;
156
+ }>>;
157
+
139
158
  export declare function deleteIndex(c: Context): Promise<Response>;
140
159
 
141
160
  export declare function deleteThreadHandler(c: Context): Promise<Response>;
@@ -158,6 +177,14 @@ declare class Deps extends MastraBase {
158
177
  constructor(rootDir?: string);
159
178
  private findLockFile;
160
179
  private getPackageManager;
180
+ getWorkspaceDependencyPath({ pkgName, version }: {
181
+ pkgName: string;
182
+ version: string;
183
+ }): string;
184
+ pack({ dir, destination }: {
185
+ dir: string;
186
+ destination: string;
187
+ }): Promise<unknown>;
161
188
  private writePnpmConfig;
162
189
  private writeYarnConfig;
163
190
  private getNpmArgs;
@@ -279,11 +306,11 @@ testPath?: string | undefined;
279
306
  }[];
280
307
  }, ContentfulStatusCode, "json">>;
281
308
 
282
- declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser'): Promise<InputOptions>;
309
+ declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string>): Promise<InputOptions>;
283
310
  export { getInputOptions as getBundlerInputOptions }
284
311
  export { getInputOptions }
285
312
 
286
- declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser'): Promise<InputOptions>;
313
+ declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string>): Promise<InputOptions>;
287
314
  export { getInputOptions_2 as getInputOptions_alias_1 }
288
315
  export { getInputOptions_2 as getWatcherInputOptions }
289
316
 
@@ -382,6 +409,16 @@ export declare function listenHandler(c: Context): Promise<Response>;
382
409
 
383
410
  export declare function listIndexes(c: Context): Promise<Response>;
384
411
 
412
+ /**
413
+ * Creates TGZ packages for workspace dependencies in the workspace-module directory
414
+ */
415
+ export declare const packWorkspaceDependencies: ({ workspaceMap, usedWorkspacePackages, bundleOutputDir, logger, }: {
416
+ workspaceMap: Map<string, WorkspacePackageInfo>;
417
+ bundleOutputDir: string;
418
+ logger: Logger;
419
+ usedWorkspacePackages: Set<string>;
420
+ }) => Promise<void>;
421
+
385
422
  export declare function pino(): {
386
423
  name: string;
387
424
  resolveId(this: PluginContext, id: string, importee: string | undefined): Promise<{
@@ -455,6 +492,11 @@ export declare function streamGenerateHandler(c: Context): Promise<Response | un
455
492
 
456
493
  export declare function streamGenerateHandler_alias_1(c: Context): Promise<Response | undefined>;
457
494
 
495
+ declare type TransitiveDependencyResult = {
496
+ resolutions: Record<string, string>;
497
+ usedWorkspacePackages: Set<string>;
498
+ };
499
+
458
500
  export declare function tsConfigPaths({ tsConfigPath, respectCoreModule }?: PluginOptions): Plugin;
459
501
 
460
502
  export declare function updateThreadHandler(c: Context): Promise<Response>;
@@ -481,6 +523,12 @@ declare type Variables = {
481
523
 
482
524
  export declare function watchWorkflowHandler(c: Context): Response | Promise<Response>;
483
525
 
526
+ declare type WorkspacePackageInfo = {
527
+ location: string;
528
+ dependencies: Record<string, string> | undefined;
529
+ version: string | undefined;
530
+ };
531
+
484
532
  declare function writeTelemetryConfig(entryFile: string, outputDir: string): Promise<{
485
533
  hasCustomConfig: boolean;
486
534
  }>;
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkAE4CVAPK_cjs = require('../chunk-AE4CVAPK.cjs');
3
+ var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "createBundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkAE4CVAPK_cjs.createBundler; }
9
+ get: function () { return chunkIMGVLBV7_cjs.createBundler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getInputOptions", {
12
12
  enumerable: true,
13
- get: function () { return chunkAE4CVAPK_cjs.getInputOptions; }
13
+ get: function () { return chunkIMGVLBV7_cjs.getInputOptions; }
14
14
  });
@@ -1 +1 @@
1
- export { createBundler, getInputOptions } from '../chunk-IKPL4RGG.js';
1
+ export { createBundler, getInputOptions } from '../chunk-AOSWYZKN.js';
@@ -1,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunk3L5VM2XK_cjs = require('../chunk-3L5VM2XK.cjs');
3
+ var chunkZ7KAM3CZ_cjs = require('../chunk-Z7KAM3CZ.cjs');
4
4
  var chunk2ZPQX6BX_cjs = require('../chunk-2ZPQX6BX.cjs');
5
5
  var chunkLA6Y6GAB_cjs = require('../chunk-LA6Y6GAB.cjs');
6
- var chunkAE4CVAPK_cjs = require('../chunk-AE4CVAPK.cjs');
7
- var chunkRPH27LI6_cjs = require('../chunk-RPH27LI6.cjs');
6
+ var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
7
+ var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
8
8
 
9
9
 
10
10
 
11
11
  Object.defineProperty(exports, "createWatcher", {
12
12
  enumerable: true,
13
- get: function () { return chunk3L5VM2XK_cjs.createWatcher; }
13
+ get: function () { return chunkZ7KAM3CZ_cjs.createWatcher; }
14
14
  });
15
15
  Object.defineProperty(exports, "getServerOptions", {
16
16
  enumerable: true,
17
- get: function () { return chunk3L5VM2XK_cjs.getServerOptions; }
17
+ get: function () { return chunkZ7KAM3CZ_cjs.getServerOptions; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWatcherInputOptions", {
20
20
  enumerable: true,
21
- get: function () { return chunk3L5VM2XK_cjs.getInputOptions; }
21
+ get: function () { return chunkZ7KAM3CZ_cjs.getInputOptions; }
22
22
  });
23
23
  Object.defineProperty(exports, "writeTelemetryConfig", {
24
24
  enumerable: true,
@@ -30,17 +30,17 @@ Object.defineProperty(exports, "analyzeBundle", {
30
30
  });
31
31
  Object.defineProperty(exports, "createBundler", {
32
32
  enumerable: true,
33
- get: function () { return chunkAE4CVAPK_cjs.createBundler; }
33
+ get: function () { return chunkIMGVLBV7_cjs.createBundler; }
34
34
  });
35
35
  Object.defineProperty(exports, "getBundlerInputOptions", {
36
36
  enumerable: true,
37
- get: function () { return chunkAE4CVAPK_cjs.getInputOptions; }
37
+ get: function () { return chunkIMGVLBV7_cjs.getInputOptions; }
38
38
  });
39
39
  Object.defineProperty(exports, "Deps", {
40
40
  enumerable: true,
41
- get: function () { return chunkRPH27LI6_cjs.Deps; }
41
+ get: function () { return chunk4VC5Z4YR_cjs.Deps; }
42
42
  });
43
43
  Object.defineProperty(exports, "FileService", {
44
44
  enumerable: true,
45
- get: function () { return chunkRPH27LI6_cjs.FileService; }
45
+ get: function () { return chunk4VC5Z4YR_cjs.FileService; }
46
46
  });
@@ -1,5 +1,5 @@
1
- export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-QGZQITE4.js';
1
+ export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-KTYDROLB.js';
2
2
  export { writeTelemetryConfig } from '../chunk-4AYFLP6G.js';
3
3
  export { analyzeBundle } from '../chunk-USZDOFES.js';
4
- export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-IKPL4RGG.js';
5
- export { Deps, FileService } from '../chunk-OJI4SKSV.js';
4
+ export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-AOSWYZKN.js';
5
+ export { Deps, FileService } from '../chunk-UV4RQQ3R.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkKSYXZYYB_cjs = require('../chunk-KSYXZYYB.cjs');
3
+ var chunkQ6OKTZNC_cjs = require('../chunk-Q6OKTZNC.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkKSYXZYYB_cjs.Bundler; }
9
+ get: function () { return chunkQ6OKTZNC_cjs.Bundler; }
10
10
  });
@@ -1 +1 @@
1
- export { Bundler } from '../chunk-54TB2QKS.js';
1
+ export { Bundler } from '../chunk-5QD7CDGY.js';
@@ -118,6 +118,22 @@ var Deps = class extends base.MastraBase {
118
118
  return "npm";
119
119
  }
120
120
  }
121
+ getWorkspaceDependencyPath({ pkgName, version }) {
122
+ return `file:./workspace-module/${pkgName}-${version}.tgz`;
123
+ }
124
+ async pack({ dir, destination }) {
125
+ const cpLogger = createChildProcessLogger({
126
+ logger: this.logger,
127
+ root: dir
128
+ });
129
+ return cpLogger({
130
+ cmd: `${this.packageManager} pack --pack-destination ${destination}`,
131
+ args: [],
132
+ env: {
133
+ PATH: process.env.PATH
134
+ }
135
+ });
136
+ }
121
137
  async writePnpmConfig(dir, options) {
122
138
  const packageJsonPath = path__default.default.join(dir, "package.json");
123
139
  const packageJson = await fsExtra.readJSON(packageJsonPath);
@@ -243,7 +259,7 @@ ${Object.entries(config.supportedArchitectures).map(([key, value]) => ` ${key}:
243
259
  }
244
260
  }
245
261
  async getPackageVersion() {
246
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-RPH27LI6.cjs', document.baseURI).href)));
262
+ const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-4VC5Z4YR.cjs', document.baseURI).href)));
247
263
  const __dirname = path.dirname(__filename);
248
264
  const pkgJsonPath = path__default.default.join(__dirname, "..", "..", "package.json");
249
265
  const content = await fsExtra.readJSON(pkgJsonPath);
@@ -330,7 +346,7 @@ var FileService = class {
330
346
  * @returns
331
347
  */
332
348
  async copyStarterFile(inputFile, outputFilePath, replaceIfExists) {
333
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-RPH27LI6.cjs', document.baseURI).href)));
349
+ const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-4VC5Z4YR.cjs', document.baseURI).href)));
334
350
  const __dirname = path__default.default.dirname(__filename);
335
351
  const filePath = path__default.default.resolve(__dirname, "..", "starter-files", inputFile);
336
352
  const fileString = fs3__namespace.default.readFileSync(filePath, "utf8");
@@ -1,7 +1,7 @@
1
1
  import { writeTelemetryConfig } from './chunk-4AYFLP6G.js';
2
2
  import { analyzeBundle } from './chunk-USZDOFES.js';
3
- import { createBundler, getInputOptions } from './chunk-IKPL4RGG.js';
4
- import { DepsService, FileService } from './chunk-OJI4SKSV.js';
3
+ import { createBundler, getInputOptions } from './chunk-AOSWYZKN.js';
4
+ import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { writeFile, stat } from 'node:fs/promises';
7
7
  import { join, dirname } from 'node:path';
@@ -10,7 +10,103 @@ import { MastraBundler } from '@mastra/core/bundler';
10
10
  import virtual from '@rollup/plugin-virtual';
11
11
  import fsExtra, { emptyDir, ensureDir, copy, readJSON } from 'fs-extra/esm';
12
12
  import resolveFrom from 'resolve-from';
13
+ import slugify from '@sindresorhus/slugify';
14
+ import { findWorkspaces, findWorkspacesRoot } from 'find-workspaces';
15
+ import { ensureDir as ensureDir$1 } from 'fs-extra';
13
16
 
17
+ var createWorkspacePackageMap = async () => {
18
+ const workspaces = await findWorkspaces();
19
+ const workspaceMap = new Map(
20
+ workspaces?.map((workspace) => [
21
+ workspace.package.name,
22
+ {
23
+ location: workspace.location,
24
+ dependencies: workspace.package.dependencies,
25
+ version: workspace.package.version
26
+ }
27
+ ]) ?? []
28
+ );
29
+ return workspaceMap;
30
+ };
31
+ var collectTransitiveWorkspaceDependencies = ({
32
+ workspaceMap,
33
+ initialDependencies,
34
+ logger
35
+ }) => {
36
+ const usedWorkspacePackages = /* @__PURE__ */ new Set();
37
+ const queue = Array.from(initialDependencies);
38
+ const resolutions = {};
39
+ while (queue.length > 0) {
40
+ const len = queue.length;
41
+ for (let i = 0; i < len; i += 1) {
42
+ const pkgName = queue.shift();
43
+ if (!pkgName || usedWorkspacePackages.has(pkgName)) {
44
+ continue;
45
+ }
46
+ const dep = workspaceMap.get(pkgName);
47
+ if (!dep) continue;
48
+ const root = findWorkspacesRoot();
49
+ if (!root) {
50
+ throw new Error("Could not find workspace root");
51
+ }
52
+ const depsService = new DepsService(root.location);
53
+ depsService.__setLogger(logger);
54
+ const sanitizedName = slugify(pkgName);
55
+ const tgzPath = depsService.getWorkspaceDependencyPath({
56
+ pkgName: sanitizedName,
57
+ version: dep.version
58
+ });
59
+ resolutions[pkgName] = tgzPath;
60
+ usedWorkspacePackages.add(pkgName);
61
+ for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) {
62
+ if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) {
63
+ queue.push(depName);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ return { resolutions, usedWorkspacePackages };
69
+ };
70
+ var packWorkspaceDependencies = async ({
71
+ workspaceMap,
72
+ usedWorkspacePackages,
73
+ bundleOutputDir,
74
+ logger
75
+ }) => {
76
+ const root = findWorkspacesRoot();
77
+ if (!root) {
78
+ throw new Error("Could not find workspace root");
79
+ }
80
+ const depsService = new DepsService(root.location);
81
+ depsService.__setLogger(logger);
82
+ if (usedWorkspacePackages.size > 0) {
83
+ const workspaceDirPath = join(bundleOutputDir, "workspace-module");
84
+ await ensureDir$1(workspaceDirPath);
85
+ logger.info(`Packaging ${usedWorkspacePackages.size} workspace dependencies...`);
86
+ const batchSize = 5;
87
+ const packages = Array.from(usedWorkspacePackages.values());
88
+ for (let i = 0; i < packages.length; i += batchSize) {
89
+ const batch = packages.slice(i, i + batchSize);
90
+ logger.info(
91
+ `Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(", ")}`
92
+ );
93
+ await Promise.all(
94
+ batch.map(async (pkgName) => {
95
+ const dep = workspaceMap.get(pkgName);
96
+ if (!dep) return;
97
+ try {
98
+ await depsService.pack({ dir: dep.location, destination: workspaceDirPath });
99
+ } catch (error) {
100
+ logger.error(`Failed to package ${pkgName}: ${error}`);
101
+ }
102
+ })
103
+ );
104
+ }
105
+ logger.info(`Successfully packaged ${usedWorkspacePackages.size} workspace dependencies`);
106
+ }
107
+ };
108
+
109
+ // src/bundler/index.ts
14
110
  var Bundler = class extends MastraBundler {
15
111
  analyzeOutputDir = ".build";
16
112
  outputDir = "output";
@@ -27,7 +123,7 @@ var Bundler = class extends MastraBundler {
27
123
  const __dirname = dirname(fileURLToPath(import.meta.url));
28
124
  await copy(join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
29
125
  }
30
- async writePackageJson(outputDirectory, dependencies) {
126
+ async writePackageJson(outputDirectory, dependencies, resolutions) {
31
127
  this.logger.debug(`Writing project's package.json`);
32
128
  await ensureDir(outputDirectory);
33
129
  const pkgPath = join(outputDirectory, "package.json");
@@ -55,7 +151,8 @@ var Bundler = class extends MastraBundler {
55
151
  },
56
152
  author: "Mastra",
57
153
  license: "ISC",
58
- dependencies: Object.fromEntries(dependenciesMap.entries())
154
+ dependencies: Object.fromEntries(dependenciesMap.entries()),
155
+ ...Object.keys(resolutions ?? {}).length > 0 && { resolutions }
59
156
  },
60
157
  null,
61
158
  2
@@ -83,7 +180,9 @@ var Bundler = class extends MastraBundler {
83
180
  await copy(publicDir, join(outputDirectory, this.outputDir));
84
181
  }
85
182
  async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
86
- const inputOptions = await getInputOptions(mastraEntryFile, analyzedBundleInfo, "node");
183
+ const inputOptions = await getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
184
+ "process.env.NODE_ENV": JSON.stringify("production")
185
+ });
87
186
  const isVirtual = serverFile.includes("\n") || existsSync(serverFile);
88
187
  const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);
89
188
  if (isVirtual) {
@@ -131,20 +230,49 @@ var Bundler = class extends MastraBundler {
131
230
  this.logger
132
231
  );
133
232
  await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));
233
+ const workspaceMap = await createWorkspacePackageMap();
134
234
  const dependenciesToInstall = /* @__PURE__ */ new Map();
235
+ const workspaceDependencies = /* @__PURE__ */ new Set();
135
236
  for (const dep of analyzedBundleInfo.externalDependencies) {
136
237
  try {
137
238
  const pkgPath = resolveFrom(mastraEntryFile, `${dep}/package.json`);
138
239
  const pkg = await readJSON(pkgPath);
240
+ if (workspaceMap.has(pkg.name)) {
241
+ workspaceDependencies.add(pkg.name);
242
+ continue;
243
+ }
139
244
  dependenciesToInstall.set(dep, pkg.version);
140
245
  } catch {
141
246
  dependenciesToInstall.set(dep, "latest");
142
247
  }
143
248
  }
249
+ let resolutions = {};
250
+ if (workspaceDependencies.size > 0) {
251
+ try {
252
+ const result = collectTransitiveWorkspaceDependencies({
253
+ workspaceMap,
254
+ initialDependencies: workspaceDependencies,
255
+ logger: this.logger
256
+ });
257
+ resolutions = result.resolutions;
258
+ Object.entries(resolutions).forEach(([pkgName, tgzPath]) => {
259
+ dependenciesToInstall.set(pkgName, tgzPath);
260
+ });
261
+ await packWorkspaceDependencies({
262
+ workspaceMap,
263
+ usedWorkspacePackages: result.usedWorkspacePackages,
264
+ bundleOutputDir: join(outputDirectory, this.outputDir),
265
+ logger: this.logger
266
+ });
267
+ } catch (error) {
268
+ this.logger.error(`Failed to collect workspace dependencies: ${error}`);
269
+ return;
270
+ }
271
+ }
144
272
  if (analyzedBundleInfo.externalDependencies.has("@mastra/memory") || analyzedBundleInfo.dependencies.has("@mastra/memory")) {
145
273
  dependenciesToInstall.set("fastembed", "latest");
146
274
  }
147
- await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);
275
+ await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall, resolutions);
148
276
  await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));
149
277
  this.logger.info("Bundling Mastra application");
150
278
  const inputOptions = await this.getBundlerOptions(
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  import { rollup } from 'rollup';
8
8
  import esbuild from 'rollup-plugin-esbuild';
9
9
 
10
- async function getInputOptions(entryFile, analyzedBundleInfo, platform) {
10
+ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = { "process.env.NODE_ENV": JSON.stringify("production") }) {
11
11
  let nodeResolvePlugin = platform === "node" ? nodeResolve({
12
12
  preferBuiltins: true,
13
13
  exportConditions: ["node", "import", "require"],
@@ -82,9 +82,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform) {
82
82
  target: "node20",
83
83
  platform,
84
84
  minify: false,
85
- define: {
86
- "process.env.NODE_ENV": JSON.stringify("production")
87
- }
85
+ define: env
88
86
  }),
89
87
  commonjs({
90
88
  extensions: [".js", ".ts"],
@@ -0,0 +1 @@
1
+
@@ -17,7 +17,7 @@ var json__default = /*#__PURE__*/_interopDefault(json);
17
17
  var nodeResolve__default = /*#__PURE__*/_interopDefault(nodeResolve);
18
18
  var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
19
19
 
20
- async function getInputOptions(entryFile, analyzedBundleInfo, platform) {
20
+ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = { "process.env.NODE_ENV": JSON.stringify("production") }) {
21
21
  let nodeResolvePlugin = platform === "node" ? nodeResolve__default.default({
22
22
  preferBuiltins: true,
23
23
  exportConditions: ["node", "import", "require"],
@@ -92,9 +92,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform) {
92
92
  target: "node20",
93
93
  platform,
94
94
  minify: false,
95
- define: {
96
- "process.env.NODE_ENV": JSON.stringify("production")
97
- }
95
+ define: env
98
96
  }),
99
97
  commonjs__default.default({
100
98
  extensions: [".js", ".ts"],
@@ -1,13 +1,13 @@
1
1
  import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-4AYFLP6G.js';
2
2
  import { aliasHono } from './chunk-USZDOFES.js';
3
- import { getInputOptions } from './chunk-IKPL4RGG.js';
3
+ import { getInputOptions } from './chunk-AOSWYZKN.js';
4
4
  import { tsConfigPaths } from './chunk-WVBUOQT6.js';
5
5
  import { watch, rollup } from 'rollup';
6
6
  import * as babel from '@babel/core';
7
7
  import esbuild from 'rollup-plugin-esbuild';
8
8
  import commonjs from '@rollup/plugin-commonjs';
9
9
 
10
- async function getInputOptions2(entryFile, platform) {
10
+ async function getInputOptions2(entryFile, platform, env) {
11
11
  const inputOptions = await getInputOptions(
12
12
  entryFile,
13
13
  {
@@ -15,7 +15,8 @@ async function getInputOptions2(entryFile, platform) {
15
15
  externalDependencies: /* @__PURE__ */ new Set(),
16
16
  invalidChunks: /* @__PURE__ */ new Set()
17
17
  },
18
- platform
18
+ platform,
19
+ env
19
20
  );
20
21
  if (Array.isArray(inputOptions.plugins)) {
21
22
  inputOptions.plugins = inputOptions.plugins.filter(
@@ -2,8 +2,8 @@
2
2
 
3
3
  var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
4
4
  var chunkLA6Y6GAB_cjs = require('./chunk-LA6Y6GAB.cjs');
5
- var chunkAE4CVAPK_cjs = require('./chunk-AE4CVAPK.cjs');
6
- var chunkRPH27LI6_cjs = require('./chunk-RPH27LI6.cjs');
5
+ var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
+ var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
7
7
  var fs = require('fs');
8
8
  var promises = require('fs/promises');
9
9
  var path = require('path');
@@ -12,6 +12,9 @@ var bundler = require('@mastra/core/bundler');
12
12
  var virtual = require('@rollup/plugin-virtual');
13
13
  var fsExtra = require('fs-extra/esm');
14
14
  var resolveFrom = require('resolve-from');
15
+ var slugify = require('@sindresorhus/slugify');
16
+ var findWorkspaces = require('find-workspaces');
17
+ var fsExtra$1 = require('fs-extra');
15
18
 
16
19
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
20
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -19,7 +22,101 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
22
  var virtual__default = /*#__PURE__*/_interopDefault(virtual);
20
23
  var fsExtra__default = /*#__PURE__*/_interopDefault(fsExtra);
21
24
  var resolveFrom__default = /*#__PURE__*/_interopDefault(resolveFrom);
25
+ var slugify__default = /*#__PURE__*/_interopDefault(slugify);
22
26
 
27
+ var createWorkspacePackageMap = async () => {
28
+ const workspaces = await findWorkspaces.findWorkspaces();
29
+ const workspaceMap = new Map(
30
+ workspaces?.map((workspace) => [
31
+ workspace.package.name,
32
+ {
33
+ location: workspace.location,
34
+ dependencies: workspace.package.dependencies,
35
+ version: workspace.package.version
36
+ }
37
+ ]) ?? []
38
+ );
39
+ return workspaceMap;
40
+ };
41
+ var collectTransitiveWorkspaceDependencies = ({
42
+ workspaceMap,
43
+ initialDependencies,
44
+ logger
45
+ }) => {
46
+ const usedWorkspacePackages = /* @__PURE__ */ new Set();
47
+ const queue = Array.from(initialDependencies);
48
+ const resolutions = {};
49
+ while (queue.length > 0) {
50
+ const len = queue.length;
51
+ for (let i = 0; i < len; i += 1) {
52
+ const pkgName = queue.shift();
53
+ if (!pkgName || usedWorkspacePackages.has(pkgName)) {
54
+ continue;
55
+ }
56
+ const dep = workspaceMap.get(pkgName);
57
+ if (!dep) continue;
58
+ const root = findWorkspaces.findWorkspacesRoot();
59
+ if (!root) {
60
+ throw new Error("Could not find workspace root");
61
+ }
62
+ const depsService = new chunk4VC5Z4YR_cjs.DepsService(root.location);
63
+ depsService.__setLogger(logger);
64
+ const sanitizedName = slugify__default.default(pkgName);
65
+ const tgzPath = depsService.getWorkspaceDependencyPath({
66
+ pkgName: sanitizedName,
67
+ version: dep.version
68
+ });
69
+ resolutions[pkgName] = tgzPath;
70
+ usedWorkspacePackages.add(pkgName);
71
+ for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) {
72
+ if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) {
73
+ queue.push(depName);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return { resolutions, usedWorkspacePackages };
79
+ };
80
+ var packWorkspaceDependencies = async ({
81
+ workspaceMap,
82
+ usedWorkspacePackages,
83
+ bundleOutputDir,
84
+ logger
85
+ }) => {
86
+ const root = findWorkspaces.findWorkspacesRoot();
87
+ if (!root) {
88
+ throw new Error("Could not find workspace root");
89
+ }
90
+ const depsService = new chunk4VC5Z4YR_cjs.DepsService(root.location);
91
+ depsService.__setLogger(logger);
92
+ if (usedWorkspacePackages.size > 0) {
93
+ const workspaceDirPath = path.join(bundleOutputDir, "workspace-module");
94
+ await fsExtra$1.ensureDir(workspaceDirPath);
95
+ logger.info(`Packaging ${usedWorkspacePackages.size} workspace dependencies...`);
96
+ const batchSize = 5;
97
+ const packages = Array.from(usedWorkspacePackages.values());
98
+ for (let i = 0; i < packages.length; i += batchSize) {
99
+ const batch = packages.slice(i, i + batchSize);
100
+ logger.info(
101
+ `Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(", ")}`
102
+ );
103
+ await Promise.all(
104
+ batch.map(async (pkgName) => {
105
+ const dep = workspaceMap.get(pkgName);
106
+ if (!dep) return;
107
+ try {
108
+ await depsService.pack({ dir: dep.location, destination: workspaceDirPath });
109
+ } catch (error) {
110
+ logger.error(`Failed to package ${pkgName}: ${error}`);
111
+ }
112
+ })
113
+ );
114
+ }
115
+ logger.info(`Successfully packaged ${usedWorkspacePackages.size} workspace dependencies`);
116
+ }
117
+ };
118
+
119
+ // src/bundler/index.ts
23
120
  var Bundler = class extends bundler.MastraBundler {
24
121
  analyzeOutputDir = ".build";
25
122
  outputDir = "output";
@@ -33,10 +130,10 @@ var Bundler = class extends bundler.MastraBundler {
33
130
  }
34
131
  async writeInstrumentationFile(outputDirectory) {
35
132
  const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
36
- const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-KSYXZYYB.cjs', document.baseURI).href))));
133
+ const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Q6OKTZNC.cjs', document.baseURI).href))));
37
134
  await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
38
135
  }
39
- async writePackageJson(outputDirectory, dependencies) {
136
+ async writePackageJson(outputDirectory, dependencies, resolutions) {
40
137
  this.logger.debug(`Writing project's package.json`);
41
138
  await fsExtra.ensureDir(outputDirectory);
42
139
  const pkgPath = path.join(outputDirectory, "package.json");
@@ -64,7 +161,8 @@ var Bundler = class extends bundler.MastraBundler {
64
161
  },
65
162
  author: "Mastra",
66
163
  license: "ISC",
67
- dependencies: Object.fromEntries(dependenciesMap.entries())
164
+ dependencies: Object.fromEntries(dependenciesMap.entries()),
165
+ ...Object.keys(resolutions ?? {}).length > 0 && { resolutions }
68
166
  },
69
167
  null,
70
168
  2
@@ -72,13 +170,13 @@ var Bundler = class extends bundler.MastraBundler {
72
170
  );
73
171
  }
74
172
  createBundler(inputOptions, outputOptions) {
75
- return chunkAE4CVAPK_cjs.createBundler(inputOptions, outputOptions);
173
+ return chunkIMGVLBV7_cjs.createBundler(inputOptions, outputOptions);
76
174
  }
77
175
  async analyze(entry, mastraFile, outputDirectory) {
78
176
  return await chunkLA6Y6GAB_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
79
177
  }
80
178
  async installDependencies(outputDirectory, rootDir = process.cwd()) {
81
- const deps = new chunkRPH27LI6_cjs.DepsService(rootDir);
179
+ const deps = new chunk4VC5Z4YR_cjs.DepsService(rootDir);
82
180
  deps.__setLogger(this.logger);
83
181
  await deps.install({ dir: path.join(outputDirectory, this.outputDir) });
84
182
  }
@@ -92,7 +190,9 @@ var Bundler = class extends bundler.MastraBundler {
92
190
  await fsExtra.copy(publicDir, path.join(outputDirectory, this.outputDir));
93
191
  }
94
192
  async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
95
- const inputOptions = await chunkAE4CVAPK_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node");
193
+ const inputOptions = await chunkIMGVLBV7_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
194
+ "process.env.NODE_ENV": JSON.stringify("production")
195
+ });
96
196
  const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
97
197
  const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);
98
198
  if (isVirtual) {
@@ -111,7 +211,7 @@ var Bundler = class extends bundler.MastraBundler {
111
211
  const inputs = {};
112
212
  for (const toolPath of toolsPaths) {
113
213
  if (await fsExtra__default.default.pathExists(toolPath)) {
114
- const fileService = new chunkRPH27LI6_cjs.FileService();
214
+ const fileService = new chunk4VC5Z4YR_cjs.FileService();
115
215
  const entryFile = fileService.getFirstExistingFile([
116
216
  path.join(toolPath, "index.ts"),
117
217
  path.join(toolPath, "index.js"),
@@ -140,20 +240,49 @@ var Bundler = class extends bundler.MastraBundler {
140
240
  this.logger
141
241
  );
142
242
  await chunk2ZPQX6BX_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
243
+ const workspaceMap = await createWorkspacePackageMap();
143
244
  const dependenciesToInstall = /* @__PURE__ */ new Map();
245
+ const workspaceDependencies = /* @__PURE__ */ new Set();
144
246
  for (const dep of analyzedBundleInfo.externalDependencies) {
145
247
  try {
146
248
  const pkgPath = resolveFrom__default.default(mastraEntryFile, `${dep}/package.json`);
147
249
  const pkg = await fsExtra.readJSON(pkgPath);
250
+ if (workspaceMap.has(pkg.name)) {
251
+ workspaceDependencies.add(pkg.name);
252
+ continue;
253
+ }
148
254
  dependenciesToInstall.set(dep, pkg.version);
149
255
  } catch {
150
256
  dependenciesToInstall.set(dep, "latest");
151
257
  }
152
258
  }
259
+ let resolutions = {};
260
+ if (workspaceDependencies.size > 0) {
261
+ try {
262
+ const result = collectTransitiveWorkspaceDependencies({
263
+ workspaceMap,
264
+ initialDependencies: workspaceDependencies,
265
+ logger: this.logger
266
+ });
267
+ resolutions = result.resolutions;
268
+ Object.entries(resolutions).forEach(([pkgName, tgzPath]) => {
269
+ dependenciesToInstall.set(pkgName, tgzPath);
270
+ });
271
+ await packWorkspaceDependencies({
272
+ workspaceMap,
273
+ usedWorkspacePackages: result.usedWorkspacePackages,
274
+ bundleOutputDir: path.join(outputDirectory, this.outputDir),
275
+ logger: this.logger
276
+ });
277
+ } catch (error) {
278
+ this.logger.error(`Failed to collect workspace dependencies: ${error}`);
279
+ return;
280
+ }
281
+ }
153
282
  if (analyzedBundleInfo.externalDependencies.has("@mastra/memory") || analyzedBundleInfo.dependencies.has("@mastra/memory")) {
154
283
  dependenciesToInstall.set("fastembed", "latest");
155
284
  }
156
- await this.writePackageJson(path.join(outputDirectory, this.outputDir), dependenciesToInstall);
285
+ await this.writePackageJson(path.join(outputDirectory, this.outputDir), dependenciesToInstall, resolutions);
157
286
  await this.writeInstrumentationFile(path.join(outputDirectory, this.outputDir));
158
287
  this.logger.info("Bundling Mastra application");
159
288
  const inputOptions = await this.getBundlerOptions(
@@ -91,6 +91,22 @@ var Deps = class extends MastraBase {
91
91
  return "npm";
92
92
  }
93
93
  }
94
+ getWorkspaceDependencyPath({ pkgName, version }) {
95
+ return `file:./workspace-module/${pkgName}-${version}.tgz`;
96
+ }
97
+ async pack({ dir, destination }) {
98
+ const cpLogger = createChildProcessLogger({
99
+ logger: this.logger,
100
+ root: dir
101
+ });
102
+ return cpLogger({
103
+ cmd: `${this.packageManager} pack --pack-destination ${destination}`,
104
+ args: [],
105
+ env: {
106
+ PATH: process.env.PATH
107
+ }
108
+ });
109
+ }
94
110
  async writePnpmConfig(dir, options) {
95
111
  const packageJsonPath = path.join(dir, "package.json");
96
112
  const packageJson = await readJSON(packageJsonPath);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
4
4
  var chunkLA6Y6GAB_cjs = require('./chunk-LA6Y6GAB.cjs');
5
- var chunkAE4CVAPK_cjs = require('./chunk-AE4CVAPK.cjs');
5
+ var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
6
6
  var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
7
7
  var rollup = require('rollup');
8
8
  var babel = require('@babel/core');
@@ -33,15 +33,16 @@ var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
33
33
  var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
34
34
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
35
35
 
36
- async function getInputOptions2(entryFile, platform) {
37
- const inputOptions = await chunkAE4CVAPK_cjs.getInputOptions(
36
+ async function getInputOptions2(entryFile, platform, env) {
37
+ const inputOptions = await chunkIMGVLBV7_cjs.getInputOptions(
38
38
  entryFile,
39
39
  {
40
40
  dependencies: /* @__PURE__ */ new Map(),
41
41
  externalDependencies: /* @__PURE__ */ new Set(),
42
42
  invalidChunks: /* @__PURE__ */ new Set()
43
43
  },
44
- platform
44
+ platform,
45
+ env
45
46
  );
46
47
  if (Array.isArray(inputOptions.plugins)) {
47
48
  inputOptions.plugins = inputOptions.plugins.filter(
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkKSYXZYYB_cjs = require('./chunk-KSYXZYYB.cjs');
3
+ var chunkQ6OKTZNC_cjs = require('./chunk-Q6OKTZNC.cjs');
4
4
  var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
5
- var chunkRPH27LI6_cjs = require('./chunk-RPH27LI6.cjs');
5
+ var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
6
6
  var babel = require('@babel/core');
7
7
  var rollup = require('rollup');
8
8
  var esbuild = require('rollup-plugin-esbuild');
@@ -33,8 +33,8 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
33
33
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
34
34
 
35
35
  // src/deploy/base.ts
36
- var Deployer = class extends chunkKSYXZYYB_cjs.Bundler {
37
- deps = new chunkRPH27LI6_cjs.DepsService();
36
+ var Deployer = class extends chunkQ6OKTZNC_cjs.Bundler {
37
+ deps = new chunk4VC5Z4YR_cjs.DepsService();
38
38
  constructor(args) {
39
39
  super(args.name, "DEPLOYER");
40
40
  this.deps.__setLogger(this.logger);
@@ -42,7 +42,7 @@ var Deployer = class extends chunkKSYXZYYB_cjs.Bundler {
42
42
  getEnvFiles() {
43
43
  const possibleFiles = [".env.production", ".env.local", ".env"];
44
44
  try {
45
- const fileService = new chunkRPH27LI6_cjs.FileService();
45
+ const fileService = new chunk4VC5Z4YR_cjs.FileService();
46
46
  const envFile = fileService.getFirstExistingFile(possibleFiles);
47
47
  return Promise.resolve([envFile]);
48
48
  } catch {
@@ -172,19 +172,19 @@ async function getDeployer(entryFile, outputDir) {
172
172
 
173
173
  Object.defineProperty(exports, "Deps", {
174
174
  enumerable: true,
175
- get: function () { return chunkRPH27LI6_cjs.Deps; }
175
+ get: function () { return chunk4VC5Z4YR_cjs.Deps; }
176
176
  });
177
177
  Object.defineProperty(exports, "FileService", {
178
178
  enumerable: true,
179
- get: function () { return chunkRPH27LI6_cjs.FileService; }
179
+ get: function () { return chunk4VC5Z4YR_cjs.FileService; }
180
180
  });
181
181
  Object.defineProperty(exports, "createChildProcessLogger", {
182
182
  enumerable: true,
183
- get: function () { return chunkRPH27LI6_cjs.createChildProcessLogger; }
183
+ get: function () { return chunk4VC5Z4YR_cjs.createChildProcessLogger; }
184
184
  });
185
185
  Object.defineProperty(exports, "createPinoStream", {
186
186
  enumerable: true,
187
- get: function () { return chunkRPH27LI6_cjs.createPinoStream; }
187
+ get: function () { return chunk4VC5Z4YR_cjs.createPinoStream; }
188
188
  });
189
189
  exports.Deployer = Deployer;
190
190
  exports.getDeployer = getDeployer;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Bundler } from './chunk-54TB2QKS.js';
1
+ import { Bundler } from './chunk-5QD7CDGY.js';
2
2
  import { recursiveRemoveNonReferencedNodes } from './chunk-4AYFLP6G.js';
3
- import { DepsService, FileService } from './chunk-OJI4SKSV.js';
4
- export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-OJI4SKSV.js';
3
+ import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
4
+ export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-UV4RQQ3R.js';
5
5
  import * as babel from '@babel/core';
6
6
  import babel__default from '@babel/core';
7
7
  import { rollup } from 'rollup';
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkRPH27LI6_cjs = require('../chunk-RPH27LI6.cjs');
3
+ var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "DepsService", {
8
8
  enumerable: true,
9
- get: function () { return chunkRPH27LI6_cjs.DepsService; }
9
+ get: function () { return chunk4VC5Z4YR_cjs.DepsService; }
10
10
  });
11
11
  Object.defineProperty(exports, "EnvService", {
12
12
  enumerable: true,
13
- get: function () { return chunkRPH27LI6_cjs.EnvService; }
13
+ get: function () { return chunk4VC5Z4YR_cjs.EnvService; }
14
14
  });
15
15
  Object.defineProperty(exports, "FileService", {
16
16
  enumerable: true,
17
- get: function () { return chunkRPH27LI6_cjs.FileService; }
17
+ get: function () { return chunk4VC5Z4YR_cjs.FileService; }
18
18
  });
@@ -1 +1 @@
1
- export { DepsService, EnvService, FileService } from '../chunk-OJI4SKSV.js';
1
+ export { DepsService, EnvService, FileService } from '../chunk-UV4RQQ3R.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.3.0-alpha.6",
3
+ "version": "0.3.0-alpha.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -93,10 +93,12 @@
93
93
  "@rollup/plugin-json": "^6.1.0",
94
94
  "@rollup/plugin-node-resolve": "^16.0.0",
95
95
  "@rollup/plugin-virtual": "^3.0.2",
96
+ "@sindresorhus/slugify": "^2.2.1",
96
97
  "builtins": "^5.1.0",
97
98
  "detect-libc": "^2.0.3",
98
99
  "dotenv": "^16.4.7",
99
100
  "esbuild": "^0.25.1",
101
+ "find-workspaces": "^0.3.1",
100
102
  "fs-extra": "^11.3.0",
101
103
  "hono": "^4.7.4",
102
104
  "resolve-from": "^5.0.0",
@@ -105,8 +107,8 @@
105
107
  "rollup-plugin-node-externals": "^8.0.0",
106
108
  "typescript-paths": "^1.5.1",
107
109
  "zod": "^3.24.2",
108
- "@mastra/core": "^0.9.0-alpha.5",
109
- "@mastra/server": "^2.0.0-alpha.5"
110
+ "@mastra/server": "^2.0.0-alpha.7",
111
+ "@mastra/core": "^0.9.0-alpha.7"
110
112
  },
111
113
  "devDependencies": {
112
114
  "@hono/node-server": "^1.13.8",