@lovable.dev/email-js 0.1.1-rc.4 → 0.1.1-rc.5

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/index.js CHANGED
@@ -1,251 +1,308 @@
1
- import { WebhookError, verifyWebhookRequest } from "@lovable.dev/webhooks-js";
1
+ // src/auth-email-handler.ts
2
+ import { WebhookError as WebhookError2, verifyWebhookRequest as verifyWebhookRequest2 } from "@lovable.dev/webhooks-js";
3
+
4
+ // src/http.ts
5
+ var DEFAULT_AUTH_HEADER = "Authorization";
6
+ var DEFAULT_API_BASE_URL = "https://api.lovable.dev";
2
7
  function resolveApiBaseUrl(apiBaseUrl) {
3
- return (apiBaseUrl ?? "https://api.lovable.dev").replace(/\/$/, "");
8
+ return (apiBaseUrl ?? DEFAULT_API_BASE_URL).replace(/\/$/, "");
4
9
  }
5
10
  var EmailAPIError = class extends Error {
6
- constructor(status, message, retryAfterSeconds, code = null) {
7
- super(message);
8
- this.name = "EmailAPIError";
9
- this.status = status;
10
- this.retryAfterSeconds = retryAfterSeconds;
11
- this.code = code;
12
- }
13
- get retryable() {
14
- return this.status === 429 || this.status >= 500 && this.status < 600;
15
- }
11
+ constructor(status, message, retryAfterSeconds, code = null) {
12
+ super(message);
13
+ this.name = "EmailAPIError";
14
+ this.status = status;
15
+ this.retryAfterSeconds = retryAfterSeconds;
16
+ this.code = code;
17
+ }
18
+ get retryable() {
19
+ return this.status === 429 || this.status >= 500 && this.status < 600;
20
+ }
16
21
  };
17
22
  function parseRetryAfter(header) {
18
- if (!header) return null;
19
- const parsed = Number(header);
20
- if (!Number.isNaN(parsed)) return parsed;
21
- const date = new Date(header);
22
- if (!Number.isNaN(date.getTime())) return Math.max(0, Math.ceil((date.getTime() - Date.now()) / 1e3));
23
- return null;
23
+ if (!header)
24
+ return null;
25
+ const parsed = Number(header);
26
+ if (!Number.isNaN(parsed))
27
+ return parsed;
28
+ const date = new Date(header);
29
+ if (!Number.isNaN(date.getTime())) {
30
+ return Math.max(0, Math.ceil((date.getTime() - Date.now()) / 1e3));
31
+ }
32
+ return null;
24
33
  }
25
34
  function buildAuthHeaderValue(apiKey) {
26
- return `Bearer ${apiKey}`;
35
+ return `Bearer ${apiKey}`;
27
36
  }
28
37
  function parseErrorCode(body) {
29
- try {
30
- const parsed = JSON.parse(body);
31
- if (parsed && typeof parsed === "object" && "type" in parsed && typeof parsed.type === "string") return parsed.type;
32
- } catch {
33
- return null;
34
- }
35
- return null;
38
+ try {
39
+ const parsed = JSON.parse(body);
40
+ if (parsed && typeof parsed === "object" && "type" in parsed && typeof parsed.type === "string") {
41
+ return parsed.type;
42
+ }
43
+ } catch {
44
+ return null;
45
+ }
46
+ return null;
36
47
  }
37
48
  async function throwIfNotOk(response) {
38
- if (response.ok) return;
39
- const errorText = await response.text();
40
- const safeErrorText = errorText.length > 500 ? `${errorText.slice(0, 500)}...` : errorText;
41
- const retryAfterSeconds = parseRetryAfter(response.headers.get("Retry-After"));
42
- const code = parseErrorCode(errorText);
43
- if (response.status === 429) console.error("[email-js] rate limited:", {
44
- status: response.status,
45
- code,
46
- retryAfterSeconds
47
- });
48
- throw new EmailAPIError(response.status, `Email API error: ${response.status} ${safeErrorText}`, retryAfterSeconds, code);
49
+ if (response.ok)
50
+ return;
51
+ const errorText = await response.text();
52
+ const safeErrorText = errorText.length > 500 ? `${errorText.slice(0, 500)}...` : errorText;
53
+ const retryAfterSeconds = parseRetryAfter(response.headers.get("Retry-After"));
54
+ const code = parseErrorCode(errorText);
55
+ if (response.status === 429) {
56
+ console.error("[email-js] rate limited:", { status: response.status, code, retryAfterSeconds });
57
+ }
58
+ throw new EmailAPIError(
59
+ response.status,
60
+ `Email API error: ${response.status} ${safeErrorText}`,
61
+ retryAfterSeconds,
62
+ code
63
+ );
49
64
  }
