@mastra/deployer-vercel 0.0.0-revert-schema-20250416221206 → 0.0.0-safe-stringify-telemetry-20251205024938
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/CHANGELOG.md +4100 -0
- package/LICENSE.md +11 -42
- package/README.md +9 -6
- package/dist/index.cjs +112 -142
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -124
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +39 -18
- package/dist/_tsup-dts-rollup.d.cts +0 -22
- package/dist/_tsup-dts-rollup.d.ts +0 -22
- package/dist/index.d.cts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,152 +1,141 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { writeFileSync, readFileSync } from 'fs';
|
|
1
|
+
import { writeFileSync } from 'fs';
|
|
3
2
|
import { join } from 'path';
|
|
4
3
|
import process from 'process';
|
|
5
4
|
import { Deployer } from '@mastra/deployer';
|
|
5
|
+
import { move } from 'fs-extra/esm';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
var VercelDeployer = class extends Deployer {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
token;
|
|
12
|
-
constructor({ teamSlug, projectName, token }) {
|
|
9
|
+
vcConfigOverrides = {};
|
|
10
|
+
constructor(options = {}) {
|
|
13
11
|
super({ name: "VERCEL" });
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.token = token;
|
|
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
|
-
getProjectId({ dir }) {
|
|
45
|
-
const projectJsonPath = join(dir, "output", ".vercel", "project.json");
|
|
46
|
-
try {
|
|
47
|
-
const projectJson = JSON.parse(readFileSync(projectJsonPath, "utf-8"));
|
|
48
|
-
return projectJson.projectId;
|
|
49
|
-
} catch {
|
|
50
|
-
throw new Error("Could not find project ID. Make sure the project has been deployed first.");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async getTeamId() {
|
|
54
|
-
const response = await fetch(`https://api.vercel.com/v2/teams`, {
|
|
55
|
-
headers: {
|
|
56
|
-
Authorization: `Bearer ${this.token}`
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
const res = await response.json();
|
|
60
|
-
const teams = res.teams;
|
|
61
|
-
return teams.find((team) => team.slug === this.teamSlug)?.id;
|
|
62
|
-
}
|
|
63
|
-
async syncEnv(envVars, { outputDirectory }) {
|
|
64
|
-
console.log("Syncing environment variables...");
|
|
65
|
-
const vercelEnvVars = Array.from(envVars.entries()).map(([key, value]) => {
|
|
66
|
-
if (!key || !value) {
|
|
67
|
-
throw new Error(`Invalid environment variable format: ${key || value}`);
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
key,
|
|
71
|
-
value,
|
|
72
|
-
target: ["production", "preview", "development"],
|
|
73
|
-
type: "plain"
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
try {
|
|
77
|
-
const projectId = this.getProjectId({ dir: outputDirectory });
|
|
78
|
-
const teamId = await this.getTeamId();
|
|
79
|
-
const response = await fetch(
|
|
80
|
-
`https://api.vercel.com/v10/projects/${projectId}/env?teamId=${teamId}&upsert=true`,
|
|
81
|
-
{
|
|
82
|
-
method: "POST",
|
|
83
|
-
headers: {
|
|
84
|
-
Authorization: `Bearer ${this.token}`,
|
|
85
|
-
"Content-Type": "application/json"
|
|
86
|
-
},
|
|
87
|
-
body: JSON.stringify(vercelEnvVars)
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
if (!response.ok) {
|
|
91
|
-
const error = await response.json();
|
|
92
|
-
throw new Error(`Failed to sync environment variables: ${error.message}`);
|
|
93
|
-
}
|
|
94
|
-
console.log("\u2713 Successfully synced environment variables");
|
|
95
|
-
} catch (error) {
|
|
96
|
-
if (error instanceof Error) {
|
|
97
|
-
console.error("Failed to sync environment variables:", error.message);
|
|
98
|
-
} else {
|
|
99
|
-
console.error("Failed to sync environment variables:", error);
|
|
100
|
-
}
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
12
|
+
this.outputDir = join(".vercel", "output", "functions", "index.func");
|
|
13
|
+
this.vcConfigOverrides = { ...options };
|
|
103
14
|
}
|
|
104
15
|
async prepare(outputDirectory) {
|
|
105
16
|
await super.prepare(outputDirectory);
|
|
106
|
-
|
|
17
|
+
this.writeVercelJSON(join(outputDirectory, this.outputDir, "..", ".."));
|
|
107
18
|
}
|
|
108
19
|
getEntry() {
|
|
109
20
|
return `
|
|
110
21
|
import { handle } from 'hono/vercel'
|
|
111
22
|
import { mastra } from '#mastra';
|
|
112
|
-
import { createHonoServer } from '#server';
|
|
23
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
24
|
+
import { tools } from '#tools';
|
|
25
|
+
import { evaluate } from '@mastra/core/eval';
|
|
26
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
27
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
28
|
+
import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';
|
|
29
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
30
|
+
|
|
31
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
32
|
+
evaluate({
|
|
33
|
+
agentName,
|
|
34
|
+
input,
|
|
35
|
+
metric,
|
|
36
|
+
output,
|
|
37
|
+
runId,
|
|
38
|
+
globalRunId: runId,
|
|
39
|
+
instructions,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (mastra.getStorage()) {
|
|
44
|
+
mastra.__registerInternalWorkflow(scoreTracesWorkflow);
|
|
45
|
+
}
|
|
113
46
|
|
|
114
|
-
|
|
47
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
48
|
+
const storage = mastra.getStorage();
|
|
49
|
+
if (storage) {
|
|
50
|
+
// Check for required fields
|
|
51
|
+
const logger = mastra?.getLogger();
|
|
52
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
53
|
+
if (!areFieldsValid) return;
|
|
54
|
+
|
|
55
|
+
await storage.insert({
|
|
56
|
+
tableName: TABLE_EVALS,
|
|
57
|
+
record: {
|
|
58
|
+
input: traceObject.input,
|
|
59
|
+
output: traceObject.output,
|
|
60
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
61
|
+
agent_name: traceObject.agentName,
|
|
62
|
+
metric_name: traceObject.metricName,
|
|
63
|
+
instructions: traceObject.instructions,
|
|
64
|
+
test_info: null,
|
|
65
|
+
global_run_id: traceObject.globalRunId,
|
|
66
|
+
run_id: traceObject.runId,
|
|
67
|
+
created_at: new Date().toISOString(),
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
115
74
|
|
|
116
75
|
export const GET = handle(app);
|
|
117
76
|
export const POST = handle(app);
|
|
77
|
+
export const PUT = handle(app);
|
|
78
|
+
export const DELETE = handle(app);
|
|
79
|
+
export const PATCH = handle(app);
|
|
80
|
+
export const OPTIONS = handle(app);
|
|
81
|
+
export const HEAD = handle(app);
|
|
118
82
|
`;
|
|
119
83
|
}
|
|
120
|
-
|
|
121
|
-
|
|
84
|
+
writeVercelJSON(outputDirectory) {
|
|
85
|
+
writeFileSync(
|
|
86
|
+
join(outputDirectory, "config.json"),
|
|
87
|
+
JSON.stringify({
|
|
88
|
+
version: 3,
|
|
89
|
+
routes: [
|
|
90
|
+
{
|
|
91
|
+
src: "/(.*)",
|
|
92
|
+
dest: "/"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
);
|
|
122
97
|
}
|
|
123
|
-
async
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
join(outputDirectory, this.outputDir)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
98
|
+
async bundle(entryFile, outputDirectory, { toolsPaths, projectRoot }) {
|
|
99
|
+
const result = await this._bundle(
|
|
100
|
+
this.getEntry(),
|
|
101
|
+
entryFile,
|
|
102
|
+
{ outputDirectory, projectRoot },
|
|
103
|
+
toolsPaths,
|
|
104
|
+
join(outputDirectory, this.outputDir)
|
|
105
|
+
);
|
|
106
|
+
const nodeVersion = process.version?.split(".")?.[0]?.replace("v", "") ?? "22";
|
|
107
|
+
const vcConfig = {
|
|
108
|
+
handler: "index.mjs",
|
|
109
|
+
launcherType: "Nodejs",
|
|
110
|
+
runtime: `nodejs${nodeVersion}.x`,
|
|
111
|
+
shouldAddHelpers: true
|
|
112
|
+
};
|
|
113
|
+
const { maxDuration, memory, regions } = this.vcConfigOverrides;
|
|
114
|
+
if (typeof maxDuration === "number") vcConfig.maxDuration = maxDuration;
|
|
115
|
+
if (typeof memory === "number") vcConfig.memory = memory;
|
|
116
|
+
if (Array.isArray(regions) && regions.length > 0) vcConfig.regions = regions;
|
|
117
|
+
writeFileSync(join(outputDirectory, this.outputDir, ".vc-config.json"), JSON.stringify(vcConfig, null, 2));
|
|
118
|
+
await move(join(outputDirectory, ".vercel", "output"), join(process.cwd(), ".vercel", "output"), {
|
|
119
|
+
overwrite: true
|
|
142
120
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
async deploy() {
|
|
124
|
+
this.logger?.info("Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.");
|
|
125
|
+
}
|
|
126
|
+
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
127
|
+
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
128
|
+
const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
|
|
129
|
+
if (hasLibsql) {
|
|
130
|
+
this.logger.error(
|
|
131
|
+
`Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency.
|
|
132
|
+
Use other Mastra Storage options instead e.g @mastra/pg`
|
|
133
|
+
);
|
|
134
|
+
process.exit(1);
|
|
148
135
|
}
|
|
149
136
|
}
|
|
150
137
|
};
|
|
151
138
|
|
|
152
139
|
export { VercelDeployer };
|
|
140
|
+
//# sourceMappingURL=index.js.map
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAOO,IAAM,cAAA,GAAN,cAA6B,QAAA,CAAS;AAAA,EACnC,oBAAuC,EAAC;AAAA,EAEhD,WAAA,CAAY,OAAA,GAAiC,EAAC,EAAG;AAC/C,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,QAAA,EAAU,CAAA;AACxB,IAAA,IAAA,CAAK,SAAA,GAAY,IAAA,CAAK,SAAA,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AAK,+EAA+E,CAAA;AAAA,EACnG;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV,CAAA;AAAA,2DAAA;AAAA,OAEF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import { writeFileSync } from 'fs';\nimport { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { move } from 'fs-extra/esm';\nimport type { VcConfig, VcConfigOverrides, VercelDeployerOptions } from './types';\n\nexport class VercelDeployer extends Deployer {\n private vcConfigOverrides: VcConfigOverrides = {};\n\n constructor(options: VercelDeployerOptions = {}) {\n super({ name: 'VERCEL' });\n this.outputDir = join('.vercel', 'output', 'functions', 'index.func');\n\n // Store all overrides centrally\n this.vcConfigOverrides = { ...options };\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n\n this.writeVercelJSON(join(outputDirectory, this.outputDir, '..', '..'));\n }\n\n private getEntry(): string {\n return `\nimport { handle } from 'hono/vercel'\nimport { mastra } from '#mastra';\nimport { createHonoServer, getToolExports } from '#server';\nimport { tools } from '#tools';\nimport { evaluate } from '@mastra/core/eval';\nimport { AvailableHooks, registerHook } from '@mastra/core/hooks';\nimport { TABLE_EVALS } from '@mastra/core/storage';\nimport { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';\nimport { checkEvalStorageFields } from '@mastra/core/utils';\n\nregisterHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {\n evaluate({\n agentName,\n input,\n metric,\n output,\n runId,\n globalRunId: runId,\n instructions,\n });\n});\n\nif (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n}\n\nregisterHook(AvailableHooks.ON_EVALUATION, async traceObject => {\n const storage = mastra.getStorage();\n if (storage) {\n // Check for required fields\n const logger = mastra?.getLogger();\n const areFieldsValid = checkEvalStorageFields(traceObject, logger);\n if (!areFieldsValid) return;\n\n await storage.insert({\n tableName: TABLE_EVALS,\n record: {\n input: traceObject.input,\n output: traceObject.output,\n result: JSON.stringify(traceObject.result || {}),\n agent_name: traceObject.agentName,\n metric_name: traceObject.metricName,\n instructions: traceObject.instructions,\n test_info: null,\n global_run_id: traceObject.globalRunId,\n run_id: traceObject.runId,\n created_at: new Date().toISOString(),\n },\n });\n }\n});\n\nconst app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\nexport const GET = handle(app);\nexport const POST = handle(app);\nexport const PUT = handle(app);\nexport const DELETE = handle(app);\nexport const PATCH = handle(app);\nexport const OPTIONS = handle(app);\nexport const HEAD = handle(app);\n`;\n }\n\n private writeVercelJSON(outputDirectory: string) {\n writeFileSync(\n join(outputDirectory, 'config.json'),\n JSON.stringify({\n version: 3,\n routes: [\n {\n src: '/(.*)',\n dest: '/',\n },\n ],\n }),\n );\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n const result = await this._bundle(\n this.getEntry(),\n entryFile,\n { outputDirectory, projectRoot },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n const nodeVersion = process.version?.split('.')?.[0]?.replace('v', '') ?? '22';\n\n const vcConfig: VcConfig = {\n handler: 'index.mjs',\n launcherType: 'Nodejs',\n runtime: `nodejs${nodeVersion}.x`,\n shouldAddHelpers: true,\n };\n\n // Merge supported overrides\n const { maxDuration, memory, regions } = this.vcConfigOverrides;\n if (typeof maxDuration === 'number') vcConfig.maxDuration = maxDuration;\n if (typeof memory === 'number') vcConfig.memory = memory;\n if (Array.isArray(regions) && regions.length > 0) vcConfig.regions = regions;\n\n writeFileSync(join(outputDirectory, this.outputDir, '.vc-config.json'), JSON.stringify(vcConfig, null, 2));\n\n await move(join(outputDirectory, '.vercel', 'output'), join(process.cwd(), '.vercel', 'output'), {\n overwrite: true,\n });\n\n return result;\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n `Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency. \n\t\t\t\tUse other Mastra Storage options instead e.g @mastra/pg`,\n );\n process.exit(1);\n }\n }\n}\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type VcConfig = {
|
|
2
|
+
handler: string;
|
|
3
|
+
launcherType: 'Nodejs';
|
|
4
|
+
runtime: string;
|
|
5
|
+
shouldAddHelpers: boolean;
|
|
6
|
+
maxDuration?: number;
|
|
7
|
+
memory?: number;
|
|
8
|
+
regions?: string[];
|
|
9
|
+
};
|
|
10
|
+
export type VcConfigOverrides = Pick<VcConfig, 'maxDuration' | 'memory' | 'regions'>;
|
|
11
|
+
export interface VercelDeployerOptions extends VcConfigOverrides {
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAErF,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-safe-stringify-telemetry-20251205024938",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
|
-
"dist"
|
|
7
|
+
"dist",
|
|
8
|
+
"CHANGELOG.md"
|
|
8
9
|
],
|
|
9
10
|
"main": "dist/index.js",
|
|
10
11
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"default": "./dist/index.js"
|
|
16
17
|
},
|
|
17
18
|
"require": {
|
|
18
|
-
"types": "./dist/index.d.
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
19
20
|
"default": "./dist/index.cjs"
|
|
20
21
|
}
|
|
21
22
|
},
|
|
@@ -23,26 +24,46 @@
|
|
|
23
24
|
},
|
|
24
25
|
"keywords": [],
|
|
25
26
|
"author": "",
|
|
26
|
-
"license": "
|
|
27
|
+
"license": "Apache-2.0",
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@rollup/plugin-virtual": "
|
|
29
|
-
"fs-extra": "^11.3.
|
|
30
|
-
"@mastra/
|
|
31
|
-
"@mastra/deployer": "0.0.0-revert-schema-20250416221206"
|
|
29
|
+
"@rollup/plugin-virtual": "3.0.2",
|
|
30
|
+
"fs-extra": "^11.3.2",
|
|
31
|
+
"@mastra/deployer": "0.0.0-safe-stringify-telemetry-20251205024938"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@microsoft/api-extractor": "^7.52.
|
|
35
|
-
"@types/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"vitest": "^3.
|
|
41
|
-
"@internal/lint": "0.0.
|
|
34
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
35
|
+
"@types/fs-extra": "^11.0.4",
|
|
36
|
+
"@types/node": "^20.19.0",
|
|
37
|
+
"eslint": "^9.37.0",
|
|
38
|
+
"tsup": "^8.5.0",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"vitest": "^3.2.4",
|
|
41
|
+
"@internal/lint": "0.0.0-safe-stringify-telemetry-20251205024938",
|
|
42
|
+
"@mastra/core": "0.0.0-safe-stringify-telemetry-20251205024938",
|
|
43
|
+
"@internal/types-builder": "0.0.0-safe-stringify-telemetry-20251205024938"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://mastra.ai",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
49
|
+
"directory": "deployers/vercel"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@mastra/core": "0.0.0-safe-stringify-telemetry-20251205024938"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"publish-branch": [
|
|
60
|
+
"main",
|
|
61
|
+
"0.x"
|
|
62
|
+
]
|
|
42
63
|
},
|
|
43
64
|
"scripts": {
|
|
44
|
-
"build": "tsup
|
|
45
|
-
"build:watch": "
|
|
65
|
+
"build": "tsup --silent --config tsup.config.ts",
|
|
66
|
+
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
46
67
|
"test": "vitest run",
|
|
47
68
|
"lint": "eslint ."
|
|
48
69
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Deployer } from '@mastra/deployer';
|
|
2
|
-
|
|
3
|
-
export declare class VercelDeployer extends Deployer {
|
|
4
|
-
private teamSlug;
|
|
5
|
-
private projectName;
|
|
6
|
-
private token;
|
|
7
|
-
constructor({ teamSlug, projectName, token }: {
|
|
8
|
-
teamSlug: string;
|
|
9
|
-
projectName: string;
|
|
10
|
-
token: string;
|
|
11
|
-
});
|
|
12
|
-
writeFiles(outputDirectory: string): void;
|
|
13
|
-
private getProjectId;
|
|
14
|
-
private getTeamId;
|
|
15
|
-
private syncEnv;
|
|
16
|
-
prepare(outputDirectory: string): Promise<void>;
|
|
17
|
-
private getEntry;
|
|
18
|
-
bundle(entryFile: string, outputDirectory: string): Promise<void>;
|
|
19
|
-
deploy(outputDirectory: string): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Deployer } from '@mastra/deployer';
|
|
2
|
-
|
|
3
|
-
export declare class VercelDeployer extends Deployer {
|
|
4
|
-
private teamSlug;
|
|
5
|
-
private projectName;
|
|
6
|
-
private token;
|
|
7
|
-
constructor({ teamSlug, projectName, token }: {
|
|
8
|
-
teamSlug: string;
|
|
9
|
-
projectName: string;
|
|
10
|
-
token: string;
|
|
11
|
-
});
|
|
12
|
-
writeFiles(outputDirectory: string): void;
|
|
13
|
-
private getProjectId;
|
|
14
|
-
private getTeamId;
|
|
15
|
-
private syncEnv;
|
|
16
|
-
prepare(outputDirectory: string): Promise<void>;
|
|
17
|
-
private getEntry;
|
|
18
|
-
bundle(entryFile: string, outputDirectory: string): Promise<void>;
|
|
19
|
-
deploy(outputDirectory: string): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { }
|
package/dist/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { VercelDeployer } from './_tsup-dts-rollup.cjs';
|