@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
|
|
4
|
-
var
|
|
4
|
+
var commonjs2 = require('@rollup/plugin-commonjs');
|
|
5
5
|
var json = require('@rollup/plugin-json');
|
|
6
6
|
var nodeResolve = require('@rollup/plugin-node-resolve');
|
|
7
7
|
var virtual = require('@rollup/plugin-virtual');
|
|
@@ -13,14 +13,34 @@ var module$1 = require('module');
|
|
|
13
13
|
var path = require('path');
|
|
14
14
|
var child_process = require('child_process');
|
|
15
15
|
var promises = require('fs/promises');
|
|
16
|
+
var babel = require('@babel/core');
|
|
16
17
|
|
|
17
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
function _interopNamespace(e) {
|
|
21
|
+
if (e && e.__esModule) return e;
|
|
22
|
+
var n = Object.create(null);
|
|
23
|
+
if (e) {
|
|
24
|
+
Object.keys(e).forEach(function (k) {
|
|
25
|
+
if (k !== 'default') {
|
|
26
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return e[k]; }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
n.default = e;
|
|
35
|
+
return Object.freeze(n);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var commonjs2__default = /*#__PURE__*/_interopDefault(commonjs2);
|
|
20
39
|
var json__default = /*#__PURE__*/_interopDefault(json);
|
|
21
40
|
var nodeResolve__default = /*#__PURE__*/_interopDefault(nodeResolve);
|
|
22
41
|
var virtual__default = /*#__PURE__*/_interopDefault(virtual);
|
|
23
42
|
var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
43
|
+
var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
|
|
24
44
|
|
|
25
45
|
function isNodeBuiltin(dep) {
|
|
26
46
|
const [pkg] = dep.split("/");
|
|
@@ -75,6 +95,230 @@ function validate(file) {
|
|
|
75
95
|
}
|
|
76
96
|
);
|
|
77
97
|
}
|
|
98
|
+
function removeAllOptionsFromMastraExcept(result, option) {
|
|
99
|
+
const t = babel__namespace.default.types;
|
|
100
|
+
return {
|
|
101
|
+
name: "remove-all-except-" + option + "-config",
|
|
102
|
+
visitor: {
|
|
103
|
+
ExportNamedDeclaration: {
|
|
104
|
+
// remove all exports
|
|
105
|
+
exit(path) {
|
|
106
|
+
path.remove();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
NewExpression(path, state) {
|
|
110
|
+
const varDeclaratorPath = path.findParent((path2) => t.isVariableDeclarator(path2.node));
|
|
111
|
+
if (!varDeclaratorPath) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const parentNode = path.parentPath.node;
|
|
115
|
+
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let mastraArgs = t.objectExpression([]);
|
|
119
|
+
if (t.isObjectExpression(path.node.arguments[0])) {
|
|
120
|
+
mastraArgs = path.node.arguments[0];
|
|
121
|
+
}
|
|
122
|
+
let telemetry = mastraArgs.properties.find(
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
(prop) => prop.key.name === option
|
|
125
|
+
);
|
|
126
|
+
let telemetryValue = t.objectExpression([]);
|
|
127
|
+
const programPath = path.scope.getProgramParent().path;
|
|
128
|
+
if (!programPath) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (telemetry && t.isObjectProperty(telemetry) && t.isExpression(telemetry.value)) {
|
|
132
|
+
result.hasCustomConfig = true;
|
|
133
|
+
telemetryValue = telemetry.value;
|
|
134
|
+
if (t.isIdentifier(telemetry.value) && telemetry.value.name === option) {
|
|
135
|
+
const telemetryBinding = state.file.scope.getBinding(option);
|
|
136
|
+
if (telemetryBinding && t.isVariableDeclarator(telemetryBinding.path.node)) {
|
|
137
|
+
const id = path.scope.generateUidIdentifier(option);
|
|
138
|
+
telemetryBinding.path.replaceWith(t.variableDeclarator(id, telemetryBinding.path.node.init));
|
|
139
|
+
telemetryValue = id;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const exportDeclaration = t.exportNamedDeclaration(
|
|
144
|
+
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), telemetryValue)]),
|
|
145
|
+
[]
|
|
146
|
+
);
|
|
147
|
+
programPath.node.body.push(exportDeclaration);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/build/babel/remove-all-options-bundler.ts
|
|
154
|
+
function removeAllOptionsExceptBundler(result) {
|
|
155
|
+
return removeAllOptionsFromMastraExcept(result, "bundler");
|
|
156
|
+
}
|
|
157
|
+
function removeNonReferencedNodes() {
|
|
158
|
+
const t = babel__namespace.default.types;
|
|
159
|
+
return {
|
|
160
|
+
name: "remove-non-referenced-nodes",
|
|
161
|
+
visitor: {
|
|
162
|
+
Program(path) {
|
|
163
|
+
const scope = path.scope;
|
|
164
|
+
const currentBody = path.get("body");
|
|
165
|
+
const filteredBody = currentBody.filter((childPath) => {
|
|
166
|
+
if (childPath.isExportDeclaration()) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
if (childPath.isVariableDeclaration()) {
|
|
170
|
+
return childPath.node.declarations.some((decl) => {
|
|
171
|
+
if (!t.isIdentifier(decl.id)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
const name = decl.id.name;
|
|
175
|
+
const binding = scope.getBinding(name);
|
|
176
|
+
return binding && (binding.referenced || binding.referencePaths.length > 0);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (childPath.isFunctionDeclaration() || childPath.isClassDeclaration()) {
|
|
180
|
+
if (!t.isIdentifier(childPath.node.id)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
const name = childPath.node.id.name;
|
|
184
|
+
const binding = scope.getBinding(name);
|
|
185
|
+
return binding && (binding.referenced || binding.referencePaths.length > 0);
|
|
186
|
+
}
|
|
187
|
+
if (childPath.isImportDeclaration()) {
|
|
188
|
+
return childPath.node.specifiers.some((specifier) => {
|
|
189
|
+
const importedName = specifier.local.name;
|
|
190
|
+
const binding = scope.getBinding(importedName);
|
|
191
|
+
return binding && (binding.referenced || binding.referencePaths.length > 0);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
});
|
|
196
|
+
path.set(
|
|
197
|
+
"body",
|
|
198
|
+
filteredBody.map((p) => p.node)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/build/plugins/remove-unused-references.ts
|
|
206
|
+
function recursiveRemoveNonReferencedNodes(code) {
|
|
207
|
+
return new Promise(async (resolve, reject) => {
|
|
208
|
+
babel__namespace.transform(
|
|
209
|
+
code,
|
|
210
|
+
{
|
|
211
|
+
babelrc: false,
|
|
212
|
+
configFile: false,
|
|
213
|
+
plugins: [removeNonReferencedNodes()]
|
|
214
|
+
},
|
|
215
|
+
(err, result) => {
|
|
216
|
+
if (err) {
|
|
217
|
+
return reject(err);
|
|
218
|
+
}
|
|
219
|
+
if (result && result.code !== code) {
|
|
220
|
+
return recursiveRemoveNonReferencedNodes(result.code).then(resolve, reject);
|
|
221
|
+
}
|
|
222
|
+
resolve({
|
|
223
|
+
code: result.code,
|
|
224
|
+
map: result.map
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/build/bundlerOptions.ts
|
|
232
|
+
function getBundlerOptionsBundler(entryFile, result) {
|
|
233
|
+
return rollup.rollup({
|
|
234
|
+
logLevel: "silent",
|
|
235
|
+
input: {
|
|
236
|
+
"bundler-config": entryFile
|
|
237
|
+
},
|
|
238
|
+
treeshake: "smallest",
|
|
239
|
+
plugins: [
|
|
240
|
+
chunk54KOF3NB_cjs.tsConfigPaths(),
|
|
241
|
+
// transpile typescript to something we understand
|
|
242
|
+
esbuild__default.default({
|
|
243
|
+
target: "node20",
|
|
244
|
+
platform: "node",
|
|
245
|
+
minify: false
|
|
246
|
+
}),
|
|
247
|
+
commonjs2__default.default({
|
|
248
|
+
extensions: [".js", ".ts"],
|
|
249
|
+
strictRequires: "strict",
|
|
250
|
+
transformMixedEsModules: true,
|
|
251
|
+
ignoreTryCatch: false
|
|
252
|
+
}),
|
|
253
|
+
{
|
|
254
|
+
name: "get-bundler-config",
|
|
255
|
+
transform(code, id) {
|
|
256
|
+
if (id !== entryFile) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
return new Promise((resolve, reject) => {
|
|
260
|
+
babel__namespace.transform(
|
|
261
|
+
code,
|
|
262
|
+
{
|
|
263
|
+
babelrc: false,
|
|
264
|
+
configFile: false,
|
|
265
|
+
filename: id,
|
|
266
|
+
plugins: [removeAllOptionsExceptBundler(result)]
|
|
267
|
+
},
|
|
268
|
+
(err, result2) => {
|
|
269
|
+
if (err) {
|
|
270
|
+
return reject(err);
|
|
271
|
+
}
|
|
272
|
+
resolve({
|
|
273
|
+
code: result2.code,
|
|
274
|
+
map: result2.map
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
// let esbuild remove all unused imports
|
|
282
|
+
esbuild__default.default({
|
|
283
|
+
target: "node20",
|
|
284
|
+
platform: "node",
|
|
285
|
+
minify: false
|
|
286
|
+
}),
|
|
287
|
+
{
|
|
288
|
+
name: "cleanup",
|
|
289
|
+
transform(code, id) {
|
|
290
|
+
if (id !== entryFile) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
return recursiveRemoveNonReferencedNodes(code);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
// let esbuild remove all unused imports
|
|
297
|
+
esbuild__default.default({
|
|
298
|
+
target: "node20",
|
|
299
|
+
platform: "node",
|
|
300
|
+
minify: false
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async function getBundlerOptions(entryFile, outputDir) {
|
|
306
|
+
const result = {
|
|
307
|
+
hasCustomConfig: false
|
|
308
|
+
};
|
|
309
|
+
const bundle = await getBundlerOptionsBundler(entryFile, result);
|
|
310
|
+
await bundle.write({
|
|
311
|
+
dir: outputDir,
|
|
312
|
+
format: "es",
|
|
313
|
+
entryFileNames: "[name].mjs"
|
|
314
|
+
});
|
|
315
|
+
if (result.hasCustomConfig) {
|
|
316
|
+
return (await import(`file:${outputDir}/bundler-config.mjs`)).bundler;
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// src/build/analyze.ts
|
|
78
322
|
var globalExternals = [
|
|
79
323
|
"pino",
|
|
80
324
|
"pino-pretty",
|
|
@@ -146,7 +390,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
146
390
|
platform,
|
|
147
391
|
minify: false
|
|
148
392
|
}),
|
|
149
|
-
|
|
393
|
+
commonjs2__default.default({
|
|
150
394
|
strictRequires: "debug",
|
|
151
395
|
ignoreTryCatch: false,
|
|
152
396
|
transformMixedEsModules: true,
|
|
@@ -183,11 +427,12 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
183
427
|
}
|
|
184
428
|
return depsToOptimize;
|
|
185
429
|
}
|
|
186
|
-
async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
430
|
+
async function bundleExternals(depsToOptimize, outputDir, logger, customExternals) {
|
|
187
431
|
logger.info("Optimizing dependencies...");
|
|
188
432
|
logger.debug(
|
|
189
433
|
`${Array.from(depsToOptimize.keys()).map((key) => `- ${key}`).join("\n")}`
|
|
190
434
|
);
|
|
435
|
+
const allExternals = [...globalExternals, ...customExternals || []];
|
|
191
436
|
const reverseVirtualReferenceMap = /* @__PURE__ */ new Map();
|
|
192
437
|
const virtualDependencies = /* @__PURE__ */ new Map();
|
|
193
438
|
for (const [dep, exports] of depsToOptimize.entries()) {
|
|
@@ -223,7 +468,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
223
468
|
),
|
|
224
469
|
// this dependency breaks the build, so we need to exclude it
|
|
225
470
|
// TODO actually fix this so we don't need to exclude it
|
|
226
|
-
external:
|
|
471
|
+
external: allExternals,
|
|
227
472
|
treeshake: "smallest",
|
|
228
473
|
plugins: [
|
|
229
474
|
virtual__default.default(
|
|
@@ -235,7 +480,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
235
480
|
{}
|
|
236
481
|
)
|
|
237
482
|
),
|
|
238
|
-
|
|
483
|
+
commonjs2__default.default({
|
|
239
484
|
strictRequires: "strict",
|
|
240
485
|
transformMixedEsModules: true,
|
|
241
486
|
ignoreTryCatch: false
|
|
@@ -260,7 +505,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
260
505
|
const moduleResolveMap = {};
|
|
261
506
|
const filteredChunks = output.filter((o) => o.type === "chunk");
|
|
262
507
|
for (const o of filteredChunks.filter((o2) => o2.isEntry || o2.isDynamicEntry)) {
|
|
263
|
-
for (const external of
|
|
508
|
+
for (const external of allExternals) {
|
|
264
509
|
const importer = findExternalImporter(o, external, filteredChunks);
|
|
265
510
|
if (importer) {
|
|
266
511
|
const fullPath = path.join(outputDir, importer.fileName);
|
|
@@ -319,10 +564,12 @@ async function validateOutput({
|
|
|
319
564
|
async function analyzeBundle(entry, mastraEntry, outputDir, platform, logger) {
|
|
320
565
|
const isVirtualFile = entry.includes("\n") || !fs.existsSync(entry);
|
|
321
566
|
const depsToOptimize = await analyze(entry, mastraEntry, isVirtualFile, platform, logger);
|
|
567
|
+
const customExternals = (await getBundlerOptions(mastraEntry, outputDir))?.externals;
|
|
322
568
|
const { output, reverseVirtualReferenceMap, usedExternals } = await bundleExternals(
|
|
323
569
|
depsToOptimize,
|
|
324
570
|
outputDir,
|
|
325
|
-
logger
|
|
571
|
+
logger,
|
|
572
|
+
customExternals
|
|
326
573
|
);
|
|
327
574
|
const result = await validateOutput({ output, reverseVirtualReferenceMap, usedExternals, outputDir }, logger);
|
|
328
575
|
return result;
|
|
@@ -330,3 +577,6 @@ async function analyzeBundle(entry, mastraEntry, outputDir, platform, logger) {
|
|
|
330
577
|
|
|
331
578
|
exports.aliasHono = aliasHono;
|
|
332
579
|
exports.analyzeBundle = analyzeBundle;
|
|
580
|
+
exports.getBundlerOptions = getBundlerOptions;
|
|
581
|
+
exports.recursiveRemoveNonReferencedNodes = recursiveRemoveNonReferencedNodes;
|
|
582
|
+
exports.removeAllOptionsFromMastraExcept = removeAllOptionsFromMastraExcept;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWK63QOD5_cjs = require('./chunk-WK63QOD5.cjs');
|
|
4
|
+
var chunkOJY5LJPT_cjs = require('./chunk-OJY5LJPT.cjs');
|
|
5
5
|
var chunkIMGVLBV7_cjs = require('./chunk-IMGVLBV7.cjs');
|
|
6
6
|
var chunk4VC5Z4YR_cjs = require('./chunk-4VC5Z4YR.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
@@ -11,6 +11,7 @@ var url = require('url');
|
|
|
11
11
|
var bundler = require('@mastra/core/bundler');
|
|
12
12
|
var virtual = require('@rollup/plugin-virtual');
|
|
13
13
|
var fsExtra = require('fs-extra/esm');
|
|
14
|
+
var globby = require('globby');
|
|
14
15
|
var resolveFrom = require('resolve-from');
|
|
15
16
|
var slugify = require('@sindresorhus/slugify');
|
|
16
17
|
var findWorkspaces = require('find-workspaces');
|
|
@@ -130,7 +131,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
130
131
|
}
|
|
131
132
|
async writeInstrumentationFile(outputDirectory) {
|
|
132
133
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
133
|
-
const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
134
|
+
const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-PJB6TDF7.cjs', document.baseURI).href))));
|
|
134
135
|
await fsExtra.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
|
|
135
136
|
}
|
|
136
137
|
async writePackageJson(outputDirectory, dependencies, resolutions) {
|
|
@@ -176,7 +177,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
176
177
|
return chunkIMGVLBV7_cjs.createBundler(inputOptions, outputOptions);
|
|
177
178
|
}
|
|
178
179
|
async analyze(entry, mastraFile, outputDirectory) {
|
|
179
|
-
return await
|
|
180
|
+
return await chunkOJY5LJPT_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
|
|
180
181
|
}
|
|
181
182
|
async installDependencies(outputDirectory, rootDir = process.cwd()) {
|
|
182
183
|
const deps = new chunk4VC5Z4YR_cjs.DepsService(rootDir);
|
|
@@ -213,36 +214,39 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
213
214
|
async getToolsInputOptions(toolsPaths) {
|
|
214
215
|
const inputs = {};
|
|
215
216
|
for (const toolPath of toolsPaths) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
217
|
+
const expandedPaths = await globby.globby(toolPath, {});
|
|
218
|
+
for (const path$1 of expandedPaths) {
|
|
219
|
+
if (await fsExtra__default.default.pathExists(path$1)) {
|
|
220
|
+
const fileService = new chunk4VC5Z4YR_cjs.FileService();
|
|
221
|
+
const entryFile = fileService.getFirstExistingFile([
|
|
222
|
+
path.join(path$1, "index.ts"),
|
|
223
|
+
path.join(path$1, "index.js"),
|
|
224
|
+
path$1
|
|
225
|
+
// if path itself is a file
|
|
226
|
+
]);
|
|
227
|
+
if (!entryFile || (await promises.stat(entryFile)).isDirectory()) {
|
|
228
|
+
this.logger.warn(`No entry file found in ${path$1}, skipping...`);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const uniqueToolID = crypto.randomUUID();
|
|
232
|
+
inputs[`tools/${uniqueToolID}`] = entryFile;
|
|
233
|
+
} else {
|
|
234
|
+
this.logger.warn(`Tool path ${path$1} does not exist, skipping...`);
|
|
227
235
|
}
|
|
228
|
-
const uniqueToolID = crypto.randomUUID();
|
|
229
|
-
inputs[`tools/${uniqueToolID}`] = entryFile;
|
|
230
|
-
} else {
|
|
231
|
-
this.logger.warn(`Tool path ${toolPath} does not exist, skipping...`);
|
|
232
236
|
}
|
|
233
237
|
}
|
|
234
238
|
return inputs;
|
|
235
239
|
}
|
|
236
240
|
async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = path.join(outputDirectory, this.outputDir)) {
|
|
237
241
|
this.logger.info("Start bundling Mastra");
|
|
238
|
-
const analyzedBundleInfo = await
|
|
242
|
+
const analyzedBundleInfo = await chunkOJY5LJPT_cjs.analyzeBundle(
|
|
239
243
|
serverFile,
|
|
240
244
|
mastraEntryFile,
|
|
241
245
|
path.join(outputDirectory, this.analyzeOutputDir),
|
|
242
246
|
"node",
|
|
243
247
|
this.logger
|
|
244
248
|
);
|
|
245
|
-
const { externalDependencies } = await
|
|
249
|
+
const { externalDependencies } = await chunkWK63QOD5_cjs.writeTelemetryConfig(mastraEntryFile, path.join(outputDirectory, this.outputDir));
|
|
246
250
|
const dependenciesToInstall = /* @__PURE__ */ new Map();
|
|
247
251
|
for (const external of externalDependencies) {
|
|
248
252
|
dependenciesToInstall.set(external, "latest");
|