mastra 0.2.0-alpha.169 → 0.2.0-alpha.171
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/{chunk-UU6XEV7T.js → chunk-TT6FMV27.js} +1 -1
- package/dist/commands/create/create.js +1 -1
- package/dist/index.js +38 -40
- package/package.json +4 -4
- package/src/playground/dist/assets/{index-C7DPxS2u.js → index-BCtrUhVU.js} +2 -2
- package/src/playground/dist/assets/{index-DJ4PjFBw.js → index-J963xAo4.js} +1 -1
- package/src/playground/dist/index.html +1 -1
|
@@ -497,7 +497,7 @@ var checkPkgJson = async () => {
|
|
|
497
497
|
if (isPkgJsonPresent) {
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
|
-
logger.debug('
|
|
500
|
+
logger.debug('package.json not found, create one or run "mastra create" to create a new project');
|
|
501
501
|
process.exit(0);
|
|
502
502
|
};
|
|
503
503
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { create } from '../../chunk-
|
|
1
|
+
export { create } from '../../chunk-TT6FMV27.js';
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { PosthogAnalytics } from './chunk-K5HPNH5H.js';
|
|
3
3
|
export { PosthogAnalytics } from './chunk-K5HPNH5H.js';
|
|
4
|
-
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-
|
|
5
|
-
export { create } from './chunk-
|
|
4
|
+
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-TT6FMV27.js';
|
|
5
|
+
export { create } from './chunk-TT6FMV27.js';
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import 'picocolors';
|
|
8
8
|
import { join, dirname } from 'node:path';
|
|
9
|
-
import { FileService as FileService$
|
|
9
|
+
import { FileService as FileService$2, getWatcherInputOptions, writeTelemetryConfig, createWatcher } from '@mastra/deployer/build';
|
|
10
10
|
import { Bundler } from '@mastra/deployer/bundler';
|
|
11
|
-
import * as
|
|
11
|
+
import * as fsExtra from 'fs-extra';
|
|
12
12
|
import { readFileSync } from 'node:fs';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
|
-
import { getDeployer, FileService as FileService$
|
|
14
|
+
import { getDeployer, FileService as FileService$1 } from '@mastra/deployer';
|
|
15
15
|
import { join as join$1 } from 'path';
|
|
16
16
|
import { execa } from 'execa';
|
|
17
|
-
import
|
|
17
|
+
import '@mastra/core/bundler';
|
|
18
18
|
import 'dotenv';
|
|
19
19
|
|
|
20
20
|
var BuildBundler = class extends Bundler {
|
|
@@ -24,7 +24,7 @@ var BuildBundler = class extends Bundler {
|
|
|
24
24
|
getEnvFiles() {
|
|
25
25
|
const possibleFiles = [".env.production", ".env"];
|
|
26
26
|
try {
|
|
27
|
-
const fileService = new FileService$
|
|
27
|
+
const fileService = new FileService$2();
|
|
28
28
|
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
29
29
|
return Promise.resolve([envFile]);
|
|
30
30
|
} catch (err) {
|
|
@@ -36,7 +36,7 @@ var BuildBundler = class extends Bundler {
|
|
|
36
36
|
const __filename = fileURLToPath(import.meta.url);
|
|
37
37
|
const __dirname = dirname(__filename);
|
|
38
38
|
const playgroundServePath = join(outputDirectory, this.outputDir, "playground");
|
|
39
|
-
await
|
|
39
|
+
await fsExtra.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
|
|
40
40
|
overwrite: true
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -95,19 +95,14 @@ async function deploy({ dir }) {
|
|
|
95
95
|
logger.warn("No deployer found.");
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
var DevBundler = class extends
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
super({
|
|
102
|
-
name: "Dev",
|
|
103
|
-
component: "BUNDLER"
|
|
104
|
-
});
|
|
105
|
-
this.mastraDir = mastraDir;
|
|
98
|
+
var DevBundler = class extends Bundler {
|
|
99
|
+
constructor() {
|
|
100
|
+
super("Dev");
|
|
106
101
|
}
|
|
107
102
|
getEnvFiles() {
|
|
108
103
|
const possibleFiles = [".env.development", ".env"];
|
|
109
104
|
try {
|
|
110
|
-
const fileService = new FileService$
|
|
105
|
+
const fileService = new FileService$1();
|
|
111
106
|
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
112
107
|
return Promise.resolve([envFile]);
|
|
113
108
|
} catch (err) {
|
|
@@ -117,25 +112,21 @@ var DevBundler = class extends MastraBundler {
|
|
|
117
112
|
async writePackageJson() {
|
|
118
113
|
}
|
|
119
114
|
async prepare(outputDirectory) {
|
|
120
|
-
await
|
|
121
|
-
await fsExtra2.emptyDir(outputDirectory);
|
|
115
|
+
await super.prepare(outputDirectory);
|
|
122
116
|
const __filename = fileURLToPath(import.meta.url);
|
|
123
117
|
const __dirname = dirname(__filename);
|
|
124
|
-
const playgroundServePath = join(outputDirectory, "playground");
|
|
125
|
-
await
|
|
118
|
+
const playgroundServePath = join(outputDirectory, this.outputDir, "playground");
|
|
119
|
+
await fsExtra.copy(join(dirname(__dirname), "src/playground/dist"), playgroundServePath, {
|
|
126
120
|
overwrite: true
|
|
127
121
|
});
|
|
128
122
|
}
|
|
129
|
-
async watch(outputDirectory) {
|
|
123
|
+
async watch(entryFile, outputDirectory) {
|
|
130
124
|
const __filename = fileURLToPath(import.meta.url);
|
|
131
125
|
const __dirname = dirname(__filename);
|
|
132
|
-
const fileService = new FileService$2();
|
|
133
|
-
const entryFile = fileService.getFirstExistingFile([
|
|
134
|
-
join(this.mastraDir, "index.ts"),
|
|
135
|
-
join(this.mastraDir, "index.js")
|
|
136
|
-
]);
|
|
137
126
|
const envFiles = await this.getEnvFiles();
|
|
138
127
|
const inputOptions = await getWatcherInputOptions(entryFile, "node");
|
|
128
|
+
await writeTelemetryConfig(entryFile, join(outputDirectory, this.outputDir));
|
|
129
|
+
await this.writeInstrumentationFile(join(outputDirectory, this.outputDir));
|
|
139
130
|
const watcher = await createWatcher(
|
|
140
131
|
{
|
|
141
132
|
...inputOptions,
|
|
@@ -156,7 +147,7 @@ var DevBundler = class extends MastraBundler {
|
|
|
156
147
|
}
|
|
157
148
|
},
|
|
158
149
|
{
|
|
159
|
-
dir: outputDirectory
|
|
150
|
+
dir: join(outputDirectory, this.outputDir)
|
|
160
151
|
}
|
|
161
152
|
);
|
|
162
153
|
this.logger.info("Starting watcher...");
|
|
@@ -187,15 +178,20 @@ var isRestarting = false;
|
|
|
187
178
|
var startServer = async (dotMastraPath, port, env) => {
|
|
188
179
|
try {
|
|
189
180
|
logger.info("[Mastra Dev] - Starting server...");
|
|
190
|
-
currentServerProcess = execa(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
181
|
+
currentServerProcess = execa(
|
|
182
|
+
"node",
|
|
183
|
+
["--import=./instrumentation.mjs", "--import=@opentelemetry/instrumentation/hook.mjs", "index.mjs"],
|
|
184
|
+
{
|
|
185
|
+
cwd: dotMastraPath,
|
|
186
|
+
env: {
|
|
187
|
+
PORT: port.toString() || "4111",
|
|
188
|
+
...Object.fromEntries(env),
|
|
189
|
+
MASTRA_DEFAULT_STORAGE_URL: `file:${join$1(dotMastraPath, "..", "mastra.db")}`
|
|
190
|
+
},
|
|
191
|
+
stdio: "inherit",
|
|
192
|
+
reject: false
|
|
193
|
+
}
|
|
194
|
+
);
|
|
199
195
|
if (currentServerProcess?.exitCode && currentServerProcess?.exitCode !== 0) {
|
|
200
196
|
if (!currentServerProcess) {
|
|
201
197
|
throw new Error(`Server failed to start`);
|
|
@@ -253,11 +249,13 @@ async function dev({ port, dir, root }) {
|
|
|
253
249
|
const rootDir = root || process.cwd();
|
|
254
250
|
const mastraDir = join$1(rootDir, dir || "src/mastra");
|
|
255
251
|
const dotMastraPath = join$1(rootDir, ".mastra");
|
|
256
|
-
const
|
|
252
|
+
const fileService = new FileService$1();
|
|
253
|
+
const entryFile = fileService.getFirstExistingFile([join$1(mastraDir, "index.ts"), join$1(mastraDir, "index.js")]);
|
|
254
|
+
const bundler = new DevBundler();
|
|
257
255
|
const env = await bundler.loadEnvVars();
|
|
258
256
|
await bundler.prepare(dotMastraPath);
|
|
259
|
-
const watcher = await bundler.watch(dotMastraPath);
|
|
260
|
-
await startServer(dotMastraPath, port, env);
|
|
257
|
+
const watcher = await bundler.watch(entryFile, dotMastraPath);
|
|
258
|
+
await startServer(join$1(dotMastraPath, "output"), port, env);
|
|
261
259
|
watcher.on("event", (event) => {
|
|
262
260
|
if (event.code === "BUNDLE_END") {
|
|
263
261
|
logger.info("[Mastra Dev] - Bundling finished, restarting server...");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mastra",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.171",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "cli for mastra",
|
|
6
6
|
"type": "module",
|
|
@@ -51,12 +51,11 @@
|
|
|
51
51
|
"superjson": "^2.2.2",
|
|
52
52
|
"swr": "^2.2.5",
|
|
53
53
|
"tcp-port-used": "^1.0.2",
|
|
54
|
-
"typescript": "^5.7.3",
|
|
55
54
|
"yocto-spinner": "^0.1.1",
|
|
56
55
|
"zod": "^3.24.1",
|
|
57
56
|
"zod-to-json-schema": "^3.24.1",
|
|
58
|
-
"@mastra/core": "^0.2.0-alpha.
|
|
59
|
-
"@mastra/deployer": "^0.1.0-alpha.
|
|
57
|
+
"@mastra/core": "^0.2.0-alpha.110",
|
|
58
|
+
"@mastra/deployer": "^0.1.0-alpha.63"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
61
|
"@ai-sdk/openai": "^1.1.9",
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
"rollup": "^4.30.1",
|
|
73
72
|
"tsup": "^8.3.5",
|
|
74
73
|
"type-fest": "^4.30.0",
|
|
74
|
+
"typescript": "^5.7.3",
|
|
75
75
|
"vitest": "^3.0.4"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|