@mastra/client-js 0.11.3-alpha.3 → 0.11.3-alpha.4

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/client.d.ts +12 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/index.cjs +398 -4
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +398 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/resources/agent-builder.d.ts +148 -0
  9. package/dist/resources/agent-builder.d.ts.map +1 -0
  10. package/dist/resources/agent.d.ts +25 -0
  11. package/dist/resources/agent.d.ts.map +1 -1
  12. package/dist/resources/index.d.ts +1 -0
  13. package/dist/resources/index.d.ts.map +1 -1
  14. package/dist/types.d.ts +33 -0
  15. package/dist/types.d.ts.map +1 -1
  16. package/package.json +8 -4
  17. package/.turbo/turbo-build.log +0 -18
  18. package/eslint.config.js +0 -11
  19. package/integration-tests/agui-adapter.test.ts +0 -122
  20. package/integration-tests/package.json +0 -18
  21. package/integration-tests/src/mastra/index.ts +0 -35
  22. package/integration-tests/vitest.config.ts +0 -9
  23. package/src/adapters/agui.test.ts +0 -293
  24. package/src/adapters/agui.ts +0 -257
  25. package/src/client.ts +0 -644
  26. package/src/example.ts +0 -95
  27. package/src/index.test.ts +0 -1253
  28. package/src/index.ts +0 -3
  29. package/src/resources/a2a.ts +0 -98
  30. package/src/resources/agent.ts +0 -1460
  31. package/src/resources/base.ts +0 -77
  32. package/src/resources/index.ts +0 -11
  33. package/src/resources/legacy-workflow.ts +0 -242
  34. package/src/resources/mcp-tool.ts +0 -48
  35. package/src/resources/memory-thread.test.ts +0 -285
  36. package/src/resources/memory-thread.ts +0 -99
  37. package/src/resources/network-memory-thread.test.ts +0 -269
  38. package/src/resources/network-memory-thread.ts +0 -81
  39. package/src/resources/network.ts +0 -86
  40. package/src/resources/observability.ts +0 -53
  41. package/src/resources/tool.ts +0 -45
  42. package/src/resources/vNextNetwork.ts +0 -194
  43. package/src/resources/vector.ts +0 -83
  44. package/src/resources/workflow.ts +0 -410
  45. package/src/types.ts +0 -534
  46. package/src/utils/index.ts +0 -11
  47. package/src/utils/process-client-tools.ts +0 -32
  48. package/src/utils/process-mastra-stream.test.ts +0 -353
  49. package/src/utils/process-mastra-stream.ts +0 -49
  50. package/src/utils/zod-to-json-schema.ts +0 -30
  51. package/src/v2-messages.test.ts +0 -180
  52. package/tsconfig.build.json +0 -9
  53. package/tsconfig.json +0 -5
  54. package/tsup.config.ts +0 -17
  55. package/vitest.config.js +0 -8
