@mastra/deployer 0.0.1-alpha.12 → 0.0.1-alpha.13

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.0.1-alpha.13
4
+
5
+ ### Patch Changes
6
+
7
+ - a1774e7: Improve bundling
8
+
3
9
  ## 0.0.1-alpha.12
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,24 +1,20 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.0.1-alpha.12",
3
+ "version": "0.0.1-alpha.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
- "module": "dist/deployer.esm.js",
8
7
  "types": "dist/index.d.ts",
9
8
  "exports": {
10
9
  ".": {
11
10
  "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/deployer.esm.js"
14
- },
15
- "require": {
16
11
  "types": "./dist/index.d.ts",
17
12
  "default": "./dist/index.js"
18
13
  }
19
14
  },
20
15
  "./server": {
21
- "import": "./dist/server/index.js"
16
+ "types": "./dist/server/index.d.ts",
17
+ "default": "./dist/server/index.js"
22
18
  },
23
19
  "./package.json": "./package.json"
24
20
  },
@@ -26,37 +22,36 @@
26
22
  "author": "",
27
23
  "license": "ISC",
28
24
  "dependencies": {
29
- "@hono/node-server": "^1.13.7",
30
- "@hono/swagger-ui": "^0.5.0",
31
- "@hono/zod-validator": "^0.4.2",
32
- "dotenv": "^16.3.1",
33
25
  "esbuild": "^0.24.2",
34
26
  "execa": "^9.3.1",
35
27
  "fs-extra": "^11.2.0",
36
- "hono": "^4.6.17",
37
- "hono-openapi": "^0.4.3",
38
- "superjson": "^2.2.2",
39
- "type-fest": "^4.30.0",
40
28
  "zod": "^3.24.1",
41
- "zod-to-json-schema": "^3.24.1",
42
29
  "@mastra/core": "0.1.27-alpha.70"
43
30
  },
44
31
  "devDependencies": {
45
- "@babel/preset-env": "^7.26.0",
46
- "@babel/preset-typescript": "^7.26.0",
47
- "@tsconfig/recommended": "^1.0.7",
32
+ "@hono/node-server": "^1.13.7",
33
+ "@hono/swagger-ui": "^0.5.0",
48
34
  "@types/fs-extra": "^11.0.4",
49
- "@types/jsdom": "^21.1.7",
50
35
  "@types/node": "^22.9.0",
51
- "@types/pg": "^8.11.10",
52
36
  "concurrently": "^9.1.0",
53
- "dts-cli": "^2.0.5",
54
- "vitest": "^2.1.8"
37
+ "hono": "^4.6.17",
38
+ "hono-openapi": "^0.4.3",
39
+ "superjson": "^2.2.2",
40
+ "tsup": "^8.3.6",
41
+ "type-fest": "^4.30.0",
42
+ "typescript": "^5.7.3",
43
+ "vitest": "^2.1.8",
44
+ "zod-to-json-schema": "^3.24.1"
55
45
  },
56
46
  "scripts": {
57
- "prebuild:app": "esbuild --platform=node --target=node20 --format=esm --bundle --outdir=dist/server src/server/index.ts",
58
- "build": "dts build && pnpm prebuild:app",
59
- "build:dev": "concurrently 'dts watch' 'sleep 5 && pnpm prebuild:app --watch'",
47
+ "build": "npm-run-all --serial build:lib build:server types:server",
48
+ "build:lib": "tsup-node src/index.ts --format esm --clean --dts --treeshake --no-splitting",
49
+ "build:server": "esbuild --platform=node --target=node20 --format=esm --bundle --outdir=dist/server src/server/index.ts",
50
+ "types:server": "tsup src/server/index.ts --no-clean --format esm --dts-only --out-dir=dist/server",
51
+ "dev": "npm-run-all -p dev:lib dev:server dev:types",
52
+ "dev:lib": "pnpm run build:lib --watch --no-clean",
53
+ "dev:server": "esbuild --watch --platform=node --target=node20 --format=esm --bundle --outdir=dist/server src/server/index.ts",
54
+ "dev:types": "pnpm run types:server --watch --no-clean",
60
55
  "pull:openapispec": "node src/server/openapi.script.js",
61
56
  "test": "vitest run"
62
57
  }
package/src/build/deps.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { MastraBase } from '@mastra/core';
2
2
  import fs from 'fs';
