@mastra/deployer 1.2.1-alpha.0 → 1.3.0-alpha.1
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 +32 -0
- package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +11 -11
- package/dist/build/index.js +4 -4
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-5QWVKP4X.js → chunk-3WL6HPU3.js} +3 -3
- package/dist/{chunk-5QWVKP4X.js.map → chunk-3WL6HPU3.js.map} +1 -1
- package/dist/{chunk-CWEG55RE.js → chunk-AMZJCH64.js} +48 -44
- package/dist/chunk-AMZJCH64.js.map +1 -0
- package/dist/{chunk-VA557HZB.js → chunk-BZLFGOSU.js} +6 -6
- package/dist/{chunk-VA557HZB.js.map → chunk-BZLFGOSU.js.map} +1 -1
- package/dist/{chunk-Q6OWS3YN.cjs → chunk-E4SQOERA.cjs} +48 -44
- package/dist/chunk-E4SQOERA.cjs.map +1 -0
- package/dist/{chunk-NL26KCV6.cjs → chunk-IZHNO3GK.cjs} +13 -13
- package/dist/{chunk-NL26KCV6.cjs.map → chunk-IZHNO3GK.cjs.map} +1 -1
- package/dist/{chunk-4CCXXH5X.cjs → chunk-K7J2W7DJ.cjs} +7 -7
- package/dist/{chunk-4CCXXH5X.cjs.map → chunk-K7J2W7DJ.cjs.map} +1 -1
- package/dist/{chunk-HFQIQVVL.js → chunk-KNINPAM6.js} +6 -6
- package/dist/{chunk-HFQIQVVL.js.map → chunk-KNINPAM6.js.map} +1 -1
- package/dist/{chunk-GRQR3MP7.js → chunk-KRRQVSI7.js} +3 -3
- package/dist/{chunk-GRQR3MP7.js.map → chunk-KRRQVSI7.js.map} +1 -1
- package/dist/{chunk-ETMR2WW4.cjs → chunk-P3YQIQSD.cjs} +15 -14
- package/dist/chunk-P3YQIQSD.cjs.map +1 -0
- package/dist/{chunk-T3HNSYJE.cjs → chunk-R2SIOO54.cjs} +11 -11
- package/dist/{chunk-T3HNSYJE.cjs.map → chunk-R2SIOO54.cjs.map} +1 -1
- package/dist/{chunk-JLBXF6EN.js → chunk-T3QYAGU3.js} +4 -3
- package/dist/chunk-T3QYAGU3.js.map +1 -0
- package/dist/{chunk-BTBP6HRB.cjs → chunk-YA6TH3CS.cjs} +14 -14
- package/dist/{chunk-BTBP6HRB.cjs.map → chunk-YA6TH3CS.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-deployment-cloud-providers.md +2 -2
- package/dist/docs/references/docs-deployment-overview.md +2 -2
- package/dist/docs/references/reference-deployer.md +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +73 -41
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +74 -42
- package/dist/server/index.js.map +1 -1
- package/package.json +8 -9
- package/dist/chunk-CWEG55RE.js.map +0 -1
- package/dist/chunk-ETMR2WW4.cjs.map +0 -1
- package/dist/chunk-JLBXF6EN.js.map +0 -1
- package/dist/chunk-Q6OWS3YN.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 1.3.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added support for request context presets in Mastra Studio. You can now define a JSON file with named requestContext presets and pass it via the `--request-context-presets` CLI flag to both `mastra dev` and `mastra studio` commands. A dropdown selector appears in the Studio Playground, allowing you to quickly switch between preset configurations. ([#12501](https://github.com/mastra-ai/mastra/pull/12501))
|
|
8
|
+
|
|
9
|
+
**Usage:**
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mastra dev --request-context-presets ./presets.json
|
|
13
|
+
mastra studio --request-context-presets ./presets.json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Presets file format:**
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"development": { "userId": "dev-user", "env": "development" },
|
|
21
|
+
"production": { "userId": "prod-user", "env": "production" }
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When presets are loaded, a dropdown appears above the JSON editor on the Request Context page. Selecting a preset populates the editor, and manually editing the JSON automatically switches back to "Custom".
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Fixed TypeScript path alias resolution in workspace packages configured with `transpilePackages`. The bundler now correctly resolves imports using path aliases (e.g., `@/_` → `./src/_`) in transpiled workspace packages, preventing build failures in monorepo setups. ([#12239](https://github.com/mastra-ai/mastra/pull/12239))
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`b7fe535`](https://github.com/mastra-ai/mastra/commit/b7fe535fedcff7920fc0c5263da1761b704b81b3), [`27e9a34`](https://github.com/mastra-ai/mastra/commit/27e9a34bdb67c6aa59bd45cbaba619b9bd1f44a0), [`1d8cd0a`](https://github.com/mastra-ai/mastra/commit/1d8cd0ac18e4ba45200093f2bc0c3067cbc6471b), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`a211248`](https://github.com/mastra-ai/mastra/commit/a21124845b1b1321b6075a8377c341c7f5cda1b6), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`a211248`](https://github.com/mastra-ai/mastra/commit/a21124845b1b1321b6075a8377c341c7f5cda1b6), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
|
|
32
|
+
- @mastra/core@1.3.0-alpha.1
|
|
33
|
+
- @mastra/server@1.3.0-alpha.1
|
|
34
|
+
|
|
3
35
|
## 1.2.1-alpha.0
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleExternals.d.ts","sourceRoot":"","sources":["../../../src/build/analyze/bundleExternals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AASlD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAU,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"bundleExternals.d.ts","sourceRoot":"","sources":["../../../src/build/analyze/bundleExternals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AASlD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAU,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAShF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAMF;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC/C,EACE,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,GACf,EAAE;IACD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACjE,GACA;IACD,0BAA0B,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3D,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C,CAmEA;AAwTD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,cAAc,CAAC,EACX,CAAC;QACC,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GACtB,IAAI,CAAC;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CAClD;;;;GAoHF"}
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkP3YQIQSD_cjs = require('../chunk-P3YQIQSD.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 chunkP3YQIQSD_cjs.analyzeBundle; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=analyze.cjs.map
|
|
12
12
|
//# sourceMappingURL=analyze.cjs.map
|
package/dist/build/analyze.js
CHANGED
package/dist/build/bundler.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkR2SIOO54_cjs = require('../chunk-R2SIOO54.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 chunkR2SIOO54_cjs.createBundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getInputOptions", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkR2SIOO54_cjs.getInputOptions; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=bundler.cjs.map
|
|
16
16
|
//# sourceMappingURL=bundler.cjs.map
|
package/dist/build/bundler.js
CHANGED
package/dist/build/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkIZHNO3GK_cjs = require('../chunk-IZHNO3GK.cjs');
|
|
4
|
+
var chunkK7J2W7DJ_cjs = require('../chunk-K7J2W7DJ.cjs');
|
|
5
|
+
var chunkP3YQIQSD_cjs = require('../chunk-P3YQIQSD.cjs');
|
|
6
|
+
var chunkR2SIOO54_cjs = require('../chunk-R2SIOO54.cjs');
|
|
7
7
|
var chunkJVBCN3RH_cjs = require('../chunk-JVBCN3RH.cjs');
|
|
8
8
|
var chunkITC6JDLC_cjs = require('../chunk-ITC6JDLC.cjs');
|
|
9
9
|
|
|
@@ -11,31 +11,31 @@ var chunkITC6JDLC_cjs = require('../chunk-ITC6JDLC.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "createWatcher", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkIZHNO3GK_cjs.createWatcher; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "getServerOptions", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkIZHNO3GK_cjs.getServerOptions; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkIZHNO3GK_cjs.getInputOptions; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkK7J2W7DJ_cjs.getBundlerOptions; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkP3YQIQSD_cjs.analyzeBundle; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "createBundler", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkR2SIOO54_cjs.createBundler; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "getBundlerInputOptions", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkR2SIOO54_cjs.getInputOptions; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "Deps", {
|
|
41
41
|
enumerable: true,
|
package/dist/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
2
|
-
export { getBundlerOptions } from '../chunk-
|
|
3
|
-
export { analyzeBundle } from '../chunk-
|
|
4
|
-
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-BZLFGOSU.js';
|
|
2
|
+
export { getBundlerOptions } from '../chunk-3WL6HPU3.js';
|
|
3
|
+
export { analyzeBundle } from '../chunk-T3QYAGU3.js';
|
|
4
|
+
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-KRRQVSI7.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-DPDWM7HQ.js';
|
|
6
6
|
export { detectRuntime, normalizeStudioBase } from '../chunk-UKA2IZKF.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/tsconfig-paths.ts"],"names":[],"mappings":"AAEA,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,
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../../src/build/plugins/tsconfig-paths.ts"],"names":[],"mappings":"AAEA,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,CAuK3G"}
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYA6TH3CS_cjs = require('../chunk-YA6TH3CS.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 chunkYA6TH3CS_cjs.Bundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "IS_DEFAULT", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkYA6TH3CS_cjs.IS_DEFAULT; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=index.cjs.map
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
package/dist/bundler/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tsConfigPaths, esbuild } from './chunk-
|
|
1
|
+
import { tsConfigPaths, esbuild } from './chunk-AMZJCH64.js';
|
|
2
2
|
import { pathToFileURL } from 'url';
|
|
3
3
|
import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';
|
|
4
4
|
import commonjs from '@rollup/plugin-commonjs';
|
|
@@ -258,5 +258,5 @@ async function getBundlerOptions(entryFile, outputDir, logger) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
export { extractMastraOption, getBundlerOptions };
|
|
261
|
-
//# sourceMappingURL=chunk-
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
261
|
+
//# sourceMappingURL=chunk-3WL6HPU3.js.map
|
|
262
|
+
//# sourceMappingURL=chunk-3WL6HPU3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/babel/remove-all-options-except.ts","../src/build/plugins/remove-all-except.ts","../src/build/babel/remove-non-referenced-nodes.ts","../src/build/plugins/remove-unused-references.ts","../src/build/shared/extract-mastra-option.ts","../src/build/bundlerOptions.ts"],"names":["babel","path","babel2","result","babel4"],"mappings":";;;;;;;;;AAKO,SAAS,gCAAA,CACd,MAAA,EACA,MAAA,EACA,MAAA,EACA;AACA,EAAA,MAAM,IAAIA,cAAA,CAAM,KAAA;AAEhB,EAAA,OAAO;AA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,EAAW,WAAW,MAAM,CAAA;AAEhF,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-5QWVKP4X.js","sourcesContent":["import babel from '@babel/core';\nimport type { NodePath, types } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\n\nexport function removeAllOptionsFromMastraExcept(\n result: { hasCustomConfig: boolean },\n option: keyof MastraConfig,\n logger?: IMastraLogger,\n) {\n const t = babel.types;\n\n return {\n name: 'remove-all-except-' + option + '-config',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports\n exit(path) {\n path.remove();\n },\n },\n\n NewExpression(path, state) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n let mastraArgs = t.objectExpression([]);\n if (t.isObjectExpression(path.node.arguments[0])) {\n mastraArgs = path.node.arguments[0];\n }\n\n // Find the config property, skipping SpreadElement nodes\n let configProperty = mastraArgs.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === option,\n );\n let configValue: types.Expression = t.objectExpression([]);\n\n const programPath = path.scope.getProgramParent().path as NodePath<types.Program> | undefined;\n if (!programPath) {\n return;\n }\n\n if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {\n result.hasCustomConfig = true;\n configValue = configProperty.value;\n\n if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {\n const configBinding = state.file.scope.getBinding(option)!;\n\n if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {\n const id = path.scope.generateUidIdentifier(option);\n\n configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init!));\n configValue = id;\n }\n }\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), configValue)]),\n [],\n );\n\n programPath.node.body.push(exportDeclaration);\n },\n\n Program: {\n exit(path) {\n // Add a fallback export if no mastra configuration was found\n const hasExport = path.node.body.some(\n node => node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration',\n );\n\n if (!hasExport) {\n if (logger) {\n logger.warn(`Mastra ${option} config could not be extracted. Please make sure your entry file looks like this:\nexport const mastra = new Mastra({\n ${option}: <value>\n})\n\n`);\n }\n\n const fallbackExportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),\n [],\n );\n path.node.body.push(fallbackExportDeclaration);\n }\n },\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport type { Plugin } from 'rollup';\nimport { removeAllOptionsFromMastraExcept } from '../babel/remove-all-options-except';\n\nexport function removeAllOptionsFromMastraExceptPlugin(\n mastraEntry: string,\n name: keyof MastraConfig,\n result: { hasCustomConfig: boolean },\n options?: { sourcemap?: boolean; logger?: IMastraLogger },\n): Plugin {\n return {\n name: `remove-${name}`,\n transform(code, id) {\n if (id !== mastraEntry) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllOptionsFromMastraExcept(result, name, options?.logger)],\n sourceMaps: options?.sourcemap,\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n } satisfies Plugin;\n}\n","import babel from '@babel/core';\n\nexport function removeNonReferencedNodes() {\n const t = babel.types;\n\n return {\n name: 'remove-non-referenced-nodes',\n visitor: {\n Program(path) {\n // Get the scope information\n const scope = path.scope;\n\n // Filter body to keep only referenced nodes\n const currentBody = path.get('body');\n const filteredBody = currentBody.filter(childPath => {\n if (childPath.isExportDeclaration()) {\n return true;\n }\n\n // For variable declarations, check if any declared variables are referenced\n if (childPath.isVariableDeclaration()) {\n return childPath.node.declarations.some(decl => {\n if (!t.isIdentifier(decl.id)) {\n return false;\n }\n\n const name = decl.id.name;\n const binding = scope.getBinding(name);\n // Keep if it has references or is exported\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // For function/class declarations, check if they're referenced\n if (childPath.isFunctionDeclaration() || childPath.isClassDeclaration()) {\n if (!t.isIdentifier(childPath.node.id)) {\n return false;\n }\n\n const name = childPath.node.id.name;\n const binding = scope.getBinding(name);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n }\n\n // For imports, check if any imported items are referenced\n if (childPath.isImportDeclaration()) {\n return childPath.node.specifiers.some(specifier => {\n const importedName = specifier.local.name;\n const binding = scope.getBinding(importedName);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // Default to keeping other node types\n return false;\n });\n\n // Replace the program body with filtered nodes\n path.set(\n 'body',\n filteredBody.map(p => p.node),\n );\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport { removeNonReferencedNodes } from '../babel/remove-non-referenced-nodes';\n\nexport function recursiveRemoveNonReferencedNodes(code: string) {\n return new Promise<{ code: string; map: any }>(async (resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n plugins: [removeNonReferencedNodes()],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n // keep looping until the code is not changed\n if (result && result.code! !== code) {\n return recursiveRemoveNonReferencedNodes(result!.code!).then(resolve, reject);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n}\n","import { pathToFileURL } from 'node:url';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport { rollup } from 'rollup';\nimport type { RollupOutput } from 'rollup';\nimport { esbuild } from '../plugins/esbuild';\nimport { removeAllOptionsFromMastraExceptPlugin } from '../plugins/remove-all-except';\nimport { recursiveRemoveNonReferencedNodes } from '../plugins/remove-unused-references';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\n\nexport function extractMastraOptionBundler(\n name: keyof MastraConfig,\n entryFile: string,\n result: {\n hasCustomConfig: boolean;\n },\n logger?: IMastraLogger,\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n [`${name}-config`]: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n // transpile typescript to something we understand\n esbuild(),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n json(),\n removeAllOptionsFromMastraExceptPlugin(entryFile, name, result, { logger }),\n // let esbuild remove all unused imports\n esbuild(),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove it once more\n esbuild(),\n ],\n });\n}\n\nexport async function extractMastraOption<T extends keyof MastraConfig>(\n name: T,\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<{\n bundleOutput: RollupOutput;\n getConfig: () => Promise<MastraConfig[T]>;\n} | null> {\n const result = {\n hasCustomConfig: false,\n };\n\n const bundler = await extractMastraOptionBundler(name, entryFile, result, logger);\n\n const output = await bundler.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (result.hasCustomConfig) {\n const configPath = `${outputDir}/${name}-config.mjs`;\n\n return {\n bundleOutput: output,\n getConfig: () => import(pathToFileURL(configPath).href).then(m => m[name] as MastraConfig[T]),\n };\n }\n\n return null;\n}\n","import type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\n\nexport function getBundlerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('bundler', entryFile, result);\n}\n\nexport async function getBundlerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['bundler'] | null> {\n const result = await extractMastraOption('bundler', entryFile, outputDir, logger);\n\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/babel/remove-all-options-except.ts","../src/build/plugins/remove-all-except.ts","../src/build/babel/remove-non-referenced-nodes.ts","../src/build/plugins/remove-unused-references.ts","../src/build/shared/extract-mastra-option.ts","../src/build/bundlerOptions.ts"],"names":["babel","path","babel2","result","babel4"],"mappings":";;;;;;;;;AAKO,SAAS,gCAAA,CACd,MAAA,EACA,MAAA,EACA,MAAA,EACA;AACA,EAAA,MAAM,IAAIA,cAAA,CAAM,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,uBAAuB,MAAA,GAAS,SAAA;AAAA,IACtC,OAAA,EAAS;AAAA,MACP,sBAAA,EAAwB;AAAA;AAAA,QAEtB,KAAK,IAAA,EAAM;AACT,UAAA,IAAA,CAAK,MAAA,EAAO;AAAA,QACd;AAAA,OACF;AAAA,MAEA,aAAA,CAAc,MAAM,KAAA,EAAO;AAEzB,QAAA,MAAM,iBAAA,GAAoB,KAAK,UAAA,CAAW,CAAAC,UAAQ,CAAA,CAAE,oBAAA,CAAqBA,KAAAA,CAAK,IAAI,CAAC,CAAA;AACnF,QAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,UAAA;AAAA,QACF;AAEA,QAAA,MAAM,UAAA,GAAa,KAAK,UAAA,CAAW,IAAA;AAEnC,QAAA,I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AAEA,EAAA,MAAM,UAAU,MAAM,0BAAA,CAA2B,IAAA,EAAM,SAAA,EAAW,QAAQ,MAAM,CAAA;AAEhF,EAAA,MAAM,MAAA,GAAS,MAAM,OAAA,CAAQ,KAAA,CAAM;AAAA,IACjC,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB;AAAA,GACjB,CAAA;AAED,EAAA,IAAI,OAAO,eAAA,EAAiB;AAC1B,IAAA,MAAM,UAAA,GAAa,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,IAAI,CAAA,WAAA,CAAA;AAEvC,IAAA,OAAO;AAAA,MACL,YAAA,EAAc,MAAA;AAAA,MACd,SAAA,EAAW,MAAM,OAAO,aAAA,CAAc,UAAU,CAAA,CAAE,IAAA,CAAA,CAAM,IAAA,CAAK,CAAA,CAAA,KAAK,CAAA,CAAE,IAAI,CAAoB;AAAA,KAC9F;AAAA,EACF;AAEA,EAAA,OAAO,IAAA;AACT;;;AC9EA,eAAsB,iBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACmC;AACnC,EAAA,MAAM,SAAS,MAAM,mBAAA,CAAoB,SAAA,EAAW,SAAA,EAAW,WAAW,MAAM,CAAA;AAEhF,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-3WL6HPU3.js","sourcesContent":["import babel from '@babel/core';\nimport type { NodePath, types } from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\n\nexport function removeAllOptionsFromMastraExcept(\n result: { hasCustomConfig: boolean },\n option: keyof MastraConfig,\n logger?: IMastraLogger,\n) {\n const t = babel.types;\n\n return {\n name: 'remove-all-except-' + option + '-config',\n visitor: {\n ExportNamedDeclaration: {\n // remove all exports\n exit(path) {\n path.remove();\n },\n },\n\n NewExpression(path, state) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n let mastraArgs = t.objectExpression([]);\n if (t.isObjectExpression(path.node.arguments[0])) {\n mastraArgs = path.node.arguments[0];\n }\n\n // Find the config property, skipping SpreadElement nodes\n let configProperty = mastraArgs.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === option,\n );\n let configValue: types.Expression = t.objectExpression([]);\n\n const programPath = path.scope.getProgramParent().path as NodePath<types.Program> | undefined;\n if (!programPath) {\n return;\n }\n\n if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {\n result.hasCustomConfig = true;\n configValue = configProperty.value;\n\n if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {\n const configBinding = state.file.scope.getBinding(option)!;\n\n if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {\n const id = path.scope.generateUidIdentifier(option);\n\n configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init!));\n configValue = id;\n }\n }\n }\n\n // add the deployer export\n const exportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), configValue)]),\n [],\n );\n\n programPath.node.body.push(exportDeclaration);\n },\n\n Program: {\n exit(path) {\n // Add a fallback export if no mastra configuration was found\n const hasExport = path.node.body.some(\n node => node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration',\n );\n\n if (!hasExport) {\n if (logger) {\n logger.warn(`Mastra ${option} config could not be extracted. Please make sure your entry file looks like this:\nexport const mastra = new Mastra({\n ${option}: <value>\n})\n\n`);\n }\n\n const fallbackExportDeclaration = t.exportNamedDeclaration(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),\n [],\n );\n path.node.body.push(fallbackExportDeclaration);\n }\n },\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport type { Plugin } from 'rollup';\nimport { removeAllOptionsFromMastraExcept } from '../babel/remove-all-options-except';\n\nexport function removeAllOptionsFromMastraExceptPlugin(\n mastraEntry: string,\n name: keyof MastraConfig,\n result: { hasCustomConfig: boolean },\n options?: { sourcemap?: boolean; logger?: IMastraLogger },\n): Plugin {\n return {\n name: `remove-${name}`,\n transform(code, id) {\n if (id !== mastraEntry) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllOptionsFromMastraExcept(result, name, options?.logger)],\n sourceMaps: options?.sourcemap,\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n } satisfies Plugin;\n}\n","import babel from '@babel/core';\n\nexport function removeNonReferencedNodes() {\n const t = babel.types;\n\n return {\n name: 'remove-non-referenced-nodes',\n visitor: {\n Program(path) {\n // Get the scope information\n const scope = path.scope;\n\n // Filter body to keep only referenced nodes\n const currentBody = path.get('body');\n const filteredBody = currentBody.filter(childPath => {\n if (childPath.isExportDeclaration()) {\n return true;\n }\n\n // For variable declarations, check if any declared variables are referenced\n if (childPath.isVariableDeclaration()) {\n return childPath.node.declarations.some(decl => {\n if (!t.isIdentifier(decl.id)) {\n return false;\n }\n\n const name = decl.id.name;\n const binding = scope.getBinding(name);\n // Keep if it has references or is exported\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // For function/class declarations, check if they're referenced\n if (childPath.isFunctionDeclaration() || childPath.isClassDeclaration()) {\n if (!t.isIdentifier(childPath.node.id)) {\n return false;\n }\n\n const name = childPath.node.id.name;\n const binding = scope.getBinding(name);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n }\n\n // For imports, check if any imported items are referenced\n if (childPath.isImportDeclaration()) {\n return childPath.node.specifiers.some(specifier => {\n const importedName = specifier.local.name;\n const binding = scope.getBinding(importedName);\n return binding && (binding.referenced || binding.referencePaths.length > 0);\n });\n }\n\n // Default to keeping other node types\n return false;\n });\n\n // Replace the program body with filtered nodes\n path.set(\n 'body',\n filteredBody.map(p => p.node),\n );\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport { removeNonReferencedNodes } from '../babel/remove-non-referenced-nodes';\n\nexport function recursiveRemoveNonReferencedNodes(code: string) {\n return new Promise<{ code: string; map: any }>(async (resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n plugins: [removeNonReferencedNodes()],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n // keep looping until the code is not changed\n if (result && result.code! !== code) {\n return recursiveRemoveNonReferencedNodes(result!.code!).then(resolve, reject);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n}\n","import { pathToFileURL } from 'node:url';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config as MastraConfig } from '@mastra/core/mastra';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport { rollup } from 'rollup';\nimport type { RollupOutput } from 'rollup';\nimport { esbuild } from '../plugins/esbuild';\nimport { removeAllOptionsFromMastraExceptPlugin } from '../plugins/remove-all-except';\nimport { recursiveRemoveNonReferencedNodes } from '../plugins/remove-unused-references';\nimport { tsConfigPaths } from '../plugins/tsconfig-paths';\n\nexport function extractMastraOptionBundler(\n name: keyof MastraConfig,\n entryFile: string,\n result: {\n hasCustomConfig: boolean;\n },\n logger?: IMastraLogger,\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n [`${name}-config`]: entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n // transpile typescript to something we understand\n esbuild(),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n json(),\n removeAllOptionsFromMastraExceptPlugin(entryFile, name, result, { logger }),\n // let esbuild remove all unused imports\n esbuild(),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove it once more\n esbuild(),\n ],\n });\n}\n\nexport async function extractMastraOption<T extends keyof MastraConfig>(\n name: T,\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<{\n bundleOutput: RollupOutput;\n getConfig: () => Promise<MastraConfig[T]>;\n} | null> {\n const result = {\n hasCustomConfig: false,\n };\n\n const bundler = await extractMastraOptionBundler(name, entryFile, result, logger);\n\n const output = await bundler.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n });\n\n if (result.hasCustomConfig) {\n const configPath = `${outputDir}/${name}-config.mjs`;\n\n return {\n bundleOutput: output,\n getConfig: () => import(pathToFileURL(configPath).href).then(m => m[name] as MastraConfig[T]),\n };\n }\n\n return null;\n}\n","import type { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\n\nexport function getBundlerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('bundler', entryFile, result);\n}\n\nexport async function getBundlerOptions(\n entryFile: string,\n outputDir: string,\n logger?: IMastraLogger,\n): Promise<Config['bundler'] | null> {\n const result = await extractMastraOption('bundler', entryFile, outputDir, logger);\n\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
@@ -208,63 +208,67 @@ function tsConfigPaths({ tsConfigPath, respectCoreModule, localResolve } = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
return {
|
|
210
210
|
name: PLUGIN_NAME,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const moduleName = resolveAlias(request, importer);
|
|
216
|
-
if (!moduleName) {
|
|
217
|
-
let importerMeta = {};
|
|
218
|
-
const resolved2 = await this.resolve(request, importer, { skipSelf: true, ...options });
|
|
219
|
-
if (!resolved2) {
|
|
211
|
+
resolveId: {
|
|
212
|
+
order: "pre",
|
|
213
|
+
async handler(request, importer, options) {
|
|
214
|
+
if (!importer || request.startsWith("\0") || importer.charCodeAt(0) === 0) {
|
|
220
215
|
return null;
|
|
221
216
|
}
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
if (!path.isAbsolute(importer)) {
|
|
218
|
+
importer = path.resolve(process.cwd(), importer);
|
|
219
|
+
}
|
|
220
|
+
const moduleName = resolveAlias(request, importer);
|
|
221
|
+
if (!moduleName) {
|
|
222
|
+
const resolved2 = await this.resolve(request, importer, { skipSelf: true, ...options });
|
|
223
|
+
if (!resolved2) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
if (localResolve) {
|
|
227
|
+
const importerInfo = this.getModuleInfo(importer);
|
|
228
|
+
const importerPluginMeta = importerInfo?.meta?.[PLUGIN_NAME];
|
|
229
|
+
if (!request.startsWith("./") && !request.startsWith("../") && importerPluginMeta?.resolved) {
|
|
230
|
+
return {
|
|
231
|
+
...resolved2,
|
|
232
|
+
external: !request.startsWith("hono/") && request !== "hono"
|
|
233
|
+
};
|
|
234
|
+
}
|
|
230
235
|
}
|
|
236
|
+
return {
|
|
237
|
+
...resolved2,
|
|
238
|
+
meta: {
|
|
239
|
+
...resolved2.meta || {}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
231
242
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
...importerMeta
|
|
243
|
+
if (!path.extname(moduleName)) {
|
|
244
|
+
const resolved2 = await this.resolve(moduleName, importer, { skipSelf: true, ...options });
|
|
245
|
+
if (!resolved2) {
|
|
246
|
+
return null;
|
|
237
247
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
248
|
+
return {
|
|
249
|
+
...resolved2,
|
|
250
|
+
meta: {
|
|
251
|
+
...resolved2.meta,
|
|
252
|
+
[PLUGIN_NAME]: {
|
|
253
|
+
resolved: true
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const resolved = await this.resolve(moduleName, importer, { skipSelf: true, ...options });
|
|
259
|
+
if (!resolved) {
|
|
243
260
|
return null;
|
|
244
261
|
}
|
|
245
262
|
return {
|
|
246
|
-
...
|
|
263
|
+
...resolved,
|
|
247
264
|
meta: {
|
|
248
|
-
...
|
|
265
|
+
...resolved.meta,
|
|
249
266
|
[PLUGIN_NAME]: {
|
|
250
267
|
resolved: true
|
|
251
268
|
}
|
|
252
269
|
}
|
|
253
270
|
};
|
|
254
271
|
}
|
|
255
|
-
const resolved = await this.resolve(moduleName, importer, { skipSelf: true, ...options });
|
|
256
|
-
if (!resolved) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
...resolved,
|
|
261
|
-
meta: {
|
|
262
|
-
...resolved.meta,
|
|
263
|
-
[PLUGIN_NAME]: {
|
|
264
|
-
resolved: true
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
272
|
}
|
|
269
273
|
};
|
|
270
274
|
}
|
|
@@ -310,5 +314,5 @@ function subpathExternalsResolver(externals) {
|
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
export { esbuild, esmShim, getPackageRootPath, removeDeployer2 as removeDeployer, subpathExternalsResolver, tsConfigPaths };
|
|
313
|
-
//# sourceMappingURL=chunk-
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
317
|
+
//# sourceMappingURL=chunk-AMZJCH64.js.map
|
|
318
|
+
//# sourceMappingURL=chunk-AMZJCH64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build/package-info.ts","../src/build/plugins/esbuild.ts","../src/build/babel/remove-deployer.ts","../src/build/plugins/remove-deployer.ts","../src/build/plugins/tsconfig-paths.ts","../src/build/plugins/esm-shim.ts","../src/build/plugins/subpath-externals-resolver.ts"],"names":["babel","path","removeDeployer","babel2","tsConfigPath","resolved"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,kBAAA,CAAmB,aAAqB,UAAA,EAA6C;AACzG,EAAA,IAAI,QAAA;AAEJ,EAAA,IAAI;AACF,IAAA,IAAI,OAAA,GAA4C,MAAA;AAChD,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,IAAI,CAAC,UAAA,CAAW,UAAA,CAAW,SAAS,CAAA,EAAG;AACrC,QAAA,UAAA,GAAa,aAAA,CAAc,UAAU,CAAA,CAAE,IAAA;AAAA,MACzC;AAEA,MAAA,OAAA,GAAU;AAAA,QACR,KAAA,EAAO,CAAC,UAAU;AAAA,OACpB;AAAA,IACF;AAEA,IAAA,MAAM,GAAA,GAAM,MAAM,cAAA,CAAe,WAAA,EAAa,OAAO,CAAA;AACrD,IAAA,QAAA,GAAW,KAAK,QAAA,IAAY,IAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,QAAA,GAAW,IAAA;AAAA,EACb;AAEA,EAAA,OAAO,QAAA;AACT;AC/BO,SAAS,OAAA,CAAQ,OAAA,GAAiD,EAAC,EAAG;AAC3E,EAAA,OAAO,eAAA,CAAgB;AAAA,IACrB,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,MAAA;AAAA,IACV,MAAA,EAAQ,KAAA;AAAA,IACR,GAAG;AAAA,GACJ,CAAA;AACH;ACPO,SAAS,cAAA,GAAiB;AAC/B,E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MAAA,MAAM,oBAAoB,SAAA,CAAU,IAAA,CAAK,cAAY,yBAAA,CAA0B,EAAA,EAAI,QAAQ,CAAC,CAAA;AAC5F,MAAA,IAAI,iBAAA,EAAmB;AACrB,QAAA,OAAO;AAAA,UACL,EAAA;AAAA,UACA,QAAA,EAAU;AAAA,SACZ;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF","file":"chunk-AMZJCH64.js","sourcesContent":["/**\n * Note: This function depends on local-pkg and should only be used at build-time.\n * It is in a separate file to avoid including local-pkg in runtime code.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { getPackageInfo } from 'local-pkg';\n\n/**\n * Get package root path\n */\nexport async function getPackageRootPath(packageName: string, parentPath?: string): Promise<string | null> {\n let rootPath: string | null;\n\n try {\n let options: { paths?: string[] } | undefined = undefined;\n if (parentPath) {\n if (!parentPath.startsWith('file://')) {\n parentPath = pathToFileURL(parentPath).href;\n }\n\n options = {\n paths: [parentPath],\n };\n }\n\n const pkg = await getPackageInfo(packageName, options);\n rootPath = pkg?.rootPath ?? null;\n } catch {\n rootPath = null;\n }\n\n return rootPath;\n}\n","import originalEsbuild from 'rollup-plugin-esbuild';\n\nexport function esbuild(options: Parameters<typeof originalEsbuild>[0] = {}) {\n return originalEsbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n ...options,\n });\n}\n","import babel from '@babel/core';\n\nexport function removeDeployer() {\n const t = babel.types;\n\n // Helper to remove deployer property from an object and clean up its binding\n function removeDeployerFromObject(\n objectExpr: babel.types.ObjectExpression,\n scope: { getBinding: (name: string) => { path?: babel.NodePath } | undefined },\n ): babel.types.ObjectProperty | undefined {\n const deployerProp = objectExpr.properties.find(\n prop => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'deployer',\n ) as babel.types.ObjectProperty | undefined;\n\n if (deployerProp) {\n objectExpr.properties = objectExpr.properties.filter(prop => prop !== deployerProp);\n\n // Clean up the deployer binding if it's a reference\n if (t.isIdentifier(deployerProp.value)) {\n const deployerBinding = scope.getBinding(deployerProp.value.name);\n if (deployerBinding) {\n deployerBinding.path?.parentPath?.remove();\n }\n }\n }\n\n return deployerProp;\n }\n\n return {\n name: 'remove-deployer',\n visitor: {\n NewExpression(path, state) {\n // is a variable declaration\n const varDeclaratorPath = path.findParent(path => t.isVariableDeclarator(path.node));\n if (!varDeclaratorPath) {\n return;\n }\n\n const parentNode = path.parentPath.node;\n // check if it's a const of mastra\n if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== 'mastra') {\n return;\n }\n\n if (!state.hasReplaced) {\n state.hasReplaced = true;\n const newMastraObj = t.cloneNode(path.node);\n if (t.isObjectExpression(newMastraObj.arguments[0]) && newMastraObj.arguments[0].properties?.length) {\n const objectArg = newMastraObj.arguments[0];\n let foundDeployer = false;\n\n // First, check for direct deployer property\n const directDeployer = removeDeployerFromObject(objectArg, state.file.scope);\n if (directDeployer) {\n foundDeployer = true;\n }\n\n // Then, check spread elements for deployer properties\n for (const prop of objectArg.properties) {\n if (t.isSpreadElement(prop) && t.isIdentifier(prop.argument)) {\n const spreadBinding = state.file.scope.getBinding(prop.argument.name);\n if (spreadBinding?.path && t.isVariableDeclarator(spreadBinding.path.node)) {\n const init = spreadBinding.path.node.init;\n if (t.isObjectExpression(init)) {\n const spreadDeployer = removeDeployerFromObject(init, state.file.scope);\n if (spreadDeployer) {\n foundDeployer = true;\n }\n }\n }\n }\n }\n\n if (foundDeployer) {\n path.replaceWith(newMastraObj);\n }\n }\n }\n },\n },\n } as babel.PluginObj;\n}\n","import * as babel from '@babel/core';\nimport type { Plugin } from 'rollup';\n\nimport { removeDeployer as removeDeployerBabelPlugin } from '../babel/remove-deployer';\n\nexport function removeDeployer(mastraEntry: string, options?: { sourcemap?: boolean }): Plugin {\n return {\n name: 'remove-deployer',\n transform(code, id) {\n if (id !== mastraEntry) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeDeployerBabelPlugin],\n sourceMaps: options?.sourcemap,\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n } satisfies Plugin;\n}\n","import fs from 'node:fs';\nimport path, { normalize } from 'node:path';\nimport type { Plugin } from 'rollup';\nimport stripJsonComments from 'strip-json-comments';\nimport type { RegisterOptions } from 'typescript-paths';\nimport { createHandler } from 'typescript-paths';\n\nconst PLUGIN_NAME = 'tsconfig-paths';\n\nexport type PluginOptions = Omit<RegisterOptions, 'loggerID'> & { localResolve?: boolean };\n\n/**\n * Check if a tsconfig file has path mappings configured.\n * Exported for testing purposes.\n *\n * @param tsConfigPath - Path to the tsconfig.json file\n * @returns true if the tsconfig has paths configured or extends another config, false otherwise\n */\nexport function hasPaths(tsConfigPath: string): boolean {\n try {\n const content = fs.readFileSync(tsConfigPath, 'utf8');\n const config = JSON.parse(stripJsonComments(content));\n return !!(\n (config.compilerOptions?.paths && Object.keys(config.compilerOptions.paths).length > 0) ||\n (typeof config.extends === 'string' && config.extends.length > 0) ||\n (Array.isArray(config.extends) && config.extends.length > 0)\n );\n } catch {\n return false;\n }\n}\n\nexport function tsConfigPaths({ tsConfigPath, respectCoreModule, localResolve }: PluginOptions = {}): Plugin {\n const handlerCache = new Map<string, ReturnType<typeof createHandler>>();\n\n // Find tsconfig.json file starting from a directory and walking up\n function findTsConfigForFile(filePath: string): string | null {\n let currentDir = path.dirname(filePath);\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const tsConfigPath = path.join(currentDir, 'tsconfig.json');\n\n if (fs.existsSync(tsConfigPath)) {\n // Check if this tsconfig has path mappings\n if (hasPaths(tsConfigPath)) {\n return tsConfigPath;\n }\n }\n\n // Also check for tsconfig.base.json (common in NX)\n const tsConfigBasePath = path.join(currentDir, 'tsconfig.base.json');\n if (fs.existsSync(tsConfigBasePath)) {\n if (hasPaths(tsConfigBasePath)) {\n return tsConfigBasePath;\n }\n }\n\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n }\n\n // Get or create handler for a specific tsconfig file\n function getHandlerForFile(filePath: string): ReturnType<typeof createHandler> | null {\n // If a specific tsConfigPath was provided, use it\n if (tsConfigPath && typeof tsConfigPath === 'string') {\n if (!handlerCache.has(tsConfigPath)) {\n handlerCache.set(\n tsConfigPath,\n createHandler({\n log: () => {},\n tsConfigPath,\n respectCoreModule,\n falllback: moduleName => fs.existsSync(moduleName),\n }),\n );\n }\n return handlerCache.get(tsConfigPath)!;\n }\n\n // Find appropriate tsconfig for this file\n const configPath = findTsConfigForFile(filePath);\n if (!configPath) {\n return null;\n }\n\n // Cache handlers to avoid recreation\n if (!handlerCache.has(configPath)) {\n handlerCache.set(\n configPath,\n createHandler({\n log: () => {},\n tsConfigPath: configPath,\n respectCoreModule,\n falllback: moduleName => fs.existsSync(moduleName),\n }),\n );\n }\n\n return handlerCache.get(configPath)!;\n }\n\n // Simple alias resolution using dynamic handler\n function resolveAlias(request: string, importer: string): string | null | undefined {\n // Get the appropriate handler for this file\n const dynamicHandler = getHandlerForFile(importer);\n if (!dynamicHandler) {\n return null;\n }\n\n const resolved = dynamicHandler(request, normalize(importer));\n return resolved;\n }\n\n return {\n name: PLUGIN_NAME,\n resolveId: {\n order: 'pre',\n async handler(request, importer, options) {\n if (!importer || request.startsWith('\\0') || importer.charCodeAt(0) === 0) {\n return null;\n }\n\n // Convert relative paths to absolute to ensure proper tsconfig path resolution\n // This allows path aliases to work regardless of how the importer path is provided\n if (!path.isAbsolute(importer)) {\n importer = path.resolve(process.cwd(), importer);\n }\n\n const moduleName = resolveAlias(request, importer);\n // No tsconfig alias found, so we need to resolve it normally\n if (!moduleName) {\n const resolved = await this.resolve(request, importer, { skipSelf: true, ...options });\n if (!resolved) {\n return null;\n }\n\n // If localResolve is true, we need to check if the importer has been resolved by the tsconfig-paths plugin\n // if so, we need to resolve the request from the importer instead of the root and mark it as external\n if (localResolve) {\n const importerInfo = this.getModuleInfo(importer);\n const importerPluginMeta = importerInfo?.meta?.[PLUGIN_NAME];\n\n if (!request.startsWith('./') && !request.startsWith('../') && importerPluginMeta?.resolved) {\n return {\n ...resolved,\n external: !request.startsWith('hono/') && request !== 'hono',\n };\n }\n }\n\n return {\n ...resolved,\n meta: {\n ...(resolved.meta || {}),\n },\n };\n }\n\n // When a module does not have an extension, we need to resolve it to a file\n if (!path.extname(moduleName)) {\n const resolved = await this.resolve(moduleName, importer, { skipSelf: true, ...options });\n\n if (!resolved) {\n return null;\n }\n\n return {\n ...resolved,\n meta: {\n ...resolved.meta,\n [PLUGIN_NAME]: {\n resolved: true,\n },\n },\n };\n }\n\n // Always pass through bundler's resolution to ensure proper path normalization\n const resolved = await this.resolve(moduleName, importer, { skipSelf: true, ...options });\n\n if (!resolved) {\n return null;\n }\n\n return {\n ...resolved,\n meta: {\n ...resolved.meta,\n [PLUGIN_NAME]: {\n resolved: true,\n },\n },\n };\n },\n },\n } satisfies Plugin;\n}\n","import originalEsmShim from '@rollup/plugin-esm-shim';\nimport type { Plugin } from 'rollup';\n\n// Regex to detect DECLARATIONS of __filename, __dirname\n// Using non-capturing group (?:) for slightly better performance\nconst FilenameDeclarationRegex = /(?:const|let|var)\\s+__filename/;\nconst DirnameDeclarationRegex = /(?:const|let|var)\\s+__dirname/;\n\n/**\n * Custom ESM shim plugin wrapper that respects user-declared __filename/__dirname variables.\n *\n * The original @rollup/plugin-esm-shim would inject shims even when users had already declared\n * their own __filename/__dirname, causing \"Identifier '__filename' has already been declared\" errors.\n *\n * This wrapper checks if the user has already declared these variables and skips the shim injection\n * if so. If either variable is declared, we skip the shim entirely since the original plugin injects\n * both together and we assume users who declare one will also handle the other if needed.\n */\nexport function esmShim(): Plugin {\n const original = originalEsmShim();\n\n return {\n name: 'esm-shim',\n renderChunk(code, chunk, opts, meta) {\n // Fast path: use includes() first to avoid regex if identifiers aren't present\n const hasFilename = code.includes('__filename');\n const hasDirname = code.includes('__dirname');\n\n // If user declared either __filename or __dirname, skip shim injection entirely\n // since the original plugin injects both together\n const userDeclaredFilename = hasFilename && FilenameDeclarationRegex.test(code);\n const userDeclaredDirname = hasDirname && DirnameDeclarationRegex.test(code);\n\n if (userDeclaredFilename || userDeclaredDirname) {\n return null;\n }\n\n // Otherwise, delegate to the original plugin\n if (typeof original.renderChunk === 'function') {\n return original.renderChunk.call(this, code, chunk, opts, meta);\n }\n\n return null;\n },\n };\n}\n\nexport default esmShim;\n","import type { Plugin } from 'rollup';\nimport { isDependencyPartOfPackage } from '../utils';\n\nexport function subpathExternalsResolver(externals: string[]): Plugin {\n return {\n name: 'subpath-externals-resolver',\n resolveId(id) {\n if (id.startsWith('.') || id.startsWith('/')) {\n return null;\n }\n\n const isPartOfExternals = externals.some(external => isDependencyPartOfPackage(id, external));\n if (isPartOfExternals) {\n return {\n id,\n external: true,\n };\n }\n },\n } satisfies Plugin;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { extractMastraOption } from './chunk-
|
|
2
|
-
import { getWorkspaceInformation, analyzeBundle, aliasHono } from './chunk-
|
|
3
|
-
import { getInputOptions, nodeModulesExtensionResolver } from './chunk-
|
|
4
|
-
import { tsConfigPaths } from './chunk-
|
|
1
|
+
import { extractMastraOption } from './chunk-3WL6HPU3.js';
|
|
2
|
+
import { getWorkspaceInformation, analyzeBundle, aliasHono } from './chunk-T3QYAGU3.js';
|
|
3
|
+
import { getInputOptions, nodeModulesExtensionResolver } from './chunk-KRRQVSI7.js';
|
|
4
|
+
import { tsConfigPaths } from './chunk-AMZJCH64.js';
|
|
5
5
|
import { slash, getPackageName } from './chunk-UKA2IZKF.js';
|
|
6
6
|
import { dirname, posix } from 'path';
|
|
7
7
|
import { noopLogger } from '@mastra/core/logger';
|
|
@@ -94,5 +94,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export { createWatcher, getInputOptions2 as getInputOptions, getServerOptions };
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-BZLFGOSU.js.map
|
|
98
|
+
//# sourceMappingURL=chunk-BZLFGOSU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/watcher.ts","../src/build/serverOptions.ts"],"names":["getInputOptions"],"mappings":";;;;;;;;;;AAeA,eAAsBA,gBAAAA,CACpB,SAAA,EACA,QAAA,EACA,GAAA,EACA;AAAA,EACE,SAAA,GAAY,KAAA;AAAA,EACZ,cAAA,GAAiB;AAAA,IACf,eAAA,EAAiB,KAAA;AAAA,IACjB,aAAA,EAAe,IAAA;AAAA,IACf,SAAA,EAAW;AAAA;AAEf,CAAA,GAA8D,EAAC,EAC/D;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,IAAA;AAAA,MACP;AAAA,KACF;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,IAAA,uBAA2B,GAAA,EAAI;AACrC,EAAA,KAAA,MA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AAA,IAAK,MAAA,EAA+B,SAAS,cAAA,EAAgB;AAC3D,QAAA;AAAA,MACF;AAEA,MAAA,IAAK,MAAA,EAA+B,SAAS,gBAAA,EAAkB;AAC7D,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN,aAAA,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,CAAK,SAAA,EAAW,CAAA;AAErC,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,4BAAA,EAA8B,CAAA;AAAA,EAC1D;AAEA,EAAA,OAAO,YAAA;AACT;AAEA,eAAsB,aAAA,CAAc,cAA4B,aAAA,EAA8B;AAC5F,EAAA,MAAM,OAAA,GAAU,MAAM,KAAA,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;;;AC9FA,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-BZLFGOSU.js","sourcesContent":["import { dirname, posix } from 'node:path';\nimport { noopLogger } from '@mastra/core/logger';\nimport * as pkg from 'empathic/package';\nimport type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\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 type { BundlerOptions } from './types';\nimport { getPackageName, slash } from './utils';\nimport type { BundlerPlatform } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: BundlerPlatform,\n env?: Record<string, string>,\n {\n sourcemap = false,\n bundlerOptions = {\n enableSourcemap: false,\n enableEsmShim: true,\n externals: true,\n },\n }: { sourcemap?: boolean; bundlerOptions?: BundlerOptions } = {},\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 bundlerOptions,\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 Map(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot, externalsPreset: bundlerOptions?.externals === true },\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 { IMastraLogger } from '@mastra/core/logger';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\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"]}
|