50
65
  async function emailApiRequest(options, path, init = { method: "GET" }) {
51
- if (!options.apiKey) throw new Error("Missing Lovable API key");
52
- const headers = { [options.authHeader ?? "Authorization"]: buildAuthHeaderValue(options.apiKey) };
53
- if (init.body !== void 0) headers["Content-Type"] = "application/json";
54
- const response = await fetch(`${resolveApiBaseUrl(options.apiBaseUrl)}${path}`, {
55
- method: init.method,
56
- headers,
57
- body: init.body === void 0 ? void 0 : JSON.stringify(init.body)
58
- });
59
- await throwIfNotOk(response);
60
- return await response.json();
61
- }
62
- //#endregion
63
- //#region src/email.ts
64
- const DEFAULT_SEND_PATH = "/v1/messaging/email/send";
66
+ if (!options.apiKey) {
67
+ throw new Error("Missing Lovable API key");
68
+ }
69
+ const headers = {
70
+ [options.authHeader ?? DEFAULT_AUTH_HEADER]: buildAuthHeaderValue(options.apiKey)
71
+ };
72
+ if (init.body !== void 0) {
73
+ headers["Content-Type"] = "application/json";
74
+ }
75
+ const response = await fetch(`${resolveApiBaseUrl(options.apiBaseUrl)}${path}`, {
76
+ method: init.method,
77
+ headers,
78
+ body: init.body === void 0 ? void 0 : JSON.stringify(init.body)
79
+ });
80
+ await throwIfNotOk(response);
81
+ return await response.json();
82
+ }
83
+
84
+ // src/email.ts
85
+ var DEFAULT_SEND_PATH = "/v1/messaging/email/send";
65
86
  async function sendLovableEmail(payload, options) {
66
- const apiKey = options.apiKey;
67
- if (!apiKey) throw new Error("Missing Lovable API key");
68
- const authHeader = options.authHeader ?? "Authorization";
69
- const url = options.sendUrl || `${resolveApiBaseUrl(options.apiBaseUrl)}${DEFAULT_SEND_PATH}`;
70
- const idempotencyKey = options.idempotencyKey ?? payload.idempotency_key ?? payload.run_id;
71
- const headers = {
72
- [authHeader]: buildAuthHeaderValue(apiKey),
73
- "Content-Type": "application/json"
74
- };
75
- if (idempotencyKey) headers["Idempotency-Key"] = idempotencyKey;
76
- const response = await fetch(url, {
77
- method: "POST",
78
- headers,
79
- body: JSON.stringify(payload)
80
- });
81
- await throwIfNotOk(response);
82
- return await response.json();
83
- }
84
- //#endregion
85
- //#region src/webhook.ts
87
+ const apiKey = options.apiKey;
88
+ if (!apiKey) {
89
+ throw new Error("Missing Lovable API key");
90
+ }
91
+ const authHeader = options.authHeader ?? DEFAULT_AUTH_HEADER;
92
+ const sendUrl = options.sendUrl;
93
+ const url = sendUrl || `${resolveApiBaseUrl(options.apiBaseUrl)}${DEFAULT_SEND_PATH}`;
94
+ const idempotencyKey = options.idempotencyKey ?? payload.idempotency_key ?? payload.run_id;
95
+ const headers = {
96
+ [authHeader]: buildAuthHeaderValue(apiKey),
97
+ "Content-Type": "application/json"
98
+ };
99
+ if (idempotencyKey) {
100
+ headers["Idempotency-Key"] = idempotencyKey;
101
+ }
102
+ const response = await fetch(url, {
103
+ method: "POST",
104
+ headers,
105
+ body: JSON.stringify(payload)
106
+ });
107
+ await throwIfNotOk(response);
108
+ return await response.json();
109
+ }
110
+
111
+ // src/webhook-handler.ts
112
+ import { WebhookError, verifyWebhookRequest } from "@lovable.dev/webhooks-js";
113
+
114
+ // src/webhook.ts
86
115
  function parseEmailWebhookPayload(body) {
87
- const parsed = JSON.parse(body);
88
- if (!parsed || typeof parsed !== "object") throw new Error("Invalid email webhook payload: missing version or type");
89
- const payload = parsed;
90
- if (typeof payload.version !== "string" || typeof payload.type !== "string") throw new Error("Invalid email webhook payload: missing version or type");
91
- return payload;
92
- }
93
- //#endregion
94
- //#region src/webhook-handler.ts
95
- const WEBHOOK_ERROR_STATUS = {
96
- missing_secret: 401,
97
- missing_timestamp: 401,
98
- invalid_timestamp: 401,
99
- stale_timestamp: 401,
100
- invalid_signature: 401,
101
- body_too_large: 400,
102
- invalid_json: 400,
103
- invalid_payload: 400
116
+ const parsed = JSON.parse(body);
117
+ if (!parsed || typeof parsed !== "object") {
118
+ throw new Error("Invalid email webhook payload: missing version or type");
119
+ }
120
+ const payload = parsed;
121
+ if (typeof payload.version !== "string" || typeof payload.type !== "string") {
122
+ throw new Error("Invalid email webhook payload: missing version or type");
123
+ }
124
+ return payload;
125
+ }
126
+
127
+ // src/webhook-handler.ts
128
+ var WEBHOOK_ERROR_STATUS = {
129
+ missing_secret: 401,
130
+ missing_timestamp: 401,
131
+ invalid_timestamp: 401,
132
+ stale_timestamp: 401,
133
+ invalid_signature: 401,
134
+ body_too_large: 400,
135
+ invalid_json: 400,
136
+ invalid_payload: 400
104
137
  };
