@mastra/deployer 0.24.5-alpha.0 → 0.24.6-alpha.0
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 +20 -0
- 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 +12 -12
- package/dist/build/index.js +4 -4
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-NSINCI76.cjs → chunk-4KA7G7H5.cjs} +9 -9
- package/dist/{chunk-NSINCI76.cjs.map → chunk-4KA7G7H5.cjs.map} +1 -1
- package/dist/{chunk-URO47RYV.js → chunk-7QAMM6ZD.js} +5 -5
- package/dist/{chunk-URO47RYV.js.map → chunk-7QAMM6ZD.js.map} +1 -1
- package/dist/{chunk-Z546LAA6.cjs → chunk-CAOUHPIR.cjs} +14 -14
- package/dist/{chunk-Z546LAA6.cjs.map → chunk-CAOUHPIR.cjs.map} +1 -1
- package/dist/{chunk-IAEJ3C3J.cjs → chunk-CVJ35R7W.cjs} +3 -3
- package/dist/{chunk-IAEJ3C3J.cjs.map → chunk-CVJ35R7W.cjs.map} +1 -1
- package/dist/{chunk-CVRN2K4O.js → chunk-D6C25KS4.js} +3 -3
- package/dist/{chunk-CVRN2K4O.js.map → chunk-D6C25KS4.js.map} +1 -1
- package/dist/{chunk-FD5X42ZU.js → chunk-J74CSPBA.js} +4 -4
- package/dist/{chunk-FD5X42ZU.js.map → chunk-J74CSPBA.js.map} +1 -1
- package/dist/{chunk-XHLN6E4D.js → chunk-KI27F57F.js} +3 -3
- package/dist/{chunk-XHLN6E4D.js.map → chunk-KI27F57F.js.map} +1 -1
- package/dist/{chunk-B2Q76NIL.js → chunk-PKKDL5R4.js} +3 -3
- package/dist/{chunk-B2Q76NIL.js.map → chunk-PKKDL5R4.js.map} +1 -1
- package/dist/{chunk-AJX72IGP.cjs → chunk-VAW2CQ6L.cjs} +5 -5
- package/dist/{chunk-AJX72IGP.cjs.map → chunk-VAW2CQ6L.cjs.map} +1 -1
- package/dist/{chunk-OVUES2BE.cjs → chunk-VHQHPXQQ.cjs} +16 -16
- package/dist/{chunk-OVUES2BE.cjs.map → chunk-VHQHPXQQ.cjs.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 0.24.6-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Rename "Playground" to "Studio" ([#10467](https://github.com/mastra-ai/mastra/pull/10467))
|
|
8
|
+
|
|
9
|
+
- Fixed a bug where imports that were not used in the main entry point were tree-shaken during analysis, causing bundling errors. Tree-shaking now only runs during the bundling step. ([#10478](https://github.com/mastra-ai/mastra/pull/10478))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
|
|
12
|
+
- @mastra/core@0.24.6-alpha.0
|
|
13
|
+
- @mastra/server@0.24.6-alpha.0
|
|
14
|
+
|
|
15
|
+
## 0.24.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`880f12b`](https://github.com/mastra-ai/mastra/commit/880f12bb45a3d49faf8d22969744ffb6e01c66fd)]:
|
|
20
|
+
- @mastra/core@0.24.5
|
|
21
|
+
- @mastra/server@0.24.5
|
|
22
|
+
|
|
3
23
|
## 0.24.5-alpha.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCVJ35R7W_cjs = require('../chunk-CVJ35R7W.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 chunkCVJ35R7W_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 chunk4KA7G7H5_cjs = require('../chunk-4KA7G7H5.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 chunk4KA7G7H5_cjs.createBundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getInputOptions", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk4KA7G7H5_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,44 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkCAOUHPIR_cjs = require('../chunk-CAOUHPIR.cjs');
|
|
4
|
+
var chunkVAW2CQ6L_cjs = require('../chunk-VAW2CQ6L.cjs');
|
|
5
|
+
var chunk4KA7G7H5_cjs = require('../chunk-4KA7G7H5.cjs');
|
|
6
|
+
var chunkCVJ35R7W_cjs = require('../chunk-CVJ35R7W.cjs');
|
|
7
7
|
var chunk3JYRSECU_cjs = require('../chunk-3JYRSECU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "createWatcher", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkCAOUHPIR_cjs.createWatcher; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getServerOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkCAOUHPIR_cjs.getServerOptions; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkCAOUHPIR_cjs.getInputOptions; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "writeTelemetryConfig", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkVAW2CQ6L_cjs.writeTelemetryConfig; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "createBundler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk4KA7G7H5_cjs.createBundler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getBundlerInputOptions", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk4KA7G7H5_cjs.getInputOptions; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkCVJ35R7W_cjs.analyzeBundle; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkCVJ35R7W_cjs.getBundlerOptions; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "Deps", {
|
|
44
44
|
enumerable: true,
|
package/dist/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
2
|
-
export { writeTelemetryConfig } from '../chunk-
|
|
3
|
-
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-
|
|
4
|
-
export { analyzeBundle, getBundlerOptions } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-J74CSPBA.js';
|
|
2
|
+
export { writeTelemetryConfig } from '../chunk-PKKDL5R4.js';
|
|
3
|
+
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-KI27F57F.js';
|
|
4
|
+
export { analyzeBundle, getBundlerOptions } from '../chunk-D6C25KS4.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-5QFG6SCM.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVHQHPXQQ_cjs = require('../chunk-VHQHPXQQ.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 chunkVHQHPXQQ_cjs.Bundler; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=index.cjs.map
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|
package/dist/bundler/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCVJ35R7W_cjs = require('./chunk-CVJ35R7W.cjs');
|
|
4
4
|
var alias = require('@rollup/plugin-alias');
|
|
5
5
|
var commonjs = require('@rollup/plugin-commonjs');
|
|
6
6
|
var json = require('@rollup/plugin-json');
|
|
@@ -45,7 +45,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const externals = Array.from(externalsCopy);
|
|
48
|
-
const normalizedEntryFile =
|
|
48
|
+
const normalizedEntryFile = chunkCVJ35R7W_cjs.slash(entryFile);
|
|
49
49
|
return {
|
|
50
50
|
logLevel: process.env.MASTRA_BUNDLER_DEBUG === "true" ? "debug" : "silent",
|
|
51
51
|
treeshake: "smallest",
|
|
@@ -76,7 +76,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
76
76
|
entries: [
|
|
77
77
|
{
|
|
78
78
|
find: /^\#server$/,
|
|
79
|
-
replacement:
|
|
79
|
+
replacement: chunkCVJ35R7W_cjs.slash(url.fileURLToPath(undefined("@mastra/deployer/server")))
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
find: /^\@mastra\/server\/(.*)/,
|
|
@@ -92,7 +92,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
92
92
|
{ find: /^\#mastra$/, replacement: normalizedEntryFile }
|
|
93
93
|
]
|
|
94
94
|
}),
|
|
95
|
-
|
|
95
|
+
chunkCVJ35R7W_cjs.tsConfigPaths(),
|
|
96
96
|
{
|
|
97
97
|
name: "tools-rewriter",
|
|
98
98
|
resolveId(id) {
|
|
@@ -104,7 +104,7 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
|
|
107
|
+
chunkCVJ35R7W_cjs.esbuild({
|
|
108
108
|
platform,
|
|
109
109
|
define: env
|
|
110
110
|
}),
|
|
@@ -135,9 +135,9 @@ async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = {
|
|
|
135
135
|
// },
|
|
136
136
|
// },
|
|
137
137
|
json__default.default(),
|
|
138
|
-
|
|
138
|
+
chunkCVJ35R7W_cjs.removeDeployer(entryFile, { sourcemap }),
|
|
139
139
|
// treeshake unused imports
|
|
140
|
-
|
|
140
|
+
chunkCVJ35R7W_cjs.esbuild({
|
|
141
141
|
include: entryFile,
|
|
142
142
|
platform
|
|
143
143
|
})
|
|
@@ -163,5 +163,5 @@ async function createBundler(inputOptions, outputOptions) {
|
|
|
163
163
|
|
|
164
164
|
exports.createBundler = createBundler;
|
|
165
165
|
exports.getInputOptions = getInputOptions;
|
|
166
|
-
//# sourceMappingURL=chunk-
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-4KA7G7H5.cjs.map
|
|
167
|
+
//# sourceMappingURL=chunk-4KA7G7H5.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/bundler.ts"],"names":["nodeResolve","slash","join","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,eAAA,CACpB,SAAA,EACA,kBAAA,EACA,QAAA,EACA,GAAA,GAA8B,EAAE,sBAAA,EAAwB,IAAA,CAAK,SAAA,CAAU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EAAA,OAAO;AAAA,IACL,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,CAAM;AAAA,QACnB,GAAG,aAAA;AAAA,QACH,MAAA,EAAQ,KAAA;AAAA,QACR,cAAA,EAAgB,YAAA;AAAA,QAChB,cAAA,EAAgB;AAAA,OACjB,CAAA;AAAA,IACH,CAAA;AAAA,IACA,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,EAAM;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/build/bundler.ts"],"names":["nodeResolve","slash","join","pathToFileURL","alias","fileURLToPath","tsConfigPaths","esbuild","optimizeLodashImports","commonjs","esmShim","json","removeDeployer","rollup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,eAAA,CACpB,SAAA,EACA,kBAAA,EACA,QAAA,EACA,GAAA,GAA8B,EAAE,sBAAA,EAAwB,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA,EAAE,EACrF;AAAA,EACE,SAAA,GAAY,KAAA;AAAA,EACZ,KAAA,GAAQ,KAAA;AAAA,EACR,WAAA;AAAA,EACA,aAAA,GAAgB,MAAA;AAAA,EAChB,aAAA,GAAgB;AAClB,CAAA,EAOuB;AACvB,EAAA,IAAI,iBAAA,GACF,QAAA,KAAa,MAAA,GACTA,4BAAA,CAAY;AAAA,IACV,cAAA,EAAgB,IAAA;AAAA,IAChB,gBAAA,EAAkB,CAAC,MAAM;AAAA,GAC1B,IACDA,4BAAA,CAAY;AAAA,IACV,cAAA,EAAgB,KAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACV,CAAA;AAEP,EAAA,MAAM,aAAA,uBAAoB,GAAA,EAAY;AAEtC,EAAA,KAAA,MAAW,QAAA,IAAY,mBAAmB,oBAAA,EAAsB;AAC9D,IAAA,IAAI,QAAA,CAAS,UAAA,CAAW,GAAG,CAAA,EAAG;AAC5B,MAAA,MAAM,CAAC,KAAA,EAAO,IAAI,IAAI,Q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,EAAyB,IAAA;AAAA,QACzB,aAAa,EAAA,EAAI;AACf,UAAA,OAAO,SAAA,CAAU,SAAS,EAAE,CAAA;AAAA,QAC9B;AAAA,OACD,CAAA;AAAA,MACD,aAAA,GAAgBC,0BAAQ,GAAI,MAAA;AAAA,MAC5B,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAeAC,qBAAA,EAAK;AAAA,MACLC,gCAAA,CAAe,SAAA,EAAW,EAAE,SAAA,EAAW,CAAA;AAAA;AAAA,MAEvCL,yBAAA,CAAQ;AAAA,QACN,OAAA,EAAS,SAAA;AAAA,QACT;AAAA,OACD;AAAA,KACH,CAAE,OAAO,OAAO;AAAA,GAClB;AACF;AAEA,eAAsB,aAAA,CACpB,cACA,aAAA,EACA;AACA,EAAA,MAAM,OAAA,GAAU,MAAMM,aAAA,CAAO,YAAY,CAAA;AAEzC,EAAA,OAAO;AAAA,IACL,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,CAAM;AAAA,QACnB,GAAG,aAAA;AAAA,QACH,MAAA,EAAQ,KAAA;AAAA,QACR,cAAA,EAAgB,YAAA;AAAA,QAChB,cAAA,EAAgB;AAAA,OACjB,CAAA;AAAA,IACH,CAAA;AAAA,IACA,OAAO,MAAM;AACX,MAAA,OAAO,QAAQ,KAAA,EAAM;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-4KA7G7H5.cjs","sourcesContent":["import alias from '@rollup/plugin-alias';\nimport commonjs from '@rollup/plugin-commonjs';\nimport json from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport esmShim from '@rollup/plugin-esm-shim';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { rollup, type InputOptions, type OutputOptions, type Plugin } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\nimport { analyzeBundle } from './analyze';\nimport { removeDeployer } from './plugins/remove-deployer';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { join } from 'node:path';\nimport { slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n platform: 'node' | 'browser',\n env: Record<string, string> = { 'process.env.NODE_ENV': JSON.stringify('production') },\n {\n sourcemap = false,\n isDev = false,\n projectRoot,\n workspaceRoot = undefined,\n enableEsmShim = true,\n }: {\n sourcemap?: boolean;\n isDev?: boolean;\n workspaceRoot?: string;\n projectRoot: string;\n enableEsmShim?: boolean;\n },\n): Promise<InputOptions> {\n let nodeResolvePlugin =\n platform === 'node'\n ? nodeResolve({\n preferBuiltins: true,\n exportConditions: ['node'],\n })\n : nodeResolve({\n preferBuiltins: false,\n browser: true,\n });\n\n const externalsCopy = new Set<string>();\n // make all nested imports external from the same package\n for (const external of analyzedBundleInfo.externalDependencies) {\n if (external.startsWith('@')) {\n const [scope, name] = external.split('/', 3);\n externalsCopy.add(`${scope}/${name}`);\n externalsCopy.add(`${scope}/${name}/*`);\n } else {\n externalsCopy.add(external);\n externalsCopy.add(`${external}/*`);\n }\n }\n\n const externals = Array.from(externalsCopy);\n\n const normalizedEntryFile = slash(entryFile);\n return {\n logLevel: process.env.MASTRA_BUNDLER_DEBUG === 'true' ? 'debug' : 'silent',\n treeshake: 'smallest',\n preserveSymlinks: true,\n external: externals,\n plugins: [\n {\n name: 'alias-optimized-deps',\n resolveId(id: string) {\n if (!analyzedBundleInfo.dependencies.has(id)) {\n return null;\n }\n\n const filename = analyzedBundleInfo.dependencies.get(id)!;\n const absolutePath = join(workspaceRoot || projectRoot, filename);\n\n // During `mastra dev` we want to keep deps as external\n if (isDev) {\n return {\n id: process.platform === 'win32' ? pathToFileURL(absolutePath).href : absolutePath,\n external: true,\n };\n }\n\n // For production builds return the absolute path as-is so Rollup can handle itself\n return {\n id: absolutePath,\n external: false,\n };\n },\n } satisfies Plugin,\n alias({\n entries: [\n {\n find: /^\\#server$/,\n replacement: slash(fileURLToPath(import.meta.resolve('@mastra/deployer/server'))),\n },\n {\n find: /^\\@mastra\\/server\\/(.*)/,\n replacement: `@mastra/server/$1`,\n customResolver: id => {\n if (id.startsWith('@mastra/server')) {\n return {\n id: fileURLToPath(import.meta.resolve(id)),\n };\n }\n },\n },\n { find: /^\\#mastra$/, replacement: normalizedEntryFile },\n ],\n }),\n tsConfigPaths(),\n {\n name: 'tools-rewriter',\n resolveId(id: string) {\n if (id === '#tools') {\n return {\n id: './tools.mjs',\n external: true,\n };\n }\n },\n } satisfies Plugin,\n esbuild({\n platform,\n define: env,\n }),\n optimizeLodashImports({\n include: '**/*.{js,ts,mjs,cjs}',\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n transformMixedEsModules: true,\n esmExternals(id) {\n return externals.includes(id);\n },\n }),\n enableEsmShim ? esmShim() : undefined,\n nodeResolvePlugin,\n // for debugging\n // {\n // name: 'logger',\n // //@ts-ignore\n // resolveId(id, ...args) {\n // console.log({ id, args });\n // },\n // // @ts-ignore\n // transform(code, id) {\n // if (code.includes('class Duplexify ')) {\n // console.log({ duplex: id });\n // }\n // },\n // },\n json(),\n removeDeployer(entryFile, { sourcemap }),\n // treeshake unused imports\n esbuild({\n include: entryFile,\n platform,\n }),\n ].filter(Boolean),\n } satisfies InputOptions;\n}\n\nexport async function createBundler(\n inputOptions: InputOptions,\n outputOptions: Partial<OutputOptions> & { dir: string },\n) {\n const bundler = await rollup(inputOptions);\n\n return {\n write: () => {\n return bundler.write({\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n });\n },\n close: () => {\n return bundler.close();\n },\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { writeTelemetryConfig } from './chunk-
|
|
2
|
-
import { createBundler, getInputOptions } from './chunk-
|
|
3
|
-
import { analyzeBundle, getWorkspaceInformation, slash, getBundlerOptions, getPackageRootPath, esbuild } from './chunk-
|
|
1
|
+
import { writeTelemetryConfig } from './chunk-PKKDL5R4.js';
|
|
2
|
+
import { createBundler, getInputOptions } from './chunk-KI27F57F.js';
|
|
3
|
+
import { analyzeBundle, getWorkspaceInformation, slash, getBundlerOptions, getPackageRootPath, esbuild } from './chunk-D6C25KS4.js';
|
|
4
4
|
import { DepsService, FileService } from './chunk-5QFG6SCM.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { writeFile, stat } from 'fs/promises';
|
|
@@ -418,5 +418,5 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
418
418
|
};
|
|
419
419
|
|
|
420
420
|
export { Bundler };
|
|
421
|
-
//# sourceMappingURL=chunk-
|
|
422
|
-
//# sourceMappingURL=chunk-
|
|
421
|
+
//# sourceMappingURL=chunk-7QAMM6ZD.js.map
|
|
422
|
+
//# sourceMappingURL=chunk-7QAMM6ZD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/customInstrumentation.ts","../src/bundler/index.ts"],"names":["pkg"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAAS,+BAAA,CACd,WACA,MAAA,EAGA;AACA,EAAA,OAAO,MAAA,CAAO;AAAA,IACZ,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO;AAAA,MACL,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,SAAA,EAAW,KAAA;AAAA,IACX,OAAA,EAAS;AAAA;AAAA,MAEP,OAAA,EAAQ;AAAA,MACR,QAAA,CAAS;AAAA,QACP,UAAA,EAAY,CAAC,KAAA,EAAO,KAAK,CAAA;AAAA,QACzB,cAAA,EAAgB,QAAA;AAAA,QAChB,uBAAA,EAAyB,IAAA;AAAA,QACzB,cAAA,EAAgB;AAAA,OACjB;AAAA;AACH,GACD,CAAA;AACH;AAEA,eAAsB,0BAAA,CACpB,SAAA,EACA,SAAA,EACA,OAAA,GAEI,EAAC,EAIJ;AACD,EAAA,MAAM,MAAA,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,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,8BAA8B,CAAA;AAAA,IACjD,SAAS,KAAA,EAAO;AACd,MAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,MAAA,MAAM,IAAI,WAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,sCAAA;AAAA,UACJ,IAAA,EAAM,uCAAuC,OAAO,CAAA,CAAA;AAAA,UACpD,QAAQ,WAAA,CAAY,QAAA;AAAA,UACpB,UAAU,aAAA,CAAc;AAAA,SAC1B;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CAAK,UAAA,EAAoB,gBAAA,EAA0B,UAAA,EAAkD;AACzG,IAAA,MAAM,iBAAA,GAAoB,MAAM,IAAA,CAAK,oBAAA,CAAqB,UAAU,CAAA;AACpE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-URO47RYV.js","sourcesContent":["import { rollup } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport commonjs from '@rollup/plugin-commonjs';\n\nexport function getCustomInstrumentationBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n instrumentation: entryFile,\n },\n treeshake: false,\n plugins: [\n // transpile typescript to something we understand\n esbuild(),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n ],\n });\n}\n\nexport async function writeCustomInstrumentation(\n entryFile: string,\n outputDir: string,\n options: {\n sourcemap?: boolean;\n } = {},\n): Promise<{\n hasCustomConfig: boolean;\n externalDependencies: string[];\n}> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getCustomInstrumentationBundler(entryFile, result);\n\n const { output } = await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: options.sourcemap,\n });\n const externals = output[0].imports.filter(x => !x.startsWith('./'));\n\n return { ...result, externalDependencies: externals };\n}\n","import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\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 { writeCustomInstrumentation } from '../build/customInstrumentation';\nimport { writeTelemetryConfig } from '../build/telemetry';\nimport { getPackageRootPath, slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\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 writeInstrumentationFile(outputDirectory: string, customInstrumentationFile?: string) {\n const instrumentationFile = join(outputDirectory, 'instrumentation.mjs');\n const __dirname = dirname(fileURLToPath(import.meta.url));\n\n if (customInstrumentationFile) {\n await copy(customInstrumentationFile, instrumentationFile);\n } else {\n await copy(join(__dirname, 'templates', 'instrumentation-template.js'), instrumentationFile);\n }\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 // add telemetry dependencies\n dependenciesMap.set('@opentelemetry/core', '^2.0.1');\n dependenciesMap.set('@opentelemetry/api', '^1.9.0');\n dependenciesMap.set('@opentelemetry/auto-instrumentations-node', '^0.59.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-grpc', '^0.201.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-http', '^0.201.0');\n dependenciesMap.set('@opentelemetry/resources', '^2.0.1');\n dependenciesMap.set('@opentelemetry/sdk-node', '^0.201.0');\n dependenciesMap.set('@opentelemetry/sdk-trace-base', '^2.0.1');\n dependenciesMap.set('@opentelemetry/semantic-conventions', '^1.33.0');\n dependenciesMap.set('@opentelemetry/instrumentation', '^0.202.0');\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 --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./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 analyze(\n entry: string | string[],\n mastraFile: string,\n outputDirectory: string,\n { enableEsmShim = true }: { enableEsmShim?: boolean } = {},\n ) {\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 bundlerOptions: {\n enableEsmShim,\n },\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 = false, enableEsmShim = true }: { enableSourcemap?: boolean; enableEsmShim?: boolean } = {},\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 },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.getToolsInputOptions(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 getToolsInputOptions(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 }: { projectRoot: string; outputDirectory: string; enableEsmShim?: boolean },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n let sourcemap = false;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, analyzeDir);\n sourcemap = !!bundlerOptions?.sourcemap;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: 'node',\n bundlerOptions: {\n enableEsmShim,\n },\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 let externalDependencies: string[];\n try {\n const result = await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));\n\n externalDependencies = result?.externalDependencies ?? [];\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_TELEMETRY_FAILED',\n text: `Failed to write telemetry config: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const mastraFolder = dirname(mastraEntryFile);\n\n const fileService = new FileService();\n const customInstrumentation = fileService.getFirstExistingFileOrUndefined([\n join(mastraFolder, 'instrumentation.js'),\n join(mastraFolder, 'instrumentation.ts'),\n join(mastraFolder, 'instrumentation.mjs'),\n ]);\n\n try {\n if (customInstrumentation) {\n const result = await writeCustomInstrumentation(customInstrumentation, join(outputDirectory, this.outputDir), {\n sourcemap,\n });\n externalDependencies = [...externalDependencies, ...result.externalDependencies];\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir), customInstrumentation);\n } else {\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_INSTRUMENTATION_FILE_FAILED',\n text: `Failed to write instrumentation file: ${message}, ${customInstrumentation ? ` Found custom instrumentation file: ${customInstrumentation}` : ''}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n\n // Add extenal dependencies from telemetry file\n for (const external of externalDependencies) {\n dependenciesToInstall.set(external, 'latest');\n }\n\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\n dependenciesToInstall.set(dep, pkg.version || 'latest');\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 const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n { enableSourcemap: sourcemap, enableEsmShim },\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,\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.getToolsInputOptions(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"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/customInstrumentation.ts","../src/bundler/index.ts"],"names":["pkg"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAAS,+BAAA,CACd,WACA,MAAA,EAGA;AACA,EAAA,OAAO,MAAA,CAAO;AAAA,IACZ,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO;AAAA,MACL,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,SAAA,EAAW,KAAA;AAAA,IACX,OAAA,EAAS;AAAA;AAAA,MAEP,OAAA,EAAQ;AAAA,MACR,QAAA,CAAS;AAAA,QACP,UAAA,EAAY,CAAC,KAAA,EAAO,KAAK,CAAA;AAAA,QACzB,cAAA,EAAgB,QAAA;AAAA,QAChB,uBAAA,EAAyB,IAAA;AAAA,QACzB,cAAA,EAAgB;AAAA,OACjB;AAAA;AACH,GACD,CAAA;AACH;AAEA,eAAsB,0BAAA,CACpB,SAAA,EACA,SAAA,EACA,OAAA,GAEI,EAAC,EAIJ;AACD,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,eAAA,EAAiB;AAAA,GACnB;AAEA,EAAA,MAAM,MAAA,GAAS,MAAM,+BAAA,CAAgC,SAAiB,CAAA;AAEtE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,MAAM,OAAO,KAAA,CAAM;AAAA,IACpC,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB,YAAA;AAAA,IAChB,WAAW,OAAA,CAAQ;AAAA,GACpB,CAAA;AACD,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,MAAA,CAAO,C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AAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CAAK,UAAA,EAAoB,gBAAA,EAA0B,UAAA,EAAkD;AACzG,IAAA,MAAM,iBAAA,GAAoB,MAAM,IAAA,CAAK,oBAAA,CAAqB,UAAU,CAAA;AACpE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-7QAMM6ZD.js","sourcesContent":["import { rollup } from 'rollup';\nimport { esbuild } from './plugins/esbuild';\nimport commonjs from '@rollup/plugin-commonjs';\n\nexport function getCustomInstrumentationBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n instrumentation: entryFile,\n },\n treeshake: false,\n plugins: [\n // transpile typescript to something we understand\n esbuild(),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n ],\n });\n}\n\nexport async function writeCustomInstrumentation(\n entryFile: string,\n outputDir: string,\n options: {\n sourcemap?: boolean;\n } = {},\n): Promise<{\n hasCustomConfig: boolean;\n externalDependencies: string[];\n}> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getCustomInstrumentationBundler(entryFile, result);\n\n const { output } = await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: options.sourcemap,\n });\n const externals = output[0].imports.filter(x => !x.startsWith('./'));\n\n return { ...result, externalDependencies: externals };\n}\n","import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\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 { writeCustomInstrumentation } from '../build/customInstrumentation';\nimport { writeTelemetryConfig } from '../build/telemetry';\nimport { getPackageRootPath, slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport { getWorkspaceInformation } from './workspaceDependencies';\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 writeInstrumentationFile(outputDirectory: string, customInstrumentationFile?: string) {\n const instrumentationFile = join(outputDirectory, 'instrumentation.mjs');\n const __dirname = dirname(fileURLToPath(import.meta.url));\n\n if (customInstrumentationFile) {\n await copy(customInstrumentationFile, instrumentationFile);\n } else {\n await copy(join(__dirname, 'templates', 'instrumentation-template.js'), instrumentationFile);\n }\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 // add telemetry dependencies\n dependenciesMap.set('@opentelemetry/core', '^2.0.1');\n dependenciesMap.set('@opentelemetry/api', '^1.9.0');\n dependenciesMap.set('@opentelemetry/auto-instrumentations-node', '^0.59.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-grpc', '^0.201.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-http', '^0.201.0');\n dependenciesMap.set('@opentelemetry/resources', '^2.0.1');\n dependenciesMap.set('@opentelemetry/sdk-node', '^0.201.0');\n dependenciesMap.set('@opentelemetry/sdk-trace-base', '^2.0.1');\n dependenciesMap.set('@opentelemetry/semantic-conventions', '^1.33.0');\n dependenciesMap.set('@opentelemetry/instrumentation', '^0.202.0');\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 --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./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 analyze(\n entry: string | string[],\n mastraFile: string,\n outputDirectory: string,\n { enableEsmShim = true }: { enableEsmShim?: boolean } = {},\n ) {\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 bundlerOptions: {\n enableEsmShim,\n },\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 = false, enableEsmShim = true }: { enableSourcemap?: boolean; enableEsmShim?: boolean } = {},\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 },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.getToolsInputOptions(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 getToolsInputOptions(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 }: { projectRoot: string; outputDirectory: string; enableEsmShim?: boolean },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n let sourcemap = false;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, analyzeDir);\n sourcemap = !!bundlerOptions?.sourcemap;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: 'node',\n bundlerOptions: {\n enableEsmShim,\n },\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 let externalDependencies: string[];\n try {\n const result = await writeTelemetryConfig(mastraEntryFile, join(outputDirectory, this.outputDir));\n\n externalDependencies = result?.externalDependencies ?? [];\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_TELEMETRY_FAILED',\n text: `Failed to write telemetry config: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const mastraFolder = dirname(mastraEntryFile);\n\n const fileService = new FileService();\n const customInstrumentation = fileService.getFirstExistingFileOrUndefined([\n join(mastraFolder, 'instrumentation.js'),\n join(mastraFolder, 'instrumentation.ts'),\n join(mastraFolder, 'instrumentation.mjs'),\n ]);\n\n try {\n if (customInstrumentation) {\n const result = await writeCustomInstrumentation(customInstrumentation, join(outputDirectory, this.outputDir), {\n sourcemap,\n });\n externalDependencies = [...externalDependencies, ...result.externalDependencies];\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir), customInstrumentation);\n } else {\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_INSTRUMENTATION_FILE_FAILED',\n text: `Failed to write instrumentation file: ${message}, ${customInstrumentation ? ` Found custom instrumentation file: ${customInstrumentation}` : ''}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n\n // Add extenal dependencies from telemetry file\n for (const external of externalDependencies) {\n dependenciesToInstall.set(external, 'latest');\n }\n\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\n dependenciesToInstall.set(dep, pkg.version || 'latest');\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 const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n { enableSourcemap: sourcemap, enableEsmShim },\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,\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.getToolsInputOptions(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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4KA7G7H5_cjs = require('./chunk-4KA7G7H5.cjs');
|
|
4
|
+
var chunkCVJ35R7W_cjs = require('./chunk-CVJ35R7W.cjs');
|
|
5
5
|
var rollup = require('rollup');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var pkg = require('empathic/package');
|
|
@@ -80,7 +80,7 @@ function nodeModulesExtensionResolver() {
|
|
|
80
80
|
for (const ext of [".mjs", ".js", ".cjs"]) {
|
|
81
81
|
const resolved2 = safeResolve(id + ext, importer);
|
|
82
82
|
if (resolved2) {
|
|
83
|
-
const pkgName =
|
|
83
|
+
const pkgName = chunkCVJ35R7W_cjs.getPackageName(id);
|
|
84
84
|
if (!pkgName) {
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
@@ -102,9 +102,9 @@ function nodeModulesExtensionResolver() {
|
|
|
102
102
|
}
|
|
103
103
|
async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
|
|
104
104
|
const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(entryFile) });
|
|
105
|
-
const projectRoot = closestPkgJson ? path.dirname(
|
|
106
|
-
const { workspaceMap, workspaceRoot } = await
|
|
107
|
-
const analyzeEntryResult = await
|
|
105
|
+
const projectRoot = closestPkgJson ? path.dirname(chunkCVJ35R7W_cjs.slash(closestPkgJson)) : chunkCVJ35R7W_cjs.slash(process.cwd());
|
|
106
|
+
const { workspaceMap, workspaceRoot } = await chunkCVJ35R7W_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
|
|
107
|
+
const analyzeEntryResult = await chunkCVJ35R7W_cjs.analyzeBundle(
|
|
108
108
|
[entryFile],
|
|
109
109
|
entryFile,
|
|
110
110
|
{
|
|
@@ -117,12 +117,12 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
117
117
|
);
|
|
118
118
|
const deps = /* @__PURE__ */ new Map();
|
|
119
119
|
for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {
|
|
120
|
-
const pkgName =
|
|
120
|
+
const pkgName = chunkCVJ35R7W_cjs.getPackageName(dep);
|
|
121
121
|
if (pkgName && workspaceMap.has(pkgName)) {
|
|
122
122
|
deps.set(dep, metadata);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const inputOptions = await
|
|
125
|
+
const inputOptions = await chunk4KA7G7H5_cjs.getInputOptions(
|
|
126
126
|
entryFile,
|
|
127
127
|
{
|
|
128
128
|
dependencies: deps,
|
|
@@ -141,7 +141,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
141
141
|
}
|
|
142
142
|
if (plugin?.name === "tsconfig-paths") {
|
|
143
143
|
plugins.push(
|
|
144
|
-
|
|
144
|
+
chunkCVJ35R7W_cjs.tsConfigPaths({
|
|
145
145
|
localResolve: true
|
|
146
146
|
})
|
|
147
147
|
);
|
|
@@ -150,7 +150,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false }
|
|
|
150
150
|
plugins.push(plugin);
|
|
151
151
|
});
|
|
152
152
|
inputOptions.plugins = plugins;
|
|
153
|
-
inputOptions.plugins.push(
|
|
153
|
+
inputOptions.plugins.push(chunkCVJ35R7W_cjs.aliasHono());
|
|
154
154
|
inputOptions.plugins.push(nodeModulesExtensionResolver());
|
|
155
155
|
}
|
|
156
156
|
return inputOptions;
|
|
@@ -170,12 +170,12 @@ async function createWatcher(inputOptions, outputOptions) {
|
|
|
170
170
|
|
|
171
171
|
// src/build/babel/remove-all-options-server.ts
|
|
172
172
|
function removeAllOptionsExceptServer(result, logger) {
|
|
173
|
-
return
|
|
173
|
+
return chunkCVJ35R7W_cjs.removeAllOptionsFromMastraExcept(result, "server", logger);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// src/build/serverOptions.ts
|
|
177
177
|
async function getServerOptions(entryFile, outputDir, logger) {
|
|
178
|
-
const result = await
|
|
178
|
+
const result = await chunkCVJ35R7W_cjs.extractMastraOption(
|
|
179
179
|
"server",
|
|
180
180
|
entryFile,
|
|
181
181
|
removeAllOptionsExceptServer,
|
|
@@ -191,5 +191,5 @@ async function getServerOptions(entryFile, outputDir, logger) {
|
|
|
191
191
|
exports.createWatcher = createWatcher;
|
|
192
192
|
exports.getInputOptions = getInputOptions2;
|
|
193
193
|
exports.getServerOptions = getServerOptions;
|
|
194
|
-
//# sourceMappingURL=chunk-
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-CAOUHPIR.cjs.map
|
|
195
|
+
//# sourceMappingURL=chunk-CAOUHPIR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","pathToFileURL","resolved","getPackageName","dirname","getInputOptions","pkg","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACEA,uBAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5BA,uBAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,SAAS,WAAA,CAAY,IAAY,QAAA,EAAkB;AACjD,EAAA,IAAI;AACF,IAAA,OAAOC,4BAAA,CAAY,UAAU,EAAE,CAAA;AAAA,EACjC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,4BAAA,GAAuC;AACrD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,iCAAA;AAAA,IACN,SAAA,CAAU,IAAI,QAAA,EAAU;AAEtB,MAAA,IAAI,EAAA,CAAG,WAAW,GAAG,CAAA,IAAK,GAAG,UAAA,CAAW,GAAG,CAAA,IAAK,CAAC,QAAA,EAAU;AACzD,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAA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YAAA,CAAa,OAAA,GAAU,OAAA;AACvB,IAAA,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAKC,2BAAA,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,MAAMC,YAAA,CAAM;AAAA,IAC1B,GAAG,YAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,aAAA;AAAA,MACH,MAAA,EAAQ,KAAA;AAAA,MACR,cAAA,EAAgB,YAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACD,CAAA;AAED,EAAA,OAAO,OAAA;AACT;;;ACjGO,SAAS,4BAAA,CAA6B,QAAsC,MAAA,EAAwB;AACzG,EAAA,OAAOC,kDAAA,CAAiC,MAAA,EAAQ,QAAA,EAAU,MAAM,CAAA;AAClE;;;ACSA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAMC,qCAAA;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,4BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-Z546LAA6.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, 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<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","pathToFileURL","resolved","getPackageName","dirname","getInputOptions","pkg","slash","getWorkspaceInformation","analyzeBundle","posix","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","extractMastraOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,gBAA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,OAAOC,kDAAA,CAAiC,MAAA,EAAQ,QAAA,EAAU,MAAM,CAAA;AAClE;;;ACSA,eAAsB,gBAAA,CACpB,SAAA,EACA,SAAA,EACA,MAAA,EACkC;AAClC,EAAA,MAAM,SAAS,MAAMC,qCAAA;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,4BAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,SAAA,EAAU;AAC1B","file":"chunk-CAOUHPIR.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport { pathToFileURL } from 'node:url';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\nimport { getPackageName } from '../utils';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: pathToFileURL(resolved).href,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: pathToFileURL(newImportWithExtension).href,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { dirname, posix } from 'node:path';\nimport * as pkg from 'empathic/package';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { noopLogger } from '@mastra/core/logger';\nimport { getWorkspaceInformation } from '../bundler/workspaceDependencies';\nimport { analyzeBundle } from './analyze';\nimport { getPackageName, slash } from './utils';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false }: { sourcemap?: boolean } = {},\n) {\n const closestPkgJson = pkg.up({ cwd: dirname(entryFile) });\n const projectRoot = closestPkgJson ? dirname(slash(closestPkgJson)) : slash(process.cwd());\n const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: entryFile });\n\n const analyzeEntryResult = await analyzeBundle(\n [entryFile],\n entryFile,\n {\n outputDir: posix.join(process.cwd(), '.mastra', '.build'),\n projectRoot: workspaceRoot || process.cwd(),\n platform: 'node',\n isDev: true,\n },\n noopLogger,\n );\n\n const deps = /* @__PURE__ */ new Map();\n for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {\n const pkgName = getPackageName(dep);\n if (pkgName && workspaceMap.has(pkgName)) {\n deps.set(dep, metadata);\n }\n }\n\n // In `analyzeBundle` we output this file and we want to use that instead of the original entry file\n //const analyzedEntryFile = posix.join(process.cwd(), '.mastra', '.build', 'entry-0.mjs');\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies: deps,\n externalDependencies: new Set(),\n workspaceMap,\n },\n platform,\n env,\n { sourcemap, isDev: true, workspaceRoot, projectRoot },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }, logger?: IMastraLogger) {\n return removeAllOptionsFromMastraExcept(result, 'server', logger);\n}\n","import { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport type { Config } from '@mastra/core/mastra';\nimport { extractMastraOption, extractMastraOptionBundler } from './shared/extract-mastra-option';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return extractMastraOptionBundler('server', entryFile, removeAllOptionsExceptServer, 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<Config['server']>(\n 'server',\n entryFile,\n removeAllOptionsExceptServer,\n outputDir,\n logger,\n );\n if (!result) {\n return null;\n }\n\n return result.getConfig();\n}\n"]}
|