@mastra/deployer 1.33.0 → 1.33.1-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 +18 -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 +15 -15
- package/dist/build/index.js +5 -5
- package/dist/build/utils.d.ts +1 -0
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-QTRSKNOJ.cjs → chunk-3T7FP546.cjs} +3 -2
- package/dist/chunk-3T7FP546.cjs.map +1 -0
- package/dist/{chunk-623NUWWK.js → chunk-4SSB2KSK.js} +3 -2
- package/dist/chunk-4SSB2KSK.js.map +1 -0
- package/dist/{chunk-D5QDTUSF.cjs → chunk-5TILMGJA.cjs} +49 -49
- package/dist/{chunk-D5QDTUSF.cjs.map → chunk-5TILMGJA.cjs.map} +1 -1
- package/dist/{chunk-BGHYAAUQ.cjs → chunk-AQL6MQFJ.cjs} +18 -18
- package/dist/{chunk-BGHYAAUQ.cjs.map → chunk-AQL6MQFJ.cjs.map} +1 -1
- package/dist/{chunk-R45J7TDH.js → chunk-FXJXKXAV.js} +3 -3
- package/dist/{chunk-R45J7TDH.js.map → chunk-FXJXKXAV.js.map} +1 -1
- package/dist/{chunk-4KIRQ3MQ.js → chunk-ISGGMBYN.js} +7 -7
- package/dist/{chunk-4KIRQ3MQ.js.map → chunk-ISGGMBYN.js.map} +1 -1
- package/dist/{chunk-5CIZPQD7.js → chunk-KAY3R5QX.js} +3 -3
- package/dist/{chunk-5CIZPQD7.js.map → chunk-KAY3R5QX.js.map} +1 -1
- package/dist/{chunk-7OOWEFCB.cjs → chunk-KBVOYAAL.cjs} +7 -7
- package/dist/{chunk-7OOWEFCB.cjs.map → chunk-KBVOYAAL.cjs.map} +1 -1
- package/dist/{chunk-AEFF4KNF.js → chunk-KTL22PW6.js} +7 -7
- package/dist/{chunk-AEFF4KNF.js.map → chunk-KTL22PW6.js.map} +1 -1
- package/dist/{chunk-36O25PW6.cjs → chunk-RJXYP6DA.cjs} +17 -17
- package/dist/{chunk-36O25PW6.cjs.map → chunk-RJXYP6DA.cjs.map} +1 -1
- package/dist/{chunk-QJIDGPHH.cjs → chunk-XABHWJ5U.cjs} +16 -16
- package/dist/{chunk-QJIDGPHH.cjs.map → chunk-XABHWJ5U.cjs.map} +1 -1
- package/dist/{chunk-WRKEX2X3.js → chunk-YHEVEEDG.js} +4 -4
- package/dist/{chunk-WRKEX2X3.js.map → chunk-YHEVEEDG.js.map} +1 -1
- package/dist/{chunk-4WS47OHX.cjs → chunk-YW7AIVNG.cjs} +5 -5
- package/dist/{chunk-4WS47OHX.cjs.map → chunk-YW7AIVNG.cjs.map} +1 -1
- package/dist/{chunk-MLMAPMI3.js → chunk-ZUJ4DO5D.js} +4 -4
- package/dist/{chunk-MLMAPMI3.js.map → chunk-ZUJ4DO5D.js.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 +1 -1
- package/dist/docs/references/docs-deployment-overview.md +6 -5
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +6 -4
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/dist/validator/custom-resolver.cjs +3 -3
- package/dist/validator/custom-resolver.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-623NUWWK.js.map +0 -1
- package/dist/chunk-QTRSKNOJ.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 1.33.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Make the playground/Studio chat runtime opt into the agent-signals streaming path (`sendSignal` + `subscribeToThread`) via the `MASTRA_AGENT_SIGNALS` environment variable. When unset (the default), Studio falls back to the existing `streamUntilIdle` route — this restores the pre-signals behavior while issues with tool approvals and dropped signal/UI messages are fixed. ([#16551](https://github.com/mastra-ai/mastra/pull/16551))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`3e63fca`](https://github.com/mastra-ai/mastra/commit/3e63fca7aa41269b2a9518effdd09b8ab8f1ff04), [`bc386e0`](https://github.com/mastra-ai/mastra/commit/bc386e08249dd30f3e66cf59de0c151a8dc26afb)]:
|
|
10
|
+
- @mastra/core@1.33.1-alpha.1
|
|
11
|
+
- @mastra/server@1.33.1-alpha.1
|
|
12
|
+
|
|
13
|
+
## 1.33.1-alpha.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`6ba46dc`](https://github.com/mastra-ai/mastra/commit/6ba46dc1ac04af635d0f59377d7384ca6af44cd1)]:
|
|
18
|
+
- @mastra/core@1.33.1-alpha.0
|
|
19
|
+
- @mastra/server@1.33.1-alpha.0
|
|
20
|
+
|
|
3
21
|
## 1.33.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5TILMGJA_cjs = require('../chunk-5TILMGJA.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 chunk5TILMGJA_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 chunkAQL6MQFJ_cjs = require('../chunk-AQL6MQFJ.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 chunkAQL6MQFJ_cjs.createBundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getInputOptions", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkAQL6MQFJ_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,41 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkXABHWJ5U_cjs = require('../chunk-XABHWJ5U.cjs');
|
|
4
|
+
var chunkKBVOYAAL_cjs = require('../chunk-KBVOYAAL.cjs');
|
|
5
|
+
var chunk5TILMGJA_cjs = require('../chunk-5TILMGJA.cjs');
|
|
6
|
+
var chunkAQL6MQFJ_cjs = require('../chunk-AQL6MQFJ.cjs');
|
|
7
7
|
var chunkQJGW77MV_cjs = require('../chunk-QJGW77MV.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunk3T7FP546_cjs = require('../chunk-3T7FP546.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "createWatcher", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkXABHWJ5U_cjs.createWatcher; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "getServerOptions", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkXABHWJ5U_cjs.getServerOptions; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkXABHWJ5U_cjs.getInputOptions; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkKBVOYAAL_cjs.getBundlerOptions; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk5TILMGJA_cjs.analyzeBundle; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "createBundler", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkAQL6MQFJ_cjs.createBundler; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "getBundlerInputOptions", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkAQL6MQFJ_cjs.getInputOptions; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "Deps", {
|
|
41
41
|
enumerable: true,
|
|
@@ -47,15 +47,15 @@ Object.defineProperty(exports, "FileService", {
|
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "detectRuntime", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk3T7FP546_cjs.detectRuntime; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "injectStudioHtmlConfig", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk3T7FP546_cjs.injectStudioHtmlConfig; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "normalizeStudioBase", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunk3T7FP546_cjs.normalizeStudioBase; }
|
|
59
59
|
});
|
|
60
60
|
//# sourceMappingURL=index.cjs.map
|
|
61
61
|
//# sourceMappingURL=index.cjs.map
|
package/dist/build/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-KTL22PW6.js';
|
|
2
|
+
export { getBundlerOptions } from '../chunk-FXJXKXAV.js';
|
|
3
|
+
export { analyzeBundle } from '../chunk-ZUJ4DO5D.js';
|
|
4
|
+
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-YHEVEEDG.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-I7JM5EHU.js';
|
|
6
|
-
export { detectRuntime, injectStudioHtmlConfig, normalizeStudioBase } from '../chunk-
|
|
6
|
+
export { detectRuntime, injectStudioHtmlConfig, normalizeStudioBase } from '../chunk-4SSB2KSK.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/build/utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/build/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E,kDAAkD;A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MAAM,GAAG,OAAO,CAM1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAkBhE"}
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRJXYP6DA_cjs = require('../chunk-RJXYP6DA.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 chunkRJXYP6DA_cjs.Bundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "IS_DEFAULT", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkRJXYP6DA_cjs.IS_DEFAULT; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=index.cjs.map
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
package/dist/bundler/index.js
CHANGED
|
@@ -105,6 +105,7 @@ function injectStudioHtmlConfig(html, config) {
|
|
|
105
105
|
html = html.replace(`'%%MASTRA_TELEMETRY_DISABLED%%'`, config.telemetryDisabled);
|
|
106
106
|
html = html.replace(`'%%MASTRA_REQUEST_CONTEXT_PRESETS%%'`, config.requestContextPresets);
|
|
107
107
|
html = html.replace(`'%%MASTRA_EXPERIMENTAL_UI%%'`, config.experimentalUI);
|
|
108
|
+
html = html.replace(`'%%MASTRA_AGENT_SIGNALS%%'`, config.agentSignals);
|
|
108
109
|
if (config.autoDetectUrl) {
|
|
109
110
|
html = html.replace(`'%%MASTRA_AUTO_DETECT_URL%%'`, config.autoDetectUrl);
|
|
110
111
|
}
|
|
@@ -142,5 +143,5 @@ exports.isExternalProtocolImport = isExternalProtocolImport;
|
|
|
142
143
|
exports.normalizeStudioBase = normalizeStudioBase;
|
|
143
144
|
exports.rollupSafeName = rollupSafeName;
|
|
144
145
|
exports.slash = slash;
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-3T7FP546.cjs.map
|
|
147
|
+
//# sourceMappingURL=chunk-3T7FP546.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build/utils.ts"],"names":["join","relative","basename","builtinModules"],"mappings":";;;;;;AA0BO,SAAS,sBAAsB,QAAA,EAAqD;AACzF,EAAA,IAAI,aAAa,SAAA,EAAW;AAC1B,IAAA,OAAO;AAAA,MACL,cAAA,EAAgB,KAAA;AAAA,MAChB,OAAA,EAAS,IAAA;AAAA,MACT,gBAAA,EAAkB,CAAC,SAAA,EAAW,QAAA,EAAU,SAAS;AAAA,KACnD;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,cAAA,EAAgB,IAAA;AAAA,IAChB,gBAAA,EAAkB,CAAC,MAAM;AAAA,GAC3B;AACF;AASO,SAAS,aAAA,GAAiC;AAC/C,EAAA,IAAI,OAAA,CAAQ,UAAU,GAAA,EAAK;AACzB,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA;AACT;AAWO,SAAS,yBAAA,CAA0B,KAAa,WAAA,EAAqB;AAC1E,EAAA,IAAI,QAAQ,WAAA,EAAa;AACvB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,GAAA,CAAI,UAAA,CAAW,CAAA,EAAG,WAAW,CAAA,CAAA,CAAG,CAAA;AACzC;AAKO,SAAS,eAAe,EAAA,EAAY;AACzC,EAAA,MAAM,KAAA,GAAQ,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA;AAE1B,EAAA,IAAI,EAAA,CAAG,UAAA,CAAW,GAAG,CAAA,EAAG;AACtB,IAAA,OAAO,MAAM,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CAAE,KAAK,GAAG,CAAA;AAAA,EAC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A,GAAO,IAAA,CAAK,OAAA,CAAQ,CAAA,4BAAA,CAAA,EAAgC,MAAA,CAAO,cAAc,CAAA;AACzE,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,CAAA,0BAAA,CAAA,EAA8B,MAAA,CAAO,YAAY,CAAA;AACrE,EAAA,IAAI,OAAO,aAAA,EAAe;AACxB,IAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,CAAA,4BAAA,CAAA,EAAgC,MAAA,CAAO,aAAa,CAAA;AAAA,EAC1E;AACA,EAAA,IAAA,GAAO,IAAA,CAAK,UAAA,CAAW,6BAAA,EAA+B,MAAA,CAAO,QAAQ,CAAA;AAErE,EAAA,OAAO,IAAA;AACT;AAOO,SAAS,gBAAgB,SAAA,EAA4B;AAC1D,EAAA,OACEC,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;AAMO,SAAS,sBAAsB,SAAA,EAA4B;AAChE,EAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,UAAA,CAAW,GAAG,CAAA,EAAG;AAC3C,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,yBAAA,CAA0B,SAAS,CAAA,IAAK,uBAAA,CAAwB,SAAS,CAAA,EAAG;AAC9E,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAA,CAAgB,SAAS,CAAA,EAAG;AAC9B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,wBAAA,CAAyB,SAAS,CAAA,EAAG;AACvC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA;AACT","file":"chunk-3T7FP546.cjs","sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { builtinModules } from 'node:module';\nimport { basename, join, relative } from 'node:path';\nimport type { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';\n\n/** The detected JavaScript runtime environment */\nexport type RuntimePlatform = 'node' | 'bun';\n\n/**\n * The esbuild/bundler platform setting.\n * - 'node': Assumes Node.js environment, externalizes built-in modules\n * - 'browser': Assumes browser environment, polyfills Node APIs\n * - 'neutral': Runtime-agnostic, preserves all globals as-is (used for Bun)\n */\nexport type BundlerPlatform = 'node' | 'browser' | 'neutral';\n\n/**\n * Get nodeResolve plugin options based on the target platform.\n *\n * For 'browser' platform (e.g., Cloudflare Workers), uses browser-compatible\n * export conditions so packages like the Cloudflare SDK resolve to their\n * web runtime instead of Node.js-specific code.\n *\n * For 'node' and 'neutral' (Bun) platforms, uses Node.js module resolution.\n */\nexport function getNodeResolveOptions(platform: BundlerPlatform): RollupNodeResolveOptions {\n if (platform === 'browser') {\n return {\n preferBuiltins: false,\n browser: true,\n exportConditions: ['browser', 'worker', 'default'],\n };\n }\n return {\n preferBuiltins: true,\n exportConditions: ['node'],\n };\n}\n\n/**\n * Detect the current JavaScript runtime environment.\n *\n * This is used by the bundler to determine the appropriate esbuild platform\n * setting. When running under Bun, we need to use 'neutral' platform to\n * preserve Bun-specific globals (like Bun.s3).\n */\nexport function detectRuntime(): RuntimePlatform {\n if (process.versions?.bun) {\n return 'bun';\n }\n return 'node';\n}\n\nexport function upsertMastraDir({ dir = process.cwd() }: { dir?: string }) {\n const dirPath = join(dir, '.mastra');\n\n if (!existsSync(dirPath)) {\n mkdirSync(dirPath, { recursive: true });\n execSync(`echo \".mastra\" >> .gitignore`);\n }\n}\n\nexport function isDependencyPartOfPackage(dep: string, packageName: string) {\n if (dep === packageName) {\n return true;\n }\n\n return dep.startsWith(`${packageName}/`);\n}\n\n/**\n * Get the package name from a module ID\n */\nexport function getPackageName(id: string) {\n const parts = id.split('/');\n\n if (id.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n return parts[0];\n}\n\n/**\n * Check if an import specifier uses a protocol scheme rather than a package name.\n * Examples: `cloudflare:workers`, `data:text/javascript,...`, `node:fs`.\n */\nexport function hasImportProtocol(specifier: string): boolean {\n // Avoid treating Windows absolute paths like `C:\\foo` as protocol imports.\n if (/^[A-Za-z]:[\\\\/]/.test(specifier)) {\n return false;\n }\n\n return /^[A-Za-z][A-Za-z\\d+.-]*:/.test(specifier);\n}\n\nconst DEFAULT_PROTOCOL_IMPORT_EXCLUDE_LIST = ['node:'] as const;\n\n/**\n * Check if a specifier uses a non-builtin protocol that should be preserved at\n * runtime instead of being treated as an installable dependency.\n */\nexport function isExternalProtocolImport(\n specifier: string,\n excludeList: readonly string[] = DEFAULT_PROTOCOL_IMPORT_EXCLUDE_LIST,\n): boolean {\n if (!hasImportProtocol(specifier)) {\n return false;\n }\n\n return !excludeList.some(prefix => specifier.startsWith(prefix));\n}\n\nfunction isRelativeImportSpecifier(specifier: string): boolean {\n return specifier === '.' || specifier === '..' || specifier.startsWith('./') || specifier.startsWith('../');\n}\n\nfunction isAbsolutePathSpecifier(specifier: string): boolean {\n return specifier.startsWith('/') || specifier.startsWith('\\\\\\\\') || /^[A-Za-z]:[\\\\/]/.test(specifier);\n}\n\n/**\n * During `mastra dev` we are compiling TS files to JS (inside workspaces) so that users can just their workspace packages.\n * We store these compiled files inside `node_modules/.cache` for each workspace package.\n */\nexport function getCompiledDepCachePath(rootPath: string, packageName: string) {\n return slash(join(rootPath, 'node_modules', '.cache', packageName));\n}\n\n/**\n * Convert windows backslashes to posix slashes\n *\n * @example\n * ```ts\n * slash('C:\\\\Users\\\\user\\\\code\\\\mastra') // 'C:/Users/user/code/mastra'\n * ```\n */\nexport function slash(path: string) {\n const isExtendedLengthPath = path.startsWith('\\\\\\\\?\\\\');\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll('\\\\', '/');\n}\n\n/**\n * Make a Rollup-safe name: pathless, POSIX, and without parent/absolute segments\n */\nexport function rollupSafeName(name: string, rootDir: string) {\n const rel = relative(rootDir, name);\n let entry = slash(rel);\n entry = entry.replace(/^(\\.\\.\\/)+/, '');\n entry = entry.replace(/^\\/+/, '');\n entry = entry.replace(/^[A-Za-z]:\\//, '');\n if (!entry) {\n entry = slash(basename(name));\n }\n return entry;\n}\n\n/**\n * Native binding loaders and infrastructure packages that should be ignored when identifying the actual package that requires native bindings\n */\nconst NATIVE_BINDING_LOADERS = [\n 'node-gyp-build',\n 'prebuild-install',\n 'bindings',\n 'node-addon-api',\n 'node-pre-gyp',\n 'nan', // Native Abstractions for Node.js\n] as const;\n\n/**\n * Finds the first real package from node_modules that likely contains native bindings, filtering out virtual modules and native binding loader infrastructure.\n *\n * @param moduleIds - Array of module IDs from a Rollup chunk\n * @returns The module ID of the actual native package, or undefined if not found\n *\n * @example\n * const moduleIds = [\n * '\\x00/path/node_modules/bcrypt/bcrypt.js?commonjs-module',\n * '/path/node_modules/node-gyp-build/index.js',\n * '/path/node_modules/bcrypt/bcrypt.js',\n * ];\n * findNativePackageModule(moduleIds); // Returns '/path/node_modules/bcrypt/bcrypt.js'\n */\nexport function findNativePackageModule(moduleIds: string[]): string | undefined {\n return moduleIds.find(id => {\n // Skip virtual modules (Rollup plugin-generated)\n if (id.startsWith('\\x00')) {\n return false;\n }\n\n // Must be from node_modules\n if (!id.includes('/node_modules/')) {\n return false;\n }\n\n // Skip native binding loader infrastructure\n for (const loader of NATIVE_BINDING_LOADERS) {\n if (id.includes(`/${loader}/`) || id.includes(`/${loader}@`)) {\n return false;\n }\n }\n\n return true;\n });\n}\n\n/**\n * Ensures that server.studioBase is normalized:\n * - Adds leading slash if missing (e.g., 'admin' → '/admin')\n * - Removes trailing slashes (e.g., '/admin/' → '/admin')\n * - Normalizes multiple slashes to single slash (e.g., '//api' → '/api')\n * - Returns empty string for root paths ('/' or '')\n *\n * @param studioBase - The studioBase path to normalize\n * @returns Normalized studioBase path string\n * @throws Error if path contains invalid characters ('..', '?', '#')\n */\nexport function normalizeStudioBase(studioBase: string): string {\n studioBase = studioBase.trim();\n\n // Validate: no path traversal, no query params, no special chars\n if (studioBase.includes('..') || studioBase.includes('?') || studioBase.includes('#')) {\n throw new Error(`Invalid base path: \"${studioBase}\". Base path cannot contain '..', '?', or '#'`);\n }\n\n // Normalize multiple slashes to single slash\n studioBase = studioBase.replace(/\\/+/g, '/');\n\n // Handle default value cases\n if (studioBase === '/' || studioBase === '') {\n return '';\n }\n\n // Remove trailing slash\n if (studioBase.endsWith('/')) {\n studioBase = studioBase.slice(0, -1);\n }\n\n // Add leading slash if missing\n if (!studioBase.startsWith('/')) {\n studioBase = `/${studioBase}`;\n }\n\n return studioBase;\n}\n\n/**\n * Configuration values for Studio's index.html placeholder injection.\n *\n * Each value is the **exact JavaScript expression** that replaces the\n * corresponding `'%%PLACEHOLDER%%'` token (including surrounding quotes).\n *\n * For literal strings pass `\"'value'\"` (quoted).\n * For runtime expressions pass the raw JS, e.g. `\"window.location.hostname\"`.\n */\nexport interface StudioInjectionConfig {\n host: string;\n port: string;\n protocol: string;\n apiPrefix: string;\n basePath: string;\n hideCloudCta: string;\n cloudApiEndpoint: string;\n experimentalFeatures: string;\n templates: string;\n telemetryDisabled: string;\n requestContextPresets: string;\n experimentalUI: string;\n agentSignals: string;\n autoDetectUrl?: string;\n}\n\n/**\n * Replace all `%%MASTRA_*%%` placeholders in the Studio `index.html` with the\n * supplied configuration values.\n *\n * The `<base href>` tag and the `window.MASTRA_STUDIO_BASE_PATH` assignment\n * use `basePath` as a plain string (no surrounding quotes), while all other\n * placeholders replace `'%%TOKEN%%'` (with surrounding single-quotes in the\n * source HTML) with the provided expression verbatim.\n */\nexport function injectStudioHtmlConfig(html: string, config: StudioInjectionConfig): string {\n html = html.replace(`'%%MASTRA_SERVER_HOST%%'`, config.host);\n html = html.replace(`'%%MASTRA_SERVER_PORT%%'`, config.port);\n html = html.replace(`'%%MASTRA_SERVER_PROTOCOL%%'`, config.protocol);\n html = html.replace(`'%%MASTRA_API_PREFIX%%'`, config.apiPrefix);\n html = html.replace(`'%%MASTRA_HIDE_CLOUD_CTA%%'`, config.hideCloudCta);\n html = html.replace(`'%%MASTRA_CLOUD_API_ENDPOINT%%'`, config.cloudApiEndpoint);\n html = html.replace(`'%%MASTRA_EXPERIMENTAL_FEATURES%%'`, config.experimentalFeatures);\n html = html.replace(`'%%MASTRA_TEMPLATES%%'`, config.templates);\n html = html.replace(`'%%MASTRA_TELEMETRY_DISABLED%%'`, config.telemetryDisabled);\n html = html.replace(`'%%MASTRA_REQUEST_CONTEXT_PRESETS%%'`, config.requestContextPresets);\n html = html.replace(`'%%MASTRA_EXPERIMENTAL_UI%%'`, config.experimentalUI);\n html = html.replace(`'%%MASTRA_AGENT_SIGNALS%%'`, config.agentSignals);\n if (config.autoDetectUrl) {\n html = html.replace(`'%%MASTRA_AUTO_DETECT_URL%%'`, config.autoDetectUrl);\n }\n html = html.replaceAll('%%MASTRA_STUDIO_BASE_PATH%%', config.basePath);\n\n return html;\n}\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 */\nexport function isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\n/**\n * Check whether a module specifier is a bare module import rather than a path,\n * virtual module, or Node builtin.\n */\nexport function isBareModuleSpecifier(specifier: string): boolean {\n if (!specifier || specifier.startsWith('#')) {\n return false;\n }\n\n if (isRelativeImportSpecifier(specifier) || isAbsolutePathSpecifier(specifier)) {\n return false;\n }\n\n if (isBuiltinModule(specifier)) {\n return false;\n }\n\n if (isExternalProtocolImport(specifier)) {\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -103,6 +103,7 @@ function injectStudioHtmlConfig(html, config) {
|
|
|
103
103
|
html = html.replace(`'%%MASTRA_TELEMETRY_DISABLED%%'`, config.telemetryDisabled);
|
|
104
104
|
html = html.replace(`'%%MASTRA_REQUEST_CONTEXT_PRESETS%%'`, config.requestContextPresets);
|
|
105
105
|
html = html.replace(`'%%MASTRA_EXPERIMENTAL_UI%%'`, config.experimentalUI);
|
|
106
|
+
html = html.replace(`'%%MASTRA_AGENT_SIGNALS%%'`, config.agentSignals);
|
|
106
107
|
if (config.autoDetectUrl) {
|
|
107
108
|
html = html.replace(`'%%MASTRA_AUTO_DETECT_URL%%'`, config.autoDetectUrl);
|
|
108
109
|
}
|
|
@@ -129,5 +130,5 @@ function isBareModuleSpecifier(specifier) {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
export { detectRuntime, getCompiledDepCachePath, getNodeResolveOptions, getPackageName, injectStudioHtmlConfig, isBareModuleSpecifier, isBuiltinModule, isDependencyPartOfPackage, isExternalProtocolImport, normalizeStudioBase, rollupSafeName, slash };
|
|
132
|
-
//# sourceMappingURL=chunk-
|
|
133
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-4SSB2KSK.js.map
|
|
134
|
+
//# sourceMappingURL=chunk-4SSB2KSK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build/utils.ts"],"names":[],"mappings":";;;;AA0BO,SAAS,sBAAsB,QAAA,EAAqD;AACzF,EAAA,IAAI,aAAa,SAAA,EAAW;AAC1B,IAAA,OAAO;AAAA,MACL,cAAA,EAAgB,KAAA;AAAA,MAChB,OAAA,EAAS,IAAA;AAAA,MACT,gBAAA,EAAkB,CAAC,SAAA,EAAW,QAAA,EAAU,SAAS;AAAA,KACnD;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,cAAA,EAAgB,IAAA;AAAA,IAChB,gBAAA,EAAkB,CAAC,MAAM;AAAA,GAC3B;AACF;AASO,SAAS,aAAA,GAAiC;AAC/C,EAAA,IAAI,OAAA,CAAQ,UAAU,GAAA,EAAK;AACzB,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA;AACT;AAWO,SAAS,yBAAA,CAA0B,KAAa,WAAA,EAA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EA,EAAA,IAAI,yBAAA,CAA0B,SAAS,CAAA,IAAK,uBAAA,CAAwB,SAAS,CAAA,EAAG;AAC9E,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAA,CAAgB,SAAS,CAAA,EAAG;AAC9B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,wBAAA,CAAyB,SAAS,CAAA,EAAG;AACvC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA;AACT","file":"chunk-4SSB2KSK.js","sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { builtinModules } from 'node:module';\nimport { basename, join, relative } from 'node:path';\nimport type { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';\n\n/** The detected JavaScript runtime environment */\nexport type RuntimePlatform = 'node' | 'bun';\n\n/**\n * The esbuild/bundler platform setting.\n * - 'node': Assumes Node.js environment, externalizes built-in modules\n * - 'browser': Assumes browser environment, polyfills Node APIs\n * - 'neutral': Runtime-agnostic, preserves all globals as-is (used for Bun)\n */\nexport type BundlerPlatform = 'node' | 'browser' | 'neutral';\n\n/**\n * Get nodeResolve plugin options based on the target platform.\n *\n * For 'browser' platform (e.g., Cloudflare Workers), uses browser-compatible\n * export conditions so packages like the Cloudflare SDK resolve to their\n * web runtime instead of Node.js-specific code.\n *\n * For 'node' and 'neutral' (Bun) platforms, uses Node.js module resolution.\n */\nexport function getNodeResolveOptions(platform: BundlerPlatform): RollupNodeResolveOptions {\n if (platform === 'browser') {\n return {\n preferBuiltins: false,\n browser: true,\n exportConditions: ['browser', 'worker', 'default'],\n };\n }\n return {\n preferBuiltins: true,\n exportConditions: ['node'],\n };\n}\n\n/**\n * Detect the current JavaScript runtime environment.\n *\n * This is used by the bundler to determine the appropriate esbuild platform\n * setting. When running under Bun, we need to use 'neutral' platform to\n * preserve Bun-specific globals (like Bun.s3).\n */\nexport function detectRuntime(): RuntimePlatform {\n if (process.versions?.bun) {\n return 'bun';\n }\n return 'node';\n}\n\nexport function upsertMastraDir({ dir = process.cwd() }: { dir?: string }) {\n const dirPath = join(dir, '.mastra');\n\n if (!existsSync(dirPath)) {\n mkdirSync(dirPath, { recursive: true });\n execSync(`echo \".mastra\" >> .gitignore`);\n }\n}\n\nexport function isDependencyPartOfPackage(dep: string, packageName: string) {\n if (dep === packageName) {\n return true;\n }\n\n return dep.startsWith(`${packageName}/`);\n}\n\n/**\n * Get the package name from a module ID\n */\nexport function getPackageName(id: string) {\n const parts = id.split('/');\n\n if (id.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n return parts[0];\n}\n\n/**\n * Check if an import specifier uses a protocol scheme rather than a package name.\n * Examples: `cloudflare:workers`, `data:text/javascript,...`, `node:fs`.\n */\nexport function hasImportProtocol(specifier: string): boolean {\n // Avoid treating Windows absolute paths like `C:\\foo` as protocol imports.\n if (/^[A-Za-z]:[\\\\/]/.test(specifier)) {\n return false;\n }\n\n return /^[A-Za-z][A-Za-z\\d+.-]*:/.test(specifier);\n}\n\nconst DEFAULT_PROTOCOL_IMPORT_EXCLUDE_LIST = ['node:'] as const;\n\n/**\n * Check if a specifier uses a non-builtin protocol that should be preserved at\n * runtime instead of being treated as an installable dependency.\n */\nexport function isExternalProtocolImport(\n specifier: string,\n excludeList: readonly string[] = DEFAULT_PROTOCOL_IMPORT_EXCLUDE_LIST,\n): boolean {\n if (!hasImportProtocol(specifier)) {\n return false;\n }\n\n return !excludeList.some(prefix => specifier.startsWith(prefix));\n}\n\nfunction isRelativeImportSpecifier(specifier: string): boolean {\n return specifier === '.' || specifier === '..' || specifier.startsWith('./') || specifier.startsWith('../');\n}\n\nfunction isAbsolutePathSpecifier(specifier: string): boolean {\n return specifier.startsWith('/') || specifier.startsWith('\\\\\\\\') || /^[A-Za-z]:[\\\\/]/.test(specifier);\n}\n\n/**\n * During `mastra dev` we are compiling TS files to JS (inside workspaces) so that users can just their workspace packages.\n * We store these compiled files inside `node_modules/.cache` for each workspace package.\n */\nexport function getCompiledDepCachePath(rootPath: string, packageName: string) {\n return slash(join(rootPath, 'node_modules', '.cache', packageName));\n}\n\n/**\n * Convert windows backslashes to posix slashes\n *\n * @example\n * ```ts\n * slash('C:\\\\Users\\\\user\\\\code\\\\mastra') // 'C:/Users/user/code/mastra'\n * ```\n */\nexport function slash(path: string) {\n const isExtendedLengthPath = path.startsWith('\\\\\\\\?\\\\');\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll('\\\\', '/');\n}\n\n/**\n * Make a Rollup-safe name: pathless, POSIX, and without parent/absolute segments\n */\nexport function rollupSafeName(name: string, rootDir: string) {\n const rel = relative(rootDir, name);\n let entry = slash(rel);\n entry = entry.replace(/^(\\.\\.\\/)+/, '');\n entry = entry.replace(/^\\/+/, '');\n entry = entry.replace(/^[A-Za-z]:\\//, '');\n if (!entry) {\n entry = slash(basename(name));\n }\n return entry;\n}\n\n/**\n * Native binding loaders and infrastructure packages that should be ignored when identifying the actual package that requires native bindings\n */\nconst NATIVE_BINDING_LOADERS = [\n 'node-gyp-build',\n 'prebuild-install',\n 'bindings',\n 'node-addon-api',\n 'node-pre-gyp',\n 'nan', // Native Abstractions for Node.js\n] as const;\n\n/**\n * Finds the first real package from node_modules that likely contains native bindings, filtering out virtual modules and native binding loader infrastructure.\n *\n * @param moduleIds - Array of module IDs from a Rollup chunk\n * @returns The module ID of the actual native package, or undefined if not found\n *\n * @example\n * const moduleIds = [\n * '\\x00/path/node_modules/bcrypt/bcrypt.js?commonjs-module',\n * '/path/node_modules/node-gyp-build/index.js',\n * '/path/node_modules/bcrypt/bcrypt.js',\n * ];\n * findNativePackageModule(moduleIds); // Returns '/path/node_modules/bcrypt/bcrypt.js'\n */\nexport function findNativePackageModule(moduleIds: string[]): string | undefined {\n return moduleIds.find(id => {\n // Skip virtual modules (Rollup plugin-generated)\n if (id.startsWith('\\x00')) {\n return false;\n }\n\n // Must be from node_modules\n if (!id.includes('/node_modules/')) {\n return false;\n }\n\n // Skip native binding loader infrastructure\n for (const loader of NATIVE_BINDING_LOADERS) {\n if (id.includes(`/${loader}/`) || id.includes(`/${loader}@`)) {\n return false;\n }\n }\n\n return true;\n });\n}\n\n/**\n * Ensures that server.studioBase is normalized:\n * - Adds leading slash if missing (e.g., 'admin' → '/admin')\n * - Removes trailing slashes (e.g., '/admin/' → '/admin')\n * - Normalizes multiple slashes to single slash (e.g., '//api' → '/api')\n * - Returns empty string for root paths ('/' or '')\n *\n * @param studioBase - The studioBase path to normalize\n * @returns Normalized studioBase path string\n * @throws Error if path contains invalid characters ('..', '?', '#')\n */\nexport function normalizeStudioBase(studioBase: string): string {\n studioBase = studioBase.trim();\n\n // Validate: no path traversal, no query params, no special chars\n if (studioBase.includes('..') || studioBase.includes('?') || studioBase.includes('#')) {\n throw new Error(`Invalid base path: \"${studioBase}\". Base path cannot contain '..', '?', or '#'`);\n }\n\n // Normalize multiple slashes to single slash\n studioBase = studioBase.replace(/\\/+/g, '/');\n\n // Handle default value cases\n if (studioBase === '/' || studioBase === '') {\n return '';\n }\n\n // Remove trailing slash\n if (studioBase.endsWith('/')) {\n studioBase = studioBase.slice(0, -1);\n }\n\n // Add leading slash if missing\n if (!studioBase.startsWith('/')) {\n studioBase = `/${studioBase}`;\n }\n\n return studioBase;\n}\n\n/**\n * Configuration values for Studio's index.html placeholder injection.\n *\n * Each value is the **exact JavaScript expression** that replaces the\n * corresponding `'%%PLACEHOLDER%%'` token (including surrounding quotes).\n *\n * For literal strings pass `\"'value'\"` (quoted).\n * For runtime expressions pass the raw JS, e.g. `\"window.location.hostname\"`.\n */\nexport interface StudioInjectionConfig {\n host: string;\n port: string;\n protocol: string;\n apiPrefix: string;\n basePath: string;\n hideCloudCta: string;\n cloudApiEndpoint: string;\n experimentalFeatures: string;\n templates: string;\n telemetryDisabled: string;\n requestContextPresets: string;\n experimentalUI: string;\n agentSignals: string;\n autoDetectUrl?: string;\n}\n\n/**\n * Replace all `%%MASTRA_*%%` placeholders in the Studio `index.html` with the\n * supplied configuration values.\n *\n * The `<base href>` tag and the `window.MASTRA_STUDIO_BASE_PATH` assignment\n * use `basePath` as a plain string (no surrounding quotes), while all other\n * placeholders replace `'%%TOKEN%%'` (with surrounding single-quotes in the\n * source HTML) with the provided expression verbatim.\n */\nexport function injectStudioHtmlConfig(html: string, config: StudioInjectionConfig): string {\n html = html.replace(`'%%MASTRA_SERVER_HOST%%'`, config.host);\n html = html.replace(`'%%MASTRA_SERVER_PORT%%'`, config.port);\n html = html.replace(`'%%MASTRA_SERVER_PROTOCOL%%'`, config.protocol);\n html = html.replace(`'%%MASTRA_API_PREFIX%%'`, config.apiPrefix);\n html = html.replace(`'%%MASTRA_HIDE_CLOUD_CTA%%'`, config.hideCloudCta);\n html = html.replace(`'%%MASTRA_CLOUD_API_ENDPOINT%%'`, config.cloudApiEndpoint);\n html = html.replace(`'%%MASTRA_EXPERIMENTAL_FEATURES%%'`, config.experimentalFeatures);\n html = html.replace(`'%%MASTRA_TEMPLATES%%'`, config.templates);\n html = html.replace(`'%%MASTRA_TELEMETRY_DISABLED%%'`, config.telemetryDisabled);\n html = html.replace(`'%%MASTRA_REQUEST_CONTEXT_PRESETS%%'`, config.requestContextPresets);\n html = html.replace(`'%%MASTRA_EXPERIMENTAL_UI%%'`, config.experimentalUI);\n html = html.replace(`'%%MASTRA_AGENT_SIGNALS%%'`, config.agentSignals);\n if (config.autoDetectUrl) {\n html = html.replace(`'%%MASTRA_AUTO_DETECT_URL%%'`, config.autoDetectUrl);\n }\n html = html.replaceAll('%%MASTRA_STUDIO_BASE_PATH%%', config.basePath);\n\n return html;\n}\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 */\nexport function isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\n/**\n * Check whether a module specifier is a bare module import rather than a path,\n * virtual module, or Node builtin.\n */\nexport function isBareModuleSpecifier(specifier: string): boolean {\n if (!specifier || specifier.startsWith('#')) {\n return false;\n }\n\n if (isRelativeImportSpecifier(specifier) || isAbsolutePathSpecifier(specifier)) {\n return false;\n }\n\n if (isBuiltinModule(specifier)) {\n return false;\n }\n\n if (isExternalProtocolImport(specifier)) {\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkYW7AIVNG_cjs = require('./chunk-YW7AIVNG.cjs');
|
|
4
|
+
var chunk3T7FP546_cjs = require('./chunk-3T7FP546.cjs');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var promises = require('fs/promises');
|
|
7
7
|
var path = require('path');
|
|
@@ -157,7 +157,7 @@ async function getWorkspaceInformation({
|
|
|
157
157
|
mastraEntryFile
|
|
158
158
|
}) {
|
|
159
159
|
const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(mastraEntryFile) });
|
|
160
|
-
const location = closestPkgJson ? path.dirname(
|
|
160
|
+
const location = closestPkgJson ? path.dirname(chunk3T7FP546_cjs.slash(closestPkgJson)) : chunk3T7FP546_cjs.slash(process.cwd());
|
|
161
161
|
const workspaces = await findWorkspaces.findWorkspaces(dir, { cache: workspacesCache });
|
|
162
162
|
const _workspaceMap = new Map(
|
|
163
163
|
workspaces?.map((workspace) => [
|
|
@@ -286,7 +286,7 @@ var DEPRECATED_EXTERNALS = ["fastembed", "nodemailer", "jsdom", "sqlite3"];
|
|
|
286
286
|
|
|
287
287
|
// src/build/analyze/analyzeEntry.ts
|
|
288
288
|
function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabled }) {
|
|
289
|
-
const normalizedMastraEntry =
|
|
289
|
+
const normalizedMastraEntry = chunk3T7FP546_cjs.slash(mastraEntry);
|
|
290
290
|
let virtualPlugin = null;
|
|
291
291
|
if (isVirtualFile) {
|
|
292
292
|
virtualPlugin = virtual__default.default({
|
|
@@ -300,13 +300,13 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
300
300
|
}
|
|
301
301
|
plugins.push(
|
|
302
302
|
...[
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
chunkYW7AIVNG_cjs.tsConfigPaths(),
|
|
304
|
+
chunkYW7AIVNG_cjs.protocolExternalResolver(),
|
|
305
305
|
{
|
|
306
306
|
name: "custom-alias-resolver",
|
|
307
307
|
resolveId(id) {
|
|
308
308
|
if (id === "#server") {
|
|
309
|
-
return
|
|
309
|
+
return chunk3T7FP546_cjs.slash(url.fileURLToPath(undefined("@mastra/deployer/server")));
|
|
310
310
|
}
|
|
311
311
|
if (id === "#mastra") {
|
|
312
312
|
return normalizedMastraEntry;
|
|
@@ -317,17 +317,17 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
319
|
json__default.default(),
|
|
320
|
-
|
|
320
|
+
chunkYW7AIVNG_cjs.esbuild(),
|
|
321
321
|
commonjs__default.default({
|
|
322
322
|
strictRequires: "debug",
|
|
323
323
|
ignoreTryCatch: false,
|
|
324
324
|
transformMixedEsModules: true,
|
|
325
325
|
extensions: [".js", ".ts"]
|
|
326
326
|
}),
|
|
327
|
-
|
|
327
|
+
chunkYW7AIVNG_cjs.removeDeployer(mastraEntry, {
|
|
328
328
|
sourcemap: sourcemapEnabled
|
|
329
329
|
}),
|
|
330
|
-
|
|
330
|
+
chunkYW7AIVNG_cjs.esbuild()
|
|
331
331
|
]
|
|
332
332
|
);
|
|
333
333
|
return plugins;
|
|
@@ -345,18 +345,18 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
345
345
|
}
|
|
346
346
|
let entryRootPath = projectRoot;
|
|
347
347
|
if (!output.facadeModuleId.startsWith("\0virtual:")) {
|
|
348
|
-
entryRootPath = await
|
|
348
|
+
entryRootPath = await chunkYW7AIVNG_cjs.getPackageRootPath(output.facadeModuleId) || projectRoot;
|
|
349
349
|
}
|
|
350
350
|
for (const [dependency, bindings] of Object.entries(output.importedBindings)) {
|
|
351
|
-
if (!
|
|
351
|
+
if (!chunk3T7FP546_cjs.isBareModuleSpecifier(dependency)) {
|
|
352
352
|
continue;
|
|
353
353
|
}
|
|
354
|
-
const pkgName =
|
|
354
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(dependency);
|
|
355
355
|
let rootPath = null;
|
|
356
356
|
let isWorkspace = false;
|
|
357
357
|
let version;
|
|
358
358
|
if (pkgName) {
|
|
359
|
-
rootPath = await
|
|
359
|
+
rootPath = await chunkYW7AIVNG_cjs.getPackageRootPath(dependency, entryRootPath);
|
|
360
360
|
isWorkspace = workspaceMap.has(pkgName);
|
|
361
361
|
if (rootPath) {
|
|
362
362
|
try {
|
|
@@ -366,7 +366,7 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
const normalizedRootPath = rootPath ?
|
|
369
|
+
const normalizedRootPath = rootPath ? chunk3T7FP546_cjs.slash(rootPath) : null;
|
|
370
370
|
depsToOptimize.set(dependency, {
|
|
371
371
|
exports: bindings,
|
|
372
372
|
rootPath: normalizedRootPath,
|
|
@@ -426,12 +426,12 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
426
426
|
const dynamicImports = output.dynamicImports.filter((d) => !DEPS_TO_IGNORE.includes(d));
|
|
427
427
|
if (dynamicImports.length) {
|
|
428
428
|
for (const dynamicImport of dynamicImports) {
|
|
429
|
-
if (!depsToOptimize.has(dynamicImport) &&
|
|
430
|
-
const pkgName =
|
|
429
|
+
if (!depsToOptimize.has(dynamicImport) && chunk3T7FP546_cjs.isBareModuleSpecifier(dynamicImport)) {
|
|
430
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(dynamicImport);
|
|
431
431
|
let version;
|
|
432
432
|
let rootPath = null;
|
|
433
433
|
if (pkgName) {
|
|
434
|
-
rootPath = await
|
|
434
|
+
rootPath = await chunkYW7AIVNG_cjs.getPackageRootPath(dynamicImport, entryRootPath);
|
|
435
435
|
if (rootPath) {
|
|
436
436
|
try {
|
|
437
437
|
const pkgJson = await esm.readJSON(`${rootPath}/package.json`);
|
|
@@ -442,7 +442,7 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
442
442
|
}
|
|
443
443
|
depsToOptimize.set(dynamicImport, {
|
|
444
444
|
exports: ["*"],
|
|
445
|
-
rootPath: rootPath ?
|
|
445
|
+
rootPath: rootPath ? chunk3T7FP546_cjs.slash(rootPath) : null,
|
|
446
446
|
isWorkspace: false,
|
|
447
447
|
version
|
|
448
448
|
});
|
|
@@ -464,7 +464,7 @@ async function analyzeEntry({
|
|
|
464
464
|
shouldCheckTransitiveDependencies = false,
|
|
465
465
|
analyzeCache
|
|
466
466
|
}) {
|
|
467
|
-
const cacheKey = isVirtualFile ? void 0 :
|
|
467
|
+
const cacheKey = isVirtualFile ? void 0 : chunk3T7FP546_cjs.slash(entry);
|
|
468
468
|
if (cacheKey && analyzeCache?.has(cacheKey)) {
|
|
469
469
|
return analyzeCache.get(cacheKey);
|
|
470
470
|
}
|
|
@@ -526,7 +526,7 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
526
526
|
}
|
|
527
527
|
for (const importedId of info.importedIds) {
|
|
528
528
|
for (const external of externals) {
|
|
529
|
-
if (
|
|
529
|
+
if (chunk3T7FP546_cjs.isDependencyPartOfPackage(importedId, external)) {
|
|
530
530
|
importMap.set(external, info.id);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -538,9 +538,9 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
538
538
|
if (chunk.type === "chunk") {
|
|
539
539
|
for (const [external, resolvedFrom] of importMap) {
|
|
540
540
|
if (chunk.moduleIds.includes(resolvedFrom)) {
|
|
541
|
-
const fullPath = url.pathToFileURL(
|
|
541
|
+
const fullPath = url.pathToFileURL(chunk3T7FP546_cjs.slash(path.join(projectRoot, fileName))).toString();
|
|
542
542
|
const innerMap = resolveMap.get(fullPath) || /* @__PURE__ */ new Map();
|
|
543
|
-
innerMap.set(external, url.pathToFileURL(
|
|
543
|
+
innerMap.set(external, url.pathToFileURL(chunk3T7FP546_cjs.slash(resolvedFrom)).toString());
|
|
544
544
|
resolveMap.set(fullPath, innerMap);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -606,7 +606,7 @@ function nodeGypDetector() {
|
|
|
606
606
|
|
|
607
607
|
// src/build/analyze/bundleExternals.ts
|
|
608
608
|
function prepareEntryFileName(name, rootDir) {
|
|
609
|
-
return
|
|
609
|
+
return chunk3T7FP546_cjs.rollupSafeName(name, rootDir);
|
|
610
610
|
}
|
|
611
611
|
function createVirtualDependencies(depsToOptimize, {
|
|
612
612
|
projectRoot,
|
|
@@ -656,7 +656,7 @@ function createVirtualDependencies(depsToOptimize, {
|
|
|
656
656
|
continue;
|
|
657
657
|
}
|
|
658
658
|
const fileName = posix.basename(currentDepPath.name);
|
|
659
|
-
const entryName = prepareEntryFileName(
|
|
659
|
+
const entryName = prepareEntryFileName(chunk3T7FP546_cjs.getCompiledDepCachePath(rootPath, fileName), rootDir);
|
|
660
660
|
fileNameToDependencyMap.set(entryName, dep);
|
|
661
661
|
optimizedDependencyEntries.set(dep, {
|
|
662
662
|
...currentDepPath,
|
|
@@ -676,9 +676,9 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
676
676
|
}) {
|
|
677
677
|
const transpilePackagesMap = /* @__PURE__ */ new Map();
|
|
678
678
|
for (const pkg2 of transpilePackages) {
|
|
679
|
-
const dir = await
|
|
679
|
+
const dir = await chunkYW7AIVNG_cjs.getPackageRootPath(pkg2);
|
|
680
680
|
if (dir) {
|
|
681
|
-
transpilePackagesMap.set(pkg2,
|
|
681
|
+
transpilePackagesMap.set(pkg2, chunk3T7FP546_cjs.slash(dir));
|
|
682
682
|
} else {
|
|
683
683
|
transpilePackagesMap.set(pkg2, workspaceMap.get(pkg2)?.location ?? pkg2);
|
|
684
684
|
}
|
|
@@ -693,10 +693,10 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
693
693
|
{}
|
|
694
694
|
)
|
|
695
695
|
),
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
transpilePackagesMap.size ?
|
|
696
|
+
chunkYW7AIVNG_cjs.tsConfigPaths(),
|
|
697
|
+
chunkYW7AIVNG_cjs.protocolExternalResolver(),
|
|
698
|
+
chunkYW7AIVNG_cjs.subpathExternalsResolver(externals),
|
|
699
|
+
transpilePackagesMap.size ? chunkYW7AIVNG_cjs.esbuild({
|
|
700
700
|
format: "esm",
|
|
701
701
|
include: [
|
|
702
702
|
// Match files from transpilePackages by their actual directory paths
|
|
@@ -751,8 +751,8 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
751
751
|
transformMixedEsModules: true,
|
|
752
752
|
ignoreTryCatch: false
|
|
753
753
|
}),
|
|
754
|
-
bundlerOptions.noBundling ? null : nodeResolve__default.default(
|
|
755
|
-
bundlerOptions.noBundling ?
|
|
754
|
+
bundlerOptions.noBundling ? null : nodeResolve__default.default(chunk3T7FP546_cjs.getNodeResolveOptions(platform)),
|
|
755
|
+
bundlerOptions.noBundling ? chunkYW7AIVNG_cjs.esmShim() : null,
|
|
756
756
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
757
757
|
aliasHono(),
|
|
758
758
|
json__default.default(),
|
|
@@ -845,9 +845,9 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
845
845
|
if (noBundling) {
|
|
846
846
|
const importedFromPackages = /* @__PURE__ */ new Set();
|
|
847
847
|
for (const moduleId of chunkInfo.moduleIds) {
|
|
848
|
-
const normalized =
|
|
848
|
+
const normalized = chunk3T7FP546_cjs.slash(moduleId);
|
|
849
849
|
for (const [pkgName, pkgInfo] of workspaceMap.entries()) {
|
|
850
|
-
const location =
|
|
850
|
+
const location = chunk3T7FP546_cjs.slash(pkgInfo.location);
|
|
851
851
|
if (normalized.startsWith(location)) {
|
|
852
852
|
importedFromPackages.add(pkgName);
|
|
853
853
|
break;
|
|
@@ -869,7 +869,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
869
869
|
if (importedFromPackages.size === 1) {
|
|
870
870
|
const [pkgName] = importedFromPackages;
|
|
871
871
|
const workspaceLocation = workspaceMap.get(pkgName).location;
|
|
872
|
-
return prepareEntryFileName(
|
|
872
|
+
return prepareEntryFileName(chunk3T7FP546_cjs.getCompiledDepCachePath(workspaceLocation, "[name].mjs"), rootDir);
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
return `${outputDirRelative}/[name].mjs`;
|
|
@@ -883,7 +883,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
883
883
|
function findExternalImporter(module, external, allOutputs) {
|
|
884
884
|
const capturedFiles = /* @__PURE__ */ new Set();
|
|
885
885
|
for (const id of module.imports) {
|
|
886
|
-
if (
|
|
886
|
+
if (chunk3T7FP546_cjs.isDependencyPartOfPackage(id, external)) {
|
|
887
887
|
return module;
|
|
888
888
|
} else {
|
|
889
889
|
if (id.endsWith(".mjs")) {
|
|
@@ -1284,10 +1284,10 @@ async function validateOutput({
|
|
|
1284
1284
|
};
|
|
1285
1285
|
for (const deps of Object.values(usedExternals)) {
|
|
1286
1286
|
for (const dep of Object.keys(deps)) {
|
|
1287
|
-
if (
|
|
1287
|
+
if (chunk3T7FP546_cjs.isExternalProtocolImport(dep)) {
|
|
1288
1288
|
continue;
|
|
1289
1289
|
}
|
|
1290
|
-
const pkgName =
|
|
1290
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(dep);
|
|
1291
1291
|
if (pkgName) {
|
|
1292
1292
|
const versionInfo = depsVersionInfo.get(dep) || depsVersionInfo.get(pkgName) || {};
|
|
1293
1293
|
result.externalDependencies.set(pkgName, versionInfo);
|
|
@@ -1370,9 +1370,9 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1370
1370
|
});
|
|
1371
1371
|
await promises.writeFile(path.join(outputDir, `entry-${index++}.mjs`), analyzeResult.output.code);
|
|
1372
1372
|
for (const [dep, metadata] of analyzeResult.dependencies.entries()) {
|
|
1373
|
-
const isPartOfExternals = allExternals.some((external) =>
|
|
1373
|
+
const isPartOfExternals = allExternals.some((external) => chunk3T7FP546_cjs.isDependencyPartOfPackage(dep, external));
|
|
1374
1374
|
if (isPartOfExternals || externalsPreset && !metadata.isWorkspace) {
|
|
1375
|
-
const pkgName =
|
|
1375
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(dep);
|
|
1376
1376
|
if (pkgName && !allUsedExternals.has(pkgName)) {
|
|
1377
1377
|
allUsedExternals.set(pkgName, {
|
|
1378
1378
|
version: metadata.version
|
|
@@ -1413,11 +1413,11 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1413
1413
|
platform
|
|
1414
1414
|
});
|
|
1415
1415
|
const relativeWorkspaceFolderPaths = Array.from(workspaceMap.values()).map(
|
|
1416
|
-
(pkgInfo) =>
|
|
1416
|
+
(pkgInfo) => chunk3T7FP546_cjs.slash(path.relative(workspaceRoot || projectRoot, pkgInfo.location))
|
|
1417
1417
|
);
|
|
1418
1418
|
const depsVersionInfo = /* @__PURE__ */ new Map();
|
|
1419
1419
|
for (const [dep, metadata] of depsToOptimize.entries()) {
|
|
1420
|
-
const pkgName =
|
|
1420
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(dep);
|
|
1421
1421
|
if (pkgName && metadata.version) {
|
|
1422
1422
|
depsVersionInfo.set(pkgName, {
|
|
1423
1423
|
version: metadata.version
|
|
@@ -1434,19 +1434,19 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1434
1434
|
continue;
|
|
1435
1435
|
}
|
|
1436
1436
|
for (const i of o.imports) {
|
|
1437
|
-
if (
|
|
1437
|
+
if (chunk3T7FP546_cjs.isBuiltinModule(i)) {
|
|
1438
1438
|
continue;
|
|
1439
1439
|
}
|
|
1440
1440
|
if (i.startsWith(".") || i.startsWith("/")) {
|
|
1441
1441
|
continue;
|
|
1442
1442
|
}
|
|
1443
|
-
if (!
|
|
1443
|
+
if (!chunk3T7FP546_cjs.isBareModuleSpecifier(i) || chunk3T7FP546_cjs.isExternalProtocolImport(i)) {
|
|
1444
1444
|
continue;
|
|
1445
1445
|
}
|
|
1446
1446
|
if (relativeWorkspaceFolderPaths.some((workspacePath) => i.startsWith(workspacePath))) {
|
|
1447
1447
|
continue;
|
|
1448
1448
|
}
|
|
1449
|
-
const pkgName =
|
|
1449
|
+
const pkgName = chunk3T7FP546_cjs.getPackageName(i);
|
|
1450
1450
|
if (pkgName && !allUsedExternals.has(pkgName)) {
|
|
1451
1451
|
const versionInfo = depsVersionInfo.get(i) || depsVersionInfo.get(pkgName) || {};
|
|
1452
1452
|
allUsedExternals.set(pkgName, versionInfo);
|
|
@@ -1467,7 +1467,7 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1467
1467
|
);
|
|
1468
1468
|
const mergedExternalDeps = new Map(result.externalDependencies);
|
|
1469
1469
|
for (const [dep, info] of allUsedExternals) {
|
|
1470
|
-
if (
|
|
1470
|
+
if (chunk3T7FP546_cjs.isExternalProtocolImport(dep)) {
|
|
1471
1471
|
continue;
|
|
1472
1472
|
}
|
|
1473
1473
|
const existing = mergedExternalDeps.get(dep);
|
|
@@ -1494,5 +1494,5 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1494
1494
|
exports.aliasHono = aliasHono;
|
|
1495
1495
|
exports.analyzeBundle = analyzeBundle;
|
|
1496
1496
|
exports.getWorkspaceInformation = getWorkspaceInformation;
|
|
1497
|
-
//# sourceMappingURL=chunk-
|
|
1498
|
-
//# sourceMappingURL=chunk-
|
|
1497
|
+
//# sourceMappingURL=chunk-5TILMGJA.cjs.map
|
|
1498
|
+
//# sourceMappingURL=chunk-5TILMGJA.cjs.map
|