105
138
  function parseEmailWebhookEvent(body) {
106
- return parseEmailWebhookPayload(body);
139
+ return parseEmailWebhookPayload(body);
107
140
  }
108
141
  function createEmailWebhookHandler(options) {
109
- const { apiKey, on } = options;
110
- if (!apiKey) throw new Error("Missing Lovable API key");
111
- return async (req) => {
112
- if (req.method !== "POST") return Response.json({ error: "Method not allowed" }, {
113
- status: 405,
114
- headers: { Allow: "POST" }
115
- });
116
- let event;
117
- try {
118
- ({payload: event} = await verifyWebhookRequest({
119
- req,
120
- secret: apiKey,
121
- parser: parseEmailWebhookEvent
122
- }));
123
- } catch (error) {
124
- if (error instanceof WebhookError) return Response.json({ error: error.message }, { status: WEBHOOK_ERROR_STATUS[error.code] });
125
- console.error("[email-js] webhook verification failed:", error);
126
- return Response.json({ error: "Webhook verification failed" }, { status: 500 });
127
- }
128
- if (event.version !== "1") return Response.json({ received: true });
129
- const handler = on[event.type];
130
- if (handler) try {
131
- await handler(event);
132
- } catch (error) {
133
- console.error("[email-js] webhook handler failed:", error);
134
- return Response.json({ error: "Handler failed" }, { status: 500 });
135
- }
136
- return Response.json({ received: true });
137
- };
138
- }
139
- //#endregion
140
- //#region src/auth-email-handler.ts
142
+ const { apiKey, on } = options;
143
+ if (!apiKey) {
144
+ throw new Error("Missing Lovable API key");
145
+ }
146
+ return async (req) => {
147
+ if (req.method !== "POST") {
148
+ return Response.json({ error: "Method not allowed" }, { status: 405, headers: { Allow: "POST" } });
149
+ }
150
+ let event;
151
+ try {
152
+ ({ payload: event } = await verifyWebhookRequest({ req, secret: apiKey, parser: parseEmailWebhookEvent }));
153
+ } catch (error) {
154
+ if (error instanceof WebhookError) {
155
+ return Response.json({ error: error.message }, { status: WEBHOOK_ERROR_STATUS[error.code] });
156
+ }
157
+ console.error("[email-js] webhook verification failed:", error);
158
+ return Response.json({ error: "Webhook verification failed" }, { status: 500 });
159
+ }
160
+ if (event.version !== "1") {
161
+ return Response.json({ received: true });
162
+ }
163
+ const handler = on[event.type];
164
+ if (handler) {
165
+ try {
166
+ await handler(event);
167
+ } catch (error) {
168
+ console.error("[email-js] webhook handler failed:", error);
169
+ return Response.json({ error: "Handler failed" }, { status: 500 });
170
+ }
171
+ }
172
+ return Response.json({ received: true });
173
+ };
174
+ }
175
+
176
+ // src/auth-email-handler.ts
141
177
  function parseAuthEmailWebhookPayload(body) {
142
- const parsed = JSON.parse(body);
143
- const payload = parsed;
144
- if (!parsed || typeof parsed !== "object" || typeof payload.version !== "string" || payload.type !== "auth" || !payload.data || typeof payload.data !== "object" || typeof payload.data.action_type !== "string" || typeof payload.data.email !== "string") throw new Error("Invalid auth email webhook payload");
145
- return payload;
178
+ const parsed = JSON.parse(body);
179
+ const payload = parsed;
180
+ if (!parsed || typeof parsed !== "object" || typeof payload.version !== "string" || payload.type !== "auth" || !payload.data || typeof payload.data !== "object" || typeof payload.data.action_type !== "string" || typeof payload.data.email !== "string") {
181
+ throw new Error("Invalid auth email webhook payload");
182
+ }
183
+ return payload;
146
184
  }
