@sentry/svelte 8.54.0 → 9.0.0-alpha.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/LICENSE +1 -1
- package/build/cjs/config.js +2 -2
- package/build/cjs/config.js.map +1 -1
- package/build/cjs/constants.js +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/performance.js +1 -1
- package/build/cjs/preprocessors.js +1 -1
- package/build/cjs/sdk.js +2 -3
- package/build/cjs/sdk.js.map +1 -1
- package/build/esm/config.js +1 -1
- package/build/esm/config.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk.js +3 -4
- package/build/esm/sdk.js.map +1 -1
- package/build/types/sdk.d.ts.map +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022
|
|
3
|
+
Copyright (c) 2022 Functional Software, Inc. dba Sentry
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
package/build/cjs/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const preprocessors = require('./preprocessors.js');
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ function withSentryConfig(
|
|
|
30
30
|
// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
|
31
31
|
const sentryPreprocessors = new Map();
|
|
32
32
|
|
|
33
|
-
const shouldTrackComponents = mergedOptions.componentTracking
|
|
33
|
+
const shouldTrackComponents = mergedOptions.componentTracking?.trackComponents;
|
|
34
34
|
if (shouldTrackComponents) {
|
|
35
35
|
const firstPassPreproc = preprocessors.componentTrackingPreprocessor(mergedOptions.componentTracking);
|
|
36
36
|
sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);
|
package/build/cjs/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';\n\nimport { componentTrackingPreprocessor, defaultComponentTrackingOptions } from './preprocessors';\nimport type { SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';\n\nconst DEFAULT_SENTRY_OPTIONS: SentrySvelteConfigOptions = {\n componentTracking: defaultComponentTrackingOptions,\n};\n\n/**\n * Add Sentry options to the Svelte config to be exported from the user's `svelte.config.js` file.\n *\n * @param originalConfig The existing config to be exported prior to adding Sentry\n * @param sentryOptions The configuration of the Sentry-added options\n *\n * @return The wrapped and modified config to be exported\n */\nexport function withSentryConfig(\n originalConfig: SvelteConfig,\n sentryOptions?: SentrySvelteConfigOptions,\n): SvelteConfig {\n const mergedOptions = {\n ...DEFAULT_SENTRY_OPTIONS,\n ...sentryOptions,\n };\n\n const originalPreprocessors = getOriginalPreprocessorArray(originalConfig);\n\n // Map is insertion-order-preserving. It's important to add preprocessors\n // to this map in the right order we want to see them being executed.\n // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n const sentryPreprocessors = new Map<string, SentryPreprocessorGroup>();\n\n const shouldTrackComponents = mergedOptions.componentTracking
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';\n\nimport { componentTrackingPreprocessor, defaultComponentTrackingOptions } from './preprocessors';\nimport type { SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';\n\nconst DEFAULT_SENTRY_OPTIONS: SentrySvelteConfigOptions = {\n componentTracking: defaultComponentTrackingOptions,\n};\n\n/**\n * Add Sentry options to the Svelte config to be exported from the user's `svelte.config.js` file.\n *\n * @param originalConfig The existing config to be exported prior to adding Sentry\n * @param sentryOptions The configuration of the Sentry-added options\n *\n * @return The wrapped and modified config to be exported\n */\nexport function withSentryConfig(\n originalConfig: SvelteConfig,\n sentryOptions?: SentrySvelteConfigOptions,\n): SvelteConfig {\n const mergedOptions = {\n ...DEFAULT_SENTRY_OPTIONS,\n ...sentryOptions,\n };\n\n const originalPreprocessors = getOriginalPreprocessorArray(originalConfig);\n\n // Map is insertion-order-preserving. It's important to add preprocessors\n // to this map in the right order we want to see them being executed.\n // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n const sentryPreprocessors = new Map<string, SentryPreprocessorGroup>();\n\n const shouldTrackComponents = mergedOptions.componentTracking?.trackComponents;\n if (shouldTrackComponents) {\n const firstPassPreproc: SentryPreprocessorGroup = componentTrackingPreprocessor(mergedOptions.componentTracking);\n sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);\n }\n\n // We prioritize user-added preprocessors, so we don't insert sentry processors if they\n // have already been added by users.\n originalPreprocessors.forEach((p: SentryPreprocessorGroup) => {\n if (p.sentryId) {\n sentryPreprocessors.delete(p.sentryId);\n }\n });\n\n const mergedPreprocessors = [...sentryPreprocessors.values(), ...originalPreprocessors];\n\n return {\n ...originalConfig,\n preprocess: mergedPreprocessors,\n };\n}\n\n/**\n * Standardizes the different ways the user-provided preprocessor option can be specified.\n * Users can specify an array of preprocessors, a single one or no preprocessor.\n *\n * @param originalConfig the user-provided svelte config oject\n * @return an array of preprocessors or an empty array if no preprocessors were specified\n */\nfunction getOriginalPreprocessorArray(originalConfig: SvelteConfig): PreprocessorGroup[] {\n if (originalConfig.preprocess) {\n if (Array.isArray(originalConfig.preprocess)) {\n return originalConfig.preprocess;\n }\n return [originalConfig.preprocess];\n }\n return [];\n}\n"],"names":["defaultComponentTrackingOptions","componentTrackingPreprocessor"],"mappings":";;;;AAKA,MAAM,sBAAsB,GAA8B;AAC1D,EAAE,iBAAiB,EAAEA,6CAA+B;AACpD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB;AAChC,EAAE,cAAc;AAChB,EAAE,aAAa;AACf,EAAgB;AAChB,EAAE,MAAM,gBAAgB;AACxB,IAAI,GAAG,sBAAsB;AAC7B,IAAI,GAAG,aAAa;AACpB,GAAG;;AAEH,EAAE,MAAM,qBAAsB,GAAE,4BAA4B,CAAC,cAAc,CAAC;;AAE5E;AACA;AACA;AACA,EAAE,MAAM,mBAAoB,GAAE,IAAI,GAAG,EAAmC;;AAExE,EAAE,MAAM,qBAAsB,GAAE,aAAa,CAAC,iBAAiB,EAAE,eAAe;AAChF,EAAE,IAAI,qBAAqB,EAAE;AAC7B,IAAI,MAAM,gBAAgB,GAA4BC,2CAA6B,CAAC,aAAa,CAAC,iBAAiB,CAAC;AACpH,IAAI,mBAAmB,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAA,IAAY,EAAE,EAAE,gBAAgB,CAAC;AAC9E;;AAEA;AACA;AACA,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,KAA8B;AAChE,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE;AACpB,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5C;AACA,GAAG,CAAC;;AAEJ,EAAE,MAAM,mBAAA,GAAsB,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,EAAE,GAAG,qBAAqB,CAAC;;AAEzF,EAAE,OAAO;AACT,IAAI,GAAG,cAAc;AACrB,IAAI,UAAU,EAAE,mBAAmB;AACnC,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,4BAA4B,CAAC,cAAc,EAAqC;AACzF,EAAE,IAAI,cAAc,CAAC,UAAU,EAAE;AACjC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE;AAClD,MAAM,OAAO,cAAc,CAAC,UAAU;AACtC;AACA,IAAI,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC;AACtC;AACA,EAAE,OAAO,EAAE;AACX;;;;"}
|
package/build/cjs/constants.js
CHANGED
package/build/cjs/index.js
CHANGED
package/build/cjs/performance.js
CHANGED
package/build/cjs/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const browser = require('@sentry/browser');
|
|
4
4
|
const core = require('@sentry/core');
|
|
@@ -56,8 +56,7 @@ function detectAndReportSvelteKit() {
|
|
|
56
56
|
* @see https://github.com/sveltejs/kit/issues/307 for more information
|
|
57
57
|
*/
|
|
58
58
|
function isSvelteKitApp() {
|
|
59
|
-
|
|
60
|
-
return core.getDomElement('div#svelte-announcer') !== null;
|
|
59
|
+
return !!browser.WINDOW.document.querySelector('div#svelte-announcer');
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
exports.detectAndReportSvelteKit = detectAndReportSvelteKit;
|
package/build/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 { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport type { Client, EventProcessor } from '@sentry/core';\nimport { applySdkMetadata
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { WINDOW } from '@sentry/browser';\nimport { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport type { Client, EventProcessor } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\n/**\n * Inits the Svelte SDK\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'svelte');\n\n const client = browserInit(opts);\n\n detectAndReportSvelteKit();\n\n return client;\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 identified\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 !!WINDOW.document.querySelector('div#svelte-announcer');\n}\n"],"names":["applySdkMetadata","browserInit","addEventProcessor","WINDOW"],"mappings":";;;;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEA,qBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC;;AAElC,EAAE,MAAM,MAAO,GAAEC,YAAW,CAAC,IAAI,CAAC;;AAElC,EAAE,wBAAwB,EAAE;;AAE5B,EAAE,OAAO,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,GAAS;AACjD,EAAE,IAAI,iBAAiB,GAAwB,SAAS;;AAExD,EAAE,MAAM,kBAAkB,GAAmB,SAAS;AACtD,IAAI,IAAI,iBAAkB,KAAI,SAAS,EAAE;AACzC,MAAM,iBAAkB,GAAE,cAAc,EAAE;AAC1C;AACA,IAAI,IAAI,iBAAiB,EAAE;AAC3B,MAAM,KAAK,CAAC,OAAA,GAAU;AACtB,QAAQ,SAAS,EAAE,QAAQ;AAC3B,QAAQ,GAAG,KAAK,CAAC,OAAO;AACxB,OAAO;AACP;AACA,IAAI,OAAO,KAAK;AAChB,GAAG;AACH,EAAE,kBAAkB,CAAC,EAAG,GAAE,oBAAoB;;AAE9C,EAAEC,yBAAiB,CAAC,kBAAkB,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C,EAAE,OAAO,CAAC,CAACC,cAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,sBAAsB,CAAC;AAChE;;;;;;"}
|
package/build/esm/config.js
CHANGED
|
@@ -28,7 +28,7 @@ function withSentryConfig(
|
|
|
28
28
|
// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
|
29
29
|
const sentryPreprocessors = new Map();
|
|
30
30
|
|
|
31
|
-
const shouldTrackComponents = mergedOptions.componentTracking
|
|
31
|
+
const shouldTrackComponents = mergedOptions.componentTracking?.trackComponents;
|
|
32
32
|
if (shouldTrackComponents) {
|
|
33
33
|
const firstPassPreproc = componentTrackingPreprocessor(mergedOptions.componentTracking);
|
|
34
34
|
sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);
|
package/build/esm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';\n\nimport { componentTrackingPreprocessor, defaultComponentTrackingOptions } from './preprocessors';\nimport type { SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';\n\nconst DEFAULT_SENTRY_OPTIONS: SentrySvelteConfigOptions = {\n componentTracking: defaultComponentTrackingOptions,\n};\n\n/**\n * Add Sentry options to the Svelte config to be exported from the user's `svelte.config.js` file.\n *\n * @param originalConfig The existing config to be exported prior to adding Sentry\n * @param sentryOptions The configuration of the Sentry-added options\n *\n * @return The wrapped and modified config to be exported\n */\nexport function withSentryConfig(\n originalConfig: SvelteConfig,\n sentryOptions?: SentrySvelteConfigOptions,\n): SvelteConfig {\n const mergedOptions = {\n ...DEFAULT_SENTRY_OPTIONS,\n ...sentryOptions,\n };\n\n const originalPreprocessors = getOriginalPreprocessorArray(originalConfig);\n\n // Map is insertion-order-preserving. It's important to add preprocessors\n // to this map in the right order we want to see them being executed.\n // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n const sentryPreprocessors = new Map<string, SentryPreprocessorGroup>();\n\n const shouldTrackComponents = mergedOptions.componentTracking
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';\n\nimport { componentTrackingPreprocessor, defaultComponentTrackingOptions } from './preprocessors';\nimport type { SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';\n\nconst DEFAULT_SENTRY_OPTIONS: SentrySvelteConfigOptions = {\n componentTracking: defaultComponentTrackingOptions,\n};\n\n/**\n * Add Sentry options to the Svelte config to be exported from the user's `svelte.config.js` file.\n *\n * @param originalConfig The existing config to be exported prior to adding Sentry\n * @param sentryOptions The configuration of the Sentry-added options\n *\n * @return The wrapped and modified config to be exported\n */\nexport function withSentryConfig(\n originalConfig: SvelteConfig,\n sentryOptions?: SentrySvelteConfigOptions,\n): SvelteConfig {\n const mergedOptions = {\n ...DEFAULT_SENTRY_OPTIONS,\n ...sentryOptions,\n };\n\n const originalPreprocessors = getOriginalPreprocessorArray(originalConfig);\n\n // Map is insertion-order-preserving. It's important to add preprocessors\n // to this map in the right order we want to see them being executed.\n // see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n const sentryPreprocessors = new Map<string, SentryPreprocessorGroup>();\n\n const shouldTrackComponents = mergedOptions.componentTracking?.trackComponents;\n if (shouldTrackComponents) {\n const firstPassPreproc: SentryPreprocessorGroup = componentTrackingPreprocessor(mergedOptions.componentTracking);\n sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);\n }\n\n // We prioritize user-added preprocessors, so we don't insert sentry processors if they\n // have already been added by users.\n originalPreprocessors.forEach((p: SentryPreprocessorGroup) => {\n if (p.sentryId) {\n sentryPreprocessors.delete(p.sentryId);\n }\n });\n\n const mergedPreprocessors = [...sentryPreprocessors.values(), ...originalPreprocessors];\n\n return {\n ...originalConfig,\n preprocess: mergedPreprocessors,\n };\n}\n\n/**\n * Standardizes the different ways the user-provided preprocessor option can be specified.\n * Users can specify an array of preprocessors, a single one or no preprocessor.\n *\n * @param originalConfig the user-provided svelte config oject\n * @return an array of preprocessors or an empty array if no preprocessors were specified\n */\nfunction getOriginalPreprocessorArray(originalConfig: SvelteConfig): PreprocessorGroup[] {\n if (originalConfig.preprocess) {\n if (Array.isArray(originalConfig.preprocess)) {\n return originalConfig.preprocess;\n }\n return [originalConfig.preprocess];\n }\n return [];\n}\n"],"names":[],"mappings":";;AAKA,MAAM,sBAAsB,GAA8B;AAC1D,EAAE,iBAAiB,EAAE,+BAA+B;AACpD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB;AAChC,EAAE,cAAc;AAChB,EAAE,aAAa;AACf,EAAgB;AAChB,EAAE,MAAM,gBAAgB;AACxB,IAAI,GAAG,sBAAsB;AAC7B,IAAI,GAAG,aAAa;AACpB,GAAG;;AAEH,EAAE,MAAM,qBAAsB,GAAE,4BAA4B,CAAC,cAAc,CAAC;;AAE5E;AACA;AACA;AACA,EAAE,MAAM,mBAAoB,GAAE,IAAI,GAAG,EAAmC;;AAExE,EAAE,MAAM,qBAAsB,GAAE,aAAa,CAAC,iBAAiB,EAAE,eAAe;AAChF,EAAE,IAAI,qBAAqB,EAAE;AAC7B,IAAI,MAAM,gBAAgB,GAA4B,6BAA6B,CAAC,aAAa,CAAC,iBAAiB,CAAC;AACpH,IAAI,mBAAmB,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAA,IAAY,EAAE,EAAE,gBAAgB,CAAC;AAC9E;;AAEA;AACA;AACA,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,KAA8B;AAChE,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE;AACpB,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5C;AACA,GAAG,CAAC;;AAEJ,EAAE,MAAM,mBAAA,GAAsB,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,EAAE,GAAG,qBAAqB,CAAC;;AAEzF,EAAE,OAAO;AACT,IAAI,GAAG,cAAc;AACrB,IAAI,UAAU,EAAE,mBAAmB;AACnC,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,4BAA4B,CAAC,cAAc,EAAqC;AACzF,EAAE,IAAI,cAAc,CAAC,UAAU,EAAE;AACjC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE;AAClD,MAAM,OAAO,cAAc,CAAC,UAAU;AACtC;AACA,IAAI,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC;AACtC;AACA,EAAE,OAAO,EAAE;AACX;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"
|
|
1
|
+
{"type":"module","version":"9.0.0-alpha.1","sideEffects":false}
|
package/build/esm/sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init as init$1, addEventProcessor } from '@sentry/browser';
|
|
2
|
-
import { applySdkMetadata
|
|
1
|
+
import { init as init$1, addEventProcessor, WINDOW } from '@sentry/browser';
|
|
2
|
+
import { applySdkMetadata } from '@sentry/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Inits the Svelte SDK
|
|
@@ -54,8 +54,7 @@ function detectAndReportSvelteKit() {
|
|
|
54
54
|
* @see https://github.com/sveltejs/kit/issues/307 for more information
|
|
55
55
|
*/
|
|
56
56
|
function isSvelteKitApp() {
|
|
57
|
-
|
|
58
|
-
return getDomElement('div#svelte-announcer') !== null;
|
|
57
|
+
return !!WINDOW.document.querySelector('div#svelte-announcer');
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
export { detectAndReportSvelteKit, init, isSvelteKitApp };
|
package/build/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 { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport type { Client, EventProcessor } from '@sentry/core';\nimport { applySdkMetadata
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { WINDOW } from '@sentry/browser';\nimport { addEventProcessor, init as browserInit } from '@sentry/browser';\nimport type { Client, EventProcessor } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\n/**\n * Inits the Svelte SDK\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'svelte');\n\n const client = browserInit(opts);\n\n detectAndReportSvelteKit();\n\n return client;\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 identified\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 !!WINDOW.document.querySelector('div#svelte-announcer');\n}\n"],"names":["browserInit"],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC;;AAElC,EAAE,MAAM,MAAO,GAAEA,MAAW,CAAC,IAAI,CAAC;;AAElC,EAAE,wBAAwB,EAAE;;AAE5B,EAAE,OAAO,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,GAAS;AACjD,EAAE,IAAI,iBAAiB,GAAwB,SAAS;;AAExD,EAAE,MAAM,kBAAkB,GAAmB,SAAS;AACtD,IAAI,IAAI,iBAAkB,KAAI,SAAS,EAAE;AACzC,MAAM,iBAAkB,GAAE,cAAc,EAAE;AAC1C;AACA,IAAI,IAAI,iBAAiB,EAAE;AAC3B,MAAM,KAAK,CAAC,OAAA,GAAU;AACtB,QAAQ,SAAS,EAAE,QAAQ;AAC3B,QAAQ,GAAG,KAAK,CAAC,OAAO;AACxB,OAAO;AACP;AACA,IAAI,OAAO,KAAK;AAChB,GAAG;AACH,EAAE,kBAAkB,CAAC,EAAG,GAAE,oBAAoB;;AAE9C,EAAE,iBAAiB,CAAC,kBAAkB,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,sBAAsB,CAAC;AAChE;;;;"}
|
package/build/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;AAGtD,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,cAAc,CAAC;AAE3D;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAYhE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAkB/C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha.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",
|
|
7
7
|
"author": "Sentry",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=18"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"/build"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"typesVersions": {
|
|
32
|
-
"<
|
|
32
|
+
"<5.0": {
|
|
33
33
|
"build/types/index.d.ts": [
|
|
34
34
|
"build/types-ts3.8/index.d.ts"
|
|
35
35
|
]
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sentry/browser": "
|
|
43
|
-
"@sentry/core": "
|
|
42
|
+
"@sentry/browser": "9.0.0-alpha.1",
|
|
43
|
+
"@sentry/core": "9.0.0-alpha.1",
|
|
44
44
|
"magic-string": "^0.30.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|