workers-start 0.8.0 → 0.10.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/mail.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * One way to send mail from a Worker, over Cloudflare Email Sending (the
3
+ * `send_email` binding) or Resend, with a recording fake for tests. Every
4
+ * message carries both a plain text and an HTML body: some clients show only
5
+ * one, and a message with only HTML scores worse with spam filters.
6
+ */
7
+ export type MailAddress = string | {
8
+ email: string;
9
+ name?: string;
10
+ };
11
+ export interface MailAttachment {
12
+ filename: string;
13
+ /** Base64. */
14
+ content: string;
15
+ contentType?: string;
16
+ }
17
+ export interface MailMessage {
18
+ from: MailAddress;
19
+ to: string | string[];
20
+ subject: string;
21
+ text: string;
22
+ html: string;
23
+ replyTo?: MailAddress;
24
+ /** Extra headers, such as `In-Reply-To`. */
25
+ headers?: Record<string, string>;
26
+ /** Adds `List-Unsubscribe` and one-click `List-Unsubscribe-Post`, for bulk and marketing mail. */
27
+ listUnsubscribeUrl?: string;
28
+ /** Resend only: repeating a send with the same key within 24 hours sends once. */
29
+ idempotencyKey?: string;
30
+ attachments?: MailAttachment[];
31
+ }
32
+ export interface MailResult {
33
+ /** The provider's message id. */
34
+ id?: string;
35
+ }
36
+ export interface Mailer {
37
+ send(message: MailMessage): Promise<MailResult>;
38
+ }
39
+ /** A send that failed. `permanent` is true when repeating it cannot help (a 4xx other than 409 and 429). */
40
+ export declare class MailError extends Error {
41
+ readonly status?: number | undefined;
42
+ readonly body?: unknown;
43
+ readonly name = "MailError";
44
+ constructor(message: string, status?: number | undefined, body?: unknown);
45
+ get permanent(): boolean;
46
+ }
47
+ /** Throws unless the message has recipients, a subject and both bodies. */
48
+ export declare function checkMessage(message: MailMessage): void;
49
+ /** The `send_email` binding, structurally, so this module needs no Workers types. */
50
+ export interface SendEmailBinding {
51
+ send(message: any): Promise<{
52
+ messageId?: string;
53
+ } | undefined | void>;
54
+ }
55
+ /** Sends through Cloudflare Email Sending. Senders and recipients must be allowed in the binding's wrangler config. */
56
+ export declare function cloudflareMailer(binding: SendEmailBinding): Mailer;
57
+ export interface ResendOptions {
58
+ apiKey: string | undefined;
59
+ fetch?: (url: string, init?: RequestInit) => Promise<Response>;
60
+ /** Default 10 seconds. */
61
+ timeoutMs?: number;
62
+ }
63
+ /** Sends through the Resend API with `fetch`, no SDK. */
64
+ export declare function resendMailer(options: ResendOptions): Mailer;
65
+ /** A mailer that records what it would send, for tests. It applies the same checks as the real ones. */
66
+ export declare function recordingMailer(): Mailer & {
67
+ sent: MailMessage[];
68
+ };
69
+ /** Escapes text for an HTML body. */
70
+ export declare function escapeHtml(text: string): string;
71
+ //# sourceMappingURL=mail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kGAAkG;IAClG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,cAAc,CAAC,EAAE,MA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Ae,IAAI,MAAM,GAAG;IAAE,IAAI,EAAE,WAAW,EAAE,CAAA;CAAE,CAUlE;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/C"}
package/dist/mail.js ADDED
@@ -0,0 +1,157 @@
1
+ /**
2
+ * One way to send mail from a Worker, over Cloudflare Email Sending (the
3
+ * `send_email` binding) or Resend, with a recording fake for tests. Every
4
+ * message carries both a plain text and an HTML body: some clients show only
5
+ * one, and a message with only HTML scores worse with spam filters.
6
+ */
7
+ /** A send that failed. `permanent` is true when repeating it cannot help (a 4xx other than 409 and 429). */
8
+ export class MailError extends Error {
9
+ status;
10
+ body;
11
+ name = "MailError";
12
+ constructor(message, status, body) {
13
+ super(message);
14
+ this.status = status;
15
+ this.body = body;
16
+ }
17
+ get permanent() {
18
+ return (this.status !== undefined &&
19
+ this.status >= 400 &&
20
+ this.status < 500 &&
21
+ this.status !== 409 &&
22
+ this.status !== 429);
23
+ }
24
+ }
25
+ /** Throws unless the message has recipients, a subject and both bodies. */
26
+ export function checkMessage(message) {
27
+ const to = Array.isArray(message.to) ? message.to : [message.to];
28
+ if (to.length === 0 || to.some((t) => !t.trim()))
29
+ throw new MailError("A message needs at least one recipient.");
30
+ if (!message.subject.trim())
31
+ throw new MailError("A message needs a subject.");
32
+ if (!message.text.trim() || !message.html.trim())
33
+ throw new MailError("A message needs both a text and an HTML body.");
34
+ }
35
+ function headersFor(message) {
36
+ const headers = { ...message.headers };
37
+ if (message.listUnsubscribeUrl) {
38
+ headers["List-Unsubscribe"] = `<${message.listUnsubscribeUrl}>`;
39
+ headers["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click";
40
+ }
41
+ return headers;
42
+ }
43
+ const formatAddress = (a) => typeof a === "string"
44
+ ? a
45
+ : a.name
46
+ ? `${a.name.replace(/["\\]/g, "")} <${a.email}>`
47
+ : a.email;
48
+ /** Sends through Cloudflare Email Sending. Senders and recipients must be allowed in the binding's wrangler config. */
49
+ export function cloudflareMailer(binding) {
50
+ return {
51
+ async send(message) {
52
+ checkMessage(message);
53
+ const headers = headersFor(message);
54
+ const from = typeof message.from === "string"
55
+ ? message.from
56
+ : { email: message.from.email, name: message.from.name ?? "" };
57
+ try {
58
+ const result = await binding.send({
59
+ from,
60
+ to: message.to,
61
+ subject: message.subject,
62
+ text: message.text,
63
+ html: message.html,
64
+ ...(message.replyTo
65
+ ? {
66
+ replyTo: typeof message.replyTo === "string"
67
+ ? message.replyTo
68
+ : {
69
+ email: message.replyTo.email,
70
+ name: message.replyTo.name ?? "",
71
+ },
72
+ }
73
+ : {}),
74
+ ...(Object.keys(headers).length ? { headers } : {}),
75
+ ...(message.attachments?.length
76
+ ? {
77
+ attachments: message.attachments.map((a) => ({
78
+ disposition: "attachment",
79
+ filename: a.filename,
80
+ type: a.contentType ?? "application/octet-stream",
81
+ content: a.content,
82
+ })),
83
+ }
84
+ : {}),
85
+ });
86
+ return result?.messageId ? { id: result.messageId } : {};
87
+ }
88
+ catch (err) {
89
+ throw new MailError(`Email Sending failed: ${err instanceof Error ? err.message : String(err)}`);
90
+ }
91
+ },
92
+ };
93
+ }
94
+ /** Sends through the Resend API with `fetch`, no SDK. */
95
+ export function resendMailer(options) {
96
+ const fetcher = options.fetch ?? ((url, init) => fetch(url, init));
97
+ return {
98
+ async send(message) {
99
+ checkMessage(message);
100
+ if (!options.apiKey)
101
+ throw new MailError("RESEND_API_KEY is not set.");
102
+ const headers = headersFor(message);
103
+ const body = {
104
+ from: formatAddress(message.from),
105
+ to: message.to,
106
+ subject: message.subject,
107
+ text: message.text,
108
+ html: message.html,
109
+ };
110
+ if (message.replyTo)
111
+ body.reply_to = formatAddress(message.replyTo);
112
+ if (Object.keys(headers).length)
113
+ body.headers = headers;
114
+ if (message.attachments?.length) {
115
+ body.attachments = message.attachments.map((a) => ({
116
+ filename: a.filename,
117
+ content: a.content,
118
+ ...(a.contentType ? { content_type: a.contentType } : {}),
119
+ }));
120
+ }
121
+ const res = await fetcher("https://api.resend.com/emails", {
122
+ method: "POST",
123
+ headers: {
124
+ authorization: `Bearer ${options.apiKey}`,
125
+ "content-type": "application/json",
126
+ ...(message.idempotencyKey
127
+ ? { "idempotency-key": message.idempotencyKey }
128
+ : {}),
129
+ },
130
+ body: JSON.stringify(body),
131
+ signal: AbortSignal.timeout(options.timeoutMs ?? 10_000),
132
+ });
133
+ const json = (await res.json().catch(() => null));
134
+ if (!res.ok) {
135
+ throw new MailError(`Resend failed (${res.status}): ${json?.message ?? res.statusText}`, res.status, json);
136
+ }
137
+ return json?.id ? { id: json.id } : {};
138
+ },
139
+ };
140
+ }
141
+ /** A mailer that records what it would send, for tests. It applies the same checks as the real ones. */
142
+ export function recordingMailer() {
143
+ const sent = [];
144
+ return {
145
+ sent,
146
+ async send(message) {
147
+ checkMessage(message);
148
+ sent.push(message);
149
+ return { id: `test-${sent.length}` };
150
+ },
151
+ };
152
+ }
153
+ /** Escapes text for an HTML body. */
154
+ export function escapeHtml(text) {
155
+ return text.replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c] ?? c);
156
+ }
157
+ //# sourceMappingURL=mail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.js","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoCH,4GAA4G;AAC5G,MAAM,OAAO,SAAU,SAAQ,KAAK;IAIvB,MAAM;IACN,IAAI;IAJG,IAAI,GAAG,WAAW,CAAC;IACrC,YACE,OAAe,EACN,MAAe,EACf,IAAc;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;sBAHN,MAAM;oBACN,IAAI;IAGf,CAAC;IACD,IAAI,SAAS;QACX,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,SAAS;YACzB,IAAI,CAAC,MAAM,IAAI,GAAG;YAClB,IAAI,CAAC,MAAM,GAAG,GAAG;YACjB,IAAI,CAAC,MAAM,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without importing an SDK: the
3
+ * objects here go straight into `withSentry` from `@sentry/cloudflare` and
4
+ * `Sentry.init` from a browser SDK.
5
+ *
6
+ * What every app had written for itself: no DSN means no SDK traffic, events
7
+ * from a local server (`wrangler dev`, `vite preview`) never reach the
8
+ * production project, and in the browser the noise that is not the app's to
9
+ * fix (requests that never left the device, extension and injected wallet
10
+ * scripts, users declining a wallet prompt) is dropped. The Worker side gets
11
+ * no message filters: browser wording describes nothing workerd says, so a
12
+ * filter there could only hide a real failure.
13
+ *
14
+ * Release and environment are left unset unless given, so
15
+ * `@sentry/cloudflare` reads `SENTRY_RELEASE` (or `CF_VERSION_METADATA`) and
16
+ * `SENTRY_ENVIRONMENT` from the Worker's env itself.
17
+ */
18
+ /** The part of a Sentry event the filters read. */
19
+ export interface SentryEventLike {
20
+ request?: {
21
+ url?: string;
22
+ };
23
+ exception?: {
24
+ values?: {
25
+ value?: string;
26
+ type?: string;
27
+ }[];
28
+ };
29
+ }
30
+ type AnyEvent = any;
31
+ type BeforeSend = (event: AnyEvent, hint: AnyEvent) => AnyEvent;
32
+ /** Whether the event's request was served from this machine. An event with no request (a cron run, a workflow step) is not local. */
33
+ export declare function isLocalEvent(event: SentryEventLike): boolean;
34
+ /** A `beforeSend` that drops local events and keeps the rest. */
35
+ export declare function dropLocalEvents<T extends SentryEventLike>(event: T): T | null;
36
+ /** Browser wording for a request that never left the device: Chrome, Safari, Firefox. */
37
+ export declare const NETWORK_ERROR: RegExp;
38
+ /** Errors thrown by extension content scripts and injected wallets. */
39
+ export declare const EXTENSION_ERROR: RegExp;
40
+ /** A person declining a wallet prompt. */
41
+ export declare const USER_REJECTION: RegExp;
42
+ /** Scripts other people inject into the page: extensions, wallets and Google Translate's proxy. */
43
+ export declare const BROWSER_DENY_URLS: readonly RegExp[];
44
+ /** Whether a browser event is noise that is not the app's to fix. `extra` adds patterns matched against the message. */
45
+ export declare function isBrowserNoise(event: SentryEventLike, extra?: readonly RegExp[]): boolean;
46
+ /** A DSN worth using: an `https://` URL. Anything else (empty, `off`, a placeholder) turns Sentry off. */
47
+ export declare function validDsn(dsn: string | null | undefined): string | undefined;
48
+ interface CommonOptions {
49
+ /** Overrides the DSN read from the env. */
50
+ dsn?: string | undefined;
51
+ /** Default 0: no tracing. */
52
+ tracesSampleRate?: number;
53
+ /** Runs after the built-in filters. */
54
+ beforeSend?: BeforeSend;
55
+ /** Tags set on every event, such as `{ runtime: "worker", worker: "api" }`. */
56
+ tags?: Record<string, string>;
57
+ release?: string;
58
+ environment?: string;
59
+ }
60
+ export interface WorkerSentryOptions {
61
+ dsn: string | undefined;
62
+ enabled: boolean;
63
+ tracesSampleRate: number;
64
+ beforeSend: BeforeSend;
65
+ beforeSendTransaction: BeforeSend;
66
+ initialScope?: {
67
+ tags: Record<string, string>;
68
+ };
69
+ release?: string;
70
+ environment?: string;
71
+ }
72
+ /**
73
+ * Options for `withSentry`, `instrumentWorkflowWithSentry` and
74
+ * `instrumentDurableObjectWithSentry`. Reads `SENTRY_DSN` from the env;
75
+ * spread the result and add anything app-specific (integrations, samplers).
76
+ */
77
+ export declare function workerSentryOptions(env: {
78
+ SENTRY_DSN?: string | undefined;
79
+ }, options?: CommonOptions): WorkerSentryOptions;
80
+ export interface BrowserSentryOptions extends WorkerSentryOptions {
81
+ denyUrls: RegExp[];
82
+ }
83
+ /**
84
+ * Options for a browser SDK's `Sentry.init`. Pass the DSN (from the build),
85
+ * and `enabled: false` for dev builds, which the browser cannot tell from
86
+ * the env.
87
+ */
88
+ export declare function browserSentryOptions(options?: CommonOptions & {
89
+ enabled?: boolean;
90
+ /** More script URLs to ignore. */
91
+ denyUrls?: readonly RegExp[];
92
+ /** More messages that are noise. */
93
+ noise?: readonly RegExp[];
94
+ }): BrowserSentryOptions;
95
+ export {};
96
+ //# sourceMappingURL=sentry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../src/sentry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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AC,EAAE,UAAU,CAAC;IACxB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,EAAE,UAAU,CAAC;IAClC,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACxC,OAAO,GAAE,aAAkB,GAC1B,mBAAmB,CAarB;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,aAAa,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtB,GACL,oBAAoB,CAmBtB"}
package/dist/sentry.js ADDED
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Sentry options for a Worker and its pages, without importing an SDK: the
3
+ * objects here go straight into `withSentry` from `@sentry/cloudflare` and
4
+ * `Sentry.init` from a browser SDK.
5
+ *
6
+ * What every app had written for itself: no DSN means no SDK traffic, events
7
+ * from a local server (`wrangler dev`, `vite preview`) never reach the
8
+ * production project, and in the browser the noise that is not the app's to
9
+ * fix (requests that never left the device, extension and injected wallet
10
+ * scripts, users declining a wallet prompt) is dropped. The Worker side gets
11
+ * no message filters: browser wording describes nothing workerd says, so a
12
+ * filter there could only hide a real failure.
13
+ *
14
+ * Release and environment are left unset unless given, so
15
+ * `@sentry/cloudflare` reads `SENTRY_RELEASE` (or `CF_VERSION_METADATA`) and
16
+ * `SENTRY_ENVIRONMENT` from the Worker's env itself.
17
+ */
18
+ const LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
19
+ /** Whether the event's request was served from this machine. An event with no request (a cron run, a workflow step) is not local. */
20
+ export function isLocalEvent(event) {
21
+ const url = event.request?.url;
22
+ if (!url)
23
+ return false;
24
+ try {
25
+ const host = new URL(url).hostname;
26
+ return LOCAL_HOSTS.has(host) || host.endsWith(".localhost");
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ /** A `beforeSend` that drops local events and keeps the rest. */
33
+ export function dropLocalEvents(event) {
34
+ return isLocalEvent(event) ? null : event;
35
+ }
36
+ /** Browser wording for a request that never left the device: Chrome, Safari, Firefox. */
37
+ export const NETWORK_ERROR = /failed to fetch|load failed|networkerror/i;
38
+ /** Errors thrown by extension content scripts and injected wallets. */
39
+ export const EXTENSION_ERROR = /func \w+ not found|tronlink|trap returned falsish|origin not allowed|object captured as promise rejection with keys: code, (data, )?message/i;
40
+ /** A person declining a wallet prompt. */
41
+ export const USER_REJECTION = /user rejected|user denied|rejected the request/i;
42
+ /** Scripts other people inject into the page: extensions, wallets and Google Translate's proxy. */
43
+ export const BROWSER_DENY_URLS = [
44
+ /\/_\/translate_http\//i,
45
+ /injected\.js/i,
46
+ /inpage\.js/i,
47
+ /contentscript/i,
48
+ /chrome-extension:\/\//i,
49
+ /moz-extension:\/\//i,
50
+ /safari-(web-)?extension:\/\//i,
51
+ ];
52
+ /** Whether a browser event is noise that is not the app's to fix. `extra` adds patterns matched against the message. */
53
+ export function isBrowserNoise(event, extra = []) {
54
+ const message = event.exception?.values?.[0]?.value ?? "";
55
+ return [NETWORK_ERROR, EXTENSION_ERROR, USER_REJECTION, ...extra].some((re) => re.test(message));
56
+ }
57
+ /** A DSN worth using: an `https://` URL. Anything else (empty, `off`, a placeholder) turns Sentry off. */
58
+ export function validDsn(dsn) {
59
+ const value = dsn?.trim();
60
+ return value?.startsWith("https://") ? value : undefined;
61
+ }
62
+ function chain(...steps) {
63
+ return (event, hint) => {
64
+ let current = event;
65
+ for (const step of steps) {
66
+ if (!step || current === null)
67
+ continue;
68
+ current = step(current, hint);
69
+ }
70
+ return current;
71
+ };
72
+ }
73
+ /**
74
+ * Options for `withSentry`, `instrumentWorkflowWithSentry` and
75
+ * `instrumentDurableObjectWithSentry`. Reads `SENTRY_DSN` from the env;
76
+ * spread the result and add anything app-specific (integrations, samplers).
77
+ */
78
+ export function workerSentryOptions(env, options = {}) {
79
+ const dsn = validDsn(options.dsn ?? env.SENTRY_DSN);
80
+ const out = {
81
+ dsn,
82
+ enabled: dsn !== undefined,
83
+ tracesSampleRate: options.tracesSampleRate ?? 0,
84
+ beforeSend: chain(dropLocalEvents, options.beforeSend),
85
+ beforeSendTransaction: dropLocalEvents,
86
+ };
87
+ if (options.tags)
88
+ out.initialScope = { tags: options.tags };
89
+ if (options.release)
90
+ out.release = options.release;
91
+ if (options.environment)
92
+ out.environment = options.environment;
93
+ return out;
94
+ }
95
+ /**
96
+ * Options for a browser SDK's `Sentry.init`. Pass the DSN (from the build),
97
+ * and `enabled: false` for dev builds, which the browser cannot tell from
98
+ * the env.
99
+ */
100
+ export function browserSentryOptions(options = {}) {
101
+ const dsn = validDsn(options.dsn);
102
+ const noise = options.noise ?? [];
103
+ const out = {
104
+ dsn,
105
+ enabled: dsn !== undefined && options.enabled !== false,
106
+ tracesSampleRate: options.tracesSampleRate ?? 0,
107
+ denyUrls: [...BROWSER_DENY_URLS, ...(options.denyUrls ?? [])],
108
+ beforeSend: chain((event) => isLocalEvent(event) || isBrowserNoise(event, noise) ? null : event, options.beforeSend),
109
+ beforeSendTransaction: dropLocalEvents,
110
+ };
111
+ if (options.tags)
112
+ out.initialScope = { tags: options.tags };
113
+ if (options.release)
114
+ out.release = options.release;
115
+ if (options.environment)
116
+ out.environment = options.environment;
117
+ return out;
118
+ }
119
+ //# sourceMappingURL=sentry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry.js","sourceRoot":"","sources":["../src/sentry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAExE,qIAAqI;AACrI,MAAM,UAAU,YAAY,CAAC,KAAsB;IACjD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;QACnC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAA4B,KAAQ;IACjE,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5C,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,2CAA2C,CAAC;AACzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAC1B,8IAA8I,CAAC;AACjJ,0CAA0C;AAC1C,MAAM,CAAC,MA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,CAAC,CAAC,CAAC,KAAK,EACpE,OAAO,CAAC,UAAU,CACnB;QACD,qBAAqB,EAAE,eAAe;KACvC,CAAC;IACF,IAAI,OAAO,CAAC,IAAI;QAAE,GAAG,CAAC,YAAY,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5D,IAAI,OAAO,CAAC,OAAO;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnD,IAAI,OAAO,CAAC,WAAW;QAAE,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC/D,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workers-start",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "The parts every TanStack Start app on Cloudflare Workers ends up writing: Markdown for agents on the same URL, a head helper that stops share cards leaking between pages, lazy Workers bindings, and a check that no local secret ships in the build.",
5
5
  "license": "MIT",
6
6
  "author": "Ryan Ghods",
@@ -21,7 +21,12 @@
21
21
  "vite",
22
22
  "seo",
23
23
  "markdown",
24
- "llms"
24
+ "llms",
25
+ "google-analytics",
26
+ "search-console",
27
+ "sentry",
28
+ "email",
29
+ "resend"
25
30
  ],
26
31
  "type": "module",
27
32
  "sideEffects": false,
@@ -81,6 +86,21 @@
81
86
  "import": "./dist/access-testing.js",
82
87
  "default": "./dist/access-testing.js"
83
88
  },
89
+ "./google": {
90
+ "types": "./dist/google.d.ts",
91
+ "import": "./dist/google.js",
92
+ "default": "./dist/google.js"
93
+ },
94
+ "./sentry": {
95
+ "types": "./dist/sentry.d.ts",
96
+ "import": "./dist/sentry.js",
97
+ "default": "./dist/sentry.js"
98
+ },
99
+ "./mail": {
100
+ "types": "./dist/mail.d.ts",
101
+ "import": "./dist/mail.js",
102
+ "default": "./dist/mail.js"
103
+ },
84
104
  "./package.json": "./package.json"
85
105
  },
86
106
  "bin": {