147
185
  function domainOfAddress(from) {
148
- return /@([^@\s<>]+)>?\s*$/.exec(from.trim())?.[1];
186
+ const match = /@([^@\s<>]+)>?\s*$/.exec(from.trim());
187
+ return match?.[1];
149
188
  }
150
189
  function createAuthEmailHandler(options) {
151
- const { apiKey, from, emails } = options;
152
- if (!apiKey) throw new Error("Missing Lovable API key");
153
- const senderDomain = options.senderDomain ?? domainOfAddress(from);
154
- if (!senderDomain) throw new Error(`Cannot derive a sender domain from "${from}"; pass senderDomain`);
155
- return async (req) => {
156
- if (req.method !== "POST") return Response.json({ error: "Method not allowed" }, {
157
- status: 405,
158
- headers: { Allow: "POST" }
159
- });
160
- let event;
161
- try {
162
- ({payload: event} = await verifyWebhookRequest({
163
- req,
164
- secret: apiKey,
165
- parser: parseAuthEmailWebhookPayload
166
- }));
167
- } catch (error) {
168
- if (error instanceof WebhookError) return Response.json({ error: error.message }, { status: WEBHOOK_ERROR_STATUS[error.code] });
169
- console.error("[email-js] auth webhook verification failed:", error);
170
- return Response.json({ error: "Webhook verification failed" }, { status: 500 });
171
- }
172
- if (!event.run_id) return Response.json({ error: "Missing run_id" }, { status: 400 });
173
- if (event.version !== "1") return Response.json({ error: `Unsupported payload version: ${event.version}` }, { status: 400 });
174
- const actionType = event.data.action_type;
175
- const definition = Object.prototype.hasOwnProperty.call(emails, actionType) ? emails[actionType] : void 0;
176
- if (!definition) return Response.json({ error: `Unknown auth email action type: ${actionType}` }, { status: 400 });
177
- try {
178
- const { render } = await import("@react-email/render");
179
- const { subject, element } = typeof definition === "function" ? await definition(event.data) : {
180
- subject: definition.subject,
181
- element: await definition.render(event.data)
182
- };
183
- const html = await render(element);
184
- const text = await render(element, { plainText: true });
185
- await sendLovableEmail({
186
- run_id: event.run_id,
187
- to: event.data.email,
188
- from,
189
- sender_domain: senderDomain,
190
- subject,
191
- html,
192
- text,
193
- purpose: "transactional",
194
- label: actionType
195
- }, {
196
- apiKey,
197
- sendUrl: options.sendUrl
198
- });
199
- } catch (error) {
200
- console.error("[email-js] auth email send failed:", error);
201
- if (error instanceof EmailAPIError && !error.retryable) return Response.json({ error: "Email send rejected" }, { status: 400 });
202
- return Response.json({ error: "Failed to send email" }, { status: 500 });
203
- }
204
- return Response.json({
205
- success: true,
206
- sent: true
207
- });
208
- };
209
- }
210
- //#endregion
211
- //#region src/logs.ts
212
- const LOGS_PATH = "/v1/messaging/email/logs";
190
+ const { apiKey, from, emails } = options;
191
+ if (!apiKey) {
192
+ throw new Error("Missing Lovable API key");
193
+ }
194
+ const senderDomain = options.senderDomain ?? domainOfAddress(from);
195
+ if (!senderDomain) {
196
+ throw new Error(`Cannot derive a sender domain from "${from}"; pass senderDomain`);
197
+ }
198
+ return async (req) => {
199
+ if (req.method !== "POST") {
200
+ return Response.json({ error: "Method not allowed" }, { status: 405, headers: { Allow: "POST" } });
201
+ }
202
+ let event;
203
+ try {
204
+ ({ payload: event } = await verifyWebhookRequest2({ req, secret: apiKey, parser: parseAuthEmailWebhookPayload }));
205
+ } catch (error) {
206
+ if (error instanceof WebhookError2) {
207
+ return Response.json({ error: error.message }, { status: WEBHOOK_ERROR_STATUS[error.code] });
208
+ }
209
+ console.error("[email-js] auth webhook verification failed:", error);
210
+ return Response.json({ error: "Webhook verification failed" }, { status: 500 });
211
+ }
212
+ if (!event.run_id) {
213
+ return Response.json({ error: "Missing run_id" }, { status: 400 });
214
+ }
215
+ if (event.version !== "1") {
216
+ return Response.json({ error: `Unsupported payload version: ${event.version}` }, { status: 400 });
217
+ }
218
+ const actionType = event.data.action_type;
219
+ const definition = Object.prototype.hasOwnProperty.call(emails, actionType) ? emails[actionType] : void 0;
220
+ if (!definition) {
221
+ return Response.json({ error: `Unknown auth email action type: ${actionType}` }, { status: 400 });
222
+ }
223
+ try {
224
+ const { render } = await import("@react-email/render");
225
+ const { subject, element } = typeof definition === "function" ? await definition(event.data) : { subject: definition.subject, element: await definition.render(event.data) };
226
+ const html = await render(element);
227
+ const text = await render(element, { plainText: true });
228
+ await sendLovableEmail(
229
+ {
230
+ run_id: event.run_id,
231
+ to: event.data.email,
232
+ from,
233
+ sender_domain: senderDomain,
234
+ subject,
235
+ html,
236
+ text,
237
+ purpose: "transactional",
238
+ label: actionType
239
+ },
240
+ { apiKey, sendUrl: options.sendUrl }
241
+ );
242
+ } catch (error) {
243
+ console.error("[email-js] auth email send failed:", error);
244
+ if (error instanceof EmailAPIError && !error.retryable) {
245
+ return Response.json({ error: "Email send rejected" }, { status: 400 });
246
+ }
247
+ return Response.json({ error: "Failed to send email" }, { status: 500 });
248
+ }
249
+ return Response.json({ success: true, sent: true });
250
+ };
251
+ }
252
+
253
+ // src/logs.ts
254
+ var LOGS_PATH = "/v1/messaging/email/logs";
213
255
  function buildLogsQuery(filters) {
214
- const params = new URLSearchParams();
215
- if (filters.recipient) params.set("recipient", filters.recipient);
216
- if (filters.event_type) params.set("event_type", filters.event_type);
217
- if (filters.status) params.set("status", filters.status);
218
- if (filters.tag) params.set("tag", filters.tag);
219
- if (filters.since) params.set("since", filters.since);
220
- if (filters.until) params.set("until", filters.until);
221
- if (filters.limit !== void 0) params.set("limit", String(filters.limit));
222
- if (filters.cursor) params.set("cursor", filters.cursor);
223
- const query = params.toString();
224
- return query ? `?${query}` : "";
256
+ const params = new URLSearchParams();
257
+ if (filters.recipient)
258
+ params.set("recipient", filters.recipient);
259
+ if (filters.event_type)
260
+ params.set("event_type", filters.event_type);
261
+ if (filters.status)
262
+ params.set("status", filters.status);
263
+ if (filters.tag)
264
+ params.set("tag", filters.tag);
265
+ if (filters.since)
266
+ params.set("since", filters.since);
267
+ if (filters.until)
268
+ params.set("until", filters.until);
269
+ if (filters.limit !== void 0)
270
+ params.set("limit", String(filters.limit));
271
+ if (filters.cursor)
272
+ params.set("cursor", filters.cursor);
273
+ const query = params.toString();
274
+ return query ? `?${query}` : "";
225
275
  }
