@sentry/utils
Advanced tools
Comparing version 5.10.0-beta.4 to 5.10.0-rc.0
@@ -13,2 +13,4 @@ export * from './async'; | ||
export * from './syncpromise'; | ||
export * from './instrument'; | ||
export * from './dsn'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,2 +15,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
tslib_1.__exportStar(require("./syncpromise"), exports); | ||
tslib_1.__exportStar(require("./instrument"), exports); | ||
tslib_1.__exportStar(require("./dsn"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Event, Integration } from "@sentry/types"; | ||
import { Event, Integration } from '@sentry/types'; | ||
/** Internal */ | ||
@@ -115,3 +115,7 @@ interface SentryGlobal { | ||
export declare function parseRetryAfterHeader(now: number, header?: string | number | null): number; | ||
/** | ||
* Safely extract function name from itself | ||
*/ | ||
export declare function getFunctionName(fn: unknown): string; | ||
export {}; | ||
//# sourceMappingURL=misc.d.ts.map |
@@ -20,3 +20,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// tslint:disable:strict-type-predicates | ||
return (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"); | ||
return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; | ||
} | ||
@@ -33,5 +33,5 @@ exports.isNodeEnv = isNodeEnv; | ||
? global | ||
: typeof window !== "undefined" | ||
: typeof window !== 'undefined' | ||
? window | ||
: typeof self !== "undefined" | ||
: typeof self !== 'undefined' | ||
? self | ||
@@ -66,17 +66,10 @@ : fallbackGlobalObject); | ||
}; | ||
return (pad(arr[0]) + | ||
pad(arr[1]) + | ||
pad(arr[2]) + | ||
pad(arr[3]) + | ||
pad(arr[4]) + | ||
pad(arr[5]) + | ||
pad(arr[6]) + | ||
pad(arr[7])); | ||
return (pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7])); | ||
} | ||
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 | ||
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) { | ||
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | ||
// tslint:disable-next-line:no-bitwise | ||
var r = (Math.random() * 16) | 0; | ||
// tslint:disable-next-line:no-bitwise | ||
var v = c === "x" ? r : (r & 0x3) | 0x8; | ||
var v = c === 'x' ? r : (r & 0x3) | 0x8; | ||
return v.toString(16); | ||
@@ -102,4 +95,4 @@ }); | ||
// coerce to undefined values to empty string so we don't get 'undefined' | ||
var query = match[6] || ""; | ||
var fragment = match[8] || ""; | ||
var query = match[6] || ''; | ||
var fragment = match[8] || ''; | ||
return { | ||
@@ -109,3 +102,3 @@ host: match[4], | ||
protocol: match[2], | ||
relative: match[5] + query + fragment // everything minus origin | ||
relative: match[5] + query + fragment, | ||
}; | ||
@@ -127,5 +120,5 @@ } | ||
} | ||
return exception.type || exception.value || event.event_id || "<unknown>"; | ||
return exception.type || exception.value || event.event_id || '<unknown>'; | ||
} | ||
return event.event_id || "<unknown>"; | ||
return event.event_id || '<unknown>'; | ||
} | ||
@@ -136,4 +129,4 @@ exports.getEventDescription = getEventDescription; | ||
var global = getGlobalObject(); | ||
var levels = ["debug", "info", "warn", "error", "log", "assert"]; | ||
if (!("console" in global)) { | ||
var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert']; | ||
if (!('console' in global)) { | ||
return callback(); | ||
@@ -145,4 +138,3 @@ } | ||
levels.forEach(function (level) { | ||
if (level in global.console && | ||
originalConsole[level].__sentry__) { | ||
if (level in global.console && originalConsole[level].__sentry__) { | ||
wrappedLevels[level] = originalConsole[level].__sentry_wrapped__; | ||
@@ -172,6 +164,4 @@ originalConsole[level] = originalConsole[level].__sentry_original__; | ||
event.exception.values[0] = event.exception.values[0] || {}; | ||
event.exception.values[0].value = | ||
event.exception.values[0].value || value || ""; | ||
event.exception.values[0].type = | ||
event.exception.values[0].type || type || "Error"; | ||
event.exception.values[0].value = event.exception.values[0].value || value || ''; | ||
event.exception.values[0].type = event.exception.values[0].type || type || 'Error'; | ||
} | ||
@@ -191,4 +181,3 @@ exports.addExceptionTypeValue = addExceptionTypeValue; | ||
// tslint:disable:no-non-null-assertion | ||
event.exception.values[0].mechanism = | ||
event.exception.values[0].mechanism || {}; | ||
event.exception.values[0].mechanism = event.exception.values[0].mechanism || {}; | ||
Object.keys(mechanism).forEach(function (key) { | ||
@@ -212,3 +201,3 @@ // @ts-ignore | ||
catch (oO) { | ||
return ""; | ||
return ''; | ||
} | ||
@@ -235,3 +224,3 @@ } | ||
var len = 0; | ||
var separator = " > "; | ||
var separator = ' > '; | ||
var sepLength = separator.length; | ||
@@ -245,5 +234,3 @@ var nextStr = void 0; | ||
// (ignore this limit if we are on the first iteration) | ||
if (nextStr === "html" || | ||
(height > 1 && | ||
len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { | ||
if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { | ||
break; | ||
@@ -258,3 +245,3 @@ } | ||
catch (_oO) { | ||
return "<unknown>"; | ||
return '<unknown>'; | ||
} | ||
@@ -277,3 +264,3 @@ } | ||
if (!elem || !elem.tagName) { | ||
return ""; | ||
return ''; | ||
} | ||
@@ -291,3 +278,3 @@ out.push(elem.tagName.toLowerCase()); | ||
} | ||
var attrWhitelist = ["type", "name", "title", "alt"]; | ||
var attrWhitelist = ['type', 'name', 'title', 'alt']; | ||
for (i = 0; i < attrWhitelist.length; i++) { | ||
@@ -300,3 +287,3 @@ key = attrWhitelist[i]; | ||
} | ||
return out.join(""); | ||
return out.join(''); | ||
} | ||
@@ -326,3 +313,3 @@ /** | ||
patch: isNaN(patch) ? undefined : patch, | ||
prerelease: match[4] | ||
prerelease: match[4], | ||
}; | ||
@@ -352,2 +339,20 @@ } | ||
exports.parseRetryAfterHeader = parseRetryAfterHeader; | ||
var 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; | ||
} | ||
} | ||
exports.getFunctionName = getFunctionName; | ||
//# sourceMappingURL=misc.js.map |
@@ -196,3 +196,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (typeof value === 'function') { | ||
return "[Function: " + (value.name || '<unknown-function-name>') + "]"; | ||
return "[Function: " + misc_1.getFunctionName(value) + "]"; | ||
} | ||
@@ -199,0 +199,0 @@ return value; |
@@ -84,2 +84,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* isNativeFetch checks if the given function is a native implementation of fetch() | ||
*/ | ||
function isNativeFetch(func) { | ||
return func && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); | ||
} | ||
/** | ||
* Tells whether current environment supports Fetch API natively | ||
@@ -94,5 +100,11 @@ * {@link supportsNativeFetch}. | ||
} | ||
var isNativeFunc = function (func) { return func.toString().indexOf('native') !== -1; }; | ||
var global = misc_1.getGlobalObject(); | ||
var result = null; | ||
// Fast path to avoid DOM I/O | ||
// tslint:disable-next-line:no-unbound-method | ||
if (isNativeFetch(global.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 | ||
var result = false; | ||
var doc = global.document; | ||
@@ -105,4 +117,4 @@ if (doc) { | ||
if (sandbox.contentWindow && sandbox.contentWindow.fetch) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(sandbox.contentWindow.fetch); | ||
// tslint:disable-next-line:no-unbound-method | ||
result = isNativeFetch(sandbox.contentWindow.fetch); | ||
} | ||
@@ -115,6 +127,2 @@ doc.head.removeChild(sandbox); | ||
} | ||
if (result === null) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(global.fetch); | ||
} | ||
return result; | ||
@@ -121,0 +129,0 @@ } |
@@ -13,2 +13,4 @@ export * from './async'; | ||
export * from './syncpromise'; | ||
export * from './instrument'; | ||
export * from './dsn'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -13,2 +13,4 @@ export * from './async'; | ||
export * from './syncpromise'; | ||
export * from './instrument'; | ||
export * from './dsn'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Event, Integration } from "@sentry/types"; | ||
import { Event, Integration } from '@sentry/types'; | ||
/** Internal */ | ||
@@ -115,3 +115,7 @@ interface SentryGlobal { | ||
export declare function parseRetryAfterHeader(now: number, header?: string | number | null): number; | ||
/** | ||
* Safely extract function name from itself | ||
*/ | ||
export declare function getFunctionName(fn: unknown): string; | ||
export {}; | ||
//# sourceMappingURL=misc.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { isString } from "./is"; | ||
import { isString } from './is'; | ||
/** | ||
@@ -18,3 +18,3 @@ * Requires a module which is protected _against bundler minification. | ||
// tslint:disable:strict-type-predicates | ||
return (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"); | ||
return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; | ||
} | ||
@@ -30,5 +30,5 @@ var fallbackGlobalObject = {}; | ||
? global | ||
: typeof window !== "undefined" | ||
: typeof window !== 'undefined' | ||
? window | ||
: typeof self !== "undefined" | ||
: typeof self !== 'undefined' | ||
? self | ||
@@ -62,17 +62,10 @@ : fallbackGlobalObject); | ||
}; | ||
return (pad(arr[0]) + | ||
pad(arr[1]) + | ||
pad(arr[2]) + | ||
pad(arr[3]) + | ||
pad(arr[4]) + | ||
pad(arr[5]) + | ||
pad(arr[6]) + | ||
pad(arr[7])); | ||
return (pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7])); | ||
} | ||
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 | ||
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) { | ||
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | ||
// tslint:disable-next-line:no-bitwise | ||
var r = (Math.random() * 16) | 0; | ||
// tslint:disable-next-line:no-bitwise | ||
var v = c === "x" ? r : (r & 0x3) | 0x8; | ||
var v = c === 'x' ? r : (r & 0x3) | 0x8; | ||
return v.toString(16); | ||
@@ -97,4 +90,4 @@ }); | ||
// coerce to undefined values to empty string so we don't get 'undefined' | ||
var query = match[6] || ""; | ||
var fragment = match[8] || ""; | ||
var query = match[6] || ''; | ||
var fragment = match[8] || ''; | ||
return { | ||
@@ -104,3 +97,3 @@ host: match[4], | ||
protocol: match[2], | ||
relative: match[5] + query + fragment // everything minus origin | ||
relative: match[5] + query + fragment, | ||
}; | ||
@@ -121,5 +114,5 @@ } | ||
} | ||
return exception.type || exception.value || event.event_id || "<unknown>"; | ||
return exception.type || exception.value || event.event_id || '<unknown>'; | ||
} | ||
return event.event_id || "<unknown>"; | ||
return event.event_id || '<unknown>'; | ||
} | ||
@@ -129,4 +122,4 @@ /** JSDoc */ | ||
var global = getGlobalObject(); | ||
var levels = ["debug", "info", "warn", "error", "log", "assert"]; | ||
if (!("console" in global)) { | ||
var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert']; | ||
if (!('console' in global)) { | ||
return callback(); | ||
@@ -138,4 +131,3 @@ } | ||
levels.forEach(function (level) { | ||
if (level in global.console && | ||
originalConsole[level].__sentry__) { | ||
if (level in global.console && originalConsole[level].__sentry__) { | ||
wrappedLevels[level] = originalConsole[level].__sentry_wrapped__; | ||
@@ -164,6 +156,4 @@ originalConsole[level] = originalConsole[level].__sentry_original__; | ||
event.exception.values[0] = event.exception.values[0] || {}; | ||
event.exception.values[0].value = | ||
event.exception.values[0].value || value || ""; | ||
event.exception.values[0].type = | ||
event.exception.values[0].type || type || "Error"; | ||
event.exception.values[0].value = event.exception.values[0].value || value || ''; | ||
event.exception.values[0].type = event.exception.values[0].type || type || 'Error'; | ||
} | ||
@@ -182,4 +172,3 @@ /** | ||
// tslint:disable:no-non-null-assertion | ||
event.exception.values[0].mechanism = | ||
event.exception.values[0].mechanism || {}; | ||
event.exception.values[0].mechanism = event.exception.values[0].mechanism || {}; | ||
Object.keys(mechanism).forEach(function (key) { | ||
@@ -202,3 +191,3 @@ // @ts-ignore | ||
catch (oO) { | ||
return ""; | ||
return ''; | ||
} | ||
@@ -224,3 +213,3 @@ } | ||
var len = 0; | ||
var separator = " > "; | ||
var separator = ' > '; | ||
var sepLength = separator.length; | ||
@@ -234,5 +223,3 @@ var nextStr = void 0; | ||
// (ignore this limit if we are on the first iteration) | ||
if (nextStr === "html" || | ||
(height > 1 && | ||
len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { | ||
if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { | ||
break; | ||
@@ -247,3 +234,3 @@ } | ||
catch (_oO) { | ||
return "<unknown>"; | ||
return '<unknown>'; | ||
} | ||
@@ -265,3 +252,3 @@ } | ||
if (!elem || !elem.tagName) { | ||
return ""; | ||
return ''; | ||
} | ||
@@ -279,3 +266,3 @@ out.push(elem.tagName.toLowerCase()); | ||
} | ||
var attrWhitelist = ["type", "name", "title", "alt"]; | ||
var attrWhitelist = ['type', 'name', 'title', 'alt']; | ||
for (i = 0; i < attrWhitelist.length; i++) { | ||
@@ -288,3 +275,3 @@ key = attrWhitelist[i]; | ||
} | ||
return out.join(""); | ||
return out.join(''); | ||
} | ||
@@ -313,3 +300,3 @@ /** | ||
patch: isNaN(patch) ? undefined : patch, | ||
prerelease: match[4] | ||
prerelease: match[4], | ||
}; | ||
@@ -337,2 +324,19 @@ } | ||
} | ||
var defaultFunctionName = '<anonymous>'; | ||
/** | ||
* Safely extract function name from itself | ||
*/ | ||
export 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; | ||
} | ||
} | ||
//# sourceMappingURL=misc.js.map |
import { isElement, isError, isEvent, isPrimitive, isSyntheticEvent } from './is'; | ||
import { Memo } from './memo'; | ||
import { htmlTreeAsString } from './misc'; | ||
import { getFunctionName, htmlTreeAsString } from './misc'; | ||
import { truncate } from './string'; | ||
@@ -192,3 +192,3 @@ /** | ||
if (typeof value === 'function') { | ||
return "[Function: " + (value.name || '<unknown-function-name>') + "]"; | ||
return "[Function: " + getFunctionName(value) + "]"; | ||
} | ||
@@ -195,0 +195,0 @@ return value; |
@@ -79,2 +79,8 @@ import { logger } from './logger'; | ||
/** | ||
* isNativeFetch checks if the given function is a native implementation of fetch() | ||
*/ | ||
function isNativeFetch(func) { | ||
return func && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); | ||
} | ||
/** | ||
* Tells whether current environment supports Fetch API natively | ||
@@ -89,5 +95,11 @@ * {@link supportsNativeFetch}. | ||
} | ||
var isNativeFunc = function (func) { return func.toString().indexOf('native') !== -1; }; | ||
var global = getGlobalObject(); | ||
var result = null; | ||
// Fast path to avoid DOM I/O | ||
// tslint:disable-next-line:no-unbound-method | ||
if (isNativeFetch(global.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 | ||
var result = false; | ||
var doc = global.document; | ||
@@ -100,4 +112,4 @@ if (doc) { | ||
if (sandbox.contentWindow && sandbox.contentWindow.fetch) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(sandbox.contentWindow.fetch); | ||
// tslint:disable-next-line:no-unbound-method | ||
result = isNativeFetch(sandbox.contentWindow.fetch); | ||
} | ||
@@ -110,6 +122,2 @@ doc.head.removeChild(sandbox); | ||
} | ||
if (result === null) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(global.fetch); | ||
} | ||
return result; | ||
@@ -116,0 +124,0 @@ } |
{ | ||
"name": "@sentry/utils", | ||
"version": "5.10.0-beta.4", | ||
"version": "5.10.0-rc.0", | ||
"description": "Utilities for all Sentry JavaScript SDKs", | ||
@@ -19,3 +19,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "5.10.0-beta.4", | ||
"@sentry/types": "5.10.0-rc.0", | ||
"tslib": "^1.9.3" | ||
@@ -22,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
442621
115
5405
13
19
1
124
+ Added@sentry/types@5.10.0-rc.0(transitive)
- Removed@sentry/types@5.10.0-beta.4(transitive)
Updated@sentry/types@5.10.0-rc.0