@sentry/svelte 7.93.0 → 7.95.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/cjs/performance.js +2 -1
- package/cjs/performance.js.map +1 -1
- package/cjs/sdk.js +3 -11
- package/cjs/sdk.js.map +1 -1
- package/esm/performance.js +2 -1
- package/esm/performance.js.map +1 -1
- package/esm/sdk.js +4 -12
- package/esm/sdk.js.map +1 -1
- package/package.json +5 -4
- package/types/performance.d.ts.map +1 -1
- package/types/sdk.d.ts.map +1 -1
package/cjs/performance.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
3
3
|
const browser = require('@sentry/browser');
|
|
4
4
|
const svelte = require('svelte');
|
|
5
5
|
const internal = require('svelte/internal');
|
|
6
|
+
const core = require('@sentry/core');
|
|
6
7
|
const constants = require('./constants.js');
|
|
7
8
|
|
|
8
9
|
const defaultTrackComponentOptions
|
|
@@ -71,7 +72,7 @@ function recordUpdateSpans(componentName, initSpan) {
|
|
|
71
72
|
// If we are initializing the component when the update span is started, we start it as child
|
|
72
73
|
// of the init span. Else, we start it as a child of the transaction.
|
|
73
74
|
const parentSpan =
|
|
74
|
-
initSpan &&
|
|
75
|
+
initSpan && initSpan.isRecording() && core.getRootSpan(initSpan) === transaction ? initSpan : transaction;
|
|
75
76
|
|
|
76
77
|
// eslint-disable-next-line deprecation/deprecation
|
|
77
78
|
updateSpan = parentSpan.startChild({
|
package/cjs/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { getCurrentScope } from '@sentry/browser';\nimport type { Span, Transaction } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants';\nimport type { TrackComponentOptions } from './types';\n\nconst defaultTrackComponentOptions: {\n trackInit: boolean;\n trackUpdates: boolean;\n componentName?: string;\n} = {\n trackInit: true,\n trackUpdates: true,\n};\n\n/**\n * Tracks the Svelte component's intialization and mounting operation as well as\n * updates and records them as spans.\n * This function is injected automatically into your Svelte components' code\n * if you are using the Sentry componentTrackingPreprocessor.\n * Alternatively, you can call it yourself if you don't want to use the preprocessor.\n */\nexport function trackComponent(options?: TrackComponentOptions): void {\n const mergedOptions = { ...defaultTrackComponentOptions, ...options };\n\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n const customComponentName = mergedOptions.componentName;\n\n // current_component.ctor.name is likely to give us the component's name automatically\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;\n\n let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(transaction, componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(transaction: Transaction, componentName: string): Span {\n // eslint-disable-next-line deprecation/deprecation\n const initSpan = transaction.startChild({\n op: UI_SVELTE_INIT,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n\n onMount(() => {\n initSpan.end();\n });\n\n return initSpan;\n}\n\nfunction recordUpdateSpans(componentName: string, initSpan?: Span): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n // We need to get the active transaction again because the initial one could\n // already be finished or there is currently no transaction going on.\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n // If we are initializing the component when the update span is started, we start it as child\n // of the init span. Else, we start it as a child of the transaction.\n const parentSpan =\n initSpan &&
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { getCurrentScope } from '@sentry/browser';\nimport type { Span, Transaction } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport { getRootSpan } from '@sentry/core';\nimport { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants';\nimport type { TrackComponentOptions } from './types';\n\nconst defaultTrackComponentOptions: {\n trackInit: boolean;\n trackUpdates: boolean;\n componentName?: string;\n} = {\n trackInit: true,\n trackUpdates: true,\n};\n\n/**\n * Tracks the Svelte component's intialization and mounting operation as well as\n * updates and records them as spans.\n * This function is injected automatically into your Svelte components' code\n * if you are using the Sentry componentTrackingPreprocessor.\n * Alternatively, you can call it yourself if you don't want to use the preprocessor.\n */\nexport function trackComponent(options?: TrackComponentOptions): void {\n const mergedOptions = { ...defaultTrackComponentOptions, ...options };\n\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n const customComponentName = mergedOptions.componentName;\n\n // current_component.ctor.name is likely to give us the component's name automatically\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;\n\n let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(transaction, componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(transaction: Transaction, componentName: string): Span {\n // eslint-disable-next-line deprecation/deprecation\n const initSpan = transaction.startChild({\n op: UI_SVELTE_INIT,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n\n onMount(() => {\n initSpan.end();\n });\n\n return initSpan;\n}\n\nfunction recordUpdateSpans(componentName: string, initSpan?: Span): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n // We need to get the active transaction again because the initial one could\n // already be finished or there is currently no transaction going on.\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n // If we are initializing the component when the update span is started, we start it as child\n // of the init span. Else, we start it as a child of the transaction.\n const parentSpan =\n initSpan && initSpan.isRecording() && getRootSpan(initSpan) === transaction ? initSpan : transaction;\n\n // eslint-disable-next-line deprecation/deprecation\n updateSpan = parentSpan.startChild({\n op: UI_SVELTE_UPDATE,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n });\n\n afterUpdate(() => {\n if (!updateSpan) {\n return;\n }\n updateSpan.end();\n updateSpan = undefined;\n });\n}\n\nfunction getActiveTransaction(): Transaction | undefined {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentScope().getTransaction();\n}\n"],"names":["current_component","DEFAULT_COMPONENT_NAME","UI_SVELTE_INIT","onMount","beforeUpdate","getRootSpan","UI_SVELTE_UPDATE","afterUpdate","getCurrentScope"],"mappings":";;;;;;;;AASA,MAAM,4BAA4B;;AAIlC,GAAI;AACJ,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,YAAY,EAAE,IAAI;AACpB,CAAC,CAAA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,OAAO,EAAgC;AACtE,EAAE,MAAM,gBAAgB,EAAE,GAAG,4BAA4B,EAAE,GAAG,OAAA,EAAS,CAAA;AACvE;AACA,EAAE,MAAM,WAAA,GAAc,oBAAoB,EAAE,CAAA;AAC5C,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,MAAM,mBAAA,GAAsB,aAAa,CAAC,aAAa,CAAA;AACzD;AACA;AACA;AACA,EAAE,MAAM,aAAc,GAAE,CAAC,CAAC,EAAE,mBAAoB,IAAGA,0BAAiB,CAAC,WAAW,CAAC,IAAA,IAAQC,gCAAsB,CAAC,CAAC,CAAC,CAAA;AAClH;AACA,EAAE,IAAI,QAAQ,GAAqB,SAAS,CAAA;AAC5C,EAAE,IAAI,aAAa,CAAC,SAAS,EAAE;AAC/B,IAAI,WAAW,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;AACzD,GAAE;AACF;AACA,EAAE,IAAI,aAAa,CAAC,YAAY,EAAE;AAClC,IAAI,iBAAiB,CAAC,aA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AAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA,SAAS,oBAAoB,GAA4B;AACzD;AACA,EAAE,OAAOC,uBAAe,EAAE,CAAC,cAAc,EAAE,CAAA;AAC3C;;;;"}
|
package/cjs/sdk.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
3
|
const browser = require('@sentry/browser');
|
|
4
|
+
const core = require('@sentry/core');
|
|
4
5
|
const utils = require('@sentry/utils');
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -8,20 +9,11 @@ const utils = require('@sentry/utils');
|
|
|
8
9
|
*/
|
|
9
10
|
function init(options) {
|
|
10
11
|
const opts = {
|
|
11
|
-
_metadata: {} ,
|
|
12
12
|
...options,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
packages: [
|
|
18
|
-
{
|
|
19
|
-
name: 'npm:@sentry/svelte',
|
|
20
|
-
version: browser.SDK_VERSION,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
version: browser.SDK_VERSION,
|
|
24
|
-
};
|
|
15
|
+
core.applySdkMetadata(opts, 'svelte');
|
|
16
|
+
|
|
25
17
|
browser.init(opts);
|
|
26
18
|
|
|
27
19
|
detectAndReportSvelteKit();
|
package/cjs/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport {
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { EventProcessor } from '@sentry/types';\nimport { getDomElement } from '@sentry/utils';\n/**\n * Inits the Svelte SDK\n */\nexport function init(options: BrowserOptions): void {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'svelte');\n\n browserInit(opts);\n\n detectAndReportSvelteKit();\n}\n\n/**\n * Adds a global event processor to detect if the SDK is initialized in a SvelteKit frontend,\n * in which case we add SvelteKit an event.modules entry to outgoing events.\n * SvelteKit detection is performed only once, when the event processor is called for the\n * first time. We cannot perform this check upfront (directly when init is called) because\n * at this time, the HTML element might not yet be accessible.\n */\nexport function detectAndReportSvelteKit(): void {\n let detectedSvelteKit: boolean | undefined = undefined;\n\n const svelteKitProcessor: EventProcessor = event => {\n if (detectedSvelteKit === undefined) {\n detectedSvelteKit = isSvelteKitApp();\n }\n if (detectedSvelteKit) {\n event.modules = {\n svelteKit: 'latest',\n ...event.modules,\n };\n }\n return event;\n };\n svelteKitProcessor.id = 'svelteKitProcessor';\n\n addEventProcessor(svelteKitProcessor);\n}\n\n/**\n * To actually detect a SvelteKit frontend, we search the DOM for a special\n * div that's inserted by SvelteKit when the page is rendered. It's identifyed\n * by its id, 'svelte-announcer', and it's used to improve page accessibility.\n * This div is not present when only using Svelte without SvelteKit.\n *\n * @see https://github.com/sveltejs/kit/issues/307 for more information\n */\nexport function isSvelteKitApp(): boolean {\n return getDomElement('div#svelte-announcer') !== null;\n}\n"],"names":["applySdkMetadata","browserInit","addEventProcessor","getDomElement"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAwB;AACpD,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG,CAAA;AACH;AACA,EAAEA,qBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC;AACA,EAAEC,YAAW,CAAC,IAAI,CAAC,CAAA;AACnB;AACA,EAAE,wBAAwB,EAAE,CAAA;AAC5B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,GAAS;AACjD,EAAE,IAAI,iBAAiB,GAAwB,SAAS,CAAA;AACxD;AACA,EAAE,MAAM,kBAAkB,GAAmB,SAAS;AACtD,IAAI,IAAI,iBAAkB,KAAI,SAAS,EAAE;AACzC,MAAM,iBAAkB,GAAE,cAAc,EAAE,CAAA;AAC1C,KAAI;AACJ,IAAI,IAAI,iBAAiB,EAAE;AAC3B,MAAM,KAAK,CAAC,OAAA,GAAU;AACtB,QAAQ,SAAS,EAAE,QAAQ;AAC3B,QAAQ,GAAG,KAAK,CAAC,OAAO;AACxB,OAAO,CAAA;AACP,KAAI;AACJ,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAA;AACH,EAAE,kBAAkB,CAAC,EAAG,GAAE,oBAAoB,CAAA;AAC9C;AACA,EAAEC,yBAAiB,CAAC,kBAAkB,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C,EAAE,OAAOC,mBAAa,CAAC,sBAAsB,CAAA,KAAM,IAAI,CAAA;AACvD;;;;;;"}
|
package/esm/performance.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getCurrentScope } from '@sentry/browser';
|
|
2
2
|
import { onMount, beforeUpdate, afterUpdate } from 'svelte';
|
|
3
3
|
import { current_component } from 'svelte/internal';
|
|
4
|
+
import { getRootSpan } from '@sentry/core';
|
|
4
5
|
import { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants.js';
|
|
5
6
|
|
|
6
7
|
const defaultTrackComponentOptions
|
|
@@ -69,7 +70,7 @@ function recordUpdateSpans(componentName, initSpan) {
|
|
|
69
70
|
// If we are initializing the component when the update span is started, we start it as child
|
|
70
71
|
// of the init span. Else, we start it as a child of the transaction.
|
|
71
72
|
const parentSpan =
|
|
72
|
-
initSpan &&
|
|
73
|
+
initSpan && initSpan.isRecording() && getRootSpan(initSpan) === transaction ? initSpan : transaction;
|
|
73
74
|
|
|
74
75
|
// eslint-disable-next-line deprecation/deprecation
|
|
75
76
|
updateSpan = parentSpan.startChild({
|
package/esm/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { getCurrentScope } from '@sentry/browser';\nimport type { Span, Transaction } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants';\nimport type { TrackComponentOptions } from './types';\n\nconst defaultTrackComponentOptions: {\n trackInit: boolean;\n trackUpdates: boolean;\n componentName?: string;\n} = {\n trackInit: true,\n trackUpdates: true,\n};\n\n/**\n * Tracks the Svelte component's intialization and mounting operation as well as\n * updates and records them as spans.\n * This function is injected automatically into your Svelte components' code\n * if you are using the Sentry componentTrackingPreprocessor.\n * Alternatively, you can call it yourself if you don't want to use the preprocessor.\n */\nexport function trackComponent(options?: TrackComponentOptions): void {\n const mergedOptions = { ...defaultTrackComponentOptions, ...options };\n\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n const customComponentName = mergedOptions.componentName;\n\n // current_component.ctor.name is likely to give us the component's name automatically\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;\n\n let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(transaction, componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(transaction: Transaction, componentName: string): Span {\n // eslint-disable-next-line deprecation/deprecation\n const initSpan = transaction.startChild({\n op: UI_SVELTE_INIT,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n\n onMount(() => {\n initSpan.end();\n });\n\n return initSpan;\n}\n\nfunction recordUpdateSpans(componentName: string, initSpan?: Span): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n // We need to get the active transaction again because the initial one could\n // already be finished or there is currently no transaction going on.\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n // If we are initializing the component when the update span is started, we start it as child\n // of the init span. Else, we start it as a child of the transaction.\n const parentSpan =\n initSpan &&
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { getCurrentScope } from '@sentry/browser';\nimport type { Span, Transaction } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport { getRootSpan } from '@sentry/core';\nimport { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants';\nimport type { TrackComponentOptions } from './types';\n\nconst defaultTrackComponentOptions: {\n trackInit: boolean;\n trackUpdates: boolean;\n componentName?: string;\n} = {\n trackInit: true,\n trackUpdates: true,\n};\n\n/**\n * Tracks the Svelte component's intialization and mounting operation as well as\n * updates and records them as spans.\n * This function is injected automatically into your Svelte components' code\n * if you are using the Sentry componentTrackingPreprocessor.\n * Alternatively, you can call it yourself if you don't want to use the preprocessor.\n */\nexport function trackComponent(options?: TrackComponentOptions): void {\n const mergedOptions = { ...defaultTrackComponentOptions, ...options };\n\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n const customComponentName = mergedOptions.componentName;\n\n // current_component.ctor.name is likely to give us the component's name automatically\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;\n\n let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(transaction, componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(transaction: Transaction, componentName: string): Span {\n // eslint-disable-next-line deprecation/deprecation\n const initSpan = transaction.startChild({\n op: UI_SVELTE_INIT,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n\n onMount(() => {\n initSpan.end();\n });\n\n return initSpan;\n}\n\nfunction recordUpdateSpans(componentName: string, initSpan?: Span): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n // We need to get the active transaction again because the initial one could\n // already be finished or there is currently no transaction going on.\n const transaction = getActiveTransaction();\n if (!transaction) {\n return;\n }\n\n // If we are initializing the component when the update span is started, we start it as child\n // of the init span. Else, we start it as a child of the transaction.\n const parentSpan =\n initSpan && initSpan.isRecording() && getRootSpan(initSpan) === transaction ? initSpan : transaction;\n\n // eslint-disable-next-line deprecation/deprecation\n updateSpan = parentSpan.startChild({\n op: UI_SVELTE_UPDATE,\n description: componentName,\n origin: 'auto.ui.svelte',\n });\n });\n\n afterUpdate(() => {\n if (!updateSpan) {\n return;\n }\n updateSpan.end();\n updateSpan = undefined;\n });\n}\n\nfunction getActiveTransaction(): Transaction | undefined {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentScope().getTransaction();\n}\n"],"names":[],"mappings":";;;;;;AASA,MAAM,4BAA4B;;AAIlC,GAAI;AACJ,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,YAAY,EAAE,IAAI;AACpB,CAAC,CAAA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,OAAO,EAAgC;AACtE,EAAE,MAAM,gBAAgB,EAAE,GAAG,4BAA4B,EAAE,GAAG,OAAA,EAAS,CAAA;AACvE;AACA,EAAE,MAAM,WAAA,GAAc,oBAAoB,EAAE,CAAA;AAC5C,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,MAAM,mBAAA,GAAsB,aAAa,CAAC,aAAa,CAAA;AACzD;AACA;AACA;AACA,EAAE,MAAM,aAAc,GAAE,CAAC,CAAC,EAAE,mBAAoB,IAAG,iBAAiB,CAAC,WAAW,CAAC,IAAA,IAAQ,sBAAsB,CAAC,CAAC,CAAC,CAAA;AAClH;AACA,EAAE,IAAI,QAAQ,GAAqB,SAAS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ACJ;AACA,EAAE,WAAW,CAAC,MAAM;AACpB,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,MAAM,OAAM;AACZ,KAAI;AACJ,IAAI,UAAU,CAAC,GAAG,EAAE,CAAA;AACpB,IAAI,UAAA,GAAa,SAAS,CAAA;AAC1B,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA,SAAS,oBAAoB,GAA4B;AACzD;AACA,EAAE,OAAO,eAAe,EAAE,CAAC,cAAc,EAAE,CAAA;AAC3C;;;;"}
|
package/esm/sdk.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { init as init$1, addEventProcessor } from '@sentry/browser';
|
|
2
|
+
import { applySdkMetadata } from '@sentry/core';
|
|
2
3
|
import { getDomElement } from '@sentry/utils';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,20 +7,11 @@ import { getDomElement } from '@sentry/utils';
|
|
|
6
7
|
*/
|
|
7
8
|
function init(options) {
|
|
8
9
|
const opts = {
|
|
9
|
-
_metadata: {} ,
|
|
10
10
|
...options,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
opts
|
|
14
|
-
|
|
15
|
-
packages: [
|
|
16
|
-
{
|
|
17
|
-
name: 'npm:@sentry/svelte',
|
|
18
|
-
version: SDK_VERSION,
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
version: SDK_VERSION,
|
|
22
|
-
};
|
|
13
|
+
applySdkMetadata(opts, 'svelte');
|
|
14
|
+
|
|
23
15
|
init$1(opts);
|
|
24
16
|
|
|
25
17
|
detectAndReportSvelteKit();
|
package/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport {
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { EventProcessor } from '@sentry/types';\nimport { getDomElement } from '@sentry/utils';\n/**\n * Inits the Svelte SDK\n */\nexport function init(options: BrowserOptions): void {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'svelte');\n\n browserInit(opts);\n\n detectAndReportSvelteKit();\n}\n\n/**\n * Adds a global event processor to detect if the SDK is initialized in a SvelteKit frontend,\n * in which case we add SvelteKit an event.modules entry to outgoing events.\n * SvelteKit detection is performed only once, when the event processor is called for the\n * first time. We cannot perform this check upfront (directly when init is called) because\n * at this time, the HTML element might not yet be accessible.\n */\nexport function detectAndReportSvelteKit(): void {\n let detectedSvelteKit: boolean | undefined = undefined;\n\n const svelteKitProcessor: EventProcessor = event => {\n if (detectedSvelteKit === undefined) {\n detectedSvelteKit = isSvelteKitApp();\n }\n if (detectedSvelteKit) {\n event.modules = {\n svelteKit: 'latest',\n ...event.modules,\n };\n }\n return event;\n };\n svelteKitProcessor.id = 'svelteKitProcessor';\n\n addEventProcessor(svelteKitProcessor);\n}\n\n/**\n * To actually detect a SvelteKit frontend, we search the DOM for a special\n * div that's inserted by SvelteKit when the page is rendered. It's identifyed\n * by its id, 'svelte-announcer', and it's used to improve page accessibility.\n * This div is not present when only using Svelte without SvelteKit.\n *\n * @see https://github.com/sveltejs/kit/issues/307 for more information\n */\nexport function isSvelteKitApp(): boolean {\n return getDomElement('div#svelte-announcer') !== null;\n}\n"],"names":["browserInit"],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAwB;AACpD,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG,CAAA;AACH;AACA,EAAE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC;AACA,EAAEA,MAAW,CAAC,IAAI,CAAC,CAAA;AACnB;AACA,EAAE,wBAAwB,EAAE,CAAA;AAC5B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,GAAS;AACjD,EAAE,IAAI,iBAAiB,GAAwB,SAAS,CAAA;AACxD;AACA,EAAE,MAAM,kBAAkB,GAAmB,SAAS;AACtD,IAAI,IAAI,iBAAkB,KAAI,SAAS,EAAE;AACzC,MAAM,iBAAkB,GAAE,cAAc,EAAE,CAAA;AAC1C,KAAI;AACJ,IAAI,IAAI,iBAAiB,EAAE;AAC3B,MAAM,KAAK,CAAC,OAAA,GAAU;AACtB,QAAQ,SAAS,EAAE,QAAQ;AAC3B,QAAQ,GAAG,KAAK,CAAC,OAAO;AACxB,OAAO,CAAA;AACP,KAAI;AACJ,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAA;AACH,EAAE,kBAAkB,CAAC,EAAG,GAAE,oBAAoB,CAAA;AAC9C;AACA,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C,EAAE,OAAO,aAAa,CAAC,sBAAsB,CAAA,KAAM,IAAI,CAAA;AACvD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/svelte",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.95.0",
|
|
4
4
|
"description": "Official Sentry SDK for Svelte",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/svelte",
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sentry/browser": "7.
|
|
33
|
-
"@sentry/
|
|
34
|
-
"@sentry/
|
|
32
|
+
"@sentry/browser": "7.95.0",
|
|
33
|
+
"@sentry/core": "7.95.0",
|
|
34
|
+
"@sentry/types": "7.95.0",
|
|
35
|
+
"@sentry/utils": "7.95.0",
|
|
35
36
|
"magic-string": "^0.30.0"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/performance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/performance.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWrD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAsBpE"}
|
package/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAUlD;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAkB/C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC"}
|