mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-04-26 23:25:11 +00:00
init
This commit is contained in:
146
node_modules/@sentry/utils/esm/aggregate-errors.js
generated
vendored
Normal file
146
node_modules/@sentry/utils/esm/aggregate-errors.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
import { isInstanceOf } from './is.js';
|
||||
import { truncate } from './string.js';
|
||||
|
||||
/**
|
||||
* Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter.
|
||||
*/
|
||||
function applyAggregateErrorsToEvent(
|
||||
exceptionFromErrorImplementation,
|
||||
parser,
|
||||
maxValueLimit = 250,
|
||||
key,
|
||||
limit,
|
||||
event,
|
||||
hint,
|
||||
) {
|
||||
if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generally speaking the last item in `event.exception.values` is the exception originating from the original Error
|
||||
const originalException =
|
||||
event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : undefined;
|
||||
|
||||
// We only create exception grouping if there is an exception in the event.
|
||||
if (originalException) {
|
||||
event.exception.values = truncateAggregateExceptions(
|
||||
aggregateExceptionsFromError(
|
||||
exceptionFromErrorImplementation,
|
||||
parser,
|
||||
limit,
|
||||
hint.originalException ,
|
||||
key,
|
||||
event.exception.values,
|
||||
originalException,
|
||||
0,
|
||||
),
|
||||
maxValueLimit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function aggregateExceptionsFromError(
|
||||
exceptionFromErrorImplementation,
|
||||
parser,
|
||||
limit,
|
||||
error,
|
||||
key,
|
||||
prevExceptions,
|
||||
exception,
|
||||
exceptionId,
|
||||
) {
|
||||
if (prevExceptions.length >= limit + 1) {
|
||||
return prevExceptions;
|
||||
}
|
||||
|
||||
let newExceptions = [...prevExceptions];
|
||||
|
||||
// Recursively call this function in order to walk down a chain of errors
|
||||
if (isInstanceOf(error[key], Error)) {
|
||||
applyExceptionGroupFieldsForParentException(exception, exceptionId);
|
||||
const newException = exceptionFromErrorImplementation(parser, error[key]);
|
||||
const newExceptionId = newExceptions.length;
|
||||
applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);
|
||||
newExceptions = aggregateExceptionsFromError(
|
||||
exceptionFromErrorImplementation,
|
||||
parser,
|
||||
limit,
|
||||
error[key],
|
||||
key,
|
||||
[newException, ...newExceptions],
|
||||
newException,
|
||||
newExceptionId,
|
||||
);
|
||||
}
|
||||
|
||||
// This will create exception grouping for AggregateErrors
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError
|
||||
if (Array.isArray(error.errors)) {
|
||||
error.errors.forEach((childError, i) => {
|
||||
if (isInstanceOf(childError, Error)) {
|
||||
applyExceptionGroupFieldsForParentException(exception, exceptionId);
|
||||
const newException = exceptionFromErrorImplementation(parser, childError);
|
||||
const newExceptionId = newExceptions.length;
|
||||
applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);
|
||||
newExceptions = aggregateExceptionsFromError(
|
||||
exceptionFromErrorImplementation,
|
||||
parser,
|
||||
limit,
|
||||
childError,
|
||||
key,
|
||||
[newException, ...newExceptions],
|
||||
newException,
|
||||
newExceptionId,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return newExceptions;
|
||||
}
|
||||
|
||||
function applyExceptionGroupFieldsForParentException(exception, exceptionId) {
|
||||
// Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.
|
||||
exception.mechanism = exception.mechanism || { type: 'generic', handled: true };
|
||||
|
||||
exception.mechanism = {
|
||||
...exception.mechanism,
|
||||
...(exception.type === 'AggregateError' && { is_exception_group: true }),
|
||||
exception_id: exceptionId,
|
||||
};
|
||||
}
|
||||
|
||||
function applyExceptionGroupFieldsForChildException(
|
||||
exception,
|
||||
source,
|
||||
exceptionId,
|
||||
parentId,
|
||||
) {
|
||||
// Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.
|
||||
exception.mechanism = exception.mechanism || { type: 'generic', handled: true };
|
||||
|
||||
exception.mechanism = {
|
||||
...exception.mechanism,
|
||||
type: 'chained',
|
||||
source,
|
||||
exception_id: exceptionId,
|
||||
parent_id: parentId,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate the message (exception.value) of all exceptions in the event.
|
||||
* Because this event processor is ran after `applyClientOptions`,
|
||||
* we need to truncate the message of the added exceptions here.
|
||||
*/
|
||||
function truncateAggregateExceptions(exceptions, maxValueLength) {
|
||||
return exceptions.map(exception => {
|
||||
if (exception.value) {
|
||||
exception.value = truncate(exception.value, maxValueLength);
|
||||
}
|
||||
return exception;
|
||||
});
|
||||
}
|
||||
|
||||
export { applyAggregateErrorsToEvent };
|
||||
//# sourceMappingURL=aggregate-errors.js.map
|
||||
1
node_modules/@sentry/utils/esm/aggregate-errors.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/aggregate-errors.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
73
node_modules/@sentry/utils/esm/anr.js
generated
vendored
Normal file
73
node_modules/@sentry/utils/esm/anr.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
import { dropUndefinedKeys } from './object.js';
|
||||
import { filenameIsInApp } from './node-stack-trace.js';
|
||||
|
||||
/**
|
||||
* A node.js watchdog timer
|
||||
* @param pollInterval The interval that we expect to get polled at
|
||||
* @param anrThreshold The threshold for when we consider ANR
|
||||
* @param callback The callback to call for ANR
|
||||
* @returns An object with `poll` and `enabled` functions {@link WatchdogReturn}
|
||||
*/
|
||||
function watchdogTimer(
|
||||
createTimer,
|
||||
pollInterval,
|
||||
anrThreshold,
|
||||
callback,
|
||||
) {
|
||||
const timer = createTimer();
|
||||
let triggered = false;
|
||||
let enabled = true;
|
||||
|
||||
setInterval(() => {
|
||||
const diffMs = timer.getTimeMs();
|
||||
|
||||
if (triggered === false && diffMs > pollInterval + anrThreshold) {
|
||||
triggered = true;
|
||||
if (enabled) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
if (diffMs < pollInterval + anrThreshold) {
|
||||
triggered = false;
|
||||
}
|
||||
}, 20);
|
||||
|
||||
return {
|
||||
poll: () => {
|
||||
timer.reset();
|
||||
},
|
||||
enabled: (state) => {
|
||||
enabled = state;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// types copied from inspector.d.ts
|
||||
|
||||
/**
|
||||
* Converts Debugger.CallFrame to Sentry StackFrame
|
||||
*/
|
||||
function callFrameToStackFrame(
|
||||
frame,
|
||||
url,
|
||||
getModuleFromFilename,
|
||||
) {
|
||||
const filename = url ? url.replace(/^file:\/\//, '') : undefined;
|
||||
|
||||
// CallFrame row/col are 0 based, whereas StackFrame are 1 based
|
||||
const colno = frame.location.columnNumber ? frame.location.columnNumber + 1 : undefined;
|
||||
const lineno = frame.location.lineNumber ? frame.location.lineNumber + 1 : undefined;
|
||||
|
||||
return dropUndefinedKeys({
|
||||
filename,
|
||||
module: getModuleFromFilename(filename),
|
||||
function: frame.functionName || '?',
|
||||
colno,
|
||||
lineno,
|
||||
in_app: filename ? filenameIsInApp(filename) : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
export { callFrameToStackFrame, watchdogTimer };
|
||||
//# sourceMappingURL=anr.js.map
|
||||
1
node_modules/@sentry/utils/esm/anr.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/anr.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"anr.js","sources":["../../src/anr.ts"],"sourcesContent":["import type { StackFrame } from '@sentry/types';\n\nimport { dropUndefinedKeys } from './object';\nimport { filenameIsInApp } from './stacktrace';\n\ntype WatchdogReturn = {\n /** Resets the watchdog timer */\n poll: () => void;\n /** Enables or disables the watchdog timer */\n enabled: (state: boolean) => void;\n};\n\ntype CreateTimerImpl = () => { getTimeMs: () => number; reset: () => void };\n\n/**\n * A node.js watchdog timer\n * @param pollInterval The interval that we expect to get polled at\n * @param anrThreshold The threshold for when we consider ANR\n * @param callback The callback to call for ANR\n * @returns An object with `poll` and `enabled` functions {@link WatchdogReturn}\n */\nexport function watchdogTimer(\n createTimer: CreateTimerImpl,\n pollInterval: number,\n anrThreshold: number,\n callback: () => void,\n): WatchdogReturn {\n const timer = createTimer();\n let triggered = false;\n let enabled = true;\n\n setInterval(() => {\n const diffMs = timer.getTimeMs();\n\n if (triggered === false && diffMs > pollInterval + anrThreshold) {\n triggered = true;\n if (enabled) {\n callback();\n }\n }\n\n if (diffMs < pollInterval + anrThreshold) {\n triggered = false;\n }\n }, 20);\n\n return {\n poll: () => {\n timer.reset();\n },\n enabled: (state: boolean) => {\n enabled = state;\n },\n };\n}\n\n// types copied from inspector.d.ts\ninterface Location {\n scriptId: string;\n lineNumber: number;\n columnNumber?: number;\n}\n\ninterface CallFrame {\n functionName: string;\n location: Location;\n url: string;\n}\n\n/**\n * Converts Debugger.CallFrame to Sentry StackFrame\n */\nexport function callFrameToStackFrame(\n frame: CallFrame,\n url: string | undefined,\n getModuleFromFilename: (filename: string | undefined) => string | undefined,\n): StackFrame {\n const filename = url ? url.replace(/^file:\\/\\//, '') : undefined;\n\n // CallFrame row/col are 0 based, whereas StackFrame are 1 based\n const colno = frame.location.columnNumber ? frame.location.columnNumber + 1 : undefined;\n const lineno = frame.location.lineNumber ? frame.location.lineNumber + 1 : undefined;\n\n return dropUndefinedKeys({\n filename,\n module: getModuleFromFilename(filename),\n function: frame.functionName || '?',\n colno,\n lineno,\n in_app: filename ? filenameIsInApp(filename) : undefined,\n });\n}\n"],"names":[],"mappings":";;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAkB;AAClB,EAAE,MAAM,KAAA,GAAQ,WAAW,EAAE,CAAA;AAC7B,EAAE,IAAI,SAAU,GAAE,KAAK,CAAA;AACvB,EAAE,IAAI,OAAQ,GAAE,IAAI,CAAA;AACpB;AACA,EAAE,WAAW,CAAC,MAAM;AACpB,IAAI,MAAM,MAAO,GAAE,KAAK,CAAC,SAAS,EAAE,CAAA;AACpC;AACA,IAAI,IAAI,SAAA,KAAc,KAAA,IAAS,MAAA,GAAS,YAAA,GAAe,YAAY,EAAE;AACrE,MAAM,SAAA,GAAY,IAAI,CAAA;AACtB,MAAM,IAAI,OAAO,EAAE;AACnB,QAAQ,QAAQ,EAAE,CAAA;AAClB,OAAM;AACN,KAAI;AACJ;AACA,IAAI,IAAI,MAAA,GAAS,YAAa,GAAE,YAAY,EAAE;AAC9C,MAAM,SAAA,GAAY,KAAK,CAAA;AACvB,KAAI;AACJ,GAAG,EAAE,EAAE,CAAC,CAAA;AACR;AACA,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;AACnB,KAAK;AACL,IAAI,OAAO,EAAE,CAAC,KAAK,KAAc;AACjC,MAAM,OAAA,GAAU,KAAK,CAAA;AACrB,KAAK;AACL,GAAG,CAAA;AACH,CAAA;AACA;AACA;;AAaA;AACA;AACA;AACO,SAAS,qBAAqB;AACrC,EAAE,KAAK;AACP,EAAE,GAAG;AACL,EAAE,qBAAqB;AACvB,EAAc;AACd,EAAE,MAAM,QAAA,GAAW,GAAA,GAAM,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAA,GAAI,SAAS,CAAA;AAClE;AACA;AACA,EAAE,MAAM,KAAM,GAAE,KAAK,CAAC,QAAQ,CAAC,YAAA,GAAe,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAA,GAAI,SAAS,CAAA;AACzF,EAAE,MAAM,MAAO,GAAE,KAAK,CAAC,QAAQ,CAAC,UAAA,GAAa,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAA,GAAI,SAAS,CAAA;AACtF;AACA,EAAE,OAAO,iBAAiB,CAAC;AAC3B,IAAI,QAAQ;AACZ,IAAI,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC;AAC3C,IAAI,QAAQ,EAAE,KAAK,CAAC,YAAA,IAAgB,GAAG;AACvC,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM,EAAE,QAAS,GAAE,eAAe,CAAC,QAAQ,CAAE,GAAE,SAAS;AAC5D,GAAG,CAAC,CAAA;AACJ;;;;"}
|
||||
150
node_modules/@sentry/utils/esm/baggage.js
generated
vendored
Normal file
150
node_modules/@sentry/utils/esm/baggage.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { isString } from './is.js';
|
||||
import { logger } from './logger.js';
|
||||
|
||||
const BAGGAGE_HEADER_NAME = 'baggage';
|
||||
|
||||
const SENTRY_BAGGAGE_KEY_PREFIX = 'sentry-';
|
||||
|
||||
const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/;
|
||||
|
||||
/**
|
||||
* Max length of a serialized baggage string
|
||||
*
|
||||
* https://www.w3.org/TR/baggage/#limits
|
||||
*/
|
||||
const MAX_BAGGAGE_STRING_LENGTH = 8192;
|
||||
|
||||
/**
|
||||
* Takes a baggage header and turns it into Dynamic Sampling Context, by extracting all the "sentry-" prefixed values
|
||||
* from it.
|
||||
*
|
||||
* @param baggageHeader A very bread definition of a baggage header as it might appear in various frameworks.
|
||||
* @returns The Dynamic Sampling Context that was found on `baggageHeader`, if there was any, `undefined` otherwise.
|
||||
*/
|
||||
function baggageHeaderToDynamicSamplingContext(
|
||||
// Very liberal definition of what any incoming header might look like
|
||||
baggageHeader,
|
||||
) {
|
||||
if (!isString(baggageHeader) && !Array.isArray(baggageHeader)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Intermediary object to store baggage key value pairs of incoming baggage headers on.
|
||||
// It is later used to read Sentry-DSC-values from.
|
||||
let baggageObject = {};
|
||||
|
||||
if (Array.isArray(baggageHeader)) {
|
||||
// Combine all baggage headers into one object containing the baggage values so we can later read the Sentry-DSC-values from it
|
||||
baggageObject = baggageHeader.reduce((acc, curr) => {
|
||||
const currBaggageObject = baggageHeaderToObject(curr);
|
||||
for (const key of Object.keys(currBaggageObject)) {
|
||||
acc[key] = currBaggageObject[key];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
} else {
|
||||
// Return undefined if baggage header is an empty string (technically an empty baggage header is not spec conform but
|
||||
// this is how we choose to handle it)
|
||||
if (!baggageHeader) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
baggageObject = baggageHeaderToObject(baggageHeader);
|
||||
}
|
||||
|
||||
// Read all "sentry-" prefixed values out of the baggage object and put it onto a dynamic sampling context object.
|
||||
const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value]) => {
|
||||
if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) {
|
||||
const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length);
|
||||
acc[nonPrefixedKey] = value;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// Only return a dynamic sampling context object if there are keys in it.
|
||||
// A keyless object means there were no sentry values on the header, which means that there is no DSC.
|
||||
if (Object.keys(dynamicSamplingContext).length > 0) {
|
||||
return dynamicSamplingContext ;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns a Dynamic Sampling Object into a baggage header by prefixing all the keys on the object with "sentry-".
|
||||
*
|
||||
* @param dynamicSamplingContext The Dynamic Sampling Context to turn into a header. For convenience and compatibility
|
||||
* with the `getDynamicSamplingContext` method on the Transaction class ,this argument can also be `undefined`. If it is
|
||||
* `undefined` the function will return `undefined`.
|
||||
* @returns a baggage header, created from `dynamicSamplingContext`, or `undefined` either if `dynamicSamplingContext`
|
||||
* was `undefined`, or if `dynamicSamplingContext` didn't contain any values.
|
||||
*/
|
||||
function dynamicSamplingContextToSentryBaggageHeader(
|
||||
// this also takes undefined for convenience and bundle size in other places
|
||||
dynamicSamplingContext,
|
||||
) {
|
||||
if (!dynamicSamplingContext) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Prefix all DSC keys with "sentry-" and put them into a new object
|
||||
const sentryPrefixedDSC = Object.entries(dynamicSamplingContext).reduce(
|
||||
(acc, [dscKey, dscValue]) => {
|
||||
if (dscValue) {
|
||||
acc[`${SENTRY_BAGGAGE_KEY_PREFIX}${dscKey}`] = dscValue;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
return objectToBaggageHeader(sentryPrefixedDSC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will parse a baggage header, which is a simple key-value map, into a flat object.
|
||||
*
|
||||
* @param baggageHeader The baggage header to parse.
|
||||
* @returns a flat object containing all the key-value pairs from `baggageHeader`.
|
||||
*/
|
||||
function baggageHeaderToObject(baggageHeader) {
|
||||
return baggageHeader
|
||||
.split(',')
|
||||
.map(baggageEntry => baggageEntry.split('=').map(keyOrValue => decodeURIComponent(keyOrValue.trim())))
|
||||
.reduce((acc, [key, value]) => {
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns a flat object (key-value pairs) into a baggage header, which is also just key-value pairs.
|
||||
*
|
||||
* @param object The object to turn into a baggage header.
|
||||
* @returns a baggage header string, or `undefined` if the object didn't have any values, since an empty baggage header
|
||||
* is not spec compliant.
|
||||
*/
|
||||
function objectToBaggageHeader(object) {
|
||||
if (Object.keys(object).length === 0) {
|
||||
// An empty baggage header is not spec compliant: We return undefined.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => {
|
||||
const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`;
|
||||
const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`;
|
||||
if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(
|
||||
`Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.`,
|
||||
);
|
||||
return baggageHeader;
|
||||
} else {
|
||||
return newBaggageHeader;
|
||||
}
|
||||
}, '');
|
||||
}
|
||||
|
||||
export { BAGGAGE_HEADER_NAME, MAX_BAGGAGE_STRING_LENGTH, SENTRY_BAGGAGE_KEY_PREFIX, SENTRY_BAGGAGE_KEY_PREFIX_REGEX, baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader };
|
||||
//# sourceMappingURL=baggage.js.map
|
||||
1
node_modules/@sentry/utils/esm/baggage.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/baggage.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
193
node_modules/@sentry/utils/esm/browser.js
generated
vendored
Normal file
193
node_modules/@sentry/utils/esm/browser.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
import { isString } from './is.js';
|
||||
import { getGlobalObject } from './worldwide.js';
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const WINDOW = getGlobalObject();
|
||||
|
||||
const DEFAULT_MAX_STRING_LENGTH = 80;
|
||||
|
||||
/**
|
||||
* Given a child DOM element, returns a query-selector statement describing that
|
||||
* and its ancestors
|
||||
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
|
||||
* @returns generated DOM path
|
||||
*/
|
||||
function htmlTreeAsString(
|
||||
elem,
|
||||
options = {},
|
||||
) {
|
||||
if (!elem) {
|
||||
return '<unknown>';
|
||||
}
|
||||
|
||||
// try/catch both:
|
||||
// - accessing event.target (see getsentry/raven-js#838, #768)
|
||||
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
|
||||
// - can throw an exception in some circumstances.
|
||||
try {
|
||||
let currentElem = elem ;
|
||||
const MAX_TRAVERSE_HEIGHT = 5;
|
||||
const out = [];
|
||||
let height = 0;
|
||||
let len = 0;
|
||||
const separator = ' > ';
|
||||
const sepLength = separator.length;
|
||||
let nextStr;
|
||||
const keyAttrs = Array.isArray(options) ? options : options.keyAttrs;
|
||||
const maxStringLength = (!Array.isArray(options) && options.maxStringLength) || DEFAULT_MAX_STRING_LENGTH;
|
||||
|
||||
while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
|
||||
nextStr = _htmlElementAsString(currentElem, keyAttrs);
|
||||
// bail out if
|
||||
// - nextStr is the 'html' element
|
||||
// - the length of the string that would be created exceeds maxStringLength
|
||||
// (ignore this limit if we are on the first iteration)
|
||||
if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength)) {
|
||||
break;
|
||||
}
|
||||
|
||||
out.push(nextStr);
|
||||
|
||||
len += nextStr.length;
|
||||
currentElem = currentElem.parentNode;
|
||||
}
|
||||
|
||||
return out.reverse().join(separator);
|
||||
} catch (_oO) {
|
||||
return '<unknown>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a simple, query-selector representation of a DOM element
|
||||
* e.g. [HTMLElement] => input#foo.btn[name=baz]
|
||||
* @returns generated DOM path
|
||||
*/
|
||||
function _htmlElementAsString(el, keyAttrs) {
|
||||
const elem = el
|
||||
|
||||
;
|
||||
|
||||
const out = [];
|
||||
let className;
|
||||
let classes;
|
||||
let key;
|
||||
let attr;
|
||||
let i;
|
||||
|
||||
if (!elem || !elem.tagName) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// @ts-expect-error WINDOW has HTMLElement
|
||||
if (WINDOW.HTMLElement) {
|
||||
// If using the component name annotation plugin, this value may be available on the DOM node
|
||||
if (elem instanceof HTMLElement && elem.dataset && elem.dataset['sentryComponent']) {
|
||||
return elem.dataset['sentryComponent'];
|
||||
}
|
||||
}
|
||||
|
||||
out.push(elem.tagName.toLowerCase());
|
||||
|
||||
// Pairs of attribute keys defined in `serializeAttribute` and their values on element.
|
||||
const keyAttrPairs =
|
||||
keyAttrs && keyAttrs.length
|
||||
? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)])
|
||||
: null;
|
||||
|
||||
if (keyAttrPairs && keyAttrPairs.length) {
|
||||
keyAttrPairs.forEach(keyAttrPair => {
|
||||
out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`);
|
||||
});
|
||||
} else {
|
||||
if (elem.id) {
|
||||
out.push(`#${elem.id}`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
className = elem.className;
|
||||
if (className && isString(className)) {
|
||||
classes = className.split(/\s+/);
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
out.push(`.${classes[i]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
const allowedAttrs = ['aria-label', 'type', 'name', 'title', 'alt'];
|
||||
for (i = 0; i < allowedAttrs.length; i++) {
|
||||
key = allowedAttrs[i];
|
||||
attr = elem.getAttribute(key);
|
||||
if (attr) {
|
||||
out.push(`[${key}="${attr}"]`);
|
||||
}
|
||||
}
|
||||
return out.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* A safe form of location.href
|
||||
*/
|
||||
function getLocationHref() {
|
||||
try {
|
||||
return WINDOW.document.location.href;
|
||||
} catch (oO) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a DOM element by using document.querySelector.
|
||||
*
|
||||
* This wrapper will first check for the existance of the function before
|
||||
* actually calling it so that we don't have to take care of this check,
|
||||
* every time we want to access the DOM.
|
||||
*
|
||||
* Reason: DOM/querySelector is not available in all environments.
|
||||
*
|
||||
* We have to cast to any because utils can be consumed by a variety of environments,
|
||||
* and we don't want to break TS users. If you know what element will be selected by
|
||||
* `document.querySelector`, specify it as part of the generic call. For example,
|
||||
* `const element = getDomElement<Element>('selector');`
|
||||
*
|
||||
* @param selector the selector string passed on to document.querySelector
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function getDomElement(selector) {
|
||||
if (WINDOW.document && WINDOW.document.querySelector) {
|
||||
return WINDOW.document.querySelector(selector) ;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOM element, traverses up the tree until it finds the first ancestor node
|
||||
* that has the `data-sentry-component` attribute. This attribute is added at build-time
|
||||
* by projects that have the component name annotation plugin installed.
|
||||
*
|
||||
* @returns a string representation of the component for the provided DOM element, or `null` if not found
|
||||
*/
|
||||
function getComponentName(elem) {
|
||||
// @ts-expect-error WINDOW has HTMLElement
|
||||
if (!WINDOW.HTMLElement) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let currentElem = elem ;
|
||||
const MAX_TRAVERSE_HEIGHT = 5;
|
||||
for (let i = 0; i < MAX_TRAVERSE_HEIGHT; i++) {
|
||||
if (!currentElem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (currentElem instanceof HTMLElement && currentElem.dataset['sentryComponent']) {
|
||||
return currentElem.dataset['sentryComponent'];
|
||||
}
|
||||
|
||||
currentElem = currentElem.parentNode;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export { getComponentName, getDomElement, getLocationHref, htmlTreeAsString };
|
||||
//# sourceMappingURL=browser.js.map
|
||||
1
node_modules/@sentry/utils/esm/browser.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/browser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/@sentry/utils/esm/buildPolyfills/README.md
generated
vendored
Normal file
15
node_modules/@sentry/utils/esm/buildPolyfills/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
## Build Polyfills
|
||||
|
||||
This is a collection of syntax and import/export polyfills either copied directly from or heavily inspired by those used by [Rollup](https://github.com/rollup/rollup) and [Sucrase](https://github.com/alangpierce/sucrase). When either tool uses one of these polyfills during a build, it injects the function source code into each file needing the function, which can lead to a great deal of duplication. For our builds, we have therefore implemented something similar to [`tsc`'s `importHelpers` behavior](https://www.typescriptlang.org/tsconfig#importHelpers): Instead of leaving the polyfills injected in multiple places, we instead replace each injected function with an `import` or `require` statement.
|
||||
|
||||
Note that not all polyfills are currently used by the SDK, but all are included here for future compatitibility, should they ever be needed. Also, since we're never going to be calling these directly from within another TS file, their types are fairly generic. In some cases testing required more specific types, which can be found in the test files.
|
||||
|
||||
--------
|
||||
|
||||
_Code from both Rollup and Sucrase is used under the MIT license, copyright 2017 and 2012-2018, respectively._
|
||||
|
||||
_Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:_
|
||||
|
||||
_The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software._
|
||||
|
||||
_THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE._
|
||||
32
node_modules/@sentry/utils/esm/buildPolyfills/_asyncNullishCoalesce.js
generated
vendored
Normal file
32
node_modules/@sentry/utils/esm/buildPolyfills/_asyncNullishCoalesce.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { _nullishCoalesce } from './_nullishCoalesce.js';
|
||||
|
||||
// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f
|
||||
|
||||
/**
|
||||
* Polyfill for the nullish coalescing operator (`??`), when used in situations where at least one of the values is the
|
||||
* result of an async operation.
|
||||
*
|
||||
* Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the
|
||||
* LHS evaluates to a nullish value, to mimic the operator's short-circuiting behavior.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase)
|
||||
*
|
||||
* @param lhs The value of the expression to the left of the `??`
|
||||
* @param rhsFn A function returning the value of the expression to the right of the `??`
|
||||
* @returns The LHS value, unless it's `null` or `undefined`, in which case, the RHS value
|
||||
*/
|
||||
async function _asyncNullishCoalesce(lhs, rhsFn) {
|
||||
return _nullishCoalesce(lhs, rhsFn);
|
||||
}
|
||||
|
||||
// Sucrase version:
|
||||
// async function _asyncNullishCoalesce(lhs, rhsFn) {
|
||||
// if (lhs != null) {
|
||||
// return lhs;
|
||||
// } else {
|
||||
// return await rhsFn();
|
||||
// }
|
||||
// }
|
||||
|
||||
export { _asyncNullishCoalesce };
|
||||
//# sourceMappingURL=_asyncNullishCoalesce.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncNullishCoalesce.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncNullishCoalesce.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_asyncNullishCoalesce.js","sources":["../../../src/buildPolyfills/_asyncNullishCoalesce.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport { _nullishCoalesce } from './_nullishCoalesce';\n\n/**\n * Polyfill for the nullish coalescing operator (`??`), when used in situations where at least one of the values is the\n * result of an async operation.\n *\n * Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the\n * LHS evaluates to a nullish value, to mimic the operator's short-circuiting behavior.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase)\n *\n * @param lhs The value of the expression to the left of the `??`\n * @param rhsFn A function returning the value of the expression to the right of the `??`\n * @returns The LHS value, unless it's `null` or `undefined`, in which case, the RHS value\n */\nexport async function _asyncNullishCoalesce(lhs: unknown, rhsFn: () => unknown): Promise<unknown> {\n return _nullishCoalesce(lhs, rhsFn);\n}\n\n// Sucrase version:\n// async function _asyncNullishCoalesce(lhs, rhsFn) {\n// if (lhs != null) {\n// return lhs;\n// } else {\n// return await rhsFn();\n// }\n// }\n"],"names":[],"mappings":";;AAAA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,qBAAqB,CAAC,GAAG,EAAW,KAAK,EAAmC;AAClG,EAAE,OAAO,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACrC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
59
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChain.js
generated
vendored
Normal file
59
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChain.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,
|
||||
* descriptors, and functions, for situations in which at least one part of the expression is async.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase) See
|
||||
* https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15
|
||||
*
|
||||
* @param ops Array result of expression conversion
|
||||
* @returns The value of the expression
|
||||
*/
|
||||
async function _asyncOptionalChain(ops) {
|
||||
let lastAccessLHS = undefined;
|
||||
let value = ops[0];
|
||||
let i = 1;
|
||||
while (i < ops.length) {
|
||||
const op = ops[i] ;
|
||||
const fn = ops[i + 1] ;
|
||||
i += 2;
|
||||
// by checking for loose equality to `null`, we catch both `null` and `undefined`
|
||||
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
||||
// really we're meaning to return `undefined` as an actual value here, but it saves bytes not to write it
|
||||
return;
|
||||
}
|
||||
if (op === 'access' || op === 'optionalAccess') {
|
||||
lastAccessLHS = value;
|
||||
value = await fn(value);
|
||||
} else if (op === 'call' || op === 'optionalCall') {
|
||||
value = await fn((...args) => (value ).call(lastAccessLHS, ...args));
|
||||
lastAccessLHS = undefined;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Sucrase version:
|
||||
// async function _asyncOptionalChain(ops) {
|
||||
// let lastAccessLHS = undefined;
|
||||
// let value = ops[0];
|
||||
// let i = 1;
|
||||
// while (i < ops.length) {
|
||||
// const op = ops[i];
|
||||
// const fn = ops[i + 1];
|
||||
// i += 2;
|
||||
// if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
||||
// return undefined;
|
||||
// }
|
||||
// if (op === 'access' || op === 'optionalAccess') {
|
||||
// lastAccessLHS = value;
|
||||
// value = await fn(value);
|
||||
// } else if (op === 'call' || op === 'optionalCall') {
|
||||
// value = await fn((...args) => value.call(lastAccessLHS, ...args));
|
||||
// lastAccessLHS = undefined;
|
||||
// }
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
|
||||
export { _asyncOptionalChain };
|
||||
//# sourceMappingURL=_asyncOptionalChain.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChain.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_asyncOptionalChain.js","sources":["../../../src/buildPolyfills/_asyncOptionalChain.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport type { GenericFunction } from './types';\n\n/**\n * Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,\n * descriptors, and functions, for situations in which at least one part of the expression is async.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase) See\n * https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15\n *\n * @param ops Array result of expression conversion\n * @returns The value of the expression\n */\nexport async function _asyncOptionalChain(ops: unknown[]): Promise<unknown> {\n let lastAccessLHS: unknown = undefined;\n let value = ops[0];\n let i = 1;\n while (i < ops.length) {\n const op = ops[i] as string;\n const fn = ops[i + 1] as (intermediateValue: unknown) => Promise<unknown>;\n i += 2;\n // by checking for loose equality to `null`, we catch both `null` and `undefined`\n if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {\n // really we're meaning to return `undefined` as an actual value here, but it saves bytes not to write it\n return;\n }\n if (op === 'access' || op === 'optionalAccess') {\n lastAccessLHS = value;\n value = await fn(value);\n } else if (op === 'call' || op === 'optionalCall') {\n value = await fn((...args: unknown[]) => (value as GenericFunction).call(lastAccessLHS, ...args));\n lastAccessLHS = undefined;\n }\n }\n return value;\n}\n\n// Sucrase version:\n// async function _asyncOptionalChain(ops) {\n// let lastAccessLHS = undefined;\n// let value = ops[0];\n// let i = 1;\n// while (i < ops.length) {\n// const op = ops[i];\n// const fn = ops[i + 1];\n// i += 2;\n// if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {\n// return undefined;\n// }\n// if (op === 'access' || op === 'optionalAccess') {\n// lastAccessLHS = value;\n// value = await fn(value);\n// } else if (op === 'call' || op === 'optionalCall') {\n// value = await fn((...args) => value.call(lastAccessLHS, ...args));\n// lastAccessLHS = undefined;\n// }\n// }\n// return value;\n// }\n"],"names":[],"mappings":"AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,mBAAmB,CAAC,GAAG,EAA+B;AAC5E,EAAE,IAAI,aAAa,GAAY,SAAS,CAAA;AACxC,EAAE,IAAI,KAAM,GAAE,GAAG,CAAC,CAAC,CAAC,CAAA;AACpB,EAAE,IAAI,CAAE,GAAE,CAAC,CAAA;AACX,EAAE,OAAO,CAAA,GAAI,GAAG,CAAC,MAAM,EAAE;AACzB,IAAI,MAAM,EAAG,GAAE,GAAG,CAAC,CAAC,CAAE,EAAA;AACtB,IAAI,MAAM,KAAK,GAAG,CAAC,CAAE,GAAE,CAAC,CAAE,EAAA;AAC1B,IAAI,CAAA,IAAK,CAAC,CAAA;AACV;AACA,IAAI,IAAI,CAAC,EAAA,KAAO,gBAAiB,IAAG,EAAG,KAAI,cAAc,KAAK,KAAM,IAAG,IAAI,EAAE;AAC7E;AACA,MAAM,OAAM;AACZ,KAAI;AACJ,IAAI,IAAI,EAAG,KAAI,YAAY,EAAA,KAAO,gBAAgB,EAAE;AACpD,MAAM,aAAA,GAAgB,KAAK,CAAA;AAC3B,MAAM,QAAQ,MAAM,EAAE,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAI,MAAO,IAAI,EAAA,KAAO,MAAA,IAAU,EAAA,KAAO,cAAc,EAAE;AACvD,MAAM,KAAA,GAAQ,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI,KAAgB,CAAC,KAAM,GAAoB,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;AACvG,MAAM,aAAA,GAAgB,SAAS,CAAA;AAC/B,KAAI;AACJ,GAAE;AACF,EAAE,OAAO,KAAK,CAAA;AACd,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
32
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChainDelete.js
generated
vendored
Normal file
32
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChainDelete.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { _asyncOptionalChain } from './_asyncOptionalChain.js';
|
||||
|
||||
// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f
|
||||
|
||||
/**
|
||||
* Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,
|
||||
* descriptors, and functions, in cases where the value of the expression is to be deleted.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase) See
|
||||
* https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15
|
||||
*
|
||||
* @param ops Array result of expression conversion
|
||||
* @returns The return value of the `delete` operator: `true`, unless the deletion target is an own, non-configurable
|
||||
* property (one which can't be deleted or turned into an accessor, and whose enumerability can't be changed), in which
|
||||
* case `false`.
|
||||
*/
|
||||
async function _asyncOptionalChainDelete(ops) {
|
||||
const result = (await _asyncOptionalChain(ops)) ;
|
||||
// If `result` is `null`, it means we didn't get to the end of the chain and so nothing was deleted (in which case,
|
||||
// return `true` since that's what `delete` does when it no-ops). If it's non-null, we know the delete happened, in
|
||||
// which case we return whatever the `delete` returned, which will be a boolean.
|
||||
return result == null ? true : (result );
|
||||
}
|
||||
|
||||
// Sucrase version:
|
||||
// async function asyncOptionalChainDelete(ops) {
|
||||
// const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
|
||||
// return result == null ? true : result;
|
||||
// }
|
||||
|
||||
export { _asyncOptionalChainDelete };
|
||||
//# sourceMappingURL=_asyncOptionalChainDelete.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChainDelete.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_asyncOptionalChainDelete.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_asyncOptionalChainDelete.js","sources":["../../../src/buildPolyfills/_asyncOptionalChainDelete.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport { _asyncOptionalChain } from './_asyncOptionalChain';\n\n/**\n * Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,\n * descriptors, and functions, in cases where the value of the expression is to be deleted.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase) See\n * https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15\n *\n * @param ops Array result of expression conversion\n * @returns The return value of the `delete` operator: `true`, unless the deletion target is an own, non-configurable\n * property (one which can't be deleted or turned into an accessor, and whose enumerability can't be changed), in which\n * case `false`.\n */\nexport async function _asyncOptionalChainDelete(ops: unknown[]): Promise<boolean> {\n const result = (await _asyncOptionalChain(ops)) as Promise<boolean | null>;\n // If `result` is `null`, it means we didn't get to the end of the chain and so nothing was deleted (in which case,\n // return `true` since that's what `delete` does when it no-ops). If it's non-null, we know the delete happened, in\n // which case we return whatever the `delete` returned, which will be a boolean.\n return result == null ? true : (result as Promise<boolean>);\n}\n\n// Sucrase version:\n// async function asyncOptionalChainDelete(ops) {\n// const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);\n// return result == null ? true : result;\n// }\n"],"names":[],"mappings":";;AAAA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,yBAAyB,CAAC,GAAG,EAA+B;AAClF,EAAE,MAAM,UAAU,MAAM,mBAAmB,CAAC,GAAG,CAAC,CAAE,EAAA;AAClD;AACA;AACA;AACA,EAAE,OAAO,UAAU,IAAA,GAAO,IAAK,IAAG,MAAA,EAA2B,CAAA;AAC7D,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
52
node_modules/@sentry/utils/esm/buildPolyfills/_nullishCoalesce.js
generated
vendored
Normal file
52
node_modules/@sentry/utils/esm/buildPolyfills/_nullishCoalesce.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f
|
||||
//
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2012-2018 various contributors (see AUTHORS)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
/**
|
||||
* Polyfill for the nullish coalescing operator (`??`).
|
||||
*
|
||||
* Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the
|
||||
* LHS evaluates to a nullish value, to mimic the operator's short-circuiting behavior.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase)
|
||||
*
|
||||
* @param lhs The value of the expression to the left of the `??`
|
||||
* @param rhsFn A function returning the value of the expression to the right of the `??`
|
||||
* @returns The LHS value, unless it's `null` or `undefined`, in which case, the RHS value
|
||||
*/
|
||||
function _nullishCoalesce(lhs, rhsFn) {
|
||||
// by checking for loose equality to `null`, we catch both `null` and `undefined`
|
||||
return lhs != null ? lhs : rhsFn();
|
||||
}
|
||||
|
||||
// Sucrase version:
|
||||
// function _nullishCoalesce(lhs, rhsFn) {
|
||||
// if (lhs != null) {
|
||||
// return lhs;
|
||||
// } else {
|
||||
// return rhsFn();
|
||||
// }
|
||||
// }
|
||||
|
||||
export { _nullishCoalesce };
|
||||
//# sourceMappingURL=_nullishCoalesce.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_nullishCoalesce.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_nullishCoalesce.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_nullishCoalesce.js","sources":["../../../src/buildPolyfills/_nullishCoalesce.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n/**\n * Polyfill for the nullish coalescing operator (`??`).\n *\n * Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the\n * LHS evaluates to a nullish value, to mimic the operator's short-circuiting behavior.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase)\n *\n * @param lhs The value of the expression to the left of the `??`\n * @param rhsFn A function returning the value of the expression to the right of the `??`\n * @returns The LHS value, unless it's `null` or `undefined`, in which case, the RHS value\n */\nexport function _nullishCoalesce(lhs: unknown, rhsFn: () => unknown): unknown {\n // by checking for loose equality to `null`, we catch both `null` and `undefined`\n return lhs != null ? lhs : rhsFn();\n}\n\n// Sucrase version:\n// function _nullishCoalesce(lhs, rhsFn) {\n// if (lhs != null) {\n// return lhs;\n// } else {\n// return rhsFn();\n// }\n// }\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,GAAG,EAAW,KAAK,EAA0B;AAC9E;AACA,EAAE,OAAO,OAAO,IAAA,GAAO,GAAI,GAAE,KAAK,EAAE,CAAA;AACpC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
59
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.js
generated
vendored
Normal file
59
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,
|
||||
* descriptors, and functions.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase)
|
||||
* See https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15
|
||||
*
|
||||
* @param ops Array result of expression conversion
|
||||
* @returns The value of the expression
|
||||
*/
|
||||
function _optionalChain(ops) {
|
||||
let lastAccessLHS = undefined;
|
||||
let value = ops[0];
|
||||
let i = 1;
|
||||
while (i < ops.length) {
|
||||
const op = ops[i] ;
|
||||
const fn = ops[i + 1] ;
|
||||
i += 2;
|
||||
// by checking for loose equality to `null`, we catch both `null` and `undefined`
|
||||
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
||||
// really we're meaning to return `undefined` as an actual value here, but it saves bytes not to write it
|
||||
return;
|
||||
}
|
||||
if (op === 'access' || op === 'optionalAccess') {
|
||||
lastAccessLHS = value;
|
||||
value = fn(value);
|
||||
} else if (op === 'call' || op === 'optionalCall') {
|
||||
value = fn((...args) => (value ).call(lastAccessLHS, ...args));
|
||||
lastAccessLHS = undefined;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Sucrase version
|
||||
// function _optionalChain(ops) {
|
||||
// let lastAccessLHS = undefined;
|
||||
// let value = ops[0];
|
||||
// let i = 1;
|
||||
// while (i < ops.length) {
|
||||
// const op = ops[i];
|
||||
// const fn = ops[i + 1];
|
||||
// i += 2;
|
||||
// if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
||||
// return undefined;
|
||||
// }
|
||||
// if (op === 'access' || op === 'optionalAccess') {
|
||||
// lastAccessLHS = value;
|
||||
// value = fn(value);
|
||||
// } else if (op === 'call' || op === 'optionalCall') {
|
||||
// value = fn((...args) => value.call(lastAccessLHS, ...args));
|
||||
// lastAccessLHS = undefined;
|
||||
// }
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
|
||||
export { _optionalChain };
|
||||
//# sourceMappingURL=_optionalChain.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_optionalChain.js","sources":["../../../src/buildPolyfills/_optionalChain.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport type { GenericFunction } from './types';\n\n/**\n * Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,\n * descriptors, and functions.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase)\n * See https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15\n *\n * @param ops Array result of expression conversion\n * @returns The value of the expression\n */\nexport function _optionalChain(ops: unknown[]): unknown {\n let lastAccessLHS: unknown = undefined;\n let value = ops[0];\n let i = 1;\n while (i < ops.length) {\n const op = ops[i] as string;\n const fn = ops[i + 1] as (intermediateValue: unknown) => unknown;\n i += 2;\n // by checking for loose equality to `null`, we catch both `null` and `undefined`\n if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {\n // really we're meaning to return `undefined` as an actual value here, but it saves bytes not to write it\n return;\n }\n if (op === 'access' || op === 'optionalAccess') {\n lastAccessLHS = value;\n value = fn(value);\n } else if (op === 'call' || op === 'optionalCall') {\n value = fn((...args: unknown[]) => (value as GenericFunction).call(lastAccessLHS, ...args));\n lastAccessLHS = undefined;\n }\n }\n return value;\n}\n\n// Sucrase version\n// function _optionalChain(ops) {\n// let lastAccessLHS = undefined;\n// let value = ops[0];\n// let i = 1;\n// while (i < ops.length) {\n// const op = ops[i];\n// const fn = ops[i + 1];\n// i += 2;\n// if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {\n// return undefined;\n// }\n// if (op === 'access' || op === 'optionalAccess') {\n// lastAccessLHS = value;\n// value = fn(value);\n// } else if (op === 'call' || op === 'optionalCall') {\n// value = fn((...args) => value.call(lastAccessLHS, ...args));\n// lastAccessLHS = undefined;\n// }\n// }\n// return value;\n// }\n"],"names":[],"mappings":"AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,GAAG,EAAsB;AACxD,EAAE,IAAI,aAAa,GAAY,SAAS,CAAA;AACxC,EAAE,IAAI,KAAM,GAAE,GAAG,CAAC,CAAC,CAAC,CAAA;AACpB,EAAE,IAAI,CAAE,GAAE,CAAC,CAAA;AACX,EAAE,OAAO,CAAA,GAAI,GAAG,CAAC,MAAM,EAAE;AACzB,IAAI,MAAM,EAAG,GAAE,GAAG,CAAC,CAAC,CAAE,EAAA;AACtB,IAAI,MAAM,KAAK,GAAG,CAAC,CAAE,GAAE,CAAC,CAAE,EAAA;AAC1B,IAAI,CAAA,IAAK,CAAC,CAAA;AACV;AACA,IAAI,IAAI,CAAC,EAAA,KAAO,gBAAiB,IAAG,EAAG,KAAI,cAAc,KAAK,KAAM,IAAG,IAAI,EAAE;AAC7E;AACA,MAAM,OAAM;AACZ,KAAI;AACJ,IAAI,IAAI,EAAG,KAAI,YAAY,EAAA,KAAO,gBAAgB,EAAE;AACpD,MAAM,aAAA,GAAgB,KAAK,CAAA;AAC3B,MAAM,KAAM,GAAE,EAAE,CAAC,KAAK,CAAC,CAAA;AACvB,KAAI,MAAO,IAAI,EAAA,KAAO,MAAA,IAAU,EAAA,KAAO,cAAc,EAAE;AACvD,MAAM,KAAA,GAAQ,EAAE,CAAC,CAAC,GAAG,IAAI,KAAgB,CAAC,QAA0B,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;AACjG,MAAM,aAAA,GAAgB,SAAS,CAAA;AAC/B,KAAI;AACJ,GAAE;AACF,EAAE,OAAO,KAAK,CAAA;AACd,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
33
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChainDelete.js
generated
vendored
Normal file
33
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChainDelete.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { _optionalChain } from './_optionalChain.js';
|
||||
|
||||
// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f
|
||||
|
||||
/**
|
||||
* Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,
|
||||
* descriptors, and functions, in cases where the value of the expression is to be deleted.
|
||||
*
|
||||
* Adapted from Sucrase (https://github.com/alangpierce/sucrase) See
|
||||
* https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15
|
||||
*
|
||||
* @param ops Array result of expression conversion
|
||||
* @returns The return value of the `delete` operator: `true`, unless the deletion target is an own, non-configurable
|
||||
* property (one which can't be deleted or turned into an accessor, and whose enumerability can't be changed), in which
|
||||
* case `false`.
|
||||
*/
|
||||
function _optionalChainDelete(ops) {
|
||||
const result = _optionalChain(ops) ;
|
||||
// If `result` is `null`, it means we didn't get to the end of the chain and so nothing was deleted (in which case,
|
||||
// return `true` since that's what `delete` does when it no-ops). If it's non-null, we know the delete happened, in
|
||||
// which case we return whatever the `delete` returned, which will be a boolean.
|
||||
return result == null ? true : result;
|
||||
}
|
||||
|
||||
// Sucrase version:
|
||||
// function _optionalChainDelete(ops) {
|
||||
// const result = _optionalChain(ops);
|
||||
// // by checking for loose equality to `null`, we catch both `null` and `undefined`
|
||||
// return result == null ? true : result;
|
||||
// }
|
||||
|
||||
export { _optionalChainDelete };
|
||||
//# sourceMappingURL=_optionalChainDelete.js.map
|
||||
1
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChainDelete.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/buildPolyfills/_optionalChainDelete.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_optionalChainDelete.js","sources":["../../../src/buildPolyfills/_optionalChainDelete.ts"],"sourcesContent":["// https://github.com/alangpierce/sucrase/tree/265887868966917f3b924ce38dfad01fbab1329f\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2012-2018 various contributors (see AUTHORS)\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport { _optionalChain } from './_optionalChain';\n\n/**\n * Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values,\n * descriptors, and functions, in cases where the value of the expression is to be deleted.\n *\n * Adapted from Sucrase (https://github.com/alangpierce/sucrase) See\n * https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15\n *\n * @param ops Array result of expression conversion\n * @returns The return value of the `delete` operator: `true`, unless the deletion target is an own, non-configurable\n * property (one which can't be deleted or turned into an accessor, and whose enumerability can't be changed), in which\n * case `false`.\n */\nexport function _optionalChainDelete(ops: unknown[]): boolean {\n const result = _optionalChain(ops) as boolean | null;\n // If `result` is `null`, it means we didn't get to the end of the chain and so nothing was deleted (in which case,\n // return `true` since that's what `delete` does when it no-ops). If it's non-null, we know the delete happened, in\n // which case we return whatever the `delete` returned, which will be a boolean.\n return result == null ? true : result;\n}\n\n// Sucrase version:\n// function _optionalChainDelete(ops) {\n// const result = _optionalChain(ops);\n// // by checking for loose equality to `null`, we catch both `null` and `undefined`\n// return result == null ? true : result;\n// }\n"],"names":[],"mappings":";;AAAA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,GAAG,EAAsB;AAC9D,EAAE,MAAM,MAAO,GAAE,cAAc,CAAC,GAAG,CAAE,EAAA;AACrC;AACA;AACA;AACA,EAAE,OAAO,MAAO,IAAG,OAAO,IAAA,GAAO,MAAM,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
||||
67
node_modules/@sentry/utils/esm/cache.js
generated
vendored
Normal file
67
node_modules/@sentry/utils/esm/cache.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Creates a cache that evicts keys in fifo order
|
||||
* @param size {Number}
|
||||
*/
|
||||
function makeFifoCache(
|
||||
size,
|
||||
)
|
||||
|
||||
{
|
||||
// Maintain a fifo queue of keys, we cannot rely on Object.keys as the browser may not support it.
|
||||
let evictionOrder = [];
|
||||
let cache = {};
|
||||
|
||||
return {
|
||||
add(key, value) {
|
||||
while (evictionOrder.length >= size) {
|
||||
// shift is O(n) but this is small size and only happens if we are
|
||||
// exceeding the cache size so it should be fine.
|
||||
const evictCandidate = evictionOrder.shift();
|
||||
|
||||
if (evictCandidate !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete cache[evictCandidate];
|
||||
}
|
||||
}
|
||||
|
||||
// in case we have a collision, delete the old key.
|
||||
if (cache[key]) {
|
||||
this.delete(key);
|
||||
}
|
||||
|
||||
evictionOrder.push(key);
|
||||
cache[key] = value;
|
||||
},
|
||||
clear() {
|
||||
cache = {};
|
||||
evictionOrder = [];
|
||||
},
|
||||
get(key) {
|
||||
return cache[key];
|
||||
},
|
||||
size() {
|
||||
return evictionOrder.length;
|
||||
},
|
||||
// Delete cache key and return true if it existed, false otherwise.
|
||||
delete(key) {
|
||||
if (!cache[key]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete cache[key];
|
||||
|
||||
for (let i = 0; i < evictionOrder.length; i++) {
|
||||
if (evictionOrder[i] === key) {
|
||||
evictionOrder.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export { makeFifoCache };
|
||||
//# sourceMappingURL=cache.js.map
|
||||
1
node_modules/@sentry/utils/esm/cache.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/cache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cache.js","sources":["../../src/cache.ts"],"sourcesContent":["/**\n * Creates a cache that evicts keys in fifo order\n * @param size {Number}\n */\nexport function makeFifoCache<Key extends string, Value>(\n size: number,\n): {\n get: (key: Key) => Value | undefined;\n add: (key: Key, value: Value) => void;\n delete: (key: Key) => boolean;\n clear: () => void;\n size: () => number;\n} {\n // Maintain a fifo queue of keys, we cannot rely on Object.keys as the browser may not support it.\n let evictionOrder: Key[] = [];\n let cache: Record<string, Value> = {};\n\n return {\n add(key: Key, value: Value) {\n while (evictionOrder.length >= size) {\n // shift is O(n) but this is small size and only happens if we are\n // exceeding the cache size so it should be fine.\n const evictCandidate = evictionOrder.shift();\n\n if (evictCandidate !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete cache[evictCandidate];\n }\n }\n\n // in case we have a collision, delete the old key.\n if (cache[key]) {\n this.delete(key);\n }\n\n evictionOrder.push(key);\n cache[key] = value;\n },\n clear() {\n cache = {};\n evictionOrder = [];\n },\n get(key: Key): Value | undefined {\n return cache[key];\n },\n size() {\n return evictionOrder.length;\n },\n // Delete cache key and return true if it existed, false otherwise.\n delete(key: Key): boolean {\n if (!cache[key]) {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete cache[key];\n\n for (let i = 0; i < evictionOrder.length; i++) {\n if (evictionOrder[i] === key) {\n evictionOrder.splice(i, 1);\n break;\n }\n }\n\n return true;\n },\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,IAAI;AACN;;AAMA,CAAE;AACF;AACA,EAAE,IAAI,aAAa,GAAU,EAAE,CAAA;AAC/B,EAAE,IAAI,KAAK,GAA0B,EAAE,CAAA;AACvC;AACA,EAAE,OAAO;AACT,IAAI,GAAG,CAAC,GAAG,EAAO,KAAK,EAAS;AAChC,MAAM,OAAO,aAAa,CAAC,MAAO,IAAG,IAAI,EAAE;AAC3C;AACA;AACA,QAAQ,MAAM,cAAe,GAAE,aAAa,CAAC,KAAK,EAAE,CAAA;AACpD;AACA,QAAQ,IAAI,cAAe,KAAI,SAAS,EAAE;AAC1C;AACA,UAAU,OAAO,KAAK,CAAC,cAAc,CAAC,CAAA;AACtC,SAAQ;AACR,OAAM;AACN;AACA;AACA,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;AACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AACxB,OAAM;AACN;AACA,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC7B,MAAM,KAAK,CAAC,GAAG,CAAA,GAAI,KAAK,CAAA;AACxB,KAAK;AACL,IAAI,KAAK,GAAG;AACZ,MAAM,KAAA,GAAQ,EAAE,CAAA;AAChB,MAAM,aAAA,GAAgB,EAAE,CAAA;AACxB,KAAK;AACL,IAAI,GAAG,CAAC,GAAG,EAA0B;AACrC,MAAM,OAAO,KAAK,CAAC,GAAG,CAAC,CAAA;AACvB,KAAK;AACL,IAAI,IAAI,GAAG;AACX,MAAM,OAAO,aAAa,CAAC,MAAM,CAAA;AACjC,KAAK;AACL;AACA,IAAI,MAAM,CAAC,GAAG,EAAgB;AAC9B,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;AACvB,QAAQ,OAAO,KAAK,CAAA;AACpB,OAAM;AACN;AACA;AACA,MAAM,OAAO,KAAK,CAAC,GAAG,CAAC,CAAA;AACvB;AACA,MAAM,KAAK,IAAI,CAAA,GAAI,CAAC,EAAE,CAAE,GAAE,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACrD,QAAQ,IAAI,aAAa,CAAC,CAAC,CAAE,KAAI,GAAG,EAAE;AACtC,UAAU,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACpC,UAAU,MAAK;AACf,SAAQ;AACR,OAAM;AACN;AACA,MAAM,OAAO,IAAI,CAAA;AACjB,KAAK;AACL,GAAG,CAAA;AACH;;;;"}
|
||||
25
node_modules/@sentry/utils/esm/clientreport.js
generated
vendored
Normal file
25
node_modules/@sentry/utils/esm/clientreport.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { createEnvelope } from './envelope.js';
|
||||
import { dateTimestampInSeconds } from './time.js';
|
||||
|
||||
/**
|
||||
* Creates client report envelope
|
||||
* @param discarded_events An array of discard events
|
||||
* @param dsn A DSN that can be set on the header. Optional.
|
||||
*/
|
||||
function createClientReportEnvelope(
|
||||
discarded_events,
|
||||
dsn,
|
||||
timestamp,
|
||||
) {
|
||||
const clientReportItem = [
|
||||
{ type: 'client_report' },
|
||||
{
|
||||
timestamp: timestamp || dateTimestampInSeconds(),
|
||||
discarded_events,
|
||||
},
|
||||
];
|
||||
return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
|
||||
}
|
||||
|
||||
export { createClientReportEnvelope };
|
||||
//# sourceMappingURL=clientreport.js.map
|
||||
1
node_modules/@sentry/utils/esm/clientreport.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/clientreport.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"clientreport.js","sources":["../../src/clientreport.ts"],"sourcesContent":["import type { ClientReport, ClientReportEnvelope, ClientReportItem } from '@sentry/types';\n\nimport { createEnvelope } from './envelope';\nimport { dateTimestampInSeconds } from './time';\n\n/**\n * Creates client report envelope\n * @param discarded_events An array of discard events\n * @param dsn A DSN that can be set on the header. Optional.\n */\nexport function createClientReportEnvelope(\n discarded_events: ClientReport['discarded_events'],\n dsn?: string,\n timestamp?: number,\n): ClientReportEnvelope {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: timestamp || dateTimestampInSeconds(),\n discarded_events,\n },\n ];\n return createEnvelope<ClientReportEnvelope>(dsn ? { dsn } : {}, [clientReportItem]);\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B;AAC1C,EAAE,gBAAgB;AAClB,EAAE,GAAG;AACL,EAAE,SAAS;AACX,EAAwB;AACxB,EAAE,MAAM,gBAAgB,GAAqB;AAC7C,IAAI,EAAE,IAAI,EAAE,eAAA,EAAiB;AAC7B,IAAI;AACJ,MAAM,SAAS,EAAE,SAAA,IAAa,sBAAsB,EAAE;AACtD,MAAM,gBAAgB;AACtB,KAAK;AACL,GAAG,CAAA;AACH,EAAE,OAAO,cAAc,CAAuB,GAAA,GAAM,EAAE,GAAA,EAAM,GAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAA;AACrF;;;;"}
|
||||
81
node_modules/@sentry/utils/esm/cookie.js
generated
vendored
Normal file
81
node_modules/@sentry/utils/esm/cookie.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* This code was originally copied from the 'cookie` module at v0.5.0 and was simplified for our use case.
|
||||
* https://github.com/jshttp/cookie/blob/a0c84147aab6266bdb3996cf4062e93907c0b0fc/index.js
|
||||
* It had the following license:
|
||||
*
|
||||
* (The MIT License)
|
||||
*
|
||||
* Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
|
||||
* Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* 'Software'), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses a cookie string
|
||||
*/
|
||||
function parseCookie(str) {
|
||||
const obj = {};
|
||||
let index = 0;
|
||||
|
||||
while (index < str.length) {
|
||||
const eqIdx = str.indexOf('=', index);
|
||||
|
||||
// no more cookie pairs
|
||||
if (eqIdx === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
let endIdx = str.indexOf(';', index);
|
||||
|
||||
if (endIdx === -1) {
|
||||
endIdx = str.length;
|
||||
} else if (endIdx < eqIdx) {
|
||||
// backtrack on prior semicolon
|
||||
index = str.lastIndexOf(';', eqIdx - 1) + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
const key = str.slice(index, eqIdx).trim();
|
||||
|
||||
// only assign once
|
||||
if (undefined === obj[key]) {
|
||||
let val = str.slice(eqIdx + 1, endIdx).trim();
|
||||
|
||||
// quoted values
|
||||
if (val.charCodeAt(0) === 0x22) {
|
||||
val = val.slice(1, -1);
|
||||
}
|
||||
|
||||
try {
|
||||
obj[key] = val.indexOf('%') !== -1 ? decodeURIComponent(val) : val;
|
||||
} catch (e) {
|
||||
obj[key] = val;
|
||||
}
|
||||
}
|
||||
|
||||
index = endIdx + 1;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
export { parseCookie };
|
||||
//# sourceMappingURL=cookie.js.map
|
||||
1
node_modules/@sentry/utils/esm/cookie.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/cookie.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cookie.js","sources":["../../src/cookie.ts"],"sourcesContent":["/**\n * This code was originally copied from the 'cookie` module at v0.5.0 and was simplified for our use case.\n * https://github.com/jshttp/cookie/blob/a0c84147aab6266bdb3996cf4062e93907c0b0fc/index.js\n * It had the following license:\n *\n * (The MIT License)\n *\n * Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>\n * Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * 'Software'), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Parses a cookie string\n */\nexport function parseCookie(str: string): Record<string, string> {\n const obj: Record<string, string> = {};\n let index = 0;\n\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === obj[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n obj[key] = val.indexOf('%') !== -1 ? decodeURIComponent(val) : val;\n } catch (e) {\n obj[key] = val;\n }\n }\n\n index = endIdx + 1;\n }\n\n return obj;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,GAAG,EAAkC;AACjE,EAAE,MAAM,GAAG,GAA2B,EAAE,CAAA;AACxC,EAAE,IAAI,KAAM,GAAE,CAAC,CAAA;AACf;AACA,EAAE,OAAO,KAAA,GAAQ,GAAG,CAAC,MAAM,EAAE;AAC7B,IAAI,MAAM,KAAM,GAAE,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACzC;AACA;AACA,IAAI,IAAI,KAAA,KAAU,CAAC,CAAC,EAAE;AACtB,MAAM,MAAK;AACX,KAAI;AACJ;AACA,IAAI,IAAI,MAAO,GAAE,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACxC;AACA,IAAI,IAAI,MAAA,KAAW,CAAC,CAAC,EAAE;AACvB,MAAM,MAAO,GAAE,GAAG,CAAC,MAAM,CAAA;AACzB,WAAW,IAAI,MAAO,GAAE,KAAK,EAAE;AAC/B;AACA,MAAM,KAAM,GAAE,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,KAAM,GAAE,CAAC,CAAA,GAAI,CAAC,CAAA;AACjD,MAAM,SAAQ;AACd,KAAI;AACJ;AACA,IAAI,MAAM,GAAA,GAAM,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC9C;AACA;AACA,IAAI,IAAI,SAAU,KAAI,GAAG,CAAC,GAAG,CAAC,EAAE;AAChC,MAAM,IAAI,GAAI,GAAE,GAAG,CAAC,KAAK,CAAC,KAAA,GAAQ,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;AACnD;AACA;AACA,MAAM,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA,KAAM,IAAI,EAAE;AACtC,QAAQ,GAAA,GAAM,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC9B,OAAM;AACN;AACA,MAAM,IAAI;AACV,QAAQ,GAAG,CAAC,GAAG,CAAA,GAAI,GAAG,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,kBAAkB,CAAC,GAAG,CAAA,GAAI,GAAG,CAAA;AAC1E,OAAQ,CAAA,OAAO,CAAC,EAAE;AAClB,QAAQ,GAAG,CAAC,GAAG,CAAA,GAAI,GAAG,CAAA;AACtB,OAAM;AACN,KAAI;AACJ;AACA,IAAI,KAAM,GAAE,MAAO,GAAE,CAAC,CAAA;AACtB,GAAE;AACF;AACA,EAAE,OAAO,GAAG,CAAA;AACZ;;;;"}
|
||||
9
node_modules/@sentry/utils/esm/debug-build.js
generated
vendored
Normal file
9
node_modules/@sentry/utils/esm/debug-build.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
||||
*
|
||||
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
||||
*/
|
||||
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
||||
|
||||
export { DEBUG_BUILD };
|
||||
//# sourceMappingURL=debug-build.js.map
|
||||
1
node_modules/@sentry/utils/esm/debug-build.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/debug-build.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAY,IAAE,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
|
||||
129
node_modules/@sentry/utils/esm/dsn.js
generated
vendored
Normal file
129
node_modules/@sentry/utils/esm/dsn.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { consoleSandbox, logger } from './logger.js';
|
||||
|
||||
/** Regular expression used to parse a Dsn. */
|
||||
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
|
||||
|
||||
function isValidProtocol(protocol) {
|
||||
return protocol === 'http' || protocol === 'https';
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the string representation of this Dsn.
|
||||
*
|
||||
* By default, this will render the public representation without the password
|
||||
* component. To get the deprecated private representation, set `withPassword`
|
||||
* to true.
|
||||
*
|
||||
* @param withPassword When set to true, the password will be included.
|
||||
*/
|
||||
function dsnToString(dsn, withPassword = false) {
|
||||
const { host, path, pass, port, projectId, protocol, publicKey } = dsn;
|
||||
return (
|
||||
`${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` +
|
||||
`@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a Dsn from a given string.
|
||||
*
|
||||
* @param str A Dsn as string
|
||||
* @returns Dsn as DsnComponents or undefined if @param str is not a valid DSN string
|
||||
*/
|
||||
function dsnFromString(str) {
|
||||
const match = DSN_REGEX.exec(str);
|
||||
|
||||
if (!match) {
|
||||
// This should be logged to the console
|
||||
consoleSandbox(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Invalid Sentry Dsn: ${str}`);
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const [protocol, publicKey, pass = '', host, port = '', lastPath] = match.slice(1);
|
||||
let path = '';
|
||||
let projectId = lastPath;
|
||||
|
||||
const split = projectId.split('/');
|
||||
if (split.length > 1) {
|
||||
path = split.slice(0, -1).join('/');
|
||||
projectId = split.pop() ;
|
||||
}
|
||||
|
||||
if (projectId) {
|
||||
const projectMatch = projectId.match(/^\d+/);
|
||||
if (projectMatch) {
|
||||
projectId = projectMatch[0];
|
||||
}
|
||||
}
|
||||
|
||||
return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol , publicKey });
|
||||
}
|
||||
|
||||
function dsnFromComponents(components) {
|
||||
return {
|
||||
protocol: components.protocol,
|
||||
publicKey: components.publicKey || '',
|
||||
pass: components.pass || '',
|
||||
host: components.host,
|
||||
port: components.port || '',
|
||||
path: components.path || '',
|
||||
projectId: components.projectId,
|
||||
};
|
||||
}
|
||||
|
||||
function validateDsn(dsn) {
|
||||
if (!DEBUG_BUILD) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const { port, projectId, protocol } = dsn;
|
||||
|
||||
const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
|
||||
const hasMissingRequiredComponent = requiredComponents.find(component => {
|
||||
if (!dsn[component]) {
|
||||
logger.error(`Invalid Sentry Dsn: ${component} missing`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hasMissingRequiredComponent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!projectId.match(/^\d+$/)) {
|
||||
logger.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isValidProtocol(protocol)) {
|
||||
logger.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (port && isNaN(parseInt(port, 10))) {
|
||||
logger.error(`Invalid Sentry Dsn: Invalid port ${port}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a valid Sentry Dsn object, identifying a Sentry instance and project.
|
||||
* @returns a valid DsnComponents object or `undefined` if @param from is an invalid DSN source
|
||||
*/
|
||||
function makeDsn(from) {
|
||||
const components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from);
|
||||
if (!components || !validateDsn(components)) {
|
||||
return undefined;
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
export { dsnFromString, dsnToString, makeDsn };
|
||||
//# sourceMappingURL=dsn.js.map
|
||||
1
node_modules/@sentry/utils/esm/dsn.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/dsn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
node_modules/@sentry/utils/esm/env.js
generated
vendored
Normal file
34
node_modules/@sentry/utils/esm/env.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This module exists for optimizations in the build process through rollup and terser. We define some global
|
||||
* constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
|
||||
* constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
|
||||
* never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
|
||||
* `logger` and preventing node-related code from appearing in browser bundles.
|
||||
*
|
||||
* Attention:
|
||||
* This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by
|
||||
* users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)
|
||||
* having issues tree-shaking these constants across package boundaries.
|
||||
* An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want
|
||||
* users to be able to shake away expressions that it guards.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Figures out if we're building a browser bundle.
|
||||
*
|
||||
* @returns true if this is a browser bundle build.
|
||||
*/
|
||||
function isBrowserBundle() {
|
||||
return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source of SDK.
|
||||
*/
|
||||
function getSDKSource() {
|
||||
// @ts-expect-error "npm" is injected by rollup during build process
|
||||
return "npm";
|
||||
}
|
||||
|
||||
export { getSDKSource, isBrowserBundle };
|
||||
//# sourceMappingURL=env.js.map
|
||||
1
node_modules/@sentry/utils/esm/env.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/env.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"env.js","sources":["../../src/env.ts"],"sourcesContent":["/*\n * This module exists for optimizations in the build process through rollup and terser. We define some global\n * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these\n * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will\n * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to\n * `logger` and preventing node-related code from appearing in browser bundles.\n *\n * Attention:\n * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by\n * users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)\n * having issues tree-shaking these constants across package boundaries.\n * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want\n * users to be able to shake away expressions that it guards.\n */\n\ndeclare const __SENTRY_BROWSER_BUNDLE__: boolean | undefined;\n\nexport type SdkSource = 'npm' | 'cdn' | 'loader';\n\n/**\n * Figures out if we're building a browser bundle.\n *\n * @returns true if this is a browser bundle build.\n */\nexport function isBrowserBundle(): boolean {\n return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;\n}\n\n/**\n * Get source of SDK.\n */\nexport function getSDKSource(): SdkSource {\n // @ts-expect-error __SENTRY_SDK_SOURCE__ is injected by rollup during build process\n return __SENTRY_SDK_SOURCE__;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,GAAY;AAC3C,EAAE,OAAO,OAAO,yBAA0B,KAAI,eAAe,CAAC,CAAC,yBAAyB,CAAA;AACxF,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,GAAc;AAC1C;AACA,EAAE,OAAO,KAAqB,CAAA;AAC9B;;;;"}
|
||||
235
node_modules/@sentry/utils/esm/envelope.js
generated
vendored
Normal file
235
node_modules/@sentry/utils/esm/envelope.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
import { dsnToString } from './dsn.js';
|
||||
import { normalize } from './normalize.js';
|
||||
import { dropUndefinedKeys } from './object.js';
|
||||
|
||||
/**
|
||||
* Creates an envelope.
|
||||
* Make sure to always explicitly provide the generic to this function
|
||||
* so that the envelope types resolve correctly.
|
||||
*/
|
||||
function createEnvelope(headers, items = []) {
|
||||
return [headers, items] ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to an envelope.
|
||||
* Make sure to always explicitly provide the generic to this function
|
||||
* so that the envelope types resolve correctly.
|
||||
*/
|
||||
function addItemToEnvelope(envelope, newItem) {
|
||||
const [headers, items] = envelope;
|
||||
return [headers, [...items, newItem]] ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function to loop through the items and item types of an envelope.
|
||||
* (This function was mostly created because working with envelope types is painful at the moment)
|
||||
*
|
||||
* If the callback returns true, the rest of the items will be skipped.
|
||||
*/
|
||||
function forEachEnvelopeItem(
|
||||
envelope,
|
||||
callback,
|
||||
) {
|
||||
const envelopeItems = envelope[1];
|
||||
|
||||
for (const envelopeItem of envelopeItems) {
|
||||
const envelopeItemType = envelopeItem[0].type;
|
||||
const result = callback(envelopeItem, envelopeItemType);
|
||||
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the envelope contains any of the given envelope item types
|
||||
*/
|
||||
function envelopeContainsItemType(envelope, types) {
|
||||
return forEachEnvelopeItem(envelope, (_, type) => types.includes(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a string to UTF8.
|
||||
*/
|
||||
function encodeUTF8(input, textEncoder) {
|
||||
const utf8 = textEncoder || new TextEncoder();
|
||||
return utf8.encode(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes an envelope.
|
||||
*/
|
||||
function serializeEnvelope(envelope, textEncoder) {
|
||||
const [envHeaders, items] = envelope;
|
||||
|
||||
// Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data
|
||||
let parts = JSON.stringify(envHeaders);
|
||||
|
||||
function append(next) {
|
||||
if (typeof parts === 'string') {
|
||||
parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next];
|
||||
} else {
|
||||
parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next);
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of items) {
|
||||
const [itemHeaders, payload] = item;
|
||||
|
||||
append(`\n${JSON.stringify(itemHeaders)}\n`);
|
||||
|
||||
if (typeof payload === 'string' || payload instanceof Uint8Array) {
|
||||
append(payload);
|
||||
} else {
|
||||
let stringifiedPayload;
|
||||
try {
|
||||
stringifiedPayload = JSON.stringify(payload);
|
||||
} catch (e) {
|
||||
// In case, despite all our efforts to keep `payload` circular-dependency-free, `JSON.strinify()` still
|
||||
// fails, we try again after normalizing it again with infinite normalization depth. This of course has a
|
||||
// performance impact but in this case a performance hit is better than throwing.
|
||||
stringifiedPayload = JSON.stringify(normalize(payload));
|
||||
}
|
||||
append(stringifiedPayload);
|
||||
}
|
||||
}
|
||||
|
||||
return typeof parts === 'string' ? parts : concatBuffers(parts);
|
||||
}
|
||||
|
||||
function concatBuffers(buffers) {
|
||||
const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);
|
||||
|
||||
const merged = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
for (const buffer of buffers) {
|
||||
merged.set(buffer, offset);
|
||||
offset += buffer.length;
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an envelope
|
||||
*/
|
||||
function parseEnvelope(
|
||||
env,
|
||||
textEncoder,
|
||||
textDecoder,
|
||||
) {
|
||||
let buffer = typeof env === 'string' ? textEncoder.encode(env) : env;
|
||||
|
||||
function readBinary(length) {
|
||||
const bin = buffer.subarray(0, length);
|
||||
// Replace the buffer with the remaining data excluding trailing newline
|
||||
buffer = buffer.subarray(length + 1);
|
||||
return bin;
|
||||
}
|
||||
|
||||
function readJson() {
|
||||
let i = buffer.indexOf(0xa);
|
||||
// If we couldn't find a newline, we must have found the end of the buffer
|
||||
if (i < 0) {
|
||||
i = buffer.length;
|
||||
}
|
||||
|
||||
return JSON.parse(textDecoder.decode(readBinary(i))) ;
|
||||
}
|
||||
|
||||
const envelopeHeader = readJson();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const items = [];
|
||||
|
||||
while (buffer.length) {
|
||||
const itemHeader = readJson();
|
||||
const binaryLength = typeof itemHeader.length === 'number' ? itemHeader.length : undefined;
|
||||
|
||||
items.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]);
|
||||
}
|
||||
|
||||
return [envelopeHeader, items];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates attachment envelope items
|
||||
*/
|
||||
function createAttachmentEnvelopeItem(
|
||||
attachment,
|
||||
textEncoder,
|
||||
) {
|
||||
const buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data;
|
||||
|
||||
return [
|
||||
dropUndefinedKeys({
|
||||
type: 'attachment',
|
||||
length: buffer.length,
|
||||
filename: attachment.filename,
|
||||
content_type: attachment.contentType,
|
||||
attachment_type: attachment.attachmentType,
|
||||
}),
|
||||
buffer,
|
||||
];
|
||||
}
|
||||
|
||||
const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
|
||||
session: 'session',
|
||||
sessions: 'session',
|
||||
attachment: 'attachment',
|
||||
transaction: 'transaction',
|
||||
event: 'error',
|
||||
client_report: 'internal',
|
||||
user_report: 'default',
|
||||
profile: 'profile',
|
||||
replay_event: 'replay',
|
||||
replay_recording: 'replay',
|
||||
check_in: 'monitor',
|
||||
feedback: 'feedback',
|
||||
span: 'span',
|
||||
statsd: 'metric_bucket',
|
||||
};
|
||||
|
||||
/**
|
||||
* Maps the type of an envelope item to a data category.
|
||||
*/
|
||||
function envelopeItemTypeToDataCategory(type) {
|
||||
return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];
|
||||
}
|
||||
|
||||
/** Extracts the minimal SDK info from the metadata or an events */
|
||||
function getSdkMetadataForEnvelopeHeader(metadataOrEvent) {
|
||||
if (!metadataOrEvent || !metadataOrEvent.sdk) {
|
||||
return;
|
||||
}
|
||||
const { name, version } = metadataOrEvent.sdk;
|
||||
return { name, version };
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates event envelope headers, based on event, sdk info and tunnel
|
||||
* Note: This function was extracted from the core package to make it available in Replay
|
||||
*/
|
||||
function createEventEnvelopeHeaders(
|
||||
event,
|
||||
sdkInfo,
|
||||
tunnel,
|
||||
dsn,
|
||||
) {
|
||||
const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;
|
||||
return {
|
||||
event_id: event.event_id ,
|
||||
sent_at: new Date().toISOString(),
|
||||
...(sdkInfo && { sdk: sdkInfo }),
|
||||
...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),
|
||||
...(dynamicSamplingContext && {
|
||||
trace: dropUndefinedKeys({ ...dynamicSamplingContext }),
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
export { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope };
|
||||
//# sourceMappingURL=envelope.js.map
|
||||
1
node_modules/@sentry/utils/esm/envelope.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/envelope.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/@sentry/utils/esm/error.js
generated
vendored
Normal file
17
node_modules/@sentry/utils/esm/error.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/** An error emitted by Sentry SDKs and related utilities. */
|
||||
class SentryError extends Error {
|
||||
/** Display name of this error instance. */
|
||||
|
||||
constructor( message, logLevel = 'warn') {
|
||||
super(message);this.message = message;
|
||||
this.name = new.target.prototype.constructor.name;
|
||||
// This sets the prototype to be `Error`, not `SentryError`. It's unclear why we do this, but commenting this line
|
||||
// out causes various (seemingly totally unrelated) playwright tests consistently time out. FYI, this makes
|
||||
// instances of `SentryError` fail `obj instanceof SentryError` checks.
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
this.logLevel = logLevel;
|
||||
}
|
||||
}
|
||||
|
||||
export { SentryError };
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/@sentry/utils/esm/error.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/error.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import type { ConsoleLevel } from '@sentry/types';\n\n/** An error emitted by Sentry SDKs and related utilities. */\nexport class SentryError extends Error {\n /** Display name of this error instance. */\n public name: string;\n\n public logLevel: ConsoleLevel;\n\n public constructor(public message: string, logLevel: ConsoleLevel = 'warn') {\n super(message);\n\n this.name = new.target.prototype.constructor.name;\n // This sets the prototype to be `Error`, not `SentryError`. It's unclear why we do this, but commenting this line\n // out causes various (seemingly totally unrelated) playwright tests consistently time out. FYI, this makes\n // instances of `SentryError` fail `obj instanceof SentryError` checks.\n Object.setPrototypeOf(this, new.target.prototype);\n this.logLevel = logLevel;\n }\n}\n"],"names":[],"mappings":"AAEA;AACO,MAAM,WAAY,SAAQ,KAAM,CAAA;AACvC;;AAKA,GAAS,WAAW,EAAQ,OAAO,EAAU,QAAQ,GAAiB,MAAM,EAAE;AAC9E,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA,IAAA,CAAA,OAAA,GAAA,OAAA,CAClB;AACA,IAAI,IAAI,CAAC,IAAK,GAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAA;AACrD;AACA;AACA;AACA,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AACrD,IAAI,IAAI,CAAC,QAAS,GAAE,QAAQ,CAAA;AAC5B,GAAE;AACF;;;;"}
|
||||
161
node_modules/@sentry/utils/esm/eventbuilder.js
generated
vendored
Normal file
161
node_modules/@sentry/utils/esm/eventbuilder.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
import { isError, isPlainObject, isParameterizedString } from './is.js';
|
||||
import { addExceptionTypeValue, addExceptionMechanism } from './misc.js';
|
||||
import { normalizeToSize } from './normalize.js';
|
||||
import { extractExceptionKeysForMessage } from './object.js';
|
||||
|
||||
/**
|
||||
* Extracts stack frames from the error.stack string
|
||||
*/
|
||||
function parseStackFrames(stackParser, error) {
|
||||
return stackParser(error.stack || '', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts stack frames from the error and builds a Sentry Exception
|
||||
*/
|
||||
function exceptionFromError(stackParser, error) {
|
||||
const exception = {
|
||||
type: error.name || error.constructor.name,
|
||||
value: error.message,
|
||||
};
|
||||
|
||||
const frames = parseStackFrames(stackParser, error);
|
||||
if (frames.length) {
|
||||
exception.stacktrace = { frames };
|
||||
}
|
||||
|
||||
return exception;
|
||||
}
|
||||
|
||||
function getMessageForObject(exception) {
|
||||
if ('name' in exception && typeof exception.name === 'string') {
|
||||
let message = `'${exception.name}' captured as exception`;
|
||||
|
||||
if ('message' in exception && typeof exception.message === 'string') {
|
||||
message += ` with message '${exception.message}'`;
|
||||
}
|
||||
|
||||
return message;
|
||||
} else if ('message' in exception && typeof exception.message === 'string') {
|
||||
return exception.message;
|
||||
} else {
|
||||
// This will allow us to group events based on top-level keys
|
||||
// which is much better than creating new group when any key/value change
|
||||
return `Object captured as exception with keys: ${extractExceptionKeysForMessage(
|
||||
exception ,
|
||||
)}`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and Event from a Exception
|
||||
*
|
||||
* TODO(v8): Remove getHub fallback
|
||||
* @hidden
|
||||
*/
|
||||
function eventFromUnknownInput(
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
getHubOrClient,
|
||||
stackParser,
|
||||
exception,
|
||||
hint,
|
||||
) {
|
||||
const client =
|
||||
typeof getHubOrClient === 'function'
|
||||
? // eslint-disable-next-line deprecation/deprecation
|
||||
getHubOrClient().getClient()
|
||||
: getHubOrClient;
|
||||
|
||||
let ex = exception;
|
||||
const providedMechanism =
|
||||
hint && hint.data && (hint.data ).mechanism;
|
||||
const mechanism = providedMechanism || {
|
||||
handled: true,
|
||||
type: 'generic',
|
||||
};
|
||||
|
||||
let extras;
|
||||
|
||||
if (!isError(exception)) {
|
||||
if (isPlainObject(exception)) {
|
||||
const normalizeDepth = client && client.getOptions().normalizeDepth;
|
||||
extras = { ['__serialized__']: normalizeToSize(exception , normalizeDepth) };
|
||||
|
||||
const message = getMessageForObject(exception);
|
||||
ex = (hint && hint.syntheticException) || new Error(message);
|
||||
(ex ).message = message;
|
||||
} else {
|
||||
// This handles when someone does: `throw "something awesome";`
|
||||
// We use synthesized Error here so we can extract a (rough) stack trace.
|
||||
ex = (hint && hint.syntheticException) || new Error(exception );
|
||||
(ex ).message = exception ;
|
||||
}
|
||||
mechanism.synthetic = true;
|
||||
}
|
||||
|
||||
const event = {
|
||||
exception: {
|
||||
values: [exceptionFromError(stackParser, ex )],
|
||||
},
|
||||
};
|
||||
|
||||
if (extras) {
|
||||
event.extra = extras;
|
||||
}
|
||||
|
||||
addExceptionTypeValue(event, undefined, undefined);
|
||||
addExceptionMechanism(event, mechanism);
|
||||
|
||||
return {
|
||||
...event,
|
||||
event_id: hint && hint.event_id,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and Event from a Message
|
||||
* @hidden
|
||||
*/
|
||||
function eventFromMessage(
|
||||
stackParser,
|
||||
message,
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
level = 'info',
|
||||
hint,
|
||||
attachStacktrace,
|
||||
) {
|
||||
const event = {
|
||||
event_id: hint && hint.event_id,
|
||||
level,
|
||||
};
|
||||
|
||||
if (attachStacktrace && hint && hint.syntheticException) {
|
||||
const frames = parseStackFrames(stackParser, hint.syntheticException);
|
||||
if (frames.length) {
|
||||
event.exception = {
|
||||
values: [
|
||||
{
|
||||
value: message,
|
||||
stacktrace: { frames },
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (isParameterizedString(message)) {
|
||||
const { __sentry_template_string__, __sentry_template_values__ } = message;
|
||||
|
||||
event.logentry = {
|
||||
message: __sentry_template_string__,
|
||||
params: __sentry_template_values__,
|
||||
};
|
||||
return event;
|
||||
}
|
||||
|
||||
event.message = message;
|
||||
return event;
|
||||
}
|
||||
|
||||
export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames };
|
||||
//# sourceMappingURL=eventbuilder.js.map
|
||||
1
node_modules/@sentry/utils/esm/eventbuilder.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/eventbuilder.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
53
node_modules/@sentry/utils/esm/index.js
generated
vendored
Normal file
53
node_modules/@sentry/utils/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
export { applyAggregateErrorsToEvent } from './aggregate-errors.js';
|
||||
export { getComponentName, getDomElement, getLocationHref, htmlTreeAsString } from './browser.js';
|
||||
export { dsnFromString, dsnToString, makeDsn } from './dsn.js';
|
||||
export { SentryError } from './error.js';
|
||||
export { GLOBAL_OBJ, getGlobalObject, getGlobalSingleton } from './worldwide.js';
|
||||
export { addInstrumentationHandler } from './instrument/index.js';
|
||||
export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel } from './is.js';
|
||||
export { isBrowser } from './isBrowser.js';
|
||||
export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './logger.js';
|
||||
export { memoBuilder } from './memo.js';
|
||||
export { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, uuid4 } from './misc.js';
|
||||
export { dynamicRequire, isNodeEnv, loadModule } from './node.js';
|
||||
export { normalize, normalizeToSize, normalizeUrlToBase, walk } from './normalize.js';
|
||||
export { addNonEnumerableProperty, convertToPlainObject, dropUndefinedKeys, extractExceptionKeysForMessage, fill, getOriginalFunction, markFunctionWrapped, objectify, urlEncode } from './object.js';
|
||||
export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path.js';
|
||||
export { makePromiseBuffer } from './promisebuffer.js';
|
||||
export { DEFAULT_USER_INCLUDES, addRequestDataToEvent, addRequestDataToTransaction, extractPathForTransaction, extractRequestData, winterCGHeadersToDict, winterCGRequestToRequestData } from './requestdata.js';
|
||||
export { severityFromString, severityLevelFromString, validSeverityLevels } from './severity.js';
|
||||
export { createStackParser, getFunctionName, nodeStackLineParser, stackParserFromStackParserOptions, stripSentryFramesAndReverse } from './stacktrace.js';
|
||||
export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate } from './string.js';
|
||||
export { isNativeFetch, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver } from './supports.js';
|
||||
export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise.js';
|
||||
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs } from './time.js';
|
||||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, tracingContextFromHeaders } from './tracing.js';
|
||||
export { getSDKSource, isBrowserBundle } from './env.js';
|
||||
export { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope } from './envelope.js';
|
||||
export { createClientReportEnvelope } from './clientreport.js';
|
||||
export { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits } from './ratelimit.js';
|
||||
export { BAGGAGE_HEADER_NAME, MAX_BAGGAGE_STRING_LENGTH, SENTRY_BAGGAGE_KEY_PREFIX, SENTRY_BAGGAGE_KEY_PREFIX_REGEX, baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader } from './baggage.js';
|
||||
export { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from './url.js';
|
||||
export { addOrUpdateIntegration } from './userIntegrations.js';
|
||||
export { makeFifoCache } from './cache.js';
|
||||
export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames } from './eventbuilder.js';
|
||||
export { callFrameToStackFrame, watchdogTimer } from './anr.js';
|
||||
export { LRUMap } from './lru.js';
|
||||
export { _asyncNullishCoalesce } from './buildPolyfills/_asyncNullishCoalesce.js';
|
||||
export { _asyncOptionalChain } from './buildPolyfills/_asyncOptionalChain.js';
|
||||
export { _asyncOptionalChainDelete } from './buildPolyfills/_asyncOptionalChainDelete.js';
|
||||
export { _nullishCoalesce } from './buildPolyfills/_nullishCoalesce.js';
|
||||
export { _optionalChain } from './buildPolyfills/_optionalChain.js';
|
||||
export { _optionalChainDelete } from './buildPolyfills/_optionalChainDelete.js';
|
||||
export { addConsoleInstrumentationHandler } from './instrument/console.js';
|
||||
export { addClickKeypressInstrumentationHandler } from './instrument/dom.js';
|
||||
export { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './instrument/xhr.js';
|
||||
export { addFetchInstrumentationHandler } from './instrument/fetch.js';
|
||||
export { addHistoryInstrumentationHandler } from './instrument/history.js';
|
||||
export { addGlobalErrorInstrumentationHandler } from './instrument/globalError.js';
|
||||
export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection.js';
|
||||
export { resetInstrumentationHandlers } from './instrument/_handlers.js';
|
||||
export { filenameIsInApp } from './node-stack-trace.js';
|
||||
export { escapeStringForRegex } from './vendor/escapeStringForRegex.js';
|
||||
export { supportsHistory } from './vendor/supportsHistory.js';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@sentry/utils/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
54
node_modules/@sentry/utils/esm/instrument/_handlers.js
generated
vendored
Normal file
54
node_modules/@sentry/utils/esm/instrument/_handlers.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { DEBUG_BUILD } from '../debug-build.js';
|
||||
import { logger } from '../logger.js';
|
||||
import { getFunctionName } from '../stacktrace.js';
|
||||
|
||||
// We keep the handlers globally
|
||||
const handlers = {};
|
||||
const instrumented = {};
|
||||
|
||||
/** Add a handler function. */
|
||||
function addHandler(type, handler) {
|
||||
handlers[type] = handlers[type] || [];
|
||||
(handlers[type] ).push(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all instrumentation handlers.
|
||||
* This can be used by tests to ensure we have a clean slate of instrumentation handlers.
|
||||
*/
|
||||
function resetInstrumentationHandlers() {
|
||||
Object.keys(handlers).forEach(key => {
|
||||
handlers[key ] = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
/** Maybe run an instrumentation function, unless it was already called. */
|
||||
function maybeInstrument(type, instrumentFn) {
|
||||
if (!instrumented[type]) {
|
||||
instrumentFn();
|
||||
instrumented[type] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** Trigger handlers for a given instrumentation type. */
|
||||
function triggerHandlers(type, data) {
|
||||
const typeHandlers = type && handlers[type];
|
||||
if (!typeHandlers) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const handler of typeHandlers) {
|
||||
try {
|
||||
handler(data);
|
||||
} catch (e) {
|
||||
DEBUG_BUILD &&
|
||||
logger.error(
|
||||
`Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError:`,
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers };
|
||||
//# sourceMappingURL=_handlers.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/_handlers.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/_handlers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_handlers.js","sources":["../../../src/instrument/_handlers.ts"],"sourcesContent":["import { DEBUG_BUILD } from '../debug-build';\nimport { logger } from '../logger';\nimport { getFunctionName } from '../stacktrace';\n\nexport type InstrumentHandlerType = 'console' | 'dom' | 'fetch' | 'history' | 'xhr' | 'error' | 'unhandledrejection';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InstrumentHandlerCallback = (data: any) => void;\n\n// We keep the handlers globally\nconst handlers: { [key in InstrumentHandlerType]?: InstrumentHandlerCallback[] } = {};\nconst instrumented: { [key in InstrumentHandlerType]?: boolean } = {};\n\n/** Add a handler function. */\nexport function addHandler(type: InstrumentHandlerType, handler: InstrumentHandlerCallback): void {\n handlers[type] = handlers[type] || [];\n (handlers[type] as InstrumentHandlerCallback[]).push(handler);\n}\n\n/**\n * Reset all instrumentation handlers.\n * This can be used by tests to ensure we have a clean slate of instrumentation handlers.\n */\nexport function resetInstrumentationHandlers(): void {\n Object.keys(handlers).forEach(key => {\n handlers[key as InstrumentHandlerType] = undefined;\n });\n}\n\n/** Maybe run an instrumentation function, unless it was already called. */\nexport function maybeInstrument(type: InstrumentHandlerType, instrumentFn: () => void): void {\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n}\n\n/** Trigger handlers for a given instrumentation type. */\nexport function triggerHandlers(type: InstrumentHandlerType, data: unknown): void {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD &&\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`,\n e,\n );\n }\n }\n}\n"],"names":[],"mappings":";;;;AAQA;AACA,MAAM,QAAQ,GAAqE,EAAE,CAAA;AACrF,MAAM,YAAY,GAAiD,EAAE,CAAA;AACrE;AACA;AACO,SAAS,UAAU,CAAC,IAAI,EAAyB,OAAO,EAAmC;AAClG,EAAE,QAAQ,CAAC,IAAI,CAAE,GAAE,QAAQ,CAAC,IAAI,CAAA,IAAK,EAAE,CAAA;AACvC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAA,GAAkC,IAAI,CAAC,OAAO,CAAC,CAAA;AAC/D,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,GAAS;AACrD,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAA,IAAO;AACvC,IAAI,QAAQ,CAAC,GAAI,EAAA,GAA4B,SAAS,CAAA;AACtD,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAAyB,YAAY,EAAoB;AAC7F,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC3B,IAAI,YAAY,EAAE,CAAA;AAClB,IAAI,YAAY,CAAC,IAAI,CAAA,GAAI,IAAI,CAAA;AAC7B,GAAE;AACF,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAAyB,IAAI,EAAiB;AAClF,EAAE,MAAM,eAAe,IAAA,IAAQ,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC7C,EAAE,IAAI,CAAC,YAAY,EAAE;AACrB,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,KAAK,MAAM,OAAQ,IAAG,YAAY,EAAE;AACtC,IAAI,IAAI;AACR,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;AACnB,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAM,WAAY;AAClB,QAAQ,MAAM,CAAC,KAAK;AACpB,UAAU,CAAC,uDAAuD,EAAE,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACrH,UAAU,CAAC;AACX,SAAS,CAAA;AACT,KAAI;AACJ,GAAE;AACF;;;;"}
|
||||
43
node_modules/@sentry/utils/esm/instrument/console.js
generated
vendored
Normal file
43
node_modules/@sentry/utils/esm/instrument/console.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { CONSOLE_LEVELS, originalConsoleMethods } from '../logger.js';
|
||||
import { fill } from '../object.js';
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a console.xxx method is called.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addConsoleInstrumentationHandler(handler) {
|
||||
const type = 'console';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentConsole);
|
||||
}
|
||||
|
||||
function instrumentConsole() {
|
||||
if (!('console' in GLOBAL_OBJ)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CONSOLE_LEVELS.forEach(function (level) {
|
||||
if (!(level in GLOBAL_OBJ.console)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod) {
|
||||
originalConsoleMethods[level] = originalConsoleMethod;
|
||||
|
||||
return function (...args) {
|
||||
const handlerData = { args, level };
|
||||
triggerHandlers('console', handlerData);
|
||||
|
||||
const log = originalConsoleMethods[level];
|
||||
log && log.apply(GLOBAL_OBJ.console, args);
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export { addConsoleInstrumentationHandler };
|
||||
//# sourceMappingURL=console.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/console.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/console.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '@sentry/types';\n\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../logger';\nimport { fill } from '../object';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n const handlerData: HandlerDataConsole = { args, level };\n triggerHandlers('console', handlerData);\n\n const log = originalConsoleMethods[level];\n log && log.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n"],"names":[],"mappings":";;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA4C;AACpG,EAAE,MAAM,IAAK,GAAE,SAAS,CAAA;AACxB,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC3B,EAAE,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAA;AAC1C,CAAA;AACA;AACA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,EAAE,aAAa,UAAU,CAAC,EAAE;AAClC,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,cAAc,CAAC,OAAO,CAAC,UAAU,KAAK,EAAsB;AAC9D,IAAI,IAAI,EAAE,KAAA,IAAS,UAAU,CAAC,OAAO,CAAC,EAAE;AACxC,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,qBAAqB,EAAuB;AAC1F,MAAM,sBAAsB,CAAC,KAAK,CAAA,GAAI,qBAAqB,CAAA;AAC3D;AACA,MAAM,OAAO,UAAU,GAAG,IAAI,EAAe;AAC7C,QAAQ,MAAM,WAAW,GAAuB,EAAE,IAAI,EAAE,OAAO,CAAA;AAC/D,QAAQ,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/C;AACA,QAAQ,MAAM,GAAI,GAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;AACjD,QAAQ,GAAA,IAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAClD,OAAO,CAAA;AACP,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;;;;"}
|
||||
236
node_modules/@sentry/utils/esm/instrument/dom.js
generated
vendored
Normal file
236
node_modules/@sentry/utils/esm/instrument/dom.js
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
import { uuid4 } from '../misc.js';
|
||||
import { fill, addNonEnumerableProperty } from '../object.js';
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
const WINDOW = GLOBAL_OBJ ;
|
||||
const DEBOUNCE_DURATION = 1000;
|
||||
|
||||
let debounceTimerID;
|
||||
let lastCapturedEventType;
|
||||
let lastCapturedEventTargetId;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a click or a keypress happens.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addClickKeypressInstrumentationHandler(handler) {
|
||||
const type = 'dom';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentDOM);
|
||||
}
|
||||
|
||||
/** Exported for tests only. */
|
||||
function instrumentDOM() {
|
||||
if (!WINDOW.document) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make it so that any click or keypress that is unhandled / bubbled up all the way to the document triggers our dom
|
||||
// handlers. (Normally we have only one, which captures a breadcrumb for each click or keypress.) Do this before
|
||||
// we instrument `addEventListener` so that we don't end up attaching this handler twice.
|
||||
const triggerDOMHandler = triggerHandlers.bind(null, 'dom');
|
||||
const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true);
|
||||
WINDOW.document.addEventListener('click', globalDOMEventHandler, false);
|
||||
WINDOW.document.addEventListener('keypress', globalDOMEventHandler, false);
|
||||
|
||||
// After hooking into click and keypress events bubbled up to `document`, we also hook into user-handled
|
||||
// clicks & keypresses, by adding an event listener of our own to any element to which they add a listener. That
|
||||
// way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler
|
||||
// could potentially prevent the event from bubbling up to our global listeners. This way, our handler are still
|
||||
// guaranteed to fire at least once.)
|
||||
['EventTarget', 'Node'].forEach((target) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
const proto = (WINDOW )[target] && (WINDOW )[target].prototype;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins
|
||||
if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {
|
||||
return;
|
||||
}
|
||||
|
||||
fill(proto, 'addEventListener', function (originalAddEventListener) {
|
||||
return function (
|
||||
|
||||
type,
|
||||
listener,
|
||||
options,
|
||||
) {
|
||||
if (type === 'click' || type == 'keypress') {
|
||||
try {
|
||||
const el = this ;
|
||||
const handlers = (el.__sentry_instrumentation_handlers__ = el.__sentry_instrumentation_handlers__ || {});
|
||||
const handlerForType = (handlers[type] = handlers[type] || { refCount: 0 });
|
||||
|
||||
if (!handlerForType.handler) {
|
||||
const handler = makeDOMEventHandler(triggerDOMHandler);
|
||||
handlerForType.handler = handler;
|
||||
originalAddEventListener.call(this, type, handler, options);
|
||||
}
|
||||
|
||||
handlerForType.refCount++;
|
||||
} catch (e) {
|
||||
// Accessing dom properties is always fragile.
|
||||
// Also allows us to skip `addEventListenrs` calls with no proper `this` context.
|
||||
}
|
||||
}
|
||||
|
||||
return originalAddEventListener.call(this, type, listener, options);
|
||||
};
|
||||
});
|
||||
|
||||
fill(
|
||||
proto,
|
||||
'removeEventListener',
|
||||
function (originalRemoveEventListener) {
|
||||
return function (
|
||||
|
||||
type,
|
||||
listener,
|
||||
options,
|
||||
) {
|
||||
if (type === 'click' || type == 'keypress') {
|
||||
try {
|
||||
const el = this ;
|
||||
const handlers = el.__sentry_instrumentation_handlers__ || {};
|
||||
const handlerForType = handlers[type];
|
||||
|
||||
if (handlerForType) {
|
||||
handlerForType.refCount--;
|
||||
// If there are no longer any custom handlers of the current type on this element, we can remove ours, too.
|
||||
if (handlerForType.refCount <= 0) {
|
||||
originalRemoveEventListener.call(this, type, handlerForType.handler, options);
|
||||
handlerForType.handler = undefined;
|
||||
delete handlers[type]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
||||
}
|
||||
|
||||
// If there are no longer any custom handlers of any type on this element, cleanup everything.
|
||||
if (Object.keys(handlers).length === 0) {
|
||||
delete el.__sentry_instrumentation_handlers__;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Accessing dom properties is always fragile.
|
||||
// Also allows us to skip `addEventListenrs` calls with no proper `this` context.
|
||||
}
|
||||
}
|
||||
|
||||
return originalRemoveEventListener.call(this, type, listener, options);
|
||||
};
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the event is similar to the last captured one. For example, two click events on the same button.
|
||||
*/
|
||||
function isSimilarToLastCapturedEvent(event) {
|
||||
// If both events have different type, then user definitely performed two separate actions. e.g. click + keypress.
|
||||
if (event.type !== lastCapturedEventType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// If both events have the same type, it's still possible that actions were performed on different targets.
|
||||
// e.g. 2 clicks on different buttons.
|
||||
if (!event.target || (event.target )._sentryId !== lastCapturedEventTargetId) {
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
// just accessing `target` property can throw an exception in some rare circumstances
|
||||
// see: https://github.com/getsentry/sentry-javascript/issues/838
|
||||
}
|
||||
|
||||
// If both events have the same type _and_ same `target` (an element which triggered an event, _not necessarily_
|
||||
// to which an event listener was attached), we treat them as the same action, as we want to capture
|
||||
// only one breadcrumb. e.g. multiple clicks on the same button, or typing inside a user input box.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide whether an event should be captured.
|
||||
* @param event event to be captured
|
||||
*/
|
||||
function shouldSkipDOMEvent(eventType, target) {
|
||||
// We are only interested in filtering `keypress` events for now.
|
||||
if (eventType !== 'keypress') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target || !target.tagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only consider keypress events on actual input elements. This will disregard keypresses targeting body
|
||||
// e.g.tabbing through elements, hotkeys, etc.
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps addEventListener to capture UI breadcrumbs
|
||||
*/
|
||||
function makeDOMEventHandler(
|
||||
handler,
|
||||
globalListener = false,
|
||||
) {
|
||||
return (event) => {
|
||||
// It's possible this handler might trigger multiple times for the same
|
||||
// event (e.g. event propagation through node ancestors).
|
||||
// Ignore if we've already captured that event.
|
||||
if (!event || event['_sentryCaptured']) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = getEventTarget(event);
|
||||
|
||||
// We always want to skip _some_ events.
|
||||
if (shouldSkipDOMEvent(event.type, target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark event as "seen"
|
||||
addNonEnumerableProperty(event, '_sentryCaptured', true);
|
||||
|
||||
if (target && !target._sentryId) {
|
||||
// Add UUID to event target so we can identify if
|
||||
addNonEnumerableProperty(target, '_sentryId', uuid4());
|
||||
}
|
||||
|
||||
const name = event.type === 'keypress' ? 'input' : event.type;
|
||||
|
||||
// If there is no last captured event, it means that we can safely capture the new event and store it for future comparisons.
|
||||
// If there is a last captured event, see if the new event is different enough to treat it as a unique one.
|
||||
// If that's the case, emit the previous event and store locally the newly-captured DOM event.
|
||||
if (!isSimilarToLastCapturedEvent(event)) {
|
||||
const handlerData = { event, name, global: globalListener };
|
||||
handler(handlerData);
|
||||
lastCapturedEventType = event.type;
|
||||
lastCapturedEventTargetId = target ? target._sentryId : undefined;
|
||||
}
|
||||
|
||||
// Start a new debounce timer that will prevent us from capturing multiple events that should be grouped together.
|
||||
clearTimeout(debounceTimerID);
|
||||
debounceTimerID = WINDOW.setTimeout(() => {
|
||||
lastCapturedEventTargetId = undefined;
|
||||
lastCapturedEventType = undefined;
|
||||
}, DEBOUNCE_DURATION);
|
||||
};
|
||||
}
|
||||
|
||||
function getEventTarget(event) {
|
||||
try {
|
||||
return event.target ;
|
||||
} catch (e) {
|
||||
// just accessing `target` property can throw an exception in some rare circumstances
|
||||
// see: https://github.com/getsentry/sentry-javascript/issues/838
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export { addClickKeypressInstrumentationHandler, instrumentDOM };
|
||||
//# sourceMappingURL=dom.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/dom.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/dom.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
122
node_modules/@sentry/utils/esm/instrument/fetch.js
generated
vendored
Normal file
122
node_modules/@sentry/utils/esm/instrument/fetch.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
import { fill } from '../object.js';
|
||||
import { supportsNativeFetch } from '../supports.js';
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a fetch request happens.
|
||||
* The handler function is called once when the request starts and once when it ends,
|
||||
* which can be identified by checking if it has an `endTimestamp`.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addFetchInstrumentationHandler(handler) {
|
||||
const type = 'fetch';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentFetch);
|
||||
}
|
||||
|
||||
function instrumentFetch() {
|
||||
if (!supportsNativeFetch()) {
|
||||
return;
|
||||
}
|
||||
|
||||
fill(GLOBAL_OBJ, 'fetch', function (originalFetch) {
|
||||
return function (...args) {
|
||||
const { method, url } = parseFetchArgs(args);
|
||||
|
||||
const handlerData = {
|
||||
args,
|
||||
fetchData: {
|
||||
method,
|
||||
url,
|
||||
},
|
||||
startTimestamp: Date.now(),
|
||||
};
|
||||
|
||||
triggerHandlers('fetch', {
|
||||
...handlerData,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return originalFetch.apply(GLOBAL_OBJ, args).then(
|
||||
(response) => {
|
||||
const finishedHandlerData = {
|
||||
...handlerData,
|
||||
endTimestamp: Date.now(),
|
||||
response,
|
||||
};
|
||||
|
||||
triggerHandlers('fetch', finishedHandlerData);
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
const erroredHandlerData = {
|
||||
...handlerData,
|
||||
endTimestamp: Date.now(),
|
||||
error,
|
||||
};
|
||||
|
||||
triggerHandlers('fetch', erroredHandlerData);
|
||||
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
||||
// it means the sentry.javascript SDK caught an error invoking your application code.
|
||||
// This is expected behavior and NOT indicative of a bug with sentry.javascript.
|
||||
throw error;
|
||||
},
|
||||
);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function hasProp(obj, prop) {
|
||||
return !!obj && typeof obj === 'object' && !!(obj )[prop];
|
||||
}
|
||||
|
||||
function getUrlFromResource(resource) {
|
||||
if (typeof resource === 'string') {
|
||||
return resource;
|
||||
}
|
||||
|
||||
if (!resource) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (hasProp(resource, 'url')) {
|
||||
return resource.url;
|
||||
}
|
||||
|
||||
if (resource.toString) {
|
||||
return resource.toString();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the fetch arguments to find the used Http method and the url of the request.
|
||||
* Exported for tests only.
|
||||
*/
|
||||
function parseFetchArgs(fetchArgs) {
|
||||
if (fetchArgs.length === 0) {
|
||||
return { method: 'GET', url: '' };
|
||||
}
|
||||
|
||||
if (fetchArgs.length === 2) {
|
||||
const [url, options] = fetchArgs ;
|
||||
|
||||
return {
|
||||
url: getUrlFromResource(url),
|
||||
method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET',
|
||||
};
|
||||
}
|
||||
|
||||
const arg = fetchArgs[0];
|
||||
return {
|
||||
url: getUrlFromResource(arg ),
|
||||
method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET',
|
||||
};
|
||||
}
|
||||
|
||||
export { addFetchInstrumentationHandler, parseFetchArgs };
|
||||
//# sourceMappingURL=fetch.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/fetch.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/fetch.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
49
node_modules/@sentry/utils/esm/instrument/globalError.js
generated
vendored
Normal file
49
node_modules/@sentry/utils/esm/instrument/globalError.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
let _oldOnErrorHandler = null;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an error is captured by the global error handler.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addGlobalErrorInstrumentationHandler(handler) {
|
||||
const type = 'error';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentError);
|
||||
}
|
||||
|
||||
function instrumentError() {
|
||||
_oldOnErrorHandler = GLOBAL_OBJ.onerror;
|
||||
|
||||
GLOBAL_OBJ.onerror = function (
|
||||
msg,
|
||||
url,
|
||||
line,
|
||||
column,
|
||||
error,
|
||||
) {
|
||||
const handlerData = {
|
||||
column,
|
||||
error,
|
||||
line,
|
||||
msg,
|
||||
url,
|
||||
};
|
||||
triggerHandlers('error', handlerData);
|
||||
|
||||
if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return _oldOnErrorHandler.apply(this, arguments);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
|
||||
}
|
||||
|
||||
export { addGlobalErrorInstrumentationHandler };
|
||||
//# sourceMappingURL=globalError.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/globalError.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/globalError.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"globalError.js","sources":["../../../src/instrument/globalError.ts"],"sourcesContent":["import type { HandlerDataError } from '@sentry/types';\n\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nlet _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null;\n\n/**\n * Add an instrumentation handler for when an error is captured by the global error handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalErrorInstrumentationHandler(handler: (data: HandlerDataError) => void): void {\n const type = 'error';\n addHandler(type, handler);\n maybeInstrument(type, instrumentError);\n}\n\nfunction instrumentError(): void {\n _oldOnErrorHandler = GLOBAL_OBJ.onerror;\n\n GLOBAL_OBJ.onerror = function (\n msg: string | object,\n url?: string,\n line?: number,\n column?: number,\n error?: Error,\n ): boolean {\n const handlerData: HandlerDataError = {\n column,\n error,\n line,\n msg,\n url,\n };\n triggerHandlers('error', handlerData);\n\n if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n\n GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;\n}\n"],"names":[],"mappings":";;;AAKA,IAAI,kBAAkB,GAA0C,IAAI,CAAA;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oCAAoC,CAAC,OAAO,EAA0C;AACtG,EAAE,MAAM,IAAK,GAAE,OAAO,CAAA;AACtB,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC3B,EAAE,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;AACxC,CAAA;AACA;AACA,SAAS,eAAe,GAAS;AACjC,EAAE,kBAAmB,GAAE,UAAU,CAAC,OAAO,CAAA;AACzC;AACA,EAAE,UAAU,CAAC,OAAQ,GAAE;AACvB,IAAI,GAAG;AACP,IAAI,GAAG;AACP,IAAI,IAAI;AACR,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAa;AACb,IAAI,MAAM,WAAW,GAAqB;AAC1C,MAAM,MAAM;AACZ,MAAM,KAAK;AACX,MAAM,IAAI;AACV,MAAM,GAAG;AACT,MAAM,GAAG;AACT,KAAK,CAAA;AACL,IAAI,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AACzC;AACA,IAAI,IAAI,kBAAmB,IAAG,CAAC,kBAAkB,CAAC,iBAAiB,EAAE;AACrE;AACA,MAAM,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AACtD,KAAI;AACJ;AACA,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAA;AACH;AACA,EAAE,UAAU,CAAC,OAAO,CAAC,uBAAA,GAA0B,IAAI,CAAA;AACnD;;;;"}
|
||||
39
node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js
generated
vendored
Normal file
39
node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
let _oldOnUnhandledRejectionHandler = null;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an unhandled promise rejection is captured.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addGlobalUnhandledRejectionInstrumentationHandler(
|
||||
handler,
|
||||
) {
|
||||
const type = 'unhandledrejection';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentUnhandledRejection);
|
||||
}
|
||||
|
||||
function instrumentUnhandledRejection() {
|
||||
_oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;
|
||||
|
||||
GLOBAL_OBJ.onunhandledrejection = function (e) {
|
||||
const handlerData = e;
|
||||
triggerHandlers('unhandledrejection', handlerData);
|
||||
|
||||
if (_oldOnUnhandledRejectionHandler && !_oldOnUnhandledRejectionHandler.__SENTRY_LOADER__) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return _oldOnUnhandledRejectionHandler.apply(this, arguments);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
|
||||
}
|
||||
|
||||
export { addGlobalUnhandledRejectionInstrumentationHandler };
|
||||
//# sourceMappingURL=globalUnhandledRejection.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"globalUnhandledRejection.js","sources":["../../../src/instrument/globalUnhandledRejection.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { HandlerDataUnhandledRejection } from '@sentry/types';\n\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nlet _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null;\n\n/**\n * Add an instrumentation handler for when an unhandled promise rejection is captured.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalUnhandledRejectionInstrumentationHandler(\n handler: (data: HandlerDataUnhandledRejection) => void,\n): void {\n const type = 'unhandledrejection';\n addHandler(type, handler);\n maybeInstrument(type, instrumentUnhandledRejection);\n}\n\nfunction instrumentUnhandledRejection(): void {\n _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;\n\n GLOBAL_OBJ.onunhandledrejection = function (e: any): boolean {\n const handlerData: HandlerDataUnhandledRejection = e;\n triggerHandlers('unhandledrejection', handlerData);\n\n if (_oldOnUnhandledRejectionHandler && !_oldOnUnhandledRejectionHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n\n GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;\n}\n"],"names":[],"mappings":";;;AAOA,IAAI,+BAA+B,GAAuD,IAAI,CAAA;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iDAAiD;AACjE,EAAE,OAAO;AACT,EAAQ;AACR,EAAE,MAAM,IAAK,GAAE,oBAAoB,CAAA;AACnC,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC3B,EAAE,eAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAA;AACrD,CAAA;AACA;AACA,SAAS,4BAA4B,GAAS;AAC9C,EAAE,+BAAgC,GAAE,UAAU,CAAC,oBAAoB,CAAA;AACnE;AACA,EAAE,UAAU,CAAC,oBAAqB,GAAE,UAAU,CAAC,EAAgB;AAC/D,IAAI,MAAM,WAAW,GAAkC,CAAC,CAAA;AACxD,IAAI,eAAe,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAA;AACtD;AACA,IAAI,IAAI,+BAAgC,IAAG,CAAC,+BAA+B,CAAC,iBAAiB,EAAE;AAC/F;AACA,MAAM,OAAO,+BAA+B,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AACnE,KAAI;AACJ;AACA,IAAI,OAAO,IAAI,CAAA;AACf,GAAG,CAAA;AACH;AACA,EAAE,UAAU,CAAC,oBAAoB,CAAC,uBAAA,GAA0B,IAAI,CAAA;AAChE;;;;"}
|
||||
72
node_modules/@sentry/utils/esm/instrument/history.js
generated
vendored
Normal file
72
node_modules/@sentry/utils/esm/instrument/history.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import { fill } from '../object.js';
|
||||
import '../debug-build.js';
|
||||
import '../logger.js';
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { supportsHistory } from '../vendor/supportsHistory.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
const WINDOW = GLOBAL_OBJ ;
|
||||
|
||||
let lastHref;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a fetch request happens.
|
||||
* The handler function is called once when the request starts and once when it ends,
|
||||
* which can be identified by checking if it has an `endTimestamp`.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addHistoryInstrumentationHandler(handler) {
|
||||
const type = 'history';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentHistory);
|
||||
}
|
||||
|
||||
function instrumentHistory() {
|
||||
if (!supportsHistory()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldOnPopState = WINDOW.onpopstate;
|
||||
WINDOW.onpopstate = function ( ...args) {
|
||||
const to = WINDOW.location.href;
|
||||
// keep track of the current URL state, as we always receive only the updated state
|
||||
const from = lastHref;
|
||||
lastHref = to;
|
||||
const handlerData = { from, to };
|
||||
triggerHandlers('history', handlerData);
|
||||
if (oldOnPopState) {
|
||||
// Apparently this can throw in Firefox when incorrectly implemented plugin is installed.
|
||||
// https://github.com/getsentry/sentry-javascript/issues/3344
|
||||
// https://github.com/bugsnag/bugsnag-js/issues/469
|
||||
try {
|
||||
return oldOnPopState.apply(this, args);
|
||||
} catch (_oO) {
|
||||
// no-empty
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function historyReplacementFunction(originalHistoryFunction) {
|
||||
return function ( ...args) {
|
||||
const url = args.length > 2 ? args[2] : undefined;
|
||||
if (url) {
|
||||
// coerce to string (this is what pushState does)
|
||||
const from = lastHref;
|
||||
const to = String(url);
|
||||
// keep track of the current URL state, as we always receive only the updated state
|
||||
lastHref = to;
|
||||
const handlerData = { from, to };
|
||||
triggerHandlers('history', handlerData);
|
||||
}
|
||||
return originalHistoryFunction.apply(this, args);
|
||||
};
|
||||
}
|
||||
|
||||
fill(WINDOW.history, 'pushState', historyReplacementFunction);
|
||||
fill(WINDOW.history, 'replaceState', historyReplacementFunction);
|
||||
}
|
||||
|
||||
export { addHistoryInstrumentationHandler };
|
||||
//# sourceMappingURL=history.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/history.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/history.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"history.js","sources":["../../../src/instrument/history.ts"],"sourcesContent":["// TODO(v8): Move everything in this file into the browser package. Nothing here is generic and we run risk of leaking browser types into non-browser packages.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { HandlerDataHistory } from '@sentry/types';\n\nimport { fill } from '../object';\nimport { supportsHistory } from '../supports';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nconst WINDOW = GLOBAL_OBJ as unknown as Window;\n\nlet lastHref: string | undefined;\n\n/**\n * Add an instrumentation handler for when a fetch request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addHistoryInstrumentationHandler(handler: (data: HandlerDataHistory) => void): void {\n const type = 'history';\n addHandler(type, handler);\n maybeInstrument(type, instrumentHistory);\n}\n\nfunction instrumentHistory(): void {\n if (!supportsHistory()) {\n return;\n }\n\n const oldOnPopState = WINDOW.onpopstate;\n WINDOW.onpopstate = function (this: WindowEventHandlers, ...args: any[]): any {\n const to = WINDOW.location.href;\n // keep track of the current URL state, as we always receive only the updated state\n const from = lastHref;\n lastHref = to;\n const handlerData: HandlerDataHistory = { from, to };\n triggerHandlers('history', handlerData);\n if (oldOnPopState) {\n // Apparently this can throw in Firefox when incorrectly implemented plugin is installed.\n // https://github.com/getsentry/sentry-javascript/issues/3344\n // https://github.com/bugsnag/bugsnag-js/issues/469\n try {\n return oldOnPopState.apply(this, args);\n } catch (_oO) {\n // no-empty\n }\n }\n };\n\n function historyReplacementFunction(originalHistoryFunction: () => void): () => void {\n return function (this: History, ...args: any[]): void {\n const url = args.length > 2 ? args[2] : undefined;\n if (url) {\n // coerce to string (this is what pushState does)\n const from = lastHref;\n const to = String(url);\n // keep track of the current URL state, as we always receive only the updated state\n lastHref = to;\n const handlerData: HandlerDataHistory = { from, to };\n triggerHandlers('history', handlerData);\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n\n fill(WINDOW.history, 'pushState', historyReplacementFunction);\n fill(WINDOW.history, 'replaceState', historyReplacementFunction);\n}\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,MAAA,GAAS,UAAW,EAAA;AAC1B;AACA,IAAI,QAAQ,CAAA;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA4C;AACpG,EAAE,MAAM,IAAK,GAAE,SAAS,CAAA;AACxB,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC3B,EAAE,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAA;AAC1C,CAAA;AACA;AACA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE;AAC1B,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,MAAM,aAAA,GAAgB,MAAM,CAAC,UAAU,CAAA;AACzC,EAAE,MAAM,CAAC,UAAA,GAAa,WAAqC,GAAG,IAAI,EAAc;AAChF,IAAI,MAAM,EAAG,GAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;AACnC;AACA,IAAI,MAAM,IAAK,GAAE,QAAQ,CAAA;AACzB,IAAI,QAAA,GAAW,EAAE,CAAA;AACjB,IAAI,MAAM,WAAW,GAAuB,EAAE,IAAI,EAAE,IAAI,CAAA;AACxD,IAAI,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC3C,IAAI,IAAI,aAAa,EAAE;AACvB;AACA;AACA;AACA,MAAM,IAAI;AACV,QAAQ,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAC9C,OAAQ,CAAA,OAAO,GAAG,EAAE;AACpB;AACA,OAAM;AACN,KAAI;AACJ,GAAG,CAAA;AACH;AACA,EAAE,SAAS,0BAA0B,CAAC,uBAAuB,EAA0B;AACvF,IAAI,OAAO,WAAyB,GAAG,IAAI,EAAe;AAC1D,MAAM,MAAM,GAAA,GAAM,IAAI,CAAC,MAAO,GAAE,CAAE,GAAE,IAAI,CAAC,CAAC,CAAA,GAAI,SAAS,CAAA;AACvD,MAAM,IAAI,GAAG,EAAE;AACf;AACA,QAAQ,MAAM,IAAK,GAAE,QAAQ,CAAA;AAC7B,QAAQ,MAAM,EAAG,GAAE,MAAM,CAAC,GAAG,CAAC,CAAA;AAC9B;AACA,QAAQ,QAAA,GAAW,EAAE,CAAA;AACrB,QAAQ,MAAM,WAAW,GAAuB,EAAE,IAAI,EAAE,IAAI,CAAA;AAC5D,QAAQ,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/C,OAAM;AACN,MAAM,OAAO,uBAAuB,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AACtD,KAAK,CAAA;AACL,GAAE;AACF;AACA,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,0BAA0B,CAAC,CAAA;AAC/D,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,0BAA0B,CAAC,CAAA;AAClE;;;;"}
|
||||
48
node_modules/@sentry/utils/esm/instrument/index.js
generated
vendored
Normal file
48
node_modules/@sentry/utils/esm/instrument/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { DEBUG_BUILD } from '../debug-build.js';
|
||||
import { logger } from '../logger.js';
|
||||
import { addConsoleInstrumentationHandler } from './console.js';
|
||||
export { addConsoleInstrumentationHandler } from './console.js';
|
||||
import { addClickKeypressInstrumentationHandler } from './dom.js';
|
||||
export { addClickKeypressInstrumentationHandler } from './dom.js';
|
||||
import { addFetchInstrumentationHandler } from './fetch.js';
|
||||
export { addFetchInstrumentationHandler } from './fetch.js';
|
||||
import { addGlobalErrorInstrumentationHandler } from './globalError.js';
|
||||
export { addGlobalErrorInstrumentationHandler } from './globalError.js';
|
||||
import { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhandledRejection.js';
|
||||
export { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhandledRejection.js';
|
||||
import { addHistoryInstrumentationHandler } from './history.js';
|
||||
export { addHistoryInstrumentationHandler } from './history.js';
|
||||
import { addXhrInstrumentationHandler } from './xhr.js';
|
||||
export { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './xhr.js';
|
||||
|
||||
// TODO(v8): Consider moving this file (or at least parts of it) into the browser package. The registered handlers are mostly non-generic and we risk leaking runtime specific code into generic packages.
|
||||
|
||||
/**
|
||||
* Add handler that will be called when given type of instrumentation triggers.
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
* @deprecated Use the proper function per instrumentation type instead!
|
||||
*/
|
||||
function addInstrumentationHandler(type, callback) {
|
||||
switch (type) {
|
||||
case 'console':
|
||||
return addConsoleInstrumentationHandler(callback);
|
||||
case 'dom':
|
||||
return addClickKeypressInstrumentationHandler(callback);
|
||||
case 'xhr':
|
||||
return addXhrInstrumentationHandler(callback);
|
||||
case 'fetch':
|
||||
return addFetchInstrumentationHandler(callback);
|
||||
case 'history':
|
||||
return addHistoryInstrumentationHandler(callback);
|
||||
case 'error':
|
||||
return addGlobalErrorInstrumentationHandler(callback);
|
||||
case 'unhandledrejection':
|
||||
return addGlobalUnhandledRejectionInstrumentationHandler(callback);
|
||||
default:
|
||||
DEBUG_BUILD && logger.warn('unknown instrumentation type:', type);
|
||||
}
|
||||
}
|
||||
|
||||
export { addInstrumentationHandler };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/index.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../src/instrument/index.ts"],"sourcesContent":["// TODO(v8): Consider moving this file (or at least parts of it) into the browser package. The registered handlers are mostly non-generic and we risk leaking runtime specific code into generic packages.\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { logger } from './../logger';\nimport type {\n InstrumentHandlerCallback as _InstrumentHandlerCallback,\n InstrumentHandlerType as _InstrumentHandlerType,\n} from './_handlers';\nimport { resetInstrumentationHandlers } from './_handlers';\nimport { addConsoleInstrumentationHandler } from './console';\nimport { addClickKeypressInstrumentationHandler } from './dom';\nimport { addFetchInstrumentationHandler } from './fetch';\nimport { addGlobalErrorInstrumentationHandler } from './globalError';\nimport { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhandledRejection';\nimport { addHistoryInstrumentationHandler } from './history';\nimport { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './xhr';\n\n/**\n * Add handler that will be called when given type of instrumentation triggers.\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n * @deprecated Use the proper function per instrumentation type instead!\n */\nexport function addInstrumentationHandler(type: _InstrumentHandlerType, callback: _InstrumentHandlerCallback): void {\n switch (type) {\n case 'console':\n return addConsoleInstrumentationHandler(callback);\n case 'dom':\n return addClickKeypressInstrumentationHandler(callback);\n case 'xhr':\n return addXhrInstrumentationHandler(callback);\n case 'fetch':\n return addFetchInstrumentationHandler(callback);\n case 'history':\n return addHistoryInstrumentationHandler(callback);\n case 'error':\n return addGlobalErrorInstrumentationHandler(callback);\n case 'unhandledrejection':\n return addGlobalUnhandledRejectionInstrumentationHandler(callback);\n default:\n DEBUG_BUILD && logger.warn('unknown instrumentation type:', type);\n }\n}\n\n/**\n * @deprecated Use the specific handler data types from @sentry/types instead, e.g. HandlerDataFetch, HandlerDataConsole, ...\n */\ntype InstrumentHandlerCallback = _InstrumentHandlerCallback;\n\n/**\n * @deprecated Use the specific handler functions instead, e.g. addConsoleInstrumentationHandler, ...\n */\ntype InstrumentHandlerType = _InstrumentHandlerType;\n\n// eslint-disable-next-line deprecation/deprecation\nexport type { InstrumentHandlerCallback, InstrumentHandlerType };\n\nexport {\n addConsoleInstrumentationHandler,\n addClickKeypressInstrumentationHandler,\n addXhrInstrumentationHandler,\n addFetchInstrumentationHandler,\n addHistoryInstrumentationHandler,\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n SENTRY_XHR_DATA_KEY,\n // Only exported for tests\n resetInstrumentationHandlers,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAA0B,QAAQ,EAAoC;AACpH,EAAE,QAAQ,IAAI;AACd,IAAI,KAAK,SAAS;AAClB,MAAM,OAAO,gCAAgC,CAAC,QAAQ,CAAC,CAAA;AACvD,IAAI,KAAK,KAAK;AACd,MAAM,OAAO,sCAAsC,CAAC,QAAQ,CAAC,CAAA;AAC7D,IAAI,KAAK,KAAK;AACd,MAAM,OAAO,4BAA4B,CAAC,QAAQ,CAAC,CAAA;AACnD,IAAI,KAAK,OAAO;AAChB,MAAM,OAAO,8BAA8B,CAAC,QAAQ,CAAC,CAAA;AACrD,IAAI,KAAK,SAAS;AAClB,MAAM,OAAO,gCAAgC,CAAC,QAAQ,CAAC,CAAA;AACvD,IAAI,KAAK,OAAO;AAChB,MAAM,OAAO,oCAAoC,CAAC,QAAQ,CAAC,CAAA;AAC3D,IAAI,KAAK,oBAAoB;AAC7B,MAAM,OAAO,iDAAiD,CAAC,QAAQ,CAAC,CAAA;AACxE,IAAI;AACJ,MAAM,WAAA,IAAe,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAA;AACvE,GAAE;AACF;;;;"}
|
||||
157
node_modules/@sentry/utils/esm/instrument/xhr.js
generated
vendored
Normal file
157
node_modules/@sentry/utils/esm/instrument/xhr.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import { isString } from '../is.js';
|
||||
import { fill } from '../object.js';
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
const WINDOW = GLOBAL_OBJ ;
|
||||
|
||||
const SENTRY_XHR_DATA_KEY = '__sentry_xhr_v3__';
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an XHR request happens.
|
||||
* The handler function is called once when the request starts and once when it ends,
|
||||
* which can be identified by checking if it has an `endTimestamp`.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addXhrInstrumentationHandler(handler) {
|
||||
const type = 'xhr';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentXHR);
|
||||
}
|
||||
|
||||
/** Exported only for tests. */
|
||||
function instrumentXHR() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
if (!(WINDOW ).XMLHttpRequest) {
|
||||
return;
|
||||
}
|
||||
|
||||
const xhrproto = XMLHttpRequest.prototype;
|
||||
|
||||
fill(xhrproto, 'open', function (originalOpen) {
|
||||
return function ( ...args) {
|
||||
const startTimestamp = Date.now();
|
||||
|
||||
// open() should always be called with two or more arguments
|
||||
// But to be on the safe side, we actually validate this and bail out if we don't have a method & url
|
||||
const method = isString(args[0]) ? args[0].toUpperCase() : undefined;
|
||||
const url = parseUrl(args[1]);
|
||||
|
||||
if (!method || !url) {
|
||||
return originalOpen.apply(this, args);
|
||||
}
|
||||
|
||||
this[SENTRY_XHR_DATA_KEY] = {
|
||||
method,
|
||||
url,
|
||||
request_headers: {},
|
||||
};
|
||||
|
||||
// if Sentry key appears in URL, don't capture it as a request
|
||||
if (method === 'POST' && url.match(/sentry_key/)) {
|
||||
this.__sentry_own_request__ = true;
|
||||
}
|
||||
|
||||
const onreadystatechangeHandler = () => {
|
||||
// For whatever reason, this is not the same instance here as from the outer method
|
||||
const xhrInfo = this[SENTRY_XHR_DATA_KEY];
|
||||
|
||||
if (!xhrInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.readyState === 4) {
|
||||
try {
|
||||
// touching statusCode in some platforms throws
|
||||
// an exception
|
||||
xhrInfo.status_code = this.status;
|
||||
} catch (e) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
const handlerData = {
|
||||
args: [method, url],
|
||||
endTimestamp: Date.now(),
|
||||
startTimestamp,
|
||||
xhr: this,
|
||||
};
|
||||
triggerHandlers('xhr', handlerData);
|
||||
}
|
||||
};
|
||||
|
||||
if ('onreadystatechange' in this && typeof this.onreadystatechange === 'function') {
|
||||
fill(this, 'onreadystatechange', function (original) {
|
||||
return function ( ...readyStateArgs) {
|
||||
onreadystatechangeHandler();
|
||||
return original.apply(this, readyStateArgs);
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this.addEventListener('readystatechange', onreadystatechangeHandler);
|
||||
}
|
||||
|
||||
// Intercepting `setRequestHeader` to access the request headers of XHR instance.
|
||||
// This will only work for user/library defined headers, not for the default/browser-assigned headers.
|
||||
// Request cookies are also unavailable for XHR, as `Cookie` header can't be defined by `setRequestHeader`.
|
||||
fill(this, 'setRequestHeader', function (original) {
|
||||
return function ( ...setRequestHeaderArgs) {
|
||||
const [header, value] = setRequestHeaderArgs;
|
||||
|
||||
const xhrInfo = this[SENTRY_XHR_DATA_KEY];
|
||||
|
||||
if (xhrInfo && isString(header) && isString(value)) {
|
||||
xhrInfo.request_headers[header.toLowerCase()] = value;
|
||||
}
|
||||
|
||||
return original.apply(this, setRequestHeaderArgs);
|
||||
};
|
||||
});
|
||||
|
||||
return originalOpen.apply(this, args);
|
||||
};
|
||||
});
|
||||
|
||||
fill(xhrproto, 'send', function (originalSend) {
|
||||
return function ( ...args) {
|
||||
const sentryXhrData = this[SENTRY_XHR_DATA_KEY];
|
||||
|
||||
if (!sentryXhrData) {
|
||||
return originalSend.apply(this, args);
|
||||
}
|
||||
|
||||
if (args[0] !== undefined) {
|
||||
sentryXhrData.body = args[0];
|
||||
}
|
||||
|
||||
const handlerData = {
|
||||
args: [sentryXhrData.method, sentryXhrData.url],
|
||||
startTimestamp: Date.now(),
|
||||
xhr: this,
|
||||
};
|
||||
triggerHandlers('xhr', handlerData);
|
||||
|
||||
return originalSend.apply(this, args);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function parseUrl(url) {
|
||||
if (isString(url)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
try {
|
||||
// url can be a string or URL
|
||||
// but since URL is not available in IE11, we do not check for it,
|
||||
// but simply assume it is an URL and return `toString()` from it (which returns the full URL)
|
||||
// If that fails, we just return undefined
|
||||
return (url ).toString();
|
||||
} catch (e2) {} // eslint-disable-line no-empty
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler, instrumentXHR };
|
||||
//# sourceMappingURL=xhr.js.map
|
||||
1
node_modules/@sentry/utils/esm/instrument/xhr.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/instrument/xhr.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
206
node_modules/@sentry/utils/esm/is.js
generated
vendored
Normal file
206
node_modules/@sentry/utils/esm/is.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const objectToString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is one of a few Error or Error-like
|
||||
* {@link isError}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isError(wat) {
|
||||
switch (objectToString.call(wat)) {
|
||||
case '[object Error]':
|
||||
case '[object Exception]':
|
||||
case '[object DOMException]':
|
||||
return true;
|
||||
default:
|
||||
return isInstanceOf(wat, Error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks whether given value is an instance of the given built-in class.
|
||||
*
|
||||
* @param wat The value to be checked
|
||||
* @param className
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isBuiltin(wat, className) {
|
||||
return objectToString.call(wat) === `[object ${className}]`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is ErrorEvent
|
||||
* {@link isErrorEvent}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isErrorEvent(wat) {
|
||||
return isBuiltin(wat, 'ErrorEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is DOMError
|
||||
* {@link isDOMError}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isDOMError(wat) {
|
||||
return isBuiltin(wat, 'DOMError');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is DOMException
|
||||
* {@link isDOMException}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isDOMException(wat) {
|
||||
return isBuiltin(wat, 'DOMException');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is a string
|
||||
* {@link isString}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isString(wat) {
|
||||
return isBuiltin(wat, 'String');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given string is parameterized
|
||||
* {@link isParameterizedString}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isParameterizedString(wat) {
|
||||
return (
|
||||
typeof wat === 'object' &&
|
||||
wat !== null &&
|
||||
'__sentry_template_string__' in wat &&
|
||||
'__sentry_template_values__' in wat
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)
|
||||
* {@link isPrimitive}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isPrimitive(wat) {
|
||||
return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is an object literal, or a class instance.
|
||||
* {@link isPlainObject}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isPlainObject(wat) {
|
||||
return isBuiltin(wat, 'Object');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is an Event instance
|
||||
* {@link isEvent}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isEvent(wat) {
|
||||
return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is an Element instance
|
||||
* {@link isElement}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isElement(wat) {
|
||||
return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is an regexp
|
||||
* {@link isRegExp}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isRegExp(wat) {
|
||||
return isBuiltin(wat, 'RegExp');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value has a then function.
|
||||
* @param wat A value to be checked.
|
||||
*/
|
||||
function isThenable(wat) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return Boolean(wat && wat.then && typeof wat.then === 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is a SyntheticEvent
|
||||
* {@link isSyntheticEvent}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isSyntheticEvent(wat) {
|
||||
return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value is NaN
|
||||
* {@link isNaN}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isNaN(wat) {
|
||||
return typeof wat === 'number' && wat !== wat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is an instance of provided constructor.
|
||||
* {@link isInstanceOf}.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @param base A constructor to be used in a check.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isInstanceOf(wat, base) {
|
||||
try {
|
||||
return wat instanceof base;
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether given value's type is a Vue ViewModel.
|
||||
*
|
||||
* @param wat A value to be checked.
|
||||
* @returns A boolean representing the result.
|
||||
*/
|
||||
function isVueViewModel(wat) {
|
||||
// Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.
|
||||
return !!(typeof wat === 'object' && wat !== null && ((wat ).__isVue || (wat )._isVue));
|
||||
}
|
||||
|
||||
export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel };
|
||||
//# sourceMappingURL=is.js.map
|
||||
1
node_modules/@sentry/utils/esm/is.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/is.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/@sentry/utils/esm/isBrowser.js
generated
vendored
Normal file
21
node_modules/@sentry/utils/esm/isBrowser.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { isNodeEnv } from './node.js';
|
||||
import { GLOBAL_OBJ } from './worldwide.js';
|
||||
|
||||
/**
|
||||
* Returns true if we are in the browser.
|
||||
*/
|
||||
function isBrowser() {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());
|
||||
}
|
||||
|
||||
// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them
|
||||
function isElectronNodeRenderer() {
|
||||
return (
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
(GLOBAL_OBJ ).process !== undefined && ((GLOBAL_OBJ ).process ).type === 'renderer'
|
||||
);
|
||||
}
|
||||
|
||||
export { isBrowser };
|
||||
//# sourceMappingURL=isBrowser.js.map
|
||||
1
node_modules/@sentry/utils/esm/isBrowser.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/isBrowser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isBrowser.js","sources":["../../src/isBrowser.ts"],"sourcesContent":["import { isNodeEnv } from './node';\nimport { GLOBAL_OBJ } from './worldwide';\n\n/**\n * Returns true if we are in the browser.\n */\nexport function isBrowser(): boolean {\n // eslint-disable-next-line no-restricted-globals\n return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());\n}\n\ntype ElectronProcess = { type?: string };\n\n// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them\nfunction isElectronNodeRenderer(): boolean {\n return (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (GLOBAL_OBJ as any).process !== undefined && ((GLOBAL_OBJ as any).process as ElectronProcess).type === 'renderer'\n );\n}\n"],"names":[],"mappings":";;;AAGA;AACA;AACA;AACO,SAAS,SAAS,GAAY;AACrC;AACA,EAAE,OAAO,OAAO,MAAO,KAAI,gBAAgB,CAAC,SAAS,EAAG,IAAG,sBAAsB,EAAE,CAAC,CAAA;AACpF,CAAA;;AAIA;AACA,SAAS,sBAAsB,GAAY;AAC3C,EAAE;AACF;AACA,IAAI,CAAC,UAAW,GAAQ,OAAA,KAAY,SAAU,IAAG,CAAC,CAAC,aAAmB,UAA4B,SAAS,UAAA;AAC3G,IAAG;AACH;;;;"}
|
||||
92
node_modules/@sentry/utils/esm/logger.js
generated
vendored
Normal file
92
node_modules/@sentry/utils/esm/logger.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { GLOBAL_OBJ } from './worldwide.js';
|
||||
|
||||
/** Prefix for logging strings */
|
||||
const PREFIX = 'Sentry Logger ';
|
||||
|
||||
const CONSOLE_LEVELS = [
|
||||
'debug',
|
||||
'info',
|
||||
'warn',
|
||||
'error',
|
||||
'log',
|
||||
'assert',
|
||||
'trace',
|
||||
] ;
|
||||
|
||||
/** This may be mutated by the console instrumentation. */
|
||||
const originalConsoleMethods
|
||||
|
||||
= {};
|
||||
|
||||
/** JSDoc */
|
||||
|
||||
/**
|
||||
* Temporarily disable sentry console instrumentations.
|
||||
*
|
||||
* @param callback The function to run against the original `console` messages
|
||||
* @returns The results of the callback
|
||||
*/
|
||||
function consoleSandbox(callback) {
|
||||
if (!('console' in GLOBAL_OBJ)) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
const console = GLOBAL_OBJ.console ;
|
||||
const wrappedFuncs = {};
|
||||
|
||||
const wrappedLevels = Object.keys(originalConsoleMethods) ;
|
||||
|
||||
// Restore all wrapped console methods
|
||||
wrappedLevels.forEach(level => {
|
||||
const originalConsoleMethod = originalConsoleMethods[level] ;
|
||||
wrappedFuncs[level] = console[level] ;
|
||||
console[level] = originalConsoleMethod;
|
||||
});
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
// Revert restoration to wrapped state
|
||||
wrappedLevels.forEach(level => {
|
||||
console[level] = wrappedFuncs[level] ;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeLogger() {
|
||||
let enabled = false;
|
||||
const logger = {
|
||||
enable: () => {
|
||||
enabled = true;
|
||||
},
|
||||
disable: () => {
|
||||
enabled = false;
|
||||
},
|
||||
isEnabled: () => enabled,
|
||||
};
|
||||
|
||||
if (DEBUG_BUILD) {
|
||||
CONSOLE_LEVELS.forEach(name => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
logger[name] = (...args) => {
|
||||
if (enabled) {
|
||||
consoleSandbox(() => {
|
||||
GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
} else {
|
||||
CONSOLE_LEVELS.forEach(name => {
|
||||
logger[name] = () => undefined;
|
||||
});
|
||||
}
|
||||
|
||||
return logger ;
|
||||
}
|
||||
|
||||
const logger = makeLogger();
|
||||
|
||||
export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods };
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/@sentry/utils/esm/logger.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/logger.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"logger.js","sources":["../../src/logger.ts"],"sourcesContent":["import type { ConsoleLevel } from '@sentry/types';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { GLOBAL_OBJ } from './worldwide';\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\nexport const CONSOLE_LEVELS: readonly ConsoleLevel[] = [\n 'debug',\n 'info',\n 'warn',\n 'error',\n 'log',\n 'assert',\n 'trace',\n] as const;\n\ntype LoggerMethod = (...args: unknown[]) => void;\ntype LoggerConsoleMethods = Record<ConsoleLevel, LoggerMethod>;\n\n/** This may be mutated by the console instrumentation. */\nexport const originalConsoleMethods: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key in ConsoleLevel]?: (...args: any[]) => void;\n} = {};\n\n/** JSDoc */\ninterface Logger extends LoggerConsoleMethods {\n disable(): void;\n enable(): void;\n isEnabled(): boolean;\n}\n\n/**\n * Temporarily disable sentry console instrumentations.\n *\n * @param callback The function to run against the original `console` messages\n * @returns The results of the callback\n */\nexport function consoleSandbox<T>(callback: () => T): T {\n if (!('console' in GLOBAL_OBJ)) {\n return callback();\n }\n\n const console = GLOBAL_OBJ.console as Console;\n const wrappedFuncs: Partial<LoggerConsoleMethods> = {};\n\n const wrappedLevels = Object.keys(originalConsoleMethods) as ConsoleLevel[];\n\n // Restore all wrapped console methods\n wrappedLevels.forEach(level => {\n const originalConsoleMethod = originalConsoleMethods[level] as LoggerMethod;\n wrappedFuncs[level] = console[level] as LoggerMethod | undefined;\n console[level] = originalConsoleMethod;\n });\n\n try {\n return callback();\n } finally {\n // Revert restoration to wrapped state\n wrappedLevels.forEach(level => {\n console[level] = wrappedFuncs[level] as LoggerMethod;\n });\n }\n}\n\nfunction makeLogger(): Logger {\n let enabled = false;\n const logger: Partial<Logger> = {\n enable: () => {\n enabled = true;\n },\n disable: () => {\n enabled = false;\n },\n isEnabled: () => enabled,\n };\n\n if (DEBUG_BUILD) {\n CONSOLE_LEVELS.forEach(name => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n logger[name] = (...args: any[]) => {\n if (enabled) {\n consoleSandbox(() => {\n GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);\n });\n }\n };\n });\n } else {\n CONSOLE_LEVELS.forEach(name => {\n logger[name] = () => undefined;\n });\n }\n\n return logger as Logger;\n}\n\nexport const logger = makeLogger();\n"],"names":[],"mappings":";;;AAKA;AACA,MAAM,MAAA,GAAS,gBAAgB,CAAA;AAC/B;AACO,MAAM,cAAc,GAA4B;AACvD,EAAE,OAAO;AACT,EAAE,MAAM;AACR,EAAE,MAAM;AACR,EAAE,OAAO;AACT,EAAE,KAAK;AACP,EAAE,QAAQ;AACV,EAAE,OAAO;AACT,CAAE,EAAA;;AAKF;MACa,sBAAsB;;AAGnC,GAAI,GAAE;AACN;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAI,QAAQ,EAAc;AACxD,EAAE,IAAI,EAAE,aAAa,UAAU,CAAC,EAAE;AAClC,IAAI,OAAO,QAAQ,EAAE,CAAA;AACrB,GAAE;AACF;AACA,EAAE,MAAM,OAAA,GAAU,UAAU,CAAC,OAAQ,EAAA;AACrC,EAAE,MAAM,YAAY,GAAkC,EAAE,CAAA;AACxD;AACA,EAAE,MAAM,gBAAgB,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAE,EAAA;AAC5D;AACA;AACA,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS;AACjC,IAAI,MAAM,qBAAsB,GAAE,sBAAsB,CAAC,KAAK,CAAE,EAAA;AAChE,IAAI,YAAY,CAAC,KAAK,CAAA,GAAI,OAAO,CAAC,KAAK,CAAE,EAAA;AACzC,IAAI,OAAO,CAAC,KAAK,CAAA,GAAI,qBAAqB,CAAA;AAC1C,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,IAAI;AACN,IAAI,OAAO,QAAQ,EAAE,CAAA;AACrB,YAAY;AACZ;AACA,IAAI,aAAa,CAAC,OAAO,CAAC,SAAS;AACnC,MAAM,OAAO,CAAC,KAAK,CAAA,GAAI,YAAY,CAAC,KAAK,CAAE,EAAA;AAC3C,KAAK,CAAC,CAAA;AACN,GAAE;AACF,CAAA;AACA;AACA,SAAS,UAAU,GAAW;AAC9B,EAAE,IAAI,OAAQ,GAAE,KAAK,CAAA;AACrB,EAAE,MAAM,MAAM,GAAoB;AAClC,IAAI,MAAM,EAAE,MAAM;AAClB,MAAM,OAAA,GAAU,IAAI,CAAA;AACpB,KAAK;AACL,IAAI,OAAO,EAAE,MAAM;AACnB,MAAM,OAAA,GAAU,KAAK,CAAA;AACrB,KAAK;AACL,IAAI,SAAS,EAAE,MAAM,OAAO;AAC5B,GAAG,CAAA;AACH;AACA,EAAE,IAAI,WAAW,EAAE;AACnB,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ;AACnC;AACA,MAAM,MAAM,CAAC,IAAI,CAAA,GAAI,CAAC,GAAG,IAAI,KAAY;AACzC,QAAQ,IAAI,OAAO,EAAE;AACrB,UAAU,cAAc,CAAC,MAAM;AAC/B,YAAY,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAA,MAAA,CAAA,CAAA,EAAA,IAAA,CAAA,EAAA,CAAA,EAAA,GAAA,IAAA,CAAA,CAAA;AACA,WAAA,CAAA,CAAA;AACA,SAAA;AACA,OAAA,CAAA;AACA,KAAA,CAAA,CAAA;AACA,GAAA,MAAA;AACA,IAAA,cAAA,CAAA,OAAA,CAAA,IAAA,IAAA;AACA,MAAA,MAAA,CAAA,IAAA,CAAA,GAAA,MAAA,SAAA,CAAA;AACA,KAAA,CAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,MAAA,EAAA;AACA,CAAA;AACA;AACA,MAAA,MAAA,GAAA,UAAA;;;;"}
|
||||
62
node_modules/@sentry/utils/esm/lru.js
generated
vendored
Normal file
62
node_modules/@sentry/utils/esm/lru.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/** A simple Least Recently Used map */
|
||||
class LRUMap {
|
||||
|
||||
constructor( _maxSize) {this._maxSize = _maxSize;
|
||||
this._cache = new Map();
|
||||
}
|
||||
|
||||
/** Get the current size of the cache */
|
||||
get size() {
|
||||
return this._cache.size;
|
||||
}
|
||||
|
||||
/** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */
|
||||
get(key) {
|
||||
const value = this._cache.get(key);
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
// Remove and re-insert to update the order
|
||||
this._cache.delete(key);
|
||||
this._cache.set(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Insert an entry and evict an older entry if we've reached maxSize */
|
||||
set(key, value) {
|
||||
if (this._cache.size >= this._maxSize) {
|
||||
// keys() returns an iterator in insertion order so keys().next() gives us the oldest key
|
||||
this._cache.delete(this._cache.keys().next().value);
|
||||
}
|
||||
this._cache.set(key, value);
|
||||
}
|
||||
|
||||
/** Remove an entry and return the entry if it was in the cache */
|
||||
remove(key) {
|
||||
const value = this._cache.get(key);
|
||||
if (value) {
|
||||
this._cache.delete(key);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Clear all entries */
|
||||
clear() {
|
||||
this._cache.clear();
|
||||
}
|
||||
|
||||
/** Get all the keys */
|
||||
keys() {
|
||||
return Array.from(this._cache.keys());
|
||||
}
|
||||
|
||||
/** Get all the values */
|
||||
values() {
|
||||
const values = [];
|
||||
this._cache.forEach(value => values.push(value));
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
export { LRUMap };
|
||||
//# sourceMappingURL=lru.js.map
|
||||
1
node_modules/@sentry/utils/esm/lru.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/lru.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lru.js","sources":["../../src/lru.ts"],"sourcesContent":["/** A simple Least Recently Used map */\nexport class LRUMap<K, V> {\n private readonly _cache: Map<K, V>;\n\n public constructor(private readonly _maxSize: number) {\n this._cache = new Map<K, V>();\n }\n\n /** Get the current size of the cache */\n public get size(): number {\n return this._cache.size;\n }\n\n /** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */\n public get(key: K): V | undefined {\n const value = this._cache.get(key);\n if (value === undefined) {\n return undefined;\n }\n // Remove and re-insert to update the order\n this._cache.delete(key);\n this._cache.set(key, value);\n return value;\n }\n\n /** Insert an entry and evict an older entry if we've reached maxSize */\n public set(key: K, value: V): void {\n if (this._cache.size >= this._maxSize) {\n // keys() returns an iterator in insertion order so keys().next() gives us the oldest key\n this._cache.delete(this._cache.keys().next().value);\n }\n this._cache.set(key, value);\n }\n\n /** Remove an entry and return the entry if it was in the cache */\n public remove(key: K): V | undefined {\n const value = this._cache.get(key);\n if (value) {\n this._cache.delete(key);\n }\n return value;\n }\n\n /** Clear all entries */\n public clear(): void {\n this._cache.clear();\n }\n\n /** Get all the keys */\n public keys(): Array<K> {\n return Array.from(this._cache.keys());\n }\n\n /** Get all the values */\n public values(): Array<V> {\n const values: V[] = [];\n this._cache.forEach(value => values.push(value));\n return values;\n }\n}\n"],"names":[],"mappings":"AAAA;AACO,MAAM,MAAM,CAAO;;AAG1B,GAAS,WAAW,GAAkB,QAAQ,EAAU,CAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AACxD,IAAI,IAAI,CAAC,MAAA,GAAS,IAAI,GAAG,EAAQ,CAAA;AACjC,GAAE;AACF;AACA;AACA,GAAS,IAAI,IAAI,GAAW;AAC5B,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;AAC3B,GAAE;AACF;AACA;AACA,GAAS,GAAG,CAAC,GAAG,EAAoB;AACpC,IAAI,MAAM,KAAM,GAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACtC,IAAI,IAAI,KAAM,KAAI,SAAS,EAAE;AAC7B,MAAM,OAAO,SAAS,CAAA;AACtB,KAAI;AACJ;AACA,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC/B,IAAI,OAAO,KAAK,CAAA;AAChB,GAAE;AACF;AACA;AACA,GAAS,GAAG,CAAC,GAAG,EAAK,KAAK,EAAW;AACrC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,IAAQ,IAAI,CAAC,QAAQ,EAAE;AAC3C;AACA,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;AACzD,KAAI;AACJ,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC/B,GAAE;AACF;AACA;AACA,GAAS,MAAM,CAAC,GAAG,EAAoB;AACvC,IAAI,MAAM,KAAM,GAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACtC,IAAI,IAAI,KAAK,EAAE;AACf,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC7B,KAAI;AACJ,IAAI,OAAO,KAAK,CAAA;AAChB,GAAE;AACF;AACA;AACA,GAAS,KAAK,GAAS;AACvB,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;AACvB,GAAE;AACF;AACA;AACA,GAAS,IAAI,GAAa;AAC1B,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;AACzC,GAAE;AACF;AACA;AACA,GAAS,MAAM,GAAa;AAC5B,IAAI,MAAM,MAAM,GAAQ,EAAE,CAAA;AAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAA,IAAS,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AACpD,IAAI,OAAO,MAAM,CAAA;AACjB,GAAE;AACF;;;;"}
|
||||
45
node_modules/@sentry/utils/esm/memo.js
generated
vendored
Normal file
45
node_modules/@sentry/utils/esm/memo.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/**
|
||||
* Helper to decycle json objects
|
||||
*/
|
||||
function memoBuilder() {
|
||||
const hasWeakSet = typeof WeakSet === 'function';
|
||||
const inner = hasWeakSet ? new WeakSet() : [];
|
||||
function memoize(obj) {
|
||||
if (hasWeakSet) {
|
||||
if (inner.has(obj)) {
|
||||
return true;
|
||||
}
|
||||
inner.add(obj);
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < inner.length; i++) {
|
||||
const value = inner[i];
|
||||
if (value === obj) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
inner.push(obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
function unmemoize(obj) {
|
||||
if (hasWeakSet) {
|
||||
inner.delete(obj);
|
||||
} else {
|
||||
for (let i = 0; i < inner.length; i++) {
|
||||
if (inner[i] === obj) {
|
||||
inner.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [memoize, unmemoize];
|
||||
}
|
||||
|
||||
export { memoBuilder };
|
||||
//# sourceMappingURL=memo.js.map
|
||||
1
node_modules/@sentry/utils/esm/memo.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/memo.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"memo.js","sources":["../../src/memo.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport type MemoFunc = [\n // memoize\n (obj: any) => boolean,\n // unmemoize\n (obj: any) => void,\n];\n\n/**\n * Helper to decycle json objects\n */\nexport function memoBuilder(): MemoFunc {\n const hasWeakSet = typeof WeakSet === 'function';\n const inner: any = hasWeakSet ? new WeakSet() : [];\n function memoize(obj: any): boolean {\n if (hasWeakSet) {\n if (inner.has(obj)) {\n return true;\n }\n inner.add(obj);\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < inner.length; i++) {\n const value = inner[i];\n if (value === obj) {\n return true;\n }\n }\n inner.push(obj);\n return false;\n }\n\n function unmemoize(obj: any): void {\n if (hasWeakSet) {\n inner.delete(obj);\n } else {\n for (let i = 0; i < inner.length; i++) {\n if (inner[i] === obj) {\n inner.splice(i, 1);\n break;\n }\n }\n }\n }\n return [memoize, unmemoize];\n}\n"],"names":[],"mappings":"AAAA;AACA;;AASA;AACA;AACA;AACO,SAAS,WAAW,GAAa;AACxC,EAAE,MAAM,UAAW,GAAE,OAAO,OAAA,KAAY,UAAU,CAAA;AAClD,EAAE,MAAM,KAAK,GAAQ,UAAW,GAAE,IAAI,OAAO,EAAC,GAAI,EAAE,CAAA;AACpD,EAAE,SAAS,OAAO,CAAC,GAAG,EAAgB;AACtC,IAAI,IAAI,UAAU,EAAE;AACpB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC1B,QAAQ,OAAO,IAAI,CAAA;AACnB,OAAM;AACN,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACpB,MAAM,OAAO,KAAK,CAAA;AAClB,KAAI;AACJ;AACA,IAAI,KAAK,IAAI,CAAA,GAAI,CAAC,EAAE,CAAE,GAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC3C,MAAM,MAAM,KAAM,GAAE,KAAK,CAAC,CAAC,CAAC,CAAA;AAC5B,MAAM,IAAI,KAAM,KAAI,GAAG,EAAE;AACzB,QAAQ,OAAO,IAAI,CAAA;AACnB,OAAM;AACN,KAAI;AACJ,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACnB,IAAI,OAAO,KAAK,CAAA;AAChB,GAAE;AACF;AACA,EAAE,SAAS,SAAS,CAAC,GAAG,EAAa;AACrC,IAAI,IAAI,UAAU,EAAE;AACpB,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AACvB,WAAW;AACX,MAAM,KAAK,IAAI,CAAA,GAAI,CAAC,EAAE,CAAE,GAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAE,KAAI,GAAG,EAAE;AAC9B,UAAU,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5B,UAAU,MAAK;AACf,SAAQ;AACR,OAAM;AACN,KAAI;AACJ,GAAE;AACF,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;AAC7B;;;;"}
|
||||
211
node_modules/@sentry/utils/esm/misc.js
generated
vendored
Normal file
211
node_modules/@sentry/utils/esm/misc.js
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
import { addNonEnumerableProperty } from './object.js';
|
||||
import { snipLine } from './string.js';
|
||||
import { GLOBAL_OBJ } from './worldwide.js';
|
||||
|
||||
/**
|
||||
* UUID4 generator
|
||||
*
|
||||
* @returns string Generated UUID4.
|
||||
*/
|
||||
function uuid4() {
|
||||
const gbl = GLOBAL_OBJ ;
|
||||
const crypto = gbl.crypto || gbl.msCrypto;
|
||||
|
||||
let getRandomByte = () => Math.random() * 16;
|
||||
try {
|
||||
if (crypto && crypto.randomUUID) {
|
||||
return crypto.randomUUID().replace(/-/g, '');
|
||||
}
|
||||
if (crypto && crypto.getRandomValues) {
|
||||
getRandomByte = () => {
|
||||
// crypto.getRandomValues might return undefined instead of the typed array
|
||||
// in old Chromium versions (e.g. 23.0.1235.0 (151422))
|
||||
// However, `typedArray` is still filled in-place.
|
||||
// @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#typedarray
|
||||
const typedArray = new Uint8Array(1);
|
||||
crypto.getRandomValues(typedArray);
|
||||
return typedArray[0];
|
||||
};
|
||||
}
|
||||
} catch (_) {
|
||||
// some runtimes can crash invoking crypto
|
||||
// https://github.com/getsentry/sentry-javascript/issues/8935
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
|
||||
// Concatenating the following numbers as strings results in '10000000100040008000100000000000'
|
||||
return (([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>
|
||||
// eslint-disable-next-line no-bitwise
|
||||
((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16),
|
||||
);
|
||||
}
|
||||
|
||||
function getFirstException(event) {
|
||||
return event.exception && event.exception.values ? event.exception.values[0] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts either message or type+value from an event that can be used for user-facing logs
|
||||
* @returns event's description
|
||||
*/
|
||||
function getEventDescription(event) {
|
||||
const { message, event_id: eventId } = event;
|
||||
if (message) {
|
||||
return message;
|
||||
}
|
||||
|
||||
const firstException = getFirstException(event);
|
||||
if (firstException) {
|
||||
if (firstException.type && firstException.value) {
|
||||
return `${firstException.type}: ${firstException.value}`;
|
||||
}
|
||||
return firstException.type || firstException.value || eventId || '<unknown>';
|
||||
}
|
||||
return eventId || '<unknown>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds exception values, type and value to an synthetic Exception.
|
||||
* @param event The event to modify.
|
||||
* @param value Value of the exception.
|
||||
* @param type Type of the exception.
|
||||
* @hidden
|
||||
*/
|
||||
function addExceptionTypeValue(event, value, type) {
|
||||
const exception = (event.exception = event.exception || {});
|
||||
const values = (exception.values = exception.values || []);
|
||||
const firstException = (values[0] = values[0] || {});
|
||||
if (!firstException.value) {
|
||||
firstException.value = value || '';
|
||||
}
|
||||
if (!firstException.type) {
|
||||
firstException.type = type || 'Error';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.
|
||||
*
|
||||
* @param event The event to modify.
|
||||
* @param newMechanism Mechanism data to add to the event.
|
||||
* @hidden
|
||||
*/
|
||||
function addExceptionMechanism(event, newMechanism) {
|
||||
const firstException = getFirstException(event);
|
||||
if (!firstException) {
|
||||
return;
|
||||
}
|
||||
|
||||
const defaultMechanism = { type: 'generic', handled: true };
|
||||
const currentMechanism = firstException.mechanism;
|
||||
firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };
|
||||
|
||||
if (newMechanism && 'data' in newMechanism) {
|
||||
const mergedData = { ...(currentMechanism && currentMechanism.data), ...newMechanism.data };
|
||||
firstException.mechanism.data = mergedData;
|
||||
}
|
||||
}
|
||||
|
||||
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
||||
const SEMVER_REGEXP =
|
||||
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
||||
|
||||
/**
|
||||
* Represents Semantic Versioning object
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses input into a SemVer interface
|
||||
* @param input string representation of a semver version
|
||||
*/
|
||||
function parseSemver(input) {
|
||||
const match = input.match(SEMVER_REGEXP) || [];
|
||||
const major = parseInt(match[1], 10);
|
||||
const minor = parseInt(match[2], 10);
|
||||
const patch = parseInt(match[3], 10);
|
||||
return {
|
||||
buildmetadata: match[5],
|
||||
major: isNaN(major) ? undefined : major,
|
||||
minor: isNaN(minor) ? undefined : minor,
|
||||
patch: isNaN(patch) ? undefined : patch,
|
||||
prerelease: match[4],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds context (pre/post/line) lines to the provided frame
|
||||
*
|
||||
* @param lines string[] containing all lines
|
||||
* @param frame StackFrame that will be mutated
|
||||
* @param linesOfContext number of context lines we want to add pre/post
|
||||
*/
|
||||
function addContextToFrame(lines, frame, linesOfContext = 5) {
|
||||
// When there is no line number in the frame, attaching context is nonsensical and will even break grouping
|
||||
if (frame.lineno === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const maxLines = lines.length;
|
||||
const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0);
|
||||
|
||||
frame.pre_context = lines
|
||||
.slice(Math.max(0, sourceLine - linesOfContext), sourceLine)
|
||||
.map((line) => snipLine(line, 0));
|
||||
|
||||
frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0);
|
||||
|
||||
frame.post_context = lines
|
||||
.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)
|
||||
.map((line) => snipLine(line, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
|
||||
* in question), and marks it captured if not.
|
||||
*
|
||||
* This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
|
||||
* record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
|
||||
* that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
|
||||
* the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
|
||||
* caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
|
||||
* function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
|
||||
* see it.
|
||||
*
|
||||
* Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on
|
||||
* them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
|
||||
* object wrapper forms so that this check will always work. However, because we need to flag the exact object which
|
||||
* will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
|
||||
* must be done before the exception captured.
|
||||
*
|
||||
* @param A thrown exception to check or flag as having been seen
|
||||
* @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
|
||||
*/
|
||||
function checkOrSetAlreadyCaught(exception) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
if (exception && (exception ).__sentry_captured__) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the
|
||||
// `ExtraErrorData` integration
|
||||
addNonEnumerableProperty(exception , '__sentry_captured__', true);
|
||||
} catch (err) {
|
||||
// `exception` is a primitive, so we can't mark it seen
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given input is already an array, and if it isn't, wraps it in one.
|
||||
*
|
||||
* @param maybeArray Input to turn into an array, if necessary
|
||||
* @returns The input, if already an array, or an array with the input as the only element, if not
|
||||
*/
|
||||
function arrayify(maybeArray) {
|
||||
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
||||
}
|
||||
|
||||
export { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, uuid4 };
|
||||
//# sourceMappingURL=misc.js.map
|
||||
1
node_modules/@sentry/utils/esm/misc.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/misc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
109
node_modules/@sentry/utils/esm/node-stack-trace.js
generated
vendored
Normal file
109
node_modules/@sentry/utils/esm/node-stack-trace.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Does this filename look like it's part of the app code?
|
||||
*/
|
||||
function filenameIsInApp(filename, isNative = false) {
|
||||
const isInternal =
|
||||
isNative ||
|
||||
(filename &&
|
||||
// It's not internal if it's an absolute linux path
|
||||
!filename.startsWith('/') &&
|
||||
// It's not internal if it's an absolute windows path
|
||||
!filename.match(/^[A-Z]:/) &&
|
||||
// It's not internal if the path is starting with a dot
|
||||
!filename.startsWith('.') &&
|
||||
// It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack
|
||||
!filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//)); // Schema from: https://stackoverflow.com/a/3641782
|
||||
|
||||
// in_app is all that's not an internal Node function or a module within node_modules
|
||||
// note that isNative appears to return true even for node core libraries
|
||||
// see https://github.com/getsentry/raven-node/issues/176
|
||||
|
||||
return !isInternal && filename !== undefined && !filename.includes('node_modules/');
|
||||
}
|
||||
|
||||
/** Node Stack line parser */
|
||||
// eslint-disable-next-line complexity
|
||||
function node(getModule) {
|
||||
const FILENAME_MATCH = /^\s*[-]{4,}$/;
|
||||
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
return (line) => {
|
||||
const lineMatch = line.match(FULL_MATCH);
|
||||
|
||||
if (lineMatch) {
|
||||
let object;
|
||||
let method;
|
||||
let functionName;
|
||||
let typeName;
|
||||
let methodName;
|
||||
|
||||
if (lineMatch[1]) {
|
||||
functionName = lineMatch[1];
|
||||
|
||||
let methodStart = functionName.lastIndexOf('.');
|
||||
if (functionName[methodStart - 1] === '.') {
|
||||
methodStart--;
|
||||
}
|
||||
|
||||
if (methodStart > 0) {
|
||||
object = functionName.slice(0, methodStart);
|
||||
method = functionName.slice(methodStart + 1);
|
||||
const objectEnd = object.indexOf('.Module');
|
||||
if (objectEnd > 0) {
|
||||
functionName = functionName.slice(objectEnd + 1);
|
||||
object = object.slice(0, objectEnd);
|
||||
}
|
||||
}
|
||||
typeName = undefined;
|
||||
}
|
||||
|
||||
if (method) {
|
||||
typeName = object;
|
||||
methodName = method;
|
||||
}
|
||||
|
||||
if (method === '<anonymous>') {
|
||||
methodName = undefined;
|
||||
functionName = undefined;
|
||||
}
|
||||
|
||||
if (functionName === undefined) {
|
||||
methodName = methodName || '<anonymous>';
|
||||
functionName = typeName ? `${typeName}.${methodName}` : methodName;
|
||||
}
|
||||
|
||||
let filename = lineMatch[2] && lineMatch[2].startsWith('file://') ? lineMatch[2].slice(7) : lineMatch[2];
|
||||
const isNative = lineMatch[5] === 'native';
|
||||
|
||||
// If it's a Windows path, trim the leading slash so that `/C:/foo` becomes `C:/foo`
|
||||
if (filename && filename.match(/\/[A-Z]:/)) {
|
||||
filename = filename.slice(1);
|
||||
}
|
||||
|
||||
if (!filename && lineMatch[5] && !isNative) {
|
||||
filename = lineMatch[5];
|
||||
}
|
||||
|
||||
return {
|
||||
filename,
|
||||
module: getModule ? getModule(filename) : undefined,
|
||||
function: functionName,
|
||||
lineno: parseInt(lineMatch[3], 10) || undefined,
|
||||
colno: parseInt(lineMatch[4], 10) || undefined,
|
||||
in_app: filenameIsInApp(filename, isNative),
|
||||
};
|
||||
}
|
||||
|
||||
if (line.match(FILENAME_MATCH)) {
|
||||
return {
|
||||
filename: line,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
export { filenameIsInApp, node };
|
||||
//# sourceMappingURL=node-stack-trace.js.map
|
||||
1
node_modules/@sentry/utils/esm/node-stack-trace.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/node-stack-trace.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/@sentry/utils/esm/node.js
generated
vendored
Normal file
66
node_modules/@sentry/utils/esm/node.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { isBrowserBundle } from './env.js';
|
||||
|
||||
/**
|
||||
* NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
|
||||
* you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks whether we're in the Node.js or Browser environment
|
||||
*
|
||||
* @returns Answer to given question
|
||||
*/
|
||||
function isNodeEnv() {
|
||||
// explicitly check for browser bundles as those can be optimized statically
|
||||
// by terser/rollup.
|
||||
return (
|
||||
!isBrowserBundle() &&
|
||||
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires a module which is protected against bundler minification.
|
||||
*
|
||||
* @param request The module path to resolve
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
||||
function dynamicRequire(mod, request) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return mod.require(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for dynamically loading module that should work with linked dependencies.
|
||||
* The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))`
|
||||
* However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during
|
||||
* build time. `require.resolve` is also not available in any other way, so we cannot create,
|
||||
* a fake helper like we do with `dynamicRequire`.
|
||||
*
|
||||
* We always prefer to use local package, thus the value is not returned early from each `try/catch` block.
|
||||
* That is to mimic the behavior of `require.resolve` exactly.
|
||||
*
|
||||
* @param moduleName module name to require
|
||||
* @returns possibly required module
|
||||
*/
|
||||
function loadModule(moduleName) {
|
||||
let mod;
|
||||
|
||||
try {
|
||||
mod = dynamicRequire(module, moduleName);
|
||||
} catch (e) {
|
||||
// no-empty
|
||||
}
|
||||
|
||||
try {
|
||||
const { cwd } = dynamicRequire(module, 'process');
|
||||
mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) ;
|
||||
} catch (e) {
|
||||
// no-empty
|
||||
}
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
export { dynamicRequire, isNodeEnv, loadModule };
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
node_modules/@sentry/utils/esm/node.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/node.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node.js","sources":["../../src/node.ts"],"sourcesContent":["/**\n * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,\n * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.\n */\n\nimport { isBrowserBundle } from './env';\n\n/**\n * Checks whether we're in the Node.js or Browser environment\n *\n * @returns Answer to given question\n */\nexport function isNodeEnv(): boolean {\n // explicitly check for browser bundles as those can be optimized statically\n // by terser/rollup.\n return (\n !isBrowserBundle() &&\n Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'\n );\n}\n\n/**\n * Requires a module which is protected against bundler minification.\n *\n * @param request The module path to resolve\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\nexport function dynamicRequire(mod: any, request: string): any {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return mod.require(request);\n}\n\n/**\n * Helper for dynamically loading module that should work with linked dependencies.\n * The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))`\n * However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during\n * build time. `require.resolve` is also not available in any other way, so we cannot create,\n * a fake helper like we do with `dynamicRequire`.\n *\n * We always prefer to use local package, thus the value is not returned early from each `try/catch` block.\n * That is to mimic the behavior of `require.resolve` exactly.\n *\n * @param moduleName module name to require\n * @returns possibly required module\n */\nexport function loadModule<T>(moduleName: string): T | undefined {\n let mod: T | undefined;\n\n try {\n mod = dynamicRequire(module, moduleName);\n } catch (e) {\n // no-empty\n }\n\n try {\n const { cwd } = dynamicRequire(module, 'process');\n mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;\n } catch (e) {\n // no-empty\n }\n\n return mod;\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,GAAY;AACrC;AACA;AACA,EAAE;AACF,IAAI,CAAC,eAAe,EAAG;AACvB,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,OAAA,KAAY,WAAY,GAAE,UAAU,CAAC,MAAM,kBAAA;AACrF,IAAG;AACH,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,GAAG,EAAO,OAAO,EAAe;AAC/D;AACA,EAAE,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAI,UAAU,EAAyB;AACjE,EAAE,IAAI,GAAG,CAAA;AACT;AACA,EAAE,IAAI;AACN,IAAI,MAAM,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAC5C,GAAI,CAAA,OAAO,CAAC,EAAE;AACd;AACA,GAAE;AACF;AACA,EAAE,IAAI;AACN,IAAI,MAAM,EAAE,GAAA,EAAM,GAAE,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACrD,IAAI,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC,EAAA,GAAA,EAAA,CAAA,cAAA,EAAA,UAAA,CAAA,CAAA,CAAA,EAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA;AACA,GAAA;AACA;AACA,EAAA,OAAA,GAAA,CAAA;AACA;;;;"}
|
||||
297
node_modules/@sentry/utils/esm/normalize.js
generated
vendored
Normal file
297
node_modules/@sentry/utils/esm/normalize.js
generated
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
import { isNaN, isVueViewModel, isSyntheticEvent } from './is.js';
|
||||
import { memoBuilder } from './memo.js';
|
||||
import { convertToPlainObject } from './object.js';
|
||||
import { getFunctionName } from './stacktrace.js';
|
||||
|
||||
/**
|
||||
* Recursively normalizes the given object.
|
||||
*
|
||||
* - Creates a copy to prevent original input mutation
|
||||
* - Skips non-enumerable properties
|
||||
* - When stringifying, calls `toJSON` if implemented
|
||||
* - Removes circular references
|
||||
* - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format
|
||||
* - Translates known global objects/classes to a string representations
|
||||
* - Takes care of `Error` object serialization
|
||||
* - Optionally limits depth of final output
|
||||
* - Optionally limits number of properties/elements included in any single object/array
|
||||
*
|
||||
* @param input The object to be normalized.
|
||||
* @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)
|
||||
* @param maxProperties The max number of elements or properties to be included in any single array or
|
||||
* object in the normallized output.
|
||||
* @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function normalize(input, depth = 100, maxProperties = +Infinity) {
|
||||
try {
|
||||
// since we're at the outermost level, we don't provide a key
|
||||
return visit('', input, depth, maxProperties);
|
||||
} catch (err) {
|
||||
return { ERROR: `**non-serializable** (${err})` };
|
||||
}
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function normalizeToSize(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
object,
|
||||
// Default Node.js REPL depth
|
||||
depth = 3,
|
||||
// 100kB, as 200kB is max payload size, so half sounds reasonable
|
||||
maxSize = 100 * 1024,
|
||||
) {
|
||||
const normalized = normalize(object, depth);
|
||||
|
||||
if (jsonSize(normalized) > maxSize) {
|
||||
return normalizeToSize(object, depth - 1, maxSize);
|
||||
}
|
||||
|
||||
return normalized ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a node to perform normalization on it
|
||||
*
|
||||
* @param key The key corresponding to the given node
|
||||
* @param value The node to be visited
|
||||
* @param depth Optional number indicating the maximum recursion depth
|
||||
* @param maxProperties Optional maximum number of properties/elements included in any single object/array
|
||||
* @param memo Optional Memo class handling decycling
|
||||
*/
|
||||
function visit(
|
||||
key,
|
||||
value,
|
||||
depth = +Infinity,
|
||||
maxProperties = +Infinity,
|
||||
memo = memoBuilder(),
|
||||
) {
|
||||
const [memoize, unmemoize] = memo;
|
||||
|
||||
// Get the simple cases out of the way first
|
||||
if (
|
||||
value == null || // this matches null and undefined -> eqeq not eqeqeq
|
||||
(['number', 'boolean', 'string'].includes(typeof value) && !isNaN(value))
|
||||
) {
|
||||
return value ;
|
||||
}
|
||||
|
||||
const stringified = stringifyValue(key, value);
|
||||
|
||||
// Anything we could potentially dig into more (objects or arrays) will have come back as `"[object XXXX]"`.
|
||||
// Everything else will have already been serialized, so if we don't see that pattern, we're done.
|
||||
if (!stringified.startsWith('[object ')) {
|
||||
return stringified;
|
||||
}
|
||||
|
||||
// From here on, we can assert that `value` is either an object or an array.
|
||||
|
||||
// Do not normalize objects that we know have already been normalized. As a general rule, the
|
||||
// "__sentry_skip_normalization__" property should only be used sparingly and only should only be set on objects that
|
||||
// have already been normalized.
|
||||
if ((value )['__sentry_skip_normalization__']) {
|
||||
return value ;
|
||||
}
|
||||
|
||||
// We can set `__sentry_override_normalization_depth__` on an object to ensure that from there
|
||||
// We keep a certain amount of depth.
|
||||
// This should be used sparingly, e.g. we use it for the redux integration to ensure we get a certain amount of state.
|
||||
const remainingDepth =
|
||||
typeof (value )['__sentry_override_normalization_depth__'] === 'number'
|
||||
? ((value )['__sentry_override_normalization_depth__'] )
|
||||
: depth;
|
||||
|
||||
// We're also done if we've reached the max depth
|
||||
if (remainingDepth === 0) {
|
||||
// At this point we know `serialized` is a string of the form `"[object XXXX]"`. Clean it up so it's just `"[XXXX]"`.
|
||||
return stringified.replace('object ', '');
|
||||
}
|
||||
|
||||
// If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.
|
||||
if (memoize(value)) {
|
||||
return '[Circular ~]';
|
||||
}
|
||||
|
||||
// If the value has a `toJSON` method, we call it to extract more information
|
||||
const valueWithToJSON = value ;
|
||||
if (valueWithToJSON && typeof valueWithToJSON.toJSON === 'function') {
|
||||
try {
|
||||
const jsonValue = valueWithToJSON.toJSON();
|
||||
// We need to normalize the return value of `.toJSON()` in case it has circular references
|
||||
return visit('', jsonValue, remainingDepth - 1, maxProperties, memo);
|
||||
} catch (err) {
|
||||
// pass (The built-in `toJSON` failed, but we can still try to do it ourselves)
|
||||
}
|
||||
}
|
||||
|
||||
// At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse
|
||||
// because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each
|
||||
// property/entry, and keep track of the number of items we add to it.
|
||||
const normalized = (Array.isArray(value) ? [] : {}) ;
|
||||
let numAdded = 0;
|
||||
|
||||
// Before we begin, convert`Error` and`Event` instances into plain objects, since some of each of their relevant
|
||||
// properties are non-enumerable and otherwise would get missed.
|
||||
const visitable = convertToPlainObject(value );
|
||||
|
||||
for (const visitKey in visitable) {
|
||||
// Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
|
||||
if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (numAdded >= maxProperties) {
|
||||
normalized[visitKey] = '[MaxProperties ~]';
|
||||
break;
|
||||
}
|
||||
|
||||
// Recursively visit all the child nodes
|
||||
const visitValue = visitable[visitKey];
|
||||
normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo);
|
||||
|
||||
numAdded++;
|
||||
}
|
||||
|
||||
// Once we've visited all the branches, remove the parent from memo storage
|
||||
unmemoize(value);
|
||||
|
||||
// Return accumulated values
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/* eslint-disable complexity */
|
||||
/**
|
||||
* Stringify the given value. Handles various known special values and types.
|
||||
*
|
||||
* Not meant to be used on simple primitives which already have a string representation, as it will, for example, turn
|
||||
* the number 1231 into "[Object Number]", nor on `null`, as it will throw.
|
||||
*
|
||||
* @param value The value to stringify
|
||||
* @returns A stringified representation of the given value
|
||||
*/
|
||||
function stringifyValue(
|
||||
key,
|
||||
// this type is a tiny bit of a cheat, since this function does handle NaN (which is technically a number), but for
|
||||
// our internal use, it'll do
|
||||
value,
|
||||
) {
|
||||
try {
|
||||
if (key === 'domain' && value && typeof value === 'object' && (value )._events) {
|
||||
return '[Domain]';
|
||||
}
|
||||
|
||||
if (key === 'domainEmitter') {
|
||||
return '[DomainEmitter]';
|
||||
}
|
||||
|
||||
// It's safe to use `global`, `window`, and `document` here in this manner, as we are asserting using `typeof` first
|
||||
// which won't throw if they are not present.
|
||||
|
||||
if (typeof global !== 'undefined' && value === global) {
|
||||
return '[Global]';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof window !== 'undefined' && value === window) {
|
||||
return '[Window]';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof document !== 'undefined' && value === document) {
|
||||
return '[Document]';
|
||||
}
|
||||
|
||||
if (isVueViewModel(value)) {
|
||||
return '[VueViewModel]';
|
||||
}
|
||||
|
||||
// React's SyntheticEvent thingy
|
||||
if (isSyntheticEvent(value)) {
|
||||
return '[SyntheticEvent]';
|
||||
}
|
||||
|
||||
if (typeof value === 'number' && value !== value) {
|
||||
return '[NaN]';
|
||||
}
|
||||
|
||||
if (typeof value === 'function') {
|
||||
return `[Function: ${getFunctionName(value)}]`;
|
||||
}
|
||||
|
||||
if (typeof value === 'symbol') {
|
||||
return `[${String(value)}]`;
|
||||
}
|
||||
|
||||
// stringified BigInts are indistinguishable from regular numbers, so we need to label them to avoid confusion
|
||||
if (typeof value === 'bigint') {
|
||||
return `[BigInt: ${String(value)}]`;
|
||||
}
|
||||
|
||||
// Now that we've knocked out all the special cases and the primitives, all we have left are objects. Simply casting
|
||||
// them to strings means that instances of classes which haven't defined their `toStringTag` will just come out as
|
||||
// `"[object Object]"`. If we instead look at the constructor's name (which is the same as the name of the class),
|
||||
// we can make sure that only plain objects come out that way.
|
||||
const objName = getConstructorName(value);
|
||||
|
||||
// Handle HTML Elements
|
||||
if (/^HTML(\w*)Element$/.test(objName)) {
|
||||
return `[HTMLElement: ${objName}]`;
|
||||
}
|
||||
|
||||
return `[object ${objName}]`;
|
||||
} catch (err) {
|
||||
return `**non-serializable** (${err})`;
|
||||
}
|
||||
}
|
||||
/* eslint-enable complexity */
|
||||
|
||||
function getConstructorName(value) {
|
||||
const prototype = Object.getPrototypeOf(value);
|
||||
|
||||
return prototype ? prototype.constructor.name : 'null prototype';
|
||||
}
|
||||
|
||||
/** Calculates bytes size of input string */
|
||||
function utf8Length(value) {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
return ~-encodeURI(value).split(/%..|./).length;
|
||||
}
|
||||
|
||||
/** Calculates bytes size of input object */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function jsonSize(value) {
|
||||
return utf8Length(JSON.stringify(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes URLs in exceptions and stacktraces to a base path so Sentry can fingerprint
|
||||
* across platforms and working directory.
|
||||
*
|
||||
* @param url The URL to be normalized.
|
||||
* @param basePath The application base path.
|
||||
* @returns The normalized URL.
|
||||
*/
|
||||
function normalizeUrlToBase(url, basePath) {
|
||||
const escapedBase = basePath
|
||||
// Backslash to forward
|
||||
.replace(/\\/g, '/')
|
||||
// Escape RegExp special characters
|
||||
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
|
||||
|
||||
let newUrl = url;
|
||||
try {
|
||||
newUrl = decodeURI(url);
|
||||
} catch (_Oo) {
|
||||
// Sometime this breaks
|
||||
}
|
||||
return (
|
||||
newUrl
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/webpack:\/?/g, '') // Remove intermediate base path
|
||||
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
|
||||
.replace(new RegExp(`(file://)?/*${escapedBase}/*`, 'ig'), 'app:///')
|
||||
);
|
||||
}
|
||||
|
||||
export { normalize, normalizeToSize, normalizeUrlToBase, visit as walk };
|
||||
//# sourceMappingURL=normalize.js.map
|
||||
1
node_modules/@sentry/utils/esm/normalize.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/normalize.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
297
node_modules/@sentry/utils/esm/object.js
generated
vendored
Normal file
297
node_modules/@sentry/utils/esm/object.js
generated
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
import { htmlTreeAsString } from './browser.js';
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { isError, isEvent, isInstanceOf, isElement, isPlainObject, isPrimitive } from './is.js';
|
||||
import { logger } from './logger.js';
|
||||
import { truncate } from './string.js';
|
||||
|
||||
/**
|
||||
* Replace a method in an object with a wrapped version of itself.
|
||||
*
|
||||
* @param source An object that contains a method to be wrapped.
|
||||
* @param name The name of the method to be wrapped.
|
||||
* @param replacementFactory A higher-order function that takes the original version of the given method and returns a
|
||||
* wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to
|
||||
* preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other
|
||||
* args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.
|
||||
* @returns void
|
||||
*/
|
||||
function fill(source, name, replacementFactory) {
|
||||
if (!(name in source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const original = source[name] ;
|
||||
const wrapped = replacementFactory(original) ;
|
||||
|
||||
// Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
|
||||
// otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
|
||||
if (typeof wrapped === 'function') {
|
||||
markFunctionWrapped(wrapped, original);
|
||||
}
|
||||
|
||||
source[name] = wrapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a non-enumerable property on the given object.
|
||||
*
|
||||
* @param obj The object on which to set the property
|
||||
* @param name The name of the property to be set
|
||||
* @param value The value to which to set the property
|
||||
*/
|
||||
function addNonEnumerableProperty(obj, name, value) {
|
||||
try {
|
||||
Object.defineProperty(obj, name, {
|
||||
// enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
|
||||
value: value,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
} catch (o_O) {
|
||||
DEBUG_BUILD && logger.log(`Failed to add non-enumerable property "${name}" to object`, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remembers the original function on the wrapped function and
|
||||
* patches up the prototype.
|
||||
*
|
||||
* @param wrapped the wrapper function
|
||||
* @param original the original function that gets wrapped
|
||||
*/
|
||||
function markFunctionWrapped(wrapped, original) {
|
||||
try {
|
||||
const proto = original.prototype || {};
|
||||
wrapped.prototype = original.prototype = proto;
|
||||
addNonEnumerableProperty(wrapped, '__sentry_original__', original);
|
||||
} catch (o_O) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
/**
|
||||
* This extracts the original function if available. See
|
||||
* `markFunctionWrapped` for more information.
|
||||
*
|
||||
* @param func the function to unwrap
|
||||
* @returns the unwrapped version of the function if available.
|
||||
*/
|
||||
function getOriginalFunction(func) {
|
||||
return func.__sentry_original__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes given object into url-friendly format
|
||||
*
|
||||
* @param object An object that contains serializable values
|
||||
* @returns string Encoded
|
||||
*/
|
||||
function urlEncode(object) {
|
||||
return Object.keys(object)
|
||||
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)
|
||||
.join('&');
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their
|
||||
* non-enumerable properties attached.
|
||||
*
|
||||
* @param value Initial source that we have to transform in order for it to be usable by the serializer
|
||||
* @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor
|
||||
* an Error.
|
||||
*/
|
||||
function convertToPlainObject(
|
||||
value,
|
||||
)
|
||||
|
||||
{
|
||||
if (isError(value)) {
|
||||
return {
|
||||
message: value.message,
|
||||
name: value.name,
|
||||
stack: value.stack,
|
||||
...getOwnProperties(value),
|
||||
};
|
||||
} else if (isEvent(value)) {
|
||||
const newObj
|
||||
|
||||
= {
|
||||
type: value.type,
|
||||
target: serializeEventTarget(value.target),
|
||||
currentTarget: serializeEventTarget(value.currentTarget),
|
||||
...getOwnProperties(value),
|
||||
};
|
||||
|
||||
if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {
|
||||
newObj.detail = value.detail;
|
||||
}
|
||||
|
||||
return newObj;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a string representation of the target of an `Event` object */
|
||||
function serializeEventTarget(target) {
|
||||
try {
|
||||
return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);
|
||||
} catch (_oO) {
|
||||
return '<unknown>';
|
||||
}
|
||||
}
|
||||
|
||||
/** Filters out all but an object's own properties */
|
||||
function getOwnProperties(obj) {
|
||||
if (typeof obj === 'object' && obj !== null) {
|
||||
const extractedProps = {};
|
||||
for (const property in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, property)) {
|
||||
extractedProps[property] = (obj )[property];
|
||||
}
|
||||
}
|
||||
return extractedProps;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given any captured exception, extract its keys and create a sorted
|
||||
* and truncated list that will be used inside the event message.
|
||||
* eg. `Non-error exception captured with keys: foo, bar, baz`
|
||||
*/
|
||||
function extractExceptionKeysForMessage(exception, maxLength = 40) {
|
||||
const keys = Object.keys(convertToPlainObject(exception));
|
||||
keys.sort();
|
||||
|
||||
if (!keys.length) {
|
||||
return '[object has no keys]';
|
||||
}
|
||||
|
||||
if (keys[0].length >= maxLength) {
|
||||
return truncate(keys[0], maxLength);
|
||||
}
|
||||
|
||||
for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {
|
||||
const serialized = keys.slice(0, includedKeys).join(', ');
|
||||
if (serialized.length > maxLength) {
|
||||
continue;
|
||||
}
|
||||
if (includedKeys === keys.length) {
|
||||
return serialized;
|
||||
}
|
||||
return truncate(serialized, maxLength);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Given any object, return a new object having removed all fields whose value was `undefined`.
|
||||
* Works recursively on objects and arrays.
|
||||
*
|
||||
* Attention: This function keeps circular references in the returned object.
|
||||
*/
|
||||
function dropUndefinedKeys(inputValue) {
|
||||
// This map keeps track of what already visited nodes map to.
|
||||
// Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular
|
||||
// references as the input object.
|
||||
const memoizationMap = new Map();
|
||||
|
||||
// This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API
|
||||
return _dropUndefinedKeys(inputValue, memoizationMap);
|
||||
}
|
||||
|
||||
function _dropUndefinedKeys(inputValue, memoizationMap) {
|
||||
if (isPojo(inputValue)) {
|
||||
// If this node has already been visited due to a circular reference, return the object it was mapped to in the new object
|
||||
const memoVal = memoizationMap.get(inputValue);
|
||||
if (memoVal !== undefined) {
|
||||
return memoVal ;
|
||||
}
|
||||
|
||||
const returnValue = {};
|
||||
// Store the mapping of this value in case we visit it again, in case of circular data
|
||||
memoizationMap.set(inputValue, returnValue);
|
||||
|
||||
for (const key of Object.keys(inputValue)) {
|
||||
if (typeof inputValue[key] !== 'undefined') {
|
||||
returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue ;
|
||||
}
|
||||
|
||||
if (Array.isArray(inputValue)) {
|
||||
// If this node has already been visited due to a circular reference, return the array it was mapped to in the new object
|
||||
const memoVal = memoizationMap.get(inputValue);
|
||||
if (memoVal !== undefined) {
|
||||
return memoVal ;
|
||||
}
|
||||
|
||||
const returnValue = [];
|
||||
// Store the mapping of this value in case we visit it again, in case of circular data
|
||||
memoizationMap.set(inputValue, returnValue);
|
||||
|
||||
inputValue.forEach((item) => {
|
||||
returnValue.push(_dropUndefinedKeys(item, memoizationMap));
|
||||
});
|
||||
|
||||
return returnValue ;
|
||||
}
|
||||
|
||||
return inputValue;
|
||||
}
|
||||
|
||||
function isPojo(input) {
|
||||
if (!isPlainObject(input)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const name = (Object.getPrototypeOf(input) ).constructor.name;
|
||||
return !name || name === 'Object';
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that something is an object.
|
||||
*
|
||||
* Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper
|
||||
* classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.
|
||||
*
|
||||
* @param wat The subject of the objectification
|
||||
* @returns A version of `wat` which can safely be used with `Object` class methods
|
||||
*/
|
||||
function objectify(wat) {
|
||||
let objectified;
|
||||
switch (true) {
|
||||
case wat === undefined || wat === null:
|
||||
objectified = new String(wat);
|
||||
break;
|
||||
|
||||
// Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason
|
||||
// those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as
|
||||
// an object in order to wrap it.
|
||||
case typeof wat === 'symbol' || typeof wat === 'bigint':
|
||||
objectified = Object(wat);
|
||||
break;
|
||||
|
||||
// this will catch the remaining primitives: `String`, `Number`, and `Boolean`
|
||||
case isPrimitive(wat):
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
objectified = new (wat ).constructor(wat);
|
||||
break;
|
||||
|
||||
// by process of elimination, at this point we know that `wat` must already be an object
|
||||
default:
|
||||
objectified = wat;
|
||||
break;
|
||||
}
|
||||
return objectified;
|
||||
}
|
||||
|
||||
export { addNonEnumerableProperty, convertToPlainObject, dropUndefinedKeys, extractExceptionKeysForMessage, fill, getOriginalFunction, markFunctionWrapped, objectify, urlEncode };
|
||||
//# sourceMappingURL=object.js.map
|
||||
1
node_modules/@sentry/utils/esm/object.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/object.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
212
node_modules/@sentry/utils/esm/path.js
generated
vendored
Normal file
212
node_modules/@sentry/utils/esm/path.js
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
// Slightly modified (no IE8 support, ES6) and transcribed to TypeScript
|
||||
// https://github.com/calvinmetcalf/rollup-plugin-node-builtins/blob/63ab8aacd013767445ca299e468d9a60a95328d7/src/es6/path.js
|
||||
//
|
||||
// Copyright Joyent, Inc.and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
/** JSDoc */
|
||||
function normalizeArray(parts, allowAboveRoot) {
|
||||
// if the path tries to go above the root, `up` ends up > 0
|
||||
let up = 0;
|
||||
for (let i = parts.length - 1; i >= 0; i--) {
|
||||
const last = parts[i];
|
||||
if (last === '.') {
|
||||
parts.splice(i, 1);
|
||||
} else if (last === '..') {
|
||||
parts.splice(i, 1);
|
||||
up++;
|
||||
} else if (up) {
|
||||
parts.splice(i, 1);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
|
||||
// if the path is allowed to go above the root, restore leading ..s
|
||||
if (allowAboveRoot) {
|
||||
for (; up--; up) {
|
||||
parts.unshift('..');
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
// Split a filename into [root, dir, basename, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
const splitPathRe = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;
|
||||
/** JSDoc */
|
||||
function splitPath(filename) {
|
||||
// Truncate files names greater than 1024 characters to avoid regex dos
|
||||
// https://github.com/getsentry/sentry-javascript/pull/8737#discussion_r1285719172
|
||||
const truncated = filename.length > 1024 ? `<truncated>${filename.slice(-1024)}` : filename;
|
||||
const parts = splitPathRe.exec(truncated);
|
||||
return parts ? parts.slice(1) : [];
|
||||
}
|
||||
|
||||
// path.resolve([from ...], to)
|
||||
// posix version
|
||||
/** JSDoc */
|
||||
function resolve(...args) {
|
||||
let resolvedPath = '';
|
||||
let resolvedAbsolute = false;
|
||||
|
||||
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
||||
const path = i >= 0 ? args[i] : '/';
|
||||
|
||||
// Skip empty entries
|
||||
if (!path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
resolvedPath = `${path}/${resolvedPath}`;
|
||||
resolvedAbsolute = path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
// At this point the path should be resolved to a full absolute path, but
|
||||
// handle relative paths to be safe (might happen when process.cwd() fails)
|
||||
|
||||
// Normalize the path
|
||||
resolvedPath = normalizeArray(
|
||||
resolvedPath.split('/').filter(p => !!p),
|
||||
!resolvedAbsolute,
|
||||
).join('/');
|
||||
|
||||
return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function trim(arr) {
|
||||
let start = 0;
|
||||
for (; start < arr.length; start++) {
|
||||
if (arr[start] !== '') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let end = arr.length - 1;
|
||||
for (; end >= 0; end--) {
|
||||
if (arr[end] !== '') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (start > end) {
|
||||
return [];
|
||||
}
|
||||
return arr.slice(start, end - start + 1);
|
||||
}
|
||||
|
||||
// path.relative(from, to)
|
||||
// posix version
|
||||
/** JSDoc */
|
||||
function relative(from, to) {
|
||||
/* eslint-disable no-param-reassign */
|
||||
from = resolve(from).slice(1);
|
||||
to = resolve(to).slice(1);
|
||||
/* eslint-enable no-param-reassign */
|
||||
|
||||
const fromParts = trim(from.split('/'));
|
||||
const toParts = trim(to.split('/'));
|
||||
|
||||
const length = Math.min(fromParts.length, toParts.length);
|
||||
let samePartsLength = length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (fromParts[i] !== toParts[i]) {
|
||||
samePartsLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let outputParts = [];
|
||||
for (let i = samePartsLength; i < fromParts.length; i++) {
|
||||
outputParts.push('..');
|
||||
}
|
||||
|
||||
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||
|
||||
return outputParts.join('/');
|
||||
}
|
||||
|
||||
// path.normalize(path)
|
||||
// posix version
|
||||
/** JSDoc */
|
||||
function normalizePath(path) {
|
||||
const isPathAbsolute = isAbsolute(path);
|
||||
const trailingSlash = path.slice(-1) === '/';
|
||||
|
||||
// Normalize the path
|
||||
let normalizedPath = normalizeArray(
|
||||
path.split('/').filter(p => !!p),
|
||||
!isPathAbsolute,
|
||||
).join('/');
|
||||
|
||||
if (!normalizedPath && !isPathAbsolute) {
|
||||
normalizedPath = '.';
|
||||
}
|
||||
if (normalizedPath && trailingSlash) {
|
||||
normalizedPath += '/';
|
||||
}
|
||||
|
||||
return (isPathAbsolute ? '/' : '') + normalizedPath;
|
||||
}
|
||||
|
||||
// posix version
|
||||
/** JSDoc */
|
||||
function isAbsolute(path) {
|
||||
return path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
// posix version
|
||||
/** JSDoc */
|
||||
function join(...args) {
|
||||
return normalizePath(args.join('/'));
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function dirname(path) {
|
||||
const result = splitPath(path);
|
||||
const root = result[0];
|
||||
let dir = result[1];
|
||||
|
||||
if (!root && !dir) {
|
||||
// No dirname whatsoever
|
||||
return '.';
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
// It has a dirname, strip trailing slash
|
||||
dir = dir.slice(0, dir.length - 1);
|
||||
}
|
||||
|
||||
return root + dir;
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function basename(path, ext) {
|
||||
let f = splitPath(path)[2];
|
||||
if (ext && f.slice(ext.length * -1) === ext) {
|
||||
f = f.slice(0, f.length - ext.length);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve };
|
||||
//# sourceMappingURL=path.js.map
|
||||
1
node_modules/@sentry/utils/esm/path.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/path.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
102
node_modules/@sentry/utils/esm/promisebuffer.js
generated
vendored
Normal file
102
node_modules/@sentry/utils/esm/promisebuffer.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import { SentryError } from './error.js';
|
||||
import { rejectedSyncPromise, SyncPromise, resolvedSyncPromise } from './syncpromise.js';
|
||||
|
||||
/**
|
||||
* Creates an new PromiseBuffer object with the specified limit
|
||||
* @param limit max number of promises that can be stored in the buffer
|
||||
*/
|
||||
function makePromiseBuffer(limit) {
|
||||
const buffer = [];
|
||||
|
||||
function isReady() {
|
||||
return limit === undefined || buffer.length < limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a promise from the queue.
|
||||
*
|
||||
* @param task Can be any PromiseLike<T>
|
||||
* @returns Removed promise.
|
||||
*/
|
||||
function remove(task) {
|
||||
return buffer.splice(buffer.indexOf(task), 1)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a promise (representing an in-flight action) to the queue, and set it to remove itself on fulfillment.
|
||||
*
|
||||
* @param taskProducer A function producing any PromiseLike<T>; In previous versions this used to be `task:
|
||||
* PromiseLike<T>`, but under that model, Promises were instantly created on the call-site and their executor
|
||||
* functions therefore ran immediately. Thus, even if the buffer was full, the action still happened. By
|
||||
* requiring the promise to be wrapped in a function, we can defer promise creation until after the buffer
|
||||
* limit check.
|
||||
* @returns The original promise.
|
||||
*/
|
||||
function add(taskProducer) {
|
||||
if (!isReady()) {
|
||||
return rejectedSyncPromise(new SentryError('Not adding Promise because buffer limit was reached.'));
|
||||
}
|
||||
|
||||
// start the task and add its promise to the queue
|
||||
const task = taskProducer();
|
||||
if (buffer.indexOf(task) === -1) {
|
||||
buffer.push(task);
|
||||
}
|
||||
void task
|
||||
.then(() => remove(task))
|
||||
// Use `then(null, rejectionHandler)` rather than `catch(rejectionHandler)` so that we can use `PromiseLike`
|
||||
// rather than `Promise`. `PromiseLike` doesn't have a `.catch` method, making its polyfill smaller. (ES5 didn't
|
||||
// have promises, so TS has to polyfill when down-compiling.)
|
||||
.then(null, () =>
|
||||
remove(task).then(null, () => {
|
||||
// We have to add another catch here because `remove()` starts a new promise chain.
|
||||
}),
|
||||
);
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for all promises in the queue to resolve or for timeout to expire, whichever comes first.
|
||||
*
|
||||
* @param timeout The time, in ms, after which to resolve to `false` if the queue is still non-empty. Passing `0` (or
|
||||
* not passing anything) will make the promise wait as long as it takes for the queue to drain before resolving to
|
||||
* `true`.
|
||||
* @returns A promise which will resolve to `true` if the queue is already empty or drains before the timeout, and
|
||||
* `false` otherwise
|
||||
*/
|
||||
function drain(timeout) {
|
||||
return new SyncPromise((resolve, reject) => {
|
||||
let counter = buffer.length;
|
||||
|
||||
if (!counter) {
|
||||
return resolve(true);
|
||||
}
|
||||
|
||||
// wait for `timeout` ms and then resolve to `false` (if not cancelled first)
|
||||
const capturedSetTimeout = setTimeout(() => {
|
||||
if (timeout && timeout > 0) {
|
||||
resolve(false);
|
||||
}
|
||||
}, timeout);
|
||||
|
||||
// if all promises resolve in time, cancel the timer and resolve to `true`
|
||||
buffer.forEach(item => {
|
||||
void resolvedSyncPromise(item).then(() => {
|
||||
if (!--counter) {
|
||||
clearTimeout(capturedSetTimeout);
|
||||
resolve(true);
|
||||
}
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
$: buffer,
|
||||
add,
|
||||
drain,
|
||||
};
|
||||
}
|
||||
|
||||
export { makePromiseBuffer };
|
||||
//# sourceMappingURL=promisebuffer.js.map
|
||||
1
node_modules/@sentry/utils/esm/promisebuffer.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/promisebuffer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
106
node_modules/@sentry/utils/esm/ratelimit.js
generated
vendored
Normal file
106
node_modules/@sentry/utils/esm/ratelimit.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// Intentionally keeping the key broad, as we don't know for sure what rate limit headers get returned from backend
|
||||
|
||||
const DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds
|
||||
|
||||
/**
|
||||
* Extracts Retry-After value from the request header or returns default value
|
||||
* @param header string representation of 'Retry-After' header
|
||||
* @param now current unix timestamp
|
||||
*
|
||||
*/
|
||||
function parseRetryAfterHeader(header, now = Date.now()) {
|
||||
const headerDelay = parseInt(`${header}`, 10);
|
||||
if (!isNaN(headerDelay)) {
|
||||
return headerDelay * 1000;
|
||||
}
|
||||
|
||||
const headerDate = Date.parse(`${header}`);
|
||||
if (!isNaN(headerDate)) {
|
||||
return headerDate - now;
|
||||
}
|
||||
|
||||
return DEFAULT_RETRY_AFTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time that the given category is disabled until for rate limiting.
|
||||
* In case no category-specific limit is set but a general rate limit across all categories is active,
|
||||
* that time is returned.
|
||||
*
|
||||
* @return the time in ms that the category is disabled until or 0 if there's no active rate limit.
|
||||
*/
|
||||
function disabledUntil(limits, dataCategory) {
|
||||
return limits[dataCategory] || limits.all || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a category is rate limited
|
||||
*/
|
||||
function isRateLimited(limits, dataCategory, now = Date.now()) {
|
||||
return disabledUntil(limits, dataCategory) > now;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update ratelimits from incoming headers.
|
||||
*
|
||||
* @return the updated RateLimits object.
|
||||
*/
|
||||
function updateRateLimits(
|
||||
limits,
|
||||
{ statusCode, headers },
|
||||
now = Date.now(),
|
||||
) {
|
||||
const updatedRateLimits = {
|
||||
...limits,
|
||||
};
|
||||
|
||||
// "The name is case-insensitive."
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Headers/get
|
||||
const rateLimitHeader = headers && headers['x-sentry-rate-limits'];
|
||||
const retryAfterHeader = headers && headers['retry-after'];
|
||||
|
||||
if (rateLimitHeader) {
|
||||
/**
|
||||
* rate limit headers are of the form
|
||||
* <header>,<header>,..
|
||||
* where each <header> is of the form
|
||||
* <retry_after>: <categories>: <scope>: <reason_code>: <namespaces>
|
||||
* where
|
||||
* <retry_after> is a delay in seconds
|
||||
* <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form
|
||||
* <category>;<category>;...
|
||||
* <scope> is what's being limited (org, project, or key) - ignored by SDK
|
||||
* <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
|
||||
* <namespaces> Semicolon-separated list of metric namespace identifiers. Defines which namespace(s) will be affected.
|
||||
* Only present if rate limit applies to the metric_bucket data category.
|
||||
*/
|
||||
for (const limit of rateLimitHeader.trim().split(',')) {
|
||||
const [retryAfter, categories, , , namespaces] = limit.split(':', 5);
|
||||
const headerDelay = parseInt(retryAfter, 10);
|
||||
const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
|
||||
if (!categories) {
|
||||
updatedRateLimits.all = now + delay;
|
||||
} else {
|
||||
for (const category of categories.split(';')) {
|
||||
if (category === 'metric_bucket') {
|
||||
// namespaces will be present when category === 'metric_bucket'
|
||||
if (!namespaces || namespaces.split(';').includes('custom')) {
|
||||
updatedRateLimits[category] = now + delay;
|
||||
}
|
||||
} else {
|
||||
updatedRateLimits[category] = now + delay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (retryAfterHeader) {
|
||||
updatedRateLimits.all = now + parseRetryAfterHeader(retryAfterHeader, now);
|
||||
} else if (statusCode === 429) {
|
||||
updatedRateLimits.all = now + 60 * 1000;
|
||||
}
|
||||
|
||||
return updatedRateLimits;
|
||||
}
|
||||
|
||||
export { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits };
|
||||
//# sourceMappingURL=ratelimit.js.map
|
||||
1
node_modules/@sentry/utils/esm/ratelimit.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/ratelimit.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
371
node_modules/@sentry/utils/esm/requestdata.js
generated
vendored
Normal file
371
node_modules/@sentry/utils/esm/requestdata.js
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
import { parseCookie } from './cookie.js';
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { isString, isPlainObject } from './is.js';
|
||||
import { logger } from './logger.js';
|
||||
import { normalize } from './normalize.js';
|
||||
import { stripUrlQueryAndFragment } from './url.js';
|
||||
|
||||
const DEFAULT_INCLUDES = {
|
||||
ip: false,
|
||||
request: true,
|
||||
transaction: true,
|
||||
user: true,
|
||||
};
|
||||
const DEFAULT_REQUEST_INCLUDES = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];
|
||||
const DEFAULT_USER_INCLUDES = ['id', 'username', 'email'];
|
||||
|
||||
/**
|
||||
* Sets parameterized route as transaction name e.g.: `GET /users/:id`
|
||||
* Also adds more context data on the transaction from the request.
|
||||
*
|
||||
* @deprecated This utility will be removed in v8.
|
||||
*/
|
||||
function addRequestDataToTransaction(
|
||||
transaction,
|
||||
req,
|
||||
deps,
|
||||
) {
|
||||
if (!transaction) return;
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
if (!transaction.metadata.source || transaction.metadata.source === 'url') {
|
||||
// Attempt to grab a parameterized route off of the request
|
||||
const [name, source] = extractPathForTransaction(req, { path: true, method: true });
|
||||
transaction.updateName(name);
|
||||
// TODO: SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
transaction.setMetadata({ source });
|
||||
}
|
||||
transaction.setAttribute('url', req.originalUrl || req.url);
|
||||
if (req.baseUrl) {
|
||||
transaction.setAttribute('baseUrl', req.baseUrl);
|
||||
}
|
||||
// TODO: We need to rewrite this to a flat format?
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
transaction.setData('query', extractQueryParams(req, deps));
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a complete and parameterized path from the request object and uses it to construct transaction name.
|
||||
* If the parameterized transaction name cannot be extracted, we fall back to the raw URL.
|
||||
*
|
||||
* Additionally, this function determines and returns the transaction name source
|
||||
*
|
||||
* eg. GET /mountpoint/user/:id
|
||||
*
|
||||
* @param req A request object
|
||||
* @param options What to include in the transaction name (method, path, or a custom route name to be
|
||||
* used instead of the request's route)
|
||||
*
|
||||
* @returns A tuple of the fully constructed transaction name [0] and its source [1] (can be either 'route' or 'url')
|
||||
*/
|
||||
function extractPathForTransaction(
|
||||
req,
|
||||
options = {},
|
||||
) {
|
||||
const method = req.method && req.method.toUpperCase();
|
||||
|
||||
let path = '';
|
||||
let source = 'url';
|
||||
|
||||
// Check to see if there's a parameterized route we can use (as there is in Express)
|
||||
if (options.customRoute || req.route) {
|
||||
path = options.customRoute || `${req.baseUrl || ''}${req.route && req.route.path}`;
|
||||
source = 'route';
|
||||
}
|
||||
|
||||
// Otherwise, just take the original URL
|
||||
else if (req.originalUrl || req.url) {
|
||||
path = stripUrlQueryAndFragment(req.originalUrl || req.url || '');
|
||||
}
|
||||
|
||||
let name = '';
|
||||
if (options.method && method) {
|
||||
name += method;
|
||||
}
|
||||
if (options.method && options.path) {
|
||||
name += ' ';
|
||||
}
|
||||
if (options.path && path) {
|
||||
name += path;
|
||||
}
|
||||
|
||||
return [name, source];
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function extractTransaction(req, type) {
|
||||
switch (type) {
|
||||
case 'path': {
|
||||
return extractPathForTransaction(req, { path: true })[0];
|
||||
}
|
||||
case 'handler': {
|
||||
return (req.route && req.route.stack && req.route.stack[0] && req.route.stack[0].name) || '<anonymous>';
|
||||
}
|
||||
case 'methodPath':
|
||||
default: {
|
||||
// if exist _reconstructedRoute return that path instead of route.path
|
||||
const customRoute = req._reconstructedRoute ? req._reconstructedRoute : undefined;
|
||||
return extractPathForTransaction(req, { path: true, method: true, customRoute })[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
function extractUserData(
|
||||
user
|
||||
|
||||
,
|
||||
keys,
|
||||
) {
|
||||
const extractedUser = {};
|
||||
const attributes = Array.isArray(keys) ? keys : DEFAULT_USER_INCLUDES;
|
||||
|
||||
attributes.forEach(key => {
|
||||
if (user && key in user) {
|
||||
extractedUser[key] = user[key];
|
||||
}
|
||||
});
|
||||
|
||||
return extractedUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize data from the request object, accounting for framework differences.
|
||||
*
|
||||
* @param req The request object from which to extract data
|
||||
* @param options.include An optional array of keys to include in the normalized data. Defaults to
|
||||
* DEFAULT_REQUEST_INCLUDES if not provided.
|
||||
* @param options.deps Injected, platform-specific dependencies
|
||||
* @returns An object containing normalized request data
|
||||
*/
|
||||
function extractRequestData(
|
||||
req,
|
||||
options
|
||||
|
||||
,
|
||||
) {
|
||||
const { include = DEFAULT_REQUEST_INCLUDES, deps } = options || {};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const requestData = {};
|
||||
|
||||
// headers:
|
||||
// node, express, koa, nextjs: req.headers
|
||||
const headers = (req.headers || {})
|
||||
|
||||
;
|
||||
// method:
|
||||
// node, express, koa, nextjs: req.method
|
||||
const method = req.method;
|
||||
// host:
|
||||
// express: req.hostname in > 4 and req.host in < 4
|
||||
// koa: req.host
|
||||
// node, nextjs: req.headers.host
|
||||
// Express 4 mistakenly strips off port number from req.host / req.hostname so we can't rely on them
|
||||
// See: https://github.com/expressjs/express/issues/3047#issuecomment-236653223
|
||||
// Also: https://github.com/getsentry/sentry-javascript/issues/1917
|
||||
const host = headers.host || req.hostname || req.host || '<no host>';
|
||||
// protocol:
|
||||
// node, nextjs: <n/a>
|
||||
// express, koa: req.protocol
|
||||
const protocol = req.protocol === 'https' || (req.socket && req.socket.encrypted) ? 'https' : 'http';
|
||||
// url (including path and query string):
|
||||
// node, express: req.originalUrl
|
||||
// koa, nextjs: req.url
|
||||
const originalUrl = req.originalUrl || req.url || '';
|
||||
// absolute url
|
||||
const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`;
|
||||
include.forEach(key => {
|
||||
switch (key) {
|
||||
case 'headers': {
|
||||
requestData.headers = headers;
|
||||
|
||||
// Remove the Cookie header in case cookie data should not be included in the event
|
||||
if (!include.includes('cookies')) {
|
||||
delete (requestData.headers ).cookie;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 'method': {
|
||||
requestData.method = method;
|
||||
break;
|
||||
}
|
||||
case 'url': {
|
||||
requestData.url = absoluteUrl;
|
||||
break;
|
||||
}
|
||||
case 'cookies': {
|
||||
// cookies:
|
||||
// node, express, koa: req.headers.cookie
|
||||
// vercel, sails.js, express (w/ cookie middleware), nextjs: req.cookies
|
||||
requestData.cookies =
|
||||
// TODO (v8 / #5257): We're only sending the empty object for backwards compatibility, so the last bit can
|
||||
// come off in v8
|
||||
req.cookies || (headers.cookie && parseCookie(headers.cookie)) || {};
|
||||
break;
|
||||
}
|
||||
case 'query_string': {
|
||||
// query string:
|
||||
// node: req.url (raw)
|
||||
// express, koa, nextjs: req.query
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
requestData.query_string = extractQueryParams(req, deps);
|
||||
break;
|
||||
}
|
||||
case 'data': {
|
||||
if (method === 'GET' || method === 'HEAD') {
|
||||
break;
|
||||
}
|
||||
// body data:
|
||||
// express, koa, nextjs: req.body
|
||||
//
|
||||
// when using node by itself, you have to read the incoming stream(see
|
||||
// https://nodejs.dev/learn/get-http-request-body-data-using-nodejs); if a user is doing that, we can't know
|
||||
// where they're going to store the final result, so they'll have to capture this data themselves
|
||||
if (req.body !== undefined) {
|
||||
requestData.data = isString(req.body) ? req.body : JSON.stringify(normalize(req.body));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if ({}.hasOwnProperty.call(req, key)) {
|
||||
requestData[key] = (req )[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return requestData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add data from the given request to the given event
|
||||
*
|
||||
* @param event The event to which the request data will be added
|
||||
* @param req Request object
|
||||
* @param options.include Flags to control what data is included
|
||||
* @param options.deps Injected platform-specific dependencies
|
||||
* @returns The mutated `Event` object
|
||||
*/
|
||||
function addRequestDataToEvent(
|
||||
event,
|
||||
req,
|
||||
options,
|
||||
) {
|
||||
const include = {
|
||||
...DEFAULT_INCLUDES,
|
||||
...(options && options.include),
|
||||
};
|
||||
|
||||
if (include.request) {
|
||||
const extractedRequestData = Array.isArray(include.request)
|
||||
? extractRequestData(req, { include: include.request, deps: options && options.deps })
|
||||
: extractRequestData(req, { deps: options && options.deps });
|
||||
|
||||
event.request = {
|
||||
...event.request,
|
||||
...extractedRequestData,
|
||||
};
|
||||
}
|
||||
|
||||
if (include.user) {
|
||||
const extractedUser = req.user && isPlainObject(req.user) ? extractUserData(req.user, include.user) : {};
|
||||
|
||||
if (Object.keys(extractedUser).length) {
|
||||
event.user = {
|
||||
...event.user,
|
||||
...extractedUser,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// client ip:
|
||||
// node, nextjs: req.socket.remoteAddress
|
||||
// express, koa: req.ip
|
||||
if (include.ip) {
|
||||
const ip = req.ip || (req.socket && req.socket.remoteAddress);
|
||||
if (ip) {
|
||||
event.user = {
|
||||
...event.user,
|
||||
ip_address: ip,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (include.transaction && !event.transaction) {
|
||||
// TODO do we even need this anymore?
|
||||
// TODO make this work for nextjs
|
||||
event.transaction = extractTransaction(req, include.transaction);
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
function extractQueryParams(
|
||||
req,
|
||||
deps,
|
||||
) {
|
||||
// url (including path and query string):
|
||||
// node, express: req.originalUrl
|
||||
// koa, nextjs: req.url
|
||||
let originalUrl = req.originalUrl || req.url || '';
|
||||
|
||||
if (!originalUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The `URL` constructor can't handle internal URLs of the form `/some/path/here`, so stick a dummy protocol and
|
||||
// hostname on the beginning. Since the point here is just to grab the query string, it doesn't matter what we use.
|
||||
if (originalUrl.startsWith('/')) {
|
||||
originalUrl = `http://dogs.are.great${originalUrl}`;
|
||||
}
|
||||
|
||||
try {
|
||||
return (
|
||||
req.query ||
|
||||
(typeof URL !== 'undefined' && new URL(originalUrl).search.slice(1)) ||
|
||||
// In Node 8, `URL` isn't in the global scope, so we have to use the built-in module from Node
|
||||
(deps && deps.url && deps.url.parse(originalUrl).query) ||
|
||||
undefined
|
||||
);
|
||||
} catch (e2) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a `Headers` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into a simple key-value dict.
|
||||
* The header keys will be lower case: e.g. A "Content-Type" header will be stored as "content-type".
|
||||
*/
|
||||
// TODO(v8): Make this function return undefined when the extraction fails.
|
||||
function winterCGHeadersToDict(winterCGHeaders) {
|
||||
const headers = {};
|
||||
try {
|
||||
winterCGHeaders.forEach((value, key) => {
|
||||
if (typeof value === 'string') {
|
||||
// We check that value is a string even though it might be redundant to make sure prototype pollution is not possible.
|
||||
headers[key] = value;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn('Sentry failed extracting headers from a request object. If you see this, please file an issue.');
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a `Request` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into the format that the `RequestData` integration understands.
|
||||
*/
|
||||
function winterCGRequestToRequestData(req) {
|
||||
const headers = winterCGHeadersToDict(req.headers);
|
||||
return {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
headers,
|
||||
};
|
||||
}
|
||||
|
||||
export { DEFAULT_USER_INCLUDES, addRequestDataToEvent, addRequestDataToTransaction, extractPathForTransaction, extractRequestData, winterCGHeadersToDict, winterCGRequestToRequestData };
|
||||
//# sourceMappingURL=requestdata.js.map
|
||||
1
node_modules/@sentry/utils/esm/requestdata.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/requestdata.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
node_modules/@sentry/utils/esm/severity.js
generated
vendored
Normal file
36
node_modules/@sentry/utils/esm/severity.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either
|
||||
//
|
||||
// a) moving `validSeverityLevels` to `@sentry/types`,
|
||||
// b) moving the`SeverityLevel` type here, or
|
||||
// c) importing `validSeverityLevels` from here into `@sentry/types`.
|
||||
//
|
||||
// Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would
|
||||
// create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the
|
||||
// type, reminding anyone who changes it to change this list also, will have to do.
|
||||
|
||||
const validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];
|
||||
|
||||
/**
|
||||
* Converts a string-based level into a member of the deprecated {@link Severity} enum.
|
||||
*
|
||||
* @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead.
|
||||
*
|
||||
* @param level String representation of Severity
|
||||
* @returns Severity
|
||||
*/
|
||||
function severityFromString(level) {
|
||||
return severityLevelFromString(level) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string-based level into a `SeverityLevel`, normalizing it along the way.
|
||||
*
|
||||
* @param level String representation of desired `SeverityLevel`.
|
||||
* @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.
|
||||
*/
|
||||
function severityLevelFromString(level) {
|
||||
return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ;
|
||||
}
|
||||
|
||||
export { severityFromString, severityLevelFromString, validSeverityLevels };
|
||||
//# sourceMappingURL=severity.js.map
|
||||
1
node_modules/@sentry/utils/esm/severity.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/severity.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"severity.js","sources":["../../src/severity.ts"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport type { Severity, SeverityLevel } from '@sentry/types';\n\n// Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either\n//\n// a) moving `validSeverityLevels` to `@sentry/types`,\n// b) moving the`SeverityLevel` type here, or\n// c) importing `validSeverityLevels` from here into `@sentry/types`.\n//\n// Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would\n// create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the\n// type, reminding anyone who changes it to change this list also, will have to do.\n\nexport const validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];\n\n/**\n * Converts a string-based level into a member of the deprecated {@link Severity} enum.\n *\n * @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead.\n *\n * @param level String representation of Severity\n * @returns Severity\n */\nexport function severityFromString(level: Severity | SeverityLevel | string): Severity {\n return severityLevelFromString(level) as Severity;\n}\n\n/**\n * Converts a string-based level into a `SeverityLevel`, normalizing it along the way.\n *\n * @param level String representation of desired `SeverityLevel`.\n * @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.\n */\nexport function severityLevelFromString(level: SeverityLevel | string): SeverityLevel {\n return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') as SeverityLevel;\n}\n"],"names":[],"mappings":"AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACa,MAAA,mBAAA,GAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,KAAK,EAA+C;AACvF,EAAE,OAAO,uBAAuB,CAAC,KAAK,CAAE,EAAA;AACxC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,KAAK,EAAyC;AACtF,EAAE,QAAQ,KAAA,KAAU,MAAO,GAAE,YAAY,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAA,GAAI,KAAM,GAAE,KAAK,GAAE;AAC9F;;;;"}
|
||||
148
node_modules/@sentry/utils/esm/stacktrace.js
generated
vendored
Normal file
148
node_modules/@sentry/utils/esm/stacktrace.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
import { node } from './node-stack-trace.js';
|
||||
export { filenameIsInApp } from './node-stack-trace.js';
|
||||
|
||||
const STACKTRACE_FRAME_LIMIT = 50;
|
||||
// Used to sanitize webpack (error: *) wrapped stack errors
|
||||
const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
||||
const STRIP_FRAME_REGEXP = /captureMessage|captureException/;
|
||||
|
||||
/**
|
||||
* Creates a stack parser with the supplied line parsers
|
||||
*
|
||||
* StackFrames are returned in the correct order for Sentry Exception
|
||||
* frames and with Sentry SDK internal frames removed from the top and bottom
|
||||
*
|
||||
*/
|
||||
function createStackParser(...parsers) {
|
||||
const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);
|
||||
|
||||
return (stack, skipFirst = 0) => {
|
||||
const frames = [];
|
||||
const lines = stack.split('\n');
|
||||
|
||||
for (let i = skipFirst; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
// Ignore lines over 1kb as they are unlikely to be stack frames.
|
||||
// Many of the regular expressions use backtracking which results in run time that increases exponentially with
|
||||
// input size. Huge strings can result in hangs/Denial of Service:
|
||||
// https://github.com/getsentry/sentry-javascript/issues/2286
|
||||
if (line.length > 1024) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// https://github.com/getsentry/sentry-javascript/issues/5459
|
||||
// Remove webpack (error: *) wrappers
|
||||
const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;
|
||||
|
||||
// https://github.com/getsentry/sentry-javascript/issues/7813
|
||||
// Skip Error: lines
|
||||
if (cleanedLine.match(/\S*Error: /)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const parser of sortedParsers) {
|
||||
const frame = parser(cleanedLine);
|
||||
|
||||
if (frame) {
|
||||
frames.push(frame);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (frames.length >= STACKTRACE_FRAME_LIMIT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return stripSentryFramesAndReverse(frames);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a stack parser implementation from Options.stackParser
|
||||
* @see Options
|
||||
*
|
||||
* If options contains an array of line parsers, it is converted into a parser
|
||||
*/
|
||||
function stackParserFromStackParserOptions(stackParser) {
|
||||
if (Array.isArray(stackParser)) {
|
||||
return createStackParser(...stackParser);
|
||||
}
|
||||
return stackParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.
|
||||
* Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the
|
||||
* function that caused the crash is the last frame in the array.
|
||||
* @hidden
|
||||
*/
|
||||
function stripSentryFramesAndReverse(stack) {
|
||||
if (!stack.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const localStack = Array.from(stack);
|
||||
|
||||
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
|
||||
if (/sentryWrapped/.test(localStack[localStack.length - 1].function || '')) {
|
||||
localStack.pop();
|
||||
}
|
||||
|
||||
// Reversing in the middle of the procedure allows us to just pop the values off the stack
|
||||
localStack.reverse();
|
||||
|
||||
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
|
||||
if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || '')) {
|
||||
localStack.pop();
|
||||
|
||||
// When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`
|
||||
// is produced within the hub itself, making it:
|
||||
//
|
||||
// Sentry.captureException()
|
||||
// getCurrentHub().captureException()
|
||||
//
|
||||
// instead of just the top `Sentry` call itself.
|
||||
// This forces us to possibly strip an additional frame in the exact same was as above.
|
||||
if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || '')) {
|
||||
localStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({
|
||||
...frame,
|
||||
filename: frame.filename || localStack[localStack.length - 1].filename,
|
||||
function: frame.function || '?',
|
||||
}));
|
||||
}
|
||||
|
||||
const defaultFunctionName = '<anonymous>';
|
||||
|
||||
/**
|
||||
* Safely extract function name from itself
|
||||
*/
|
||||
function getFunctionName(fn) {
|
||||
try {
|
||||
if (!fn || typeof fn !== 'function') {
|
||||
return defaultFunctionName;
|
||||
}
|
||||
return fn.name || defaultFunctionName;
|
||||
} catch (e) {
|
||||
// Just accessing custom props in some Selenium environments
|
||||
// can cause a "Permission denied" exception (see raven-js#495).
|
||||
return defaultFunctionName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Node.js stack line parser
|
||||
*
|
||||
* This is in @sentry/utils so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`.
|
||||
* This allows it to be used without referencing or importing any node specific code which causes bundlers to complain
|
||||
*/
|
||||
function nodeStackLineParser(getModule) {
|
||||
return [90, node(getModule)];
|
||||
}
|
||||
|
||||
export { createStackParser, getFunctionName, nodeStackLineParser, stackParserFromStackParserOptions, stripSentryFramesAndReverse };
|
||||
//# sourceMappingURL=stacktrace.js.map
|
||||
1
node_modules/@sentry/utils/esm/stacktrace.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/stacktrace.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
141
node_modules/@sentry/utils/esm/string.js
generated
vendored
Normal file
141
node_modules/@sentry/utils/esm/string.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
import { isVueViewModel, isString, isRegExp } from './is.js';
|
||||
|
||||
/**
|
||||
* Truncates given string to the maximum characters count
|
||||
*
|
||||
* @param str An object that contains serializable values
|
||||
* @param max Maximum number of characters in truncated string (0 = unlimited)
|
||||
* @returns string Encoded
|
||||
*/
|
||||
function truncate(str, max = 0) {
|
||||
if (typeof str !== 'string' || max === 0) {
|
||||
return str;
|
||||
}
|
||||
return str.length <= max ? str : `${str.slice(0, max)}...`;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is basically just `trim_line` from
|
||||
* https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67
|
||||
*
|
||||
* @param str An object that contains serializable values
|
||||
* @param max Maximum number of characters in truncated string
|
||||
* @returns string Encoded
|
||||
*/
|
||||
function snipLine(line, colno) {
|
||||
let newLine = line;
|
||||
const lineLength = newLine.length;
|
||||
if (lineLength <= 150) {
|
||||
return newLine;
|
||||
}
|
||||
if (colno > lineLength) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
colno = lineLength;
|
||||
}
|
||||
|
||||
let start = Math.max(colno - 60, 0);
|
||||
if (start < 5) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
let end = Math.min(start + 140, lineLength);
|
||||
if (end > lineLength - 5) {
|
||||
end = lineLength;
|
||||
}
|
||||
if (end === lineLength) {
|
||||
start = Math.max(end - 140, 0);
|
||||
}
|
||||
|
||||
newLine = newLine.slice(start, end);
|
||||
if (start > 0) {
|
||||
newLine = `'{snip} ${newLine}`;
|
||||
}
|
||||
if (end < lineLength) {
|
||||
newLine += ' {snip}';
|
||||
}
|
||||
|
||||
return newLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join values in array
|
||||
* @param input array of values to be joined together
|
||||
* @param delimiter string to be placed in-between values
|
||||
* @returns Joined values
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function safeJoin(input, delimiter) {
|
||||
if (!Array.isArray(input)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const output = [];
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const value = input[i];
|
||||
try {
|
||||
// This is a hack to fix a Vue3-specific bug that causes an infinite loop of
|
||||
// console warnings. This happens when a Vue template is rendered with
|
||||
// an undeclared variable, which we try to stringify, ultimately causing
|
||||
// Vue to issue another warning which repeats indefinitely.
|
||||
// see: https://github.com/getsentry/sentry-javascript/pull/8981
|
||||
if (isVueViewModel(value)) {
|
||||
output.push('[VueViewModel]');
|
||||
} else {
|
||||
output.push(String(value));
|
||||
}
|
||||
} catch (e) {
|
||||
output.push('[value cannot be serialized]');
|
||||
}
|
||||
}
|
||||
|
||||
return output.join(delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given value matches a regex or string
|
||||
*
|
||||
* @param value The string to test
|
||||
* @param pattern Either a regex or a string against which `value` will be matched
|
||||
* @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match
|
||||
* `pattern` if it contains `pattern`. Only applies to string-type patterns.
|
||||
*/
|
||||
function isMatchingPattern(
|
||||
value,
|
||||
pattern,
|
||||
requireExactStringMatch = false,
|
||||
) {
|
||||
if (!isString(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isRegExp(pattern)) {
|
||||
return pattern.test(value);
|
||||
}
|
||||
if (isString(pattern)) {
|
||||
return requireExactStringMatch ? value === pattern : value.includes(pattern);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the given string against an array of strings and regexes. By default, string matching is done on a
|
||||
* substring-inclusion basis rather than a strict equality basis
|
||||
*
|
||||
* @param testString The string to test
|
||||
* @param patterns The patterns against which to test the string
|
||||
* @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to
|
||||
* count. If false, `testString` will match a string pattern if it contains that pattern.
|
||||
* @returns
|
||||
*/
|
||||
function stringMatchesSomePattern(
|
||||
testString,
|
||||
patterns = [],
|
||||
requireExactStringMatch = false,
|
||||
) {
|
||||
return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));
|
||||
}
|
||||
|
||||
export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate };
|
||||
//# sourceMappingURL=string.js.map
|
||||
1
node_modules/@sentry/utils/esm/string.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/string.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
166
node_modules/@sentry/utils/esm/supports.js
generated
vendored
Normal file
166
node_modules/@sentry/utils/esm/supports.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
import { DEBUG_BUILD } from './debug-build.js';
|
||||
import { logger } from './logger.js';
|
||||
import { getGlobalObject } from './worldwide.js';
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const WINDOW = getGlobalObject();
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports ErrorEvent objects
|
||||
* {@link supportsErrorEvent}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsErrorEvent() {
|
||||
try {
|
||||
new ErrorEvent('');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports DOMError objects
|
||||
* {@link supportsDOMError}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsDOMError() {
|
||||
try {
|
||||
// Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':
|
||||
// 1 argument required, but only 0 present.
|
||||
// @ts-expect-error It really needs 1 argument, not 0.
|
||||
new DOMError('');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports DOMException objects
|
||||
* {@link supportsDOMException}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsDOMException() {
|
||||
try {
|
||||
new DOMException('');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports Fetch API
|
||||
* {@link supportsFetch}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsFetch() {
|
||||
if (!('fetch' in WINDOW)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
new Headers();
|
||||
new Request('http://www.example.com');
|
||||
new Response();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* isNativeFetch checks if the given function is a native implementation of fetch()
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
function isNativeFetch(func) {
|
||||
return func && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports Fetch API natively
|
||||
* {@link supportsNativeFetch}.
|
||||
*
|
||||
* @returns true if `window.fetch` is natively implemented, false otherwise
|
||||
*/
|
||||
function supportsNativeFetch() {
|
||||
if (typeof EdgeRuntime === 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!supportsFetch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fast path to avoid DOM I/O
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
if (isNativeFetch(WINDOW.fetch)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)
|
||||
// so create a "pure" iframe to see if that has native fetch
|
||||
let result = false;
|
||||
const doc = WINDOW.document;
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
if (doc && typeof (doc.createElement ) === 'function') {
|
||||
try {
|
||||
const sandbox = doc.createElement('iframe');
|
||||
sandbox.hidden = true;
|
||||
doc.head.appendChild(sandbox);
|
||||
if (sandbox.contentWindow && sandbox.contentWindow.fetch) {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
result = isNativeFetch(sandbox.contentWindow.fetch);
|
||||
}
|
||||
doc.head.removeChild(sandbox);
|
||||
} catch (err) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports ReportingObserver API
|
||||
* {@link supportsReportingObserver}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsReportingObserver() {
|
||||
return 'ReportingObserver' in WINDOW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether current environment supports Referrer Policy API
|
||||
* {@link supportsReferrerPolicy}.
|
||||
*
|
||||
* @returns Answer to the given question.
|
||||
*/
|
||||
function supportsReferrerPolicy() {
|
||||
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'
|
||||
// (see https://caniuse.com/#feat=referrer-policy),
|
||||
// it doesn't. And it throws an exception instead of ignoring this parameter...
|
||||
// REF: https://github.com/getsentry/raven-js/issues/1233
|
||||
|
||||
if (!supportsFetch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
new Request('_', {
|
||||
referrerPolicy: 'origin' ,
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export { isNativeFetch, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver };
|
||||
//# sourceMappingURL=supports.js.map
|
||||
1
node_modules/@sentry/utils/esm/supports.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/supports.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
192
node_modules/@sentry/utils/esm/syncpromise.js
generated
vendored
Normal file
192
node_modules/@sentry/utils/esm/syncpromise.js
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
import { isThenable } from './is.js';
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
|
||||
/** SyncPromise internal states */
|
||||
var States; (function (States) {
|
||||
/** Pending */
|
||||
const PENDING = 0; States[States["PENDING"] = PENDING] = "PENDING";
|
||||
/** Resolved / OK */
|
||||
const RESOLVED = 1; States[States["RESOLVED"] = RESOLVED] = "RESOLVED";
|
||||
/** Rejected / Error */
|
||||
const REJECTED = 2; States[States["REJECTED"] = REJECTED] = "REJECTED";
|
||||
})(States || (States = {}));
|
||||
|
||||
// Overloads so we can call resolvedSyncPromise without arguments and generic argument
|
||||
|
||||
/**
|
||||
* Creates a resolved sync promise.
|
||||
*
|
||||
* @param value the value to resolve the promise with
|
||||
* @returns the resolved sync promise
|
||||
*/
|
||||
function resolvedSyncPromise(value) {
|
||||
return new SyncPromise(resolve => {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a rejected sync promise.
|
||||
*
|
||||
* @param value the value to reject the promise with
|
||||
* @returns the rejected sync promise
|
||||
*/
|
||||
function rejectedSyncPromise(reason) {
|
||||
return new SyncPromise((_, reject) => {
|
||||
reject(reason);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Thenable class that behaves like a Promise and follows it's interface
|
||||
* but is not async internally
|
||||
*/
|
||||
class SyncPromise {
|
||||
|
||||
constructor(
|
||||
executor,
|
||||
) {SyncPromise.prototype.__init.call(this);SyncPromise.prototype.__init2.call(this);SyncPromise.prototype.__init3.call(this);SyncPromise.prototype.__init4.call(this);
|
||||
this._state = States.PENDING;
|
||||
this._handlers = [];
|
||||
|
||||
try {
|
||||
executor(this._resolve, this._reject);
|
||||
} catch (e) {
|
||||
this._reject(e);
|
||||
}
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
then(
|
||||
onfulfilled,
|
||||
onrejected,
|
||||
) {
|
||||
return new SyncPromise((resolve, reject) => {
|
||||
this._handlers.push([
|
||||
false,
|
||||
result => {
|
||||
if (!onfulfilled) {
|
||||
// TODO: ¯\_(ツ)_/¯
|
||||
// TODO: FIXME
|
||||
resolve(result );
|
||||
} else {
|
||||
try {
|
||||
resolve(onfulfilled(result));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
reason => {
|
||||
if (!onrejected) {
|
||||
reject(reason);
|
||||
} else {
|
||||
try {
|
||||
resolve(onrejected(reason));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
]);
|
||||
this._executeHandlers();
|
||||
});
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
catch(
|
||||
onrejected,
|
||||
) {
|
||||
return this.then(val => val, onrejected);
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
finally(onfinally) {
|
||||
return new SyncPromise((resolve, reject) => {
|
||||
let val;
|
||||
let isRejected;
|
||||
|
||||
return this.then(
|
||||
value => {
|
||||
isRejected = false;
|
||||
val = value;
|
||||
if (onfinally) {
|
||||
onfinally();
|
||||
}
|
||||
},
|
||||
reason => {
|
||||
isRejected = true;
|
||||
val = reason;
|
||||
if (onfinally) {
|
||||
onfinally();
|
||||
}
|
||||
},
|
||||
).then(() => {
|
||||
if (isRejected) {
|
||||
reject(val);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(val );
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** JSDoc */
|
||||
__init() {this._resolve = (value) => {
|
||||
this._setResult(States.RESOLVED, value);
|
||||
};}
|
||||
|
||||
/** JSDoc */
|
||||
__init2() {this._reject = (reason) => {
|
||||
this._setResult(States.REJECTED, reason);
|
||||
};}
|
||||
|
||||
/** JSDoc */
|
||||
__init3() {this._setResult = (state, value) => {
|
||||
if (this._state !== States.PENDING) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isThenable(value)) {
|
||||
void (value ).then(this._resolve, this._reject);
|
||||
return;
|
||||
}
|
||||
|
||||
this._state = state;
|
||||
this._value = value;
|
||||
|
||||
this._executeHandlers();
|
||||
};}
|
||||
|
||||
/** JSDoc */
|
||||
__init4() {this._executeHandlers = () => {
|
||||
if (this._state === States.PENDING) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cachedHandlers = this._handlers.slice();
|
||||
this._handlers = [];
|
||||
|
||||
cachedHandlers.forEach(handler => {
|
||||
if (handler[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._state === States.RESOLVED) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
handler[1](this._value );
|
||||
}
|
||||
|
||||
if (this._state === States.REJECTED) {
|
||||
handler[2](this._value);
|
||||
}
|
||||
|
||||
handler[0] = true;
|
||||
});
|
||||
};}
|
||||
}
|
||||
|
||||
export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise };
|
||||
//# sourceMappingURL=syncpromise.js.map
|
||||
1
node_modules/@sentry/utils/esm/syncpromise.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/syncpromise.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
128
node_modules/@sentry/utils/esm/time.js
generated
vendored
Normal file
128
node_modules/@sentry/utils/esm/time.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
import { GLOBAL_OBJ } from './worldwide.js';
|
||||
|
||||
const ONE_SECOND_IN_MS = 1000;
|
||||
|
||||
/**
|
||||
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
|
||||
* for accessing a high-resolution monotonic clock.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
|
||||
*
|
||||
* TODO(v8): Return type should be rounded.
|
||||
*/
|
||||
function dateTimestampInSeconds() {
|
||||
return Date.now() / ONE_SECOND_IN_MS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not
|
||||
* support the API.
|
||||
*
|
||||
* Wrapping the native API works around differences in behavior from different browsers.
|
||||
*/
|
||||
function createUnixTimestampInSecondsFunc() {
|
||||
const { performance } = GLOBAL_OBJ ;
|
||||
if (!performance || !performance.now) {
|
||||
return dateTimestampInSeconds;
|
||||
}
|
||||
|
||||
// Some browser and environments don't have a timeOrigin, so we fallback to
|
||||
// using Date.now() to compute the starting time.
|
||||
const approxStartingTimeOrigin = Date.now() - performance.now();
|
||||
const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;
|
||||
|
||||
// performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
|
||||
// wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
|
||||
//
|
||||
// TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the
|
||||
// wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and
|
||||
// correct for this.
|
||||
// See: https://github.com/getsentry/sentry-javascript/issues/2590
|
||||
// See: https://github.com/mdn/content/issues/4713
|
||||
// See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6
|
||||
return () => {
|
||||
return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
|
||||
* availability of the Performance API.
|
||||
*
|
||||
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is
|
||||
* asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The
|
||||
* skew can grow to arbitrary amounts like days, weeks or months.
|
||||
* See https://github.com/getsentry/sentry-javascript/issues/2590.
|
||||
*/
|
||||
const timestampInSeconds = createUnixTimestampInSecondsFunc();
|
||||
|
||||
/**
|
||||
* Re-exported with an old name for backwards-compatibility.
|
||||
* TODO (v8): Remove this
|
||||
*
|
||||
* @deprecated Use `timestampInSeconds` instead.
|
||||
*/
|
||||
const timestampWithMs = timestampInSeconds;
|
||||
|
||||
/**
|
||||
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.
|
||||
*/
|
||||
let _browserPerformanceTimeOriginMode;
|
||||
|
||||
/**
|
||||
* The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the
|
||||
* performance API is available.
|
||||
*/
|
||||
const browserPerformanceTimeOrigin = (() => {
|
||||
// Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or
|
||||
// performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin
|
||||
// data as reliable if they are within a reasonable threshold of the current time.
|
||||
|
||||
const { performance } = GLOBAL_OBJ ;
|
||||
if (!performance || !performance.now) {
|
||||
_browserPerformanceTimeOriginMode = 'none';
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const threshold = 3600 * 1000;
|
||||
const performanceNow = performance.now();
|
||||
const dateNow = Date.now();
|
||||
|
||||
// if timeOrigin isn't available set delta to threshold so it isn't used
|
||||
const timeOriginDelta = performance.timeOrigin
|
||||
? Math.abs(performance.timeOrigin + performanceNow - dateNow)
|
||||
: threshold;
|
||||
const timeOriginIsReliable = timeOriginDelta < threshold;
|
||||
|
||||
// While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin
|
||||
// is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
|
||||
// Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always
|
||||
// a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the
|
||||
// Date API.
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const navigationStart = performance.timing && performance.timing.navigationStart;
|
||||
const hasNavigationStart = typeof navigationStart === 'number';
|
||||
// if navigationStart isn't available set delta to threshold so it isn't used
|
||||
const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;
|
||||
const navigationStartIsReliable = navigationStartDelta < threshold;
|
||||
|
||||
if (timeOriginIsReliable || navigationStartIsReliable) {
|
||||
// Use the more reliable time origin
|
||||
if (timeOriginDelta <= navigationStartDelta) {
|
||||
_browserPerformanceTimeOriginMode = 'timeOrigin';
|
||||
return performance.timeOrigin;
|
||||
} else {
|
||||
_browserPerformanceTimeOriginMode = 'navigationStart';
|
||||
return navigationStart;
|
||||
}
|
||||
}
|
||||
|
||||
// Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.
|
||||
_browserPerformanceTimeOriginMode = 'dateNow';
|
||||
return dateNow;
|
||||
})();
|
||||
|
||||
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs };
|
||||
//# sourceMappingURL=time.js.map
|
||||
1
node_modules/@sentry/utils/esm/time.js.map
generated
vendored
Normal file
1
node_modules/@sentry/utils/esm/time.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
129
node_modules/@sentry/utils/esm/tracing.js
generated
vendored
Normal file
129
node_modules/@sentry/utils/esm/tracing.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
import { baggageHeaderToDynamicSamplingContext } from './baggage.js';
|
||||
import { uuid4 } from './misc.js';
|
||||
|
||||
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- RegExp is used for readability here
|
||||
const TRACEPARENT_REGEXP = new RegExp(
|
||||
'^[ \\t]*' + // whitespace
|
||||
'([0-9a-f]{32})?' + // trace_id
|
||||
'-?([0-9a-f]{16})?' + // span_id
|
||||
'-?([01])?' + // sampled
|
||||
'[ \\t]*$', // whitespace
|
||||
);
|
||||
|
||||
/**
|
||||
* Extract transaction context data from a `sentry-trace` header.
|
||||
*
|
||||
* @param traceparent Traceparent string
|
||||
*
|
||||
* @returns Object containing data from the header, or undefined if traceparent string is malformed
|
||||
*/
|
||||
function extractTraceparentData(traceparent) {
|
||||
if (!traceparent) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const matches = traceparent.match(TRACEPARENT_REGEXP);
|
||||
if (!matches) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let parentSampled;
|
||||
if (matches[3] === '1') {
|
||||
parentSampled = true;
|
||||
} else if (matches[3] === '0') {
|
||||
parentSampled = false;
|
||||
}
|
||||
|
||||
return {
|
||||
traceId: matches[1],
|
||||
parentSampled,
|
||||
parentSpanId: matches[2],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create tracing context from incoming headers.
|
||||
*
|
||||
* @deprecated Use `propagationContextFromHeaders` instead.
|
||||
*/
|
||||
// TODO(v8): Remove this function
|
||||
function tracingContextFromHeaders(
|
||||
sentryTrace,
|
||||
baggage,
|
||||
)
|
||||
|
||||
{
|
||||
const traceparentData = extractTraceparentData(sentryTrace);
|
||||
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage);
|
||||
|
||||
const { traceId, parentSpanId, parentSampled } = traceparentData || {};
|
||||
|
||||
if (!traceparentData) {
|
||||
return {
|
||||
traceparentData,
|
||||
dynamicSamplingContext: undefined,
|
||||
propagationContext: {
|
||||
traceId: traceId || uuid4(),
|
||||
spanId: uuid4().substring(16),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
traceparentData,
|
||||
dynamicSamplingContext: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it
|
||||
propagationContext: {
|
||||
traceId: traceId || uuid4(),
|
||||
parentSpanId: parentSpanId || uuid4().substring(16),
|
||||
spanId: uuid4().substring(16),
|
||||
sampled: parentSampled,
|
||||
dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a propagation context from incoming headers.
|
||||
*/
|
||||
function propagationContextFromHeaders(
|
||||
sentryTrace,
|
||||
baggage,
|
||||
) {
|
||||
const traceparentData = extractTraceparentData(sentryTrace);
|
||||
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage);
|
||||
|
||||
const { traceId, parentSpanId, parentSampled } = traceparentData || {};
|
||||
|
||||
if (!traceparentData) {
|
||||
return {
|
||||
traceId: traceId || uuid4(),
|
||||
spanId: uuid4().substring(16),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
traceId: traceId || uuid4(),
|
||||
parentSpanId: parentSpanId || uuid4().substring(16),
|
||||
spanId: uuid4().substring(16),
|
||||
sampled: parentSampled,
|
||||
dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sentry-trace header from span context values.
|
||||
*/
|
||||
function generateSentryTraceHeader(
|
||||
traceId = uuid4(),
|
||||
spanId = uuid4().substring(16),
|
||||
sampled,
|
||||
) {
|
||||
let sampledString = '';
|
||||
if (sampled !== undefined) {
|
||||
sampledString = sampled ? '-1' : '-0';
|
||||
}
|
||||
return `${traceId}-${spanId}${sampledString}`;
|
||||
}
|
||||
|
||||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, tracingContextFromHeaders };
|
||||
//# sourceMappingURL=tracing.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user