@sentry/svelte 8.0.0-alpha.9 → 8.0.0-beta.2

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.
@@ -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
- initSpan = recordInitSpan(componentName);
35
+ recordInitSpan(componentName);
37
36
  }
38
37
 
39
38
  if (mergedOptions.trackUpdates) {
40
- recordUpdateSpans(componentName, initSpan);
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, initSpan) {
56
+ function recordUpdateSpans(componentName) {
60
57
  let updateSpan;
61
58
  svelte.beforeUpdate(() => {
62
- // We need to get the active transaction again because the initial one could
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
- // If we are initializing the component when the update span is started, we start it as child
70
- // of the init span. Else, we start it as a child of the transaction.
71
- const parentSpan =
72
- initSpan && initSpan.isRecording() && core.getRootSpan(initSpan) === core.getRootSpan(activeSpan)
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
 
@@ -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 { getRootSpan, startInactiveSpan, withActiveSpan } 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 let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(componentName: string): Span | undefined {\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 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 activeSpan = getActiveSpan();\n if (!activeSpan) {\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) === getRootSpan(activeSpan)\n ? initSpan\n : getRootSpan(activeSpan);\n\n if (!parentSpan) return;\n\n updateSpan = withActiveSpan(parentSpan, () => {\n return startInactiveSpan({\n op: UI_SVELTE_UPDATE,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\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","getRootSpan","withActiveSpan","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;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,IAAGA,0BAAiB,CAAC,W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AAI,IAAI,CAAC,UAAU,EAAE,OAAM;AAC3B;AACA,IAAI,UAAA,GAAaC,mBAAc,CAAC,UAAU,EAAE,MAAM;AAClD,MAAM,OAAOP,sBAAiB,CAAC;AAC/B,QAAQ,EAAE,EAAEQ,0BAAgB;AAC5B,QAAQ,IAAI,EAAE,aAAa;AAC3B,QAAQ,UAAU,EAAE,EAAE,CAACN,wCAAgC,GAAG,kBAAkB;AAC5E,OAAO,CAAC,CAAA;AACR,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;AACA,EAAEO,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;;;;"}
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;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;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C,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;;;;"}
@@ -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, getRootSpan, withActiveSpan } from '@sentry/core';
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
- initSpan = recordInitSpan(componentName);
33
+ recordInitSpan(componentName);
35
34
  }
36
35
 
37
36
  if (mergedOptions.trackUpdates) {
38
- recordUpdateSpans(componentName, initSpan);
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, initSpan) {
54
+ function recordUpdateSpans(componentName) {
58
55
  let updateSpan;
59
56
  beforeUpdate(() => {
60
- // We need to get the active transaction again because the initial one could
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
- // If we are initializing the component when the update span is started, we start it as child
68
- // of the init span. Else, we start it as a child of the transaction.
69
- const parentSpan =
70
- initSpan && initSpan.isRecording() && getRootSpan(initSpan) === getRootSpan(activeSpan)
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
 
@@ -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 { getRootSpan, startInactiveSpan, withActiveSpan } 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 let initSpan: Span | undefined = undefined;\n if (mergedOptions.trackInit) {\n initSpan = recordInitSpan(componentName);\n }\n\n if (mergedOptions.trackUpdates) {\n recordUpdateSpans(componentName, initSpan);\n }\n}\n\nfunction recordInitSpan(componentName: string): Span | undefined {\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 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 activeSpan = getActiveSpan();\n if (!activeSpan) {\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) === getRootSpan(activeSpan)\n ? initSpan\n : getRootSpan(activeSpan);\n\n if (!parentSpan) return;\n\n updateSpan = withActiveSpan(parentSpan, () => {\n return startInactiveSpan({\n op: UI_SVELTE_UPDATE,\n name: componentName,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte' },\n });\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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AAW,EAAC,IAAK,WAAW,CAAC,QAAQ,CAAA,KAAM,WAAW,CAAC,UAAU,CAAA;AAC5F,UAAU,QAAA;AACV,UAAU,WAAW,CAAC,UAAU,CAAC,CAAA;AACjC;AACA,IAAI,IAAI,CAAC,UAAU,EAAE,OAAM;AAC3B;AACA,IAAI,UAAA,GAAa,cAAc,CAAC,UAAU,EAAE,MAAM;AAClD,MAAM,OAAO,iBAAiB,CAAC;AAC/B,QAAQ,EAAE,EAAE,gBAAgB;AAC5B,QAAQ,IAAI,EAAE,aAAa;AAC3B,QAAQ,UAAU,EAAE,EAAE,CAAC,gCAAgC,GAAG,kBAAkB;AAC5E,OAAO,CAAC,CAAA;AACR,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;;;;"}
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,EA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M,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-alpha.9",
3
+ "version": "8.0.0-beta.2",
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-alpha.9",
46
- "@sentry/core": "8.0.0-alpha.9",
47
- "@sentry/types": "8.0.0-alpha.9",
48
- "@sentry/utils": "8.0.0-alpha.9",
45
+ "@sentry/browser": "8.0.0-beta.2",
46
+ "@sentry/core": "8.0.0-beta.2",
47
+ "@sentry/types": "8.0.0-beta.2",
48
+ "@sentry/utils": "8.0.0-beta.2",
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,CAiBpE"}
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"}