226
276
  async function listEmailLogs(filters, options) {
227
- const body = await emailApiRequest(options, `${LOGS_PATH}${buildLogsQuery(filters)}`);
228
- return {
229
- ...body,
230
- data: body.data ?? []
231
- };
232
- }
233
- //#endregion
234
- //#region src/unsubscribe.ts
235
- const UNSUBSCRIBES_PATH = "/v1/messaging/email/unsubscribes";
277
+ const body = await emailApiRequest(options, `${LOGS_PATH}${buildLogsQuery(filters)}`);
278
+ return { ...body, data: body.data ?? [] };
279
+ }
280
+
281
+ // src/unsubscribe.ts
282
+ var UNSUBSCRIBES_PATH = "/v1/messaging/email/unsubscribes";
236
283
  function buildUnsubscribePath(recipient, domain) {
237
- if (!recipient.includes("@")) throw new Error("Invalid recipient");
238
- const query = new URLSearchParams({ domain }).toString();
239
- return `${UNSUBSCRIBES_PATH}/${encodeURIComponent(recipient)}?${query}`;
284
+ if (!recipient.includes("@")) {
285
+ throw new Error("Invalid recipient");
286
+ }
287
+ const query = new URLSearchParams({ domain }).toString();
288
+ return `${UNSUBSCRIBES_PATH}/${encodeURIComponent(recipient)}?${query}`;
240
289
  }
