@mastra/deployer 1.0.0-beta.11 → 1.0.0-beta.14
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/bundleExternals.d.ts +4 -5
- package/dist/build/analyze/bundleExternals.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/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts +2 -1
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +12 -12
- package/dist/build/index.js +4 -4
- package/dist/build/plugins/node-modules-extension-resolver.d.ts +7 -0
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/types.d.ts +5 -0
- package/dist/build/types.d.ts.map +1 -1
- package/dist/build/utils.d.ts +6 -0
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/build/watcher.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-HFP6WWM5.js → chunk-BFA354MH.js} +6 -76
- package/dist/chunk-BFA354MH.js.map +1 -0
- package/dist/chunk-C6UFSG3V.js +249 -0
- package/dist/chunk-C6UFSG3V.js.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-G6GFAPPU.js +6 -0
- package/dist/{chunk-Q2YGWEXY.js.map → chunk-G6GFAPPU.js.map} +1 -1
- package/dist/{chunk-NM6R77PX.js → chunk-HHA2Y3AS.js} +7 -3
- package/dist/chunk-HHA2Y3AS.js.map +1 -0
- package/dist/{chunk-3KATYU33.js → chunk-HNSVE6YO.js} +85 -36
- package/dist/chunk-HNSVE6YO.js.map +1 -0
- package/dist/chunk-HPGDVJAZ.js +3 -0
- package/dist/{chunk-FBT6QP7J.js.map → chunk-HPGDVJAZ.js.map} +1 -1
- package/dist/{chunk-PK3AX3KO.cjs → chunk-IVKDKRCR.cjs} +42 -31
- package/dist/chunk-IVKDKRCR.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-PB5O2NTZ.cjs +261 -0
- package/dist/chunk-PB5O2NTZ.cjs.map +1 -0
- package/dist/{chunk-EHZKDGGA.cjs → chunk-UJXH5MNH.cjs} +102 -53
- package/dist/chunk-UJXH5MNH.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-V5W7WIXT.cjs +123 -0
- package/dist/chunk-V5W7WIXT.cjs.map +1 -0
- package/dist/{chunk-F2LCS2DV.cjs → chunk-VA2CSOKJ.cjs} +7 -2
- package/dist/chunk-VA2CSOKJ.cjs.map +1 -0
- package/dist/{chunk-5OGQ7IFB.js → chunk-ZXT4NSIV.js} +35 -25
- package/dist/chunk-ZXT4NSIV.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 +5 -5
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +5 -5
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +3 -3
- 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/validator/custom-resolver.cjs +2 -2
- package/dist/validator/custom-resolver.js +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 +5 -6
- package/dist/arktype-aI7TBD0R-OEPFT4G6.js +0 -8
- package/dist/chunk-3KATYU33.js.map +0 -1
- package/dist/chunk-5OGQ7IFB.js.map +0 -1
- package/dist/chunk-BTNPI4Z7.cjs +0 -4
- package/dist/chunk-EHZKDGGA.cjs.map +0 -1
- package/dist/chunk-F2LCS2DV.cjs.map +0 -1
- package/dist/chunk-FBT6QP7J.js +0 -3
- package/dist/chunk-HFP6WWM5.js.map +0 -1
- package/dist/chunk-ID3HN3BH.cjs +0 -16
- package/dist/chunk-N5TMJUIR.js +0 -14
- package/dist/chunk-NM6R77PX.js.map +0 -1
- package/dist/chunk-PK3AX3KO.cjs.map +0 -1
- package/dist/chunk-Q2YGWEXY.js +0 -6
- package/dist/chunk-UG72ONP7.js +0 -147
- package/dist/chunk-UG72ONP7.js.map +0 -1
- package/dist/chunk-Z33LQHGJ.cjs +0 -196
- package/dist/chunk-Z33LQHGJ.cjs.map +0 -1
- package/dist/chunk-ZPUTJSEC.cjs +0 -157
- package/dist/chunk-ZPUTJSEC.cjs.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/server/handlers/prompt.d.ts +0 -3
- package/dist/server/handlers/prompt.d.ts.map +0 -1
- package/dist/sury-CWZTCd75-K3FHMZF5.cjs +0 -17
- package/dist/typebox-Dei93FPO-2WP4NOYD.js +0 -8
- package/dist/valibot--1zFm7rT-HMTCRBB3.cjs +0 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVA2CSOKJ_cjs = require('./chunk-VA2CSOKJ.cjs');
|
|
4
4
|
var babel = require('@babel/core');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var promises = require('fs/promises');
|
|
@@ -129,7 +129,7 @@ globalThis.__dirname = dirname(__filename);
|
|
|
129
129
|
"--input-type=module",
|
|
130
130
|
"--enable-source-maps",
|
|
131
131
|
"-e",
|
|
132
|
-
`${prefixCode};import('file://${
|
|
132
|
+
`${prefixCode};import('file://${chunkVA2CSOKJ_cjs.slash(file)}').catch(err => {
|
|
133
133
|
${errorHandler.toString()}
|
|
134
134
|
errorHandler(err);
|
|
135
135
|
})`.replaceAll(/\n/g, "")
|
|
@@ -578,7 +578,7 @@ async function getWorkspaceInformation({
|
|
|
578
578
|
mastraEntryFile
|
|
579
579
|
}) {
|
|
580
580
|
const closestPkgJson = pkg__namespace.up({ cwd: path2.dirname(mastraEntryFile) });
|
|
581
|
-
const location = closestPkgJson ? path2.dirname(
|
|
581
|
+
const location = closestPkgJson ? path2.dirname(chunkVA2CSOKJ_cjs.slash(closestPkgJson)) : chunkVA2CSOKJ_cjs.slash(process.cwd());
|
|
582
582
|
const workspaces = await findWorkspaces.findWorkspaces(dir, { cache: workspacesCache });
|
|
583
583
|
const _workspaceMap = new Map(
|
|
584
584
|
workspaces?.map((workspace) => [
|
|
@@ -713,7 +713,7 @@ var DEPRECATED_EXTERNALS = ["fastembed", "nodemailer", "jsdom", "sqlite3"];
|
|
|
713
713
|
|
|
714
714
|
// src/build/analyze/analyzeEntry.ts
|
|
715
715
|
function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabled }) {
|
|
716
|
-
const normalizedMastraEntry =
|
|
716
|
+
const normalizedMastraEntry = chunkVA2CSOKJ_cjs.slash(mastraEntry);
|
|
717
717
|
let virtualPlugin = null;
|
|
718
718
|
if (isVirtualFile) {
|
|
719
719
|
virtualPlugin = virtual__default.default({
|
|
@@ -732,7 +732,7 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
732
732
|
name: "custom-alias-resolver",
|
|
733
733
|
resolveId(id) {
|
|
734
734
|
if (id === "#server") {
|
|
735
|
-
return
|
|
735
|
+
return chunkVA2CSOKJ_cjs.slash(url.fileURLToPath(undefined("@mastra/deployer/server")));
|
|
736
736
|
}
|
|
737
737
|
if (id === "#mastra") {
|
|
738
738
|
return normalizedMastraEntry;
|
|
@@ -774,14 +774,14 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
774
774
|
if (isNodeBuiltin(dependency) || dependency.startsWith("#")) {
|
|
775
775
|
continue;
|
|
776
776
|
}
|
|
777
|
-
const pkgName =
|
|
777
|
+
const pkgName = chunkVA2CSOKJ_cjs.getPackageName(dependency);
|
|
778
778
|
let rootPath = null;
|
|
779
779
|
let isWorkspace = false;
|
|
780
780
|
if (pkgName) {
|
|
781
781
|
rootPath = await getPackageRootPath(dependency, entryRootPath);
|
|
782
782
|
isWorkspace = workspaceMap.has(pkgName);
|
|
783
783
|
}
|
|
784
|
-
const normalizedRootPath = rootPath ?
|
|
784
|
+
const normalizedRootPath = rootPath ? chunkVA2CSOKJ_cjs.slash(rootPath) : null;
|
|
785
785
|
depsToOptimize.set(dependency, {
|
|
786
786
|
exports: bindings,
|
|
787
787
|
rootPath: normalizedRootPath,
|
|
@@ -978,7 +978,7 @@ function subpathExternalsResolver(externals) {
|
|
|
978
978
|
if (id.startsWith(".") || id.startsWith("/")) {
|
|
979
979
|
return null;
|
|
980
980
|
}
|
|
981
|
-
const isPartOfExternals = externals.some((external) =>
|
|
981
|
+
const isPartOfExternals = externals.some((external) => chunkVA2CSOKJ_cjs.isDependencyPartOfPackage(id, external));
|
|
982
982
|
if (isPartOfExternals) {
|
|
983
983
|
return {
|
|
984
984
|
id,
|
|
@@ -998,7 +998,7 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
998
998
|
}
|
|
999
999
|
for (const importedId of info.importedIds) {
|
|
1000
1000
|
for (const external of externals) {
|
|
1001
|
-
if (
|
|
1001
|
+
if (chunkVA2CSOKJ_cjs.isDependencyPartOfPackage(importedId, external)) {
|
|
1002
1002
|
importMap.set(external, info.id);
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
@@ -1010,9 +1010,9 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
1010
1010
|
if (chunk.type === "chunk") {
|
|
1011
1011
|
for (const [external, resolvedFrom] of importMap) {
|
|
1012
1012
|
if (chunk.moduleIds.includes(resolvedFrom)) {
|
|
1013
|
-
const fullPath = url.pathToFileURL(
|
|
1013
|
+
const fullPath = url.pathToFileURL(chunkVA2CSOKJ_cjs.slash(path2.join(projectRoot, fileName))).toString();
|
|
1014
1014
|
const innerMap = resolveMap.get(fullPath) || /* @__PURE__ */ new Map();
|
|
1015
|
-
innerMap.set(external, url.pathToFileURL(
|
|
1015
|
+
innerMap.set(external, url.pathToFileURL(chunkVA2CSOKJ_cjs.slash(resolvedFrom)).toString());
|
|
1016
1016
|
resolveMap.set(fullPath, innerMap);
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
@@ -1032,7 +1032,7 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
1032
1032
|
|
|
1033
1033
|
// src/build/analyze/bundleExternals.ts
|
|
1034
1034
|
function prepareEntryFileName(name, rootDir) {
|
|
1035
|
-
return
|
|
1035
|
+
return chunkVA2CSOKJ_cjs.rollupSafeName(name, rootDir);
|
|
1036
1036
|
}
|
|
1037
1037
|
function createVirtualDependencies(depsToOptimize, {
|
|
1038
1038
|
projectRoot,
|
|
@@ -1040,7 +1040,7 @@ function createVirtualDependencies(depsToOptimize, {
|
|
|
1040
1040
|
outputDir,
|
|
1041
1041
|
bundlerOptions
|
|
1042
1042
|
}) {
|
|
1043
|
-
const { isDev = false } = bundlerOptions || {};
|
|
1043
|
+
const { isDev = false, externalsPreset = false } = bundlerOptions || {};
|
|
1044
1044
|
const fileNameToDependencyMap = /* @__PURE__ */ new Map();
|
|
1045
1045
|
const optimizedDependencyEntries = /* @__PURE__ */ new Map();
|
|
1046
1046
|
const rootDir = workspaceRoot || projectRoot;
|
|
@@ -1072,7 +1072,7 @@ function createVirtualDependencies(depsToOptimize, {
|
|
|
1072
1072
|
virtual: virtualFile.join("\n")
|
|
1073
1073
|
});
|
|
1074
1074
|
}
|
|
1075
|
-
if (isDev) {
|
|
1075
|
+
if (isDev || externalsPreset) {
|
|
1076
1076
|
for (const [dep, { isWorkspace, rootPath }] of depsToOptimize.entries()) {
|
|
1077
1077
|
if (!isWorkspace || !rootPath || !workspaceRoot) {
|
|
1078
1078
|
continue;
|
|
@@ -1082,7 +1082,7 @@ function createVirtualDependencies(depsToOptimize, {
|
|
|
1082
1082
|
continue;
|
|
1083
1083
|
}
|
|
1084
1084
|
const fileName = posix.basename(currentDepPath.name);
|
|
1085
|
-
const entryName = prepareEntryFileName(
|
|
1085
|
+
const entryName = prepareEntryFileName(chunkVA2CSOKJ_cjs.getCompiledDepCachePath(rootPath, fileName), rootDir);
|
|
1086
1086
|
fileNameToDependencyMap.set(entryName, dep);
|
|
1087
1087
|
optimizedDependencyEntries.set(dep, {
|
|
1088
1088
|
...currentDepPath,
|
|
@@ -1103,7 +1103,7 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
1103
1103
|
for (const pkg2 of transpilePackages) {
|
|
1104
1104
|
const dir = await getPackageRootPath(pkg2);
|
|
1105
1105
|
if (dir) {
|
|
1106
|
-
transpilePackagesMap.set(pkg2,
|
|
1106
|
+
transpilePackagesMap.set(pkg2, chunkVA2CSOKJ_cjs.slash(dir));
|
|
1107
1107
|
} else {
|
|
1108
1108
|
transpilePackagesMap.set(pkg2, workspaceMap.get(pkg2)?.location ?? pkg2);
|
|
1109
1109
|
}
|
|
@@ -1129,7 +1129,7 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
})
|
|
1131
1131
|
}) : null,
|
|
1132
|
-
bundlerOptions.
|
|
1132
|
+
bundlerOptions.noBundling ? {
|
|
1133
1133
|
name: "alias-optimized-deps",
|
|
1134
1134
|
async resolveId(id, importer, options) {
|
|
1135
1135
|
if (!virtualDependencies.has(id)) {
|
|
@@ -1159,11 +1159,11 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
1159
1159
|
transformMixedEsModules: true,
|
|
1160
1160
|
ignoreTryCatch: false
|
|
1161
1161
|
}),
|
|
1162
|
-
bundlerOptions.
|
|
1162
|
+
bundlerOptions.noBundling ? null : nodeResolve__default.default({
|
|
1163
1163
|
preferBuiltins: true,
|
|
1164
1164
|
exportConditions: ["node"]
|
|
1165
1165
|
}),
|
|
1166
|
-
bundlerOptions.
|
|
1166
|
+
bundlerOptions.noBundling ? esmShim() : null,
|
|
1167
1167
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
1168
1168
|
aliasHono(),
|
|
1169
1169
|
json__default.default(),
|
|
@@ -1216,6 +1216,16 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
1216
1216
|
if (virtualDependencies.size === 0) {
|
|
1217
1217
|
return [];
|
|
1218
1218
|
}
|
|
1219
|
+
const noBundling = bundlerOptions.isDev || bundlerOptions.externalsPreset;
|
|
1220
|
+
const plugins = await getInputPlugins2(virtualDependencies, {
|
|
1221
|
+
transpilePackages: packagesToTranspile,
|
|
1222
|
+
workspaceMap,
|
|
1223
|
+
bundlerOptions: {
|
|
1224
|
+
noBundling
|
|
1225
|
+
},
|
|
1226
|
+
rootDir,
|
|
1227
|
+
externals
|
|
1228
|
+
});
|
|
1219
1229
|
const bundler = await rollup.rollup({
|
|
1220
1230
|
logLevel: process.env.MASTRA_BUNDLER_DEBUG === "true" ? "debug" : "silent",
|
|
1221
1231
|
input: Array.from(virtualDependencies.entries()).reduce(
|
|
@@ -1226,14 +1236,8 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
1226
1236
|
{}
|
|
1227
1237
|
),
|
|
1228
1238
|
external: externals,
|
|
1229
|
-
treeshake:
|
|
1230
|
-
plugins
|
|
1231
|
-
transpilePackages: packagesToTranspile,
|
|
1232
|
-
workspaceMap,
|
|
1233
|
-
bundlerOptions,
|
|
1234
|
-
rootDir,
|
|
1235
|
-
externals
|
|
1236
|
-
})
|
|
1239
|
+
treeshake: noBundling ? false : "safest",
|
|
1240
|
+
plugins
|
|
1237
1241
|
});
|
|
1238
1242
|
const outputDirRelative = prepareEntryFileName(outputDir, rootDir);
|
|
1239
1243
|
const { output } = await bundler.write({
|
|
@@ -1247,12 +1251,12 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
1247
1251
|
* So we want to write them to the `.mastra/output` folder as well.
|
|
1248
1252
|
*/
|
|
1249
1253
|
chunkFileNames: (chunkInfo) => {
|
|
1250
|
-
if (
|
|
1254
|
+
if (noBundling) {
|
|
1251
1255
|
const importedFromPackages = /* @__PURE__ */ new Set();
|
|
1252
1256
|
for (const moduleId of chunkInfo.moduleIds) {
|
|
1253
|
-
const normalized =
|
|
1257
|
+
const normalized = chunkVA2CSOKJ_cjs.slash(moduleId);
|
|
1254
1258
|
for (const [pkgName, pkgInfo] of workspaceMap.entries()) {
|
|
1255
|
-
const location =
|
|
1259
|
+
const location = chunkVA2CSOKJ_cjs.slash(pkgInfo.location);
|
|
1256
1260
|
if (normalized.startsWith(location)) {
|
|
1257
1261
|
importedFromPackages.add(pkgName);
|
|
1258
1262
|
break;
|
|
@@ -1274,7 +1278,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
1274
1278
|
if (importedFromPackages.size === 1) {
|
|
1275
1279
|
const [pkgName] = importedFromPackages;
|
|
1276
1280
|
const workspaceLocation = workspaceMap.get(pkgName).location;
|
|
1277
|
-
return prepareEntryFileName(
|
|
1281
|
+
return prepareEntryFileName(chunkVA2CSOKJ_cjs.getCompiledDepCachePath(workspaceLocation, "[name].mjs"), rootDir);
|
|
1278
1282
|
}
|
|
1279
1283
|
}
|
|
1280
1284
|
return `${outputDirRelative}/[name].mjs`;
|
|
@@ -1288,7 +1292,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
1288
1292
|
function findExternalImporter(module, external, allOutputs) {
|
|
1289
1293
|
const capturedFiles = /* @__PURE__ */ new Set();
|
|
1290
1294
|
for (const id of module.imports) {
|
|
1291
|
-
if (
|
|
1295
|
+
if (chunkVA2CSOKJ_cjs.isDependencyPartOfPackage(id, external)) {
|
|
1292
1296
|
return module;
|
|
1293
1297
|
} else {
|
|
1294
1298
|
if (id.endsWith(".mjs")) {
|
|
@@ -1309,19 +1313,31 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
1309
1313
|
}
|
|
1310
1314
|
async function bundleExternals(depsToOptimize, outputDir, options) {
|
|
1311
1315
|
const { workspaceRoot = null, workspaceMap = /* @__PURE__ */ new Map(), projectRoot = outputDir, bundlerOptions = {} } = options;
|
|
1312
|
-
const {
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1316
|
+
const { externals: customExternals = [], transpilePackages = [], isDev = false } = bundlerOptions || {};
|
|
1317
|
+
let externalsPreset = false;
|
|
1318
|
+
if (customExternals === true) {
|
|
1319
|
+
externalsPreset = true;
|
|
1320
|
+
}
|
|
1321
|
+
const externalsList = Array.isArray(customExternals) ? customExternals : [];
|
|
1322
|
+
const allExternals = [...GLOBAL_EXTERNALS, ...DEPRECATED_EXTERNALS, ...externalsList];
|
|
1317
1323
|
const workspacePackagesNames = Array.from(workspaceMap.keys());
|
|
1318
1324
|
const packagesToTranspile = /* @__PURE__ */ new Set([...transpilePackages, ...workspacePackagesNames]);
|
|
1325
|
+
const extractedExternals = /* @__PURE__ */ new Map();
|
|
1326
|
+
if (externalsPreset) {
|
|
1327
|
+
for (const [dep, metadata] of depsToOptimize.entries()) {
|
|
1328
|
+
if (!metadata.isWorkspace) {
|
|
1329
|
+
extractedExternals.set(dep, metadata.rootPath ?? dep);
|
|
1330
|
+
depsToOptimize.delete(dep);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1319
1334
|
const { optimizedDependencyEntries, fileNameToDependencyMap } = createVirtualDependencies(depsToOptimize, {
|
|
1320
1335
|
workspaceRoot,
|
|
1321
1336
|
outputDir,
|
|
1322
1337
|
projectRoot,
|
|
1323
1338
|
bundlerOptions: {
|
|
1324
|
-
isDev
|
|
1339
|
+
isDev,
|
|
1340
|
+
externalsPreset
|
|
1325
1341
|
}
|
|
1326
1342
|
});
|
|
1327
1343
|
const output = await buildExternalDependencies(optimizedDependencyEntries, {
|
|
@@ -1331,7 +1347,8 @@ async function bundleExternals(depsToOptimize, outputDir, options) {
|
|
|
1331
1347
|
rootDir: workspaceRoot || projectRoot,
|
|
1332
1348
|
outputDir,
|
|
1333
1349
|
bundlerOptions: {
|
|
1334
|
-
isDev
|
|
1350
|
+
isDev,
|
|
1351
|
+
externalsPreset
|
|
1335
1352
|
}
|
|
1336
1353
|
});
|
|
1337
1354
|
const moduleResolveMap2 = /* @__PURE__ */ new Map();
|
|
@@ -1366,6 +1383,14 @@ async function bundleExternals(depsToOptimize, outputDir, options) {
|
|
|
1366
1383
|
}
|
|
1367
1384
|
usedExternals[fullPath] = innerObj;
|
|
1368
1385
|
}
|
|
1386
|
+
if (extractedExternals.size > 0) {
|
|
1387
|
+
const syntheticPath = path2__namespace.join(workspaceRoot || projectRoot, "__externals__");
|
|
1388
|
+
const externalsObj = /* @__PURE__ */ Object.create(null);
|
|
1389
|
+
for (const [dep, rootPath] of extractedExternals) {
|
|
1390
|
+
externalsObj[dep] = rootPath;
|
|
1391
|
+
}
|
|
1392
|
+
usedExternals[syntheticPath] = externalsObj;
|
|
1393
|
+
}
|
|
1369
1394
|
return { output, fileNameToDependencyMap, usedExternals };
|
|
1370
1395
|
}
|
|
1371
1396
|
|
|
@@ -1641,7 +1666,7 @@ async function analyzeBundle(entries, mastraEntry, {
|
|
|
1641
1666
|
outputDir,
|
|
1642
1667
|
projectRoot,
|
|
1643
1668
|
isDev = false,
|
|
1644
|
-
bundlerOptions
|
|
1669
|
+
bundlerOptions
|
|
1645
1670
|
}, logger) {
|
|
1646
1671
|
const mastraConfig = await promises.readFile(mastraEntry, "utf-8");
|
|
1647
1672
|
const mastraConfigResult = {
|
|
@@ -1660,28 +1685,30 @@ export const mastra = new Mastra({
|
|
|
1660
1685
|
|
|
1661
1686
|
If you think your configuration is valid, please open an issue.`);
|
|
1662
1687
|
}
|
|
1663
|
-
const { enableEsmShim = true } = _bundlerOptions || {};
|
|
1664
|
-
const bundlerOptions = await getBundlerOptions(mastraEntry, outputDir);
|
|
1665
1688
|
const { workspaceMap, workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile: mastraEntry });
|
|
1689
|
+
let externalsPreset = false;
|
|
1690
|
+
const userExternals = Array.isArray(bundlerOptions?.externals) ? bundlerOptions?.externals : [];
|
|
1691
|
+
if (bundlerOptions?.externals === true) {
|
|
1692
|
+
externalsPreset = true;
|
|
1693
|
+
}
|
|
1666
1694
|
let index = 0;
|
|
1667
1695
|
const depsToOptimize = /* @__PURE__ */ new Map();
|
|
1668
|
-
const
|
|
1669
|
-
const allExternals = [...GLOBAL_EXTERNALS, ...customExternals];
|
|
1696
|
+
const allExternals = [...GLOBAL_EXTERNALS, ...userExternals].filter(Boolean);
|
|
1670
1697
|
logger.info("Analyzing dependencies...");
|
|
1671
1698
|
const allUsedExternals = /* @__PURE__ */ new Set();
|
|
1672
1699
|
for (const entry of entries) {
|
|
1673
1700
|
const isVirtualFile = entry.includes("\n") || !fs.existsSync(entry);
|
|
1674
1701
|
const analyzeResult = await analyzeEntry({ entry, isVirtualFile }, mastraEntry, {
|
|
1675
1702
|
logger,
|
|
1676
|
-
sourcemapEnabled: bundlerOptions?.
|
|
1703
|
+
sourcemapEnabled: bundlerOptions?.enableSourcemap ?? false,
|
|
1677
1704
|
workspaceMap,
|
|
1678
1705
|
projectRoot,
|
|
1679
|
-
shouldCheckTransitiveDependencies: isDev
|
|
1706
|
+
shouldCheckTransitiveDependencies: isDev || externalsPreset
|
|
1680
1707
|
});
|
|
1681
1708
|
await promises.writeFile(path2.join(outputDir, `entry-${index++}.mjs`), analyzeResult.output.code);
|
|
1682
1709
|
for (const [dep, metadata] of analyzeResult.dependencies.entries()) {
|
|
1683
|
-
const isPartOfExternals = allExternals.some((external) =>
|
|
1684
|
-
if (isPartOfExternals) {
|
|
1710
|
+
const isPartOfExternals = allExternals.some((external) => chunkVA2CSOKJ_cjs.isDependencyPartOfPackage(dep, external));
|
|
1711
|
+
if (isPartOfExternals || externalsPreset && !metadata.isWorkspace) {
|
|
1685
1712
|
allUsedExternals.add(dep);
|
|
1686
1713
|
continue;
|
|
1687
1714
|
}
|
|
@@ -1696,7 +1723,7 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1696
1723
|
}
|
|
1697
1724
|
}
|
|
1698
1725
|
}
|
|
1699
|
-
if (isDev) {
|
|
1726
|
+
if (isDev || externalsPreset) {
|
|
1700
1727
|
for (const [dep, metadata] of depsToOptimize.entries()) {
|
|
1701
1728
|
if (!metadata.isWorkspace) {
|
|
1702
1729
|
depsToOptimize.delete(dep);
|
|
@@ -1709,14 +1736,36 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1709
1736
|
const { output, fileNameToDependencyMap, usedExternals } = await bundleExternals(depsToOptimize, outputDir, {
|
|
1710
1737
|
bundlerOptions: {
|
|
1711
1738
|
...bundlerOptions,
|
|
1712
|
-
externals: allExternals,
|
|
1713
|
-
enableEsmShim,
|
|
1739
|
+
externals: bundlerOptions?.externals ?? allExternals,
|
|
1714
1740
|
isDev
|
|
1715
1741
|
},
|
|
1716
1742
|
projectRoot,
|
|
1717
1743
|
workspaceRoot,
|
|
1718
1744
|
workspaceMap
|
|
1719
1745
|
});
|
|
1746
|
+
const relativeWorkspaceFolderPaths = Array.from(workspaceMap.values()).map(
|
|
1747
|
+
(pkgInfo) => path2.relative(workspaceRoot || projectRoot, pkgInfo.location)
|
|
1748
|
+
);
|
|
1749
|
+
for (const o of output) {
|
|
1750
|
+
if (o.type === "asset") {
|
|
1751
|
+
continue;
|
|
1752
|
+
}
|
|
1753
|
+
for (const i of o.imports) {
|
|
1754
|
+
if (chunkVA2CSOKJ_cjs.isBuiltinModule(i)) {
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
if (i.startsWith(".") || i.startsWith("/")) {
|
|
1758
|
+
continue;
|
|
1759
|
+
}
|
|
1760
|
+
if (relativeWorkspaceFolderPaths.some((workspacePath) => i.startsWith(workspacePath))) {
|
|
1761
|
+
continue;
|
|
1762
|
+
}
|
|
1763
|
+
const pkgName = chunkVA2CSOKJ_cjs.getPackageName(i);
|
|
1764
|
+
if (pkgName) {
|
|
1765
|
+
allUsedExternals.add(pkgName);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1720
1769
|
const result = await validateOutput(
|
|
1721
1770
|
{
|
|
1722
1771
|
output,
|
|
@@ -1746,5 +1795,5 @@ exports.removeAllOptionsFromMastraExcept = removeAllOptionsFromMastraExcept;
|
|
|
1746
1795
|
exports.removeDeployer = removeDeployer2;
|
|
1747
1796
|
exports.subpathExternalsResolver = subpathExternalsResolver;
|
|
1748
1797
|
exports.tsConfigPaths = tsConfigPaths;
|
|
1749
|
-
//# sourceMappingURL=chunk-
|
|
1750
|
-
//# sourceMappingURL=chunk-
|
|
1798
|
+
//# sourceMappingURL=chunk-UJXH5MNH.cjs.map
|
|
1799
|
+
//# sourceMappingURL=chunk-UJXH5MNH.cjs.map
|