@mastra/deployer 0.10.0 → 0.10.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/dist/_tsup-dts-rollup.d.cts +15 -1
- package/dist/_tsup-dts-rollup.d.ts +15 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/index.cjs +12 -8
- package/dist/build/index.d.cts +1 -0
- package/dist/build/index.d.ts +1 -0
- package/dist/build/index.js +3 -3
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-U5VNUAES.js → chunk-5ZQI6XPC.js} +1 -2
- package/dist/{chunk-YU2QBGOU.js → chunk-DGNRILK6.js} +21 -17
- package/dist/chunk-O3VM5GJZ.js +99 -0
- package/dist/{chunk-HHZDRBPV.cjs → chunk-OJY5LJPT.cjs} +258 -8
- package/dist/{chunk-BQAYAQTU.cjs → chunk-PJB6TDF7.cjs} +25 -21
- package/dist/{chunk-EHPJDSR3.js → chunk-W46BY5GT.js} +237 -8
- package/dist/chunk-WK63QOD5.cjs +125 -0
- package/dist/{chunk-WHD7NHLX.cjs → chunk-YHCVXGZM.cjs} +4 -5
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +98 -11
- package/dist/server/index.js +99 -12
- package/package.json +5 -4
- package/dist/chunk-3R6WDRBB.cjs +0 -255
- package/dist/chunk-TUMXQX4H.js +0 -228
|
@@ -329,6 +329,14 @@ export declare function getAgentExecutionHandler(c: Context): Promise<Response>;
|
|
|
329
329
|
|
|
330
330
|
export declare function getAgentsHandler(c: Context): Promise<Response & TypedResponse<any, ContentfulStatusCode, "json">>;
|
|
331
331
|
|
|
332
|
+
declare function getBundlerOptions(entryFile: string, outputDir: string): Promise<Config['bundler'] | null>;
|
|
333
|
+
export { getBundlerOptions }
|
|
334
|
+
export { getBundlerOptions as getBundlerOptions_alias_1 }
|
|
335
|
+
|
|
336
|
+
export declare function getBundlerOptionsBundler(entryFile: string, result: {
|
|
337
|
+
hasCustomConfig: false;
|
|
338
|
+
}): Promise<RollupBuild>;
|
|
339
|
+
|
|
332
340
|
declare function getDeployer(entryFile: string, outputDir: string): Promise<MastraDeployer | undefined>;
|
|
333
341
|
export { getDeployer }
|
|
334
342
|
export { getDeployer as getDeployer_alias_1 }
|
|
@@ -651,6 +659,10 @@ export declare function recursiveRemoveNonReferencedNodes(code: string): Promise
|
|
|
651
659
|
|
|
652
660
|
export declare function removeAllExceptDeployer(): babel_2.PluginObj;
|
|
653
661
|
|
|
662
|
+
export declare function removeAllOptionsExceptBundler(result: {
|
|
663
|
+
hasCustomConfig: boolean;
|
|
664
|
+
}): PluginObj<PluginPass>;
|
|
665
|
+
|
|
654
666
|
export declare function removeAllOptionsExceptServer(result: {
|
|
655
667
|
hasCustomConfig: boolean;
|
|
656
668
|
}): PluginObj<PluginPass>;
|
|
@@ -661,7 +673,7 @@ export declare function removeAllOptionsExceptTelemetry(result: {
|
|
|
661
673
|
|
|
662
674
|
export declare function removeAllOptionsFromMastraExcept(result: {
|
|
663
675
|
hasCustomConfig: boolean;
|
|
664
|
-
}, option: 'telemetry' | 'server'): babel_2.PluginObj;
|
|
676
|
+
}, option: 'telemetry' | 'server' | 'bundler'): babel_2.PluginObj;
|
|
665
677
|
|
|
666
678
|
export declare function removeDeployer(): babel_2.PluginObj;
|
|
667
679
|
|
|
@@ -715,6 +727,8 @@ export declare function streamGenerateHandler(c: Context): Promise<Response | un
|
|
|
715
727
|
|
|
716
728
|
export declare function streamGenerateHandler_alias_1(c: Context): Promise<Response | undefined>;
|
|
717
729
|
|
|
730
|
+
export declare function streamWorkflowHandler(c: Context): Promise<Response>;
|
|
731
|
+
|
|
718
732
|
declare type TransitiveDependencyResult = {
|
|
719
733
|
resolutions: Record<string, string>;
|
|
720
734
|
usedWorkspacePackages: Set<string>;
|
|
@@ -329,6 +329,14 @@ export declare function getAgentExecutionHandler(c: Context): Promise<Response>;
|
|
|
329
329
|
|
|
330
330
|
export declare function getAgentsHandler(c: Context): Promise<Response & TypedResponse<any, ContentfulStatusCode, "json">>;
|
|
331
331
|
|
|
332
|
+
declare function getBundlerOptions(entryFile: string, outputDir: string): Promise<Config['bundler'] | null>;
|
|
333
|
+
export { getBundlerOptions }
|
|
334
|
+
export { getBundlerOptions as getBundlerOptions_alias_1 }
|
|
335
|
+
|
|
336
|
+
export declare function getBundlerOptionsBundler(entryFile: string, result: {
|
|
337
|
+
hasCustomConfig: false;
|
|
338
|
+
}): Promise<RollupBuild>;
|
|
339
|
+
|
|
332
340
|
declare function getDeployer(entryFile: string, outputDir: string): Promise<MastraDeployer | undefined>;
|
|
333
341
|
export { getDeployer }
|
|
334
342
|
export { getDeployer as getDeployer_alias_1 }
|
|
@@ -651,6 +659,10 @@ export declare function recursiveRemoveNonReferencedNodes(code: string): Promise
|
|
|
651
659
|
|
|
652
660
|
export declare function removeAllExceptDeployer(): babel_2.PluginObj;
|
|
653
661
|
|
|
662
|
+
export declare function removeAllOptionsExceptBundler(result: {
|
|
663
|
+
hasCustomConfig: boolean;
|
|
664
|
+
}): PluginObj<PluginPass>;
|
|
665
|
+
|
|
654
666
|
export declare function removeAllOptionsExceptServer(result: {
|
|
655
667
|
hasCustomConfig: boolean;
|
|
656
668
|
}): PluginObj<PluginPass>;
|
|
@@ -661,7 +673,7 @@ export declare function removeAllOptionsExceptTelemetry(result: {
|
|
|
661
673
|
|
|
662
674
|
export declare function removeAllOptionsFromMastraExcept(result: {
|
|
663
675
|
hasCustomConfig: boolean;
|
|
664
|
-
}, option: 'telemetry' | 'server'): babel_2.PluginObj;
|
|
676
|
+
}, option: 'telemetry' | 'server' | 'bundler'): babel_2.PluginObj;
|
|
665
677
|
|
|
666
678
|
export declare function removeDeployer(): babel_2.PluginObj;
|
|
667
679
|
|
|
@@ -715,6 +727,8 @@ export declare function streamGenerateHandler(c: Context): Promise<Response | un
|
|
|
715
727
|
|
|
716
728
|
export declare function streamGenerateHandler_alias_1(c: Context): Promise<Response | undefined>;
|
|
717
729
|
|
|
730
|
+
export declare function streamWorkflowHandler(c: Context): Promise<Response>;
|
|
731
|
+
|
|
718
732
|
declare type TransitiveDependencyResult = {
|
|
719
733
|
resolutions: Record<string, string>;
|
|
720
734
|
usedWorkspacePackages: Set<string>;
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOJY5LJPT_cjs = require('../chunk-OJY5LJPT.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 chunkOJY5LJPT_cjs.analyzeBundle; }
|
|
10
10
|
});
|
package/dist/build/analyze.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { analyzeBundle } from '../chunk-
|
|
1
|
+
export { analyzeBundle } from '../chunk-W46BY5GT.js';
|
package/dist/build/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYHCVXGZM_cjs = require('../chunk-YHCVXGZM.cjs');
|
|
4
|
+
var chunkWK63QOD5_cjs = require('../chunk-WK63QOD5.cjs');
|
|
5
|
+
var chunkOJY5LJPT_cjs = require('../chunk-OJY5LJPT.cjs');
|
|
6
6
|
var chunkIMGVLBV7_cjs = require('../chunk-IMGVLBV7.cjs');
|
|
7
7
|
var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
|
|
8
8
|
|
|
@@ -10,23 +10,27 @@ var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "createWatcher", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkYHCVXGZM_cjs.createWatcher; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getServerOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkYHCVXGZM_cjs.getServerOptions; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkYHCVXGZM_cjs.getInputOptions; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "writeTelemetryConfig", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkWK63QOD5_cjs.writeTelemetryConfig; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkOJY5LJPT_cjs.analyzeBundle; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "getBundlerOptions", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkOJY5LJPT_cjs.getBundlerOptions; }
|
|
30
34
|
});
|
|
31
35
|
Object.defineProperty(exports, "createBundler", {
|
|
32
36
|
enumerable: true,
|
package/dist/build/index.d.cts
CHANGED
|
@@ -7,3 +7,4 @@ export { FileService_alias_1 as FileService } from '../_tsup-dts-rollup.cjs';
|
|
|
7
7
|
export { Deps_alias_1 as Deps } from '../_tsup-dts-rollup.cjs';
|
|
8
8
|
export { writeTelemetryConfig } from '../_tsup-dts-rollup.cjs';
|
|
9
9
|
export { getServerOptions } from '../_tsup-dts-rollup.cjs';
|
|
10
|
+
export { getBundlerOptions_alias_1 as getBundlerOptions } from '../_tsup-dts-rollup.cjs';
|
package/dist/build/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { FileService_alias_1 as FileService } from '../_tsup-dts-rollup.js';
|
|
|
7
7
|
export { Deps_alias_1 as Deps } from '../_tsup-dts-rollup.js';
|
|
8
8
|
export { writeTelemetryConfig } from '../_tsup-dts-rollup.js';
|
|
9
9
|
export { getServerOptions } from '../_tsup-dts-rollup.js';
|
|
10
|
+
export { getBundlerOptions_alias_1 as getBundlerOptions } from '../_tsup-dts-rollup.js';
|
package/dist/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
2
|
-
export { writeTelemetryConfig } from '../chunk-
|
|
3
|
-
export { analyzeBundle } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-5ZQI6XPC.js';
|
|
2
|
+
export { writeTelemetryConfig } from '../chunk-O3VM5GJZ.js';
|
|
3
|
+
export { analyzeBundle, getBundlerOptions } from '../chunk-W46BY5GT.js';
|
|
4
4
|
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-AOSWYZKN.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-UV4RQQ3R.js';
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPJB6TDF7_cjs = require('../chunk-PJB6TDF7.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 chunkPJB6TDF7_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-DGNRILK6.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-
|
|
2
|
-
import { aliasHono } from './chunk-EHPJDSR3.js';
|
|
1
|
+
import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-W46BY5GT.js';
|
|
3
2
|
import { getInputOptions } from './chunk-AOSWYZKN.js';
|
|
4
3
|
import { tsConfigPaths } from './chunk-WVBUOQT6.js';
|
|
5
4
|
import { watch, rollup } from 'rollup';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { writeTelemetryConfig } from './chunk-
|
|
2
|
-
import { analyzeBundle } from './chunk-
|
|
1
|
+
import { writeTelemetryConfig } from './chunk-O3VM5GJZ.js';
|
|
2
|
+
import { analyzeBundle } from './chunk-W46BY5GT.js';
|
|
3
3
|
import { createBundler, getInputOptions } from './chunk-AOSWYZKN.js';
|
|
4
4
|
import { DepsService, FileService } from './chunk-UV4RQQ3R.js';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
@@ -9,6 +9,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
9
|
import { MastraBundler } from '@mastra/core/bundler';
|
|
10
10
|
import virtual from '@rollup/plugin-virtual';
|
|
11
11
|
import fsExtra, { emptyDir, ensureDir, copy, readJSON } from 'fs-extra/esm';
|
|
12
|
+
import { globby } from 'globby';
|
|
12
13
|
import resolveFrom from 'resolve-from';
|
|
13
14
|
import slugify from '@sindresorhus/slugify';
|
|
14
15
|
import { findWorkspaces, findWorkspacesRoot } from 'find-workspaces';
|
|
@@ -203,22 +204,25 @@ var Bundler = class extends MastraBundler {
|
|
|
203
204
|
async getToolsInputOptions(toolsPaths) {
|
|
204
205
|
const inputs = {};
|
|
205
206
|
for (const toolPath of toolsPaths) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
const expandedPaths = await globby(toolPath, {});
|
|
208
|
+
for (const path of expandedPaths) {
|
|
209
|
+
if (await fsExtra.pathExists(path)) {
|
|
210
|
+
const fileService = new FileService();
|
|
211
|
+
const entryFile = fileService.getFirstExistingFile([
|
|
212
|
+
join(path, "index.ts"),
|
|
213
|
+
join(path, "index.js"),
|
|
214
|
+
path
|
|
215
|
+
// if path itself is a file
|
|
216
|
+
]);
|
|
217
|
+
if (!entryFile || (await stat(entryFile)).isDirectory()) {
|
|
218
|
+
this.logger.warn(`No entry file found in ${path}, skipping...`);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const uniqueToolID = crypto.randomUUID();
|
|
222
|
+
inputs[`tools/${uniqueToolID}`] = entryFile;
|
|
223
|
+
} else {
|
|
224
|
+
this.logger.warn(`Tool path ${path} does not exist, skipping...`);
|
|
217
225
|
}
|
|
218
|
-
const uniqueToolID = crypto.randomUUID();
|
|
219
|
-
inputs[`tools/${uniqueToolID}`] = entryFile;
|
|
220
|
-
} else {
|
|
221
|
-
this.logger.warn(`Tool path ${toolPath} does not exist, skipping...`);
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
return inputs;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-W46BY5GT.js';
|
|
2
|
+
import * as babel from '@babel/core';
|
|
3
|
+
import { rollup } from 'rollup';
|
|
4
|
+
import esbuild from 'rollup-plugin-esbuild';
|
|
5
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
+
|
|
7
|
+
// src/build/babel/remove-all-options-telemetry.ts
|
|
8
|
+
function removeAllOptionsExceptTelemetry(result) {
|
|
9
|
+
return removeAllOptionsFromMastraExcept(result, "telemetry");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/build/telemetry.ts
|
|
13
|
+
function getTelemetryBundler(entryFile, result) {
|
|
14
|
+
return rollup({
|
|
15
|
+
logLevel: "silent",
|
|
16
|
+
input: {
|
|
17
|
+
"telemetry-config": entryFile
|
|
18
|
+
},
|
|
19
|
+
treeshake: "smallest",
|
|
20
|
+
plugins: [
|
|
21
|
+
// transpile typescript to something we understand
|
|
22
|
+
esbuild({
|
|
23
|
+
target: "node20",
|
|
24
|
+
platform: "node",
|
|
25
|
+
minify: false
|
|
26
|
+
}),
|
|
27
|
+
commonjs({
|
|
28
|
+
extensions: [".js", ".ts"],
|
|
29
|
+
strictRequires: "strict",
|
|
30
|
+
transformMixedEsModules: true,
|
|
31
|
+
ignoreTryCatch: false
|
|
32
|
+
}),
|
|
33
|
+
{
|
|
34
|
+
name: "get-telemetry-config",
|
|
35
|
+
transform(code, id) {
|
|
36
|
+
if (id !== entryFile) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
babel.transform(
|
|
41
|
+
code,
|
|
42
|
+
{
|
|
43
|
+
babelrc: false,
|
|
44
|
+
configFile: false,
|
|
45
|
+
filename: id,
|
|
46
|
+
plugins: [removeAllOptionsExceptTelemetry(result)]
|
|
47
|
+
},
|
|
48
|
+
(err, result2) => {
|
|
49
|
+
if (err) {
|
|
50
|
+
return reject(err);
|
|
51
|
+
}
|
|
52
|
+
resolve({
|
|
53
|
+
code: result2.code,
|
|
54
|
+
map: result2.map
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
// let esbuild remove all unused imports
|
|
62
|
+
esbuild({
|
|
63
|
+
target: "node20",
|
|
64
|
+
platform: "node",
|
|
65
|
+
minify: false
|
|
66
|
+
}),
|
|
67
|
+
{
|
|
68
|
+
name: "cleanup",
|
|
69
|
+
transform(code, id) {
|
|
70
|
+
if (id !== entryFile) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
return recursiveRemoveNonReferencedNodes(code);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
// let esbuild remove all unused imports
|
|
77
|
+
esbuild({
|
|
78
|
+
target: "node20",
|
|
79
|
+
platform: "node",
|
|
80
|
+
minify: false
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async function writeTelemetryConfig(entryFile, outputDir) {
|
|
86
|
+
const result = {
|
|
87
|
+
hasCustomConfig: false
|
|
88
|
+
};
|
|
89
|
+
const bundle = await getTelemetryBundler(entryFile, result);
|
|
90
|
+
const { output } = await bundle.write({
|
|
91
|
+
dir: outputDir,
|
|
92
|
+
format: "es",
|
|
93
|
+
entryFileNames: "[name].mjs"
|
|
94
|
+
});
|
|
95
|
+
const externals = output[0].imports.filter((x) => !x.startsWith("./"));
|
|
96
|
+
return { ...result, externalDependencies: externals };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { writeTelemetryConfig };
|