3
3
  import path, { dirname } from 'path';
4
- import { PackageJson } from 'type-fest';
4
+ import type { PackageJson } from 'type-fest';
5
5
  import { fileURLToPath } from 'url';
6
6
 
7
7
  import fsExtra from 'fs-extra/esm';
@@ -11,7 +11,7 @@ export class Deployer extends MastraBase {
11
11
  deps: Deps = new Deps();
12
12
  dotMastraPath: string;
13
13
  projectPath: string;
14
- name: string = '';
14
+ override name: string = '';
15
15
  type: 'Deploy' | 'Dev';
16
16
 
17
17
  constructor({ dir, type }: { dir: string; type: 'Deploy' | 'Dev' }) {
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './deploy/index.js';
2
2
  export * from './build/index.js';
3
- export * from './server/index.js';
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
  import { stringify } from 'superjson';
3
3
  import zodToJsonSchema from 'zod-to-json-schema';
4
4
 
@@ -128,7 +128,7 @@ export async function generateHandler(c: Context) {
128
128
  }
129
129
  }
130
130
 
131
- export async function streamGenerateHandler(c: Context) {
131
+ export async function streamGenerateHandler(c: Context): Promise<Response> {
132
132
  try {
133
133
  const mastra = c.get('mastra');
134
134
  const agentId = c.req.param('agentId');
@@ -1,8 +1,8 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  const clients = new Set<ReadableStreamDefaultController>();
4
4
 
5
- export function handleClientsRefresh(c: Context) {
5
+ export function handleClientsRefresh(c: Context): Response {
6
6
  const stream = new ReadableStream({
7
7
  start(controller) {
8
8
  clients.add(controller);
@@ -1,12 +1,12 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  import { HTTPException } from 'hono/http-exception';
4
- import { ContentfulStatusCode } from 'hono/utils/http-status';
4
+ import type { ContentfulStatusCode } from 'hono/utils/http-status';
5
5
 
6
- import { ApiError } from '../types';
6
+ import type { ApiError } from '../types';
7
7
 
8
8
  // Helper to handle errors consistently
9
- export function handleError(error: unknown, defaultMessage: string) {
9
+ export function handleError(error: unknown, defaultMessage: string): Promise<Response> {
10
10
  console.error(defaultMessage, error);
11
11
  const apiError = error as ApiError;
12
12
  throw new HTTPException((apiError.status || 500) as ContentfulStatusCode, {
@@ -19,7 +19,7 @@ export function notFoundHandler() {
19
19
  throw new HTTPException(404, { message: 'Not Found' });
20
20
  }
21
21
 
22
- export function errorHandler(err: Error, c: Context) {
22
+ export function errorHandler(err: Error, c: Context): Response {
23
23
  if (err instanceof HTTPException) {
24
24
  return c.json({ error: err.message }, err.status);
25
25
  }
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  import { handleError } from './error';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  import { HTTPException } from 'hono/http-exception';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  // Root handler
4
4
  export async function rootHandler(c: Context) {
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
 
3
3
  import { handleError } from './error';
4
4
  import { validateBody } from './utils';
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
  import { stringify } from 'superjson';
3
3
  import zodToJsonSchema from 'zod-to-json-schema';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Context } from 'hono';
1
+ import type { Context } from 'hono';
2
2
  import { stringify } from 'superjson';
3
3
  import zodToJsonSchema from 'zod-to-json-schema';
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { serve } from '@hono/node-server';
2
2
  import { serveStatic } from '@hono/node-server/serve-static';
3
3
  import { swaggerUI } from '@hono/swagger-ui';
4
- import { type Mastra } from '@mastra/core';
4
+ import type { Mastra } from '@mastra/core';
5
5
  import { Hono } from 'hono';
6
6
  import { describeRoute, openAPISpecs } from 'hono-openapi';
7
7
  import { join } from 'path';
package/tsconfig.json CHANGED
@@ -1,10 +1,5 @@
1
1
  {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "moduleResolution": "bundler",
5
- "outDir": "./dist",
6
- "rootDir": "./src"
7
- },
2
+ "extends": "../../tsconfig.node.json",
8
3
  "include": ["src/**/*"],
9
4
  "exclude": ["node_modules", "**/*.test.ts"]
10
5
  }