@mastra/deployer 1.0.0-beta.14 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/babel/remove-deployer.d.ts.map +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/bundlerOptions.d.ts.map +1 -1
- package/dist/build/deployer.d.ts.map +1 -1
- package/dist/build/index.cjs +10 -10
- package/dist/build/index.js +3 -3
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/plugins/remove-all-except.d.ts +10 -0
- package/dist/build/plugins/remove-all-except.d.ts.map +1 -0
- package/dist/build/serverOptions.d.ts.map +1 -1
- package/dist/build/shared/extract-mastra-option.d.ts +4 -8
- package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-IVKDKRCR.cjs → chunk-7F6JKGX4.cjs} +20 -12
- package/dist/chunk-7F6JKGX4.cjs.map +1 -0
- package/dist/{chunk-HNSVE6YO.js → chunk-BDA7RMRF.js} +191 -171
- package/dist/chunk-BDA7RMRF.js.map +1 -0
- package/dist/{chunk-UJXH5MNH.cjs → chunk-CRIOGWZD.cjs} +190 -171
- package/dist/chunk-CRIOGWZD.cjs.map +1 -0
- package/dist/{chunk-ZXT4NSIV.js → chunk-ESR6AK5N.js} +14 -6
- package/dist/chunk-ESR6AK5N.js.map +1 -0
- package/dist/{chunk-V5W7WIXT.cjs → chunk-HRCR6OKC.cjs} +11 -22
- package/dist/chunk-HRCR6OKC.cjs.map +1 -0
- package/dist/{chunk-C6UFSG3V.js → chunk-ONWHS3PA.js} +34 -79
- package/dist/chunk-ONWHS3PA.js.map +1 -0
- package/dist/{chunk-PB5O2NTZ.cjs → chunk-OVVUJ46G.cjs} +39 -85
- package/dist/chunk-OVVUJ46G.cjs.map +1 -0
- package/dist/{chunk-BFA354MH.js → chunk-WFIG7I5C.js} +5 -16
- package/dist/chunk-WFIG7I5C.js.map +1 -0
- package/dist/index.cjs +4 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -14
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +262 -14
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +260 -12
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/build/babel/get-deployer.d.ts +0 -3
- package/dist/build/babel/get-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-bundler.d.ts +0 -5
- package/dist/build/babel/remove-all-options-bundler.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-deployer.d.ts +0 -5
- package/dist/build/babel/remove-all-options-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-server.d.ts +0 -5
- package/dist/build/babel/remove-all-options-server.d.ts.map +0 -1
- package/dist/chunk-BFA354MH.js.map +0 -1
- package/dist/chunk-C6UFSG3V.js.map +0 -1
- package/dist/chunk-HNSVE6YO.js.map +0 -1
- package/dist/chunk-IVKDKRCR.cjs.map +0 -1
- package/dist/chunk-PB5O2NTZ.cjs.map +0 -1
- package/dist/chunk-UJXH5MNH.cjs.map +0 -1
- package/dist/chunk-V5W7WIXT.cjs.map +0 -1
- package/dist/chunk-ZXT4NSIV.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add --studio flag to bundle playground UI with mastra build ([#11327](https://github.com/mastra-ai/mastra/pull/11327))
|
|
8
|
+
|
|
9
|
+
Enables bundling the studio/playground UI into the build output so it can be served from the deployed server.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mastra build --studio
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- Fixes `mastra build` failing with `BABEL_TRANSFORM_ERROR` when using spread operator in Mastra config. The Babel plugins now correctly skip `SpreadElement` nodes when searching for config properties. ([#11309](https://github.com/mastra-ai/mastra/pull/11309))
|
|
16
|
+
|
|
17
|
+
Also fixes npm package aliases (like `"ai-v5": "npm:ai@5.0.93"`) not being resolved correctly when writing the output package.json - now uses the actual package name from the resolved package.json instead of the alias.
|
|
18
|
+
|
|
19
|
+
- Fixed bundling issues for packages without an `exports` field in their package.json. ([#11310](https://github.com/mastra-ai/mastra/pull/11310))
|
|
20
|
+
|
|
21
|
+
Previously, the deployer could produce incorrect import paths for older npm packages that don't use the modern exports map (like lodash). This caused runtime errors when deploying to production environments.
|
|
22
|
+
|
|
23
|
+
The fix ensures these packages now resolve correctly, while packages with proper exports maps continue to work as expected.
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`33a4d2e`](https://github.com/mastra-ai/mastra/commit/33a4d2e4ed8af51f69256232f00c34d6b6b51d48), [`4aaa844`](https://github.com/mastra-ai/mastra/commit/4aaa844a4f19d054490f43638a990cc57bda8d2f), [`4a1a6cb`](https://github.com/mastra-ai/mastra/commit/4a1a6cb3facad54b2bb6780b00ce91d6de1edc08), [`31d13d5`](https://github.com/mastra-ai/mastra/commit/31d13d5fdc2e2380e2e3ee3ec9fb29d2a00f265d), [`4c62166`](https://github.com/mastra-ai/mastra/commit/4c621669f4a29b1f443eca3ba70b814afa286266), [`7bcbf10`](https://github.com/mastra-ai/mastra/commit/7bcbf10133516e03df964b941f9a34e9e4ab4177), [`4353600`](https://github.com/mastra-ai/mastra/commit/43536005a65988a8eede236f69122e7f5a284ba2), [`6986fb0`](https://github.com/mastra-ai/mastra/commit/6986fb064f5db6ecc24aa655e1d26529087b43b3), [`053e979`](https://github.com/mastra-ai/mastra/commit/053e9793b28e970086b0507f7f3b76ea32c1e838), [`e26dc9c`](https://github.com/mastra-ai/mastra/commit/e26dc9c3ccfec54ae3dc3e2b2589f741f9ae60a6), [`55edf73`](https://github.com/mastra-ai/mastra/commit/55edf7302149d6c964fbb7908b43babfc2b52145), [`27c0009`](https://github.com/mastra-ai/mastra/commit/27c0009777a6073d7631b0eb7b481d94e165b5ca), [`dee388d`](https://github.com/mastra-ai/mastra/commit/dee388dde02f2e63c53385ae69252a47ab6825cc), [`3f3fc30`](https://github.com/mastra-ai/mastra/commit/3f3fc3096f24c4a26cffeecfe73085928f72aa63), [`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`632fdb8`](https://github.com/mastra-ai/mastra/commit/632fdb8b3cd9ff6f90399256d526db439fc1758b), [`10c2735`](https://github.com/mastra-ai/mastra/commit/10c27355edfdad1ee2b826b897df74125eb81fb8), [`1924cf0`](https://github.com/mastra-ai/mastra/commit/1924cf06816e5e4d4d5333065ec0f4bb02a97799), [`b339816`](https://github.com/mastra-ai/mastra/commit/b339816df0984d0243d944ac2655d6ba5f809cde), [`9d57c7e`](https://github.com/mastra-ai/mastra/commit/9d57c7ecc0b095a47d78508c6fc29127a92edeee)]:
|
|
26
|
+
- @mastra/core@1.0.0-beta.15
|
|
27
|
+
- @mastra/server@1.0.0-beta.15
|
|
28
|
+
|
|
3
29
|
## 1.0.0-beta.14
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeEntry.d.ts","sourceRoot":"","sources":["../../../src/build/analyze/analyzeEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKrE,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"analyzeEntry.d.ts","sourceRoot":"","sources":["../../../src/build/analyze/analyzeEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKrE,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAO/E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA8MnD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAChC,EACE,KAAK,EACL,aAAa,GACd,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;CACxB,EACD,WAAW,EAAE,MAAM,EACnB,EACE,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,qBAAiC,EAAE,mCAAmC;AACtE,iCAAyC,GAC1C,EAAE;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxD,iCAAiC,CAAC,EAAE,OAAO,CAAC;CAC7C,GACA,OAAO,CAAC;IACT,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC9C,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;KACvB,CAAC;CACH,CAAC,CAmCD"}
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCRIOGWZD_cjs = require('../chunk-CRIOGWZD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkCRIOGWZD_cjs.analyzeBundle; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=analyze.cjs.map
|
|
12
12
|
//# sourceMappingURL=analyze.cjs.map
|
package/dist/build/analyze.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-deployer.d.ts","sourceRoot":"","sources":["../../../src/build/babel/remove-deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"remove-deployer.d.ts","sourceRoot":"","sources":["../../../src/build/babel/remove-deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,wBAAgB,cAAc,IA+EvB,KAAK,CAAC,SAAS,CACrB"}
|
package/dist/build/bundler.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOVVUJ46G_cjs = require('../chunk-OVVUJ46G.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createBundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkOVVUJ46G_cjs.createBundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getInputOptions", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkOVVUJ46G_cjs.getInputOptions; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=bundler.cjs.map
|
|
16
16
|
//# sourceMappingURL=bundler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../src/build/bundler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,aAAa,EAAe,MAAM,QAAQ,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../src/build/bundler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,aAAa,EAAe,MAAM,QAAQ,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAS1C,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,EAC7D,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAA2D,EACtF,EACE,SAAiB,EACjB,KAAa,EACb,WAAW,EACX,aAAyB,EACzB,aAAoB,EACpB,eAAuB,GACxB,EAAE;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GACA,OAAO,CAAC,YAAY,CAAC,CAyHvB;AAED,wBAAsB,aAAa,CACjC,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE;;;GAiBxD"}
|
package/dist/build/bundler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundlerOptions.d.ts","sourceRoot":"","sources":["../../src/build/bundlerOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundlerOptions.d.ts","sourceRoot":"","sources":["../../src/build/bundlerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IACN,eAAe,EAAE,KAAK,CAAC;CACxB,yCAGF;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAQnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../../src/build/deployer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../../src/build/deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IACN,eAAe,EAAE,KAAK,CAAC;CACxB,yCAGF;AAED,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAOpC"}
|
package/dist/build/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkHRCR6OKC_cjs = require('../chunk-HRCR6OKC.cjs');
|
|
4
|
+
var chunkOVVUJ46G_cjs = require('../chunk-OVVUJ46G.cjs');
|
|
5
|
+
var chunkCRIOGWZD_cjs = require('../chunk-CRIOGWZD.cjs');
|
|
6
6
|
var chunkJVBCN3RH_cjs = require('../chunk-JVBCN3RH.cjs');
|
|
7
7
|
var chunkVA2CSOKJ_cjs = require('../chunk-VA2CSOKJ.cjs');
|
|
8
8
|
|
|
@@ -10,31 +10,31 @@ var chunkVA2CSOKJ_cjs = require('../chunk-VA2CSOKJ.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "createWatcher", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkHRCR6OKC_cjs.createWatcher; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getServerOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkHRCR6OKC_cjs.getServerOptions; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkHRCR6OKC_cjs.getInputOptions; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "createBundler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkOVVUJ46G_cjs.createBundler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getBundlerInputOptions", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkOVVUJ46G_cjs.getInputOptions; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkCRIOGWZD_cjs.analyzeBundle; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkCRIOGWZD_cjs.getBundlerOptions; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "Deps", {
|
|
40
40
|
enumerable: true,
|
package/dist/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
2
|
-
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-
|
|
3
|
-
export { analyzeBundle, getBundlerOptions } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-WFIG7I5C.js';
|
|
2
|
+
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-ONWHS3PA.js';
|
|
3
|
+
export { analyzeBundle, getBundlerOptions } from '../chunk-BDA7RMRF.js';
|
|
4
4
|
export { Deps, FileService } from '../chunk-DPDWM7HQ.js';
|
|
5
5
|
export { normalizeStudioBase } from '../chunk-HHA2Y3AS.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-modules-extension-resolver.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/node-modules-extension-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-modules-extension-resolver.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/node-modules-extension-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAoBrC;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CA0DrD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin } from 'rollup';
|
|
2
|
+
import type { Config as MastraConfig } from '@mastra/core/mastra';
|
|
3
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
4
|
+
export declare function removeAllOptionsFromMastraExceptPlugin(mastraEntry: string, name: keyof MastraConfig, result: {
|
|
5
|
+
hasCustomConfig: boolean;
|
|
6
|
+
}, options?: {
|
|
7
|
+
sourcemap?: boolean;
|
|
8
|
+
logger?: IMastraLogger;
|
|
9
|
+
}): Plugin;
|
|
10
|
+
//# sourceMappingURL=remove-all-except.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-all-except.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/remove-all-except.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,sCAAsC,CACpD,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,YAAY,EACxB,MAAM,EAAE;IAAE,eAAe,EAAE,OAAO,CAAA;CAAE,EACpC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,aAAa,CAAA;CAAE,GACxD,MAAM,CAgCR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverOptions.d.ts","sourceRoot":"","sources":["../../src/build/serverOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverOptions.d.ts","sourceRoot":"","sources":["../../src/build/serverOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IACN,eAAe,EAAE,KAAK,CAAC;CACxB,yCAGF;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAOlC"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { type RollupOutput } from 'rollup';
|
|
2
|
-
import { removeAllOptionsFromMastraExcept } from '../babel/remove-all-options-except.js';
|
|
3
2
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
4
|
-
type
|
|
3
|
+
import type { Config as MastraConfig } from '@mastra/core/mastra';
|
|
4
|
+
export declare function extractMastraOptionBundler(name: keyof MastraConfig, entryFile: string, result: {
|
|
5
5
|
hasCustomConfig: boolean;
|
|
6
|
-
}, logger?: IMastraLogger) => ReturnType<typeof removeAllOptionsFromMastraExcept>;
|
|
7
|
-
export declare function extractMastraOptionBundler(name: string, entryFile: string, transformer: Transformer, result: {
|
|
8
|
-
hasCustomConfig: false;
|
|
9
6
|
}, logger?: IMastraLogger): Promise<import("rollup").RollupBuild>;
|
|
10
|
-
export declare function extractMastraOption<T>(name:
|
|
7
|
+
export declare function extractMastraOption<T extends keyof MastraConfig>(name: T, entryFile: string, outputDir: string, logger?: IMastraLogger): Promise<{
|
|
11
8
|
bundleOutput: RollupOutput;
|
|
12
|
-
getConfig: () => Promise<T>;
|
|
9
|
+
getConfig: () => Promise<MastraConfig[T]>;
|
|
13
10
|
} | null>;
|
|
14
|
-
export {};
|
|
15
11
|
//# sourceMappingURL=extract-mastra-option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-mastra-option.d.ts","sourceRoot":"","sources":["../../../src/build/shared/extract-mastra-option.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-mastra-option.d.ts","sourceRoot":"","sources":["../../../src/build/shared/extract-mastra-option.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,YAAY,EACxB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IACN,eAAe,EAAE,OAAO,CAAC;CAC1B,EACD,MAAM,CAAC,EAAE,aAAa,yCAuCvB;AAED,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,MAAM,YAAY,EACpE,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC;IACT,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,GAAG,IAAI,CAAC,CAuBR"}
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7F6JKGX4_cjs = require('../chunk-7F6JKGX4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Bundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk7F6JKGX4_cjs.Bundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "IS_DEFAULT", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk7F6JKGX4_cjs.IS_DEFAULT; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=index.cjs.map
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1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-CRIOGWZD.cjs');
|
|
5
5
|
var chunkJVBCN3RH_cjs = require('./chunk-JVBCN3RH.cjs');
|
|
6
6
|
var chunkVA2CSOKJ_cjs = require('./chunk-VA2CSOKJ.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
@@ -90,7 +90,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
createBundler(inputOptions, outputOptions) {
|
|
93
|
-
return
|
|
93
|
+
return chunkOVVUJ46G_cjs.createBundler(inputOptions, outputOptions);
|
|
94
94
|
}
|
|
95
95
|
async getUserBundlerOptions(mastraEntryFile, outputDirectory) {
|
|
96
96
|
const defaultBundlerOptions = {
|
|
@@ -100,7 +100,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
100
100
|
[IS_DEFAULT]: true
|
|
101
101
|
};
|
|
102
102
|
try {
|
|
103
|
-
const bundlerOptions = await
|
|
103
|
+
const bundlerOptions = await chunkCRIOGWZD_cjs.getBundlerOptions(mastraEntryFile, outputDirectory);
|
|
104
104
|
return bundlerOptions ?? defaultBundlerOptions;
|
|
105
105
|
} catch (error) {
|
|
106
106
|
this.logger.debug("Failed to get bundler options, sourcemap will be disabled", { error });
|
|
@@ -108,7 +108,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
108
108
|
return defaultBundlerOptions;
|
|
109
109
|
}
|
|
110
110
|
async analyze(entry, mastraFile, outputDirectory) {
|
|
111
|
-
return await
|
|
111
|
+
return await chunkCRIOGWZD_cjs.analyzeBundle(
|
|
112
112
|
[].concat(entry),
|
|
113
113
|
mastraFile,
|
|
114
114
|
{
|
|
@@ -147,10 +147,10 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, { enableSourcemap, enableEsmShim, externals }) {
|
|
150
|
-
const { workspaceRoot } = await
|
|
150
|
+
const { workspaceRoot } = await chunkCRIOGWZD_cjs.getWorkspaceInformation({ mastraEntryFile });
|
|
151
151
|
const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(mastraEntryFile) });
|
|
152
152
|
const projectRoot = closestPkgJson ? path.dirname(closestPkgJson) : process.cwd();
|
|
153
|
-
const inputOptions = await
|
|
153
|
+
const inputOptions = await chunkOVVUJ46G_cjs.getInputOptions(
|
|
154
154
|
mastraEntryFile,
|
|
155
155
|
analyzedBundleInfo,
|
|
156
156
|
"node",
|
|
@@ -231,7 +231,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
231
231
|
let analyzedBundleInfo;
|
|
232
232
|
try {
|
|
233
233
|
const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);
|
|
234
|
-
analyzedBundleInfo = await
|
|
234
|
+
analyzedBundleInfo = await chunkCRIOGWZD_cjs.analyzeBundle(
|
|
235
235
|
[serverFile, ...Object.values(resolvedToolsPaths)],
|
|
236
236
|
mastraEntryFile,
|
|
237
237
|
{
|
|
@@ -263,9 +263,17 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
263
263
|
if (analyzedBundleInfo.workspaceMap.has(dep)) {
|
|
264
264
|
continue;
|
|
265
265
|
}
|
|
266
|
-
const rootPath = await
|
|
266
|
+
const rootPath = await chunkCRIOGWZD_cjs.getPackageRootPath(dep);
|
|
267
267
|
const pkg2 = await fsExtra.readJSON(`${rootPath}/package.json`);
|
|
268
|
-
|
|
268
|
+
const actualPackageName = pkg2.name;
|
|
269
|
+
const version = pkg2.version || "latest";
|
|
270
|
+
const importName = chunkVA2CSOKJ_cjs.getPackageName(dep);
|
|
271
|
+
const isAlias = actualPackageName && importName !== actualPackageName;
|
|
272
|
+
if (isAlias) {
|
|
273
|
+
dependenciesToInstall.set(dep, `npm:${actualPackageName}@${version}`);
|
|
274
|
+
} else {
|
|
275
|
+
dependenciesToInstall.set(dep, version);
|
|
276
|
+
}
|
|
269
277
|
} catch {
|
|
270
278
|
dependenciesToInstall.set(dep, "latest");
|
|
271
279
|
}
|
|
@@ -350,5 +358,5 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
350
358
|
|
|
351
359
|
exports.Bundler = Bundler;
|
|
352
360
|
exports.IS_DEFAULT = IS_DEFAULT;
|
|
353
|
-
//# sourceMappingURL=chunk-
|
|
354
|
-
//# sourceMappingURL=chunk-
|
|
361
|
+
//# sourceMappingURL=chunk-7F6JKGX4.cjs.map
|
|
362
|
+
//# sourceMappingURL=chunk-7F6JKGX4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bundler/index.ts"],"names":["MastraBundler","emptyDir","ensureDir","join","writeFile","createBundler","getBundlerOptions","analyzeBundle","DepsService","stat","copy","getWorkspaceInformation","pkg","dirname","getInputOptions","existsSync","virtual","slash","posix","glob","path","fsExtra","FileService","error","MastraError","ErrorDomain","ErrorCategory","getPackageRootPath","readJSON","getPackageName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,IAAM,UAAA,GAAa,OAAO,YAAY;AAEtC,IAAe,OAAA,GAAf,cAA+BA,qBAAA,CAAc;AAAA,EACxC,gBAAA,GAAmB,QAAA;AAAA,EACnB,SAAA,GAAY,QAAA;AAAA,EAEtB,WAAA,CAAY,IAAA,EAAc,SAAA,GAAoC,SAAA,EAAW;AACvE,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AAAA,EAC3B;AAAA,EAEA,MAAM,QAAQ,eAAA,EAAwC;AAEpD,IAAA,MAAMC,iBAAS,eAAe,CAAA;AAE9B,IAAA,MAAMC,iBAAA,CAAUC,SAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,gBAAgB,CAAC,CAAA;AAC5D,IAAA,MAAMD,iBAAA,CAAUC,SAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,EACvD;AAAA,EAEA,MAAM,gBAAA,CACJ,eAAA,EACA,YAA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AS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-7F6JKGX4.cjs","sourcesContent":["import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport type { Config } from '@mastra/core/mastra';\nimport virtual from '@rollup/plugin-virtual';\nimport * as pkg from 'empathic/package';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport type { InputOptions, OutputOptions } from 'rollup';\nimport { glob } from 'tinyglobby';\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { getPackageRootPath } from '../build/package-info';\nimport type { BundlerOptions } from '../build/types';\nimport { getPackageName, slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\n\nexport type { BundlerOptions } from '../build/types';\n\nexport const IS_DEFAULT = Symbol('IS_DEFAULT');\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const defaultBundlerOptions: Config['bundler'] = {\n externals: [],\n sourcemap: false,\n transpilePackages: [],\n [IS_DEFAULT]: true,\n } as const;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n\n return bundlerOptions ?? defaultBundlerOptions;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n return defaultBundlerOptions;\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n {\n outputDir: join(outputDirectory, this.analyzeOutputDir),\n projectRoot: outputDirectory,\n platform: 'node',\n },\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap, enableEsmShim, externals }: BundlerOptions,\n ) {\n const { workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile });\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const projectRoot = closestPkgJson ? dirname(closestPkgJson) : process.cwd();\n\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n 'node',\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: enableSourcemap, workspaceRoot, projectRoot, enableEsmShim, externalsPreset: externals === true },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n getAllToolPaths(mastraDir: string, toolsPaths: (string | string[])[] = []): (string | string[])[] {\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedMastraDir = slash(mastraDir);\n\n // Prepare default tools paths with glob patterns\n const defaultToolsPath = posix.join(normalizedMastraDir, 'tools/**/*.{js,ts}');\n const defaultToolsIgnorePaths = [\n `!${posix.join(normalizedMastraDir, 'tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'tools/**/__tests__/**')}`,\n ];\n\n // Combine default path with ignore patterns\n const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];\n\n // If no tools paths provided, use only the default paths\n if (toolsPaths.length === 0) {\n return [defaultPaths];\n }\n\n // If tools paths are provided, add the default paths to ensure standard tools are always included\n return [...toolsPaths, defaultPaths];\n }\n\n async listToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await glob(toolPath, {\n absolute: true,\n expandDirectories: false,\n });\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedEntryFile = entryFile.replaceAll('\\\\', '/');\n inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n {\n projectRoot,\n outputDirectory,\n enableEsmShim = true,\n }: {\n projectRoot: string;\n outputDirectory: string;\n enableEsmShim?: boolean;\n },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n\n const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n const internalBundlerOptions: BundlerOptions = {\n enableSourcemap: !!bundlerOptions.sourcemap,\n externals: bundlerOptions.externals ?? [],\n enableEsmShim,\n };\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: 'node',\n bundlerOptions: internalBundlerOptions,\n },\n this.logger,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof MastraError) {\n throw error;\n }\n\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n for (const dep of analyzedBundleInfo.externalDependencies) {\n try {\n if (analyzedBundleInfo.workspaceMap.has(dep)) {\n continue;\n }\n\n const rootPath = await getPackageRootPath(dep);\n const pkg = await readJSON(`${rootPath}/package.json`);\n const actualPackageName = pkg.name;\n const version = pkg.version || 'latest';\n\n // Check if this is an npm alias (import name differs from actual package name)\n // e.g., importing \"ai-v5\" which resolves to package \"ai\"\n // or importing \"@ai-sdk/openai-v5\" which resolves to \"@ai-sdk/openai\"\n // In this case, write npm alias syntax: \"ai-v5\": \"npm:ai@5.0.93\"\n // For scoped packages, compare the full package name (e.g., @scope/pkg)\n const importName = getPackageName(dep);\n const isAlias = actualPackageName && importName !== actualPackageName;\n\n if (isAlias) {\n dependenciesToInstall.set(dep, `npm:${actualPackageName}@${version}`);\n } else {\n dependenciesToInstall.set(dep, version);\n }\n } catch {\n dependenciesToInstall.set(dep, 'latest');\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);\n\n this.logger.info('Bundling Mastra application');\n\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n internalBundlerOptions,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap: internalBundlerOptions.enableSourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory, rootDir: projectRoot });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory, projectRoot);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
|