@mastra/deployer-netlify 1.2.38-alpha.2 → 1.2.39-alpha.0
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/_types/rollup/dist/rollup.d.ts +11 -30
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
|
@@ -62,9 +62,7 @@ export type LogLevel = 'warn' | 'info' | 'debug';
|
|
|
62
62
|
export type LogLevelOption = LogLevel | 'silent';
|
|
63
63
|
|
|
64
64
|
export type SourceMapSegment =
|
|
65
|
-
| [number]
|
|
66
|
-
| [number, number, number, number]
|
|
67
|
-
| [number, number, number, number, number];
|
|
65
|
+
[number] | [number, number, number, number] | [number, number, number, number, number];
|
|
68
66
|
|
|
69
67
|
export interface ExistingDecodedSourceMap {
|
|
70
68
|
file?: string | undefined;
|
|
@@ -96,11 +94,11 @@ export type DecodedSourceMapOrMissing =
|
|
|
96
94
|
| (ExistingDecodedSourceMap & { missing?: false | undefined });
|
|
97
95
|
|
|
98
96
|
export interface SourceMap {
|
|
99
|
-
file
|
|
97
|
+
file?: string | undefined;
|
|
100
98
|
mappings: string;
|
|
101
99
|
names: string[];
|
|
102
100
|
sources: string[];
|
|
103
|
-
sourcesContent?: string[] | undefined;
|
|
101
|
+
sourcesContent?: (string | null)[] | undefined;
|
|
104
102
|
version: number;
|
|
105
103
|
debugId?: string | undefined;
|
|
106
104
|
toString(): string;
|
|
@@ -613,9 +611,7 @@ export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
|
613
611
|
export type JsxPreset = 'react' | 'react-jsx' | 'preserve' | 'preserve-react';
|
|
614
612
|
|
|
615
613
|
export type NormalizedJsxOptions =
|
|
616
|
-
|
|
|
617
|
-
| NormalizedJsxClassicOptions
|
|
618
|
-
| NormalizedJsxAutomaticOptions;
|
|
614
|
+
NormalizedJsxPreserveOptions | NormalizedJsxClassicOptions | NormalizedJsxAutomaticOptions;
|
|
619
615
|
|
|
620
616
|
interface NormalizedJsxPreserveOptions {
|
|
621
617
|
factory: string | null;
|
|
@@ -1085,16 +1081,14 @@ export interface AwaitingEventEmitter<T extends Record<string, (...parameters: a
|
|
|
1085
1081
|
off<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
|
|
1086
1082
|
/**
|
|
1087
1083
|
* Registers an event listener that will be awaited before Rollup continues.
|
|
1088
|
-
* All listeners
|
|
1089
|
-
*
|
|
1084
|
+
* All listeners are invoked and awaited in parallel. Rollup waits until all
|
|
1085
|
+
* of them have settled and then throws the first rejection, if any.
|
|
1090
1086
|
*/
|
|
1091
1087
|
on<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
|
|
1092
1088
|
/**
|
|
1093
|
-
* Registers an event listener
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
* Listeners are removed automatically when removeListenersForCurrentRun is
|
|
1097
|
-
* called, which happens automatically after each run.
|
|
1089
|
+
* Registers an event listener like `on`. Listeners are removed automatically
|
|
1090
|
+
* when removeListenersForCurrentRun is called, which happens right before each
|
|
1091
|
+
* rebuild, after the changes that triggered it were announced.
|
|
1098
1092
|
*/
|
|
1099
1093
|
onCurrentRun<K extends keyof T>(
|
|
1100
1094
|
event: K,
|
|
@@ -1132,12 +1126,7 @@ interface AstNodeLocation {
|
|
|
1132
1126
|
}
|
|
1133
1127
|
|
|
1134
1128
|
type OmittedEstreeKeys =
|
|
1135
|
-
| '
|
|
1136
|
-
| 'range'
|
|
1137
|
-
| 'leadingComments'
|
|
1138
|
-
| 'trailingComments'
|
|
1139
|
-
| 'innerComments'
|
|
1140
|
-
| 'comments';
|
|
1129
|
+
'loc' | 'range' | 'leadingComments' | 'trailingComments' | 'innerComments' | 'comments';
|
|
1141
1130
|
type RollupAstNode<T> = Omit<T, OmittedEstreeKeys> & AstNodeLocation;
|
|
1142
1131
|
|
|
1143
1132
|
type ProgramNode = RollupAstNode<estree.Program>;
|
|
@@ -1196,15 +1185,7 @@ export interface RollupFsModule {
|
|
|
1196
1185
|
}
|
|
1197
1186
|
|
|
1198
1187
|
export type BufferEncoding =
|
|
1199
|
-
| '
|
|
1200
|
-
| 'utf8'
|
|
1201
|
-
| 'utf16le'
|
|
1202
|
-
| 'ucs2'
|
|
1203
|
-
| 'base64'
|
|
1204
|
-
| 'base64url'
|
|
1205
|
-
| 'latin1'
|
|
1206
|
-
| 'binary'
|
|
1207
|
-
| 'hex';
|
|
1188
|
+
'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
|
|
1208
1189
|
|
|
1209
1190
|
export interface RollupDirectoryEntry {
|
|
1210
1191
|
isFile(): boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["builtinModules","Deployer","DepsService"],"sources":["../src/index.ts"],"sourcesContent":["import { builtinModules } from 'node:module';\nimport { join } from 'node:path';\nimport process from 'node:process';\nimport type { BundlerConfig } from '@mastra/core/bundler';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport type { BundlerOptions } from '@mastra/deployer/bundler';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\n/** Bare Node.js built-in module names (excludes internal `_`-prefixed ones). */\nconst builtins = new Set(builtinModules.filter(m => !m.startsWith('_')));\n\n/**\n * Rollup plugin that adds the `node:` prefix to bare Node.js built-in imports.\n * Deno requires `node:events` instead of `events`, `node:fs` instead of `fs`, etc.\n */\nfunction nodeBuiltinPrefix() {\n return {\n name: 'node-builtin-prefix',\n resolveId(source: string) {\n const base = source.split('/')[0]!;\n if (builtins.has(base) && !source.startsWith('node:')) {\n return { id: `node:${source}`, external: true };\n }\n return null;\n },\n };\n}\n\n/** Modules that Netlify's Edge bundler cannot resolve: native Node addons (`bufferutil`, `utf-8-validate`) and `typescript`. */\nconst EDGE_INCOMPATIBLE_MODULES = ['bufferutil', 'utf-8-validate', 'typescript'];\n\n/**\n * Rollup plugin that replaces edge-incompatible modules with an empty stub so\n * they do not appear as external imports in the bundle.\n */\nfunction stubEdgeIncompatibleModules() {\n const stubs = new Set(EDGE_INCOMPATIBLE_MODULES);\n const STUB_ID = '\\0mastra-netlify-edge-stub';\n return {\n name: 'stub-edge-incompatible-modules',\n resolveId(source: string) {\n return stubs.has(source) ? STUB_ID : null;\n },\n load(id: string) {\n if (id === STUB_ID) {\n return 'export default undefined;';\n }\n return null;\n },\n };\n}\n\nexport interface NetlifyDeployerOptions {\n /**\n * Deploy target for Netlify.\n *\n * - `'serverless'` — Standard Netlify Functions (Node.js runtime, 60s default timeout).\n * - `'edge'` — Netlify Edge Functions (Deno-based runtime, no hard timeout, runs at the edge).\n *\n * @default 'serverless'\n */\n target?: 'serverless' | 'edge';\n}\n\nexport class NetlifyDeployer extends Deployer {\n readonly target: 'serverless' | 'edge';\n\n constructor(options: NetlifyDeployerOptions = {}) {\n super({ name: 'NETLIFY' });\n\n this.target = options.target ?? 'serverless';\n\n this.outputDir =\n this.target === 'edge' ? join('.netlify', 'v1', 'edge-functions') : join('.netlify', 'v1', 'functions', 'api');\n }\n\n protected async installDependencies(\n outputDirectory: string,\n rootDir = process.cwd(),\n pnpmOverrides?: Record<string, string>,\n pnpmWorkspaceSettings?: BundlerConfig['pnpmWorkspaceSettings'],\n ) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n if (this.target === 'edge') {\n // Edge functions run on Deno — no platform-specific architecture constraints\n await deps.install({ dir: join(outputDirectory, this.outputDir), pnpmOverrides, pnpmWorkspaceSettings });\n } else {\n await deps.install({\n dir: join(outputDirectory, this.outputDir),\n pnpmOverrides,\n pnpmWorkspaceSettings,\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\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 protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n bundlerOptions: BundlerOptions,\n additionalEntries: Record<string, string>,\n toolProjectRoot: string,\n ) {\n const inputOptions = await super.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n {\n ...bundlerOptions,\n enableEsmShim: this.target !== 'edge',\n },\n additionalEntries,\n toolProjectRoot,\n );\n\n if (this.target === 'edge' && Array.isArray(inputOptions.plugins)) {\n // Run before subpathExternalsResolver so the resolveId hooks win.\n inputOptions.plugins.unshift(nodeBuiltinPrefix(), stubEdgeIncompatibleModules());\n\n // Drop edge-incompatible modules from Rollup's external list so the stub plugin can redirect them.\n if (Array.isArray(inputOptions.external)) {\n inputOptions.external = inputOptions.external.filter(id => !EDGE_INCOMPATIBLE_MODULES.includes(id as string));\n }\n }\n\n return inputOptions;\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: this.target !== 'edge' },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n // Use Netlify Frameworks API config.json\n // https://docs.netlify.com/build/frameworks/frameworks-api/\n if (this.target === 'edge') {\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n edge_functions: [\n {\n function: 'index',\n path: '/*',\n },\n ],\n });\n } else {\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n functions: {\n directory: '.netlify/v1/functions',\n node_bundler: 'none', // Mastra pre-bundles, don't re-bundle\n included_files: ['.netlify/v1/functions/**'],\n },\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\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 { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\n if (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\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 // LibSQL uses native Node.js bindings — incompatible with both serverless and edge environments\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger?.error(\n `Netlify Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency.\n LibSQL with file URLs uses native Node.js bindings that cannot run in Netlify serverless or edge environments. Use other Mastra Storage options instead.`,\n );\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,WAAW,I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AAC,0BAA0B;GAC7C;GACA,WAAW,CACT;IACE,OAAO;IACP,MAAM;IACN,IAAI;IACJ,QAAQ;GACV,CACF;EACF,CAAC;EAGH,OAAA,GAAA,aAAA,KAAA,EAAA,GAAA,KAAA,KAAA,CAAgB,iBAAiB,YAAY,IAAI,IAAA,GAAA,KAAA,KAAA,CAAQ,QAAA,QAAQ,IAAI,GAAG,YAAY,IAAI,GAAG,EACzF,WAAW,KACb,CAAC;EAED,OAAO;CACT;CAEA,WAA2B;EACzB,OAAO;;;;;;;;;;;;;;;CAeT;CAEA,MAAM,KAAK,WAAmB,iBAAyB,YAAkD;EACvG,MAAM,MAAM,KAAK,WAAW,iBAAiB,UAAU;EAKvD,IAFmB,MAAM,KAAK,KAAK,kBAAkB,CAAC,gBAAgB,CAAC,MAAO,MAE/D;GACb,KAAK,QAAQ,MACX;iKAEF;GACA,QAAA,QAAQ,KAAK,CAAC;EAChB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["builtinModules","Deployer","join","DepsService","writeJson","move"],"sources":["../src/index.ts"],"sourcesContent":["import { builtinModules } from 'node:module';\nimport { join } from 'node:path';\nimport process from 'node:process';\nimport type { BundlerConfig } from '@mastra/core/bundler';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport type { BundlerOptions } from '@mastra/deployer/bundler';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\n/** Bare Node.js built-in module names (excludes internal `_`-prefixed ones). */\nconst builtins = new Set(builtinModules.filter(m => !m.startsWith('_')));\n\n/**\n * Rollup plugin that adds the `node:` prefix to bare Node.js built-in imports.\n * Deno requires `node:events` instead of `events`, `node:fs` instead of `fs`, etc.\n */\nfunction nodeBuiltinPrefix() {\n return {\n name: 'node-builtin-prefix',\n resolveId(source: string) {\n const base = source.split('/')[0]!;\n if (builtins.has(base) && !source.startsWith('node:')) {\n return { id: `node:${source}`, external: true };\n }\n return null;\n },\n };\n}\n\n/** Modules that Netlify's Edge bundler cannot resolve: native Node addons (`bufferutil`, `utf-8-validate`) and `typescript`. */\nconst EDGE_INCOMPATIBLE_MODULES = ['bufferutil', 'utf-8-validate', 'typescript'];\n\n/**\n * Rollup plugin that replaces edge-incompatible modules with an empty stub so\n * they do not appear as external imports in the bundle.\n */\nfunction stubEdgeIncompatibleModules() {\n const stubs = new Set(EDGE_INCOMPATIBLE_MODULES);\n const STUB_ID = '\\0mastra-netlify-edge-stub';\n return {\n name: 'stub-edge-incompatible-modules',\n resolveId(source: string) {\n return stubs.has(source) ? STUB_ID : null;\n },\n load(id: string) {\n if (id === STUB_ID) {\n return 'export default undefined;';\n }\n return null;\n },\n };\n}\n\nexport interface NetlifyDeployerOptions {\n /**\n * Deploy target for Netlify.\n *\n * - `'serverless'` — Standard Netlify Functions (Node.js runtime, 60s default timeout).\n * - `'edge'` — Netlify Edge Functions (Deno-based runtime, no hard timeout, runs at the edge).\n *\n * @default 'serverless'\n */\n target?: 'serverless' | 'edge';\n}\n\nexport class NetlifyDeployer extends Deployer {\n readonly target: 'serverless' | 'edge';\n\n constructor(options: NetlifyDeployerOptions = {}) {\n super({ name: 'NETLIFY' });\n\n this.target = options.target ?? 'serverless';\n\n this.outputDir =\n this.target === 'edge' ? join('.netlify', 'v1', 'edge-functions') : join('.netlify', 'v1', 'functions', 'api');\n }\n\n protected async installDependencies(\n outputDirectory: string,\n rootDir = process.cwd(),\n pnpmOverrides?: Record<string, string>,\n pnpmWorkspaceSettings?: BundlerConfig['pnpmWorkspaceSettings'],\n ) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n if (this.target === 'edge') {\n // Edge functions run on Deno — no platform-specific architecture constraints\n await deps.install({ dir: join(outputDirectory, this.outputDir), pnpmOverrides, pnpmWorkspaceSettings });\n } else {\n await deps.install({\n dir: join(outputDirectory, this.outputDir),\n pnpmOverrides,\n pnpmWorkspaceSettings,\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\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 protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n bundlerOptions: BundlerOptions,\n additionalEntries: Record<string, string>,\n toolProjectRoot: string,\n ) {\n const inputOptions = await super.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n {\n ...bundlerOptions,\n enableEsmShim: this.target !== 'edge',\n },\n additionalEntries,\n toolProjectRoot,\n );\n\n if (this.target === 'edge' && Array.isArray(inputOptions.plugins)) {\n // Run before subpathExternalsResolver so the resolveId hooks win.\n inputOptions.plugins.unshift(nodeBuiltinPrefix(), stubEdgeIncompatibleModules());\n\n // Drop edge-incompatible modules from Rollup's external list so the stub plugin can redirect them.\n if (Array.isArray(inputOptions.external)) {\n inputOptions.external = inputOptions.external.filter(id => !EDGE_INCOMPATIBLE_MODULES.includes(id as string));\n }\n }\n\n return inputOptions;\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: this.target !== 'edge' },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n // Use Netlify Frameworks API config.json\n // https://docs.netlify.com/build/frameworks/frameworks-api/\n if (this.target === 'edge') {\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n edge_functions: [\n {\n function: 'index',\n path: '/*',\n },\n ],\n });\n } else {\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n functions: {\n directory: '.netlify/v1/functions',\n node_bundler: 'none', // Mastra pre-bundles, don't re-bundle\n included_files: ['.netlify/v1/functions/**'],\n },\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\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 { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\n if (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\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 // LibSQL uses native Node.js bindings — incompatible with both serverless and edge environments\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger?.error(\n `Netlify Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency.\n LibSQL with file URLs uses native Node.js bindings that cannot run in Netlify serverless or edge environments. Use other Mastra Storage options instead.`,\n );\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,WAAW,IAAI,IAAIA,SAAAA,eAAe,QAAO,MAAK,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC;;;;;AAMvE,SAAS,oBAAoB;CAC3B,OAAO;EACL,MAAM;EACN,UAAU,QAAgB;GACxB,MAAM,OAAO,OAAO,MAAM,GAAG,CAAC,CAAC;GAC/B,IAAI,SAAS,IAAI,IAAI,KAAK,CAAC,OAAO,WAAW,OAAO,GAClD,OAAO;IAAE,IAAI,QAAQ;IAAU,UAAU;GAAK;GAEhD,OAAO;EACT;CACF;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,OAAO;CACT;CAEA,WAA2B;EACzB,OAAO;;;;;;;;;;;;;;;CAeT;CAEA,MAAM,KAAK,WAAmB,iBAAyB,YAAkD;EACvG,MAAM,MAAM,KAAK,WAAW,iBAAiB,UAAU;EAKvD,IAFmB,MAAM,KAAK,KAAK,kBAAkB,CAAC,gBAAgB,CAAC,MAAO,MAE/D;GACb,KAAK,QAAQ,MACX;iKAEF;GACA,QAAA,QAAQ,KAAK,CAAC;EAChB;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.39-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"fs-extra": "^11.3.5",
|
|
29
|
-
"rollup": "^4.
|
|
30
|
-
"@mastra/deployer": "^1.
|
|
29
|
+
"rollup": "^4.64.10",
|
|
30
|
+
"@mastra/deployer": "^1.80.0-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/fs-extra": "^11.0.4",
|
|
34
|
-
"@types/node": "22.20.
|
|
34
|
+
"@types/node": "22.20.5",
|
|
35
35
|
"@vitest/coverage-v8": "4.1.11",
|
|
36
36
|
"@vitest/ui": "4.1.11",
|
|
37
|
-
"tsdown": "0.
|
|
37
|
+
"tsdown": "0.23.1",
|
|
38
38
|
"typescript": "^7.0.2",
|
|
39
39
|
"vitest": "4.1.11",
|
|
40
|
-
"@internal/lint": "0.0.
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
40
|
+
"@internal/lint": "0.0.145",
|
|
41
|
+
"@mastra/core": "1.80.0-alpha.0",
|
|
42
|
+
"@internal/types-builder": "0.0.120"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://mastra.ai",
|
|
45
45
|
"repository": {
|