@spotlightjs/overlay 2.0.0 → 2.1.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.
Files changed (26) hide show
  1. package/dist/{index-5682ce90.js → index-d3152027.js} +6363 -6267
  2. package/dist/index-d3152027.js.map +1 -0
  3. package/dist/{main-3257b7fc.js → main-cb892f58.js} +2 -2
  4. package/dist/{main-3257b7fc.js.map → main-cb892f58.js.map} +1 -1
  5. package/dist/sentry-spotlight.js +20 -14
  6. package/dist/sentry-spotlight.umd.cjs +123 -122
  7. package/dist/sentry-spotlight.umd.cjs.map +1 -1
  8. package/dist/src/constants.d.ts +1 -0
  9. package/dist/src/index.d.ts +6 -12
  10. package/dist/src/integrations/integration.d.ts +2 -1
  11. package/dist/src/integrations/sentry/components/traces/spans/SpanItem.d.ts +2 -1
  12. package/dist/src/integrations/sentry/components/traces/spans/SpanTree.d.ts +2 -1
  13. package/dist/src/integrations/sentry/components/traces/traceDetail/TraceDetailHeader.d.ts +4 -0
  14. package/dist/src/integrations/sentry/components/traces/traceDetail/index.d.ts +1 -0
  15. package/dist/src/integrations/sentry/components/traces/traceInfo/TraceGeneralInfo.d.ts +6 -0
  16. package/dist/src/integrations/sentry/components/traces/traceInfo/TraceTags.d.ts +6 -0
  17. package/dist/src/integrations/sentry/components/traces/traceInfo/index.d.ts +6 -0
  18. package/dist/src/integrations/sentry/data/sentryDataCache.d.ts +2 -2
  19. package/dist/src/integrations/sentry/data/sentryEventsContext.d.ts +1 -1
  20. package/dist/src/integrations/sentry/hooks/useDebounce.d.ts +1 -0
  21. package/dist/src/integrations/sentry/index.d.ts +8 -0
  22. package/dist/src/integrations/sentry/sentry-integration.d.ts +0 -5
  23. package/dist/src/integrations/sentry/utils/fetch.d.ts +6 -0
  24. package/dist/src/lib/eventTarget.d.ts +11 -0
  25. package/package.json +2 -2
  26. package/dist/index-5682ce90.js.map +0 -1
@@ -3,3 +3,4 @@ export declare const DEFAULT_EXPERIMENTS: {
3
3
  'sentry:focus-local-events': boolean;
4
4
  };
5
5
  export declare const DEFAULT_ANCHOR = "bottomRight";
6
+ export declare const CONTEXT_LINES_ENDPOINT = "/@spotlight/contextlines";
@@ -1,10 +1,13 @@
1
+ import { CONTEXT_LINES_ENDPOINT, DEFAULT_ANCHOR, DEFAULT_EXPERIMENTS, DEFAULT_SIDECAR_URL } from './constants.ts';
2
+ import { off, on, trigger } from './lib/eventTarget.ts';
1
3
  import { React, ReactDOM } from './react-instance.tsx';
2
4
  import { SpotlightOverlayOptions } from './types.ts';
3
5
  export { default as console } from './integrations/console/index.ts';
4
6
  export { default as hydrationError } from './integrations/hydration-error/index.ts';
5
7
  export { default as sentry } from './integrations/sentry/index.ts';
6
8
  export { default as viteInspect } from './integrations/vite-inspect/index.ts';
7
- export { React, ReactDOM };
9
+ export type { SpotlightOverlayOptions, WindowWithSpotlight } from './types.ts';
10
+ export { CONTEXT_LINES_ENDPOINT, DEFAULT_ANCHOR, DEFAULT_EXPERIMENTS, DEFAULT_SIDECAR_URL, React, ReactDOM, off, on, trigger, };
8
11
  /**
9
12
  * Open the Spotlight debugger Window
10
13
  */
@@ -16,24 +19,15 @@ export declare function closeSpotlight(): Promise<void>;
16
19
  /**
17
20
  * Invokes the passed in callback when the Spotlight debugger Window is closed
18
21
  */
19
- export declare function onClose(cb: () => void): Promise<void>;
22
+ export declare function onClose(cb: EventListener): Promise<void>;
20
23
  /**
21
24
  * Invokes the passed in callback when the Spotlight debugger Window is opened
22
25
  */
