@mastra/deployer 1.0.0-beta.21 → 1.0.0-beta.22

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 (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/build/analyze.cjs +2 -2
  3. package/dist/build/analyze.js +1 -1
  4. package/dist/build/bundler.cjs +3 -3
  5. package/dist/build/bundler.js +1 -1
  6. package/dist/build/index.cjs +10 -10
  7. package/dist/build/index.js +3 -3
  8. package/dist/build/plugins/tsconfig-paths.d.ts +1 -1
  9. package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
  10. package/dist/bundler/index.cjs +3 -3
  11. package/dist/bundler/index.js +1 -1
  12. package/dist/{chunk-UKP4KHBS.js → chunk-5FPJTHRK.js} +4 -4
  13. package/dist/{chunk-UKP4KHBS.js.map → chunk-5FPJTHRK.js.map} +1 -1
  14. package/dist/{chunk-HVKR4FT2.cjs → chunk-7EPD2XJR.cjs} +11 -11
  15. package/dist/{chunk-HVKR4FT2.cjs.map → chunk-7EPD2XJR.cjs.map} +1 -1
  16. package/dist/{chunk-Z53UZLS3.cjs → chunk-GU4OME5Q.cjs} +11 -11
  17. package/dist/{chunk-Z53UZLS3.cjs.map → chunk-GU4OME5Q.cjs.map} +1 -1
  18. package/dist/{chunk-4NPMVODD.js → chunk-HWSYWSD7.js} +3 -3
  19. package/dist/chunk-HWSYWSD7.js.map +1 -0
  20. package/dist/{chunk-2ZPRZMBN.js → chunk-NGQZZ54Y.js} +3 -3
  21. package/dist/{chunk-2ZPRZMBN.js.map → chunk-NGQZZ54Y.js.map} +1 -1
  22. package/dist/{chunk-NGWTN4SJ.js → chunk-SD6NHZ2H.js} +4 -4
  23. package/dist/{chunk-NGWTN4SJ.js.map → chunk-SD6NHZ2H.js.map} +1 -1
  24. package/dist/{chunk-NWQP6PZQ.cjs → chunk-T7NCLSYN.cjs} +3 -3
  25. package/dist/chunk-T7NCLSYN.cjs.map +1 -0
  26. package/dist/{chunk-SBGBJ7NB.cjs → chunk-VOI3B5MX.cjs} +11 -11
  27. package/dist/{chunk-SBGBJ7NB.cjs.map → chunk-VOI3B5MX.cjs.map} +1 -1
  28. package/dist/docs/README.md +1 -1
  29. package/dist/docs/SKILL.md +1 -1
  30. package/dist/docs/SOURCE_MAP.json +1 -1
  31. package/dist/docs/deployment/01-overview.md +6 -2
  32. package/dist/docs/deployment/02-mastra-server.md +99 -40
  33. package/dist/docs/deployment/03-monorepo.md +89 -17
  34. package/dist/index.cjs +4 -4
  35. package/dist/index.js +2 -2
  36. package/dist/server/index.cjs +12 -10
  37. package/dist/server/index.cjs.map +1 -1
  38. package/dist/server/index.d.ts.map +1 -1
  39. package/dist/server/index.js +12 -10
  40. package/dist/server/index.js.map +1 -1
  41. package/dist/server/types.d.ts +1 -1
  42. package/dist/server/types.d.ts.map +1 -1
  43. package/package.json +6 -6
  44. package/dist/chunk-4NPMVODD.js.map +0 -1
  45. package/dist/chunk-NWQP6PZQ.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 1.0.0-beta.22
4
+
5
+ ### Major Changes
6
+
7
+ - Serve the Mastra Studio from `studio` folder (previously `playground`). ([#11751](https://github.com/mastra-ai/mastra/pull/11751))
8
+
9
+ The function signature for `createNodeServer()` changed, `playground` was renamed to `studio`:
10
+
11
+ ```ts
12
+ await createNodeServer(mastra, { studio: true, swaggerUI: false, tools: {} });
13
+ ```
14
+
15
+ ### Patch Changes
16
+
17
+ - Add support for configuring a cloud API endpoint via `MASTRA_CLOUD_API_ENDPOINT` environment variable. This value is now injected into the playground frontend as `window.MASTRA_CLOUD_API_ENDPOINT`. ([#11887](https://github.com/mastra-ai/mastra/pull/11887))
18
+
19
+ - Fix path alias resolution for extended tsconfig files. Reference issue: #11770 ([#11788](https://github.com/mastra-ai/mastra/pull/11788))
20
+
21
+ - Updated dependencies [[`ebae12a`](https://github.com/mastra-ai/mastra/commit/ebae12a2dd0212e75478981053b148a2c246962d), [`c61a0a5`](https://github.com/mastra-ai/mastra/commit/c61a0a5de4904c88fd8b3718bc26d1be1c2ec6e7), [`69136e7`](https://github.com/mastra-ai/mastra/commit/69136e748e32f57297728a4e0f9a75988462f1a7), [`449aed2`](https://github.com/mastra-ai/mastra/commit/449aed2ba9d507b75bf93d427646ea94f734dfd1), [`eb648a2`](https://github.com/mastra-ai/mastra/commit/eb648a2cc1728f7678768dd70cd77619b448dab9), [`0131105`](https://github.com/mastra-ai/mastra/commit/0131105532e83bdcbb73352fc7d0879eebf140dc), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`4db4e9b`](https://github.com/mastra-ai/mastra/commit/4db4e9b0905e1a659215bd49e987b47005e281ec), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`b00ccd3`](https://github.com/mastra-ai/mastra/commit/b00ccd325ebd5d9e37e34dd0a105caae67eb568f), [`3bdfa75`](https://github.com/mastra-ai/mastra/commit/3bdfa7507a91db66f176ba8221aa28dd546e464a), [`e770de9`](https://github.com/mastra-ai/mastra/commit/e770de941a287a49b1964d44db5a5763d19890a6), [`52e2716`](https://github.com/mastra-ai/mastra/commit/52e2716b42df6eff443de72360ae83e86ec23993), [`27b4040`](https://github.com/mastra-ai/mastra/commit/27b4040bfa1a95d92546f420a02a626b1419a1d6), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`2657fab`](https://github.com/mastra-ai/mastra/commit/2657fab795e72fae742e1e8fdd4644ebaec199e3), [`8dc7f55`](https://github.com/mastra-ai/mastra/commit/8dc7f55900395771da851dc7d78d53ae84fe34ec), [`8379099`](https://github.com/mastra-ai/mastra/commit/8379099fc467af6bef54dd7f80c9bd75bf8bbddf), [`8c0ec25`](https://github.com/mastra-ai/mastra/commit/8c0ec25646c8a7df253ed1e5ff4863a0d3f1316c), [`ff4d9a6`](https://github.com/mastra-ai/mastra/commit/ff4d9a6704fc87b31a380a76ed22736fdedbba5a), [`69821ef`](https://github.com/mastra-ai/mastra/commit/69821ef806482e2c44e2197ac0b050c3fe3a5285), [`1ed5716`](https://github.com/mastra-ai/mastra/commit/1ed5716830867b3774c4a1b43cc0d82935f32b96), [`4186bdd`](https://github.com/mastra-ai/mastra/commit/4186bdd00731305726fa06adba0b076a1d50b49f), [`7aaf973`](https://github.com/mastra-ai/mastra/commit/7aaf973f83fbbe9521f1f9e7a4fd99b8de464617)]:
22
+ - @mastra/core@1.0.0-beta.22
23
+ - @mastra/server@1.0.0-beta.22
24
+
3
25
  ## 1.0.0-beta.21
4
26
 
5
27
  ### Patch Changes
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkNWQP6PZQ_cjs = require('../chunk-NWQP6PZQ.cjs');
3
+ var chunkT7NCLSYN_cjs = require('../chunk-T7NCLSYN.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "analyzeBundle", {
8
8
  enumerable: true,
9
- get: function () { return chunkNWQP6PZQ_cjs.analyzeBundle; }
9
+ get: function () { return chunkT7NCLSYN_cjs.analyzeBundle; }
10
10
  });
11
11
  //# sourceMappingURL=analyze.cjs.map
12
12
  //# sourceMappingURL=analyze.cjs.map
@@ -1,3 +1,3 @@
1
- export { analyzeBundle } from '../chunk-4NPMVODD.js';
1
+ export { analyzeBundle } from '../chunk-HWSYWSD7.js';
2
2
  //# sourceMappingURL=analyze.js.map
3
3
  //# sourceMappingURL=analyze.js.map
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkHVKR4FT2_cjs = require('../chunk-HVKR4FT2.cjs');
3
+ var chunk7EPD2XJR_cjs = require('../chunk-7EPD2XJR.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "createBundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkHVKR4FT2_cjs.createBundler; }
9
+ get: function () { return chunk7EPD2XJR_cjs.createBundler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getInputOptions", {
12
12
  enumerable: true,
13
- get: function () { return chunkHVKR4FT2_cjs.getInputOptions; }
13
+ get: function () { return chunk7EPD2XJR_cjs.getInputOptions; }
14
14
  });
15
15
  //# sourceMappingURL=bundler.cjs.map
16
16
  //# sourceMappingURL=bundler.cjs.map
@@ -1,3 +1,3 @@
1
- export { createBundler, getInputOptions } from '../chunk-2ZPRZMBN.js';
1
+ export { createBundler, getInputOptions } from '../chunk-NGQZZ54Y.js';
2
2
  //# sourceMappingURL=bundler.js.map
3
3
  //# sourceMappingURL=bundler.js.map
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkZ53UZLS3_cjs = require('../chunk-Z53UZLS3.cjs');
4
- var chunkHVKR4FT2_cjs = require('../chunk-HVKR4FT2.cjs');
5
- var chunkNWQP6PZQ_cjs = require('../chunk-NWQP6PZQ.cjs');
3
+ var chunkGU4OME5Q_cjs = require('../chunk-GU4OME5Q.cjs');
4
+ var chunk7EPD2XJR_cjs = require('../chunk-7EPD2XJR.cjs');
5
+ var chunkT7NCLSYN_cjs = require('../chunk-T7NCLSYN.cjs');
6
6
  var chunkJVBCN3RH_cjs = require('../chunk-JVBCN3RH.cjs');
7
7
  var chunk5TYVF4KJ_cjs = require('../chunk-5TYVF4KJ.cjs');
8
8
 
@@ -10,31 +10,31 @@ var chunk5TYVF4KJ_cjs = require('../chunk-5TYVF4KJ.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "createWatcher", {
12
12
  enumerable: true,
13
- get: function () { return chunkZ53UZLS3_cjs.createWatcher; }
13
+ get: function () { return chunkGU4OME5Q_cjs.createWatcher; }
14
14
  });
15
15
  Object.defineProperty(exports, "getServerOptions", {
16
16
  enumerable: true,
17
- get: function () { return chunkZ53UZLS3_cjs.getServerOptions; }
17
+ get: function () { return chunkGU4OME5Q_cjs.getServerOptions; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWatcherInputOptions", {
20
20
  enumerable: true,
21
- get: function () { return chunkZ53UZLS3_cjs.getInputOptions; }
21
+ get: function () { return chunkGU4OME5Q_cjs.getInputOptions; }
22
22
  });
23
23
  Object.defineProperty(exports, "createBundler", {
24
24
  enumerable: true,
25
- get: function () { return chunkHVKR4FT2_cjs.createBundler; }
25
+ get: function () { return chunk7EPD2XJR_cjs.createBundler; }
26
26
  });
27
27
  Object.defineProperty(exports, "getBundlerInputOptions", {
28
28
  enumerable: true,
29
- get: function () { return chunkHVKR4FT2_cjs.getInputOptions; }
29
+ get: function () { return chunk7EPD2XJR_cjs.getInputOptions; }
30
30
  });
31
31
  Object.defineProperty(exports, "analyzeBundle", {
32
32
  enumerable: true,
33
- get: function () { return chunkNWQP6PZQ_cjs.analyzeBundle; }
33
+ get: function () { return chunkT7NCLSYN_cjs.analyzeBundle; }
34
34
  });
35
35
  Object.defineProperty(exports, "getBundlerOptions", {
36
36
  enumerable: true,
37
- get: function () { return chunkNWQP6PZQ_cjs.getBundlerOptions; }
37
+ get: function () { return chunkT7NCLSYN_cjs.getBundlerOptions; }
38
38
  });
39
39
  Object.defineProperty(exports, "Deps", {
40
40
  enumerable: true,
@@ -1,6 +1,6 @@
1
- export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-UKP4KHBS.js';
2
- export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-2ZPRZMBN.js';
3
- export { analyzeBundle, getBundlerOptions } from '../chunk-4NPMVODD.js';
1
+ export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-5FPJTHRK.js';
2
+ export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-NGQZZ54Y.js';
3
+ export { analyzeBundle, getBundlerOptions } from '../chunk-HWSYWSD7.js';
4
4
  export { Deps, FileService } from '../chunk-DPDWM7HQ.js';
5
5
  export { detectRuntime, normalizeStudioBase } from '../chunk-QAOUDKHK.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -8,7 +8,7 @@ export type PluginOptions = Omit<RegisterOptions, 'loggerID'> & {
8
8
  * Exported for testing purposes.
9
9
  *
10
10
  * @param tsConfigPath - Path to the tsconfig.json file
11
- * @returns true if the tsconfig has paths configured, false otherwise
11
+ * @returns true if the tsconfig has paths configured or extends another config, false otherwise
12
12
  */
13
13
  export declare function hasPaths(tsConfigPath: string): boolean;
14
14
  export declare function tsConfigPaths({ tsConfigPath, respectCoreModule, localResolve }?: PluginOptions): Plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/tsconfig-paths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAQtD;AAED,wBAAgB,aAAa,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAE,aAAkB,GAAG,MAAM,CAiK3G"}
1
+ {"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/tsconfig-paths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAYtD;AAED,wBAAgB,aAAa,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAE,aAAkB,GAAG,MAAM,CAiK3G"}
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkSBGBJ7NB_cjs = require('../chunk-SBGBJ7NB.cjs');
3
+ var chunkVOI3B5MX_cjs = require('../chunk-VOI3B5MX.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkSBGBJ7NB_cjs.Bundler; }
9
+ get: function () { return chunkVOI3B5MX_cjs.Bundler; }
10
10
  });
11
11
  Object.defineProperty(exports, "IS_DEFAULT", {
12
12
  enumerable: true,
13
- get: function () { return chunkSBGBJ7NB_cjs.IS_DEFAULT; }
13
+ get: function () { return chunkVOI3B5MX_cjs.IS_DEFAULT; }
14
14
  });
15
15
  //# sourceMappingURL=index.cjs.map
16
16
  //# sourceMappingURL=index.cjs.map
@@ -1,3 +1,3 @@
1
- export { Bundler, IS_DEFAULT } from '../chunk-NGWTN4SJ.js';
1
+ export { Bundler, IS_DEFAULT } from '../chunk-SD6NHZ2H.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { getInputOptions, nodeModulesExtensionResolver } from './chunk-2ZPRZMBN.js';
2
- import { getWorkspaceInformation, analyzeBundle, tsConfigPaths, aliasHono, extractMastraOption } from './chunk-4NPMVODD.js';
1
+ import { getInputOptions, nodeModulesExtensionResolver } from './chunk-NGQZZ54Y.js';
2
+ import { getWorkspaceInformation, analyzeBundle, tsConfigPaths, aliasHono, extractMastraOption } from './chunk-HWSYWSD7.js';
3
3
  import { slash, getPackageName } from './chunk-QAOUDKHK.js';
4
4
  import { watch } from 'rollup';
5
5
  import { dirname, posix } from 'path';
@@ -84,5 +84,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
84
84
  }
85
85
 
86
86
  export { createWatcher, getInputOptions2 as getInputOptions, getServerOptions };
87
- //# sourceMappingURL=chunk-UKP4KHBS.js.map
88
- //# sourceMappingURL=chunk-UKP4KHBS.js.map
87
+ //# sourceMappingURL=chunk-5FPJTHRK.js.map
88
+ //# sourceMappingURL=chunk-5FPJTHRK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions"],"mappings":";;;;;;;;AAaA,eAAsBA,gBAAAA,CACpB,WACA,QAAA,EACA,GAAA,EACA,EAAE,SAAA,GAAY,KAAA,EAAM,GAA6B,EAAC,EAClD;AACA,EAAA,MAAM,iBAAqB,GAAA,CAAA,EAAA,CAAG,EAAE,KAAK,OAAA,CAAQ,SAAS,GAAG,CAAA;AACzD,EAAA,MAAM,WAAA,GAAc,cAAA,GAAiB,OAAA,CAAQ,KAAA,CAAM,cAAc,CAAC,CAAA,GAAI,KAAA,CAAM,OAAA,CAAQ,GAAA,EAAK,CAAA;AACzF,EAAA,MAAM,EAAE,cAAc,aAAA,EAAc,GAAI,MAAM,uBAAA,CAAwB,EAAE,eAAA,EAAiB,SAAA,EAAW,CAAA;AAEpG,EAAA,MAAM,qBAAqB,MAAM,aAAA;AAAA,IAC/B,CAAC,SAAS,CAAA;AAAA,IACV,SAAA;AAAA,IACA;AAAA,MACE,WAAW,KAAA,CAAM,IAAA,CAAK,QAAQ,GAAA,EAAI,EAAG,WAAW,QAAQ,CAAA;AAAA,MACxD,WAAA,EAAa,aAAA,IAAiB,OAAA,CAAQ,GAAA,EAAI;AAAA,MAC1C,QAAA;AAAA,MACA,KAAA,EAAO;AAAA,KACT;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,IAAA,uBAA2B,GAAA,EAAI;AACrC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,QAAQ,KAAK,kBAAA,CAAmB,YAAA,CAAa,SAAQ,EAAG;AACvE,IAAA,MAAM,OAAA,GAAU,eAAe,GAAG,CAA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B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACpFA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAM,mBAAA,CAAoB,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAC/E,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-UKP4KHBS.js","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
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,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAM,mBAAA,CAAoB,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAC/E,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-5FPJTHRK.js","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNWQP6PZQ_cjs = require('./chunk-NWQP6PZQ.cjs');
3
+ var chunkT7NCLSYN_cjs = require('./chunk-T7NCLSYN.cjs');
4
4
  var chunk5TYVF4KJ_cjs = require('./chunk-5TYVF4KJ.cjs');
5
5
  var alias = require('@rollup/plugin-alias');
6
6
  var commonjs = require('@rollup/plugin-commonjs');
@@ -20,7 +20,7 @@ var json__default = /*#__PURE__*/_interopDefault(json);
20
20
  var nodeResolve2__default = /*#__PURE__*/_interopDefault(nodeResolve2);
21
21
 
22
22
  async function getPackageJSON(pkgName, importer) {
23
- const pkgRoot = await chunkNWQP6PZQ_cjs.getPackageRootPath(pkgName, importer);
23
+ const pkgRoot = await chunkT7NCLSYN_cjs.getPackageRootPath(pkgName, importer);
24
24
  if (!pkgRoot) {
25
25
  throw new Error(`Package ${pkgName} not found`);
26
26
  }
@@ -49,7 +49,7 @@ function nodeModulesExtensionResolver() {
49
49
  if (!!packageJSON.exports) {
50
50
  return null;
51
51
  }
52
- const packageRoot = await chunkNWQP6PZQ_cjs.getPackageRootPath(pkgName, importer);
52
+ const packageRoot = await chunkT7NCLSYN_cjs.getPackageRootPath(pkgName, importer);
53
53
  const nodeResolved = await nodeResolvePlugin.resolveId?.handler?.call(this, id, importer, options);
54
54
  if (!nodeResolved?.id) {
55
55
  return null;
@@ -96,7 +96,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
96
96
  preserveSymlinks: true,
97
97
  external: externals,
98
98
  plugins: [
99
- chunkNWQP6PZQ_cjs.subpathExternalsResolver(externals),
99
+ chunkT7NCLSYN_cjs.subpathExternalsResolver(externals),
100
100
  {
101
101
  name: "alias-optimized-deps",
102
102
  resolveId(id) {
@@ -137,7 +137,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
137
137
  { find: /^\#mastra$/, replacement: normalizedEntryFile }
138
138
  ]
139
139
  }),
140
- chunkNWQP6PZQ_cjs.tsConfigPaths(),
140
+ chunkT7NCLSYN_cjs.tsConfigPaths(),
141
141
  {
142
142
  name: "tools-rewriter",
143
143
  resolveId(id) {
@@ -149,7 +149,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
149
149
  }
150
150
  }
151
151
  },
152
- chunkNWQP6PZQ_cjs.esbuild({
152
+ chunkT7NCLSYN_cjs.esbuild({
153
153
  platform,
154
154
  define: env
155
155
  }),
@@ -163,7 +163,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
163
163
  return externals.includes(id);
164
164
  }
165
165
  }),
166
- enableEsmShim ? chunkNWQP6PZQ_cjs.esmShim() : void 0,
166
+ enableEsmShim ? chunkT7NCLSYN_cjs.esmShim() : void 0,
167
167
  externalsPreset ? nodeModulesExtensionResolver() : nodeResolvePlugin,
168
168
  // for debugging
169
169
  // {
@@ -180,9 +180,9 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
180
180
  // },
181
181
  // },
182
182
  json__default.default(),
183
- chunkNWQP6PZQ_cjs.removeDeployer(entryFile, { sourcemap }),
183
+ chunkT7NCLSYN_cjs.removeDeployer(entryFile, { sourcemap }),
184
184
  // treeshake unused imports
185
- chunkNWQP6PZQ_cjs.esbuild({
185
+ chunkT7NCLSYN_cjs.esbuild({
186
186
  include: entryFile,
187
187
  platform
188
188
  })
@@ -209,5 +209,5 @@ async function createBundler(inputOptions, outputOptions) {
209
209
  exports.createBundler = createBundler;
210
210
  exports.getInputOptions = getInputOptions;
211
211
  exports.nodeModulesExtensionResolver = nodeModulesExtensionResolver;
212
- //# sourceMappingURL=chunk-HVKR4FT2.cjs.map
213
- //# sourceMappingURL=chunk-HVKR4FT2.cjs.map
212
+ //# sourceMappingURL=chunk-7EPD2XJR.cjs.map
213
+ //# sourceMappingURL=chunk-7EPD2XJR.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/bundler.ts"],"names":["getPackageRootPath","readFile","join","nodeResolve","isBuiltinModule","isAbsolute","getPackageName","slash","subpathExternalsResolver","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,eAAe,cAAA,CAAe,SAAiB,QAA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B,IAAA;AAAA,QACzB,aAAa,EAAA,EAAI;AACf,UAAA,OAAO,SAAA,CAAU,SAAS,EAAE,CAAA;AAAA,QAC9B;AAAA,OACD,CAAA;AAAA,MACL,aAAA,GAAgBC,2BAAQ,GAAI,MAAA;AAAA,MAC5B,eAAA,GAAkB,8BAA6B,GAAI,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAenDC,qBAAA,EAAK;AAAA,MACLC,gCAAA,CAAe,SAAA,EAAW,EAAE,SAAA,EAAW,CAAA;AAAA;AAAA,MAEvCL,yBAAA,CAAQ;AAAA,QACN,OAAA,EAAS,SAAA;AAAA,QACT;AAAA,OACD;AAAA,KACH,CAAE,OAAO,OAAO;AAAA,GAClB;AACF;AAEA,eAAsB,aAAA,CACpB,cACA,aAAA,EACA;AACA,EAAA,MAAM,OAAA,GAAU,MAAMM,aAAA,CAAO,YAAY,CAAA;AAEzC,EAAA,OAAO;AAAA,IACL,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,CAAM;AAAA,QACnB,GAAG,aAAA;AAAA,QACH,MAAA,EAAQ,KAAA;AAAA,QACR,cAAA,EAAgB,YAAA;AAAA,QAChB,cAAA,EAAgB;AAAA,OACjB,CAAA;AAAA,IACH,CAAA;AAAA,IACA,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,EAAM;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-HVKR4FT2.cjs","sourcesContent":["import { join, isAbsolute } from 'node:path';\nimport { readFile } from 'node:fs/promises';\nimport type { Plugin } from 'rollup';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { getPackageName, isBuiltinModule } from '../utils';\nimport { getPackageRootPath } from '../package-info';\nimport type { PackageJson } from 'type-fest';\n\n/**\n * Check if a package has an exports field in its package.json.\n * Results are cached to avoid repeated filesystem reads.\n */\nasync function getPackageJSON(pkgName: string, importer: string): Promise<PackageJson> {\n const pkgRoot = await getPackageRootPath(pkgName, importer);\n if (!pkgRoot) {\n throw new Error(`Package ${pkgName} not found`);\n }\n\n const pkgJSON = JSON.parse(await readFile(join(pkgRoot, 'package.json'), 'utf-8')) as PackageJson;\n return pkgJSON;\n}\n\n/**\n * Rollup plugin that resolves module extensions for external dependencies.\n *\n * This plugin handles ESM compatibility for external imports when node-resolve is not used:\n * - Packages WITH exports field (e.g., hono, date-fns): Keep imports as-is or strip redundant extensions\n * - Packages WITHOUT exports field (e.g., lodash): Add .js extension for direct file imports\n */\nexport function nodeModulesExtensionResolver(): Plugin {\n // Create a single instance of node-resolve to reuse\n const nodeResolvePlugin = nodeResolve();\n\n return {\n name: 'node-modules-extension-resolver',\n async resolveId(id, importer, options) {\n // Skip relative imports, absolute paths, no importer, or builtin modules\n if (!importer || id.startsWith('.') || id.startsWith('/') || isBuiltinModule(id) || isAbsolute(id)) {\n return null;\n }\n\n // Skip direct package imports (e.g., 'lodash', '@mastra/core')\n const parts = id.split('/');\n const isScoped = id.startsWith('@');\n if ((isScoped && parts.length === 2) || (!isScoped && parts.length === 1)) {\n return null;\n }\n\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n try {\n const packageJSON = await getPackageJSON(pkgName, importer);\n // if it has exports, node should be able to rsolve it, if not the exports map is wrong.\n if (!!packageJSON.exports) {\n return null;\n }\n\n const packageRoot = await getPackageRootPath(pkgName, importer);\n // @ts-expect-error - handle is part of resolveId signature\n const nodeResolved = await nodeResolvePlugin.resolveId?.handler?.call(this, id, importer, options);\n // if we cannot resolve it, it's not a valid import so we let node handle it\n if (!nodeResolved?.id) {\n return null;\n }\n\n let filePath = nodeResolved.id;\n if (nodeResolved.resolvedBy === 'commonjs--resolver') {\n filePath = filePath.substring(1).split('?')[0];\n }\n\n const resolvedImportPath = filePath.replace(packageRoot, pkgName);\n\n return {\n id: resolvedImportPath,\n external: true,\n };\n } catch (err) {\n console.error(err);\n return null;\n }\n },\n };\n}\n","import alias from '@rollup/plugin-alias';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { esmShim } from './plugins/esm-shim';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { rollup, type InputOptions, type OutputOptions, type Plugin } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport { analyzeBundle } from './analyze';\nimport { removeAllOptionsFromMastraExceptPlugin } from './plugins/remove-all-except';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash, type BundlerPlatform } from './utils';\nimport { subpathExternalsResolver } from './plugins/subpath-externals-resolver';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { removeDeployer } from './plugins/remove-deployer';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: BundlerPlatform,\n env: Record<string, string> = { 'process.env.NODE_ENV': JSON.stringify('production') },\n {\n sourcemap = false,\n isDev = false,\n projectRoot,\n workspaceRoot = undefined,\n enableEsmShim = true,\n externalsPreset = false,\n }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n externalsPreset?: boolean;\n },\n): Promise<InputOptions> {\n // For 'neutral' platform (Bun), use similar settings to 'node' for module resolution\n let nodeResolvePlugin =\n platform === 'node' || platform === 'neutral'\n ? nodeResolve({\n preferBuiltins: true,\n exportConditions: ['node'],\n })\n : nodeResolve({\n preferBuiltins: false,\n browser: true,\n });\n\n const externalsCopy = new Set<string>(analyzedBundleInfo.externalDependencies);\n const externals = externalsPreset ? [] : Array.from(externalsCopy);\n\n const normalizedEntryFile = slash(entryFile);\n return {\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n treeshake: 'smallest',\n preserveSymlinks: true,\n external: externals,\n plugins: [\n subpathExternalsResolver(externals),\n {\n name: 'alias-optimized-deps',\n resolveId(id: string) {\n if (!analyzedBundleInfo.dependencies.has(id)) {\n return null;\n }\n\n const filename = analyzedBundleInfo.dependencies.get(id)!;\n const absolutePath = join(workspaceRoot || projectRoot, filename);\n\n // During `mastra dev` we want to keep deps as external\n if (isDev) {\n return {\n id: process.platform === 'win32' ? pathToFileURL(absolutePath).href : absolutePath,\n external: true,\n };\n }\n\n // For production builds return the absolute path as-is so Rollup can handle itself\n return {\n id: absolutePath,\n external: false,\n };\n },\n } satisfies Plugin,\n alias({\n entries: [\n {\n find: /^\\#server$/,\n replacement: slash(fileURLToPath(import.meta.resolve('@mastra/deployer/server'))),\n },\n {\n find: /^\\@mastra\\/server\\/(.*)/,\n replacement: `@mastra/server/$1`,\n customResolver: id => {\n if (id.startsWith('@mastra/server')) {\n return {\n id: fileURLToPath(import.meta.resolve(id)),\n };\n }\n },\n },\n { find: /^\\#mastra$/, replacement: normalizedEntryFile },\n ],\n }),\n tsConfigPaths(),\n {\n name: 'tools-rewriter',\n resolveId(id: string) {\n if (id === '#tools') {\n return {\n id: './tools.mjs',\n external: true,\n };\n }\n },\n } satisfies Plugin,\n esbuild({\n platform,\n define: env,\n }),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n externalsPreset\n ? null\n : commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n externalsPreset ? nodeModulesExtensionResolver() : nodeResolvePlugin,\n // for debugging\n // {\n // name: 'logger',\n // //@ts-ignore\n // resolveId(id, ...args) {\n // console.log({ id, args });\n // },\n // // @ts-ignore\n // transform(code, id) {\n // if (code.includes('class Duplexify ')) {\n // console.log({ duplex: id });\n // }\n // },\n // },\n json(),\n removeDeployer(entryFile, { sourcemap }),\n // treeshake unused imports\n esbuild({\n include: entryFile,\n platform,\n }),\n ].filter(Boolean),\n } satisfies InputOptions;\n}\n\nexport async function createBundler(\n inputOptions: InputOptions,\n outputOptions: Partial<OutputOptions> & { dir: string },\n) {\n const bundler = await rollup(inputOptions);\n\n return {\n write: () => {\n return bundler.write({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n });\n },\n close: () => {\n return bundler.close();\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/bundler.ts"],"names":["getPackageRootPath","readFile","join","nodeResolve","isBuiltinModule","isAbsolute","getPackageName","slash","subpathExternalsResolver","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,eAAe,cAAA,CAAe,SAAiB,QAAA,EAAwC;AACrF,EAAA,MAAM,OAAA,GAAU,MAAMA,oCAAA,CAAmB,OAAA,EAAS,QAAQ,CAAA;AAC1D,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,QAAA,EAAW,OAAO,CAAA,UAAA,CAAY,CAAA;AAAA,EAChD;AAEA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,MAAMC,iBAAA,CAASC,UAAK,OAAA,EAAS,cAAc,CAAA,EAAG,OAAO,CAAC,CAAA;AACjF,EAAA,OAAO,OAAA;AACT;AASO,SAAS,4BAAA,GAAuC;AAErD,EAAA,MAAM,oBAAoBC,6BAAA,EAAY;AAEtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,iCAAA;AAAA,IACN,MAAM,SAAA,CAAU,EAAA,EAAI,QAAA,EAAU,OAAA,EAAS;AAErC,MAAA,IAAI,CAAC,QAAA,IAAY,EAAA,CAAG,UAAA,CAAW,GAAG,CAAA,IAAK,EAAA,CAAG,UAAA,CAAW,GAAG,KAAKC,iCAAA,CAAgB,EAAE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AAA,QACnB,GAAG,aAAA;AAAA,QACH,MAAA,EAAQ,KAAA;AAAA,QACR,cAAA,EAAgB,YAAA;AAAA,QAChB,cAAA,EAAgB;AAAA,OACjB,CAAA;AAAA,IACH,CAAA;AAAA,IACA,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,EAAM;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-7EPD2XJR.cjs","sourcesContent":["import { join, isAbsolute } from 'node:path';\nimport { readFile } from 'node:fs/promises';\nimport type { Plugin } from 'rollup';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { getPackageName, isBuiltinModule } from '../utils';\nimport { getPackageRootPath } from '../package-info';\nimport type { PackageJson } from 'type-fest';\n\n/**\n * Check if a package has an exports field in its package.json.\n * Results are cached to avoid repeated filesystem reads.\n */\nasync function getPackageJSON(pkgName: string, importer: string): Promise<PackageJson> {\n const pkgRoot = await getPackageRootPath(pkgName, importer);\n if (!pkgRoot) {\n throw new Error(`Package ${pkgName} not found`);\n }\n\n const pkgJSON = JSON.parse(await readFile(join(pkgRoot, 'package.json'), 'utf-8')) as PackageJson;\n return pkgJSON;\n}\n\n/**\n * Rollup plugin that resolves module extensions for external dependencies.\n *\n * This plugin handles ESM compatibility for external imports when node-resolve is not used:\n * - Packages WITH exports field (e.g., hono, date-fns): Keep imports as-is or strip redundant extensions\n * - Packages WITHOUT exports field (e.g., lodash): Add .js extension for direct file imports\n */\nexport function nodeModulesExtensionResolver(): Plugin {\n // Create a single instance of node-resolve to reuse\n const nodeResolvePlugin = nodeResolve();\n\n return {\n name: 'node-modules-extension-resolver',\n async resolveId(id, importer, options) {\n // Skip relative imports, absolute paths, no importer, or builtin modules\n if (!importer || id.startsWith('.') || id.startsWith('/') || isBuiltinModule(id) || isAbsolute(id)) {\n return null;\n }\n\n // Skip direct package imports (e.g., 'lodash', '@mastra/core')\n const parts = id.split('/');\n const isScoped = id.startsWith('@');\n if ((isScoped && parts.length === 2) || (!isScoped && parts.length === 1)) {\n return null;\n }\n\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n try {\n const packageJSON = await getPackageJSON(pkgName, importer);\n // if it has exports, node should be able to rsolve it, if not the exports map is wrong.\n if (!!packageJSON.exports) {\n return null;\n }\n\n const packageRoot = await getPackageRootPath(pkgName, importer);\n // @ts-expect-error - handle is part of resolveId signature\n const nodeResolved = await nodeResolvePlugin.resolveId?.handler?.call(this, id, importer, options);\n // if we cannot resolve it, it's not a valid import so we let node handle it\n if (!nodeResolved?.id) {\n return null;\n }\n\n let filePath = nodeResolved.id;\n if (nodeResolved.resolvedBy === 'commonjs--resolver') {\n filePath = filePath.substring(1).split('?')[0];\n }\n\n const resolvedImportPath = filePath.replace(packageRoot, pkgName);\n\n return {\n id: resolvedImportPath,\n external: true,\n };\n } catch (err) {\n console.error(err);\n return null;\n }\n },\n };\n}\n","import alias from '@rollup/plugin-alias';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport { esmShim } from './plugins/esm-shim';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { rollup, type InputOptions, type OutputOptions, type Plugin } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport { analyzeBundle } from './analyze';\nimport { removeAllOptionsFromMastraExceptPlugin } from './plugins/remove-all-except';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash, type BundlerPlatform } from './utils';\nimport { subpathExternalsResolver } from './plugins/subpath-externals-resolver';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { removeDeployer } from './plugins/remove-deployer';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: BundlerPlatform,\n env: Record<string, string> = { 'process.env.NODE_ENV': JSON.stringify('production') },\n {\n sourcemap = false,\n isDev = false,\n projectRoot,\n workspaceRoot = undefined,\n enableEsmShim = true,\n externalsPreset = false,\n }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n externalsPreset?: boolean;\n },\n): Promise<InputOptions> {\n // For 'neutral' platform (Bun), use similar settings to 'node' for module resolution\n let nodeResolvePlugin =\n platform === 'node' || platform === 'neutral'\n ? nodeResolve({\n preferBuiltins: true,\n exportConditions: ['node'],\n })\n : nodeResolve({\n preferBuiltins: false,\n browser: true,\n });\n\n const externalsCopy = new Set<string>(analyzedBundleInfo.externalDependencies);\n const externals = externalsPreset ? [] : Array.from(externalsCopy);\n\n const normalizedEntryFile = slash(entryFile);\n return {\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n treeshake: 'smallest',\n preserveSymlinks: true,\n external: externals,\n plugins: [\n subpathExternalsResolver(externals),\n {\n name: 'alias-optimized-deps',\n resolveId(id: string) {\n if (!analyzedBundleInfo.dependencies.has(id)) {\n return null;\n }\n\n const filename = analyzedBundleInfo.dependencies.get(id)!;\n const absolutePath = join(workspaceRoot || projectRoot, filename);\n\n // During `mastra dev` we want to keep deps as external\n if (isDev) {\n return {\n id: process.platform === 'win32' ? pathToFileURL(absolutePath).href : absolutePath,\n external: true,\n };\n }\n\n // For production builds return the absolute path as-is so Rollup can handle itself\n return {\n id: absolutePath,\n external: false,\n };\n },\n } satisfies Plugin,\n alias({\n entries: [\n {\n find: /^\\#server$/,\n replacement: slash(fileURLToPath(import.meta.resolve('@mastra/deployer/server'))),\n },\n {\n find: /^\\@mastra\\/server\\/(.*)/,\n replacement: `@mastra/server/$1`,\n customResolver: id => {\n if (id.startsWith('@mastra/server')) {\n return {\n id: fileURLToPath(import.meta.resolve(id)),\n };\n }\n },\n },\n { find: /^\\#mastra$/, replacement: normalizedEntryFile },\n ],\n }),\n tsConfigPaths(),\n {\n name: 'tools-rewriter',\n resolveId(id: string) {\n if (id === '#tools') {\n return {\n id: './tools.mjs',\n external: true,\n };\n }\n },\n } satisfies Plugin,\n esbuild({\n platform,\n define: env,\n }),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n externalsPreset\n ? null\n : commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n externalsPreset ? nodeModulesExtensionResolver() : nodeResolvePlugin,\n // for debugging\n // {\n // name: 'logger',\n // //@ts-ignore\n // resolveId(id, ...args) {\n // console.log({ id, args });\n // },\n // // @ts-ignore\n // transform(code, id) {\n // if (code.includes('class Duplexify ')) {\n // console.log({ duplex: id });\n // }\n // },\n // },\n json(),\n removeDeployer(entryFile, { sourcemap }),\n // treeshake unused imports\n esbuild({\n include: entryFile,\n platform,\n }),\n ].filter(Boolean),\n } satisfies InputOptions;\n}\n\nexport async function createBundler(\n inputOptions: InputOptions,\n outputOptions: Partial<OutputOptions> & { dir: string },\n) {\n const bundler = await rollup(inputOptions);\n\n return {\n write: () => {\n return bundler.write({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n });\n },\n close: () => {\n return bundler.close();\n },\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkHVKR4FT2_cjs = require('./chunk-HVKR4FT2.cjs');
4
- var chunkNWQP6PZQ_cjs = require('./chunk-NWQP6PZQ.cjs');
3
+ var chunk7EPD2XJR_cjs = require('./chunk-7EPD2XJR.cjs');
4
+ var chunkT7NCLSYN_cjs = require('./chunk-T7NCLSYN.cjs');
5
5
  var chunk5TYVF4KJ_cjs = require('./chunk-5TYVF4KJ.cjs');
6
6
  var rollup = require('rollup');
7
7
  var path = require('path');
@@ -31,8 +31,8 @@ var pkg__namespace = /*#__PURE__*/_interopNamespace(pkg);
31
31
  async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
32
32
  const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(entryFile) });
33
33
  const projectRoot = closestPkgJson ? path.dirname(chunk5TYVF4KJ_cjs.slash(closestPkgJson)) : chunk5TYVF4KJ_cjs.slash(process.cwd());
34
- const { workspaceMap, workspaceRoot } = await chunkNWQP6PZQ_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
35
- const analyzeEntryResult = await chunkNWQP6PZQ_cjs.analyzeBundle(
34
+ const { workspaceMap, workspaceRoot } = await chunkT7NCLSYN_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
35
+ const analyzeEntryResult = await chunkT7NCLSYN_cjs.analyzeBundle(
36
36
  [entryFile],
37
37
  entryFile,
38
38
  {
@@ -50,7 +50,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
50
50
  deps.set(dep, metadata);
51
51
  }
52
52
  }
53
- const inputOptions = await chunkHVKR4FT2_cjs.getInputOptions(
53
+ const inputOptions = await chunk7EPD2XJR_cjs.getInputOptions(
54
54
  entryFile,
55
55
  {
56
56
  dependencies: deps,
@@ -69,7 +69,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
69
69
  }
70
70
  if (plugin?.name === "tsconfig-paths") {
71
71
  plugins.push(
72
- chunkNWQP6PZQ_cjs.tsConfigPaths({
72
+ chunkT7NCLSYN_cjs.tsConfigPaths({
73
73
  localResolve: true
74
74
  })
75
75
  );
@@ -78,8 +78,8 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
78
78
  plugins.push(plugin);
79
79
  });
80
80
  inputOptions.plugins = plugins;
81
- inputOptions.plugins.push(chunkNWQP6PZQ_cjs.aliasHono());
82
- inputOptions.plugins.push(chunkHVKR4FT2_cjs.nodeModulesExtensionResolver());
81
+ inputOptions.plugins.push(chunkT7NCLSYN_cjs.aliasHono());
82
+ inputOptions.plugins.push(chunk7EPD2XJR_cjs.nodeModulesExtensionResolver());
83
83
  }
84
84
  return inputOptions;
85
85
  }
@@ -98,7 +98,7 @@ async function createWatcher(inputOptions, outputOptions) {
98
98
 
99
99
  // src/build/serverOptions.ts
100
100
  async function getServerOptions(entryFile, outputDir, logger) {
101
- const result = await chunkNWQP6PZQ_cjs.extractMastraOption("server", entryFile, outputDir, logger);
101
+ const result = await chunkT7NCLSYN_cjs.extractMastraOption("server", entryFile, outputDir, logger);
102
102
  if (!result) {
103
103
  return null;
104
104
  }
@@ -108,5 +108,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
108
108
  exports.createWatcher = createWatcher;
109
109
  exports.getInputOptions = getInputOptions2;
110
110
  exports.getServerOptions = getServerOptions;
111
- //# sourceMappingURL=chunk-Z53UZLS3.cjs.map
112
- //# sourceMappingURL=chunk-Z53UZLS3.cjs.map
111
+ //# sourceMappingURL=chunk-GU4OME5Q.cjs.map
112
+ //# sourceMappingURL=chunk-GU4OME5Q.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions","pkg","dirname","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","getPackageName","tsConfigPaths","aliasHono","nodeModulesExtensionResolver","watch","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,eAAsBA,gBAAAA,CACpB,WACA,QAAA,EACA,GAAA,EACA,EAAE,SAAA,GAAY,KAAA,EAAM,GAA6B,EAAC,EAClD;AACA,EAAA,MAAM,iBAAqBC,cAAA,CAAA,EAAA,CAAG,EAAE,KAAKC,YAAA,CAAQ,SAAS,GAAG,CAAA;AACzD,EAAA,MAAM,WAAA,GAAc,cAAA,GAAiBA,YAAA,CAAQC,uBAAA,CAAM,cAAc,CAAC,CAAA,GAAIA,uBAAA,CAAM,OAAA,CAAQ,GAAA,EAAK,CAAA;AACzF,EAAA,MAAM,EAAE,cAAc,aAAA,EAAc,GAAI,MAAMC,yCAAA,CAAwB,EAAE,eAAA,EAAiB,SAAA,EAAW,CAAA;AAEpG,EAAA,MAAM,qB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,IAAA;AAAA,UACNS,+BAAA,CAAc;AAAA,YACZ,YAAA,EAAc;AAAA,WACf;AAAA,SACH;AACA,QAAA;AAAA,MACF;AAEA,MAAA,OAAA,CAAQ,KAAK,MAAgB,CAAA;AAAA,IAC/B,CAAC,CAAA;AAED,IAAA,YAAA,CAAa,OAAA,GAAU,OAAA;AACvB,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAKC,2BAAA,EAAW,CAAA;AAErC,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAKC,8CAAA,EAA8B,CAAA;AAAA,EAC1D;AAEA,EAAA,OAAO,YAAA;AACT;AAEA,eAAsB,aAAA,CAAc,cAA4B,aAAA,EAA8B;AAC5F,EAAA,MAAM,OAAA,GAAU,MAAMC,YAAA,CAAM;AAAA,IAC1B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACpFA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAMC,qCAAA,CAAoB,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAC/E,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-Z53UZLS3.cjs","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
1
+ {"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions","pkg","dirname","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","getPackageName","tsConfigPaths","aliasHono","nodeModulesExtensionResolver","watch","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,eAAsBA,gBAAAA,CACpB,WACA,QAAA,EACA,GAAA,EACA,EAAE,SAAA,GAAY,KAAA,EAAM,GAA6B,EAAC,EAClD;AACA,EAAA,MAAM,iBAAqBC,cAAA,CAAA,EAAA,CAAG,EAAE,KAAKC,YAAA,CAAQ,SAAS,GAAG,CAAA;AACzD,EAAA,MAAM,WAAA,GAAc,cAAA,GAAiBA,YAAA,CAAQC,uBAAA,CAAM,cAAc,CAAC,CAAA,GAAIA,uBAAA,CAAM,OAAA,CAAQ,GAAA,EAAK,CAAA;AACzF,EAAA,MAAM,EAAE,cAAc,aAAA,EAAc,GAAI,MAAMC,yCAAA,CAAwB,EAAE,eAAA,EAAiB,SAAA,EAAW,CAAA;AAEpG,EAAA,MAAM,qBAAqB,MAAMC,+BAAA;AAAA,IAC/B,CAAC,SAAS,CA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AA,EAAc;AAAA,WACf;AAAA,SACH;AACA,QAAA;AAAA,MACF;AAEA,MAAA,OAAA,CAAQ,KAAK,MAAgB,CAAA;AAAA,IAC/B,CAAC,CAAA;AAED,IAAA,YAAA,CAAa,OAAA,GAAU,OAAA;AACvB,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAKC,2BAAA,EAAW,CAAA;AAErC,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAKC,8CAAA,EAA8B,CAAA;AAAA,EAC1D;AAEA,EAAA,OAAO,YAAA;AACT;AAEA,eAAsB,aAAA,CAAc,cAA4B,aAAA,EAA8B;AAC5F,EAAA,MAAM,OAAA,GAAU,MAAMC,YAAA,CAAM;AAAA,IAC1B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACpFA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAMC,qCAAA,CAAoB,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAC/E,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-GU4OME5Q.cjs","sourcesContent":["import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash, type BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform,\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, result);\n}\n\nexport async function getServerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['server'] | null> {\n const result = await extractMastraOption('server', entryFile, outputDir, logger);\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
@@ -122,7 +122,7 @@ function hasPaths(tsConfigPath) {
122
122
  try {
123
123
  const content = fs.readFileSync(tsConfigPath, "utf8");
124
124
  const config = JSON.parse(stripJsonComments(content));
125
- return !!(config.compilerOptions?.paths && Object.keys(config.compilerOptions.paths).length > 0);
125
+ return !!(config.compilerOptions?.paths && Object.keys(config.compilerOptions.paths).length > 0 || typeof config.extends === "string" && config.extends.length > 0 || Array.isArray(config.extends) && config.extends.length > 0);
126
126
  } catch {
127
127
  return false;
128
128
  }
@@ -1770,5 +1770,5 @@ If you think your configuration is valid, please open an issue.`);
1770
1770
  }
1771
1771
 
1772
1772
  export { aliasHono, analyzeBundle, esbuild, esmShim, extractMastraOption, getBundlerOptions, getPackageRootPath, getWorkspaceInformation, removeDeployer2 as removeDeployer, subpathExternalsResolver, tsConfigPaths };
1773
- //# sourceMappingURL=chunk-4NPMVODD.js.map
1774
- //# sourceMappingURL=chunk-4NPMVODD.js.map
1773
+ //# sourceMappingURL=chunk-HWSYWSD7.js.map
1774
+ //# sourceMappingURL=chunk-HWSYWSD7.js.map