@mastra/deployer 0.12.0-alpha.1 → 0.12.0-alpha.3
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 +13 -5
- package/dist/_tsup-dts-rollup.d.ts +13 -5
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +12 -12
- package/dist/build/index.js +4 -4
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-WKW236CI.cjs → chunk-2PH2MAPX.cjs} +3 -2
- package/dist/{chunk-TLGEPS44.js → chunk-4LXGDG3B.js} +6 -7
- package/dist/{chunk-DB7LRMOC.js → chunk-65VPZFEJ.js} +17 -9
- package/dist/{chunk-D73JIE6N.cjs → chunk-F77MZS66.cjs} +23 -15
- package/dist/{chunk-TK2RG7LU.cjs → chunk-IKFMMDLP.cjs} +12 -11
- package/dist/{chunk-WTGMSQT5.cjs → chunk-IU62EKC5.cjs} +8 -9
- package/dist/{chunk-APPDEIPA.js → chunk-JJZZYEAE.js} +6 -5
- package/dist/{chunk-NB6XIOPQ.js → chunk-QKFJZOFK.js} +1 -1
- package/dist/{chunk-HZNWZQHG.js → chunk-SKERVR44.js} +3 -3
- package/dist/{chunk-MOG6ASL4.cjs → chunk-SZ72UHWX.cjs} +4 -4
- package/dist/{chunk-AFR3LY44.js → chunk-TDQ2ALQJ.js} +3 -2
- package/dist/{chunk-E7ZSCQUV.cjs → chunk-YXXASUVF.cjs} +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +308 -4
- package/dist/server/index.js +309 -5
- package/package.json +5 -5
|
@@ -49,7 +49,7 @@ export declare function aliasHono(): Plugin;
|
|
|
49
49
|
*
|
|
50
50
|
* This helps identify which dependencies need to be externalized vs bundled.
|
|
51
51
|
*/
|
|
52
|
-
declare function analyzeBundle(entries: string[], mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: IMastraLogger): Promise<{
|
|
52
|
+
declare function analyzeBundle(entries: string[], mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: IMastraLogger, sourcemapEnabled?: boolean): Promise<{
|
|
53
53
|
invalidChunks: Set<string>;
|
|
54
54
|
dependencies: Map<string, string>;
|
|
55
55
|
externalDependencies: Set<string>;
|
|
@@ -113,7 +113,7 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
113
113
|
rootDir?: string;
|
|
114
114
|
outputDirectory: string;
|
|
115
115
|
}): Promise<void>;
|
|
116
|
-
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
116
|
+
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[], sourcemapEnabled?: boolean): Promise<InputOptions>;
|
|
117
117
|
getToolsInputOptions(toolsPaths: string[]): Promise<Record<string, string>>;
|
|
118
118
|
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
|
|
119
119
|
lint(_entryFile: string, _outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
@@ -193,6 +193,8 @@ export declare const defaultAuthConfig: MastraAuthConfig;
|
|
|
193
193
|
|
|
194
194
|
export declare function deleteIndex(c: Context): Promise<Response>;
|
|
195
195
|
|
|
196
|
+
export declare function deleteMessagesHandler(c: Context): Promise<Response>;
|
|
197
|
+
|
|
196
198
|
export declare function deleteThreadHandler(c: Context): Promise<Response>;
|
|
197
199
|
|
|
198
200
|
declare abstract class Deployer extends Bundler implements IDeployer {
|
|
@@ -417,11 +419,15 @@ testPath?: string | undefined;
|
|
|
417
419
|
}[];
|
|
418
420
|
}, ContentfulStatusCode, "json">>;
|
|
419
421
|
|
|
420
|
-
declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string
|
|
422
|
+
declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string>, { sourcemap }?: {
|
|
423
|
+
sourcemap?: boolean;
|
|
424
|
+
}): Promise<InputOptions>;
|
|
421
425
|
export { getInputOptions as getBundlerInputOptions }
|
|
422
426
|
export { getInputOptions }
|
|
423
427
|
|
|
424
|
-
declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string
|
|
428
|
+
declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string>, { sourcemap }?: {
|
|
429
|
+
sourcemap?: boolean;
|
|
430
|
+
}): Promise<InputOptions>;
|
|
425
431
|
export { getInputOptions_2 as getInputOptions_alias_1 }
|
|
426
432
|
export { getInputOptions_2 as getWatcherInputOptions }
|
|
427
433
|
|
|
@@ -802,7 +808,9 @@ export declare function removeAllOptionsFromMastraExcept(result: {
|
|
|
802
808
|
|
|
803
809
|
export declare function removeDeployer(): babel_2.PluginObj;
|
|
804
810
|
|
|
805
|
-
export declare function removeDeployer_alias_1(mastraEntry: string
|
|
811
|
+
export declare function removeDeployer_alias_1(mastraEntry: string, options?: {
|
|
812
|
+
sourcemap?: boolean;
|
|
813
|
+
}): Plugin;
|
|
806
814
|
|
|
807
815
|
export declare function removeNonReferencedNodes(): babel_2.PluginObj;
|
|
808
816
|
|
|
@@ -49,7 +49,7 @@ export declare function aliasHono(): Plugin;
|
|
|
49
49
|
*
|
|
50
50
|
* This helps identify which dependencies need to be externalized vs bundled.
|
|
51
51
|
*/
|
|
52
|
-
declare function analyzeBundle(entries: string[], mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: IMastraLogger): Promise<{
|
|
52
|
+
declare function analyzeBundle(entries: string[], mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: IMastraLogger, sourcemapEnabled?: boolean): Promise<{
|
|
53
53
|
invalidChunks: Set<string>;
|
|
54
54
|
dependencies: Map<string, string>;
|
|
55
55
|
externalDependencies: Set<string>;
|
|
@@ -113,7 +113,7 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
113
113
|
rootDir?: string;
|
|
114
114
|
outputDirectory: string;
|
|
115
115
|
}): Promise<void>;
|
|
116
|
-
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
116
|
+
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[], sourcemapEnabled?: boolean): Promise<InputOptions>;
|
|
117
117
|
getToolsInputOptions(toolsPaths: string[]): Promise<Record<string, string>>;
|
|
118
118
|
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
|
|
119
119
|
lint(_entryFile: string, _outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
@@ -193,6 +193,8 @@ export declare const defaultAuthConfig: MastraAuthConfig;
|
|
|
193
193
|
|
|
194
194
|
export declare function deleteIndex(c: Context): Promise<Response>;
|
|
195
195
|
|
|
196
|
+
export declare function deleteMessagesHandler(c: Context): Promise<Response>;
|
|
197
|
+
|
|
196
198
|
export declare function deleteThreadHandler(c: Context): Promise<Response>;
|
|
197
199
|
|
|
198
200
|
declare abstract class Deployer extends Bundler implements IDeployer {
|
|
@@ -417,11 +419,15 @@ testPath?: string | undefined;
|
|
|
417
419
|
}[];
|
|
418
420
|
}, ContentfulStatusCode, "json">>;
|
|
419
421
|
|
|
420
|
-
declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string
|
|
422
|
+
declare function getInputOptions(entryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, platform: 'node' | 'browser', env?: Record<string, string>, { sourcemap }?: {
|
|
423
|
+
sourcemap?: boolean;
|
|
424
|
+
}): Promise<InputOptions>;
|
|
421
425
|
export { getInputOptions as getBundlerInputOptions }
|
|
422
426
|
export { getInputOptions }
|
|
423
427
|
|
|
424
|
-
declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string
|
|
428
|
+
declare function getInputOptions_2(entryFile: string, platform: 'node' | 'browser', env?: Record<string, string>, { sourcemap }?: {
|
|
429
|
+
sourcemap?: boolean;
|
|
430
|
+
}): Promise<InputOptions>;
|
|
425
431
|
export { getInputOptions_2 as getInputOptions_alias_1 }
|
|
426
432
|
export { getInputOptions_2 as getWatcherInputOptions }
|
|
427
433
|
|
|
@@ -802,7 +808,9 @@ export declare function removeAllOptionsFromMastraExcept(result: {
|
|
|
802
808
|
|
|
803
809
|
export declare function removeDeployer(): babel_2.PluginObj;
|
|
804
810
|
|
|
805
|
-
export declare function removeDeployer_alias_1(mastraEntry: string
|
|
811
|
+
export declare function removeDeployer_alias_1(mastraEntry: string, options?: {
|
|
812
|
+
sourcemap?: boolean;
|
|
813
|
+
}): Plugin;
|
|
806
814
|
|
|
807
815
|
export declare function removeNonReferencedNodes(): babel_2.PluginObj;
|
|
808
816
|
|
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIU62EKC5_cjs = require('../chunk-IU62EKC5.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 chunkIU62EKC5_cjs.analyzeBundle; }
|
|
10
10
|
});
|
package/dist/build/analyze.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { analyzeBundle } from '../chunk-
|
|
1
|
+
export { analyzeBundle } from '../chunk-4LXGDG3B.js';
|
package/dist/build/bundler.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSZ72UHWX_cjs = require('../chunk-SZ72UHWX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createBundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkSZ72UHWX_cjs.createBundler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getInputOptions", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkSZ72UHWX_cjs.getInputOptions; }
|
|
14
14
|
});
|
package/dist/build/bundler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createBundler, getInputOptions } from '../chunk-
|
|
1
|
+
export { createBundler, getInputOptions } from '../chunk-SKERVR44.js';
|
package/dist/build/index.cjs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkIKFMMDLP_cjs = require('../chunk-IKFMMDLP.cjs');
|
|
4
|
+
var chunkYXXASUVF_cjs = require('../chunk-YXXASUVF.cjs');
|
|
5
|
+
var chunkIU62EKC5_cjs = require('../chunk-IU62EKC5.cjs');
|
|
6
|
+
var chunkSZ72UHWX_cjs = require('../chunk-SZ72UHWX.cjs');
|
|
7
7
|
var chunkF25LATVR_cjs = require('../chunk-F25LATVR.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "createWatcher", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkIKFMMDLP_cjs.createWatcher; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getServerOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkIKFMMDLP_cjs.getServerOptions; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkIKFMMDLP_cjs.getInputOptions; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "writeTelemetryConfig", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkYXXASUVF_cjs.writeTelemetryConfig; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkIU62EKC5_cjs.analyzeBundle; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkIU62EKC5_cjs.getBundlerOptions; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "createBundler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkSZ72UHWX_cjs.createBundler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "getBundlerInputOptions", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkSZ72UHWX_cjs.getInputOptions; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "Deps", {
|
|
44
44
|
enumerable: true,
|
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, getBundlerOptions } from '../chunk-
|
|
4
|
-
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-JJZZYEAE.js';
|
|
2
|
+
export { writeTelemetryConfig } from '../chunk-QKFJZOFK.js';
|
|
3
|
+
export { analyzeBundle, getBundlerOptions } from '../chunk-4LXGDG3B.js';
|
|
4
|
+
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-SKERVR44.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-7HFWRNM7.js';
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkF77MZS66_cjs = require('../chunk-F77MZS66.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 chunkF77MZS66_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-65VPZFEJ.js';
|
|
@@ -74,7 +74,7 @@ function removeDeployer() {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// src/build/plugins/remove-deployer.ts
|
|
77
|
-
function removeDeployer2(mastraEntry) {
|
|
77
|
+
function removeDeployer2(mastraEntry, options) {
|
|
78
78
|
return {
|
|
79
79
|
name: "remove-deployer",
|
|
80
80
|
transform(code, id) {
|
|
@@ -88,7 +88,8 @@ function removeDeployer2(mastraEntry) {
|
|
|
88
88
|
babelrc: false,
|
|
89
89
|
configFile: false,
|
|
90
90
|
filename: id,
|
|
91
|
-
plugins: [removeDeployer]
|
|
91
|
+
plugins: [removeDeployer],
|
|
92
|
+
sourceMaps: options?.sourcemap
|
|
92
93
|
},
|
|
93
94
|
(err, result) => {
|
|
94
95
|
if (err) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tsConfigPaths, removeDeployer } from './chunk-
|
|
1
|
+
import { tsConfigPaths, removeDeployer } from './chunk-TDQ2ALQJ.js';
|
|
2
2
|
import commonjs2 from '@rollup/plugin-commonjs';
|
|
3
3
|
import json from '@rollup/plugin-json';
|
|
4
4
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
@@ -347,7 +347,7 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
347
347
|
}
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
|
-
async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
350
|
+
async function analyze(entry, mastraEntry, isVirtualFile, platform, logger, sourcemapEnabled = false) {
|
|
351
351
|
logger.info("Analyzing dependencies...");
|
|
352
352
|
let virtualPlugin = null;
|
|
353
353
|
if (isVirtualFile) {
|
|
@@ -397,7 +397,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
397
397
|
transformMixedEsModules: true,
|
|
398
398
|
extensions: [".js", ".ts"]
|
|
399
399
|
}),
|
|
400
|
-
removeDeployer(normalizedMastraEntry),
|
|
400
|
+
removeDeployer(normalizedMastraEntry, { sourcemap: sourcemapEnabled }),
|
|
401
401
|
esbuild({
|
|
402
402
|
target: "node20",
|
|
403
403
|
platform,
|
|
@@ -493,8 +493,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger, customExternal
|
|
|
493
493
|
}),
|
|
494
494
|
nodeResolve({
|
|
495
495
|
preferBuiltins: true,
|
|
496
|
-
exportConditions: ["node"
|
|
497
|
-
mainFields: ["module", "main"]
|
|
496
|
+
exportConditions: ["node"]
|
|
498
497
|
}),
|
|
499
498
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
500
499
|
aliasHono(),
|
|
@@ -570,11 +569,11 @@ async function validateOutput({
|
|
|
570
569
|
}
|
|
571
570
|
return result;
|
|
572
571
|
}
|
|
573
|
-
async function analyzeBundle(entries, mastraEntry, outputDir, platform, logger) {
|
|
572
|
+
async function analyzeBundle(entries, mastraEntry, outputDir, platform, logger, sourcemapEnabled = false) {
|
|
574
573
|
const depsToOptimize = /* @__PURE__ */ new Map();
|
|
575
574
|
for (const entry of entries) {
|
|
576
575
|
const isVirtualFile = entry.includes("\n") || !existsSync(entry);
|
|
577
|
-
const analyzeResult = await analyze(entry, mastraEntry, isVirtualFile, platform, logger);
|
|
576
|
+
const analyzeResult = await analyze(entry, mastraEntry, isVirtualFile, platform, logger, sourcemapEnabled);
|
|
578
577
|
for (const [dep, exports] of analyzeResult.entries()) {
|
|
579
578
|
if (depsToOptimize.has(dep)) {
|
|
580
579
|
const existingExports = depsToOptimize.get(dep);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { writeTelemetryConfig } from './chunk-
|
|
2
|
-
import { analyzeBundle, getBundlerOptions } from './chunk-
|
|
3
|
-
import { createBundler, getInputOptions } from './chunk-
|
|
1
|
+
import { writeTelemetryConfig } from './chunk-QKFJZOFK.js';
|
|
2
|
+
import { analyzeBundle, getBundlerOptions } from './chunk-4LXGDG3B.js';
|
|
3
|
+
import { createBundler, getInputOptions } from './chunk-SKERVR44.js';
|
|
4
4
|
import { DepsService, FileService } from './chunk-7HFWRNM7.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { writeFile, stat } from 'fs/promises';
|
|
@@ -252,10 +252,16 @@ var Bundler = class extends MastraBundler {
|
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
|
|
256
|
-
const inputOptions = await getInputOptions(
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, sourcemapEnabled = false) {
|
|
256
|
+
const inputOptions = await getInputOptions(
|
|
257
|
+
mastraEntryFile,
|
|
258
|
+
analyzedBundleInfo,
|
|
259
|
+
"node",
|
|
260
|
+
{
|
|
261
|
+
"process.env.NODE_ENV": JSON.stringify("production")
|
|
262
|
+
},
|
|
263
|
+
{ sourcemap: sourcemapEnabled }
|
|
264
|
+
);
|
|
259
265
|
const isVirtual = serverFile.includes("\n") || existsSync(serverFile);
|
|
260
266
|
const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);
|
|
261
267
|
if (isVirtual) {
|
|
@@ -313,7 +319,8 @@ var Bundler = class extends MastraBundler {
|
|
|
313
319
|
mastraEntryFile,
|
|
314
320
|
join(outputDirectory, this.analyzeOutputDir),
|
|
315
321
|
"node",
|
|
316
|
-
this.logger
|
|
322
|
+
this.logger,
|
|
323
|
+
sourcemap
|
|
317
324
|
);
|
|
318
325
|
} catch (error) {
|
|
319
326
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -435,7 +442,8 @@ var Bundler = class extends MastraBundler {
|
|
|
435
442
|
serverFile,
|
|
436
443
|
mastraEntryFile,
|
|
437
444
|
analyzedBundleInfo,
|
|
438
|
-
toolsPaths
|
|
445
|
+
toolsPaths,
|
|
446
|
+
sourcemap
|
|
439
447
|
);
|
|
440
448
|
const bundler = await this.createBundler(
|
|
441
449
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYXXASUVF_cjs = require('./chunk-YXXASUVF.cjs');
|
|
4
|
+
var chunkIU62EKC5_cjs = require('./chunk-IU62EKC5.cjs');
|
|
5
|
+
var chunkSZ72UHWX_cjs = require('./chunk-SZ72UHWX.cjs');
|
|
6
6
|
var chunkF25LATVR_cjs = require('./chunk-F25LATVR.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
var promises = require('fs/promises');
|
|
@@ -170,7 +170,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
170
170
|
}
|
|
171
171
|
async writeInstrumentationFile(outputDirectory, customInstrumentationFile) {
|
|
172
172
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
173
|
-
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-
|
|
173
|
+
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-F77MZS66.cjs', document.baseURI).href))));
|
|
174
174
|
if (customInstrumentationFile) {
|
|
175
175
|
await fsExtra.copy(customInstrumentationFile, instrumentationFile);
|
|
176
176
|
} else {
|
|
@@ -226,10 +226,10 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
createBundler(inputOptions, outputOptions) {
|
|
229
|
-
return
|
|
229
|
+
return chunkSZ72UHWX_cjs.createBundler(inputOptions, outputOptions);
|
|
230
230
|
}
|
|
231
231
|
async analyze(entry, mastraFile, outputDirectory) {
|
|
232
|
-
return await
|
|
232
|
+
return await chunkIU62EKC5_cjs.analyzeBundle(
|
|
233
233
|
[].concat(entry),
|
|
234
234
|
mastraFile,
|
|
235
235
|
path.join(outputDirectory, this.analyzeOutputDir),
|
|
@@ -264,10 +264,16 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
|
|
268
|
-
const inputOptions = await
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, sourcemapEnabled = false) {
|
|
268
|
+
const inputOptions = await chunkSZ72UHWX_cjs.getInputOptions(
|
|
269
|
+
mastraEntryFile,
|
|
270
|
+
analyzedBundleInfo,
|
|
271
|
+
"node",
|
|
272
|
+
{
|
|
273
|
+
"process.env.NODE_ENV": JSON.stringify("production")
|
|
274
|
+
},
|
|
275
|
+
{ sourcemap: sourcemapEnabled }
|
|
276
|
+
);
|
|
271
277
|
const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
|
|
272
278
|
const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);
|
|
273
279
|
if (isVirtual) {
|
|
@@ -312,7 +318,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
312
318
|
this.logger.info("Start bundling Mastra");
|
|
313
319
|
let sourcemap = false;
|
|
314
320
|
try {
|
|
315
|
-
const bundlerOptions = await
|
|
321
|
+
const bundlerOptions = await chunkIU62EKC5_cjs.getBundlerOptions(mastraEntryFile, outputDirectory);
|
|
316
322
|
sourcemap = !!bundlerOptions?.sourcemap;
|
|
317
323
|
} catch (error) {
|
|
318
324
|
this.logger.debug("Failed to get bundler options, sourcemap will be disabled", { error });
|
|
@@ -320,12 +326,13 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
320
326
|
let analyzedBundleInfo;
|
|
321
327
|
try {
|
|
322
328
|
const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);
|
|
323
|
-
analyzedBundleInfo = await
|
|
329
|
+
analyzedBundleInfo = await chunkIU62EKC5_cjs.analyzeBundle(
|
|
324
330
|
[serverFile, ...Object.values(resolvedToolsPaths)],
|
|
325
331
|
mastraEntryFile,
|
|
326
332
|
path.join(outputDirectory, this.analyzeOutputDir),
|
|
327
333
|
"node",
|
|
328
|
-
this.logger
|
|
334
|
+
this.logger,
|
|
335
|
+
sourcemap
|
|
329
336
|
);
|
|
330
337
|
} catch (error$1) {
|
|
331
338
|
const message = error$1 instanceof Error ? error$1.message : String(error$1);
|
|
@@ -341,7 +348,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
341
348
|
}
|
|
342
349
|
let externalDependencies;
|
|
343
350
|
try {
|
|
344
|
-
const result = await
|
|
351
|
+
const result = await chunkYXXASUVF_cjs.writeTelemetryConfig({
|
|
345
352
|
entryFile: mastraEntryFile,
|
|
346
353
|
outputDir: path.join(outputDirectory, this.outputDir),
|
|
347
354
|
options: {
|
|
@@ -447,7 +454,8 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
447
454
|
serverFile,
|
|
448
455
|
mastraEntryFile,
|
|
449
456
|
analyzedBundleInfo,
|
|
450
|
-
toolsPaths
|
|
457
|
+
toolsPaths,
|
|
458
|
+
sourcemap
|
|
451
459
|
);
|
|
452
460
|
const bundler = await this.createBundler(
|
|
453
461
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkIU62EKC5_cjs = require('./chunk-IU62EKC5.cjs');
|
|
4
|
+
var chunkSZ72UHWX_cjs = require('./chunk-SZ72UHWX.cjs');
|
|
5
|
+
var chunk2PH2MAPX_cjs = require('./chunk-2PH2MAPX.cjs');
|
|
6
6
|
var rollup = require('rollup');
|
|
7
7
|
var path = require('path');
|
|
8
8
|
var resolveFrom = require('resolve-from');
|
|
@@ -112,8 +112,8 @@ function nodeModulesExtensionResolver() {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// src/build/watcher.ts
|
|
115
|
-
async function getInputOptions2(entryFile, platform, env) {
|
|
116
|
-
const inputOptions = await
|
|
115
|
+
async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
|
|
116
|
+
const inputOptions = await chunkSZ72UHWX_cjs.getInputOptions(
|
|
117
117
|
entryFile,
|
|
118
118
|
{
|
|
119
119
|
dependencies: /* @__PURE__ */ new Map(),
|
|
@@ -121,7 +121,8 @@ async function getInputOptions2(entryFile, platform, env) {
|
|
|
121
121
|
invalidChunks: /* @__PURE__ */ new Set()
|
|
122
122
|
},
|
|
123
123
|
platform,
|
|
124
|
-
env
|
|
124
|
+
env,
|
|
125
|
+
{ sourcemap }
|
|
125
126
|
);
|
|
126
127
|
if (Array.isArray(inputOptions.plugins)) {
|
|
127
128
|
inputOptions.plugins = inputOptions.plugins.filter(
|
|
@@ -129,11 +130,11 @@ async function getInputOptions2(entryFile, platform, env) {
|
|
|
129
130
|
(plugin) => !plugin || !plugin?.name || plugin.name !== "node-resolve" && plugin.name !== "tsconfig-paths"
|
|
130
131
|
);
|
|
131
132
|
inputOptions.plugins.unshift(
|
|
132
|
-
|
|
133
|
+
chunk2PH2MAPX_cjs.tsConfigPaths({
|
|
133
134
|
localResolve: true
|
|
134
135
|
})
|
|
135
136
|
);
|
|
136
|
-
inputOptions.plugins.push(
|
|
137
|
+
inputOptions.plugins.push(chunkIU62EKC5_cjs.aliasHono());
|
|
137
138
|
inputOptions.plugins.push(nodeModulesExtensionResolver());
|
|
138
139
|
}
|
|
139
140
|
return inputOptions;
|
|
@@ -153,7 +154,7 @@ async function createWatcher(inputOptions, outputOptions) {
|
|
|
153
154
|
|
|
154
155
|
// src/build/babel/remove-all-options-server.ts
|
|
155
156
|
function removeAllOptionsExceptServer(result) {
|
|
156
|
-
return
|
|
157
|
+
return chunkIU62EKC5_cjs.removeAllOptionsFromMastraExcept(result, "server");
|
|
157
158
|
}
|
|
158
159
|
function getServerOptionsBundler(entryFile, result) {
|
|
159
160
|
return rollup.rollup({
|
|
@@ -163,7 +164,7 @@ function getServerOptionsBundler(entryFile, result) {
|
|
|
163
164
|
},
|
|
164
165
|
treeshake: "smallest",
|
|
165
166
|
plugins: [
|
|
166
|
-
|
|
167
|
+
chunk2PH2MAPX_cjs.tsConfigPaths(),
|
|
167
168
|
// transpile typescript to something we understand
|
|
168
169
|
esbuild__default.default({
|
|
169
170
|
target: "node20",
|
|
@@ -216,7 +217,7 @@ function getServerOptionsBundler(entryFile, result) {
|
|
|
216
217
|
if (id !== entryFile) {
|
|
217
218
|
return;
|
|
218
219
|
}
|
|
219
|
-
return
|
|
220
|
+
return chunkIU62EKC5_cjs.recursiveRemoveNonReferencedNodes(code);
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
223
|
// let esbuild remove all unused imports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2PH2MAPX_cjs = require('./chunk-2PH2MAPX.cjs');
|
|
4
4
|
var commonjs2 = require('@rollup/plugin-commonjs');
|
|
5
5
|
var json = require('@rollup/plugin-json');
|
|
6
6
|
var nodeResolve = require('@rollup/plugin-node-resolve');
|
|
@@ -259,7 +259,7 @@ function getBundlerOptionsBundler(entryFile, result) {
|
|
|
259
259
|
},
|
|
260
260
|
treeshake: "smallest",
|
|
261
261
|
plugins: [
|
|
262
|
-
|
|
262
|
+
chunk2PH2MAPX_cjs.tsConfigPaths(),
|
|
263
263
|
// transpile typescript to something we understand
|
|
264
264
|
esbuild__default.default({
|
|
265
265
|
target: "node20",
|
|
@@ -375,7 +375,7 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
375
375
|
}
|
|
376
376
|
return null;
|
|
377
377
|
}
|
|
378
|
-
async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
378
|
+
async function analyze(entry, mastraEntry, isVirtualFile, platform, logger, sourcemapEnabled = false) {
|
|
379
379
|
logger.info("Analyzing dependencies...");
|
|
380
380
|
let virtualPlugin = null;
|
|
381
381
|
if (isVirtualFile) {
|
|
@@ -392,7 +392,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
392
392
|
preserveSymlinks: true,
|
|
393
393
|
plugins: [
|
|
394
394
|
virtualPlugin,
|
|
395
|
-
|
|
395
|
+
chunk2PH2MAPX_cjs.tsConfigPaths(),
|
|
396
396
|
{
|
|
397
397
|
name: "custom-alias-resolver",
|
|
398
398
|
resolveId(id) {
|
|
@@ -425,7 +425,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
425
425
|
transformMixedEsModules: true,
|
|
426
426
|
extensions: [".js", ".ts"]
|
|
427
427
|
}),
|
|
428
|
-
|
|
428
|
+
chunk2PH2MAPX_cjs.removeDeployer(normalizedMastraEntry, { sourcemap: sourcemapEnabled }),
|
|
429
429
|
esbuild__default.default({
|
|
430
430
|
target: "node20",
|
|
431
431
|
platform,
|
|
@@ -521,8 +521,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger, customExternal
|
|
|
521
521
|
}),
|
|
522
522
|
nodeResolve__default.default({
|
|
523
523
|
preferBuiltins: true,
|
|
524
|
-
exportConditions: ["node"
|
|
525
|
-
mainFields: ["module", "main"]
|
|
524
|
+
exportConditions: ["node"]
|
|
526
525
|
}),
|
|
527
526
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
528
527
|
aliasHono(),
|
|
@@ -598,11 +597,11 @@ async function validateOutput({
|
|
|
598
597
|
}
|
|
599
598
|
return result;
|
|
600
599
|
}
|
|
601
|
-
async function analyzeBundle(entries, mastraEntry, outputDir, platform, logger) {
|
|
600
|
+
async function analyzeBundle(entries, mastraEntry, outputDir, platform, logger, sourcemapEnabled = false) {
|
|
602
601
|
const depsToOptimize = /* @__PURE__ */ new Map();
|
|
603
602
|
for (const entry of entries) {
|
|
604
603
|
const isVirtualFile = entry.includes("\n") || !fs.existsSync(entry);
|
|
605
|
-
const analyzeResult = await analyze(entry, mastraEntry, isVirtualFile, platform, logger);
|
|
604
|
+
const analyzeResult = await analyze(entry, mastraEntry, isVirtualFile, platform, logger, sourcemapEnabled);
|
|
606
605
|
for (const [dep, exports] of analyzeResult.entries()) {
|
|
607
606
|
if (depsToOptimize.has(dep)) {
|
|
608
607
|
const existingExports = depsToOptimize.get(dep);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-
|
|
2
|
-
import { getInputOptions } from './chunk-
|
|
3
|
-
import { tsConfigPaths } from './chunk-
|
|
1
|
+
import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-4LXGDG3B.js';
|
|
2
|
+
import { getInputOptions } from './chunk-SKERVR44.js';
|
|
3
|
+
import { tsConfigPaths } from './chunk-TDQ2ALQJ.js';
|
|
4
4
|
import { watch, rollup } from 'rollup';
|
|
5
5
|
import { extname, dirname } from 'path';
|
|
6
6
|
import resolveFrom from 'resolve-from';
|
|
@@ -85,7 +85,7 @@ function nodeModulesExtensionResolver() {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// src/build/watcher.ts
|
|
88
|
-
async function getInputOptions2(entryFile, platform, env) {
|
|
88
|
+
async function getInputOptions2(entryFile, platform, env, { sourcemap = false } = {}) {
|
|
89
89
|
const inputOptions = await getInputOptions(
|
|
90
90
|
entryFile,
|
|
91
91
|
{
|
|
@@ -94,7 +94,8 @@ async function getInputOptions2(entryFile, platform, env) {
|
|
|
94
94
|
invalidChunks: /* @__PURE__ */ new Set()
|
|
95
95
|
},
|
|
96
96
|
platform,
|
|
97
|
-
env
|
|
97
|
+
env,
|
|
98
|
+
{ sourcemap }
|
|
98
99
|
);
|
|
99
100
|
if (Array.isArray(inputOptions.plugins)) {
|
|
100
101
|
inputOptions.plugins = inputOptions.plugins.filter(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-
|
|
1
|
+
import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-4LXGDG3B.js';
|
|
2
2
|
import * as babel from '@babel/core';
|
|
3
3
|
import { rollup } from 'rollup';
|
|
4
4
|
import esbuild from 'rollup-plugin-esbuild';
|