@mastra/deployer 0.2.4 → 0.2.5-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/_tsup-dts-rollup.d.cts +6 -5
- package/dist/_tsup-dts-rollup.d.ts +6 -5
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-CS5NGTWK.js → chunk-KLVSED7T.js} +16 -12
- package/dist/{chunk-WUF7W23E.cjs → chunk-NXBTVZHO.cjs} +17 -13
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
|
@@ -6,8 +6,8 @@ import { Hono } from 'hono';
|
|
|
6
6
|
import type { IDeployer } from '@mastra/core/deployer';
|
|
7
7
|
import { InputOption } from 'rollup';
|
|
8
8
|
import { InputOptions } from 'rollup';
|
|
9
|
-
import type { Logger } from '@mastra/core
|
|
10
|
-
import type { Logger as Logger_2 } from '@mastra/core';
|
|
9
|
+
import type { Logger } from '@mastra/core';
|
|
10
|
+
import type { Logger as Logger_2 } from '@mastra/core/logger';
|
|
11
11
|
import type { Mastra } from '@mastra/core';
|
|
12
12
|
import { MastraBase } from '@mastra/core/base';
|
|
13
13
|
import { MastraBundler } from '@mastra/core/bundler';
|
|
@@ -36,7 +36,7 @@ export declare function aliasHono(): Plugin;
|
|
|
36
36
|
*
|
|
37
37
|
* This helps identify which dependencies need to be externalized vs bundled.
|
|
38
38
|
*/
|
|
39
|
-
declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger:
|
|
39
|
+
declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: Logger): Promise<{
|
|
40
40
|
invalidChunks: Set<string>;
|
|
41
41
|
dependencies: Map<string, string>;
|
|
42
42
|
externalDependencies: Set<string>;
|
|
@@ -71,6 +71,7 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
71
71
|
}>;
|
|
72
72
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
73
73
|
protected copyPublic(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
74
|
+
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>): Promise<InputOptions>;
|
|
74
75
|
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, bundleLocation?: string): Promise<void>;
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -84,7 +85,7 @@ export { createBundler }
|
|
|
84
85
|
export { createBundler as createBundler_alias_1 }
|
|
85
86
|
|
|
86
87
|
declare function createChildProcessLogger({ logger, root }: {
|
|
87
|
-
logger:
|
|
88
|
+
logger: Logger_2;
|
|
88
89
|
root: string;
|
|
89
90
|
}): ({ cmd, args, env }: {
|
|
90
91
|
cmd: string;
|
|
@@ -112,7 +113,7 @@ export declare function createNodeServer(mastra: Mastra, options?: {
|
|
|
112
113
|
apiReqLogs?: boolean;
|
|
113
114
|
}): Promise<ServerType>;
|
|
114
115
|
|
|
115
|
-
declare const createPinoStream: (logger:
|
|
116
|
+
declare const createPinoStream: (logger: Logger_2) => Transform;
|
|
116
117
|
export { createPinoStream }
|
|
117
118
|
export { createPinoStream as createPinoStream_alias_1 }
|
|
118
119
|
export { createPinoStream as createPinoStream_alias_2 }
|
|
@@ -6,8 +6,8 @@ import { Hono } from 'hono';
|
|
|
6
6
|
import type { IDeployer } from '@mastra/core/deployer';
|
|
7
7
|
import { InputOption } from 'rollup';
|
|
8
8
|
import { InputOptions } from 'rollup';
|
|
9
|
-
import type { Logger } from '@mastra/core
|
|
10
|
-
import type { Logger as Logger_2 } from '@mastra/core';
|
|
9
|
+
import type { Logger } from '@mastra/core';
|
|
10
|
+
import type { Logger as Logger_2 } from '@mastra/core/logger';
|
|
11
11
|
import type { Mastra } from '@mastra/core';
|
|
12
12
|
import { MastraBase } from '@mastra/core/base';
|
|
13
13
|
import { MastraBundler } from '@mastra/core/bundler';
|
|
@@ -36,7 +36,7 @@ export declare function aliasHono(): Plugin;
|
|
|
36
36
|
*
|
|
37
37
|
* This helps identify which dependencies need to be externalized vs bundled.
|
|
38
38
|
*/
|
|
39
|
-
declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger:
|
|
39
|
+
declare function analyzeBundle(entry: string, mastraEntry: string, outputDir: string, platform: 'node' | 'browser', logger: Logger): Promise<{
|
|
40
40
|
invalidChunks: Set<string>;
|
|
41
41
|
dependencies: Map<string, string>;
|
|
42
42
|
externalDependencies: Set<string>;
|
|
@@ -71,6 +71,7 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
71
71
|
}>;
|
|
72
72
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
73
73
|
protected copyPublic(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
74
|
+
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>): Promise<InputOptions>;
|
|
74
75
|
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, bundleLocation?: string): Promise<void>;
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -84,7 +85,7 @@ export { createBundler }
|
|
|
84
85
|
export { createBundler as createBundler_alias_1 }
|
|
85
86
|
|
|
86
87
|
declare function createChildProcessLogger({ logger, root }: {
|
|
87
|
-
logger:
|
|
88
|
+
logger: Logger_2;
|
|
88
89
|
root: string;
|
|
89
90
|
}): ({ cmd, args, env }: {
|
|
90
91
|
cmd: string;
|
|
@@ -112,7 +113,7 @@ export declare function createNodeServer(mastra: Mastra, options?: {
|
|
|
112
113
|
apiReqLogs?: boolean;
|
|
113
114
|
}): Promise<ServerType>;
|
|
114
115
|
|
|
115
|
-
declare const createPinoStream: (logger:
|
|
116
|
+
declare const createPinoStream: (logger: Logger_2) => Transform;
|
|
116
117
|
export { createPinoStream }
|
|
117
118
|
export { createPinoStream as createPinoStream_alias_1 }
|
|
118
119
|
export { createPinoStream as createPinoStream_alias_2 }
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNXBTVZHO_cjs = require('../chunk-NXBTVZHO.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 chunkNXBTVZHO_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-KLVSED7T.js';
|
|
@@ -81,9 +81,23 @@ var Bundler = class extends MastraBundler {
|
|
|
81
81
|
}
|
|
82
82
|
await copy(publicDir, join(outputDirectory, this.outputDir));
|
|
83
83
|
}
|
|
84
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo) {
|
|
85
|
+
const inputOptions = await getInputOptions(mastraEntryFile, analyzedBundleInfo, "node");
|
|
86
|
+
const isVirtual = serverFile.includes("\n") || existsSync(serverFile);
|
|
87
|
+
if (isVirtual) {
|
|
88
|
+
inputOptions.input = { index: "#entry" };
|
|
89
|
+
if (Array.isArray(inputOptions.plugins)) {
|
|
90
|
+
inputOptions.plugins.unshift(virtual({ "#entry": serverFile }));
|
|
91
|
+
} else {
|
|
92
|
+
inputOptions.plugins = [virtual({ "#entry": serverFile })];
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
inputOptions.input = { index: serverFile };
|
|
96
|
+
}
|
|
97
|
+
return inputOptions;
|
|
98
|
+
}
|
|
84
99
|
async _bundle(serverFile, mastraEntryFile, outputDirectory, bundleLocation = join(outputDirectory, this.outputDir)) {
|
|
85
100
|
this.logger.info("Start bundling Mastra");
|
|
86
|
-
const isVirtual = serverFile.includes("\n") || existsSync(serverFile);
|
|
87
101
|
const analyzedBundleInfo = await analyzeBundle(
|
|
88
102
|
serverFile,
|
|
89
103
|
mastraEntryFile,
|
|
@@ -105,17 +119,7 @@ var Bundler = class extends MastraBundler {
|
|
|
105
119
|
await this.writePackageJson(join(outputDirectory, this.outputDir), dependenciesToInstall);
|
|
106
120
|
await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));
|
|
107
121
|
this.logger.info("Bundling Mastra application");
|
|
108
|
-
const inputOptions = await
|
|
109
|
-
if (isVirtual) {
|
|
110
|
-
inputOptions.input = { index: "#entry" };
|
|
111
|
-
if (Array.isArray(inputOptions.plugins)) {
|
|
112
|
-
inputOptions.plugins.unshift(virtual({ "#entry": serverFile }));
|
|
113
|
-
} else {
|
|
114
|
-
inputOptions.plugins = [virtual({ "#entry": serverFile })];
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
inputOptions.input = { index: serverFile };
|
|
118
|
-
}
|
|
122
|
+
const inputOptions = await this.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo);
|
|
119
123
|
const bundler = await this.createBundler(inputOptions, { dir: bundleLocation });
|
|
120
124
|
await bundler.write();
|
|
121
125
|
this.logger.info("Bundling Mastra done");
|
|
@@ -31,7 +31,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
31
31
|
}
|
|
32
32
|
async writeInstrumentationFile(outputDirectory) {
|
|
33
33
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
34
|
-
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-
|
|
34
|
+
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-NXBTVZHO.cjs', document.baseURI).href))));
|
|
35
35
|
await esm.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
|
|
36
36
|
}
|
|
37
37
|
async writePackageJson(outputDirectory, dependencies) {
|
|
@@ -89,9 +89,23 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
89
89
|
}
|
|
90
90
|
await esm.copy(publicDir, path.join(outputDirectory, this.outputDir));
|
|
91
91
|
}
|
|
92
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo) {
|
|
93
|
+
const inputOptions = await chunkOT6UKL2S_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node");
|
|
94
|
+
const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
|
|
95
|
+
if (isVirtual) {
|
|
96
|
+
inputOptions.input = { index: "#entry" };
|
|
97
|
+
if (Array.isArray(inputOptions.plugins)) {
|
|
98
|
+
inputOptions.plugins.unshift(virtual__default.default({ "#entry": serverFile }));
|
|
99
|
+
} else {
|
|
100
|
+
inputOptions.plugins = [virtual__default.default({ "#entry": serverFile })];
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
inputOptions.input = { index: serverFile };
|
|
104
|
+
}
|
|
105
|
+
return inputOptions;
|
|
106
|
+
}
|
|
92
107
|
async _bundle(serverFile, mastraEntryFile, outputDirectory, bundleLocation = path.join(outputDirectory, this.outputDir)) {
|
|
93
108
|
this.logger.info("Start bundling Mastra");
|
|
94
|
-
const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
|
|
95
109
|
const analyzedBundleInfo = await chunkNWERLYTR_cjs.analyzeBundle(
|
|
96
110
|
serverFile,
|
|
97
111
|
mastraEntryFile,
|
|
@@ -113,17 +127,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
113
127
|
await this.writePackageJson(path.join(outputDirectory, this.outputDir), dependenciesToInstall);
|
|
114
128
|
await this.writeInstrumentationFile(path.join(outputDirectory, this.outputDir));
|
|
115
129
|
this.logger.info("Bundling Mastra application");
|
|
116
|
-
const inputOptions = await
|
|
117
|
-
if (isVirtual) {
|
|
118
|
-
inputOptions.input = { index: "#entry" };
|
|
119
|
-
if (Array.isArray(inputOptions.plugins)) {
|
|
120
|
-
inputOptions.plugins.unshift(virtual__default.default({ "#entry": serverFile }));
|
|
121
|
-
} else {
|
|
122
|
-
inputOptions.plugins = [virtual__default.default({ "#entry": serverFile })];
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
inputOptions.input = { index: serverFile };
|
|
126
|
-
}
|
|
130
|
+
const inputOptions = await this.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo);
|
|
127
131
|
const bundler = await this.createBundler(inputOptions, { dir: bundleLocation });
|
|
128
132
|
await bundler.write();
|
|
129
133
|
this.logger.info("Bundling Mastra done");
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk7GYBZLVN_cjs = require('./chunk-7GYBZLVN.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkNXBTVZHO_cjs = require('./chunk-NXBTVZHO.cjs');
|
|
5
5
|
var chunkKFOGAPGX_cjs = require('./chunk-KFOGAPGX.cjs');
|
|
6
6
|
var babel = require('@babel/core');
|
|
7
7
|
var rollup = require('rollup');
|
|
@@ -33,7 +33,7 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
|
33
33
|
var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
|
|
34
34
|
|
|
35
35
|
// src/deploy/base.ts
|
|
36
|
-
var Deployer = class extends
|
|
36
|
+
var Deployer = class extends chunkNXBTVZHO_cjs.Bundler {
|
|
37
37
|
deps = new chunkKFOGAPGX_cjs.Deps();
|
|
38
38
|
constructor(args) {
|
|
39
39
|
super(args.name, "DEPLOYER");
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileService } from './chunk-PUX2FDGX.js';
|
|
2
2
|
export { FileService } from './chunk-PUX2FDGX.js';
|
|
3
|
-
import { Bundler } from './chunk-
|
|
3
|
+
import { Bundler } from './chunk-KLVSED7T.js';
|
|
4
4
|
import { Deps, recursiveRemoveNonReferencedNodes } from './chunk-ZAXXMFXX.js';
|
|
5
5
|
export { Deps, createChildProcessLogger, createPinoStream } from './chunk-ZAXXMFXX.js';
|
|
6
6
|
import * as babel from '@babel/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
96
96
|
"typescript-paths": "^1.5.1",
|
|
97
97
|
"zod": "^3.24.2",
|
|
98
|
-
"@mastra/core": "^0.
|
|
98
|
+
"@mastra/core": "^0.7.0-alpha.1"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@hono/node-server": "^1.13.8",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"@types/babel__core": "^7.20.5",
|
|
105
105
|
"@types/babel__helper-module-imports": "^7.18.3",
|
|
106
106
|
"@types/fs-extra": "^11.0.4",
|
|
107
|
-
"@types/node": "^
|
|
107
|
+
"@types/node": "^20.17.27",
|
|
108
108
|
"concurrently": "^9.1.2",
|
|
109
|
-
"eslint": "^9.
|
|
109
|
+
"eslint": "^9.23.0",
|
|
110
110
|
"hono-openapi": "^0.4.6",
|
|
111
111
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
112
112
|
"superjson": "^2.2.2",
|