@mastra/deployer 0.13.2 → 0.14.0-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/build/analyze.cjs +3 -3
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.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 +9 -9
- package/dist/build/index.js +3 -3
- package/dist/build/plugins/__fixtures__/basic-with-json.d.ts +3 -0
- package/dist/build/plugins/__fixtures__/basic-with-json.d.ts.map +1 -0
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-DO5ZQHCX.cjs → chunk-2U2PRVDT.cjs} +9 -9
- package/dist/{chunk-DO5ZQHCX.cjs.map → chunk-2U2PRVDT.cjs.map} +1 -1
- package/dist/{chunk-J4CNHLNI.cjs → chunk-BHBOHN5O.cjs} +7 -7
- package/dist/{chunk-J4CNHLNI.cjs.map → chunk-BHBOHN5O.cjs.map} +1 -1
- package/dist/{chunk-7T2PU7VS.cjs → chunk-J3ANFXPF.cjs} +8 -6
- package/dist/chunk-J3ANFXPF.cjs.map +1 -0
- package/dist/{chunk-IA6E2T4X.js → chunk-LL3IH4QP.js} +4 -4
- package/dist/{chunk-IA6E2T4X.js.map → chunk-LL3IH4QP.js.map} +1 -1
- package/dist/{chunk-XJGTXD3R.js → chunk-MSLITBUT.js} +3 -3
- package/dist/{chunk-XJGTXD3R.js.map → chunk-MSLITBUT.js.map} +1 -1
- package/dist/{chunk-3OH2F6RQ.js → chunk-QIR375OA.js} +7 -5
- package/dist/chunk-QIR375OA.js.map +1 -0
- package/dist/{chunk-7U5E2KBV.js → chunk-ZBRHSHJD.js} +3 -3
- package/dist/{chunk-7U5E2KBV.js.map → chunk-ZBRHSHJD.js.map} +1 -1
- package/dist/{chunk-USWV4OQC.cjs → chunk-ZHGM6JS4.cjs} +5 -5
- package/dist/{chunk-USWV4OQC.cjs.map → chunk-ZHGM6JS4.cjs.map} +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
- package/dist/server/index.cjs +9 -4
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +9 -4
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/chunk-3OH2F6RQ.js.map +0 -1
- package/dist/chunk-7T2PU7VS.cjs.map +0 -1
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ3ANFXPF_cjs = require('../chunk-J3ANFXPF.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 chunkJ3ANFXPF_cjs.analyzeBundle; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "bundleExternals", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkJ3ANFXPF_cjs.bundleExternals; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=analyze.cjs.map
|
|
16
16
|
//# sourceMappingURL=analyze.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/build/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,WAAW,EAAe,MAAM,QAAQ,CAAC;AA0KjF;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE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
|
|
1
|
-
{"version":3,"file":"bundlerOptions.d.ts","sourceRoot":"","sources":["../../src/build/bundlerOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundlerOptions.d.ts","sourceRoot":"","sources":["../../src/build/bundlerOptions.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IACN,eAAe,EAAE,KAAK,CAAC;CACxB,yCA8EF;AAED,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAiB/G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../../src/build/deployer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../../src/build/deployer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AASnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;IAAE,iBAAiB,EAAE,OAAO,CAAA;CAAE,yCA4E3F;AAED,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,uCAerE"}
|
package/dist/build/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkBHBOHN5O_cjs = require('../chunk-BHBOHN5O.cjs');
|
|
4
|
+
var chunkZHGM6JS4_cjs = require('../chunk-ZHGM6JS4.cjs');
|
|
5
|
+
var chunkJ3ANFXPF_cjs = require('../chunk-J3ANFXPF.cjs');
|
|
6
6
|
var chunkJ42QUFVB_cjs = require('../chunk-J42QUFVB.cjs');
|
|
7
7
|
var chunkJ4SL7224_cjs = require('../chunk-J4SL7224.cjs');
|
|
8
8
|
|
|
@@ -10,27 +10,27 @@ var chunkJ4SL7224_cjs = require('../chunk-J4SL7224.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "createWatcher", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkBHBOHN5O_cjs.createWatcher; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getServerOptions", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkBHBOHN5O_cjs.getServerOptions; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkBHBOHN5O_cjs.getInputOptions; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "writeTelemetryConfig", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkZHGM6JS4_cjs.writeTelemetryConfig; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkJ3ANFXPF_cjs.analyzeBundle; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getBundlerOptions", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkJ3ANFXPF_cjs.getBundlerOptions; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "createBundler", {
|
|
36
36
|
enumerable: true,
|
package/dist/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
2
|
-
export { writeTelemetryConfig } from '../chunk-
|
|
3
|
-
export { analyzeBundle, getBundlerOptions } from '../chunk-
|
|
1
|
+
export { createWatcher, getServerOptions, getInputOptions as getWatcherInputOptions } from '../chunk-MSLITBUT.js';
|
|
2
|
+
export { writeTelemetryConfig } from '../chunk-ZBRHSHJD.js';
|
|
3
|
+
export { analyzeBundle, getBundlerOptions } from '../chunk-QIR375OA.js';
|
|
4
4
|
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-N66CXJKO.js';
|
|
5
5
|
export { Deps, FileService } from '../chunk-37Q52RJU.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const mastra: Mastra<Record<string, import("@mastra/core/agent").Agent<any, import("@mastra/core/agent").ToolsInput, Record<string, import("@mastra/core").Metric>>>, Record<string, import("@mastra/core/workflows/legacy").LegacyWorkflow<import("@mastra/core/workflows/legacy").LegacyStep<string, any, any, import("@mastra/core/workflows/legacy").StepExecutionContext<any, import("@mastra/core/workflows/legacy").WorkflowContext<any, import("@mastra/core/workflows/legacy").LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, import("@mastra/core/workflows").Workflow<any, import("@mastra/core").Step<string, any, any, any, any, any>[], string, import("zod").ZodType<any, import("zod").ZodTypeDef, any>, import("zod").ZodType<any, import("zod").ZodTypeDef, any>, import("zod").ZodType<any, import("zod").ZodTypeDef, any>>>, Record<string, import("@mastra/core/vector").MastraVector<import("@mastra/core/vector/filter").VectorFilter>>, Record<string, import("@mastra/core/tts").MastraTTS>, import("@mastra/core/logger").ConsoleLogger, Record<string, import("@mastra/core/network").AgentNetwork>, Record<string, import("@mastra/core/network/vNext").NewAgentNetwork>, Record<string, import("@mastra/core/mcp").MCPServerBase>>;
|
|
2
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
3
|
+
//# sourceMappingURL=basic-with-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-with-json.d.ts","sourceRoot":"","sources":["../../../../src/build/plugins/__fixtures__/basic-with-json.js"],"names":[],"mappings":"AAKA,0vCAQG;uBAboB,qBAAqB"}
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2U2PRVDT_cjs = require('../chunk-2U2PRVDT.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 chunk2U2PRVDT_cjs.Bundler; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=index.cjs.map
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|
package/dist/bundler/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkZHGM6JS4_cjs = require('./chunk-ZHGM6JS4.cjs');
|
|
4
|
+
var chunkJ3ANFXPF_cjs = require('./chunk-J3ANFXPF.cjs');
|
|
5
5
|
var chunkJ42QUFVB_cjs = require('./chunk-J42QUFVB.cjs');
|
|
6
6
|
var chunkJ4SL7224_cjs = require('./chunk-J4SL7224.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
@@ -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-2U2PRVDT.cjs', document.baseURI).href))));
|
|
174
174
|
if (customInstrumentationFile) {
|
|
175
175
|
await fsExtra.copy(customInstrumentationFile, instrumentationFile);
|
|
176
176
|
} else {
|
|
@@ -229,7 +229,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
229
229
|
return chunkJ42QUFVB_cjs.createBundler(inputOptions, outputOptions);
|
|
230
230
|
}
|
|
231
231
|
async analyze(entry, mastraFile, outputDirectory) {
|
|
232
|
-
return await
|
|
232
|
+
return await chunkJ3ANFXPF_cjs.analyzeBundle(
|
|
233
233
|
[].concat(entry),
|
|
234
234
|
mastraFile,
|
|
235
235
|
path.join(outputDirectory, this.analyzeOutputDir),
|
|
@@ -318,7 +318,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
318
318
|
this.logger.info("Start bundling Mastra");
|
|
319
319
|
let sourcemap = false;
|
|
320
320
|
try {
|
|
321
|
-
const bundlerOptions = await
|
|
321
|
+
const bundlerOptions = await chunkJ3ANFXPF_cjs.getBundlerOptions(mastraEntryFile, outputDirectory);
|
|
322
322
|
sourcemap = !!bundlerOptions?.sourcemap;
|
|
323
323
|
} catch (error) {
|
|
324
324
|
this.logger.debug("Failed to get bundler options, sourcemap will be disabled", { error });
|
|
@@ -326,7 +326,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
326
326
|
let analyzedBundleInfo;
|
|
327
327
|
try {
|
|
328
328
|
const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);
|
|
329
|
-
analyzedBundleInfo = await
|
|
329
|
+
analyzedBundleInfo = await chunkJ3ANFXPF_cjs.analyzeBundle(
|
|
330
330
|
[serverFile, ...Object.values(resolvedToolsPaths)],
|
|
331
331
|
mastraEntryFile,
|
|
332
332
|
path.join(outputDirectory, this.analyzeOutputDir),
|
|
@@ -348,7 +348,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
348
348
|
}
|
|
349
349
|
let externalDependencies;
|
|
350
350
|
try {
|
|
351
|
-
const result = await
|
|
351
|
+
const result = await chunkZHGM6JS4_cjs.writeTelemetryConfig({
|
|
352
352
|
entryFile: mastraEntryFile,
|
|
353
353
|
outputDir: path.join(outputDirectory, this.outputDir),
|
|
354
354
|
options: {
|
|
@@ -526,5 +526,5 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
526
526
|
};
|
|
527
527
|
|
|
528
528
|
exports.Bundler = Bundler;
|
|
529
|
-
//# sourceMappingURL=chunk-
|
|
530
|
-
//# sourceMappingURL=chunk-
|
|
529
|
+
//# sourceMappingURL=chunk-2U2PRVDT.cjs.map
|
|
530
|
+
//# sourceMappingURL=chunk-2U2PRVDT.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/customInstrumentation.ts","../src/bundler/workspaceDependencies.ts","../src/bundler/index.ts"],"names":["rollup","esbuild","commonjs","findWorkspaces","findWorkspacesRoot","DepsService","slugify","join","ensureDir","MastraBundler","emptyDir","dirname","fileURLToPath","copy","writeFile","createBundler","analyzeBundle","stat","getInputOptions","existsSync","virtual","globby","path","fsExtra","FileService","getBundlerOptions","error","MastraError","ErrorDomain","ErrorCategory","writeTelemetryConfig","resolveFrom","readJSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,+BAAA,CACd,WACA,MAAA,EAGA;AACA,EAAA,OAAOA,aAAA,CAAO;AAAA,IACZ,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO;AAAA,MACL,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,SAAA,EAAW,KAAA;AAAA,IACX,OAAA,EAAS;AAAA;AAAA,MAEPC,wBAAA,CAAQ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A,CAAK,oBAAoB,eAAe,CAAA;AAE9C,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,8BAA8B,CAAA;AAAA,IACjD,SAASe,OAAA,EAAO;AACd,MAAA,MAAM,UAAUA,OAAA,YAAiB,KAAA,GAAQA,OAAA,CAAM,OAAA,GAAU,OAAOA,OAAK,CAAA;AACrE,MAAA,MAAM,IAAIC,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,sCAAA;AAAA,UACJ,IAAA,EAAM,uCAAuC,OAAO,CAAA,CAAA;AAAA,UACpD,QAAQC,iBAAA,CAAY,QAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc;AAAA,SAC1B;AAAA,QACAH;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CAAK,UAAA,EAAoB,gBAAA,EAA0B,UAAA,EAAkD;AACzG,IAAA,MAAM,iBAAA,GAAoB,MAAM,IAAA,CAAK,oBAAA,CAAqB,UAAU,CAAA;AACpE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-DO5ZQHCX.cjs","sourcesContent":["import { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\nimport commonjs from '@rollup/plugin-commonjs';\n\nexport function getCustomInstrumentationBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n instrumentation: entryFile,\n },\n treeshake: false,\n plugins: [\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n ],\n });\n}\n\nexport async function writeCustomInstrumentation(\n entryFile: string,\n outputDir: string,\n options: {\n sourcemap?: boolean;\n } = {},\n): Promise<{\n hasCustomConfig: boolean;\n externalDependencies: string[];\n}> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getCustomInstrumentationBundler(entryFile, result);\n\n const { output } = await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: options.sourcemap,\n });\n const externals = output[0].imports.filter(x => !x.startsWith('./'));\n\n return { ...result, externalDependencies: externals };\n}\n","import { join } from 'node:path';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport slugify from '@sindresorhus/slugify';\nimport { findWorkspaces, findWorkspacesRoot } from 'find-workspaces';\nimport { ensureDir } from 'fs-extra';\nimport { DepsService } from '../services';\n\ntype WorkspacePackageInfo = {\n location: string;\n dependencies: Record<string, string> | undefined;\n version: string | undefined;\n};\n\ntype TransitiveDependencyResult = {\n resolutions: Record<string, string>;\n usedWorkspacePackages: Set<string>;\n};\n\n/**\n * Creates a map of workspace packages with their metadata for dependency resolution\n * @returns Map of package names to their location, dependencies and version\n */\nexport const createWorkspacePackageMap = async () => {\n // TODO move to our own implementation - pkg is 4 years old\n const workspaces = await findWorkspaces();\n const workspaceMap = new Map(\n workspaces?.map(workspace => [\n workspace.package.name,\n {\n location: workspace.location,\n dependencies: workspace.package.dependencies,\n version: workspace.package.version,\n },\n ]) ?? [],\n );\n\n return workspaceMap;\n};\n\n/**\n * Collects all transitive workspace dependencies and their TGZ paths\n */\nexport const collectTransitiveWorkspaceDependencies = ({\n workspaceMap,\n initialDependencies,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n initialDependencies: Set<string>;\n logger: IMastraLogger;\n}): TransitiveDependencyResult => {\n const usedWorkspacePackages = new Set<string>();\n const queue: string[] = Array.from(initialDependencies);\n const resolutions: Record<string, string> = {};\n\n while (queue.length > 0) {\n const len = queue.length;\n for (let i = 0; i < len; i += 1) {\n const pkgName = queue.shift();\n if (!pkgName || usedWorkspacePackages.has(pkgName)) {\n continue;\n }\n\n const dep = workspaceMap.get(pkgName);\n if (!dep) continue;\n\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n const sanitizedName = slugify(pkgName);\n\n const tgzPath = depsService.getWorkspaceDependencyPath({\n pkgName: sanitizedName,\n version: dep.version!,\n });\n resolutions[pkgName] = tgzPath;\n usedWorkspacePackages.add(pkgName);\n\n for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) {\n if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) {\n queue.push(depName);\n }\n }\n }\n }\n\n return { resolutions, usedWorkspacePackages };\n};\n\n/**\n * Creates TGZ packages for workspace dependencies in the workspace-module directory\n */\nexport const packWorkspaceDependencies = async ({\n workspaceMap,\n usedWorkspacePackages,\n bundleOutputDir,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n bundleOutputDir: string;\n logger: IMastraLogger;\n usedWorkspacePackages: Set<string>;\n}): Promise<void> => {\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n\n // package all workspace dependencies\n if (usedWorkspacePackages.size > 0) {\n const workspaceDirPath = join(bundleOutputDir, 'workspace-module');\n await ensureDir(workspaceDirPath);\n\n logger.info(`Packaging ${usedWorkspacePackages.size} workspace dependencies...`);\n\n const batchSize = 5;\n const packages = Array.from(usedWorkspacePackages.values());\n\n for (let i = 0; i < packages.length; i += batchSize) {\n const batch = packages.slice(i, i + batchSize);\n logger.info(\n `Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(', ')}`,\n );\n await Promise.all(\n batch.map(async pkgName => {\n const dep = workspaceMap.get(pkgName);\n if (!dep) return;\n\n await depsService.pack({ dir: dep.location, destination: workspaceDirPath });\n }),\n );\n }\n\n logger.info(`Successfully packaged ${usedWorkspacePackages.size} workspace dependencies`);\n }\n};\n","import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport virtual from '@rollup/plugin-virtual';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport { globby } from 'globby';\nimport resolveFrom from 'resolve-from';\nimport type { InputOptions, OutputOptions } from 'rollup';\n\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { writeCustomInstrumentation } from '../build/customInstrumentation';\nimport { writeTelemetryConfig } from '../build/telemetry';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport {\n collectTransitiveWorkspaceDependencies,\n createWorkspacePackageMap,\n packWorkspaceDependencies,\n} from './workspaceDependencies';\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writeInstrumentationFile(outputDirectory: string, customInstrumentationFile?: string) {\n const instrumentationFile = join(outputDirectory, 'instrumentation.mjs');\n const __dirname = dirname(fileURLToPath(import.meta.url));\n\n if (customInstrumentationFile) {\n await copy(customInstrumentationFile, instrumentationFile);\n } else {\n await copy(join(__dirname, 'templates', 'instrumentation-template.js'), instrumentationFile);\n }\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n // add telemetry dependencies\n dependenciesMap.set('@opentelemetry/core', '^2.0.1');\n dependenciesMap.set('@opentelemetry/auto-instrumentations-node', '^0.59.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-grpc', '^0.201.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-http', '^0.201.0');\n dependenciesMap.set('@opentelemetry/resources', '^2.0.1');\n dependenciesMap.set('@opentelemetry/sdk-node', '^0.201.0');\n dependenciesMap.set('@opentelemetry/sdk-trace-base', '^2.0.1');\n dependenciesMap.set('@opentelemetry/semantic-conventions', '^1.33.0');\n dependenciesMap.set('@opentelemetry/instrumentation', '^0.202.0');\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n join(outputDirectory, this.analyzeOutputDir),\n 'node',\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n sourcemapEnabled: boolean = false,\n ) {\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n 'node',\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: sourcemapEnabled },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n async getToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await globby(toolPath, {});\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n inputs[`tools/${uniqueToolID}`] = entryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n outputDirectory: string,\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n this.logger.info('Start bundling Mastra');\n\n let sourcemap = false;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n sourcemap = !!bundlerOptions?.sourcemap;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n join(outputDirectory, this.analyzeOutputDir),\n 'node',\n this.logger,\n sourcemap,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n let externalDependencies: string[];\n try {\n const result = await writeTelemetryConfig({\n entryFile: mastraEntryFile,\n outputDir: join(outputDirectory, this.outputDir),\n options: {\n sourcemap,\n },\n logger: this.logger,\n });\n externalDependencies = result.externalDependencies;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_TELEMETRY_FAILED',\n text: `Failed to write telemetry config: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const mastraFolder = dirname(mastraEntryFile);\n\n const fileService = new FileService();\n const customInstrumentation = fileService.getFirstExistingFileOrUndefined([\n join(mastraFolder, 'instrumentation.js'),\n join(mastraFolder, 'instrumentation.ts'),\n join(mastraFolder, 'instrumentation.mjs'),\n ]);\n\n try {\n if (customInstrumentation) {\n const result = await writeCustomInstrumentation(customInstrumentation, join(outputDirectory, this.outputDir), {\n sourcemap,\n });\n externalDependencies = [...externalDependencies, ...result.externalDependencies];\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir), customInstrumentation);\n } else {\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_INSTRUMENTATION_FILE_FAILED',\n text: `Failed to write instrumentation file: ${message}, ${customInstrumentation ? ` Found custom instrumentation file: ${customInstrumentation}` : ''}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n\n // Add extenal dependencies from telemetry file\n for (const external of externalDependencies) {\n dependenciesToInstall.set(external, 'latest');\n }\n\n const workspaceMap = await createWorkspacePackageMap();\n const workspaceDependencies = new Set<string>();\n for (const dep of analyzedBundleInfo.externalDependencies) {\n try {\n const pkgPath = resolveFrom(mastraEntryFile, `${dep}/package.json`);\n const pkg = await readJSON(pkgPath);\n\n if (workspaceMap.has(pkg.name)) {\n workspaceDependencies.add(pkg.name);\n continue;\n }\n\n dependenciesToInstall.set(dep, pkg.version);\n } catch {\n dependenciesToInstall.set(dep, 'latest');\n }\n }\n\n let resolutions: Record<string, string> = {};\n if (workspaceDependencies.size > 0) {\n try {\n const result = collectTransitiveWorkspaceDependencies({\n workspaceMap,\n initialDependencies: workspaceDependencies,\n logger: this.logger,\n });\n resolutions = result.resolutions;\n\n // Update dependenciesToInstall with the resolved TGZ paths\n Object.entries(resolutions).forEach(([pkgName, tgzPath]) => {\n dependenciesToInstall.set(pkgName, tgzPath);\n });\n\n await packWorkspaceDependencies({\n workspaceMap,\n usedWorkspacePackages: result.usedWorkspacePackages,\n bundleOutputDir: join(outputDirectory, this.outputDir),\n logger: this.logger,\n });\n } catch (error) {\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_WORKSPACE_DEPS_FAILED',\n text: `Failed to collect and pack workspace dependencies.`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n },\n error,\n );\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall, resolutions);\n\n this.logger.info('Bundling Mastra application');\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n sourcemap,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/customInstrumentation.ts","../src/bundler/workspaceDependencies.ts","../src/bundler/index.ts"],"names":["rollup","esbuild","commonjs","findWorkspaces","findWorkspacesRoot","DepsService","slugify","join","ensureDir","MastraBundler","emptyDir","dirname","fileURLToPath","copy","writeFile","createBundler","analyzeBundle","stat","getInputOptions","existsSync","virtual","globby","path","fsExtra","FileService","getBundlerOptions","error","MastraError","ErrorDomain","ErrorCategory","writeTelemetryConfig","resolveFrom","readJSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,+BAAA,CACd,WACA,MAAA,EAGA;AACA,EAAA,OAAOA,aAAA,CAAO;AAAA,IACZ,QAAA,EAAU,QAAA;AAAA,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AE3C,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,0BAA0B,CAAA;AAE3C,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,yBAAyB,CAAA;AAC1C,MAAA,MAAM,IAAA,CAAK,oBAAoB,eAAe,CAAA;AAE9C,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,8BAA8B,CAAA;AAAA,IACjD,SAASe,OAAA,EAAO;AACd,MAAA,MAAM,UAAUA,OAAA,YAAiB,KAAA,GAAQA,OAAA,CAAM,OAAA,GAAU,OAAOA,OAAK,CAAA;AACrE,MAAA,MAAM,IAAIC,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,sCAAA;AAAA,UACJ,IAAA,EAAM,uCAAuC,OAAO,CAAA,CAAA;AAAA,UACpD,QAAQC,iBAAA,CAAY,QAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc;AAAA,SAC1B;AAAA,QACAH;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CAAK,UAAA,EAAoB,gBAAA,EAA0B,UAAA,EAAkD;AACzG,IAAA,MAAM,iBAAA,GAAoB,MAAM,IAAA,CAAK,oBAAA,CAAqB,UAAU,CAAA;AACpE,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,CAAE,MAAA;AACnD,IAAA,IAAI,cAAc,CAAA,EAAG;AACnB,MAAA,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,WAAW,IAAI,WAAA,KAAgB,CAAA,GAAI,MAAA,GAAS,OAAO,CAAA,CAAE,CAAA;AAAA,IACjF;AAAA,EACF;AACF","file":"chunk-2U2PRVDT.cjs","sourcesContent":["import { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\nimport commonjs from '@rollup/plugin-commonjs';\n\nexport function getCustomInstrumentationBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n instrumentation: entryFile,\n },\n treeshake: false,\n plugins: [\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n ],\n });\n}\n\nexport async function writeCustomInstrumentation(\n entryFile: string,\n outputDir: string,\n options: {\n sourcemap?: boolean;\n } = {},\n): Promise<{\n hasCustomConfig: boolean;\n externalDependencies: string[];\n}> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getCustomInstrumentationBundler(entryFile, result);\n\n const { output } = await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: options.sourcemap,\n });\n const externals = output[0].imports.filter(x => !x.startsWith('./'));\n\n return { ...result, externalDependencies: externals };\n}\n","import { join } from 'node:path';\nimport type { IMastraLogger } from '@mastra/core/logger';\nimport slugify from '@sindresorhus/slugify';\nimport { findWorkspaces, findWorkspacesRoot } from 'find-workspaces';\nimport { ensureDir } from 'fs-extra';\nimport { DepsService } from '../services';\n\ntype WorkspacePackageInfo = {\n location: string;\n dependencies: Record<string, string> | undefined;\n version: string | undefined;\n};\n\ntype TransitiveDependencyResult = {\n resolutions: Record<string, string>;\n usedWorkspacePackages: Set<string>;\n};\n\n/**\n * Creates a map of workspace packages with their metadata for dependency resolution\n * @returns Map of package names to their location, dependencies and version\n */\nexport const createWorkspacePackageMap = async () => {\n // TODO move to our own implementation - pkg is 4 years old\n const workspaces = await findWorkspaces();\n const workspaceMap = new Map(\n workspaces?.map(workspace => [\n workspace.package.name,\n {\n location: workspace.location,\n dependencies: workspace.package.dependencies,\n version: workspace.package.version,\n },\n ]) ?? [],\n );\n\n return workspaceMap;\n};\n\n/**\n * Collects all transitive workspace dependencies and their TGZ paths\n */\nexport const collectTransitiveWorkspaceDependencies = ({\n workspaceMap,\n initialDependencies,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n initialDependencies: Set<string>;\n logger: IMastraLogger;\n}): TransitiveDependencyResult => {\n const usedWorkspacePackages = new Set<string>();\n const queue: string[] = Array.from(initialDependencies);\n const resolutions: Record<string, string> = {};\n\n while (queue.length > 0) {\n const len = queue.length;\n for (let i = 0; i < len; i += 1) {\n const pkgName = queue.shift();\n if (!pkgName || usedWorkspacePackages.has(pkgName)) {\n continue;\n }\n\n const dep = workspaceMap.get(pkgName);\n if (!dep) continue;\n\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n const sanitizedName = slugify(pkgName);\n\n const tgzPath = depsService.getWorkspaceDependencyPath({\n pkgName: sanitizedName,\n version: dep.version!,\n });\n resolutions[pkgName] = tgzPath;\n usedWorkspacePackages.add(pkgName);\n\n for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) {\n if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) {\n queue.push(depName);\n }\n }\n }\n }\n\n return { resolutions, usedWorkspacePackages };\n};\n\n/**\n * Creates TGZ packages for workspace dependencies in the workspace-module directory\n */\nexport const packWorkspaceDependencies = async ({\n workspaceMap,\n usedWorkspacePackages,\n bundleOutputDir,\n logger,\n}: {\n workspaceMap: Map<string, WorkspacePackageInfo>;\n bundleOutputDir: string;\n logger: IMastraLogger;\n usedWorkspacePackages: Set<string>;\n}): Promise<void> => {\n const root = findWorkspacesRoot();\n if (!root) {\n throw new Error('Could not find workspace root');\n }\n\n const depsService = new DepsService(root.location);\n depsService.__setLogger(logger);\n\n // package all workspace dependencies\n if (usedWorkspacePackages.size > 0) {\n const workspaceDirPath = join(bundleOutputDir, 'workspace-module');\n await ensureDir(workspaceDirPath);\n\n logger.info(`Packaging ${usedWorkspacePackages.size} workspace dependencies...`);\n\n const batchSize = 5;\n const packages = Array.from(usedWorkspacePackages.values());\n\n for (let i = 0; i < packages.length; i += batchSize) {\n const batch = packages.slice(i, i + batchSize);\n logger.info(\n `Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(', ')}`,\n );\n await Promise.all(\n batch.map(async pkgName => {\n const dep = workspaceMap.get(pkgName);\n if (!dep) return;\n\n await depsService.pack({ dir: dep.location, destination: workspaceDirPath });\n }),\n );\n }\n\n logger.info(`Successfully packaged ${usedWorkspacePackages.size} workspace dependencies`);\n }\n};\n","import { existsSync } from 'node:fs';\nimport { stat, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport virtual from '@rollup/plugin-virtual';\nimport fsExtra, { copy, ensureDir, readJSON, emptyDir } from 'fs-extra/esm';\nimport { globby } from 'globby';\nimport resolveFrom from 'resolve-from';\nimport type { InputOptions, OutputOptions } from 'rollup';\n\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport { writeCustomInstrumentation } from '../build/customInstrumentation';\nimport { writeTelemetryConfig } from '../build/telemetry';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport {\n collectTransitiveWorkspaceDependencies,\n createWorkspacePackageMap,\n packWorkspaceDependencies,\n} from './workspaceDependencies';\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writeInstrumentationFile(outputDirectory: string, customInstrumentationFile?: string) {\n const instrumentationFile = join(outputDirectory, 'instrumentation.mjs');\n const __dirname = dirname(fileURLToPath(import.meta.url));\n\n if (customInstrumentationFile) {\n await copy(customInstrumentationFile, instrumentationFile);\n } else {\n await copy(join(__dirname, 'templates', 'instrumentation-template.js'), instrumentationFile);\n }\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(`Writing project's package.json`);\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, value);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, value);\n }\n }\n\n // add telemetry dependencies\n dependenciesMap.set('@opentelemetry/core', '^2.0.1');\n dependenciesMap.set('@opentelemetry/auto-instrumentations-node', '^0.59.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-grpc', '^0.201.0');\n dependenciesMap.set('@opentelemetry/exporter-trace-otlp-http', '^0.201.0');\n dependenciesMap.set('@opentelemetry/resources', '^2.0.1');\n dependenciesMap.set('@opentelemetry/sdk-node', '^0.201.0');\n dependenciesMap.set('@opentelemetry/sdk-trace-base', '^2.0.1');\n dependenciesMap.set('@opentelemetry/semantic-conventions', '^1.33.0');\n dependenciesMap.set('@opentelemetry/instrumentation', '^0.202.0');\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n description: '',\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node --import=./instrumentation.mjs --import=@opentelemetry/instrumentation/hook.mjs ./index.mjs',\n },\n author: 'Mastra',\n license: 'ISC',\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n pnpm: {\n neverBuiltDependencies: [],\n },\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n join(outputDirectory, this.analyzeOutputDir),\n 'node',\n this.logger,\n );\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({ dir: join(outputDirectory, this.outputDir) });\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n sourcemapEnabled: boolean = false,\n ) {\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n 'node',\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n { sourcemap: sourcemapEnabled },\n );\n const isVirtual = serverFile.includes('\\n') || existsSync(serverFile);\n\n const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n async getToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await globby(toolPath, {});\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn(`No entry file found in ${path}, skipping...`);\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n inputs[`tools/${uniqueToolID}`] = entryFile;\n } else {\n this.logger.warn(`Tool path ${path} does not exist, skipping...`);\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n outputDirectory: string,\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n this.logger.info('Start bundling Mastra');\n\n let sourcemap = false;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n sourcemap = !!bundlerOptions?.sourcemap;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.getToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n join(outputDirectory, this.analyzeOutputDir),\n 'node',\n this.logger,\n sourcemap,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n let externalDependencies: string[];\n try {\n const result = await writeTelemetryConfig({\n entryFile: mastraEntryFile,\n outputDir: join(outputDirectory, this.outputDir),\n options: {\n sourcemap,\n },\n logger: this.logger,\n });\n externalDependencies = result.externalDependencies;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_TELEMETRY_FAILED',\n text: `Failed to write telemetry config: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const mastraFolder = dirname(mastraEntryFile);\n\n const fileService = new FileService();\n const customInstrumentation = fileService.getFirstExistingFileOrUndefined([\n join(mastraFolder, 'instrumentation.js'),\n join(mastraFolder, 'instrumentation.ts'),\n join(mastraFolder, 'instrumentation.mjs'),\n ]);\n\n try {\n if (customInstrumentation) {\n const result = await writeCustomInstrumentation(customInstrumentation, join(outputDirectory, this.outputDir), {\n sourcemap,\n });\n externalDependencies = [...externalDependencies, ...result.externalDependencies];\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir), customInstrumentation);\n } else {\n await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_INSTRUMENTATION_FILE_FAILED',\n text: `Failed to write instrumentation file: ${message}, ${customInstrumentation ? ` Found custom instrumentation file: ${customInstrumentation}` : ''}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const dependenciesToInstall = new Map<string, string>();\n\n // Add extenal dependencies from telemetry file\n for (const external of externalDependencies) {\n dependenciesToInstall.set(external, 'latest');\n }\n\n const workspaceMap = await createWorkspacePackageMap();\n const workspaceDependencies = new Set<string>();\n for (const dep of analyzedBundleInfo.externalDependencies) {\n try {\n const pkgPath = resolveFrom(mastraEntryFile, `${dep}/package.json`);\n const pkg = await readJSON(pkgPath);\n\n if (workspaceMap.has(pkg.name)) {\n workspaceDependencies.add(pkg.name);\n continue;\n }\n\n dependenciesToInstall.set(dep, pkg.version);\n } catch {\n dependenciesToInstall.set(dep, 'latest');\n }\n }\n\n let resolutions: Record<string, string> = {};\n if (workspaceDependencies.size > 0) {\n try {\n const result = collectTransitiveWorkspaceDependencies({\n workspaceMap,\n initialDependencies: workspaceDependencies,\n logger: this.logger,\n });\n resolutions = result.resolutions;\n\n // Update dependenciesToInstall with the resolved TGZ paths\n Object.entries(resolutions).forEach(([pkgName, tgzPath]) => {\n dependenciesToInstall.set(pkgName, tgzPath);\n });\n\n await packWorkspaceDependencies({\n workspaceMap,\n usedWorkspacePackages: result.usedWorkspacePackages,\n bundleOutputDir: join(outputDirectory, this.outputDir),\n logger: this.logger,\n });\n } catch (error) {\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_WORKSPACE_DEPS_FAILED',\n text: `Failed to collect and pack workspace dependencies.`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n },\n error,\n );\n }\n }\n\n try {\n await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall, resolutions);\n\n this.logger.info('Bundling Mastra application');\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n sourcemap,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn(`Circular dependency found:\n\\t${warning.message.replace('Circular dependency: ', '')}`);\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory);\n\n this.logger.info('Done installing dependencies');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.getToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info(`Found ${toolsLength} ${toolsLength === 1 ? 'tool' : 'tools'}`);\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ3ANFXPF_cjs = require('./chunk-J3ANFXPF.cjs');
|
|
4
4
|
var chunkJ42QUFVB_cjs = require('./chunk-J42QUFVB.cjs');
|
|
5
5
|
var chunkVAE7BL7I_cjs = require('./chunk-VAE7BL7I.cjs');
|
|
6
6
|
var rollup = require('rollup');
|
|
@@ -115,7 +115,7 @@ function nodeModulesExtensionResolver() {
|
|
|
115
115
|
async function getInputOptions2(entryFile, platform, env, { sourcemap = false, transpilePackages = [] } = {}) {
|
|
116
116
|
const dependencies = /* @__PURE__ */ new Map();
|
|
117
117
|
if (transpilePackages.length) {
|
|
118
|
-
const { output, reverseVirtualReferenceMap } = await
|
|
118
|
+
const { output, reverseVirtualReferenceMap } = await chunkJ3ANFXPF_cjs.bundleExternals(
|
|
119
119
|
new Map(transpilePackages.map((pkg) => [pkg, ["*"]])),
|
|
120
120
|
".mastra/.build",
|
|
121
121
|
logger.noopLogger,
|
|
@@ -161,7 +161,7 @@ async function getInputOptions2(entryFile, platform, env, { sourcemap = false, t
|
|
|
161
161
|
plugins.push(plugin);
|
|
162
162
|
});
|
|
163
163
|
inputOptions.plugins = plugins;
|
|
164
|
-
inputOptions.plugins.push(
|
|
164
|
+
inputOptions.plugins.push(chunkJ3ANFXPF_cjs.aliasHono());
|
|
165
165
|
inputOptions.plugins.push(nodeModulesExtensionResolver());
|
|
166
166
|
}
|
|
167
167
|
return inputOptions;
|
|
@@ -181,7 +181,7 @@ async function createWatcher(inputOptions, outputOptions) {
|
|
|
181
181
|
|
|
182
182
|
// src/build/babel/remove-all-options-server.ts
|
|
183
183
|
function removeAllOptionsExceptServer(result) {
|
|
184
|
-
return
|
|
184
|
+
return chunkJ3ANFXPF_cjs.removeAllOptionsFromMastraExcept(result, "server");
|
|
185
185
|
}
|
|
186
186
|
function getServerOptionsBundler(entryFile, result) {
|
|
187
187
|
return rollup.rollup({
|
|
@@ -245,7 +245,7 @@ function getServerOptionsBundler(entryFile, result) {
|
|
|
245
245
|
if (id !== entryFile) {
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
return
|
|
248
|
+
return chunkJ3ANFXPF_cjs.recursiveRemoveNonReferencedNodes(code);
|
|
249
249
|
}
|
|
250
250
|
},
|
|
251
251
|
// let esbuild remove all unused imports
|
|
@@ -277,5 +277,5 @@ async function getServerOptions(entryFile, outputDir) {
|
|
|
277
277
|
exports.createWatcher = createWatcher;
|
|
278
278
|
exports.getInputOptions = getInputOptions2;
|
|
279
279
|
exports.getServerOptions = getServerOptions;
|
|
280
|
-
//# sourceMappingURL=chunk-
|
|
281
|
-
//# sourceMappingURL=chunk-
|
|
280
|
+
//# sourceMappingURL=chunk-BHBOHN5O.cjs.map
|
|
281
|
+
//# sourceMappingURL=chunk-BHBOHN5O.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","resolved","dirname","getInputOptions","bundleExternals","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","rollup","esbuild","optimizeLodashImports","commonjs","babel","result","recursiveRemoveNonReferencedNodes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,gBAAgB,SAAA,EAA4B;AACnD,EAAA,OACEA,uBAAA,CAAe,QAAA,CAAS,SAAS,CAAA,IACjC,UAAU,UAAA,CAAW,OAAO,CAAA,IAC5BA,uBAAA,CAAe,QAAA,CAAS,SAAA,CAAU,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAC,CAAA;AAE3D;AAEA,SAAS,WAAA,CAAY,IAAY,QAAA,EAAkB;AACjD,EAAA,IAAI;AACF,IAAA,OAAOC,4BAAA,CAAY,UAAU,EAAE,CAAA;AAAA,EACjC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,SAAS,eAAe,EAAA,EAAY;AAClC,EAAA,MAAM,KAAA,GAAQ,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA;AAE1B,EAAA,IAAI,EAAA,CAAG,UAAA,CAAW,GAAG,CAAA,EAAG;AACtB,IAAA,OAAO,MAAM,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CAAE,KAAK,GAAG,CAAA;AAAA,EACnC;AAEA,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,EAAiB;AAAA,GACnB;AAEA,EAAA,MAAM,MAAA,GAAS,MAAM,uBAAA,CAAwB,SAAA,EAAW,MAAM,CAAA;AAE9D,EAAA,MAAM,OAAO,KAAA,CAAM;AAAA,IACjB,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB,YAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACZ,CAAA;AAED,EAAA,IAAI,OAAO,eAAA,EAAiB;AAC1B,IAAA,OAAA,CAAQ,MAAM,OAAO,CAAA,KAAA,EAAQ,SAAS,CAAA,kBAAA,CAAA,CAAA,EAAuB,MAAA;AAAA,EAC/D;AAEA,EAAA,OAAO,IAAA;AACT","file":"chunk-J4CNHLNI.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\nfunction getPackageName(id: string) {\n const parts = id.split('/');\n\n if (id.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n return parts[0];\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: resolved,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: newImportWithExtension,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { bundleExternals } from './analyze';\nimport { noopLogger } from '@mastra/core/logger';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false, transpilePackages = [] }: { sourcemap?: boolean; transpilePackages?: string[] } = {},\n) {\n const dependencies = new Map<string, string>();\n\n if (transpilePackages.length) {\n const { output, reverseVirtualReferenceMap } = await bundleExternals(\n new Map(transpilePackages.map(pkg => [pkg, ['*']])),\n '.mastra/.build',\n noopLogger,\n {\n transpilePackages,\n isDev: true,\n },\n );\n\n for (const file of output) {\n if (file.type === 'asset') {\n continue;\n }\n\n if (file.isEntry && reverseVirtualReferenceMap.has(file.name)) {\n dependencies.set(reverseVirtualReferenceMap.get(file.name)!, file.fileName);\n }\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies,\n externalDependencies: new Set(),\n invalidChunks: new Set(),\n },\n platform,\n env,\n { sourcemap },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }) {\n return removeAllOptionsFromMastraExcept(result, 'server');\n}\n","import * as babel from '@babel/core';\nimport { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\n\nimport { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport commonjs from '@rollup/plugin-commonjs';\nimport { recursiveRemoveNonReferencedNodes } from './plugins/remove-unused-references';\nimport type { Config, Mastra } from '@mastra/core';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n 'server-config': entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n optimizeLodashImports(),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n {\n name: 'get-server-config',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllOptionsExceptServer(result)],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n ],\n });\n}\n\nexport async function getServerOptions(entryFile: string, outputDir: string): Promise<Config['server'] | null> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getServerOptionsBundler(entryFile, result);\n\n await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: true,\n });\n\n if (result.hasCustomConfig) {\n return (await import(`file:${outputDir}/server-config.mjs`)).server as unknown as Config['server'];\n }\n\n return null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build/plugins/node-modules-extension-resolver.ts","../src/build/watcher.ts","../src/build/babel/remove-all-options-server.ts","../src/build/serverOptions.ts"],"names":["builtinModules","resolveFrom","extname","resolved","dirname","getInputOptions","bundleExternals","noopLogger","tsConfigPaths","aliasHono","watch","removeAllOptionsFromMastraExcept","rollup","esbuild","optimizeLodashImports","commonjs","babel","result","recursiveRemoveNonReferencedNodes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAQ;AAAA,iBACd,CAAA;AAAA,cACH;AAAA,aACF;AAAA,UACF,CAAC,CAAA;AAAA,QACH;AAAA,OACF;AAAA;AAAA,MAEAJ,wBAAA,CAAQ;AAAA,QACN,MAAA,EAAQ,QAAA;AAAA,QACR,QAAA,EAAU,MAAA;AAAA,QACV,MAAA,EAAQ;AAAA,OACT,CAAA;AAAA,MACD;AAAA,QACE,IAAA,EAAM,SAAA;AAAA,QACN,SAAA,CAAU,MAAM,EAAA,EAAI;AAClB,UAAA,IAAI,OAAO,SAAA,EAAW;AACpB,YAAA;AAAA,UACF;AAEA,UAAA,OAAOK,oDAAkC,IAAI,CAAA;AAAA,QAC/C;AAAA,OACF;AAAA;AAAA,MAEAL,wBAAA,CAAQ;AAAA,QACN,MAAA,EAAQ,QAAA;AAAA,QACR,QAAA,EAAU,MAAA;AAAA,QACV,MAAA,EAAQ;AAAA,OACT;AAAA;AACH,GACD,CAAA;AACH;AAEA,eAAsB,gBAAA,CAAiB,WAAmB,SAAA,EAAqD;AAC7G,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,eAAA,EAAiB;AAAA,GACnB;AAEA,EAAA,MAAM,MAAA,GAAS,MAAM,uBAAA,CAAwB,SAAA,EAAW,MAAM,CAAA;AAE9D,EAAA,MAAM,OAAO,KAAA,CAAM;AAAA,IACjB,GAAA,EAAK,SAAA;AAAA,IACL,MAAA,EAAQ,IAAA;AAAA,IACR,cAAA,EAAgB,YAAA;AAAA,IAChB,SAAA,EAAW;AAAA,GACZ,CAAA;AAED,EAAA,IAAI,OAAO,eAAA,EAAiB;AAC1B,IAAA,OAAA,CAAQ,MAAM,OAAO,CAAA,KAAA,EAAQ,SAAS,CAAA,kBAAA,CAAA,CAAA,EAAuB,MAAA;AAAA,EAC/D;AAEA,EAAA,OAAO,IAAA;AACT","file":"chunk-BHBOHN5O.cjs","sourcesContent":["import { dirname, extname } from 'path';\nimport resolveFrom from 'resolve-from';\nimport type { Plugin } from 'rollup';\nimport { builtinModules } from 'node:module';\n\n/**\n * Check if a module is a Node.js builtin module\n * @param specifier - Module specifier\n * @returns True if it's a builtin module\n */\nfunction isBuiltinModule(specifier: string): boolean {\n return (\n builtinModules.includes(specifier) ||\n specifier.startsWith('node:') ||\n builtinModules.includes(specifier.replace(/^node:/, ''))\n );\n}\n\nfunction safeResolve(id: string, importer: string) {\n try {\n return resolveFrom(importer, id);\n } catch {\n return null;\n }\n}\n\nfunction getPackageName(id: string) {\n const parts = id.split('/');\n\n if (id.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n return parts[0];\n}\n\n// we only need this for dev, so we can resolve the js extension of the module as we do not use node-resolve\nexport function nodeModulesExtensionResolver(): Plugin {\n return {\n name: 'node-modules-extension-resolver',\n resolveId(id, importer) {\n // if is relative, skip\n if (id.startsWith('.') || id.startsWith('/') || !importer) {\n return null;\n }\n\n if (isBuiltinModule(id)) {\n return null;\n }\n\n // if it's a scoped direct import skip\n if (id.startsWith('@') && id.split('/').length === 2) {\n return null;\n }\n\n // if it's a direct import, skip\n if (!id.startsWith('@') && id.split('/').length === 1) {\n return null;\n }\n\n const foundExt = extname(id);\n if (foundExt) {\n return null;\n }\n\n try {\n // if we cannot resolve it, it means it's a legacy module\n const resolved = import.meta.resolve(id);\n\n if (!extname(resolved)) {\n throw new Error(`Cannot resolve ${id} from ${importer}`);\n }\n\n return null;\n } catch (e) {\n // try to do a node like resolve first\n const resolved = safeResolve(id, importer);\n if (resolved) {\n return {\n id: resolved,\n external: true,\n };\n }\n\n for (const ext of ['.mjs', '.js', '.cjs']) {\n const resolved = safeResolve(id + ext, importer);\n if (resolved) {\n const pkgName = getPackageName(id);\n if (!pkgName) {\n return null;\n }\n\n const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);\n if (!pkgJsonPath) {\n return null;\n }\n\n const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);\n\n return {\n id: newImportWithExtension,\n external: true,\n };\n }\n }\n }\n\n return null;\n },\n } satisfies Plugin;\n}\n","import type { InputOptions, OutputOptions, Plugin } from 'rollup';\nimport { watch } from 'rollup';\nimport { getInputOptions as getBundlerInputOptions } from './bundler';\nimport { aliasHono } from './plugins/hono-alias';\nimport { nodeModulesExtensionResolver } from './plugins/node-modules-extension-resolver';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { bundleExternals } from './analyze';\nimport { noopLogger } from '@mastra/core/logger';\n\nexport async function getInputOptions(\n entryFile: string,\n platform: 'node' | 'browser',\n env?: Record<string, string>,\n { sourcemap = false, transpilePackages = [] }: { sourcemap?: boolean; transpilePackages?: string[] } = {},\n) {\n const dependencies = new Map<string, string>();\n\n if (transpilePackages.length) {\n const { output, reverseVirtualReferenceMap } = await bundleExternals(\n new Map(transpilePackages.map(pkg => [pkg, ['*']])),\n '.mastra/.build',\n noopLogger,\n {\n transpilePackages,\n isDev: true,\n },\n );\n\n for (const file of output) {\n if (file.type === 'asset') {\n continue;\n }\n\n if (file.isEntry && reverseVirtualReferenceMap.has(file.name)) {\n dependencies.set(reverseVirtualReferenceMap.get(file.name)!, file.fileName);\n }\n }\n }\n\n const inputOptions = await getBundlerInputOptions(\n entryFile,\n {\n dependencies,\n externalDependencies: new Set(),\n invalidChunks: new Set(),\n },\n platform,\n env,\n { sourcemap },\n );\n\n if (Array.isArray(inputOptions.plugins)) {\n // filter out node-resolve plugin so all node_modules are external\n // and tsconfig-paths plugin as we are injection a custom one\n const plugins = [] as Plugin[];\n inputOptions.plugins.forEach(plugin => {\n if ((plugin as Plugin | undefined)?.name === 'node-resolve') {\n return;\n }\n\n if ((plugin as Plugin | undefined)?.name === 'tsconfig-paths') {\n plugins.push(\n tsConfigPaths({\n localResolve: true,\n }),\n );\n return;\n }\n\n plugins.push(plugin as Plugin);\n });\n\n inputOptions.plugins = plugins;\n inputOptions.plugins.push(aliasHono());\n // fixes imports like lodash/fp/get\n inputOptions.plugins.push(nodeModulesExtensionResolver());\n }\n\n return inputOptions;\n}\n\nexport async function createWatcher(inputOptions: InputOptions, outputOptions: OutputOptions) {\n const watcher = await watch({\n ...inputOptions,\n output: {\n ...outputOptions,\n format: 'esm',\n entryFileNames: '[name].mjs',\n chunkFileNames: '[name].mjs',\n },\n });\n\n return watcher;\n}\n","import { removeAllOptionsFromMastraExcept } from './remove-all-options-except';\n\nexport function removeAllOptionsExceptServer(result: { hasCustomConfig: boolean }) {\n return removeAllOptionsFromMastraExcept(result, 'server');\n}\n","import * as babel from '@babel/core';\nimport { rollup } from 'rollup';\nimport esbuild from 'rollup-plugin-esbuild';\n\nimport { removeAllOptionsExceptServer } from './babel/remove-all-options-server';\nimport commonjs from '@rollup/plugin-commonjs';\nimport { recursiveRemoveNonReferencedNodes } from './plugins/remove-unused-references';\nimport type { Config, Mastra } from '@mastra/core';\nimport { tsConfigPaths } from './plugins/tsconfig-paths';\nimport { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';\n\nexport function getServerOptionsBundler(\n entryFile: string,\n result: {\n hasCustomConfig: false;\n },\n) {\n return rollup({\n logLevel: 'silent',\n input: {\n 'server-config': entryFile,\n },\n treeshake: 'smallest',\n plugins: [\n tsConfigPaths(),\n // transpile typescript to something we understand\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n optimizeLodashImports(),\n commonjs({\n extensions: ['.js', '.ts'],\n strictRequires: 'strict',\n transformMixedEsModules: true,\n ignoreTryCatch: false,\n }),\n {\n name: 'get-server-config',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n babel.transform(\n code,\n {\n babelrc: false,\n configFile: false,\n filename: id,\n plugins: [removeAllOptionsExceptServer(result)],\n },\n (err, result) => {\n if (err) {\n return reject(err);\n }\n\n resolve({\n code: result!.code!,\n map: result!.map!,\n });\n },\n );\n });\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n {\n name: 'cleanup',\n transform(code, id) {\n if (id !== entryFile) {\n return;\n }\n\n return recursiveRemoveNonReferencedNodes(code);\n },\n },\n // let esbuild remove all unused imports\n esbuild({\n target: 'node20',\n platform: 'node',\n minify: false,\n }),\n ],\n });\n}\n\nexport async function getServerOptions(entryFile: string, outputDir: string): Promise<Config['server'] | null> {\n const result = {\n hasCustomConfig: false,\n } as const;\n\n const bundle = await getServerOptionsBundler(entryFile, result);\n\n await bundle.write({\n dir: outputDir,\n format: 'es',\n entryFileNames: '[name].mjs',\n sourcemap: true,\n });\n\n if (result.hasCustomConfig) {\n return (await import(`file:${outputDir}/server-config.mjs`)).server as unknown as Config['server'];\n }\n\n return null;\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chunkVAE7BL7I_cjs = require('./chunk-VAE7BL7I.cjs');
|
|
4
4
|
var babel = require('@babel/core');
|
|
5
5
|
var commonjs2 = require('@rollup/plugin-commonjs');
|
|
6
|
-
var
|
|
6
|
+
var json2 = require('@rollup/plugin-json');
|
|
7
7
|
var nodeResolve = require('@rollup/plugin-node-resolve');
|
|
8
8
|
var virtual = require('@rollup/plugin-virtual');
|
|
9
9
|
var fs = require('fs');
|
|
@@ -40,7 +40,7 @@ function _interopNamespace(e) {
|
|
|
40
40
|
|
|
41
41
|
var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
|
|
42
42
|
var commonjs2__default = /*#__PURE__*/_interopDefault(commonjs2);
|
|
43
|
-
var
|
|
43
|
+
var json2__default = /*#__PURE__*/_interopDefault(json2);
|
|
44
44
|
var nodeResolve__default = /*#__PURE__*/_interopDefault(nodeResolve);
|
|
45
45
|
var virtual__default = /*#__PURE__*/_interopDefault(virtual);
|
|
46
46
|
var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
@@ -275,6 +275,7 @@ function getBundlerOptionsBundler(entryFile, result) {
|
|
|
275
275
|
transformMixedEsModules: true,
|
|
276
276
|
ignoreTryCatch: false
|
|
277
277
|
}),
|
|
278
|
+
json2__default.default(),
|
|
278
279
|
{
|
|
279
280
|
name: "get-bundler-config",
|
|
280
281
|
transform(code, id) {
|
|
@@ -448,7 +449,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger, sour
|
|
|
448
449
|
}
|
|
449
450
|
}
|
|
450
451
|
},
|
|
451
|
-
|
|
452
|
+
json2__default.default(),
|
|
452
453
|
esbuild__default.default({
|
|
453
454
|
target: "node20",
|
|
454
455
|
platform,
|
|
@@ -592,7 +593,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger, options) {
|
|
|
592
593
|
}),
|
|
593
594
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
594
595
|
aliasHono(),
|
|
595
|
-
|
|
596
|
+
json2__default.default()
|
|
596
597
|
].filter(Boolean)
|
|
597
598
|
});
|
|
598
599
|
const { output } = await bundler.write({
|
|
@@ -671,6 +672,7 @@ async function analyzeBundle(entries, mastraEntry, outputDir, platform, logger,
|
|
|
671
672
|
};
|
|
672
673
|
await babel__namespace.transformAsync(mastraConfig, {
|
|
673
674
|
filename: mastraEntry,
|
|
675
|
+
presets: ["@babel/preset-typescript"],
|
|
674
676
|
plugins: [checkConfigExport(mastraConfigResult)]
|
|
675
677
|
});
|
|
676
678
|
if (!mastraConfigResult.hasValidConfig) {
|
|
@@ -711,5 +713,5 @@ exports.bundleExternals = bundleExternals;
|
|
|
711
713
|
exports.getBundlerOptions = getBundlerOptions;
|
|
712
714
|
exports.recursiveRemoveNonReferencedNodes = recursiveRemoveNonReferencedNodes;
|
|
713
715
|
exports.removeAllOptionsFromMastraExcept = removeAllOptionsFromMastraExcept;
|
|
714
|
-
//# sourceMappingURL=chunk-
|
|
715
|
-
//# sourceMappingURL=chunk-
|
|
716
|
+
//# sourceMappingURL=chunk-J3ANFXPF.cjs.map
|
|
717
|
+
//# sourceMappingURL=chunk-J3ANFXPF.cjs.map
|