241
290
  async function getEmailUnsubscribe(request, options) {
242
- return emailApiRequest(options, buildUnsubscribePath(request.recipient, request.domain));
291
+ return emailApiRequest(options, buildUnsubscribePath(request.recipient, request.domain));
243
292
  }
244
293
  async function setEmailUnsubscribe(request, options) {
245
- return emailApiRequest(options, buildUnsubscribePath(request.recipient, request.domain), {
246
- method: "PUT",
247
- body: { subscribed: request.subscribed }
248
- });
294
+ return emailApiRequest(options, buildUnsubscribePath(request.recipient, request.domain), {
295
+ method: "PUT",
296
+ body: { subscribed: request.subscribed }
297
+ });
249
298
  }
250
- //#endregion
251
- export { EmailAPIError, createAuthEmailHandler, createEmailWebhookHandler, getEmailUnsubscribe, listEmailLogs, parseEmailWebhookPayload, sendLovableEmail, setEmailUnsubscribe };
299
+ export {
300
+ EmailAPIError,
301
+ createAuthEmailHandler,
302
+ createEmailWebhookHandler,
303
+ getEmailUnsubscribe,
304
+ listEmailLogs,
305
+ parseEmailWebhookPayload,
306
+ sendLovableEmail,
307
+ setEmailUnsubscribe
308
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/email-js",
3
- "version": "0.1.1-rc.4",
3
+ "version": "0.1.1-rc.5",
4
4
  "description": "Lovable Email JS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,14 +46,15 @@
46
46
  "react": "^19.0.0",
47
47
  "react-dom": "^19.0.0",
48
48
  "rimraf": "^5.0.0",
49
- "tsdown": "^0.22.5",
49
+ "tsup": "^7.2.0",
50
50
  "typescript": "^5",
51
51
  "vitest": "^4.1.5",
52
52
  "@lovable/api-utils": "1.0.0"
53
53
  },
54
54
  "scripts": {
55
- "build": "tsdown",
56
- "dev": "tsdown --watch",
55
+ "build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
56
+ "check:package": "tmp=$(mktemp -d) && pnpm pack --out \"$tmp/pkg.tgz\" && tar -xzf \"$tmp/pkg.tgz\" -C \"$tmp\" && publint \"$tmp/package\" --strict && attw \"$tmp/pkg.tgz\"",
57
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
57
58
  "test": "vitest run",
58
59
  "clean": "rimraf dist",
59
60
  "typecheck": "tsgo --noEmit"