@sentry/svelte 8.0.0-beta.4 → 8.0.0-beta.5
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
CHANGED
|
@@ -2,7 +2,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2
2
|
|
|
3
3
|
const browser = require('@sentry/browser');
|
|
4
4
|
const svelte = require('svelte');
|
|
5
|
-
const internal = require('svelte/internal');
|
|
6
5
|
const core = require('@sentry/core');
|
|
7
6
|
const constants = require('./constants.js');
|
|
8
7
|
|
|
@@ -14,7 +13,7 @@ const defaultTrackComponentOptions
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
* Tracks the Svelte component's
|
|
16
|
+
* Tracks the Svelte component's initialization and mounting operation as well as
|
|
18
17
|
* updates and records them as spans.
|
|
19
18
|
*
|
|
20
19
|
* This function is injected automatically into your Svelte components' code
|
|
@@ -27,9 +26,7 @@ function trackComponent(options) {
|
|
|
27
26
|
|
|
28
27
|
const customComponentName = mergedOptions.componentName;
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
32
|
-
const componentName = `<${customComponentName || internal.current_component.constructor.name || constants.DEFAULT_COMPONENT_NAME}>`;
|
|
29
|
+
const componentName = `<${customComponentName || constants.DEFAULT_COMPONENT_NAME}>`;
|
|
33
30
|
|
|
34
31
|
if (mergedOptions.trackInit) {
|
|
35
32
|
recordInitSpan(componentName);
|
|
@@ -56,13 +53,8 @@ function recordInitSpan(componentName) {
|
|
|
56
53
|
function recordUpdateSpans(componentName) {
|
|
57
54
|
let updateSpan;
|
|
58
55
|
svelte.beforeUpdate(() => {
|
|
59
|
-
// If there is no active span, we skip
|
|
60
|
-
const activeSpan = browser.getActiveSpan();
|
|
61
|
-
if (!activeSpan) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
56
|
updateSpan = core.startInactiveSpan({
|
|
57
|
+
onlyIfParent: true,
|
|
66
58
|
op: constants.UI_SVELTE_UPDATE,
|
|
67
59
|
name: componentName,
|
|
68
60
|
attributes: { [browser.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
package/cjs/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\n\nimport { startInactiveSpan } 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 initialization and mounting operation as well as\n * updates and records them as spans.\n *\n * This function is injected automatically into your Svelte components' code\n * if you are using the withSentryConfig wrapper.\n *\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 customComponentName = mergedOptions.componentName;\n\n const componentName = `<${customComponentName || DEFAULT_COMPONENT_NAME}>`;\n\n if (mergedOptions.trackInit) {\n recordInitSpan(componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName);\n }\n}\n\nfunction recordInitSpan(componentName: string): void {\n const initSpan = startInactiveSpan({\n onlyIfParent: true,\n op: UI_SVELTE_INIT,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\n\n onMount(() => {\n initSpan.end();\n });\n}\n\nfunction recordUpdateSpans(componentName: string): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n updateSpan = startInactiveSpan({\n onlyIfParent: true,\n op: UI_SVELTE_UPDATE,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\n });\n\n afterUpdate(() => {\n if (!updateSpan) {\n return;\n }\n updateSpan.end();\n updateSpan = undefined;\n });\n}\n"],"names":["DEFAULT_COMPONENT_NAME","startInactiveSpan","UI_SVELTE_INIT","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","onMount","beforeUpdate","UI_SVELTE_UPDATE","afterUpdate"],"mappings":";;;;;;;AAQA,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;AACA;AACA;AACO,SAAS,cAAc,CAAC,OAAO,EAAgC;AACtE,EAAE,MAAM,gBAAgB,EAAE,GAAG,4BAA4B,EAAE,GAAG,OAAA,EAAS,CAAA;AACvE;AACA,EAAE,MAAM,mBAAA,GAAsB,aAAa,CAAC,aAAa,CAAA;AACzD;AACA,EAAE,MAAM,aAAc,GAAE,CAAC,CAAC,EAAE,mBAAA,IAAuBA,gCAAsB,CAAC,CAAC,CAAC,CAAA;AAC5E;AACA,EAAE,IAAI,aAAa,CAAC,SAAS,EAAE;AAC/B,IAAI,cAAc,CAAC,aAAa,CAAC,CAAA;AACjC,GAAE;AACF;AACA,EAAE,IAAI,aAAa,CAAC,YAAY,EAAE;AAClC,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAA;AACpC,GAAE;AACF,CAAA;AACA;AACA,SAAS,cAAc,CAAC,aAAa,EAAgB;AACrD,EAAE,MAAM,QAAA,GAAWC,sBAAiB,CAAC;AACrC,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,EAAE,EAAEC,wBAAc;AACtB,IAAI,IAAI,EAAE,aAAa;AACvB,IAAI,UAAU,EAAE,EAAE,CAACC,wCAAgC,GAAG,kBAAkB;AACxE,GAAG,CAAC,CAAA;AACJ;AACA,EAAEC,cAAO,CAAC,MAAM;AAChB,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAA;AAClB,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA,SAAS,iBAAiB,CAAC,aAAa,EAAgB;AACxD,EAAE,IAAI,UAAU,CAAA;AAChB,EAAEC,mBAAY,CAAC,MAAM;AACrB,IAAI,UAAA,GAAaJ,sBAAiB,CAAC;AACnC,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,EAAE,EAAEK,0BAAgB;AAC1B,MAAM,IAAI,EAAE,aAAa;AACzB,MAAM,UAAU,EAAE,EAAE,CAACH,wCAAgC,GAAG,kBAAkB;AAC1E,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;AACA,EAAEI,kBAAW,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;;;;"}
|
package/esm/performance.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN
|
|
1
|
+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
|
|
2
2
|
import { onMount, beforeUpdate, afterUpdate } from 'svelte';
|
|
3
|
-
import { current_component } from 'svelte/internal';
|
|
4
3
|
import { startInactiveSpan } from '@sentry/core';
|
|
5
|
-
import {
|
|
4
|
+
import { UI_SVELTE_INIT, UI_SVELTE_UPDATE, DEFAULT_COMPONENT_NAME } from './constants.js';
|
|
6
5
|
|
|
7
6
|
const defaultTrackComponentOptions
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ const defaultTrackComponentOptions
|
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
|
-
* Tracks the Svelte component's
|
|
14
|
+
* Tracks the Svelte component's initialization and mounting operation as well as
|
|
16
15
|
* updates and records them as spans.
|
|
17
16
|
*
|
|
18
17
|
* This function is injected automatically into your Svelte components' code
|
|
@@ -25,9 +24,7 @@ function trackComponent(options) {
|
|
|
25
24
|
|
|
26
25
|
const customComponentName = mergedOptions.componentName;
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
30
|
-
const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;
|
|
27
|
+
const componentName = `<${customComponentName || DEFAULT_COMPONENT_NAME}>`;
|
|
31
28
|
|
|
32
29
|
if (mergedOptions.trackInit) {
|
|
33
30
|
recordInitSpan(componentName);
|
|
@@ -54,13 +51,8 @@ function recordInitSpan(componentName) {
|
|
|
54
51
|
function recordUpdateSpans(componentName) {
|
|
55
52
|
let updateSpan;
|
|
56
53
|
beforeUpdate(() => {
|
|
57
|
-
// If there is no active span, we skip
|
|
58
|
-
const activeSpan = getActiveSpan();
|
|
59
|
-
if (!activeSpan) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
54
|
updateSpan = startInactiveSpan({
|
|
55
|
+
onlyIfParent: true,
|
|
64
56
|
op: UI_SVELTE_UPDATE,
|
|
65
57
|
name: componentName,
|
|
66
58
|
attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
package/esm/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\n\nimport { startInactiveSpan } 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 initialization and mounting operation as well as\n * updates and records them as spans.\n *\n * This function is injected automatically into your Svelte components' code\n * if you are using the withSentryConfig wrapper.\n *\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 customComponentName = mergedOptions.componentName;\n\n const componentName = `<${customComponentName || DEFAULT_COMPONENT_NAME}>`;\n\n if (mergedOptions.trackInit) {\n recordInitSpan(componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName);\n }\n}\n\nfunction recordInitSpan(componentName: string): void {\n const initSpan = startInactiveSpan({\n onlyIfParent: true,\n op: UI_SVELTE_INIT,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\n\n onMount(() => {\n initSpan.end();\n });\n}\n\nfunction recordUpdateSpans(componentName: string): void {\n let updateSpan: Span | undefined;\n beforeUpdate(() => {\n updateSpan = startInactiveSpan({\n onlyIfParent: true,\n op: UI_SVELTE_UPDATE,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\n });\n\n afterUpdate(() => {\n if (!updateSpan) {\n return;\n }\n updateSpan.end();\n updateSpan = undefined;\n });\n}\n"],"names":[],"mappings":";;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;AAC1B,MAAM,IAAI,EAAE,aAAa;AACzB,MAAM,UAAU,EAAE,EAAE,CAAC,gCAAgC,GAAG,kBAAkB;AAC1E,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/svelte",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.5",
|
|
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",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sentry/browser": "8.0.0-beta.
|
|
46
|
-
"@sentry/core": "8.0.0-beta.
|
|
47
|
-
"@sentry/types": "8.0.0-beta.
|
|
48
|
-
"@sentry/utils": "8.0.0-beta.
|
|
45
|
+
"@sentry/browser": "8.0.0-beta.5",
|
|
46
|
+
"@sentry/core": "8.0.0-beta.5",
|
|
47
|
+
"@sentry/types": "8.0.0-beta.5",
|
|
48
|
+
"@sentry/utils": "8.0.0-beta.5",
|
|
49
49
|
"magic-string": "^0.30.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"svelte": "3.x || 4.x"
|
|
52
|
+
"svelte": "3.x || 4.x || 5.x"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@sveltejs/vite-plugin-svelte": "1.4.0",
|
package/types/performance.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TrackComponentOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Tracks the Svelte component's
|
|
3
|
+
* Tracks the Svelte component's initialization and mounting operation as well as
|
|
4
4
|
* updates and records them as spans.
|
|
5
5
|
*
|
|
6
6
|
* This function is injected automatically into your Svelte components' code
|
|
@@ -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":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWrD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAcpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TrackComponentOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Tracks the Svelte component's
|
|
3
|
+
* Tracks the Svelte component's initialization and mounting operation as well as
|
|
4
4
|
* updates and records them as spans.
|
|
5
5
|
*
|
|
6
6
|
* This function is injected automatically into your Svelte components' code
|