@mastra/deployer 1.0.0-beta.13 → 1.0.0-beta.15
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 +40 -0
- package/dist/arktype-aI7TBD0R-CCZH3EYK.js +8 -0
- package/dist/{arktype-aI7TBD0R-OEPFT4G6.js.map → arktype-aI7TBD0R-CCZH3EYK.js.map} +1 -1
- package/dist/{arktype-aI7TBD0R-4YXBEQBG.cjs → arktype-aI7TBD0R-XHBHUL3T.cjs} +3 -3
- package/dist/{arktype-aI7TBD0R-4YXBEQBG.cjs.map → arktype-aI7TBD0R-XHBHUL3T.cjs.map} +1 -1
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.d.ts +3 -4
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/babel/remove-deployer.d.ts.map +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/bundlerOptions.d.ts.map +1 -1
- package/dist/build/deployer.d.ts.map +1 -1
- package/dist/build/index.cjs +10 -10
- package/dist/build/index.js +3 -3
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/plugins/remove-all-except.d.ts +10 -0
- package/dist/build/plugins/remove-all-except.d.ts.map +1 -0
- package/dist/build/serverOptions.d.ts.map +1 -1
- package/dist/build/shared/extract-mastra-option.d.ts +4 -8
- package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
- package/dist/build/types.d.ts +5 -0
- package/dist/build/types.d.ts.map +1 -1
- package/dist/bundler/index.cjs +6 -2
- package/dist/bundler/index.d.ts +7 -7
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/chunk-2VG357HT.cjs +4 -0
- package/dist/{chunk-BTNPI4Z7.cjs.map → chunk-2VG357HT.cjs.map} +1 -1
- package/dist/chunk-4P2LYC33.js +14 -0
- package/dist/{chunk-N5TMJUIR.js.map → chunk-4P2LYC33.js.map} +1 -1
- package/dist/chunk-54PQDTM3.cjs +16 -0
- package/dist/{chunk-ID3HN3BH.cjs.map → chunk-54PQDTM3.cjs.map} +1 -1
- package/dist/{chunk-MMUE22EL.js → chunk-5HTKP372.js} +9 -9
- package/dist/{chunk-MMUE22EL.js.map → chunk-5HTKP372.js.map} +1 -1
- package/dist/{chunk-3GOE3SL2.cjs → chunk-7F6JKGX4.cjs} +48 -33
- package/dist/chunk-7F6JKGX4.cjs.map +1 -0
- package/dist/{chunk-RGUNHE4Y.js → chunk-BDA7RMRF.js} +198 -181
- package/dist/chunk-BDA7RMRF.js.map +1 -0
- package/dist/{chunk-KCGBR2X6.cjs → chunk-CRIOGWZD.cjs} +197 -181
- package/dist/chunk-CRIOGWZD.cjs.map +1 -0
- package/dist/{chunk-TXKETRIN.cjs → chunk-DMISJICL.cjs} +9 -9
- package/dist/{chunk-TXKETRIN.cjs.map → chunk-DMISJICL.cjs.map} +1 -1
- package/dist/{chunk-XTXGU6QF.js → chunk-ESR6AK5N.js} +43 -29
- package/dist/chunk-ESR6AK5N.js.map +1 -0
- package/dist/chunk-G6GFAPPU.js +6 -0
- package/dist/{chunk-Q2YGWEXY.js.map → chunk-G6GFAPPU.js.map} +1 -1
- package/dist/chunk-HPGDVJAZ.js +3 -0
- package/dist/{chunk-FBT6QP7J.js.map → chunk-HPGDVJAZ.js.map} +1 -1
- package/dist/{chunk-24GY667C.cjs → chunk-HRCR6OKC.cjs} +11 -22
- package/dist/chunk-HRCR6OKC.cjs.map +1 -0
- package/dist/{chunk-GD2TGMBP.cjs → chunk-JBE6KM7R.cjs} +3 -3
- package/dist/{chunk-GD2TGMBP.cjs.map → chunk-JBE6KM7R.cjs.map} +1 -1
- package/dist/{chunk-7PLNIFGZ.cjs → chunk-KE4NVPI4.cjs} +3 -3
- package/dist/{chunk-7PLNIFGZ.cjs.map → chunk-KE4NVPI4.cjs.map} +1 -1
- package/dist/{chunk-R6O3XWXM.js → chunk-ONWHS3PA.js} +34 -79
- package/dist/chunk-ONWHS3PA.js.map +1 -0
- package/dist/{chunk-LENVOSFH.cjs → chunk-OVVUJ46G.cjs} +39 -85
- package/dist/chunk-OVVUJ46G.cjs.map +1 -0
- package/dist/{chunk-P4L6VIHY.js → chunk-V4HCIN6G.js} +3 -3
- package/dist/{chunk-P4L6VIHY.js.map → chunk-V4HCIN6G.js.map} +1 -1
- package/dist/{chunk-SRPOHKWH.js → chunk-WFIG7I5C.js} +5 -16
- package/dist/chunk-WFIG7I5C.js.map +1 -0
- package/dist/default-u_dwuiYb-IKALPRLV.js +3 -0
- package/dist/{default-u_dwuiYb-65M4BHAA.js.map → default-u_dwuiYb-IKALPRLV.js.map} +1 -1
- package/dist/default-u_dwuiYb-ZNEZWEPC.cjs +9 -0
- package/dist/{default-u_dwuiYb-PWN6FHC6.cjs.map → default-u_dwuiYb-ZNEZWEPC.cjs.map} +1 -1
- package/dist/effect-QlVUlMFu-2KN4AWBH.cjs +17 -0
- package/dist/{effect-QlVUlMFu-2ADPKIDF.cjs.map → effect-QlVUlMFu-2KN4AWBH.cjs.map} +1 -1
- package/dist/{effect-QlVUlMFu-FD73M3OO.js → effect-QlVUlMFu-MWXQUT6S.js} +4 -4
- package/dist/{effect-QlVUlMFu-FD73M3OO.js.map → effect-QlVUlMFu-MWXQUT6S.js.map} +1 -1
- package/dist/index.cjs +4 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -14
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +263 -15
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +261 -13
- package/dist/server/index.js.map +1 -1
- package/dist/sury-CWZTCd75-6QYFZXZY.cjs +17 -0
- package/dist/{sury-CWZTCd75-K3FHMZF5.cjs.map → sury-CWZTCd75-6QYFZXZY.cjs.map} +1 -1
- package/dist/{sury-CWZTCd75-Y2GURJ6K.js → sury-CWZTCd75-DAPFEZIA.js} +4 -4
- package/dist/{sury-CWZTCd75-Y2GURJ6K.js.map → sury-CWZTCd75-DAPFEZIA.js.map} +1 -1
- package/dist/typebox-Dei93FPO-LBLFC3RD.js +8 -0
- package/dist/{typebox-Dei93FPO-2WP4NOYD.js.map → typebox-Dei93FPO-LBLFC3RD.js.map} +1 -1
- package/dist/{typebox-Dei93FPO-WTXAW2LA.cjs → typebox-Dei93FPO-RDSW6DFA.cjs} +3 -3
- package/dist/{typebox-Dei93FPO-WTXAW2LA.cjs.map → typebox-Dei93FPO-RDSW6DFA.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-VGFBTDTW.js → valibot--1zFm7rT-AASENK42.js} +4 -4
- package/dist/{valibot--1zFm7rT-VGFBTDTW.js.map → valibot--1zFm7rT-AASENK42.js.map} +1 -1
- package/dist/valibot--1zFm7rT-OOWNQW47.cjs +17 -0
- package/dist/{valibot--1zFm7rT-HMTCRBB3.cjs.map → valibot--1zFm7rT-OOWNQW47.cjs.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-ILCWWLE4.cjs → valibot-D_HTw1Gn-PBXMZJWR.cjs} +7 -7
- package/dist/{valibot-D_HTw1Gn-ILCWWLE4.cjs.map → valibot-D_HTw1Gn-PBXMZJWR.cjs.map} +1 -1
- package/dist/{valibot-D_HTw1Gn-LLCGNU3W.js → valibot-D_HTw1Gn-PCY2UTIB.js} +5 -5
- package/dist/{valibot-D_HTw1Gn-LLCGNU3W.js.map → valibot-D_HTw1Gn-PCY2UTIB.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-XCRGYQVE.js → zod-Bwrt9trS-MTR3E2QO.js} +4 -4
- package/dist/{zod-Bwrt9trS-XCRGYQVE.js.map → zod-Bwrt9trS-MTR3E2QO.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-XDMWF3NW.cjs → zod-Bwrt9trS-OXQA54TZ.cjs} +6 -6
- package/dist/{zod-Bwrt9trS-XDMWF3NW.cjs.map → zod-Bwrt9trS-OXQA54TZ.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-ZWQMF6SS.cjs → zod-DSgpEGAE-7BIIMWZW.cjs} +7 -7
- package/dist/{zod-DSgpEGAE-ZWQMF6SS.cjs.map → zod-DSgpEGAE-7BIIMWZW.cjs.map} +1 -1
- package/dist/{zod-DSgpEGAE-TKBHSSLS.js → zod-DSgpEGAE-UO7OP3J6.js} +5 -5
- package/dist/{zod-DSgpEGAE-TKBHSSLS.js.map → zod-DSgpEGAE-UO7OP3J6.js.map} +1 -1
- package/package.json +6 -6
- package/dist/arktype-aI7TBD0R-OEPFT4G6.js +0 -8
- package/dist/build/babel/get-deployer.d.ts +0 -3
- package/dist/build/babel/get-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-bundler.d.ts +0 -5
- package/dist/build/babel/remove-all-options-bundler.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-deployer.d.ts +0 -5
- package/dist/build/babel/remove-all-options-deployer.d.ts.map +0 -1
- package/dist/build/babel/remove-all-options-server.d.ts +0 -5
- package/dist/build/babel/remove-all-options-server.d.ts.map +0 -1
- package/dist/chunk-24GY667C.cjs.map +0 -1
- package/dist/chunk-3GOE3SL2.cjs.map +0 -1
- package/dist/chunk-BTNPI4Z7.cjs +0 -4
- package/dist/chunk-FBT6QP7J.js +0 -3
- package/dist/chunk-ID3HN3BH.cjs +0 -16
- package/dist/chunk-KCGBR2X6.cjs.map +0 -1
- package/dist/chunk-LENVOSFH.cjs.map +0 -1
- package/dist/chunk-N5TMJUIR.js +0 -14
- package/dist/chunk-Q2YGWEXY.js +0 -6
- package/dist/chunk-R6O3XWXM.js.map +0 -1
- package/dist/chunk-RGUNHE4Y.js.map +0 -1
- package/dist/chunk-SRPOHKWH.js.map +0 -1
- package/dist/chunk-XTXGU6QF.js.map +0 -1
- package/dist/default-u_dwuiYb-65M4BHAA.js +0 -3
- package/dist/default-u_dwuiYb-PWN6FHC6.cjs +0 -9
- package/dist/effect-QlVUlMFu-2ADPKIDF.cjs +0 -17
- package/dist/sury-CWZTCd75-K3FHMZF5.cjs +0 -17
- package/dist/typebox-Dei93FPO-2WP4NOYD.js +0 -8
- package/dist/valibot--1zFm7rT-HMTCRBB3.cjs +0 -17
|
@@ -109,87 +109,6 @@ globalThis.__dirname = dirname(__filename);
|
|
|
109
109
|
}
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
function removeAllOptionsFromMastraExcept(result, option, logger) {
|
|
113
|
-
const t = babel__default.types;
|
|
114
|
-
return {
|
|
115
|
-
name: "remove-all-except-" + option + "-config",
|
|
116
|
-
visitor: {
|
|
117
|
-
ExportNamedDeclaration: {
|
|
118
|
-
// remove all exports
|
|
119
|
-
exit(path3) {
|
|
120
|
-
path3.remove();
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
NewExpression(path3, state) {
|
|
124
|
-
const varDeclaratorPath = path3.findParent((path4) => t.isVariableDeclarator(path4.node));
|
|
125
|
-
if (!varDeclaratorPath) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const parentNode = path3.parentPath.node;
|
|
129
|
-
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
let mastraArgs = t.objectExpression([]);
|
|
133
|
-
if (t.isObjectExpression(path3.node.arguments[0])) {
|
|
134
|
-
mastraArgs = path3.node.arguments[0];
|
|
135
|
-
}
|
|
136
|
-
let configProperty = mastraArgs.properties.find(
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
(prop) => prop.key.name === option
|
|
139
|
-
);
|
|
140
|
-
let configValue = t.objectExpression([]);
|
|
141
|
-
const programPath = path3.scope.getProgramParent().path;
|
|
142
|
-
if (!programPath) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {
|
|
146
|
-
result.hasCustomConfig = true;
|
|
147
|
-
configValue = configProperty.value;
|
|
148
|
-
if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {
|
|
149
|
-
const configBinding = state.file.scope.getBinding(option);
|
|
150
|
-
if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {
|
|
151
|
-
const id = path3.scope.generateUidIdentifier(option);
|
|
152
|
-
configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init));
|
|
153
|
-
configValue = id;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const exportDeclaration = t.exportNamedDeclaration(
|
|
158
|
-
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), configValue)]),
|
|
159
|
-
[]
|
|
160
|
-
);
|
|
161
|
-
programPath.node.body.push(exportDeclaration);
|
|
162
|
-
},
|
|
163
|
-
Program: {
|
|
164
|
-
exit(path3) {
|
|
165
|
-
const hasExport = path3.node.body.some(
|
|
166
|
-
(node) => node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration"
|
|
167
|
-
);
|
|
168
|
-
if (!hasExport) {
|
|
169
|
-
if (logger) {
|
|
170
|
-
logger.warn(`Mastra ${option} config could not be extracted. Please make sure your entry file looks like this:
|
|
171
|
-
export const mastra = new Mastra({
|
|
172
|
-
${option}: <value>
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
`);
|
|
176
|
-
}
|
|
177
|
-
const fallbackExportDeclaration = t.exportNamedDeclaration(
|
|
178
|
-
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),
|
|
179
|
-
[]
|
|
180
|
-
);
|
|
181
|
-
path3.node.body.push(fallbackExportDeclaration);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/build/babel/remove-all-options-bundler.ts
|
|
190
|
-
function removeAllOptionsExceptBundler(result, logger) {
|
|
191
|
-
return removeAllOptionsFromMastraExcept(result, "bundler", logger);
|
|
192
|
-
}
|
|
193
112
|
function esbuild(options = {}) {
|
|
194
113
|
return originalEsbuild({
|
|
195
114
|
target: "node20",
|
|
@@ -407,7 +326,117 @@ function recursiveRemoveNonReferencedNodes(code) {
|
|
|
407
326
|
);
|
|
408
327
|
});
|
|
409
328
|
}
|
|
410
|
-
function
|
|
329
|
+
function removeAllOptionsFromMastraExcept(result, option, logger) {
|
|
330
|
+
const t = babel__default.types;
|
|
331
|
+
return {
|
|
332
|
+
name: "remove-all-except-" + option + "-config",
|
|
333
|
+
visitor: {
|
|
334
|
+
ExportNamedDeclaration: {
|
|
335
|
+
// remove all exports
|
|
336
|
+
exit(path3) {
|
|
337
|
+
path3.remove();
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
NewExpression(path3, state) {
|
|
341
|
+
const varDeclaratorPath = path3.findParent((path4) => t.isVariableDeclarator(path4.node));
|
|
342
|
+
if (!varDeclaratorPath) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const parentNode = path3.parentPath.node;
|
|
346
|
+
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
let mastraArgs = t.objectExpression([]);
|
|
350
|
+
if (t.isObjectExpression(path3.node.arguments[0])) {
|
|
351
|
+
mastraArgs = path3.node.arguments[0];
|
|
352
|
+
}
|
|
353
|
+
let configProperty = mastraArgs.properties.find(
|
|
354
|
+
(prop) => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === option
|
|
355
|
+
);
|
|
356
|
+
let configValue = t.objectExpression([]);
|
|
357
|
+
const programPath = path3.scope.getProgramParent().path;
|
|
358
|
+
if (!programPath) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (configProperty && t.isObjectProperty(configProperty) && t.isExpression(configProperty.value)) {
|
|
362
|
+
result.hasCustomConfig = true;
|
|
363
|
+
configValue = configProperty.value;
|
|
364
|
+
if (t.isIdentifier(configProperty.value) && configProperty.value.name === option) {
|
|
365
|
+
const configBinding = state.file.scope.getBinding(option);
|
|
366
|
+
if (configBinding && t.isVariableDeclarator(configBinding.path.node)) {
|
|
367
|
+
const id = path3.scope.generateUidIdentifier(option);
|
|
368
|
+
configBinding.path.replaceWith(t.variableDeclarator(id, configBinding.path.node.init));
|
|
369
|
+
configValue = id;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const exportDeclaration = t.exportNamedDeclaration(
|
|
374
|
+
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), configValue)]),
|
|
375
|
+
[]
|
|
376
|
+
);
|
|
377
|
+
programPath.node.body.push(exportDeclaration);
|
|
378
|
+
},
|
|
379
|
+
Program: {
|
|
380
|
+
exit(path3) {
|
|
381
|
+
const hasExport = path3.node.body.some(
|
|
382
|
+
(node) => node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration"
|
|
383
|
+
);
|
|
384
|
+
if (!hasExport) {
|
|
385
|
+
if (logger) {
|
|
386
|
+
logger.warn(`Mastra ${option} config could not be extracted. Please make sure your entry file looks like this:
|
|
387
|
+
export const mastra = new Mastra({
|
|
388
|
+
${option}: <value>
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
`);
|
|
392
|
+
}
|
|
393
|
+
const fallbackExportDeclaration = t.exportNamedDeclaration(
|
|
394
|
+
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),
|
|
395
|
+
[]
|
|
396
|
+
);
|
|
397
|
+
path3.node.body.push(fallbackExportDeclaration);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/build/plugins/remove-all-except.ts
|
|
406
|
+
function removeAllOptionsFromMastraExceptPlugin(mastraEntry, name, result, options) {
|
|
407
|
+
return {
|
|
408
|
+
name: `remove-${name}`,
|
|
409
|
+
transform(code, id) {
|
|
410
|
+
if (id !== mastraEntry) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
return new Promise((resolve2, reject) => {
|
|
414
|
+
babel.transform(
|
|
415
|
+
code,
|
|
416
|
+
{
|
|
417
|
+
babelrc: false,
|
|
418
|
+
configFile: false,
|
|
419
|
+
filename: id,
|
|
420
|
+
plugins: [removeAllOptionsFromMastraExcept(result, name, options?.logger)],
|
|
421
|
+
sourceMaps: options?.sourcemap
|
|
422
|
+
},
|
|
423
|
+
(err, result2) => {
|
|
424
|
+
if (err) {
|
|
425
|
+
return reject(err);
|
|
426
|
+
}
|
|
427
|
+
resolve2({
|
|
428
|
+
code: result2.code,
|
|
429
|
+
map: result2.map
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// src/build/shared/extract-mastra-option.ts
|
|
439
|
+
function extractMastraOptionBundler(name, entryFile, result, logger) {
|
|
411
440
|
return rollup({
|
|
412
441
|
logLevel: "silent",
|
|
413
442
|
input: {
|
|
@@ -428,34 +457,7 @@ function extractMastraOptionBundler(name, entryFile, transformer, result, logger
|
|
|
428
457
|
ignoreTryCatch: false
|
|
429
458
|
}),
|
|
430
459
|
json(),
|
|
431
|
-
{
|
|
432
|
-
name: `extract-${name}-config`,
|
|
433
|
-
transform(code, id) {
|
|
434
|
-
if (id !== entryFile) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
return new Promise((resolve2, reject) => {
|
|
438
|
-
babel.transform(
|
|
439
|
-
code,
|
|
440
|
-
{
|
|
441
|
-
babelrc: false,
|
|
442
|
-
configFile: false,
|
|
443
|
-
filename: id,
|
|
444
|
-
plugins: [transformer(result, logger)]
|
|
445
|
-
},
|
|
446
|
-
(err, result2) => {
|
|
447
|
-
if (err) {
|
|
448
|
-
return reject(err);
|
|
449
|
-
}
|
|
450
|
-
resolve2({
|
|
451
|
-
code: result2.code,
|
|
452
|
-
map: result2.map
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
);
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
},
|
|
460
|
+
removeAllOptionsFromMastraExceptPlugin(entryFile, name, result, { logger }),
|
|
459
461
|
// let esbuild remove all unused imports
|
|
460
462
|
esbuild(),
|
|
461
463
|
{
|
|
@@ -472,11 +474,11 @@ function extractMastraOptionBundler(name, entryFile, transformer, result, logger
|
|
|
472
474
|
]
|
|
473
475
|
});
|
|
474
476
|
}
|
|
475
|
-
async function extractMastraOption(name, entryFile,
|
|
477
|
+
async function extractMastraOption(name, entryFile, outputDir, logger) {
|
|
476
478
|
const result = {
|
|
477
479
|
hasCustomConfig: false
|
|
478
480
|
};
|
|
479
|
-
const bundler = await extractMastraOptionBundler(name, entryFile,
|
|
481
|
+
const bundler = await extractMastraOptionBundler(name, entryFile, result, logger);
|
|
480
482
|
const output = await bundler.write({
|
|
481
483
|
dir: outputDir,
|
|
482
484
|
format: "es",
|
|
@@ -494,13 +496,7 @@ async function extractMastraOption(name, entryFile, transformer, outputDir, logg
|
|
|
494
496
|
|
|
495
497
|
// src/build/bundlerOptions.ts
|
|
496
498
|
async function getBundlerOptions(entryFile, outputDir, logger) {
|
|
497
|
-
const result = await extractMastraOption(
|
|
498
|
-
"bundler",
|
|
499
|
-
entryFile,
|
|
500
|
-
removeAllOptionsExceptBundler,
|
|
501
|
-
outputDir,
|
|
502
|
-
logger
|
|
503
|
-
);
|
|
499
|
+
const result = await extractMastraOption("bundler", entryFile, outputDir, logger);
|
|
504
500
|
if (!result) {
|
|
505
501
|
return null;
|
|
506
502
|
}
|
|
@@ -569,8 +565,57 @@ function isNodeBuiltin(dep) {
|
|
|
569
565
|
const [pkg2] = dep.split("/");
|
|
570
566
|
return dep.startsWith("node:") || builtinModules.includes(dep) || builtinModules.includes(pkg2);
|
|
571
567
|
}
|
|
568
|
+
async function getPackageRootPath(packageName, parentPath) {
|
|
569
|
+
let rootPath;
|
|
570
|
+
try {
|
|
571
|
+
let options = void 0;
|
|
572
|
+
if (parentPath) {
|
|
573
|
+
if (!parentPath.startsWith("file://")) {
|
|
574
|
+
parentPath = pathToFileURL(parentPath).href;
|
|
575
|
+
}
|
|
576
|
+
options = {
|
|
577
|
+
paths: [parentPath]
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
const pkg2 = await getPackageInfo(packageName, options);
|
|
581
|
+
rootPath = pkg2?.rootPath ?? null;
|
|
582
|
+
} catch (e) {
|
|
583
|
+
rootPath = null;
|
|
584
|
+
}
|
|
585
|
+
return rootPath;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/build/analyze/constants.ts
|
|
589
|
+
var DEPS_TO_IGNORE = ["#tools"];
|
|
590
|
+
var GLOBAL_EXTERNALS = [
|
|
591
|
+
"pino",
|
|
592
|
+
"pino-pretty",
|
|
593
|
+
"@libsql/client",
|
|
594
|
+
"pg",
|
|
595
|
+
"libsql",
|
|
596
|
+
"#tools",
|
|
597
|
+
"typescript",
|
|
598
|
+
"undici",
|
|
599
|
+
"readable-stream"
|
|
600
|
+
];
|
|
601
|
+
var DEPRECATED_EXTERNALS = ["fastembed", "nodemailer", "jsdom", "sqlite3"];
|
|
572
602
|
function removeDeployer() {
|
|
573
603
|
const t = babel__default.types;
|
|
604
|
+
function removeDeployerFromObject(objectExpr, scope) {
|
|
605
|
+
const deployerProp = objectExpr.properties.find(
|
|
606
|
+
(prop) => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === "deployer"
|
|
607
|
+
);
|
|
608
|
+
if (deployerProp) {
|
|
609
|
+
objectExpr.properties = objectExpr.properties.filter((prop) => prop !== deployerProp);
|
|
610
|
+
if (t.isIdentifier(deployerProp.value)) {
|
|
611
|
+
const deployerBinding = scope.getBinding(deployerProp.value.name);
|
|
612
|
+
if (deployerBinding) {
|
|
613
|
+
deployerBinding.path?.parentPath?.remove();
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return deployerProp;
|
|
618
|
+
}
|
|
574
619
|
return {
|
|
575
620
|
name: "remove-deployer",
|
|
576
621
|
visitor: {
|
|
@@ -586,23 +631,30 @@ function removeDeployer() {
|
|
|
586
631
|
if (!state.hasReplaced) {
|
|
587
632
|
state.hasReplaced = true;
|
|
588
633
|
const newMastraObj = t.cloneNode(path3.node);
|
|
589
|
-
if (t.isObjectExpression(newMastraObj.arguments[0]) && newMastraObj.arguments[0].properties?.
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
);
|
|
593
|
-
if (
|
|
594
|
-
|
|
634
|
+
if (t.isObjectExpression(newMastraObj.arguments[0]) && newMastraObj.arguments[0].properties?.length) {
|
|
635
|
+
const objectArg = newMastraObj.arguments[0];
|
|
636
|
+
let foundDeployer = false;
|
|
637
|
+
const directDeployer = removeDeployerFromObject(objectArg, state.file.scope);
|
|
638
|
+
if (directDeployer) {
|
|
639
|
+
foundDeployer = true;
|
|
595
640
|
}
|
|
596
|
-
|
|
597
|
-
(prop)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
641
|
+
for (const prop of objectArg.properties) {
|
|
642
|
+
if (t.isSpreadElement(prop) && t.isIdentifier(prop.argument)) {
|
|
643
|
+
const spreadBinding = state.file.scope.getBinding(prop.argument.name);
|
|
644
|
+
if (spreadBinding?.path && t.isVariableDeclarator(spreadBinding.path.node)) {
|
|
645
|
+
const init = spreadBinding.path.node.init;
|
|
646
|
+
if (t.isObjectExpression(init)) {
|
|
647
|
+
const spreadDeployer = removeDeployerFromObject(init, state.file.scope);
|
|
648
|
+
if (spreadDeployer) {
|
|
649
|
+
foundDeployer = true;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
603
653
|
}
|
|
604
654
|
}
|
|
605
|
-
|
|
655
|
+
if (foundDeployer) {
|
|
656
|
+
path3.replaceWith(newMastraObj);
|
|
657
|
+
}
|
|
606
658
|
}
|
|
607
659
|
}
|
|
608
660
|
}
|
|
@@ -642,40 +694,6 @@ function removeDeployer2(mastraEntry, options) {
|
|
|
642
694
|
}
|
|
643
695
|
};
|
|
644
696
|
}
|
|
645
|
-
async function getPackageRootPath(packageName, parentPath) {
|
|
646
|
-
let rootPath;
|
|
647
|
-
try {
|
|
648
|
-
let options = void 0;
|
|
649
|
-
if (parentPath) {
|
|
650
|
-
if (!parentPath.startsWith("file://")) {
|
|
651
|
-
parentPath = pathToFileURL(parentPath).href;
|
|
652
|
-
}
|
|
653
|
-
options = {
|
|
654
|
-
paths: [parentPath]
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
const pkg2 = await getPackageInfo(packageName, options);
|
|
658
|
-
rootPath = pkg2?.rootPath ?? null;
|
|
659
|
-
} catch (e) {
|
|
660
|
-
rootPath = null;
|
|
661
|
-
}
|
|
662
|
-
return rootPath;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
// src/build/analyze/constants.ts
|
|
666
|
-
var DEPS_TO_IGNORE = ["#tools"];
|
|
667
|
-
var GLOBAL_EXTERNALS = [
|
|
668
|
-
"pino",
|
|
669
|
-
"pino-pretty",
|
|
670
|
-
"@libsql/client",
|
|
671
|
-
"pg",
|
|
672
|
-
"libsql",
|
|
673
|
-
"#tools",
|
|
674
|
-
"typescript",
|
|
675
|
-
"undici",
|
|
676
|
-
"readable-stream"
|
|
677
|
-
];
|
|
678
|
-
var DEPRECATED_EXTERNALS = ["fastembed", "nodemailer", "jsdom", "sqlite3"];
|
|
679
697
|
|
|
680
698
|
// src/build/analyze/analyzeEntry.ts
|
|
681
699
|
function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabled }) {
|
|
@@ -716,7 +734,9 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
716
734
|
transformMixedEsModules: true,
|
|
717
735
|
extensions: [".js", ".ts"]
|
|
718
736
|
}),
|
|
719
|
-
removeDeployer2(mastraEntry, {
|
|
737
|
+
removeDeployer2(mastraEntry, {
|
|
738
|
+
sourcemap: sourcemapEnabled
|
|
739
|
+
}),
|
|
720
740
|
esbuild()
|
|
721
741
|
]
|
|
722
742
|
);
|
|
@@ -1632,7 +1652,7 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1632
1652
|
outputDir,
|
|
1633
1653
|
projectRoot,
|
|
1634
1654
|
isDev = false,
|
|
1635
|
-
bundlerOptions
|
|
1655
|
+
bundlerOptions
|
|
1636
1656
|
}, logger) {
|
|
1637
1657
|
const mastraConfig = await readFile(mastraEntry, "utf-8");
|
|
1638
1658
|
const mastraConfigResult = {
|
|
@@ -1651,25 +1671,22 @@ export const mastra = new Mastra({
|
|
|
1651
1671
|
|
|
1652
1672
|
If you think your configuration is valid, please open an issue.`);
|
|
1653
1673
|
}
|
|
1654
|
-
const { externals: _bundlerExternals = [] } = internalBundlerOptions || {};
|
|
1655
|
-
const userBundlerOptions = await getBundlerOptions(mastraEntry, outputDir);
|
|
1656
1674
|
const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: mastraEntry });
|
|
1657
1675
|
let externalsPreset = false;
|
|
1658
|
-
|
|
1676
|
+
const userExternals = Array.isArray(bundlerOptions?.externals) ? bundlerOptions?.externals : [];
|
|
1677
|
+
if (bundlerOptions?.externals === true) {
|
|
1659
1678
|
externalsPreset = true;
|
|
1660
1679
|
}
|
|
1661
1680
|
let index = 0;
|
|
1662
1681
|
const depsToOptimize = /* @__PURE__ */ new Map();
|
|
1663
|
-
const
|
|
1664
|
-
const userExternals = Array.isArray(userBundlerOptions?.externals) ? userBundlerOptions?.externals : [];
|
|
1665
|
-
const allExternals = [...GLOBAL_EXTERNALS, ...bundlerExternals, ...userExternals];
|
|
1682
|
+
const allExternals = [...GLOBAL_EXTERNALS, ...userExternals].filter(Boolean);
|
|
1666
1683
|
logger.info("Analyzing dependencies...");
|
|
1667
1684
|
const allUsedExternals = /* @__PURE__ */ new Set();
|
|
1668
1685
|
for (const entry of entries) {
|
|
1669
1686
|
const isVirtualFile = entry.includes("\n") || !existsSync(entry);
|
|
1670
1687
|
const analyzeResult = await analyzeEntry({ entry, isVirtualFile }, mastraEntry, {
|
|
1671
1688
|
logger,
|
|
1672
|
-
sourcemapEnabled:
|
|
1689
|
+
sourcemapEnabled: bundlerOptions?.enableSourcemap ?? false,
|
|
1673
1690
|
workspaceMap,
|
|
1674
1691
|
projectRoot,
|
|
1675
1692
|
shouldCheckTransitiveDependencies: isDev || externalsPreset
|
|
@@ -1704,8 +1721,8 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1704
1721
|
logger.debug(`${sortedDeps.map((key) => `- ${key}`).join("\n")}`);
|
|
1705
1722
|
const { output, fileNameToDependencyMap, usedExternals } = await bundleExternals(depsToOptimize, outputDir, {
|
|
1706
1723
|
bundlerOptions: {
|
|
1707
|
-
...
|
|
1708
|
-
externals:
|
|
1724
|
+
...bundlerOptions,
|
|
1725
|
+
externals: bundlerOptions?.externals ?? allExternals,
|
|
1709
1726
|
isDev
|
|
1710
1727
|
},
|
|
1711
1728
|
projectRoot,
|
|
@@ -1752,6 +1769,6 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1752
1769
|
};
|
|
1753
1770
|
}
|
|
1754
1771
|
|
|
1755
|
-
export { aliasHono, analyzeBundle, esbuild, esmShim, extractMastraOption, getBundlerOptions, getPackageRootPath, getWorkspaceInformation,
|
|
1756
|
-
//# sourceMappingURL=chunk-
|
|
1757
|
-
//# sourceMappingURL=chunk-
|
|
1772
|
+
export { aliasHono, analyzeBundle, esbuild, esmShim, extractMastraOption, getBundlerOptions, getPackageRootPath, getWorkspaceInformation, removeDeployer2 as removeDeployer, subpathExternalsResolver, tsConfigPaths };
|
|
1773
|
+
//# sourceMappingURL=chunk-BDA7RMRF.js.map
|
|
1774
|
+
//# sourceMappingURL=chunk-BDA7RMRF.js.map
|