mastra 0.1.57-unstable.91 → 0.1.57-unstable.92
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/utils/bundle.d.ts +4 -0
- package/dist/utils/bundle.d.ts.map +1 -1
- package/dist/utils/bundle.js +19 -5
- package/package.json +1 -1
package/dist/utils/bundle.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export declare function bundleServer(entryPoint: string): Promise<esbuild.BuildR
|
|
|
20
20
|
logOverride: {
|
|
21
21
|
'commonjs-variable-in-esm': "silent";
|
|
22
22
|
};
|
|
23
|
+
plugins: {
|
|
24
|
+
name: string;
|
|
25
|
+
setup(build: any): void;
|
|
26
|
+
}[];
|
|
23
27
|
}>>;
|
|
24
28
|
export declare function bundle(dirPath: string, options?: {
|
|
25
29
|
outfile?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAanC,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAanC,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;qBAYlC,GAAG;;IAkGrB;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;IAuGnH"}
|
package/dist/utils/bundle.js
CHANGED
|
@@ -13,11 +13,20 @@ export async function bundleServer(entryPoint) {
|
|
|
13
13
|
upsertMastraDir();
|
|
14
14
|
const outfile = join(process.cwd(), '.mastra', 'server.mjs');
|
|
15
15
|
const cliNodeModules = join(path.dirname(path.dirname(__dirname)), 'node_modules');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
let missingMastraDependency = false;
|
|
17
|
+
const externalIfMissingPlugin = {
|
|
18
|
+
name: 'external-if-missing',
|
|
19
|
+
setup(build) {
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
build.onResolve(({}, args) => {
|
|
23
|
+
if (!fs.existsSync(path.join(args.resolveDir, args.path))) {
|
|
24
|
+
missingMastraDependency = true;
|
|
25
|
+
return { path: args.path, external: true };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
21
30
|
const result = await esbuild.build({
|
|
22
31
|
entryPoints: [entryPoint],
|
|
23
32
|
bundle: true,
|
|
@@ -81,7 +90,12 @@ export async function bundleServer(entryPoint) {
|
|
|
81
90
|
logOverride: {
|
|
82
91
|
'commonjs-variable-in-esm': 'silent',
|
|
83
92
|
},
|
|
93
|
+
plugins: [externalIfMissingPlugin],
|
|
84
94
|
});
|
|
95
|
+
if (missingMastraDependency) {
|
|
96
|
+
console.error('Missing Mastra dependency. Please install it using `npm i -g mastra`');
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
85
99
|
// Output build metadata
|
|
86
100
|
await esbuild.analyzeMetafile(result.metafile);
|
|
87
101
|
return result;
|