23
- export declare function onOpen(cb: () => void): Promise<void>;
26
+ export declare function onOpen(cb: EventListener): Promise<void>;
24
27
  /**
25
28
  * Register a callback that is invoked when a severe event is processed
26
29
  * by a Spotlight integration.
27
30
  * A count of the number of collected severe events is passed to the callback.
28
31
  */
29
32
  export declare function onSevereEvent(cb: (count: number) => void): Promise<void>;
30
- /**
31
- * Trigger an event in Spotlight.
32
- *
33
- * This is primarily useful for handling an uncaught error/crash, and forcing the debugger
34
- * to render vs a native error handler.
35
- *
36
- * e.g. trigger("sentry.showError", {eventId});
37
- */
38
- export declare function trigger(eventName: string, payload: unknown): Promise<void>;
39
33
  export declare function init({ openOnInit, showTriggerButton, injectImmediately, sidecarUrl, anchor, debug, integrations, experiments, fullPage, showClearEventsButton, }?: SpotlightOverlayOptions): Promise<void>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { type ComponentType } from 'react';
2
3
  import { type ExperimentsConfig, type NotificationCount } from '../types';
3
4
  export type SpotlightContext = {
@@ -94,7 +95,7 @@ export type RawEventContext = {
94
95
  *
95
96
  * Return the processed object or undefined if the event should be ignored.
96
97
  */
97
- data: string;
98
+ data: string | Buffer;
98
99
  };
99
100
  type TeardownFunction = () => void | Promise<() => void>;
100
101
  export declare function initIntegrations(integrations: Integration<any>[] | undefined, context: SpotlightContext): Promise<[Integration[], TeardownFunction[]]>;
@@ -1,5 +1,5 @@
1
1
  import { Span, TraceContext } from '../../../types';
2
- declare const SpanItem: ({ span, startTimestamp, totalDuration, depth, traceContext, totalTransactions, spanNodeWidth, setSpanNodeWidth, }: {
2
+ declare const SpanItem: ({ span, startTimestamp, totalDuration, depth, traceContext, totalTransactions, spanNodeWidth, setSpanNodeWidth, query, }: {
3
3
  span: Span;
4
4
  startTimestamp: number;
5
5
  totalDuration: number;
@@ -8,5 +8,6 @@ declare const SpanItem: ({ span, startTimestamp, totalDuration, depth, traceCont
8
8
  totalTransactions?: number | undefined;
9
9
  spanNodeWidth: number;
10
10
  setSpanNodeWidth?: ((val: number) => void) | undefined;
11
+ query?: string | undefined;
11
12
  }) => import("react/jsx-runtime").JSX.Element;
12
13
  export default SpanItem;
@@ -1,5 +1,5 @@
1
1
  import { Span, TraceContext } from '../../../types';
2
- export default function SpanTree({ traceContext, tree, startTimestamp, totalDuration, depth, totalTransactions, spanNodeWidth, setSpanNodeWidth, }: {
2
+ export default function SpanTree({ traceContext, tree, startTimestamp, totalDuration, depth, totalTransactions, spanNodeWidth, setSpanNodeWidth, query, }: {
3
3
  traceContext: TraceContext;
4
4
  tree: Span[];
5
5
  startTimestamp: number;
@@ -8,4 +8,5 @@ export default function SpanTree({ traceContext, tree, startTimestamp, totalDura
8
8
  totalTransactions?: number;
9
9
  spanNodeWidth: number;
10
10
  setSpanNodeWidth?: (val: number) => void;
11
+ query?: string;
11
12
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import { Trace } from '../../../../../integrations/sentry/types';
2
+ export default function TraceDetailHeader({ trace }: {
3
+ trace: Trace;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function TraceDetails(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Trace } from '../../../../../integrations/sentry/types';
2
+ type TraceGeneralInfoProps = {
3
+ trace: Trace;
4
+ };
5
+ export default function TraceGeneralInfo({ trace }: TraceGeneralInfoProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Trace } from '../../../../../integrations/sentry/types';
2
+ type TraceTagsProps = {
3
+ trace: Trace;
4
+ };
5
+ export default function TraceTags({ trace }: TraceTagsProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { TraceContext } from '../../../types';
2
+ type TraceInfoProps = {
3
+ traceContext: TraceContext;
4
+ };
5
+ export default function TraceInfo({ traceContext }: TraceInfoProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -26,10 +26,10 @@ declare class SentryDataCache {
26
26
  pushEnvelope({ envelope, rawEnvelope }: {
27
27
  envelope: Envelope;
28
28
  rawEnvelope: RawEventContext;
29
- }): void;
29
+ }): number;
30
30
  pushEvent(event: SentryEvent & {
31
31
  event_id?: string;
32
- }): void;
32
+ }): Promise<void>;
33
33
  getEvents(): SentryEvent[];
34
34
  getTraces(): Trace[];
35
35
  getSdks(): Sdk[];
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
- import { SentryEvent } from '../types';
3
+ import type { SentryEvent } from '../types';
4
4
  interface SetEventsAction {
5
5
  e: SentryEvent | SentryEvent[];
6
6
  action: string;
@@ -0,0 +1 @@
1
+ export default function useDebounce<T extends (...args: any[]) => void>(callback: T, delay: number): (...args: Parameters<T>) => void;
@@ -6,6 +6,8 @@ import TracesTab from './tabs/TracesTab';
6
6
  type SentryIntegrationOptions = {
7
7
  sidecarUrl?: string;
8
8
  injectIntoSDK?: boolean;
9
+ openLastError?: boolean;
10
+ retries?: number;
9
11
  };
10
12
  export default function sentryIntegration(options?: SentryIntegrationOptions): {
11
13
  name: string;
@@ -39,6 +41,12 @@ export default function sentryIntegration(options?: SentryIntegrationOptions): {
39
41
  })[];
40
42
  reset: () => void;
41
43
  };
44
+ /**
45
+ * Implements parser for
46
+ * @see https://develop.sentry.dev/sdk/envelopes/#serialization-format
47
+ * @param rawEvent Envelope data
48
+ * @returns parsed envelope
49
+ */
42
50
  export declare function processEnvelope(rawEvent: RawEventContext): {
43
51
  event: Envelope;
44
52
  rawEvent: RawEventContext;
@@ -29,9 +29,4 @@ export declare const spotlightIntegration: (options?: SpotlightBrowserIntegratio
29
29
  processEvent: (event: Event) => Promise<Event | null>;
30
30
  afterAllSetup: (client: Client) => void;
31
31
  };
32
- type FetchImpl = typeof fetch;
33
- /**
34
- * We want to get an unpatched fetch implementation to avoid capturing our own calls.
35
- */
36
- export declare function getNativeFetchImplementation(): FetchImpl;
37
32
  export {};
@@ -0,0 +1,6 @@
1
+ type FetchImpl = typeof fetch;
2
+ /**
3
+ * We want to get an unpatched fetch implementation to avoid capturing our own calls.
4
+ */
5
+ export declare function getNativeFetchImplementation(): FetchImpl;
6
+ export {};
@@ -11,3 +11,14 @@
11
11
  * which is local to one spotlight code instance.
12
12
  */
13
13
  export declare function getSpotlightEventTarget(): EventTarget;
14
+ /**
15
+ * Trigger an event in Spotlight.
16
+ *
17
+ * This is primarily useful for handling an uncaught error/crash, and forcing the debugger
18
+ * to render vs a native error handler.
19
+ *
20
+ * e.g. trigger("sentry.showError", {eventId});
21
+ */
22
+ export declare function trigger(eventName: string, payload?: unknown): Promise<void>;
23
+ export declare function on(eventName: string, cb: EventListener): Promise<void>;
24
+ export declare function off(eventName: string, cb: EventListener): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotlightjs/overlay",
3
3
  "description": "The overlay of Spotlight to add debug interface to your web app.",
4
- "version": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -30,7 +30,7 @@
30
30
  "eslint-plugin-react-hooks": "^4.6.0",
31
31
  "eslint-plugin-react-refresh": "^0.4.3",
32
32
  "typescript": "^5.0.2",
33
- "vite": "^4.5.2",
33
+ "vite": "^4.5.3",
34
34
  "vite-plugin-dts": "^3.5.2",
35
35
  "vite-plugin-svgr": "^3.2.0",
36
36
  "vitest": "^0.34.6",