@sentry/browser 11.0.0-rc.1 → 11.0.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/build/npm/cjs/dev/helpers.js +24 -2
- package/build/npm/cjs/dev/helpers.js.map +1 -1
- package/build/npm/cjs/dev/integrations/globalhandlers.js +2 -1
- package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpclient.js +3 -6
- package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpcontext.js +6 -0
- package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spotlight.js +4 -1
- package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/dev/integrations/webWorker.js +73 -19
- package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
- package/build/npm/cjs/prod/helpers.js +24 -2
- package/build/npm/cjs/prod/helpers.js.map +1 -1
- package/build/npm/cjs/prod/integrations/globalhandlers.js +2 -1
- package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpclient.js +3 -6
- package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpcontext.js +6 -0
- package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spotlight.js +4 -1
- package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/prod/integrations/webWorker.js +73 -19
- package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
- package/build/npm/esm/dev/helpers.js +24 -3
- package/build/npm/esm/dev/helpers.js.map +1 -1
- package/build/npm/esm/dev/integrations/globalhandlers.js +2 -2
- package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpclient.js +3 -6
- package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpcontext.js +6 -0
- package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/spotlight.js +4 -1
- package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/dev/integrations/webWorker.js +77 -23
- package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
- package/build/npm/esm/dev/package.json +1 -1
- package/build/npm/esm/prod/helpers.js +24 -3
- package/build/npm/esm/prod/helpers.js.map +1 -1
- package/build/npm/esm/prod/integrations/globalhandlers.js +2 -2
- package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpclient.js +3 -6
- package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpcontext.js +6 -0
- package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/spotlight.js +4 -1
- package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/prod/integrations/webWorker.js +77 -23
- package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
- package/build/npm/esm/prod/package.json +1 -1
- package/build/npm/types/helpers.d.ts +10 -2
- package/build/npm/types/helpers.d.ts.map +1 -1
- package/build/npm/types/integrations/globalhandlers.d.ts +4 -0
- package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
- package/build/npm/types/integrations/httpcontext.d.ts.map +1 -1
- package/build/npm/types/integrations/spotlight.d.ts +9 -2
- package/build/npm/types/integrations/spotlight.d.ts.map +1 -1
- package/build/npm/types/integrations/webWorker.d.ts +5 -4
- package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpcontext.js","sources":["../../../../../src/integrations/httpcontext.ts"],"sourcesContent":["import { _INTERNAL_filterKeyValueData, defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core';\nimport { getHttpRequestData, WINDOW } from '../helpers';\nimport { filterCollectedUrl } from '@sentry/core';\nimport { HTTP_REQUEST_HEADER_KEY_BASE, SENTRY_OP, URL_FULL, USER_AGENT_ORIGINAL } from '@sentry/conventions/attributes';\n\n/**\n * Collects information about HTTP request headers and\n * attaches them to the event.\n */\nexport const httpContextIntegration = defineIntegration(() => {\n return {\n name: 'HttpContext' as const,\n preprocessEvent(event, _hint, client) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const { url, headers: collectedHeaders } = getHttpRequestData();\n\n // We only filter the headers we collected ourselves, so headers the user set are left alone. Going by key\n // means we also catch these headers when `browserTracingIntegration` already put them on the event.\n const behavior = client.getDataCollectionOptions().httpHeaders.request;\n const userHeaders = Object.entries(event.request?.headers ?? {}).filter(([key]) => !(key in collectedHeaders));\n\n const headers = {\n ..._INTERNAL_filterKeyValueData(collectedHeaders, behavior),\n ...Object.fromEntries(userHeaders),\n };\n\n event.request = {\n // The URL isn't gated by `dataCollection`, same as on the server.\n url,\n ...event.request,\n ...(Object.keys(headers).length > 0 ? { headers } : { headers: undefined }),\n };\n },\n\n processSpan(span, client) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const reqData = getHttpRequestData();\n\n // `httpHeadersToSpanAttributes` would also work here, but its cookie and array handling never runs for these\n // two headers and costs every browser bundle ~400B gzip.\n const headers = _INTERNAL_filterKeyValueData(\n reqData.headers,\n client.getDataCollectionOptions().httpHeaders.request,\n );\n const referer = headers['Referer'];\n\n safeSetSpanJSONAttributes(span, {\n // This attribute is used by the \"Filter out events from legacy browsers and crawlers\" features on the Sentry backend.\n // Therefore, it's set on every span.\n [USER_AGENT_ORIGINAL]: headers['User-Agent'],\n\n // These attributes, we only need on the segment span (analogous to the `request` context for events)\n ...(span.is_segment && {\n // Coerce empty string to undefined so the helper's nullish check drops it,\n // rather than writing an empty `url.full` attribute onto the span.\n [URL_FULL]: span.attributes?.[SENTRY_OP] !== 'http.client' ? filterCollectedUrl(reqData.url) : undefined,\n [`${HTTP_REQUEST_HEADER_KEY_BASE}.referer`]: referer ? [referer] : undefined,\n }),\n });\n },\n };\n});\n"],"names":[],"mappings":";;;;AASO,MAAM,sBAAA,GAAyB,kBAAkB,MAAM;AAC5D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,eAAA,CAAgB,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ;AAEpC,MAAA,IAAI,CAAC,OAAO,SAAA,IAAa,CAAC,OAAO,QAAA,IAAY,CAAC,OAAO,QAAA,EAAU;AAC7D,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,EAAE,GAAA,EAAK,OAAA,EAAS,gBAAA,KAAqB,kBAAA,EAAmB;AAI9D,MAAA,MAAM,QAAA,GAAW,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAA,CAAY,OAAA;AAC/D,MAAA,MAAM,cAAc,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,OAAA,EAAS,WAAW,EAAE,CAAA,CAAE,MAAA,CAAO,CAAC,CAAC,GAAG,CAAA,KAAM,EAAE,OAAO,gBAAA,CAAiB,CAAA;AAE7G,MAAA,MAAM,OAAA,GAAU;AAAA,QACd,GAAG,4BAAA,CAA6B,gBAAA,EAAkB,QAAQ,CAAA;AAAA,QAC1D,GAAG,MAAA,CAAO,WAAA,CAAY,WAAW;AAAA,OACnC;AAEA,MAAA,KAAA,CAAM,OAAA,GAAU;AAAA;AAAA,QAEd,GAAA;AAAA,QACA,GAAG,KAAA,CAAM,OAAA;AAAA,QACT,GAAI,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA,CAAE,MAAA,GAAS,CAAA,GAAI,EAAE,OAAA,EAAQ,GAAI,EAAE,OAAA,EAAS,MAAA;AAAU,OAC3E;AAAA,IACF,CAAA;AAAA,IAEA,WAAA,CAAY,MAAM,MAAA,EAAQ;AAExB,MAAA,IAAI,CAAC,OAAO,SAAA,IAAa,CAAC,OAAO,QAAA,IAAY,CAAC,OAAO,QAAA,EAAU;AAC7D,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAU,kBAAA,EAAmB;AAInC,MAAA,MAAM,OAAA,GAAU,4BAAA;AAAA,QACd,OAAA,CAAQ,OAAA;AAAA,QACR,MAAA,CAAO,wBAAA,EAAyB,CAAE,WAAA,CAAY;AAAA,OAChD;AACA,MAAA,MAAM,OAAA,GAAU,QAAQ,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"httpcontext.js","sources":["../../../../../src/integrations/httpcontext.ts"],"sourcesContent":["import { _INTERNAL_filterKeyValueData, defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core';\nimport { getHttpRequestData, WINDOW } from '../helpers';\nimport { filterCollectedUrl } from '@sentry/core';\nimport { HTTP_REQUEST_HEADER_KEY_BASE, SENTRY_OP, URL_FULL, USER_AGENT_ORIGINAL } from '@sentry/conventions/attributes';\n\n/**\n * Collects information about HTTP request headers and\n * attaches them to the event.\n */\nexport const httpContextIntegration = defineIntegration(() => {\n return {\n name: 'HttpContext' as const,\n preprocessEvent(event, _hint, client) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const { url, headers: collectedHeaders } = getHttpRequestData();\n\n // We only filter the headers we collected ourselves, so headers the user set are left alone. Going by key\n // means we also catch these headers when `browserTracingIntegration` already put them on the event.\n const behavior = client.getDataCollectionOptions().httpHeaders.request;\n const userHeaders = Object.entries(event.request?.headers ?? {}).filter(([key]) => !(key in collectedHeaders));\n\n const headers = {\n ..._INTERNAL_filterKeyValueData(collectedHeaders, behavior),\n ...Object.fromEntries(userHeaders),\n };\n\n event.request = {\n // The URL isn't gated by `dataCollection`, same as on the server.\n url,\n ...event.request,\n ...(Object.keys(headers).length > 0 ? { headers } : { headers: undefined }),\n };\n },\n\n processSpan(span, client) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const reqData = getHttpRequestData();\n\n // `httpHeadersToSpanAttributes` would also work here, but its cookie and array handling never runs for these\n // two headers and costs every browser bundle ~400B gzip.\n const headers = _INTERNAL_filterKeyValueData(\n reqData.headers,\n client.getDataCollectionOptions().httpHeaders.request,\n );\n const referer = headers['Referer'];\n const { hostname, protocol } = WINDOW.location || {};\n\n safeSetSpanJSONAttributes(span, {\n // This attribute is used by the \"Filter out events from legacy browsers and crawlers\" features on the Sentry backend.\n // Therefore, it's set on every span.\n [USER_AGENT_ORIGINAL]: headers['User-Agent'],\n\n // Likewise for the \"Filter out localhost events\" feature. Deliberately inlined rather than\n // sharing the server-side helper, which costs bundle size for request headers and IPs that\n // don't exist here. Mirrors Relay's localhost filter (relay-filter/src/localhost.rs).\n 'sentry.is_localhost':\n protocol === 'file:' ||\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n // `location.hostname` keeps the brackets for IPv6 hosts, so this is `[::1]`, not `::1`.\n hostname === '[::1]' ||\n !!hostname?.endsWith('.localhost'),\n\n // These attributes, we only need on the segment span (analogous to the `request` context for events)\n ...(span.is_segment && {\n // Coerce empty string to undefined so the helper's nullish check drops it,\n // rather than writing an empty `url.full` attribute onto the span.\n [URL_FULL]: span.attributes?.[SENTRY_OP] !== 'http.client' ? filterCollectedUrl(reqData.url) : undefined,\n [`${HTTP_REQUEST_HEADER_KEY_BASE}.referer`]: referer ? [referer] : undefined,\n }),\n });\n },\n };\n});\n"],"names":[],"mappings":";;;;AASO,MAAM,sBAAA,GAAyB,kBAAkB,MAAM;AAC5D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,eAAA,CAAgB,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ;AAEpC,MAAA,IAAI,CAAC,OAAO,SAAA,IAAa,CAAC,OAAO,QAAA,IAAY,CAAC,OAAO,QAAA,EAAU;AAC7D,QAAA;AAAA,MACF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,EAAM;AAAA;AAAA;AAAA,QAG9B,CAAC,mBAAmB,GAAG,OAAA,CAAQ,YAAY,CAAA;AAAA;AAAA;AAAA;AAAA,QAK3C,qBAAA,EACE,QAAA,KAAa,OAAA,IACb,QAAA,KAAa,eACb,QAAA,KAAa,WAAA;AAAA,QAEb,aAAa,OAAA,IACb,CAAC,CAAC,QAAA,EAAU,SAAS,YAAY,CAAA;AAAA;AAAA,QAGnC,GAAI,KAAK,UAAA,IAAc;AAAA;AAAA;AAAA,UAGrB,CAAC,QAAQ,GAAG,IAAA,CAAK,UAAA,GAAa,SAAS,CAAA,KAAM,aAAA,GAAgB,kBAAA,CAAmB,OAAA,CAAQ,GAAG,CAAA,GAAI,MAAA;AAAA,UAC/F,CAAC,GAAG,4BAA4B,CAAA,QAAA,CAAU,GAAG,OAAA,GAAU,CAAC,OAAO,CAAA,GAAI;AAAA;AACrE,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -4,7 +4,10 @@ import { UI_INTERACTION_CLICK } from '@sentry/conventions/op';
|
|
|
4
4
|
import { DEBUG_BUILD } from '../debug-build.js';
|
|
5
5
|
|
|
6
6
|
const INTEGRATION_NAME = "SpotlightBrowser";
|
|
7
|
-
const SPOTLIGHT_IGNORE_SPANS = [
|
|
7
|
+
const SPOTLIGHT_IGNORE_SPANS = [
|
|
8
|
+
{ op: UI_INTERACTION_CLICK, name: "#sentry-spotlight" },
|
|
9
|
+
{ op: UI_INTERACTION_CLICK, attributes: { "browser.web_vital.inp.target": "#sentry-spotlight" } }
|
|
10
|
+
];
|
|
8
11
|
const _spotlightIntegration = ((options = {}) => {
|
|
9
12
|
const sidecarUrl = options.sidecarUrl || "http://localhost:8969/stream";
|
|
10
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sources":["../../../../../src/integrations/spotlight.ts"],"sourcesContent":["import type { Client, Envelope, IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, serializeEnvelope } from '@sentry/core';\nimport { getNativeImplementation } from '@sentry/browser-utils';\nimport { UI_INTERACTION_CLICK } from '@sentry/conventions/op';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WINDOW } from '../helpers';\n\nexport type SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'SpotlightBrowser' as const;\n\nexport const SPOTLIGHT_IGNORE_SPANS = [{ op: UI_INTERACTION_CLICK, name: '#sentry-spotlight' }];\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';\n\n return {\n name: INTEGRATION_NAME,\n setup: () => {\n DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);\n },\n beforeSetup(client: Client) {\n const opts = client.getOptions();\n opts.ignoreSpans = [...(opts.ignoreSpans || []), ...SPOTLIGHT_IGNORE_SPANS];\n },\n afterAllSetup: (client: Client) => {\n setupSidecarForwarding(client, sidecarUrl);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction setupSidecarForwarding(client: Client, sidecarUrl: string): void {\n const makeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch');\n let failCount = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failCount > 3) {\n debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:', failCount);\n return;\n }\n\n makeFetch(sidecarUrl, {\n method: 'POST',\n body: serializeEnvelope(envelope) as BodyInit,\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n mode: 'cors',\n }).then(\n res => {\n if (res.status >= 200 && res.status < 400) {\n // Reset failed requests counter on success\n failCount = 0;\n }\n },\n err => {\n failCount++;\n debug.error(\n \"Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/\",\n err,\n );\n },\n );\n });\n}\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);\n"],"names":[],"mappings":";;;;;AAeO,MAAM,gBAAA,GAAmB;AAEzB,MAAM,
|
|
1
|
+
{"version":3,"file":"spotlight.js","sources":["../../../../../src/integrations/spotlight.ts"],"sourcesContent":["import type { Client, Envelope, IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, serializeEnvelope } from '@sentry/core';\nimport { getNativeImplementation } from '@sentry/browser-utils';\nimport { UI_INTERACTION_CLICK } from '@sentry/conventions/op';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WINDOW } from '../helpers';\n\nexport type SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'SpotlightBrowser' as const;\n\nexport const SPOTLIGHT_IGNORE_SPANS = [\n { op: UI_INTERACTION_CLICK, name: '#sentry-spotlight' },\n { op: UI_INTERACTION_CLICK, attributes: { 'browser.web_vital.inp.target': '#sentry-spotlight' } },\n];\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';\n\n return {\n name: INTEGRATION_NAME,\n setup: () => {\n DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);\n },\n beforeSetup(client: Client) {\n const opts = client.getOptions();\n opts.ignoreSpans = [...(opts.ignoreSpans || []), ...SPOTLIGHT_IGNORE_SPANS];\n },\n afterAllSetup: (client: Client) => {\n setupSidecarForwarding(client, sidecarUrl);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction setupSidecarForwarding(client: Client, sidecarUrl: string): void {\n const makeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch');\n let failCount = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failCount > 3) {\n debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:', failCount);\n return;\n }\n\n makeFetch(sidecarUrl, {\n method: 'POST',\n body: serializeEnvelope(envelope) as BodyInit,\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n mode: 'cors',\n }).then(\n res => {\n if (res.status >= 200 && res.status < 400) {\n // Reset failed requests counter on success\n failCount = 0;\n }\n },\n err => {\n failCount++;\n debug.error(\n \"Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/\",\n err,\n );\n },\n );\n });\n}\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);\n"],"names":[],"mappings":";;;;;AAeO,MAAM,gBAAA,GAAmB;AAEzB,MAAM,sBAAA,GAAyB;AAAA,EACpC,EAAE,EAAA,EAAI,oBAAA,EAAsB,IAAA,EAAM,mBAAA,EAAoB;AAAA,EACtD,EAAE,EAAA,EAAI,oBAAA,EAAsB,YAAY,EAAE,8BAAA,EAAgC,qBAAoB;AAChG;AAEA,MAAM,qBAAA,IAAyB,CAAC,OAAA,GAA+C,EAAC,KAAM;AACpF,EAAA,MAAM,UAAA,GAAa,QAAQ,UAAA,IAAc,8BAAA;AAEzC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,OAAO,MAAM;AACX,MAAA,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,mBAAA,EAAqB,UAAU,CAAA;AAAA,IAC1D,CAAA;AAAA,IACA,YAAY,MAAA,EAAgB;AAC1B,MAAA,MAAM,IAAA,GAAO,OAAO,UAAA,EAAW;AAC/B,MAAA,IAAA,CAAK,WAAA,GAAc,CAAC,GAAI,IAAA,CAAK,eAAe,EAAC,EAAI,GAAG,sBAAsB,CAAA;AAAA,IAC5E,CAAA;AAAA,IACA,aAAA,EAAe,CAAC,MAAA,KAAmB;AACjC,MAAA,sBAAA,CAAuB,QAAQ,UAAU,CAAA;AAAA,IAC3C;AAAA,GACF;AACF,CAAA,CAAA;AAEA,SAAS,sBAAA,CAAuB,QAAgB,UAAA,EAA0B;AACxE,EAAA,MAAM,SAAA,GAA6C,wBAAwB,OAAO,CAAA;AAClF,EAAA,IAAI,SAAA,GAAY,CAAA;AAEhB,EAAA,MAAA,CAAO,EAAA,CAAG,gBAAA,EAAkB,CAAC,QAAA,KAAuB;AAClD,IAAA,IAAI,YAAY,CAAA,EAAG;AACjB,MAAA,KAAA,CAAM,IAAA,CAAK,yFAAyF,SAAS,CAAA;AAC7G,MAAA;AAAA,IACF;AAEA,IAAA,SAAA,CAAU,UAAA,EAAY;AAAA,MACpB,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,kBAAkB,QAAQ,CAAA;AAAA,MAChC,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB;AAAA,OAClB;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA,CAAE,IAAA;AAAA,MACD,CAAA,GAAA,KAAO;AACL,QAAA,IAAI,GAAA,CAAI,MAAA,IAAU,GAAA,IAAO,GAAA,CAAI,SAAS,GAAA,EAAK;AAEzC,UAAA,SAAA,GAAY,CAAA;AAAA,QACd;AAAA,MACF,CAAA;AAAA,MACA,CAAA,GAAA,KAAO;AACL,QAAA,SAAA,EAAA;AACA,QAAA,KAAA,CAAM,KAAA;AAAA,UACJ,8FAAA;AAAA,UACA;AAAA,SACF;AAAA,MACF;AAAA,KACF;AAAA,EACF,CAAC,CAAA;AACH;AAOO,MAAM,2BAAA,GAA8B,kBAAkB,qBAAqB;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineIntegration, debug, isPlainObject, getClient, isPrimitive, captureEvent } from '@sentry/core';
|
|
1
|
+
import { defineIntegration, debug, isPlainObject, isError, addNonEnumerableProperty, getClient, isPrimitive, captureEvent, normalize } from '@sentry/core';
|
|
2
2
|
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
-
import { eventFromUnknownInput } from '../eventbuilder.js';
|
|
4
|
-
import { WINDOW } from '../helpers.js';
|
|
5
|
-
import { _eventFromRejectionWithPrimitive, _getUnhandledRejectionError } from './globalhandlers.js';
|
|
3
|
+
import { eventFromUnknownInput, extractType, extractMessage } from '../eventbuilder.js';
|
|
4
|
+
import { ignoreNextOnErrorMatching, WINDOW } from '../helpers.js';
|
|
5
|
+
import { _eventFromRejectionWithPrimitive, _enhanceEventWithInitialFrame, _getUnhandledRejectionError } from './globalhandlers.js';
|
|
6
6
|
|
|
7
7
|
const INTEGRATION_NAME = "WebWorker";
|
|
8
|
+
const MAX_FORWARDED_ERRORS = 20;
|
|
8
9
|
const webWorkerIntegration = defineIntegration(({ worker }) => ({
|
|
9
10
|
name: INTEGRATION_NAME,
|
|
10
11
|
setupOnce: () => {
|
|
@@ -13,6 +14,16 @@ const webWorkerIntegration = defineIntegration(({ worker }) => ({
|
|
|
13
14
|
addWorker: (worker2) => listenForSentryMessages(worker2)
|
|
14
15
|
}));
|
|
15
16
|
function listenForSentryMessages(worker) {
|
|
17
|
+
const forwardedErrors = [];
|
|
18
|
+
worker.addEventListener("error", ({ message, filename, lineno, colno }) => {
|
|
19
|
+
const index = forwardedErrors.findIndex(
|
|
20
|
+
(e) => e.message === message && e.url === filename && e.lineno === lineno && e.colno === colno
|
|
21
|
+
);
|
|
22
|
+
if (index !== -1) {
|
|
23
|
+
forwardedErrors.splice(0, index + 1);
|
|
24
|
+
ignoreNextOnErrorMatching({ msg: message, url: filename, line: lineno, column: colno });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
worker.addEventListener("message", (event) => {
|
|
17
28
|
if (isSentryMessage(event.data)) {
|
|
18
29
|
event.stopImmediatePropagation();
|
|
@@ -44,27 +55,40 @@ function listenForSentryMessages(worker) {
|
|
|
44
55
|
];
|
|
45
56
|
}
|
|
46
57
|
if (event.data._sentryWorkerError) {
|
|
47
|
-
DEBUG_BUILD && debug.log("Sentry worker
|
|
48
|
-
|
|
58
|
+
DEBUG_BUILD && debug.log("Sentry worker error message received", event.data._sentryWorkerError);
|
|
59
|
+
const { kind, message, url, lineno, colno } = event.data._sentryWorkerError;
|
|
60
|
+
if (kind === "error") {
|
|
61
|
+
if (forwardedErrors.push({ message, url, lineno, colno }) > MAX_FORWARDED_ERRORS) {
|
|
62
|
+
forwardedErrors.shift();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleForwardedWorkerError(event.data._sentryWorkerError);
|
|
49
66
|
}
|
|
50
67
|
}
|
|
51
68
|
});
|
|
52
69
|
}
|
|
53
|
-
function
|
|
70
|
+
function handleForwardedWorkerError(workerError) {
|
|
71
|
+
const { reason, kind, name, filename, url, lineno, colno, plainError } = workerError;
|
|
72
|
+
const isUnhandledRejection = kind !== "error";
|
|
73
|
+
const error = plainError && isPlainObject(reason) ? errorFromPlain(reason) : reason;
|
|
74
|
+
if (name && isError(error) && error.name !== name) {
|
|
75
|
+
addNonEnumerableProperty(error, "name", name);
|
|
76
|
+
}
|
|
54
77
|
const client = getClient();
|
|
55
78
|
if (!client) {
|
|
56
79
|
return;
|
|
57
80
|
}
|
|
58
|
-
const stackParser = client.getOptions()
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
const { stackParser, attachStacktrace } = client.getOptions();
|
|
82
|
+
const event = isUnhandledRejection && isPrimitive(error) ? _eventFromRejectionWithPrimitive(error) : eventFromUnknownInput(stackParser, error, void 0, attachStacktrace, isUnhandledRejection);
|
|
83
|
+
if (!isUnhandledRejection) {
|
|
84
|
+
_enhanceEventWithInitialFrame(event, url || filename, lineno, colno);
|
|
85
|
+
}
|
|
62
86
|
event.level = "error";
|
|
63
|
-
if (
|
|
87
|
+
if (filename) {
|
|
64
88
|
event.contexts = {
|
|
65
89
|
...event.contexts,
|
|
66
90
|
worker: {
|
|
67
|
-
filename
|
|
91
|
+
filename
|
|
68
92
|
}
|
|
69
93
|
};
|
|
70
94
|
}
|
|
@@ -72,30 +96,60 @@ function handleForwardedWorkerRejection(workerError) {
|
|
|
72
96
|
originalException: error,
|
|
73
97
|
mechanism: {
|
|
74
98
|
handled: false,
|
|
75
|
-
type: "auto.browser.web_worker.onunhandledrejection"
|
|
99
|
+
type: isUnhandledRejection ? "auto.browser.web_worker.onunhandledrejection" : "auto.browser.web_worker.onerror"
|
|
76
100
|
}
|
|
77
101
|
});
|
|
78
|
-
DEBUG_BUILD && debug.log(
|
|
102
|
+
DEBUG_BUILD && debug.log(`Captured worker ${isUnhandledRejection ? "unhandled rejection" : "error"}`, error);
|
|
79
103
|
}
|
|
80
104
|
function registerWebWorker({ self }) {
|
|
105
|
+
Error.stackTraceLimit = 50;
|
|
81
106
|
self.postMessage({
|
|
82
107
|
_sentryMessage: true,
|
|
83
108
|
_sentryDebugIds: self._sentryDebugIds ?? void 0,
|
|
84
109
|
_sentryModuleMetadata: self._sentryModuleMetadata ?? void 0
|
|
85
110
|
});
|
|
111
|
+
const forward = (serializedError) => {
|
|
112
|
+
const { reason } = serializedError;
|
|
113
|
+
DEBUG_BUILD && debug.log(`[Sentry Worker] Forwarding ${serializedError.kind} to parent`, serializedError);
|
|
114
|
+
postSerializedWorkerError(self, {
|
|
115
|
+
...serializedError,
|
|
116
|
+
filename: self.location?.href,
|
|
117
|
+
name: isError(reason) ? extractType(reason) : void 0
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
self.addEventListener("error", (event) => {
|
|
121
|
+
const { error, message, filename, lineno, colno } = event;
|
|
122
|
+
forward({ kind: "error", reason: error ?? message, message, url: filename, lineno, colno });
|
|
123
|
+
});
|
|
86
124
|
self.addEventListener("unhandledrejection", (event) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
125
|
+
forward({ kind: "unhandledrejection", reason: _getUnhandledRejectionError(event) });
|
|
126
|
+
});
|
|
127
|
+
DEBUG_BUILD && debug.log("[Sentry Worker] Registered worker with error and unhandled rejection handling");
|
|
128
|
+
}
|
|
129
|
+
function postSerializedWorkerError(self, serializedError) {
|
|
130
|
+
try {
|
|
92
131
|
self.postMessage({
|
|
93
132
|
_sentryMessage: true,
|
|
94
133
|
_sentryWorkerError: serializedError
|
|
95
134
|
});
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
135
|
+
return;
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
const { reason } = serializedError;
|
|
139
|
+
const plainError = isError(reason);
|
|
140
|
+
const plainReason = plainError ? { message: extractMessage(reason), stack: reason.stack } : normalize(reason);
|
|
141
|
+
try {
|
|
142
|
+
self.postMessage({
|
|
143
|
+
_sentryMessage: true,
|
|
144
|
+
_sentryWorkerError: { ...serializedError, reason: plainReason, plainError }
|
|
145
|
+
});
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function errorFromPlain(plain) {
|
|
150
|
+
const error = new Error(String(plain.message));
|
|
151
|
+
error.stack = typeof plain.stack === "string" ? plain.stack : void 0;
|
|
152
|
+
return error;
|
|
99
153
|
}
|
|
100
154
|
function isSentryMessage(eventData) {
|
|
101
155
|
if (!isPlainObject(eventData) || eventData._sentryMessage !== true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webWorker.js","sources":["../../../../../src/integrations/webWorker.ts"],"sourcesContent":["import type { DebugImage, Integration, IntegrationFn } from '@sentry/core';\nimport { captureEvent, debug, defineIntegration, getClient, isPlainObject, isPrimitive } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { WINDOW } from '../helpers';\nimport { _eventFromRejectionWithPrimitive, _getUnhandledRejectionError } from './globalhandlers';\n\nexport const INTEGRATION_NAME = 'WebWorker' as const;\n\ninterface WebWorkerMessage {\n _sentryMessage: boolean;\n _sentryDebugIds?: Record<string, string>;\n _sentryModuleMetadata?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n _sentryWorkerError?: SerializedWorkerError;\n _sentryWasmImages?: Array<DebugImage>;\n}\n\ninterface SerializedWorkerError {\n reason: unknown;\n filename?: string;\n}\n\ninterface WebWorkerIntegrationOptions {\n worker: Worker | Array<Worker>;\n}\n\ninterface WebWorkerIntegration extends Integration {\n addWorker: (worker: Worker) => void;\n}\n\n/**\n * Use this integration to set up Sentry with web workers.\n *\n * IMPORTANT: This integration must be added **before** you start listening to\n * any messages from the worker. Otherwise, your message handlers will receive\n * messages from the Sentry SDK which you need to ignore.\n *\n * This integration only has an effect, if you call `Sentry.registerWebWorker(self)`\n * from within the worker(s) you're adding to the integration.\n *\n * Given that you want to initialize the SDK as early as possible, you most likely\n * want to add this integration **after** initializing the SDK:\n *\n * @example:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // some time earlier:\n * Sentry.init(...)\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Add the integration\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * If you initialize multiple workers at the same time, you can also pass an array of workers\n * to the integration:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: [worker1, worker2] });\n * Sentry.addIntegration(webWorkerIntegration);\n * ```\n *\n * If you have any additional workers that you initialize at a later point,\n * you can add them to the integration as follows:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: worker1 });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // sometime later:\n * webWorkerIntegration.addWorker(worker2);\n * ```\n *\n * Of course, you can also directly add the integration in Sentry.init:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Initialize the SDK\n * Sentry.init({\n * integrations: [Sentry.webWorkerIntegration({ worker })]\n * });\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * @param options {WebWorkerIntegrationOptions} Integration options:\n * - `worker`: The worker instance.\n */\nexport const webWorkerIntegration = defineIntegration(({ worker }: WebWorkerIntegrationOptions) => ({\n name: INTEGRATION_NAME,\n setupOnce: () => {\n (Array.isArray(worker) ? worker : [worker]).forEach(w => listenForSentryMessages(w));\n },\n addWorker: (worker: Worker) => listenForSentryMessages(worker),\n})) as IntegrationFn<WebWorkerIntegration>;\n\nfunction listenForSentryMessages(worker: Worker): void {\n worker.addEventListener('message', event => {\n if (isSentryMessage(event.data)) {\n event.stopImmediatePropagation(); // other listeners should not receive this message\n\n // Handle debug IDs\n if (event.data._sentryDebugIds) {\n DEBUG_BUILD && debug.log('Sentry debugId web worker message received', event.data);\n WINDOW._sentryDebugIds = {\n ...event.data._sentryDebugIds,\n // debugIds of the main thread have precedence over the worker's in case of a collision.\n ...WINDOW._sentryDebugIds,\n };\n }\n\n // Handle module metadata\n if (event.data._sentryModuleMetadata) {\n DEBUG_BUILD && debug.log('Sentry module metadata web worker message received', event.data);\n // Merge worker's raw metadata into the global object\n // It will be parsed lazily when needed by getMetadataForUrl\n WINDOW._sentryModuleMetadata = {\n ...event.data._sentryModuleMetadata,\n // Module metadata of the main thread have precedence over the worker's in case of a collision.\n ...WINDOW._sentryModuleMetadata,\n };\n }\n\n // Handle WASM images from worker\n if (event.data._sentryWasmImages) {\n DEBUG_BUILD && debug.log('Sentry WASM images web worker message received', event.data);\n const existingImages =\n (WINDOW as typeof WINDOW & { _sentryWasmImages?: Array<DebugImage> })._sentryWasmImages || [];\n const newImages = event.data._sentryWasmImages.filter(\n (newImg: unknown) =>\n isPlainObject(newImg) &&\n typeof newImg.code_file === 'string' &&\n !existingImages.some(existing => existing.code_file === newImg.code_file),\n );\n (WINDOW as typeof WINDOW & { _sentryWasmImages?: Array<DebugImage> })._sentryWasmImages = [\n ...existingImages,\n ...newImages,\n ];\n }\n\n // Handle unhandled rejections forwarded from worker\n if (event.data._sentryWorkerError) {\n DEBUG_BUILD && debug.log('Sentry worker rejection message received', event.data._sentryWorkerError);\n handleForwardedWorkerRejection(event.data._sentryWorkerError);\n }\n }\n });\n}\n\nfunction handleForwardedWorkerRejection(workerError: SerializedWorkerError): void {\n const client = getClient();\n if (!client) {\n return;\n }\n\n const stackParser = client.getOptions().stackParser;\n const attachStacktrace = client.getOptions().attachStacktrace;\n\n const error = workerError.reason;\n\n // Follow same pattern as globalHandlers for unhandledrejection\n // Handle both primitives and errors the same way\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n // Add worker-specific context\n if (workerError.filename) {\n event.contexts = {\n ...event.contexts,\n worker: {\n filename: workerError.filename,\n },\n };\n }\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.web_worker.onunhandledrejection',\n },\n });\n\n DEBUG_BUILD && debug.log('Captured worker unhandled rejection', error);\n}\n\n/**\n * Minimal interface for DedicatedWorkerGlobalScope, only requiring the postMessage method.\n * (which is the only thing we need from the worker's global object)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope\n *\n * We can't use the actual type because it breaks everyone who doesn't have {\"lib\": [\"WebWorker\"]}\n * but uses {\"skipLibCheck\": true} in their tsconfig.json.\n */\ninterface MinimalDedicatedWorkerGlobalScope {\n postMessage: (message: unknown) => void;\n addEventListener: (type: string, listener: (event: unknown) => void) => void;\n location?: { href?: string };\n}\n\ninterface RegisterWebWorkerOptions {\n self: MinimalDedicatedWorkerGlobalScope & {\n _sentryDebugIds?: Record<string, string>;\n _sentryModuleMetadata?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n };\n}\n\n/**\n * Use this function to register the worker with the Sentry SDK.\n *\n * This function will:\n * - Send debug IDs to the parent thread\n * - Send module metadata to the parent thread (for thirdPartyErrorFilterIntegration)\n * - Set up a handler for unhandled rejections in the worker\n * - Forward unhandled rejections to the parent thread for capture\n *\n * Note: Synchronous errors in workers are already captured by globalHandlers.\n * This only handles unhandled promise rejections which don't bubble to the parent.\n *\n * @example\n * ```ts filename={worker.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // Do this as early as possible in your worker.\n * Sentry.registerWebWorker({ self });\n *\n * // continue setting up your worker\n * self.postMessage(...)\n * ```\n * @param options {RegisterWebWorkerOptions} Integration options:\n * - `self`: The worker instance you're calling this function from (self).\n */\nexport function registerWebWorker({ self }: RegisterWebWorkerOptions): void {\n // Send debug IDs and raw module metadata to parent thread\n // The metadata will be parsed lazily on the main thread when needed\n self.postMessage({\n _sentryMessage: true,\n _sentryDebugIds: self._sentryDebugIds ?? undefined,\n _sentryModuleMetadata: self._sentryModuleMetadata ?? undefined,\n });\n\n // Set up unhandledrejection handler inside the worker\n // Following the same pattern as globalHandlers\n // unhandled rejections don't bubble to the parent thread, so we need to handle them here\n self.addEventListener('unhandledrejection', (event: unknown) => {\n const reason = _getUnhandledRejectionError(event);\n\n // Forward the raw reason to parent thread\n // The parent will handle primitives vs errors the same way globalHandlers does\n const serializedError: SerializedWorkerError = {\n reason: reason,\n filename: self.location?.href,\n };\n\n // Forward to parent thread\n self.postMessage({\n _sentryMessage: true,\n _sentryWorkerError: serializedError,\n });\n\n DEBUG_BUILD && debug.log('[Sentry Worker] Forwarding unhandled rejection to parent', serializedError);\n });\n\n DEBUG_BUILD && debug.log('[Sentry Worker] Registered worker with unhandled rejection handling');\n}\n\nfunction isSentryMessage(eventData: unknown): eventData is WebWorkerMessage {\n if (!isPlainObject(eventData) || eventData._sentryMessage !== true) {\n return false;\n }\n\n // Must have at least one of: debug IDs, module metadata, worker error, or WASM images\n const hasDebugIds = '_sentryDebugIds' in eventData;\n const hasModuleMetadata = '_sentryModuleMetadata' in eventData;\n const hasWorkerError = '_sentryWorkerError' in eventData;\n const hasWasmImages = '_sentryWasmImages' in eventData;\n\n if (!hasDebugIds && !hasModuleMetadata && !hasWorkerError && !hasWasmImages) {\n return false;\n }\n\n // Validate debug IDs if present\n if (hasDebugIds && !(isPlainObject(eventData._sentryDebugIds) || eventData._sentryDebugIds === undefined)) {\n return false;\n }\n\n // Validate module metadata if present\n if (\n hasModuleMetadata &&\n !(isPlainObject(eventData._sentryModuleMetadata) || eventData._sentryModuleMetadata === undefined)\n ) {\n return false;\n }\n\n // Validate worker error if present\n if (hasWorkerError && !isPlainObject(eventData._sentryWorkerError)) {\n return false;\n }\n\n // Validate WASM images if present\n if (\n hasWasmImages &&\n (!Array.isArray(eventData._sentryWasmImages) ||\n !eventData._sentryWasmImages.every(\n (img: unknown) => isPlainObject(img) && typeof (img as { code_file?: unknown }).code_file === 'string',\n ))\n ) {\n return false;\n }\n\n return true;\n}\n"],"names":["worker"],"mappings":";;;;;;AAOO,MAAM,gBAAA,GAAmB;AAgGzB,MAAM,oBAAA,GAAuB,iBAAA,CAAkB,CAAC,EAAE,QAAO,MAAoC;AAAA,EAClG,IAAA,EAAM,gBAAA;AAAA,EACN,WAAW,MAAM;AACf,IAAA,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,GAAI,MAAA,GAAS,CAAC,MAAM,CAAA,EAAG,OAAA,CAAQ,CAAA,CAAA,KAAK,uBAAA,CAAwB,CAAC,CAAC,CAAA;AAAA,EACrF,CAAA;AAAA,EACA,SAAA,EAAW,CAACA,OAAAA,KAAmB,uBAAA,CAAwBA,OAAM;AAC/D,CAAA,CAAE;AAEF,SAAS,wBAAwB,MAAA,EAAsB;AACrD,EAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,CAAA,KAAA,KAAS;AAC1C,IAAA,IAAI,eAAA,CAAgB,KAAA,CAAM,IAAI,CAAA,EAAG;AAC/B,MAAA,KAAA,CAAM,wBAAA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,EACT;AAGA,EAAA,IACE,iBAAA,IACA,EAAE,aAAA,CAAc,SAAA,CAAU,qBAAqB,CAAA,IAAK,SAAA,CAAU,0BAA0B,MAAA,CAAA,EACxF;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,IAAI,cAAA,IAAkB,CAAC,aAAA,CAAc,SAAA,CAAU,kBAAkB,CAAA,EAAG;AAClE,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,IACE,aAAA,KACC,CAAC,KAAA,CAAM,OAAA,CAAQ,UAAU,iBAAiB,CAAA,IACzC,CAAC,SAAA,CAAU,iBAAA,CAAkB,KAAA;AAAA,IAC3B,CAAC,GAAA,KAAiB,aAAA,CAAc,GAAG,CAAA,IAAK,OAAQ,IAAgC,SAAA,KAAc;AAAA,GAChG,CAAA,EACF;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"webWorker.js","sources":["../../../../../src/integrations/webWorker.ts"],"sourcesContent":["import type { DebugImage, Integration, IntegrationFn } from '@sentry/core';\nimport {\n addNonEnumerableProperty,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n isError,\n isPlainObject,\n isPrimitive,\n normalize,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput, extractMessage, extractType } from '../eventbuilder';\nimport { ignoreNextOnErrorMatching, WINDOW } from '../helpers';\nimport {\n _enhanceEventWithInitialFrame,\n _eventFromRejectionWithPrimitive,\n _getUnhandledRejectionError,\n} from './globalhandlers';\n\nexport const INTEGRATION_NAME = 'WebWorker' as const;\n\nconst MAX_FORWARDED_ERRORS = 20;\n\ninterface WebWorkerMessage {\n _sentryMessage: boolean;\n _sentryDebugIds?: Record<string, string>;\n _sentryModuleMetadata?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n _sentryWorkerError?: SerializedWorkerError;\n _sentryWasmImages?: Array<DebugImage>;\n}\n\ntype WorkerErrorKind = 'error' | 'unhandledrejection';\n\ninterface SerializedWorkerError {\n reason: unknown;\n filename?: string;\n /** Absent on workers registered by an SDK version that only forwarded rejections. */\n kind?: WorkerErrorKind;\n /** Structured clone resets any name outside the built-in set to `Error`. */\n name?: string;\n /** The `ErrorEvent` message, matched against the copy that bubbles to `window.onerror`. */\n message?: string;\n /** Script the error was thrown in, which can differ from the worker script. */\n url?: string;\n lineno?: number;\n colno?: number;\n /** Set when `reason` is a plain `{ message, stack }` copy of an error that did not clone. */\n plainError?: boolean;\n}\n\ninterface WebWorkerIntegrationOptions {\n worker: Worker | Array<Worker>;\n}\n\ninterface WebWorkerIntegration extends Integration {\n addWorker: (worker: Worker) => void;\n}\n\n/**\n * Use this integration to set up Sentry with web workers.\n *\n * IMPORTANT: This integration must be added **before** you start listening to\n * any messages from the worker. Otherwise, your message handlers will receive\n * messages from the Sentry SDK which you need to ignore.\n *\n * This integration only has an effect, if you call `Sentry.registerWebWorker(self)`\n * from within the worker(s) you're adding to the integration.\n *\n * Given that you want to initialize the SDK as early as possible, you most likely\n * want to add this integration **after** initializing the SDK:\n *\n * @example:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // some time earlier:\n * Sentry.init(...)\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Add the integration\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * If you initialize multiple workers at the same time, you can also pass an array of workers\n * to the integration:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: [worker1, worker2] });\n * Sentry.addIntegration(webWorkerIntegration);\n * ```\n *\n * If you have any additional workers that you initialize at a later point,\n * you can add them to the integration as follows:\n *\n * ```ts filename={main.js}\n * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: worker1 });\n * Sentry.addIntegration(webWorkerIntegration);\n *\n * // sometime later:\n * webWorkerIntegration.addWorker(worker2);\n * ```\n *\n * Of course, you can also directly add the integration in Sentry.init:\n * ```ts filename={main.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // 1. Initialize the worker\n * const worker = new Worker(new URL('./worker.ts', import.meta.url));\n *\n * // 2. Initialize the SDK\n * Sentry.init({\n * integrations: [Sentry.webWorkerIntegration({ worker })]\n * });\n *\n * // 3. Register message listeners on the worker\n * worker.addEventListener('message', event => {\n * // ...\n * });\n * ```\n *\n * @param options {WebWorkerIntegrationOptions} Integration options:\n * - `worker`: The worker instance.\n */\nexport const webWorkerIntegration = defineIntegration(({ worker }: WebWorkerIntegrationOptions) => ({\n name: INTEGRATION_NAME,\n setupOnce: () => {\n (Array.isArray(worker) ? worker : [worker]).forEach(w => listenForSentryMessages(w));\n },\n addWorker: (worker: Worker) => listenForSentryMessages(worker),\n})) as IntegrationFn<WebWorkerIntegration>;\n\nfunction listenForSentryMessages(worker: Worker): void {\n // Forwarded errors whose message-only copy has yet to bubble to the page.\n const forwardedErrors: Array<Pick<SerializedWorkerError, 'message' | 'url' | 'lineno' | 'colno'>> = [];\n\n // The bubbled copy fires `error` on the worker object and then `window.onerror` in the same task, after the\n // forward arrived. Skipping only copies of errors we actually received means a missing forward can at worst\n // cause a duplicate, never a lost error.\n worker.addEventListener('error', ({ message, filename, lineno, colno }) => {\n const index = forwardedErrors.findIndex(\n e => e.message === message && e.url === filename && e.lineno === lineno && e.colno === colno,\n );\n if (index !== -1) {\n // Earlier entries were cancelled inside the worker and will never bubble.\n forwardedErrors.splice(0, index + 1);\n ignoreNextOnErrorMatching({ msg: message, url: filename, line: lineno, column: colno });\n }\n });\n\n worker.addEventListener('message', event => {\n if (isSentryMessage(event.data)) {\n event.stopImmediatePropagation(); // other listeners should not receive this message\n\n // Handle debug IDs\n if (event.data._sentryDebugIds) {\n DEBUG_BUILD && debug.log('Sentry debugId web worker message received', event.data);\n WINDOW._sentryDebugIds = {\n ...event.data._sentryDebugIds,\n // debugIds of the main thread have precedence over the worker's in case of a collision.\n ...WINDOW._sentryDebugIds,\n };\n }\n\n // Handle module metadata\n if (event.data._sentryModuleMetadata) {\n DEBUG_BUILD && debug.log('Sentry module metadata web worker message received', event.data);\n // Merge worker's raw metadata into the global object\n // It will be parsed lazily when needed by getMetadataForUrl\n WINDOW._sentryModuleMetadata = {\n ...event.data._sentryModuleMetadata,\n // Module metadata of the main thread have precedence over the worker's in case of a collision.\n ...WINDOW._sentryModuleMetadata,\n };\n }\n\n // Handle WASM images from worker\n if (event.data._sentryWasmImages) {\n DEBUG_BUILD && debug.log('Sentry WASM images web worker message received', event.data);\n const existingImages =\n (WINDOW as typeof WINDOW & { _sentryWasmImages?: Array<DebugImage> })._sentryWasmImages || [];\n const newImages = event.data._sentryWasmImages.filter(\n (newImg: unknown) =>\n isPlainObject(newImg) &&\n typeof newImg.code_file === 'string' &&\n !existingImages.some(existing => existing.code_file === newImg.code_file),\n );\n (WINDOW as typeof WINDOW & { _sentryWasmImages?: Array<DebugImage> })._sentryWasmImages = [\n ...existingImages,\n ...newImages,\n ];\n }\n\n // Handle errors and unhandled rejections forwarded from worker\n if (event.data._sentryWorkerError) {\n DEBUG_BUILD && debug.log('Sentry worker error message received', event.data._sentryWorkerError);\n const { kind, message, url, lineno, colno } = event.data._sentryWorkerError;\n if (kind === 'error') {\n // Bounded because a worker that cancels its own errors never bubbles them.\n if (forwardedErrors.push({ message, url, lineno, colno }) > MAX_FORWARDED_ERRORS) {\n forwardedErrors.shift();\n }\n }\n handleForwardedWorkerError(event.data._sentryWorkerError);\n }\n }\n });\n}\n\nfunction handleForwardedWorkerError(workerError: SerializedWorkerError): void {\n const { reason, kind, name, filename, url, lineno, colno, plainError } = workerError;\n // Older workers only ever forwarded rejections and send no `kind`.\n const isUnhandledRejection = kind !== 'error';\n\n const error = plainError && isPlainObject(reason) ? errorFromPlain(reason) : reason;\n\n if (name && isError(error) && error.name !== name) {\n addNonEnumerableProperty(error, 'name', name);\n }\n\n const client = getClient();\n if (!client) {\n return;\n }\n\n const { stackParser, attachStacktrace } = client.getOptions();\n\n // Follow same pattern as globalHandlers for each source.\n // A thrown primitive is not a rejection, so the rejection-specific wording must not apply to it.\n const event =\n isUnhandledRejection && isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, isUnhandledRejection);\n\n if (!isUnhandledRejection) {\n // An ErrorEvent reports an unknown script as an empty string.\n _enhanceEventWithInitialFrame(event, url || filename, lineno, colno);\n }\n\n event.level = 'error';\n\n // Add worker-specific context\n if (filename) {\n event.contexts = {\n ...event.contexts,\n worker: {\n filename,\n },\n };\n }\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: isUnhandledRejection ? 'auto.browser.web_worker.onunhandledrejection' : 'auto.browser.web_worker.onerror',\n },\n });\n\n DEBUG_BUILD && debug.log(`Captured worker ${isUnhandledRejection ? 'unhandled rejection' : 'error'}`, error);\n}\n\n/**\n * Minimal interface for DedicatedWorkerGlobalScope, only requiring the postMessage method.\n * (which is the only thing we need from the worker's global object)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope\n *\n * We can't use the actual type because it breaks everyone who doesn't have {\"lib\": [\"WebWorker\"]}\n * but uses {\"skipLibCheck\": true} in their tsconfig.json.\n */\ninterface MinimalDedicatedWorkerGlobalScope {\n postMessage: (message: unknown) => void;\n addEventListener: (type: string, listener: (event: unknown) => void) => void;\n location?: { href?: string };\n}\n\ninterface RegisterWebWorkerOptions {\n self: MinimalDedicatedWorkerGlobalScope & {\n _sentryDebugIds?: Record<string, string>;\n _sentryModuleMetadata?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n };\n}\n\n/**\n * Use this function to register the worker with the Sentry SDK.\n *\n * This function will:\n * - Send debug IDs to the parent thread\n * - Send module metadata to the parent thread (for thirdPartyErrorFilterIntegration)\n * - Set up handlers for uncaught errors and unhandled rejections in the worker\n * - Forward both to the parent thread for capture\n *\n * Note: uncaught errors do bubble to the parent, but the propagated `ErrorEvent` carries\n * no `error` object, so globalHandlers can only build an event from the message string.\n * Forwarding them here preserves the real stack, which matters most for wasm frames.\n *\n * @example\n * ```ts filename={worker.js}\n * import * as Sentry from '@sentry/<your-sdk>';\n *\n * // Do this as early as possible in your worker.\n * Sentry.registerWebWorker({ self });\n *\n * // continue setting up your worker\n * self.postMessage(...)\n * ```\n * @param options {RegisterWebWorkerOptions} Integration options:\n * - `self`: The worker instance you're calling this function from (self).\n */\nexport function registerWebWorker({ self }: RegisterWebWorkerOptions): void {\n // Mirrors globalHandlersIntegration. The worker has no client of its own, so without this\n // V8's default of 10 truncates stacks before this code forwards them.\n Error.stackTraceLimit = 50;\n\n // Send debug IDs and raw module metadata to parent thread\n // The metadata will be parsed lazily on the main thread when needed\n self.postMessage({\n _sentryMessage: true,\n _sentryDebugIds: self._sentryDebugIds ?? undefined,\n _sentryModuleMetadata: self._sentryModuleMetadata ?? undefined,\n });\n\n const forward = (serializedError: Omit<SerializedWorkerError, 'filename' | 'name'>): void => {\n const { reason } = serializedError;\n\n DEBUG_BUILD && debug.log(`[Sentry Worker] Forwarding ${serializedError.kind} to parent`, serializedError);\n\n postSerializedWorkerError(self, {\n ...serializedError,\n filename: self.location?.href,\n name: isError(reason) ? extractType(reason) : undefined,\n });\n };\n\n // Uncaught errors bubble to the parent, but the propagated ErrorEvent\n // carries no error object. Forwarding the object keeps the real stack.\n self.addEventListener('error', (event: unknown) => {\n const { error, message, filename, lineno, colno } = event as {\n error?: unknown;\n message?: string;\n filename?: string;\n lineno?: number;\n colno?: number;\n };\n\n forward({ kind: 'error', reason: error ?? message, message, url: filename, lineno, colno });\n });\n\n // Unhandled rejections do not bubble to the parent thread at all.\n self.addEventListener('unhandledrejection', (event: unknown) => {\n forward({ kind: 'unhandledrejection', reason: _getUnhandledRejectionError(event) });\n });\n\n DEBUG_BUILD && debug.log('[Sentry Worker] Registered worker with error and unhandled rejection handling');\n}\n\n/**\n * `postMessage` structured-clones the reason. A `DataCloneError` must never\n * escape the worker's own error handler, so the forward is retried with\n * plain data that clones in every browser, including ones that cannot clone\n * `Error` at all.\n */\nfunction postSerializedWorkerError(\n self: MinimalDedicatedWorkerGlobalScope,\n serializedError: SerializedWorkerError,\n): void {\n try {\n self.postMessage({\n _sentryMessage: true,\n _sentryWorkerError: serializedError,\n });\n return;\n } catch {\n // Not cloneable, fall through and send plain data instead.\n }\n\n const { reason } = serializedError;\n const plainError = isError(reason);\n const plainReason = plainError ? { message: extractMessage(reason), stack: reason.stack } : normalize(reason);\n\n try {\n self.postMessage({\n _sentryMessage: true,\n _sentryWorkerError: { ...serializedError, reason: plainReason, plainError },\n });\n } catch {\n // Dropping the forward is better than throwing out of the worker's error handler.\n }\n}\n\nfunction errorFromPlain(plain: Record<string, unknown>): Error {\n const error = new Error(String(plain.message));\n error.stack = typeof plain.stack === 'string' ? plain.stack : undefined;\n return error;\n}\n\nfunction isSentryMessage(eventData: unknown): eventData is WebWorkerMessage {\n if (!isPlainObject(eventData) || eventData._sentryMessage !== true) {\n return false;\n }\n\n // Must have at least one of: debug IDs, module metadata, worker error, or WASM images\n const hasDebugIds = '_sentryDebugIds' in eventData;\n const hasModuleMetadata = '_sentryModuleMetadata' in eventData;\n const hasWorkerError = '_sentryWorkerError' in eventData;\n const hasWasmImages = '_sentryWasmImages' in eventData;\n\n if (!hasDebugIds && !hasModuleMetadata && !hasWorkerError && !hasWasmImages) {\n return false;\n }\n\n // Validate debug IDs if present\n if (hasDebugIds && !(isPlainObject(eventData._sentryDebugIds) || eventData._sentryDebugIds === undefined)) {\n return false;\n }\n\n // Validate module metadata if present\n if (\n hasModuleMetadata &&\n !(isPlainObject(eventData._sentryModuleMetadata) || eventData._sentryModuleMetadata === undefined)\n ) {\n return false;\n }\n\n // Validate worker error if present\n if (hasWorkerError && !isPlainObject(eventData._sentryWorkerError)) {\n return false;\n }\n\n // Validate WASM images if present\n if (\n hasWasmImages &&\n (!Array.isArray(eventData._sentryWasmImages) ||\n !eventData._sentryWasmImages.every(\n (img: unknown) => isPlainObject(img) && typeof (img as { code_file?: unknown }).code_file === 'string',\n ))\n ) {\n return false;\n }\n\n return true;\n}\n"],"names":["worker"],"mappings":";;;;;;AAqBO,MAAM,gBAAA,GAAmB;AAEhC,MAAM,oBAAA,GAAuB,EAAA;AA8GtB,MAAM,oBAAA,GAAuB,iBAAA,CAAkB,CAAC,EAAE,QAAO,MAAoC;AAAA,EAClG,IAAA,EAAM,gBAAA;AAAA,EACN,WAAW,MAAM;AACf,IAAA,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,GAAI,MAAA,GAAS,CAAC,MAAM,CAAA,EAAG,OAAA,CAAQ,CAAA,CAAA,KAAK,uBAAA,CAAwB,CAAC,CAAC,CAAA;AAAA,EACrF,CAAA;AAAA,EACA,SAAA,EAAW,CAACA,OAAAA,KAAmB,uBAAA,CAAwBA,OAAM;AAC/D,CAAA,CAAE;AAEF,SAAS,wBAAwB,MAAA,EAAsB;AAErD,EAAA,MAAM,kBAA8F,EAAC;AAKrG,EAAA,MAAA,CAAO,gBAAA,CAAiB,SAAS,CAAC,EAAE,SAAS,QAAA,EAAU,MAAA,EAAQ,OAAM,KAAM;AACzE,IAAA,MAAM,QAAQ,eAAA,CAAgB,SAAA;AAAA,MAC5B,CAAA,CAAA,KAAK,CAAA,CAAE,OAAA,KAAY,OAAA,IAAW,CAAA,CAAE,GAAA,KAAQ,QAAA,IAAY,CAAA,CAAE,MAAA,KAAW,MAAA,IAAU,CAAA,CAAE,KAAA,KAAU;AAAA,KACzF;AACA,IAAA,IAAI,UAAU,EAAA,EAAI;AAEhB,MAAA,eAAA,CAAgB,MAAA,CAAO,CAAA,EAAG,KAAA,GAAQ,CAAC,CAAA;AACnC,MAAA,yBAAA,CAA0B,EAAE,KAAK,OAAA,EAAS,G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WAAA,IAAe,EAAE,aAAA,CAAc,SAAA,CAAU,eAAe,CAAA,IAAK,SAAA,CAAU,oBAAoB,MAAA,CAAA,EAAY;AACzG,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,IACE,iBAAA,IACA,EAAE,aAAA,CAAc,SAAA,CAAU,qBAAqB,CAAA,IAAK,SAAA,CAAU,0BAA0B,MAAA,CAAA,EACxF;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,IAAI,cAAA,IAAkB,CAAC,aAAA,CAAc,SAAA,CAAU,kBAAkB,CAAA,EAAG;AAClE,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,IACE,aAAA,KACC,CAAC,KAAA,CAAM,OAAA,CAAQ,UAAU,iBAAiB,CAAA,IACzC,CAAC,SAAA,CAAU,iBAAA,CAAkB,KAAA;AAAA,IAC3B,CAAC,GAAA,KAAiB,aAAA,CAAc,GAAG,CAAA,IAAK,OAAQ,IAAgC,SAAA,KAAc;AAAA,GAChG,CAAA,EACF;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"11.0.0
|
|
1
|
+
{"type":"module","version":"11.0.0","sideEffects":false}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import type { Mechanism, WrappedFunction } from '@sentry/core';
|
|
1
|
+
import type { HandlerDataError, Mechanism, WrappedFunction } from '@sentry/core';
|
|
2
2
|
import { GLOBAL_OBJ } from '@sentry/core';
|
|
3
3
|
export declare const WINDOW: typeof GLOBAL_OBJ & Window;
|
|
4
|
+
type ErrorReport = Pick<HandlerDataError, 'msg' | 'url' | 'line' | 'column'>;
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
|
-
export declare function shouldIgnoreOnError(): boolean;
|
|
8
|
+
export declare function shouldIgnoreOnError(data?: HandlerDataError): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Skips the next `onerror` report that matches `report`, once. A report that
|
|
11
|
+
* never arrives is forgotten after the current task.
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare function ignoreNextOnErrorMatching(report: ErrorReport): void;
|
|
8
16
|
/**
|
|
9
17
|
* @hidden
|
|
10
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAML,UAAU,EAGX,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,MAAM,EAAiB,OAAO,UAAU,GAAG,MAAM,CAAC;AAI/D,KAAK,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;AAI7E;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAYpE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAQnE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAGD,KAAK,iBAAiB,GAAG,QAAQ,CAAC;AAElC,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC9C,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,eAAe,CAAC,CAAC,CAAC,CAAC;AACtB,wBAAgB,IAAI,CAAC,WAAW,EAC9B,EAAE,EAAE,WAAW,EACf,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,WAAW,CAAC;AA0If;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgBrF"}
|
|
@@ -15,5 +15,9 @@ export declare function _getUnhandledRejectionError(error: unknown): unknown;
|
|
|
15
15
|
* @returns An Event object with an appropriate `exception` value
|
|
16
16
|
*/
|
|
17
17
|
export declare function _eventFromRejectionWithPrimitive(reason: Primitive): Event;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a frame built from the error location when the event has none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function _enhanceEventWithInitialFrame(event: Event, url: string | undefined, lineno: number | undefined, colno: number | undefined): Event;
|
|
18
22
|
export {};
|
|
19
23
|
//# sourceMappingURL=globalhandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.d.ts","sourceRoot":"","sources":["../../../../src/integrations/globalhandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,KAAK,EAAiB,SAAS,EAAe,MAAM,cAAc,CAAC;AAmBzF,KAAK,oCAAoC,GAAG,SAAS,GAAG,sBAAsB,CAAC;AAE/E,KAAK,0BAA0B,GAAG,MAAM,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;AA6BxF,eAAO,MAAM,yBAAyB;;CAAgD,CAAC;AAyDvF;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA0BnE;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,GAAG,KAAK,CAYzE"}
|
|
1
|
+
{"version":3,"file":"globalhandlers.d.ts","sourceRoot":"","sources":["../../../../src/integrations/globalhandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,KAAK,EAAiB,SAAS,EAAe,MAAM,cAAc,CAAC;AAmBzF,KAAK,oCAAoC,GAAG,SAAS,GAAG,sBAAsB,CAAC;AAE/E,KAAK,0BAA0B,GAAG,MAAM,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;AA6BxF,eAAO,MAAM,yBAAyB;;CAAgD,CAAC;AAyDvF;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA0BnE;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,GAAG,KAAK,CAYzE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,KAAK,CAuBP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpcontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/httpcontext.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"httpcontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/httpcontext.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;CAwEjC,CAAC"}
|
|
@@ -6,10 +6,17 @@ export type SpotlightConnectionOptions = {
|
|
|
6
6
|
sidecarUrl?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const INTEGRATION_NAME: 'SpotlightBrowser';
|
|
9
|
-
export declare const SPOTLIGHT_IGNORE_SPANS: {
|
|
9
|
+
export declare const SPOTLIGHT_IGNORE_SPANS: ({
|
|
10
10
|
op: string;
|
|
11
11
|
name: string;
|
|
12
|
-
|
|
12
|
+
attributes?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
name?: undefined;
|
|
15
|
+
op: string;
|
|
16
|
+
attributes: {
|
|
17
|
+
'browser.web_vital.inp.target': string;
|
|
18
|
+
};
|
|
19
|
+
})[];
|
|
13
20
|
/**
|
|
14
21
|
* Use this integration to send errors and transactions to Spotlight.
|
|
15
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../../src/integrations/spotlight.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAG,kBAA2B,CAAC;AAE5D,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../../src/integrations/spotlight.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAG,kBAA2B,CAAC;AAE5D,eAAO,MAAM,sBAAsB;;;;;;;;QAES,8BAA8B;;IACzE,CAAC;AAuDF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;CAA2C,CAAC"}
|
|
@@ -105,11 +105,12 @@ interface RegisterWebWorkerOptions {
|
|
|
105
105
|
* This function will:
|
|
106
106
|
* - Send debug IDs to the parent thread
|
|
107
107
|
* - Send module metadata to the parent thread (for thirdPartyErrorFilterIntegration)
|
|
108
|
-
* - Set up
|
|
109
|
-
* - Forward
|
|
108
|
+
* - Set up handlers for uncaught errors and unhandled rejections in the worker
|
|
109
|
+
* - Forward both to the parent thread for capture
|
|
110
110
|
*
|
|
111
|
-
* Note:
|
|
112
|
-
*
|
|
111
|
+
* Note: uncaught errors do bubble to the parent, but the propagated `ErrorEvent` carries
|
|
112
|
+
* no `error` object, so globalHandlers can only build an event from the message string.
|
|
113
|
+
* Forwarding them here preserves the real stack, which matters most for wasm frames.
|
|
113
114
|
*
|
|
114
115
|
* @example
|
|
115
116
|
* ```ts filename={worker.js}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webWorker.d.ts","sourceRoot":"","sources":["../../../../src/integrations/webWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"webWorker.d.ts","sourceRoot":"","sources":["../../../../src/integrations/webWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB3E,eAAO,MAAM,gBAAgB,EAAG,WAAoB,CAAC;AAmCrD,UAAU,oBAAqB,SAAQ,WAAW;IAChD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,eAAO,MAAM,oBAAoB,EAM1B,aAAa,CAAC,oBAAoB,CAAC,CAAC;AAoI3C;;;;;;;;GAQG;AACH,UAAU,iCAAiC;IACzC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9B;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,iCAAiC,GAAG;QACxC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7C,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,GAAG,IAAI,CA6C1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "11.0.0
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sentry/browser-utils": "11.0.0
|
|
41
|
+
"@sentry/browser-utils": "11.0.0",
|
|
42
42
|
"@sentry/conventions": "^0.23.0",
|
|
43
|
-
"@sentry/feedback": "11.0.0
|
|
44
|
-
"@sentry/replay": "11.0.0
|
|
45
|
-
"@sentry/replay-canvas": "11.0.0
|
|
46
|
-
"@sentry/core": "11.0.0
|
|
43
|
+
"@sentry/feedback": "11.0.0",
|
|
44
|
+
"@sentry/replay": "11.0.0",
|
|
45
|
+
"@sentry/replay-canvas": "11.0.0",
|
|
46
|
+
"@sentry/core": "11.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@sentry-internal/integration-shims": "11.0.0
|
|
49
|
+
"@sentry-internal/integration-shims": "11.0.0",
|
|
50
50
|
"fake-indexeddb": "^6.2.5"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|