@mastra/deployer-netlify 1.0.0-beta.0 → 1.0.0-beta.2
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 +20 -0
- package/README.md +59 -45
- package/dist/index.cjs +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/deployer-netlify
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Adjust the generated `.netlify/v1/config.json` file to not let Netlify bundle the functions (since Mastra already bundles its output). Also, re-enable ESM shimming. ([#10405](https://github.com/mastra-ai/mastra/pull/10405))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`ac0d2f4`](https://github.com/mastra-ai/mastra/commit/ac0d2f4ff8831f72c1c66c2be809706d17f65789), [`1a0d3fc`](https://github.com/mastra-ai/mastra/commit/1a0d3fc811482c9c376cdf79ee615c23bae9b2d6), [`85a628b`](https://github.com/mastra-ai/mastra/commit/85a628b1224a8f64cd82ea7f033774bf22df7a7e), [`c237233`](https://github.com/mastra-ai/mastra/commit/c23723399ccedf7f5744b3f40997b79246bfbe64), [`90ae4bf`](https://github.com/mastra-ai/mastra/commit/90ae4bf971286398d4cb528b4678d96b461fef42), [`15f9e21`](https://github.com/mastra-ai/mastra/commit/15f9e216177201ea6e3f6d0bfb063fcc0953444f), [`ff94dea`](https://github.com/mastra-ai/mastra/commit/ff94dea935f4e34545c63bcb6c29804732698809), [`5b2ff46`](https://github.com/mastra-ai/mastra/commit/5b2ff4651df70c146523a7fca773f8eb0a2272f8), [`db41688`](https://github.com/mastra-ai/mastra/commit/db4168806d007417e2e60b4f68656dca4e5f40c9), [`a54a3a6`](https://github.com/mastra-ai/mastra/commit/a54a3a61d88219829de9ff6cf0d5ece163d78dc1), [`5ca599d`](https://github.com/mastra-ai/mastra/commit/5ca599d0bb59a1595f19f58473fcd67cc71cef58), [`bff1145`](https://github.com/mastra-ai/mastra/commit/bff114556b3cbadad9b2768488708f8ad0e91475), [`5c8ca24`](https://github.com/mastra-ai/mastra/commit/5c8ca247094e0cc2cdbd7137822fb47241f86e77), [`e191844`](https://github.com/mastra-ai/mastra/commit/e1918444ca3f80e82feef1dad506cd4ec6e2875f), [`22553f1`](https://github.com/mastra-ai/mastra/commit/22553f11c63ee5e966a9c034a349822249584691), [`7237163`](https://github.com/mastra-ai/mastra/commit/72371635dbf96a87df4b073cc48fc655afbdce3d), [`2500740`](https://github.com/mastra-ai/mastra/commit/2500740ea23da067d6e50ec71c625ab3ce275e64), [`873ecbb`](https://github.com/mastra-ai/mastra/commit/873ecbb517586aa17d2f1e99283755b3ebb2863f), [`4f9bbe5`](https://github.com/mastra-ai/mastra/commit/4f9bbe5968f42c86f4930b8193de3c3c17e5bd36), [`02e51fe`](https://github.com/mastra-ai/mastra/commit/02e51feddb3d4155cfbcc42624fd0d0970d032c0), [`8f3fa3a`](https://github.com/mastra-ai/mastra/commit/8f3fa3a652bb77da092f913ec51ae46e3a7e27dc), [`cd29ad2`](https://github.com/mastra-ai/mastra/commit/cd29ad23a255534e8191f249593849ed29160886), [`bdf4d8c`](https://github.com/mastra-ai/mastra/commit/bdf4d8cdc656d8a2c21d81834bfa3bfa70f56c16), [`854e3da`](https://github.com/mastra-ai/mastra/commit/854e3dad5daac17a91a20986399d3a51f54bf68b), [`ce18d38`](https://github.com/mastra-ai/mastra/commit/ce18d38678c65870350d123955014a8432075fd9), [`cccf9c8`](https://github.com/mastra-ai/mastra/commit/cccf9c8b2d2dfc1a5e63919395b83d78c89682a0), [`5a9bafc`](https://github.com/mastra-ai/mastra/commit/5a9bafcaaa859898e954456e781a1552dc0ad4f1), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`73ac522`](https://github.com/mastra-ai/mastra/commit/73ac522d5db7ba08a9bacf1f801d7990f3100a70), [`f0fdc14`](https://github.com/mastra-ai/mastra/commit/f0fdc14ee233d619266b3d2bbdeea7d25cfc6d13), [`db18bc9`](https://github.com/mastra-ai/mastra/commit/db18bc9c3825e2c1a0ad9a183cc9935f6691bfa1), [`9b37b56`](https://github.com/mastra-ai/mastra/commit/9b37b565e1f2a76c24f728945cc740c2b09be9da), [`41a23c3`](https://github.com/mastra-ai/mastra/commit/41a23c32f9877d71810f37e24930515df2ff7a0f), [`5d171ad`](https://github.com/mastra-ai/mastra/commit/5d171ad9ef340387276b77c2bb3e83e83332d729), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8), [`d1e74a0`](https://github.com/mastra-ai/mastra/commit/d1e74a0a293866dece31022047f5dbab65a304d0), [`39e7869`](https://github.com/mastra-ai/mastra/commit/39e7869bc7d0ee391077ce291474d8a84eedccff), [`5761926`](https://github.com/mastra-ai/mastra/commit/57619260c4a2cdd598763abbacd90de594c6bc76), [`c900fdd`](https://github.com/mastra-ai/mastra/commit/c900fdd504c41348efdffb205cfe80d48c38fa33), [`604a79f`](https://github.com/mastra-ai/mastra/commit/604a79fecf276e26a54a3fe01bb94e65315d2e0e), [`887f0b4`](https://github.com/mastra-ai/mastra/commit/887f0b4746cdbd7cb7d6b17ac9f82aeb58037ea5), [`2562143`](https://github.com/mastra-ai/mastra/commit/256214336b4faa78646c9c1776612393790d8784), [`cd7c74a`](https://github.com/mastra-ai/mastra/commit/cd7c74ab8f7975713b03e6c4768ad66dc0aa2a57), [`ef11a61`](https://github.com/mastra-ai/mastra/commit/ef11a61920fa0ed08a5b7ceedd192875af119749), [`46fa9fe`](https://github.com/mastra-ai/mastra/commit/46fa9feae3d44c7fdcd5b5f6be6acbe341b46e56)]:
|
|
10
|
+
- @mastra/core@1.0.0-beta.6
|
|
11
|
+
- @mastra/deployer@1.0.0-beta.6
|
|
12
|
+
|
|
13
|
+
## 1.0.0-beta.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Remove unused dependencies ([#10019](https://github.com/mastra-ai/mastra/pull/10019))
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`2319326`](https://github.com/mastra-ai/mastra/commit/2319326f8c64e503a09bbcf14be2dd65405445e0), [`2319326`](https://github.com/mastra-ai/mastra/commit/2319326f8c64e503a09bbcf14be2dd65405445e0), [`df9fdcd`](https://github.com/mastra-ai/mastra/commit/df9fdcd8403652c894cf4ac0503afea3b822588c), [`65591d2`](https://github.com/mastra-ai/mastra/commit/65591d2b7cecb83fff4ebc1d743e2f71859a2f7d), [`d629361`](https://github.com/mastra-ai/mastra/commit/d629361a60f6565b5bfb11976fdaf7308af858e2), [`08c31c1`](https://github.com/mastra-ai/mastra/commit/08c31c188ebccd598acaf55e888b6397d01f7eae), [`fd3d338`](https://github.com/mastra-ai/mastra/commit/fd3d338a2c362174ed5b383f1f011ad9fb0302aa), [`c30400a`](https://github.com/mastra-ai/mastra/commit/c30400a49b994b1b97256fe785eb6c906fc2b232), [`69e0a87`](https://github.com/mastra-ai/mastra/commit/69e0a878896a2da9494945d86e056a5f8f05b851), [`01f8878`](https://github.com/mastra-ai/mastra/commit/01f88783de25e4de048c1c8aace43e26373c6ea5), [`4c77209`](https://github.com/mastra-ai/mastra/commit/4c77209e6c11678808b365d545845918c40045c8), [`d827d08`](https://github.com/mastra-ai/mastra/commit/d827d0808ffe1f3553a84e975806cc989b9735dd), [`23c10a1`](https://github.com/mastra-ai/mastra/commit/23c10a1efdd9a693c405511ab2dc8a1236603162), [`676ccc7`](https://github.com/mastra-ai/mastra/commit/676ccc7fe92468d2d45d39c31a87825c89fd1ea0), [`c10398d`](https://github.com/mastra-ai/mastra/commit/c10398d5b88f1d4af556f4267ff06f1d11e89179), [`00c2387`](https://github.com/mastra-ai/mastra/commit/00c2387f5f04a365316f851e58666ac43f8c4edf), [`ad6250d`](https://github.com/mastra-ai/mastra/commit/ad6250dbdaad927e29f74a27b83f6c468b50a705), [`3a73998`](https://github.com/mastra-ai/mastra/commit/3a73998fa4ebeb7f3dc9301afe78095fc63e7999), [`e16d553`](https://github.com/mastra-ai/mastra/commit/e16d55338403c7553531cc568125c63d53653dff), [`4d59f58`](https://github.com/mastra-ai/mastra/commit/4d59f58de2d90d6e2810a19d4518e38ddddb9038), [`e1bb9c9`](https://github.com/mastra-ai/mastra/commit/e1bb9c94b4eb68b019ae275981be3feb769b5365), [`351a11f`](https://github.com/mastra-ai/mastra/commit/351a11fcaf2ed1008977fa9b9a489fc422e51cd4)]:
|
|
20
|
+
- @mastra/core@1.0.0-beta.3
|
|
21
|
+
- @mastra/deployer@1.0.0-beta.3
|
|
22
|
+
|
|
3
23
|
## 1.0.0-beta.0
|
|
4
24
|
|
|
5
25
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@ A Netlify deployer for Mastra applications.
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Deploy Mastra applications to Netlify Functions
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
8
|
+
- Generates Netlify Frameworks API configuration during build
|
|
9
|
+
- Bundles functions with optimized settings for serverless environments
|
|
10
|
+
- Routes all requests through a single API endpoint
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
|
|
15
|
+
npm install @mastra/deployer-netlify
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -23,66 +23,80 @@ The Netlify deployer is used as part of the Mastra framework:
|
|
|
23
23
|
import { Mastra } from '@mastra/core/mastra';
|
|
24
24
|
import { NetlifyDeployer } from '@mastra/deployer-netlify';
|
|
25
25
|
|
|
26
|
-
const deployer = new NetlifyDeployer({
|
|
27
|
-
scope: 'your-team-id',
|
|
28
|
-
projectName: 'your-project-name',
|
|
29
|
-
token: 'your-netlify-token',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
26
|
const mastra = new Mastra({
|
|
33
|
-
deployer,
|
|
34
|
-
// ... other Mastra configuration options
|
|
27
|
+
deployer: new NetlifyDeployer(),
|
|
35
28
|
});
|
|
36
29
|
```
|
|
37
30
|
|
|
38
|
-
## Configuration
|
|
39
|
-
|
|
40
|
-
### Constructor Options
|
|
41
|
-
|
|
42
|
-
- `scope` (required): Your Netlify team slug or ID
|
|
43
|
-
- `projectName`: Name of your Netlify site (will be created if it doesn't exist)
|
|
44
|
-
- `token`: Your Netlify authentication token
|
|
45
|
-
|
|
46
31
|
## Project Structure
|
|
47
32
|
|
|
48
33
|
The deployer automatically creates the following structure:
|
|
49
34
|
|
|
50
|
-
```
|
|
35
|
+
```bash
|
|
51
36
|
your-project/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
└──
|
|
37
|
+
└── .netlify/
|
|
38
|
+
└── v1/
|
|
39
|
+
├── config.json
|
|
40
|
+
└── functions/
|
|
41
|
+
└── api/
|
|
42
|
+
├── index.js
|
|
43
|
+
├── package.json
|
|
44
|
+
└── node_modules/
|
|
56
45
|
```
|
|
57
46
|
|
|
58
|
-
###
|
|
47
|
+
### Netlify Frameworks API Configuration
|
|
48
|
+
|
|
49
|
+
The deployer uses Netlify's [Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/) and generates a `.netlify/v1/config.json` file to configure functions and routing for Netlify.
|
|
50
|
+
|
|
51
|
+
Generated configuration:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"functions": {
|
|
56
|
+
"directory": ".netlify/v1/functions",
|
|
57
|
+
"node_bundler": "none",
|
|
58
|
+
"included_files": [".netlify/v1/functions/**"]
|
|
59
|
+
},
|
|
60
|
+
"redirects": [
|
|
61
|
+
{
|
|
62
|
+
"force": true,
|
|
63
|
+
"from": "/*",
|
|
64
|
+
"to": "/.netlify/functions/api/:splat",
|
|
65
|
+
"status": 200
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
59
70
|
|
|
60
|
-
|
|
71
|
+
This configuration:
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
directory = "/netlify/functions"
|
|
73
|
+
- Tells Netlify where to find your functions
|
|
74
|
+
- Disables Netlify's bundling (Mastra pre-bundles for optimization)
|
|
75
|
+
- Routes all requests to your Mastra API function
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
## How It Works
|
|
78
|
+
|
|
79
|
+
The Netlify deployer:
|
|
80
|
+
|
|
81
|
+
1. **Bundles your Mastra application** into optimized serverless functions
|
|
82
|
+
2. **Creates the Frameworks API configuration** automatically
|
|
83
|
+
3. **Handles all routing** through a single API endpoint
|
|
84
|
+
4. **Pre-optimizes dependencies** for serverless environments
|
|
73
85
|
|
|
74
86
|
## Environment Variables
|
|
75
87
|
|
|
76
|
-
Environment variables are handled
|
|
88
|
+
Environment variables are handled through:
|
|
77
89
|
|
|
78
90
|
- `.env` files in your project
|
|
79
|
-
-
|
|
80
|
-
-
|
|
91
|
+
- Netlify's environment variable dashboard
|
|
92
|
+
- Runtime environment variable access in your Mastra app
|
|
93
|
+
|
|
94
|
+
## Deployment
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
Deploy your Mastra application to Netlify by:
|
|
83
97
|
|
|
84
|
-
|
|
98
|
+
1. **Building locally**: Run your build command (the deployer handles bundling)
|
|
99
|
+
2. **Using Netlify CLI**: `netlify deploy --prod`
|
|
100
|
+
3. **Via Git integration**: Connect your repository to Netlify for automatic deployments
|
|
85
101
|
|
|
86
|
-
|
|
87
|
-
2. Configure the site with your environment variables
|
|
88
|
-
3. Deploy your application to Netlify Functions
|
|
102
|
+
The deployer automatically configures everything needed for Netlify Functions.
|
package/dist/index.cjs
CHANGED
|
@@ -38,11 +38,17 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
38
38
|
const result = await this._bundle(
|
|
39
39
|
this.getEntry(),
|
|
40
40
|
entryFile,
|
|
41
|
-
{ outputDirectory, projectRoot, enableEsmShim:
|
|
41
|
+
{ outputDirectory, projectRoot, enableEsmShim: true },
|
|
42
42
|
toolsPaths,
|
|
43
43
|
path.join(outputDirectory, this.outputDir)
|
|
44
44
|
);
|
|
45
45
|
await esm.writeJson(path.join(outputDirectory, ".netlify", "v1", "config.json"), {
|
|
46
|
+
functions: {
|
|
47
|
+
directory: ".netlify/v1/functions",
|
|
48
|
+
node_bundler: "none",
|
|
49
|
+
// Mastra pre-bundles, don't re-bundle
|
|
50
|
+
included_files: [".netlify/v1/functions/**"]
|
|
51
|
+
},
|
|
46
52
|
redirects: [
|
|
47
53
|
{
|
|
48
54
|
force: true,
|
|
@@ -76,6 +82,14 @@ var NetlifyDeployer = class extends deployer.Deployer {
|
|
|
76
82
|
}
|
|
77
83
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
78
84
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
85
|
+
const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
|
|
86
|
+
if (hasLibsql) {
|
|
87
|
+
this.logger?.error(
|
|
88
|
+
`Netlify Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency.
|
|
89
|
+
LibSQL with file URLs uses native Node.js bindings that cannot run in serverless environments. Use other Mastra Storage options instead.`
|
|
90
|
+
);
|
|
91
|
+
process__default.default.exit(1);
|
|
92
|
+
}
|
|
79
93
|
}
|
|
80
94
|
};
|
|
81
95
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["Deployer","join","process","DepsService","writeJson","move"],"mappings":";;;;;;;;;;;;;AAMO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,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import { join } from 'node:path';\nimport process from 'node: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: true },\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 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 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 // Check for LibSQL dependency which is not supported in Netlify Functions\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 serverless environments. Use other Mastra Storage options instead.`,\n );\n process.exit(1);\n }\n }\n}\n"]}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;IAkChB,OAAO,CAAC,QAAQ;IAkBV,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAczG"}
|
package/dist/index.js
CHANGED
|
@@ -32,11 +32,17 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
32
32
|
const result = await this._bundle(
|
|
33
33
|
this.getEntry(),
|
|
34
34
|
entryFile,
|
|
35
|
-
{ outputDirectory, projectRoot, enableEsmShim:
|
|
35
|
+
{ outputDirectory, projectRoot, enableEsmShim: true },
|
|
36
36
|
toolsPaths,
|
|
37
37
|
join(outputDirectory, this.outputDir)
|
|
38
38
|
);
|
|
39
39
|
await writeJson(join(outputDirectory, ".netlify", "v1", "config.json"), {
|
|
40
|
+
functions: {
|
|
41
|
+
directory: ".netlify/v1/functions",
|
|
42
|
+
node_bundler: "none",
|
|
43
|
+
// Mastra pre-bundles, don't re-bundle
|
|
44
|
+
included_files: [".netlify/v1/functions/**"]
|
|
45
|
+
},
|
|
40
46
|
redirects: [
|
|
41
47
|
{
|
|
42
48
|
force: true,
|
|
@@ -70,6 +76,14 @@ var NetlifyDeployer = class extends Deployer {
|
|
|
70
76
|
}
|
|
71
77
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
72
78
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
79
|
+
const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
|
|
80
|
+
if (hasLibsql) {
|
|
81
|
+
this.logger?.error(
|
|
82
|
+
`Netlify Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency.
|
|
83
|
+
LibSQL with file URLs uses native Node.js bindings that cannot run in serverless environments. Use other Mastra Storage options instead.`
|
|
84
|
+
);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
88
|
};
|
|
75
89
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,GAAO,IAAI,WAAA,CAAY,OAAO,CAAA;AACpC,IAAA,IAAA,CAAK,WAAA,CAAY,KAAK,MAAM,CAAA;AAE5B,IAAA,MAAM,KAAK,OAAA,CAAQ;AAAA,MACjB,GAAA,EAAK,IAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,SAAS,CAAA;AAAA,MACzC,YAAA,EAAc;AAAA,QACZ,EAAA,EAAI,CAAC,OAAO,CAAA;AAAA,QACZ,GAAA,EAAK,CAAC,KAAK,CAAA;AAAA,QACX,IAAA,EAAM,CAAC,KAA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AAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAeT;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAGvD,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,EAAQ,KAAA;AAAA,QACX,CAAA;AAAA,gJAAA;AAAA,OAEF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import { join } from 'node:path';\nimport process from 'node: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: true },\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 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 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 // Check for LibSQL dependency which is not supported in Netlify Functions\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 serverless environments. Use other Mastra Storage options instead.`,\n );\n process.exit(1);\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,23 +26,22 @@
|
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rollup/plugin-virtual": "3.0.2",
|
|
30
|
-
"date-fns": "^4.1.0",
|
|
31
|
-
"execa": "^9.6.0",
|
|
32
29
|
"fs-extra": "^11.3.2",
|
|
33
|
-
"@mastra/deployer": "^1.0.0-beta.
|
|
30
|
+
"@mastra/deployer": "^1.0.0-beta.6"
|
|
34
31
|
},
|
|
35
32
|
"devDependencies": {
|
|
36
33
|
"@microsoft/api-extractor": "^7.52.8",
|
|
37
34
|
"@types/fs-extra": "^11.0.4",
|
|
38
|
-
"@types/node": "
|
|
35
|
+
"@types/node": "22.13.17",
|
|
36
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
37
|
+
"@vitest/ui": "4.0.12",
|
|
39
38
|
"eslint": "^9.37.0",
|
|
40
39
|
"tsup": "^8.5.0",
|
|
41
40
|
"typescript": "^5.8.3",
|
|
42
|
-
"vitest": "
|
|
41
|
+
"vitest": "4.0.12",
|
|
43
42
|
"@internal/lint": "0.0.53",
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
43
|
+
"@mastra/core": "1.0.0-beta.6",
|
|
44
|
+
"@internal/types-builder": "0.0.28"
|
|
46
45
|
},
|
|
47
46
|
"homepage": "https://mastra.ai",
|
|
48
47
|
"repository": {
|