From 74ff5b07f7537953623c01605a25e08205f2566e Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:41:04 +0530 Subject: [PATCH] fix: removed sentry from exports due to jsr restrictions --- deno.json | 1 - deps.ts | 14 -------------- src/sentry.ts | 23 +++++++++++++++-------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/deno.json b/deno.json index b644b3a..b6043dc 100644 --- a/deno.json +++ b/deno.json @@ -3,7 +3,6 @@ "version": "0.6.4", "exports": { "./router": "./src/router.ts", - "./sentry": "./src/sentry.ts", "./utils": "./src/utils.ts" }, "publish": { diff --git a/deps.ts b/deps.ts index 60662a0..7dfe292 100644 --- a/deps.ts +++ b/deps.ts @@ -1,17 +1,3 @@ -export { - captureException, - continueTrace, - defineIntegration, - requestDataIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - setHttpStatus, - startSpan, - withIsolationScope, -} from 'https://esm.sh/@sentry/core@^8.22.0' -export * as Sentry from 'https://esm.sh/@sentry/deno@^8.22.0' -export type { IntegrationFn, SpanAttributes } from 'https://esm.sh/@sentry/types@^8.22.0' -export { getSanitizedUrlString, parseUrl } from 'https://esm.sh/@sentry/utils@^8.22.0' export { abortable, deadline, debounce, delay, retry } from 'jsr:@std/async@^1.0.1' export { walk } from 'jsr:@std/fs@^1.0.0' export { serveDir, type ServeDirOptions, STATUS_CODE, STATUS_TEXT, type StatusCode } from 'jsr:@std/http@^1.0.0-rc.6' diff --git a/src/sentry.ts b/src/sentry.ts index d26cedc..acde187 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -3,24 +3,31 @@ * * @description * Deno server integration for Sentry. + * + * This file is not published to JSR because of restrictions on https imports. + * Import this file directly in your Deno server application: + * + * ```ts + * import { init } from 'https://raw.githubusercontent.com/globalbrain/hado/main/src/sentry.ts' + * + * init() + * ``` */ import { captureException, continueTrace, defineIntegration, - getSanitizedUrlString, - type IntegrationFn, - parseUrl, requestDataIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - Sentry, setHttpStatus, - type SpanAttributes, startSpan, withIsolationScope, -} from '../deps.ts' +} from 'https://esm.sh/@sentry/core@^8.22.0' +import * as Sentry from 'https://esm.sh/@sentry/deno@^8.22.0' +import type { Client, IntegrationFn, SpanAttributes } from 'https://esm.sh/@sentry/types@^8.22.0' +import { getSanitizedUrlString, parseUrl } from 'https://esm.sh/@sentry/utils@^8.22.0' type RawHandler = (request: Request, info: Deno.ServeHandlerInfo) => Response | Promise @@ -143,8 +150,8 @@ function instrumentDenoServeOptions(handler: RawHandler): RawHandler { export function init( dsn: string | undefined = Deno.env.get('SENTRY_DSN'), environment: string | undefined = Deno.env.get('SENTRY_ENVIRONMENT') || Deno.env.get('DENO_ENV'), -): void { - Sentry.init({ +): Client { + return Sentry.init({ dsn, environment, integrations: [