Skip to content

Commit

Permalink
fix: removed sentry from exports due to jsr restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Aug 1, 2024
1 parent 9785d59 commit 74ff5b0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.6.4",
"exports": {
"./router": "./src/router.ts",
"./sentry": "./src/sentry.ts",
"./utils": "./src/utils.ts"
},
"publish": {
Expand Down
14 changes: 0 additions & 14 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
23 changes: 15 additions & 8 deletions src/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Response>

Expand Down Expand Up @@ -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: [
Expand Down

0 comments on commit 74ff5b0

Please sign in to comment.