@sentry/svelte 8.0.0-alpha.8 → 8.0.0-beta.1
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 +8 -23
- package/cjs/performance.js.map +1 -1
- package/esm/performance.js +9 -24
- package/esm/performance.js.map +1 -1
- package/package.json +5 -5
- package/types/performance.d.ts.map +1 -1
package/cjs/performance.js
CHANGED
|
@@ -31,13 +31,12 @@ function trackComponent(options) {
|
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
32
32
|
const componentName = `<${customComponentName || internal.current_component.constructor.name || constants.DEFAULT_COMPONENT_NAME}>`;
|
|
33
33
|
|
|
34
|
-
let initSpan = undefined;
|
|
35
34
|
if (mergedOptions.trackInit) {
|
|
36
|
-
|
|
35
|
+
recordInitSpan(componentName);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
if (mergedOptions.trackUpdates) {
|
|
40
|
-
recordUpdateSpans(componentName
|
|
39
|
+
recordUpdateSpans(componentName);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -52,35 +51,21 @@ function recordInitSpan(componentName) {
|
|
|
52
51
|
svelte.onMount(() => {
|
|
53
52
|
initSpan.end();
|
|
54
53
|
});
|
|
55
|
-
|
|
56
|
-
return initSpan;
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
function recordUpdateSpans(componentName
|
|
56
|
+
function recordUpdateSpans(componentName) {
|
|
60
57
|
let updateSpan;
|
|
61
58
|
svelte.beforeUpdate(() => {
|
|
62
|
-
//
|
|
63
|
-
// already be finished or there is currently no transaction going on.
|
|
59
|
+
// If there is no active span, we skip
|
|
64
60
|
const activeSpan = browser.getActiveSpan();
|
|
65
61
|
if (!activeSpan) {
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
? initSpan
|
|
74
|
-
: core.getRootSpan(activeSpan);
|
|
75
|
-
|
|
76
|
-
if (!parentSpan) return;
|
|
77
|
-
|
|
78
|
-
updateSpan = core.withActiveSpan(parentSpan, () => {
|
|
79
|
-
return core.startInactiveSpan({
|
|
80
|
-
op: constants.UI_SVELTE_UPDATE,
|
|
81
|
-
name: componentName,
|
|
82
|
-
attributes: { [browser.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
|
83
|
-
});
|
|
65
|
+
updateSpan = core.startInactiveSpan({
|
|
66
|
+
op: constants.UI_SVELTE_UPDATE,
|
|
67
|
+
name: componentName,
|
|
68
|
+
attributes: { [browser.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
|
84
69
|
});
|
|
85
70
|
});
|
|
86
71
|
|
package/cjs/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport {
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\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 intialization 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 // 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 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 // If there is no active span, we skip\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n updateSpan = startInactiveSpan({\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":["current_component","DEFAULT_COMPONENT_NAME","startInactiveSpan","UI_SVELTE_INIT","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","onMount","beforeUpdate","getActiveSpan","UI_SVELTE_UPDATE","afterUpdate"],"mappings":";;;;;;;;AASA,MAAM,4BAA4B;;AAIlC,GAAI;AACJ,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,YAAY,EAAE,IAAI;AACpB,CAAC,CAAA;AACD;AACA;AACA;AACA;AACA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,EAAEM,0BAAgB;AAC1B,MAAM,IAAI,EAAE,aAAa;AACzB,MAAM,UAAU,EAAE,EAAE,CAACJ,wCAAgC,GAAG,kBAAkB;AAC1E,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;AACA,EAAEK,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,7 +1,7 @@
|
|
|
1
1
|
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/browser';
|
|
2
2
|
import { onMount, beforeUpdate, afterUpdate } from 'svelte';
|
|
3
3
|
import { current_component } from 'svelte/internal';
|
|
4
|
-
import { startInactiveSpan
|
|
4
|
+
import { startInactiveSpan } from '@sentry/core';
|
|
5
5
|
import { DEFAULT_COMPONENT_NAME, UI_SVELTE_INIT, UI_SVELTE_UPDATE } from './constants.js';
|
|
6
6
|
|
|
7
7
|
const defaultTrackComponentOptions
|
|
@@ -29,13 +29,12 @@ function trackComponent(options) {
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
30
30
|
const componentName = `<${customComponentName || current_component.constructor.name || DEFAULT_COMPONENT_NAME}>`;
|
|
31
31
|
|
|
32
|
-
let initSpan = undefined;
|
|
33
32
|
if (mergedOptions.trackInit) {
|
|
34
|
-
|
|
33
|
+
recordInitSpan(componentName);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
if (mergedOptions.trackUpdates) {
|
|
38
|
-
recordUpdateSpans(componentName
|
|
37
|
+
recordUpdateSpans(componentName);
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -50,35 +49,21 @@ function recordInitSpan(componentName) {
|
|
|
50
49
|
onMount(() => {
|
|
51
50
|
initSpan.end();
|
|
52
51
|
});
|
|
53
|
-
|
|
54
|
-
return initSpan;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
function recordUpdateSpans(componentName
|
|
54
|
+
function recordUpdateSpans(componentName) {
|
|
58
55
|
let updateSpan;
|
|
59
56
|
beforeUpdate(() => {
|
|
60
|
-
//
|
|
61
|
-
// already be finished or there is currently no transaction going on.
|
|
57
|
+
// If there is no active span, we skip
|
|
62
58
|
const activeSpan = getActiveSpan();
|
|
63
59
|
if (!activeSpan) {
|
|
64
60
|
return;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
? initSpan
|
|
72
|
-
: getRootSpan(activeSpan);
|
|
73
|
-
|
|
74
|
-
if (!parentSpan) return;
|
|
75
|
-
|
|
76
|
-
updateSpan = withActiveSpan(parentSpan, () => {
|
|
77
|
-
return startInactiveSpan({
|
|
78
|
-
op: UI_SVELTE_UPDATE,
|
|
79
|
-
name: componentName,
|
|
80
|
-
attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
|
81
|
-
});
|
|
63
|
+
updateSpan = startInactiveSpan({
|
|
64
|
+
op: UI_SVELTE_UPDATE,
|
|
65
|
+
name: componentName,
|
|
66
|
+
attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },
|
|
82
67
|
});
|
|
83
68
|
});
|
|
84
69
|
|
package/esm/performance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\n\nimport {
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../src/performance.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/types';\nimport { afterUpdate, beforeUpdate, onMount } from 'svelte';\nimport { current_component } from 'svelte/internal';\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 intialization 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 // 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 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 // If there is no active span, we skip\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n updateSpan = startInactiveSpan({\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":";;;;;;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;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;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,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,GAAW,iBAAiB,CAAC;AACrC,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,EAAE,EAAE,cAAc;AACtB,IAAI,IAAI,EAAE,aAAa;AACvB,IAAI,UAAU,EAAE,EAAE,CAAC,gCAAgC,GAAG,kBAAkB;AACxE,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,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,EAAE,YAAY,CAAC,MAAM;AACrB;AACA,IAAI,MAAM,UAAA,GAAa,aAAa,EAAE,CAAA;AACtC,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,UAAA,GAAa,iBAAiB,CAAC;AACnC,MAAM,EAAE,EAAE,gBAAgB;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-
|
|
3
|
+
"version": "8.0.0-beta.1",
|
|
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,10 +42,10 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sentry/browser": "8.0.0-
|
|
46
|
-
"@sentry/core": "8.0.0-
|
|
47
|
-
"@sentry/types": "8.0.0-
|
|
48
|
-
"@sentry/utils": "8.0.0-
|
|
45
|
+
"@sentry/browser": "8.0.0-beta.1",
|
|
46
|
+
"@sentry/core": "8.0.0-beta.1",
|
|
47
|
+
"@sentry/types": "8.0.0-beta.1",
|
|
48
|
+
"@sentry/utils": "8.0.0-beta.1",
|
|
49
49
|
"magic-string": "^0.30.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/performance.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWrD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/performance.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWrD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAgBpE"}
|