@mastra/deployer-vercel 0.0.0-support-monorepos-20250415183219 → 0.0.0-taofeeqInngest-20250603090617

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.
@@ -9,14 +9,15 @@ export declare class VercelDeployer extends Deployer {
9
9
  projectName: string;
10
10
  token: string;
11
11
  });
12
- writeFiles(outputDirectory: string): void;
13
12
  private getProjectId;
14
13
  private getTeamId;
15
14
  private syncEnv;
16
15
  prepare(outputDirectory: string): Promise<void>;
17
16
  private getEntry;
18
- bundle(entryFile: string, outputDirectory: string): Promise<void>;
17
+ private writeVercelJSON;
18
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
19
19
  deploy(outputDirectory: string): Promise<void>;
20
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
20
21
  }
21
22
 
22
23
  export { }
@@ -9,14 +9,15 @@ export declare class VercelDeployer extends Deployer {
9
9
  projectName: string;
10
10
  token: string;
11
11
  });
12
- writeFiles(outputDirectory: string): void;
13
12
  private getProjectId;
14
13
  private getTeamId;
15
14
  private syncEnv;
16
15
  prepare(outputDirectory: string): Promise<void>;
17
16
  private getEntry;
18
- bundle(entryFile: string, outputDirectory: string): Promise<void>;
17
+ private writeVercelJSON;
18
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
19
19
  deploy(outputDirectory: string): Promise<void>;
20
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
20
21
  }
21
22
 
22
23
  export { }
package/dist/index.cjs CHANGED
@@ -40,32 +40,6 @@ var VercelDeployer = class extends deployer.Deployer {
40
40
  this.projectName = projectName;
41
41
  this.token = token;
42
42
  }
