@mastra/deployer-netlify 0.0.0-share-agent-metadata-with-cloud-20250718123411 → 0.0.0-sidebar-window-undefined-fix-20251029233656
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 +3964 -0
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -0
- package/package.json +24 -13
- package/dist/_tsup-dts-rollup.d.cts +0 -13
- package/dist/_tsup-dts-rollup.d.ts +0 -13
- package/dist/index.d.cts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -34,11 +34,11 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
34
34
|
async prepare(outputDirectory) {
|
|
35
35
|
await super.prepare(outputDirectory);
|
|
36
36
|
}
|
|
37
|
-
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
37
|
+
async bundle(entryFile, outputDirectory, { toolsPaths, projectRoot }) {
|
|
38
38
|
const result = await this._bundle(
|
|
39
39
|
this.getEntry(),
|
|
40
40
|
entryFile,
|
|
41
|
-
outputDirectory,
|
|
41
|
+
{ outputDirectory, projectRoot, enableEsmShim: false },
|
|
42
42
|
toolsPaths,
|
|
43
43
|
path.join(outputDirectory, this.outputDir)
|
|
44
44
|
);
|
|
@@ -61,10 +61,12 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
61
61
|
return `
|
|
62
62
|
import { handle } from 'hono/netlify'
|
|
63
63
|
import { mastra } from '#mastra';
|
|
64
|
-
import { createHonoServer } from '#server';
|
|
64
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
65
|
+
import { tools } from '#tools';
|
|
65
66
|
import { evaluate } from '@mastra/core/eval';
|
|
66
67
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
67
68
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
69
|
+
import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';
|
|
68
70
|
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
69
71
|
|
|
70
72
|
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
@@ -79,6 +81,10 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
79
81
|
});
|
|
80
82
|
});
|
|
81
83
|
|
|
84
|
+
if (mastra.getStorage()) {
|
|
85
|
+
mastra.__registerInternalWorkflow(scoreTracesWorkflow);
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
83
89
|
const storage = mastra.getStorage();
|
|
84
90
|
if (storage) {
|
|
@@ -105,7 +111,7 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
105
111
|
}
|
|
106
112
|
});
|
|
107
113
|
|
|
108
|
-
const app = await createHonoServer(mastra);
|
|
114
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
109
115
|
|
|
110
116
|
export default handle(app)
|
|
111
117
|
`;
|
|
@@ -116,3 +122,5 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
116
122
|
};
|
|
117
123
|
|
|
118
124
|
exports.NetlifyDeployer = NetlifyDeployer;
|
|
125
|
+
//# sourceMappingURL=index.cjs.map
|
|
126
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["Deployer","join","process","DepsService","writeJson","move"],"mappings":";;;;;;;;;;;;;AAMO,IAAM,eAAA,GAAN,cAA8BA,iBAAA,CAAS;AAAA,EAC5C,WAAA,GAAc;AACZ,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AACzB,IAAA,IAAA,CAAK,SAAA,GAAYC,SAAA,CAAK,UAAA,EAAY,IAAA,EAAM,aAAa,KAAK,CAAA;AAAA,EAC5D;AAAA,EA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AAA,UACJ,MAAA,EAAQ;AAAA;AACV;AACF,KACD,CAAA;AAED,IAAA,MAAMI,QAAA,CAAKJ,SAAA,CAAK,eAAA,EAAiB,UAAA,EAAY,IAAI,CAAA,EAAGA,SAAA,CAAKC,wBAAA,CAAQ,GAAA,EAAI,EAAG,UAAA,EAAY,IAAI,CAAA,EAAG;AAAA,MACzF,SAAA,EAAW;AAAA,KACZ,CAAA;AAED,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEQ,QAAA,GAAmB;AACzB,IAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAyDT;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAAA,EAGzD;AACF","file":"index.cjs","sourcesContent":["import { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\nexport class NetlifyDeployer extends Deployer {\n constructor() {\n super({ name: 'NETLIFY' });\n this.outputDir = join('.netlify', 'v1', 'functions', 'api');\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({\n dir: join(outputDirectory, this.outputDir),\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\n });\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Netlify failed. Please use the Netlify dashboard to deploy.');\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\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, enableEsmShim: false },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\n ],\n });\n\n await move(join(outputDirectory, '.netlify', 'v1'), join(process.cwd(), '.netlify', 'v1'), {\n overwrite: true,\n });\n\n return result;\n }\n\n private getEntry(): string {\n return `\n import { handle } from 'hono/netlify'\n import { mastra } from '#mastra';\n import { createHonoServer, getToolExports } from '#server';\n import { tools } from '#tools';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n registerHook(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\n if (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n registerHook(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\n const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\n export default handle(app)\n`;\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n // Lint for netlify support\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { Deployer } from '@mastra/deployer';
|
|
2
|
+
export declare class NetlifyDeployer extends Deployer {
|
|
3
|
+
constructor();
|
|
4
|
+
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
5
|
+
deploy(): Promise<void>;
|
|
6
|
+
prepare(outputDirectory: string): Promise<void>;
|
|
7
|
+
bundle(entryFile: string, outputDirectory: string, { toolsPaths, projectRoot }: {
|
|
8
|
+
toolsPaths: (string | string[])[];
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
private getEntry;
|
|
12
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,qBAAa,eAAgB,SAAQ,QAAQ;;cAM3B,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,SAAgB;IAc9E,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACtF,OAAO,CAAC,IAAI,CAAC;IA2BhB,OAAO,CAAC,QAAQ;IA4DV,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAKzG"}
|
package/dist/index.js
CHANGED
|
@@ -28,11 +28,11 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
28
28
|
async prepare(outputDirectory) {
|
|
29
29
|
await super.prepare(outputDirectory);
|
|
30
30
|
}
|
|
31
|
-
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
31
|
+
async bundle(entryFile, outputDirectory, { toolsPaths, projectRoot }) {
|
|
32
32
|
const result = await this._bundle(
|
|
33
33
|
this.getEntry(),
|
|
34
34
|
entryFile,
|
|
35
|
-
outputDirectory,
|
|
35
|
+
{ outputDirectory, projectRoot, enableEsmShim: false },
|
|
36
36
|
toolsPaths,
|
|
37
37
|
join(outputDirectory, this.outputDir)
|
|
38
38
|
);
|
|
@@ -55,10 +55,12 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
55
55
|
return `
|
|
56
56
|
import { handle } from 'hono/netlify'
|
|
57
57
|
import { mastra } from '#mastra';
|
|
58
|
-
import { createHonoServer } from '#server';
|
|
58
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
59
|
+
import { tools } from '#tools';
|
|
59
60
|
import { evaluate } from '@mastra/core/eval';
|
|
60
61
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
61
62
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
63
|
+
import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';
|
|
62
64
|
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
63
65
|
|
|
64
66
|
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
@@ -73,6 +75,10 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
73
75
|
});
|
|
74
76
|
});
|
|
75
77
|
|
|
78
|
+
if (mastra.getStorage()) {
|
|
79
|
+
mastra.__registerInternalWorkflow(scoreTracesWorkflow);
|
|
80
|
+
}
|
|
81
|
+
|
|
76
82
|
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
77
83
|
const storage = mastra.getStorage();
|
|
78
84
|
if (storage) {
|
|
@@ -99,7 +105,7 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
99
105
|
}
|
|
100
106
|
});
|
|
101
107
|
|
|
102
|
-
const app = await createHonoServer(mastra);
|
|
108
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
103
109
|
|
|
104
110
|
export default handle(app)
|
|
105
111
|
`;
|
|
@@ -110,3 +116,5 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
110
116
|
};
|
|
111
117
|
|
|
112
118
|
export { NetlifyDeployer };
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAMO,IAAM,eAAA,GAAN,cAA8B,QAAA,CAAS;AAAA,EAC5C,WAAA,GAAc;AACZ,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AACzB,IAAA,IAAA,CAAK,SAAA,GAAY,IAAA,CAAK,UAAA,EAAY,IAAA,EAAM,aAAa,KAAK,CAAA;AAAA,EAC5D;AAAA,EAEA,MAAgB,mBAAA,CAAoB,eAAA,EAAyB,OAAA,GAAU,OAAA,CAAQ,KAAI,EAAG;AACpF,IAAA,MAAM,IAAA,GAA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AY,IAAI,CAAA,EAAG,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAI,EAAG,UAAA,EAAY,IAAI,CAAA,EAAG;AAAA,MACzF,SAAA,EAAW;AAAA,KACZ,CAAA;AAED,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEQ,QAAA,GAAmB;AACzB,IAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAyDT;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAAA,EAGzD;AACF","file":"index.js","sourcesContent":["import { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\nexport class NetlifyDeployer extends Deployer {\n constructor() {\n super({ name: 'NETLIFY' });\n this.outputDir = join('.netlify', 'v1', 'functions', 'api');\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({\n dir: join(outputDirectory, this.outputDir),\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\n });\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Netlify failed. Please use the Netlify dashboard to deploy.');\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\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, enableEsmShim: false },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\n ],\n });\n\n await move(join(outputDirectory, '.netlify', 'v1'), join(process.cwd(), '.netlify', 'v1'), {\n overwrite: true,\n });\n\n return result;\n }\n\n private getEntry(): string {\n return `\n import { handle } from 'hono/netlify'\n import { mastra } from '#mastra';\n import { createHonoServer, getToolExports } from '#server';\n import { tools } from '#tools';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n registerHook(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\n if (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n registerHook(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\n const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\n export default handle(app)\n`;\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n // Lint for netlify support\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-sidebar-window-undefined-fix-20251029233656",
|
|
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
|
},
|
|
@@ -25,30 +26,40 @@
|
|
|
25
26
|
"author": "",
|
|
26
27
|
"license": "Apache-2.0",
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@rollup/plugin-virtual": "
|
|
29
|
+
"@rollup/plugin-virtual": "3.0.2",
|
|
29
30
|
"date-fns": "^4.1.0",
|
|
30
31
|
"execa": "^9.6.0",
|
|
31
|
-
"fs-extra": "^11.3.
|
|
32
|
-
"
|
|
33
|
-
"@mastra/deployer": "0.0.0-share-agent-metadata-with-cloud-20250718123411"
|
|
32
|
+
"fs-extra": "^11.3.2",
|
|
33
|
+
"@mastra/deployer": "0.0.0-sidebar-window-undefined-fix-20251029233656"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@microsoft/api-extractor": "^7.52.8",
|
|
37
37
|
"@types/fs-extra": "^11.0.4",
|
|
38
38
|
"@types/node": "^20.19.0",
|
|
39
|
-
"eslint": "^9.
|
|
39
|
+
"eslint": "^9.37.0",
|
|
40
40
|
"tsup": "^8.5.0",
|
|
41
41
|
"typescript": "^5.8.3",
|
|
42
42
|
"vitest": "^3.2.4",
|
|
43
|
-
"@internal/lint": "0.0.0-
|
|
44
|
-
"@
|
|
43
|
+
"@internal/lint": "0.0.0-sidebar-window-undefined-fix-20251029233656",
|
|
44
|
+
"@internal/types-builder": "0.0.0-sidebar-window-undefined-fix-20251029233656",
|
|
45
|
+
"@mastra/core": "0.0.0-sidebar-window-undefined-fix-20251029233656"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://mastra.ai",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
51
|
+
"directory": "deployers/netlify"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
45
55
|
},
|
|
46
56
|
"peerDependencies": {
|
|
47
|
-
"
|
|
57
|
+
"zod": "^3.25.0 || ^4.0.0",
|
|
58
|
+
"@mastra/core": "0.0.0-sidebar-window-undefined-fix-20251029233656"
|
|
48
59
|
},
|
|
49
60
|
"scripts": {
|
|
50
|
-
"build": "tsup
|
|
51
|
-
"build:watch": "
|
|
61
|
+
"build": "tsup --silent --config tsup.config.ts",
|
|
62
|
+
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
52
63
|
"test": "vitest run",
|
|
53
64
|
"lint": "eslint ."
|
|
54
65
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Deployer } from '@mastra/deployer';
|
|
2
|
-
|
|
3
|
-
export declare class NetlifyDeployer extends Deployer {
|
|
4
|
-
constructor();
|
|
5
|
-
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
6
|
-
deploy(): Promise<void>;
|
|
7
|
-
prepare(outputDirectory: string): Promise<void>;
|
|
8
|
-
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
9
|
-
private getEntry;
|
|
10
|
-
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Deployer } from '@mastra/deployer';
|
|
2
|
-
|
|
3
|
-
export declare class NetlifyDeployer extends Deployer {
|
|
4
|
-
constructor();
|
|
5
|
-
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
6
|
-
deploy(): Promise<void>;
|
|
7
|
-
prepare(outputDirectory: string): Promise<void>;
|
|
8
|
-
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
9
|
-
private getEntry;
|
|
10
|
-
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { }
|
package/dist/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NetlifyDeployer } from './_tsup-dts-rollup.cjs';
|