@@ -1,353 +0,0 @@
1
- import { ReadableStream } from 'stream/web';
2
- import type { ChunkType } from '@mastra/core/stream';
3
- import { describe, expect, it, vi, beforeEach } from 'vitest';
4
- import { processMastraStream } from './process-mastra-stream';
5
-
6
- describe('processMastraStream', () => {
7
- let mockOnChunk: ReturnType<typeof vi.fn>;
8
-
9
- beforeEach(() => {
10
- mockOnChunk = vi.fn().mockResolvedValue(undefined);
11
- vi.clearAllMocks();
12
- });
13
-
14
- const createMockStream = (data: string): ReadableStream<Uint8Array> => {
15
- return new ReadableStream({
16
- start(controller) {
17
- const encoder = new TextEncoder();
18
- controller.enqueue(encoder.encode(data));
19
- controller.close();
20
- },
21
- });
22
- };
23
-
24
- const createChunkedMockStream = (chunks: string[]): ReadableStream<Uint8Array> => {
25
- let currentIndex = 0;
26
- return new ReadableStream({
27
- start(controller) {
28
- const encoder = new TextEncoder();
29
-
30
- const pushNext = () => {
31
- if (currentIndex < chunks.length) {
32
- controller.enqueue(encoder.encode(chunks[currentIndex]));
33
- currentIndex++;
34
- // Simulate async processing
35
- setTimeout(pushNext, 10);
36
- } else {
37
- controller.close();
38
- }
39
- };
40
-
41
- pushNext();
42
- },
43
- });
44
- };
45
-
46
- it('should process valid SSE messages and call onChunk', async () => {
47
- const testChunk: ChunkType = {
48
- type: 'test',
49
- runId: 'run-123',
50
- from: 'agent',
51
- payload: { message: 'hello' },
52
- };
53
-
54
- const sseData = `data: ${JSON.stringify(testChunk)}\n\n`;
55
- const stream = createMockStream(sseData);
56
-
57
- await processMastraStream({
58
- stream,
59
- onChunk: mockOnChunk,
60
- });
61
-
62
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
63
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
64
- });
65
-
66
- it('should process multiple SSE messages in sequence', async () => {
67
- const testChunk1: ChunkType = {
68
- type: 'message',
69
- runId: 'run-123',
70
- from: 'agent',
71
- payload: { text: 'first message' },
72
- };
73
-
74
- const testChunk2: ChunkType = {
75
- type: 'message',
76
- runId: 'run-123',
77
- from: 'agent',
78
- payload: { text: 'second message' },
79
- };
80
-
81
- const sseData = `data: ${JSON.stringify(testChunk1)}\n\ndata: ${JSON.stringify(testChunk2)}\n\n`;
82
- const stream = createMockStream(sseData);
83
-
84
- await processMastraStream({
85
- stream,
86
- onChunk: mockOnChunk,
87
- });
88
-
89
- expect(mockOnChunk).toHaveBeenCalledTimes(2);
90
- expect(mockOnChunk).toHaveBeenNthCalledWith(1, testChunk1);
91
- expect(mockOnChunk).toHaveBeenNthCalledWith(2, testChunk2);
92
- });
93
-
94
- it('should handle [DONE] marker and terminate stream processing', async () => {
95
- const testChunk: ChunkType = {
96
- type: 'message',
97
- runId: 'run-123',
98
- from: 'agent',
99
- payload: { text: 'message before done' },
100
- };
101
-
102
- const sseData = `data: ${JSON.stringify(testChunk)}\n\ndata: [DONE]\n\n`;
103
- const stream = createMockStream(sseData);
104
-
105
- const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
106
-
107
- await processMastraStream({
108
- stream,
109
- onChunk: mockOnChunk,
110
- });
111
-
112
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
113
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
114
- expect(consoleSpy).toHaveBeenCalledWith('🏁 Stream finished');
115
-
116
- consoleSpy.mockRestore();
117
- });
118
-
119
- it('should handle JSON parsing errors gracefully', async () => {
120
- const invalidJson = 'data: {invalid json}\n\n';
121
- const validChunk: ChunkType = {
122
- type: 'message',
123
- runId: 'run-123',
124
- from: 'agent',
125
- payload: { text: 'valid message' },
126
- };
127
- const validData = `data: ${JSON.stringify(validChunk)}\n\n`;
128
-
129
- const sseData = invalidJson + validData;
130
- const stream = createMockStream(sseData);
131
-
132
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
133
-
134
- await processMastraStream({
135
- stream,
136
- onChunk: mockOnChunk,
137
- });
138
-
139
- // Should have called onChunk only for the valid message
140
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
141
- expect(mockOnChunk).toHaveBeenCalledWith(validChunk);
142
-
143
- // Should have logged the JSON parsing error
144
- expect(consoleErrorSpy).toHaveBeenCalledWith(
145
- '❌ JSON parse error:',
146
- expect.any(SyntaxError),
147
- 'Data:',
148
- '{invalid json}',
149
- );
150
-
151
- consoleErrorSpy.mockRestore();
152
- });
153
-
154
- it('should handle incomplete SSE messages across chunks', async () => {
155
- const testChunk: ChunkType = {
156
- type: 'message',
157
- runId: 'run-123',
158
- from: 'agent',
159
- payload: { text: 'complete message' },
160
- };
161
-
162
- // Split the SSE message across multiple chunks
163
- const chunks = [
164
- 'data: {"type":"message","runId":"run-123"',
165
- ',"from":"agent","payload":{"text":"complete message"}}\n\n',
166
- ];
167
-
168
- const stream = createChunkedMockStream(chunks);
169
-
170
- await processMastraStream({
171
- stream,
172
- onChunk: mockOnChunk,
173
- });
174
-
175
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
176
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
177
- });
178
-
179
- it('should handle empty stream', async () => {
180
- const stream = createMockStream('');
181
-
182
- await processMastraStream({
183
- stream,
184
- onChunk: mockOnChunk,
185
- });
186
-
187
- expect(mockOnChunk).not.toHaveBeenCalled();
188
- });
189
-
190
- it('should ignore non-data lines', async () => {
191
- const testChunk: ChunkType = {
192
- type: 'message',
193
- runId: 'run-123',
194
- from: 'agent',
195
- payload: { text: 'valid message' },
196
- };
197
-
198
- // SSE format: each line ends with \n, and messages are separated by \n\n
199
- const sseData = `event: test-event\nid: 123\n\ndata: ${JSON.stringify(testChunk)}\n\nretry: 5000\n\n`;
200
-
201
- const stream = createMockStream(sseData);
202
-
203
- await processMastraStream({
204
- stream,
205
- onChunk: mockOnChunk,
206
- });
207
-
208
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
209
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
210
- });
211
-
212
- it('should properly clean up stream reader resources', async () => {
213
- const testChunk: ChunkType = {
214
- type: 'message',
215
- runId: 'run-123',
216
- from: 'agent',
217
- payload: { text: 'test message' },
218
- };
219
-
220
- const sseData = `data: ${JSON.stringify(testChunk)}\n\n`;
221
- const stream = createMockStream(sseData);
222
-
223
- // Spy on the reader's releaseLock method
224
- const reader = stream.getReader();
225
- const releaseLockSpy = vi.spyOn(reader, 'releaseLock');
226
- reader.releaseLock(); // Release it so processMastraStream can get it
227
-
228
- await processMastraStream({
229
- stream,
230
- onChunk: mockOnChunk,
231
- });
232
-
233
- // The function should have called releaseLock in the finally block
234
- expect(releaseLockSpy).toHaveBeenCalled();
235
- });
236
-
237
- it('should handle onChunk errors by logging them as JSON parse errors', async () => {
238
- const testChunk: ChunkType = {
239
- type: 'message',
240
- runId: 'run-123',
241
- from: 'agent',
242
- payload: { text: 'first message' },
243
- };
244
-
245
- const sseData = `data: ${JSON.stringify(testChunk)}\n\n`;
246
- const stream = createMockStream(sseData);
247
-
248
- // Make the call to onChunk reject
249
- mockOnChunk.mockRejectedValueOnce(new Error('onChunk error'));
250
-
251
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
252
-
253
- // Should not throw an error but handle it gracefully
254
- await processMastraStream({
255
- stream,
256
- onChunk: mockOnChunk,
257
- });
258
-
259
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
260
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
261
-
262
- // Should log the onChunk error as a JSON parse error
263
- expect(consoleErrorSpy).toHaveBeenCalledWith(
264
- '❌ JSON parse error:',
265
- expect.any(Error),
266
- 'Data:',
267
- JSON.stringify(testChunk),
268
- );
269
-
270
- consoleErrorSpy.mockRestore();
271
- });
272
-
273
- it('should handle stream read errors', async () => {
274
- const errorMessage = 'Stream read error';
275
- const stream = new ReadableStream({
276
- start(controller) {
277
- controller.error(new Error(errorMessage));
278
- },
279
- });
280
-
281
- await expect(
282
- processMastraStream({
283
- stream,
284
- onChunk: mockOnChunk,
285
- }),
286
- ).rejects.toThrow(errorMessage);
287
-
288
- expect(mockOnChunk).not.toHaveBeenCalled();
289
- });
290
-
291
- it('should handle mixed valid and invalid data lines', async () => {
292
- const validChunk1: ChunkType = {
293
- type: 'message',
294
- runId: 'run-123',
295
- from: 'agent',
296
- payload: { text: 'first valid message' },
297
- };
298
-
299
- const validChunk2: ChunkType = {
300
- type: 'message',
301
- runId: 'run-123',
302
- from: 'agent',
303
- payload: { text: 'second valid message' },
304
- };
305
-
306
- const sseData = `data: ${JSON.stringify(validChunk1)}\n\ndata: {invalid json}\n\ndata: ${JSON.stringify(validChunk2)}\n\ndata: [DONE]\n\n`;
307
-
308
- const stream = createMockStream(sseData);
309
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
310
- const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
311
-
312
- await processMastraStream({
313
- stream,
314
- onChunk: mockOnChunk,
315
- });
316
-
317
- expect(mockOnChunk).toHaveBeenCalledTimes(2);
318
- expect(mockOnChunk).toHaveBeenNthCalledWith(1, validChunk1);
319
- expect(mockOnChunk).toHaveBeenNthCalledWith(2, validChunk2);
320
-
321
- expect(consoleErrorSpy).toHaveBeenCalledWith(
322
- '❌ JSON parse error:',
323
- expect.any(SyntaxError),
324
- 'Data:',
325
- '{invalid json}',
326
- );
327
- expect(consoleSpy).toHaveBeenCalledWith('🏁 Stream finished');
328
-
329
- consoleErrorSpy.mockRestore();
330
- consoleSpy.mockRestore();
331
- });
332
-
333
- it('should handle data lines without "data: " prefix', async () => {
334
- const testChunk: ChunkType = {
335
- type: 'message',
336
- runId: 'run-123',
337
- from: 'agent',
338
- payload: { text: 'valid message' },
339
- };
340
-
341
- const sseData = `some random line\n\ndata: ${JSON.stringify(testChunk)}\n\nanother line without prefix\n\n`;
342
-
343
- const stream = createMockStream(sseData);
344
-
345
- await processMastraStream({
346
- stream,
347
- onChunk: mockOnChunk,
348
- });
349
-
350
- expect(mockOnChunk).toHaveBeenCalledTimes(1);
351
- expect(mockOnChunk).toHaveBeenCalledWith(testChunk);
352
- });
353
- });
@@ -1,49 +0,0 @@
1
- import type { ReadableStream } from 'stream/web';
2
- import type { ChunkType } from '@mastra/core/stream';
3
-
4
- export async function processMastraStream({
5
- stream,
6
- onChunk,
7
- }: {
8
- stream: ReadableStream<Uint8Array>;
9
- onChunk: (chunk: ChunkType) => Promise<void>;
10
- }) {
11
- const reader = stream.getReader();
12
- const decoder = new TextDecoder();
13
- let buffer = '';
14
-
15
- try {
16
- while (true) {
17
- const { done, value } = await reader.read();
18
-
19
- if (done) break;
20
-
21
- // Decode the chunk and add to buffer
22
- buffer += decoder.decode(value, { stream: true });
23
-
24
- // Process complete SSE messages
25
- const lines = buffer.split('\n\n');
26
- buffer = lines.pop() || ''; // Keep incomplete line in buffer
27
-
28
- for (const line of lines) {
29
- if (line.startsWith('data: ')) {
30
- const data = line.slice(6); // Remove 'data: '
31
-
32
- if (data === '[DONE]') {
33
- console.log('🏁 Stream finished');
34
- return;
35
- }
36
-
37
- try {
38
- const json = JSON.parse(data);
39
- await onChunk(json);
40
- } catch (error) {
41
- console.error('❌ JSON parse error:', error, 'Data:', data);
42
- }
43
- }
44
- }
45
- }
46
- } finally {
47
- reader.releaseLock();
48
- }
49
- }
@@ -1,30 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ZodType } from 'zod';
3
- import originalZodToJsonSchema from 'zod-to-json-schema';
4
-
5
- function isZodType(value: unknown): value is ZodType {
6
- // Check if it's a Zod schema by looking for common Zod properties and methods
7
- return (
8
- typeof value === 'object' &&
9
- value !== null &&
10
- '_def' in value &&
11
- 'parse' in value &&
12
- typeof (value as any).parse === 'function' &&
13
- 'safeParse' in value &&
14
- typeof (value as any).safeParse === 'function'
15
- );
16
- }
17
-
18
- export function zodToJsonSchema<T extends ZodType | any>(zodSchema: T) {
19
- if (!isZodType(zodSchema)) {
20
- return zodSchema;
21
- }
22
-
23
- if ('toJSONSchema' in z) {
24
- const fn = 'toJSONSchema';
25
- // @ts-expect-error Some nextjs compilation issue
26
- return z[fn].call(z, zodSchema);
27
- }
28
-
29
- return originalZodToJsonSchema(zodSchema, { $refStrategy: 'none' });
30
- }
@@ -1,180 +0,0 @@
1
- import type { MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
2
- import { describe, it, expect, vi, beforeEach } from 'vitest';
3
- import { MastraClient } from './client';
4
-
5
- describe('V2 Message Format Support', () => {
6
- let client: MastraClient;
7
- const agentId = 'test-agent';
8
-
9
- beforeEach(() => {
10
- global.fetch = vi.fn();
11
- client = new MastraClient({
12
- baseUrl: 'http://localhost:3000',
13
- });
14
- });
15
-
16
- it('should send v1 messages successfully', async () => {
17
- const v1Messages: MastraMessageV1[] = [
18
- {
19
- id: 'msg-v1-1',
20
- role: 'user',
21
- content: 'Hello from v1!',
22
- type: 'text',
23
- createdAt: new Date(),
24
- threadId: 'thread-123',
25
- resourceId: 'resource-123',
26
- },
27
- ];
28
-
29
- (global.fetch as any).mockResolvedValueOnce({
30
- ok: true,
31
- json: async () => v1Messages,
32
- });
33
-
34
- const result = await client.saveMessageToMemory({
35
- agentId,
36
- messages: v1Messages,
37
- });
38
-
39
- expect(result).toEqual(v1Messages);
40
- expect(global.fetch).toHaveBeenCalledWith(
41
- expect.stringContaining('/api/memory/save-messages'),
42
- expect.objectContaining({
43
- method: 'POST',
44
- body: JSON.stringify({ agentId, messages: v1Messages }),
45
- }),
46
- );
47
- });
48
-
49
- it('should send v2 messages successfully', async () => {
50
- const v2Messages: MastraMessageV2[] = [
51
- {
52
- id: 'msg-v2-1',
53
- role: 'assistant',
54
- createdAt: new Date(),
55
- threadId: 'thread-123',
56
- resourceId: 'resource-123',
57
- content: {
58
- format: 2,
59
- parts: [{ type: 'text', text: 'Hello from v2!' }],
60
- content: 'Hello from v2!',
61
- },
62
- },
63
- ];
64
-
65
- (global.fetch as any).mockResolvedValueOnce({
66
- ok: true,
67
- json: async () => v2Messages,
68
- });
69
-
70
- const result = await client.saveMessageToMemory({
71
- agentId,
72
- messages: v2Messages,
73
- });
74
-
75
- expect(result).toEqual(v2Messages);
76
- expect(global.fetch).toHaveBeenCalledWith(
77
- expect.stringContaining('/api/memory/save-messages'),
78
- expect.objectContaining({
79
- method: 'POST',
80
- body: JSON.stringify({ agentId, messages: v2Messages }),
81
- }),
82
- );
83
- });
84
-
85
- it('should send mixed v1 and v2 messages successfully', async () => {
86
- const mixedMessages: (MastraMessageV1 | MastraMessageV2)[] = [
87
- {
88
- id: 'msg-v1-1',
89
- role: 'user',
90
- content: 'Question in v1 format',
91
- type: 'text',
92
- createdAt: new Date(),
93
- threadId: 'thread-123',
94
- resourceId: 'resource-123',
95
- },
96
- {
97
- id: 'msg-v2-1',
98
- role: 'assistant',
99
- createdAt: new Date(),
100
- threadId: 'thread-123',
101
- resourceId: 'resource-123',
102
- content: {
103
- format: 2,
104
- parts: [
105
- { type: 'text', text: 'Answer in v2 format' },
106
- {
107
- type: 'tool-invocation',
108
- toolInvocation: {
109
- state: 'result' as const,
110
- toolCallId: 'call-123',
111
- toolName: 'calculator',
112
- args: { a: 1, b: 2 },
113
- result: '3',
114
- },
115
- },
116
- ],
117
- toolInvocations: [
118
- {
119
- state: 'result' as const,
120
- toolCallId: 'call-123',
121
- toolName: 'calculator',
122
- args: { a: 1, b: 2 },
123
- result: '3',
124
- },
125
- ],
126
- },
127
- },
128
- ];
129
-
130
- (global.fetch as any).mockResolvedValueOnce({
131
- ok: true,
132
- json: async () => mixedMessages,
133
- });
134
-
135
- const result = await client.saveMessageToMemory({
136
- agentId,
137
- messages: mixedMessages,
138
- });
139
-
140
- expect(result).toEqual(mixedMessages);
141
- expect(global.fetch).toHaveBeenCalledWith(
142
- expect.stringContaining('/api/memory/save-messages'),
143
- expect.objectContaining({
144
- method: 'POST',
145
- body: JSON.stringify({ agentId, messages: mixedMessages }),
146
- }),
147
- );
148
- });
149
-
150
- it('should handle v2 messages with attachments', async () => {
151
- const v2MessageWithAttachments: MastraMessageV2 = {
152
- id: 'msg-v2-att',
153
- role: 'user',
154
- createdAt: new Date(),
155
- threadId: 'thread-123',
156
- resourceId: 'resource-123',
157
- content: {
158
- format: 2,
159
- parts: [
160
- { type: 'text', text: 'Check out this image:' },
161
- { type: 'file', data: 'data:image/png;base64,iVBORw0...', mimeType: 'image/png' },
162
- ],
163
- experimental_attachments: [{ url: 'data:image/png;base64,iVBORw0...', contentType: 'image/png' }],
164
- },
165
- };
166
-
167
- (global.fetch as any).mockResolvedValueOnce({
168
- ok: true,
169
- json: async () => [v2MessageWithAttachments],
170
- });
171
-
172
- const result = await client.saveMessageToMemory({
173
- agentId,
174
- messages: [v2MessageWithAttachments],
175
- });
176
-
177
- expect(result).toHaveLength(1);
178
- expect(result[0]).toEqual(v2MessageWithAttachments);
179
- });
180
- });
@@ -1,9 +0,0 @@
1
- {
2
- "extends": ["./tsconfig.json", "../../tsconfig.build.json"],
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*"],
8
- "exclude": ["node_modules", "**/*.test.ts", "src/**/*.mock.ts"]
9
- }
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*", "tsup.config.ts", "integration-tests/**/*"],
4
- "exclude": ["node_modules", "integration-tests/node_modules", "src/example.ts", "**/*.test.ts"]
5
- }
package/tsup.config.ts DELETED
@@ -1,17 +0,0 @@
1
- import { generateTypes } from '@internal/types-builder';
2
- import { defineConfig } from 'tsup';
3
-
4
- export default defineConfig({
5
- entry: ['src/index.ts'],
6
- format: ['esm', 'cjs'],
7
- clean: true,
8
- dts: false,
9
- splitting: true,
10
- treeshake: {
11
- preset: 'smallest',
12
- },
13
- sourcemap: true,
14
- onSuccess: async () => {
15
- await generateTypes(process.cwd());
16
- },
17
- });
package/vitest.config.js DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'node',
6
- include: ['src/**/*.test.ts'],
7
- },
8
- });