43
- writeFiles(outputDirectory) {
44
- fs.writeFileSync(
45
- path.join(outputDirectory, this.outputDir, "vercel.json"),
46
- JSON.stringify(
47
- {
48
- version: 2,
49
- installCommand: "npm install --omit=dev",
50
- builds: [
51
- {
52
- src: "index.mjs",
53
- use: "@vercel/node",
54
- config: { includeFiles: ["**"] }
55
- }
56
- ],
57
- routes: [
58
- {
59
- src: "/(.*)",
60
- dest: "index.mjs"
61
- }
62
- ]
63
- },
64
- null,
65
- 2
66
- )
67
- );
68
- }
69
43
  getProjectId({ dir }) {
70
44
  const projectJsonPath = path.join(dir, "output", ".vercel", "project.json");
71
45
  try {
@@ -128,22 +102,101 @@ var VercelDeployer = class extends deployer.Deployer {
128
102
  }
129
103
  async prepare(outputDirectory) {
130
104
  await super.prepare(outputDirectory);
131
- await this.writeFiles(outputDirectory);
132
105
  }
133
106
  getEntry() {
134
107
  return `
135
108
  import { handle } from 'hono/vercel'
136
109
  import { mastra } from '#mastra';
137
110
  import { createHonoServer } from '#server';
111
+ import { evaluate } from '@mastra/core/eval';
112
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
113
+ import { TABLE_EVALS } from '@mastra/core/storage';
114
+ import { checkEvalStorageFields } from '@mastra/core/utils';
115
+
116
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
117
+ evaluate({
118
+ agentName,
119
+ input,
120
+ metric,
121
+ output,
122
+ runId,
123
+ globalRunId: runId,
124
+ instructions,
125
+ });
126
+ });
127
+
128
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
129
+ const storage = mastra.getStorage();
130
+ if (storage) {
131
+ // Check for required fields
132
+ const logger = mastra?.getLogger();
133
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
134
+ if (!areFieldsValid) return;
135
+
136
+ await storage.insert({
137
+ tableName: TABLE_EVALS,
138
+ record: {
139
+ input: traceObject.input,
140
+ output: traceObject.output,
141
+ result: JSON.stringify(traceObject.result || {}),
142
+ agent_name: traceObject.agentName,
143
+ metric_name: traceObject.metricName,
144
+ instructions: traceObject.instructions,
145
+ test_info: null,
146
+ global_run_id: traceObject.globalRunId,
147
+ run_id: traceObject.runId,
148
+ created_at: new Date().toISOString(),
149
+ },
150
+ });
151
+ }
152
+ });
138
153
 
139
154
  const app = await createHonoServer(mastra);
140
155
 
141
156
  export const GET = handle(app);
142
157
  export const POST = handle(app);
158
+ export const PUT = handle(app);
159
+ export const DELETE = handle(app);
160
+ export const OPTIONS = handle(app);
161
+ export const HEAD = handle(app);
143
162
  `;
144
163
  }
145
- async bundle(entryFile, outputDirectory) {
146
- return this._bundle(this.getEntry(), entryFile, outputDirectory);
164
+ writeVercelJSON(outputDirectory, files = ["./*"]) {
165
+ fs.writeFileSync(
166
+ path.join(outputDirectory, this.outputDir, "vercel.json"),
167
+ JSON.stringify(
168
+ {
169
+ version: 2,
170
+ installCommand: "npm install --omit=dev",
171
+ builds: [
172
+ {
173
+ src: "index.mjs",
174
+ use: "@vercel/node",
175
+ config: { includeFiles: files }
176
+ }
177
+ ],
178
+ routes: [
179
+ {
180
+ src: "/(.*)",
181
+ dest: "index.mjs"
182
+ }
183
+ ]
184
+ },
185
+ null,
186
+ 2
187
+ )
188
+ );
189
+ }
190
+ async bundle(entryFile, outputDirectory, toolsPaths) {
191
+ const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
192
+ const files = fs.readdirSync(path.join(outputDirectory, this.outputDir), {
193
+ recursive: true
194
+ });
195
+ const filesWithoutNodeModules = files.filter(
196
+ (file) => typeof file === "string" && !file.startsWith("node_modules")
197
+ );
198
+ this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
199
+ return result;
147
200
  }
148
201
  async deploy(outputDirectory) {
149
202
  const envVars = await this.loadEnvVars();
@@ -172,6 +225,18 @@ export const POST = handle(app);
172
225
  this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
173
226
  }
174
227
  }
228
+ async lint(entryFile, outputDirectory, toolsPaths) {
229
+ await super.lint(entryFile, outputDirectory, toolsPaths);
230
+ await super.lint(entryFile, outputDirectory, toolsPaths);
231
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
232
+ if (hasLibsql) {
233
+ this.logger.error(
234
+ `Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency.
235
+ Use other Mastra Storage options instead e.g @mastra/pg`
236
+ );
237
+ process__default.default.exit(1);
238
+ }
239
+ }
175
240
  };
176
241
 
177
242
  exports.VercelDeployer = VercelDeployer;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as child_process from 'child_process';
2
- import { writeFileSync, readFileSync } from 'fs';
2
+ import { readFileSync, writeFileSync, readdirSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import process from 'process';
5
5
  import { Deployer } from '@mastra/deployer';
@@ -15,32 +15,6 @@ var VercelDeployer = class extends Deployer {
15
15
  this.projectName = projectName;
16
16
  this.token = token;
17
17
  }
18
- writeFiles(outputDirectory) {
19
- writeFileSync(
20
- join(outputDirectory, this.outputDir, "vercel.json"),
21
- JSON.stringify(
22
- {
23
- version: 2,
24
- installCommand: "npm install --omit=dev",
25
- builds: [
26
- {
27
- src: "index.mjs",
28
- use: "@vercel/node",
29
- config: { includeFiles: ["**"] }
30
- }
31
- ],
32
- routes: [
33
- {
34
- src: "/(.*)",
35
- dest: "index.mjs"
36
- }
37
- ]
38
- },
39
- null,
40
- 2
41
- )
42
- );
43
- }
44
18
  getProjectId({ dir }) {
45
19
  const projectJsonPath = join(dir, "output", ".vercel", "project.json");
46
20
  try {
@@ -103,22 +77,101 @@ var VercelDeployer = class extends Deployer {
103
77
  }
104
78
  async prepare(outputDirectory) {
105
79
  await super.prepare(outputDirectory);
106
- await this.writeFiles(outputDirectory);
107
80
  }
108
81
  getEntry() {
109
82
  return `
110
83
  import { handle } from 'hono/vercel'
111
84
  import { mastra } from '#mastra';
112
85
  import { createHonoServer } from '#server';
86
+ import { evaluate } from '@mastra/core/eval';
87
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
88
+ import { TABLE_EVALS } from '@mastra/core/storage';
89
+ import { checkEvalStorageFields } from '@mastra/core/utils';
90
+
91
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
92
+ evaluate({
93
+ agentName,
94
+ input,
95
+ metric,
96
+ output,
97
+ runId,
98
+ globalRunId: runId,
99
+ instructions,
100
+ });
101
+ });
102
+
103
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
104
+ const storage = mastra.getStorage();
105
+ if (storage) {
106
+ // Check for required fields
107
+ const logger = mastra?.getLogger();
108
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
109
+ if (!areFieldsValid) return;
110
+
111
+ await storage.insert({
112
+ tableName: TABLE_EVALS,
113
+ record: {
114
+ input: traceObject.input,
115
+ output: traceObject.output,
116
+ result: JSON.stringify(traceObject.result || {}),
117
+ agent_name: traceObject.agentName,
118
+ metric_name: traceObject.metricName,
119
+ instructions: traceObject.instructions,
120
+ test_info: null,
121
+ global_run_id: traceObject.globalRunId,
122
+ run_id: traceObject.runId,
123
+ created_at: new Date().toISOString(),
124
+ },
125
+ });
126
+ }
127
+ });
113
128
 
114
129
  const app = await createHonoServer(mastra);
115
130
 
116
131
  export const GET = handle(app);
117
132
  export const POST = handle(app);
133
+ export const PUT = handle(app);
134
+ export const DELETE = handle(app);
135
+ export const OPTIONS = handle(app);
136
+ export const HEAD = handle(app);
118
137
  `;
119
138
  }
120
- async bundle(entryFile, outputDirectory) {
121
- return this._bundle(this.getEntry(), entryFile, outputDirectory);
139
+ writeVercelJSON(outputDirectory, files = ["./*"]) {
140
+ writeFileSync(
141
+ join(outputDirectory, this.outputDir, "vercel.json"),
142
+ JSON.stringify(
143
+ {
144
+ version: 2,
145
+ installCommand: "npm install --omit=dev",
146
+ builds: [
147
+ {
148
+ src: "index.mjs",
149
+ use: "@vercel/node",
150
+ config: { includeFiles: files }
151
+ }
152
+ ],
153
+ routes: [
154
+ {
155
+ src: "/(.*)",
156
+ dest: "index.mjs"
157
+ }
158
+ ]
159
+ },
160
+ null,
161
+ 2
162
+ )
163
+ );
164
+ }
165
+ async bundle(entryFile, outputDirectory, toolsPaths) {
166
+ const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
167
+ const files = readdirSync(join(outputDirectory, this.outputDir), {
168
+ recursive: true
169
+ });
170
+ const filesWithoutNodeModules = files.filter(
171
+ (file) => typeof file === "string" && !file.startsWith("node_modules")
172
+ );
173
+ this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
174
+ return result;
122
175
  }
123
176
  async deploy(outputDirectory) {
124
177
  const envVars = await this.loadEnvVars();
@@ -147,6 +200,18 @@ export const POST = handle(app);
147
200
  this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
148
201
  }
149
202
  }
203
+ async lint(entryFile, outputDirectory, toolsPaths) {
204
+ await super.lint(entryFile, outputDirectory, toolsPaths);
205
+ await super.lint(entryFile, outputDirectory, toolsPaths);
206
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
207
+ if (hasLibsql) {
208
+ this.logger.error(
209
+ `Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency.
210
+ Use other Mastra Storage options instead e.g @mastra/pg`
211
+ );
212
+ process.exit(1);
213
+ }
214
+ }
150
215
  };
151
216
 
152
217
  export { VercelDeployer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-vercel",
3
- "version": "0.0.0-support-monorepos-20250415183219",
3
+ "version": "0.0.0-taofeeqInngest-20250603090617",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,18 +27,21 @@
27
27
  "dependencies": {
28
28
  "@rollup/plugin-virtual": "^3.0.2",
29
29
  "fs-extra": "^11.3.0",
30
- "@mastra/core": "0.8.3",
31
- "@mastra/deployer": "0.0.0-support-monorepos-20250415183219"
30
+ "@mastra/deployer": "0.0.0-taofeeqInngest-20250603090617"
32
31
  },
33
32
  "devDependencies": {
34
- "@microsoft/api-extractor": "^7.52.1",
33
+ "@microsoft/api-extractor": "^7.52.5",
35
34
  "@types/node": "^20.17.27",
36
35
  "eslint": "^9.23.0",
37
36
  "tsup": "^8.4.0",
38
37
  "typescript": "^5.8.2",
39
38
  "vercel": "^39.4.2",
40
- "vitest": "^3.0.9",
41
- "@internal/lint": "0.0.2"
39
+ "vitest": "^3.1.2",
40
+ "@mastra/core": "0.0.0-taofeeqInngest-20250603090617",
41
+ "@internal/lint": "0.0.0-taofeeqInngest-20250603090617"
42
+ },
43
+ "peerDependencies": {
44
+ "@mastra/core": "^0.10.1-alpha.0"
42
45
  },
43
46
  "scripts": {
44
47
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",