Criada a API do site

This commit is contained in:
Caio1w
2025-10-29 19:56:41 -03:00
parent f201c8edbd
commit 4a14f533d2
3074 changed files with 780728 additions and 41 deletions

46
node_modules/error-stack-parser-es/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict';
const lite = require('./lite.cjs');
function stackframesLiteToStackframes(liteStackframes) {
return liteStackframes.map((liteStackframe) => {
return {
functionName: liteStackframe.function,
args: liteStackframe.args,
fileName: liteStackframe.file,
lineNumber: liteStackframe.line,
columnNumber: liteStackframe.col,
source: liteStackframe.raw
};
});
}
function parse(error, options) {
return stackframesLiteToStackframes(lite.parse(error, options));
}
function parseV8OrIE(error) {
return stackframesLiteToStackframes(lite.parseV8OrIE(error));
}
function parseFFOrSafari(error) {
return stackframesLiteToStackframes(lite.parseFFOrSafari(error));
}
function parseOpera(e) {
return stackframesLiteToStackframes(lite.parseOpera(e));
}
function parseOpera9(e) {
return stackframesLiteToStackframes(lite.parseOpera9(e));
}
function parseOpera10(e) {
return stackframesLiteToStackframes(lite.parseOpera10(e));
}
function parseOpera11(error) {
return stackframesLiteToStackframes(lite.parseOpera11(error));
}
exports.extractLocation = lite.extractLocation;
exports.parse = parse;
exports.parseFFOrSafari = parseFFOrSafari;
exports.parseOpera = parseOpera;
exports.parseOpera10 = parseOpera10;
exports.parseOpera11 = parseOpera11;
exports.parseOpera9 = parseOpera9;
exports.parseV8OrIE = parseV8OrIE;

22
node_modules/error-stack-parser-es/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { ParseOptions, StackFrame } from './lite.cjs';
export { StackFrameLite, extractLocation } from './lite.cjs';
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrame[];
declare function parseV8OrIE(error: Error): StackFrame[];
declare function parseFFOrSafari(error: Error): StackFrame[];
declare function parseOpera(e: Error): StackFrame[];
declare function parseOpera9(e: Error): StackFrame[];
declare function parseOpera10(e: Error): StackFrame[];
declare function parseOpera11(error: Error): StackFrame[];
export { ParseOptions, StackFrame, parse, parseFFOrSafari, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseV8OrIE };

22
node_modules/error-stack-parser-es/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { ParseOptions, StackFrame } from './lite.mjs';
export { StackFrameLite, extractLocation } from './lite.mjs';
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrame[];
declare function parseV8OrIE(error: Error): StackFrame[];
declare function parseFFOrSafari(error: Error): StackFrame[];
declare function parseOpera(e: Error): StackFrame[];
declare function parseOpera9(e: Error): StackFrame[];
declare function parseOpera10(e: Error): StackFrame[];
declare function parseOpera11(error: Error): StackFrame[];
export { ParseOptions, StackFrame, parse, parseFFOrSafari, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseV8OrIE };

22
node_modules/error-stack-parser-es/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { ParseOptions, StackFrame } from './lite.js';
export { StackFrameLite, extractLocation } from './lite.js';
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrame[];
declare function parseV8OrIE(error: Error): StackFrame[];
declare function parseFFOrSafari(error: Error): StackFrame[];
declare function parseOpera(e: Error): StackFrame[];
declare function parseOpera9(e: Error): StackFrame[];
declare function parseOpera10(e: Error): StackFrame[];
declare function parseOpera11(error: Error): StackFrame[];
export { ParseOptions, StackFrame, parse, parseFFOrSafari, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseV8OrIE };

38
node_modules/error-stack-parser-es/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { parse as parse$1, parseV8OrIE as parseV8OrIE$1, parseFFOrSafari as parseFFOrSafari$1, parseOpera as parseOpera$1, parseOpera9 as parseOpera9$1, parseOpera10 as parseOpera10$1, parseOpera11 as parseOpera11$1 } from './lite.mjs';
export { extractLocation } from './lite.mjs';
function stackframesLiteToStackframes(liteStackframes) {
return liteStackframes.map((liteStackframe) => {
return {
functionName: liteStackframe.function,
args: liteStackframe.args,
fileName: liteStackframe.file,
lineNumber: liteStackframe.line,
columnNumber: liteStackframe.col,
source: liteStackframe.raw
};
});
}
function parse(error, options) {
return stackframesLiteToStackframes(parse$1(error, options));
}
function parseV8OrIE(error) {
return stackframesLiteToStackframes(parseV8OrIE$1(error));
}
function parseFFOrSafari(error) {
return stackframesLiteToStackframes(parseFFOrSafari$1(error));
}
function parseOpera(e) {
return stackframesLiteToStackframes(parseOpera$1(e));
}
function parseOpera9(e) {
return stackframesLiteToStackframes(parseOpera9$1(e));
}
function parseOpera10(e) {
return stackframesLiteToStackframes(parseOpera10$1(e));
}
function parseOpera11(error) {
return stackframesLiteToStackframes(parseOpera11$1(error));
}
export { parse, parseFFOrSafari, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseV8OrIE };

179
node_modules/error-stack-parser-es/dist/lite.cjs generated vendored Normal file
View File

@@ -0,0 +1,179 @@
'use strict';
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
function parse(error, options) {
if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined")
return parseOpera(error, options);
else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP))
return parseV8OrIE(error, options);
else if (error.stack)
return parseFFOrSafari(error, options);
else if (options?.allowEmpty)
return [];
else
throw new Error("Cannot parse given Error object");
}
function parseStack(stackString, options) {
if (stackString.match(CHROME_IE_STACK_REGEXP))
return parseV8OrIeString(stackString, options);
else
return parseFFOrSafariString(stackString, options);
}
function extractLocation(urlLike) {
if (!urlLike.includes(":"))
return [urlLike, undefined, undefined];
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
return [parts[1], parts[2] || undefined, parts[3] || undefined];
}
function applySlice(lines, options) {
if (options && options.slice != null) {
if (Array.isArray(options.slice))
return lines.slice(options.slice[0], options.slice[1]);
return lines.slice(0, options.slice);
}
return lines;
}
function parseV8OrIE(error, options) {
return parseV8OrIeString(error.stack, options);
}
function parseV8OrIeString(stack, options) {
const filtered = applySlice(
stack.split("\n").filter((line) => {
return !!line.match(CHROME_IE_STACK_REGEXP);
}),
options
);
return filtered.map((line) => {
if (line.includes("(eval ")) {
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
}
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
const location = sanitizedLine.match(/ (\(.+\)$)/);
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
const locationParts = extractLocation(location ? location[1] : sanitizedLine);
const functionName = location && sanitizedLine || undefined;
const fileName = ["eval", "<anonymous>"].includes(locationParts[0]) ? undefined : locationParts[0];
return {
function: functionName,
file: fileName,
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
});
}
function parseFFOrSafari(error, options) {
return parseFFOrSafariString(error.stack, options);
}
function parseFFOrSafariString(stack, options) {
const filtered = applySlice(
stack.split("\n").filter((line) => {
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
}),
options
);
return filtered.map((line) => {
if (line.includes(" > eval"))
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
if (!line.includes("@") && !line.includes(":")) {
return {
function: line
};
} else {
const functionNameRegex = /(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/;
const matches = line.match(functionNameRegex);
const functionName = matches && matches[1] ? matches[1] : undefined;
const locationParts = extractLocation(line.replace(functionNameRegex, ""));
return {
function: functionName,
file: locationParts[0],
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
}
});
}
function parseOpera(e, options) {
if (!e.stacktrace || e.message.includes("\n") && e.message.split("\n").length > e.stacktrace.split("\n").length)
return parseOpera9(e);
else if (!e.stack)
return parseOpera10(e);
else
return parseOpera11(e, options);
}
function parseOpera9(e, options) {
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
const lines = e.message.split("\n");
const result = [];
for (let i = 2, len = lines.length; i < len; i += 2) {
const match = lineRE.exec(lines[i]);
if (match) {
result.push({
file: match[2],
line: +match[1],
raw: lines[i]
});
}
}
return applySlice(result, options);
}
function parseOpera10(e, options) {
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
const lines = e.stacktrace.split("\n");
const result = [];
for (let i = 0, len = lines.length; i < len; i += 2) {
const match = lineRE.exec(lines[i]);
if (match) {
result.push({
function: match[3] || undefined,
file: match[2],
line: match[1] ? +match[1] : undefined,
raw: lines[i]
});
}
}
return applySlice(result, options);
}
function parseOpera11(error, options) {
const filtered = applySlice(
// @ts-expect-error missing stack property
error.stack.split("\n").filter((line) => {
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
}),
options
);
return filtered.map((line) => {
const tokens = line.split("@");
const locationParts = extractLocation(tokens.pop());
const functionCall = tokens.shift() || "";
const functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || undefined;
let argsRaw;
if (functionCall.match(/\(([^)]*)\)/))
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, "$1");
const args = argsRaw === undefined || argsRaw === "[arguments not available]" ? undefined : argsRaw.split(",");
return {
function: functionName,
args,
file: locationParts[0],
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
});
}
exports.extractLocation = extractLocation;
exports.parse = parse;
exports.parseFFOrSafari = parseFFOrSafari;
exports.parseFFOrSafariString = parseFFOrSafariString;
exports.parseOpera = parseOpera;
exports.parseOpera10 = parseOpera10;
exports.parseOpera11 = parseOpera11;
exports.parseOpera9 = parseOpera9;
exports.parseStack = parseStack;
exports.parseV8OrIE = parseV8OrIE;
exports.parseV8OrIeString = parseV8OrIeString;

65
node_modules/error-stack-parser-es/dist/lite.d.cts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
interface StackFrame {
args?: any[];
columnNumber?: number;
lineNumber?: number;
fileName?: string;
functionName?: string;
source?: string;
}
/**
* Simplified representation of a stack frame.
*/
interface StackFrameLite {
function?: string;
args?: any[];
file?: string;
col?: number;
line?: number;
raw?: string;
}
interface ParseOptions {
/**
* Slice the stack from the given index.
* This could save some computation to avoid parsing unneeded stack frames.
*/
slice?: number | [number, number];
/**
* Whether to return empty stack or throw an error when `stack` not found.
*
* By default, `parse` will throw an error when `stack` not found.
*
* @default false
*/
allowEmpty?: boolean;
}
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @param {ParseOptions} options
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrameLite[];
/**
* Parse stack string from V8, Firefox, or IE into an array of StackFrames.
*/
declare function parseStack(stackString: string, options?: ParseOptions): StackFrameLite[];
/**
* Separate line and column numbers from a string of the form: (URI:Line:Column)
*/
declare function extractLocation(urlLike: string): [string, string | undefined, string | undefined];
declare function parseV8OrIE(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseV8OrIeString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafari(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafariString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseOpera(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera9(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera10(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera11(error: Error, options?: ParseOptions): StackFrameLite[];
export { type ParseOptions, type StackFrame, type StackFrameLite, extractLocation, parse, parseFFOrSafari, parseFFOrSafariString, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseStack, parseV8OrIE, parseV8OrIeString };

65
node_modules/error-stack-parser-es/dist/lite.d.mts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
interface StackFrame {
args?: any[];
columnNumber?: number;
lineNumber?: number;
fileName?: string;
functionName?: string;
source?: string;
}
/**
* Simplified representation of a stack frame.
*/
interface StackFrameLite {
function?: string;
args?: any[];
file?: string;
col?: number;
line?: number;
raw?: string;
}
interface ParseOptions {
/**
* Slice the stack from the given index.
* This could save some computation to avoid parsing unneeded stack frames.
*/
slice?: number | [number, number];
/**
* Whether to return empty stack or throw an error when `stack` not found.
*
* By default, `parse` will throw an error when `stack` not found.
*
* @default false
*/
allowEmpty?: boolean;
}
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @param {ParseOptions} options
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrameLite[];
/**
* Parse stack string from V8, Firefox, or IE into an array of StackFrames.
*/
declare function parseStack(stackString: string, options?: ParseOptions): StackFrameLite[];
/**
* Separate line and column numbers from a string of the form: (URI:Line:Column)
*/
declare function extractLocation(urlLike: string): [string, string | undefined, string | undefined];
declare function parseV8OrIE(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseV8OrIeString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafari(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafariString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseOpera(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera9(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera10(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera11(error: Error, options?: ParseOptions): StackFrameLite[];
export { type ParseOptions, type StackFrame, type StackFrameLite, extractLocation, parse, parseFFOrSafari, parseFFOrSafariString, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseStack, parseV8OrIE, parseV8OrIeString };

65
node_modules/error-stack-parser-es/dist/lite.d.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
interface StackFrame {
args?: any[];
columnNumber?: number;
lineNumber?: number;
fileName?: string;
functionName?: string;
source?: string;
}
/**
* Simplified representation of a stack frame.
*/
interface StackFrameLite {
function?: string;
args?: any[];
file?: string;
col?: number;
line?: number;
raw?: string;
}
interface ParseOptions {
/**
* Slice the stack from the given index.
* This could save some computation to avoid parsing unneeded stack frames.
*/
slice?: number | [number, number];
/**
* Whether to return empty stack or throw an error when `stack` not found.
*
* By default, `parse` will throw an error when `stack` not found.
*
* @default false
*/
allowEmpty?: boolean;
}
/**
* Port from https://github.com/stacktracejs/error-stack-parser
*/
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @param {ParseOptions} options
* @return {Array} of StackFrames
*/
declare function parse(error: Error, options?: ParseOptions): StackFrameLite[];
/**
* Parse stack string from V8, Firefox, or IE into an array of StackFrames.
*/
declare function parseStack(stackString: string, options?: ParseOptions): StackFrameLite[];
/**
* Separate line and column numbers from a string of the form: (URI:Line:Column)
*/
declare function extractLocation(urlLike: string): [string, string | undefined, string | undefined];
declare function parseV8OrIE(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseV8OrIeString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafari(error: Error, options?: ParseOptions): StackFrameLite[];
declare function parseFFOrSafariString(stack: string, options?: ParseOptions): StackFrameLite[];
declare function parseOpera(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera9(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera10(e: Error, options?: ParseOptions): StackFrameLite[];
declare function parseOpera11(error: Error, options?: ParseOptions): StackFrameLite[];
export { type ParseOptions, type StackFrame, type StackFrameLite, extractLocation, parse, parseFFOrSafari, parseFFOrSafariString, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseStack, parseV8OrIE, parseV8OrIeString };

167
node_modules/error-stack-parser-es/dist/lite.mjs generated vendored Normal file
View File

@@ -0,0 +1,167 @@
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
function parse(error, options) {
if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined")
return parseOpera(error, options);
else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP))
return parseV8OrIE(error, options);
else if (error.stack)
return parseFFOrSafari(error, options);
else if (options?.allowEmpty)
return [];
else
throw new Error("Cannot parse given Error object");
}
function parseStack(stackString, options) {
if (stackString.match(CHROME_IE_STACK_REGEXP))
return parseV8OrIeString(stackString, options);
else
return parseFFOrSafariString(stackString, options);
}
function extractLocation(urlLike) {
if (!urlLike.includes(":"))
return [urlLike, undefined, undefined];
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
return [parts[1], parts[2] || undefined, parts[3] || undefined];
}
function applySlice(lines, options) {
if (options && options.slice != null) {
if (Array.isArray(options.slice))
return lines.slice(options.slice[0], options.slice[1]);
return lines.slice(0, options.slice);
}
return lines;
}
function parseV8OrIE(error, options) {
return parseV8OrIeString(error.stack, options);
}
function parseV8OrIeString(stack, options) {
const filtered = applySlice(
stack.split("\n").filter((line) => {
return !!line.match(CHROME_IE_STACK_REGEXP);
}),
options
);
return filtered.map((line) => {
if (line.includes("(eval ")) {
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
}
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
const location = sanitizedLine.match(/ (\(.+\)$)/);
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
const locationParts = extractLocation(location ? location[1] : sanitizedLine);
const functionName = location && sanitizedLine || undefined;
const fileName = ["eval", "<anonymous>"].includes(locationParts[0]) ? undefined : locationParts[0];
return {
function: functionName,
file: fileName,
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
});
}
function parseFFOrSafari(error, options) {
return parseFFOrSafariString(error.stack, options);
}
function parseFFOrSafariString(stack, options) {
const filtered = applySlice(
stack.split("\n").filter((line) => {
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
}),
options
);
return filtered.map((line) => {
if (line.includes(" > eval"))
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
if (!line.includes("@") && !line.includes(":")) {
return {
function: line
};
} else {
const functionNameRegex = /(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/;
const matches = line.match(functionNameRegex);
const functionName = matches && matches[1] ? matches[1] : undefined;
const locationParts = extractLocation(line.replace(functionNameRegex, ""));
return {
function: functionName,
file: locationParts[0],
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
}
});
}
function parseOpera(e, options) {
if (!e.stacktrace || e.message.includes("\n") && e.message.split("\n").length > e.stacktrace.split("\n").length)
return parseOpera9(e);
else if (!e.stack)
return parseOpera10(e);
else
return parseOpera11(e, options);
}
function parseOpera9(e, options) {
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
const lines = e.message.split("\n");
const result = [];
for (let i = 2, len = lines.length; i < len; i += 2) {
const match = lineRE.exec(lines[i]);
if (match) {
result.push({
file: match[2],
line: +match[1],
raw: lines[i]
});
}
}
return applySlice(result, options);
}
function parseOpera10(e, options) {
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
const lines = e.stacktrace.split("\n");
const result = [];
for (let i = 0, len = lines.length; i < len; i += 2) {
const match = lineRE.exec(lines[i]);
if (match) {
result.push({
function: match[3] || undefined,
file: match[2],
line: match[1] ? +match[1] : undefined,
raw: lines[i]
});
}
}
return applySlice(result, options);
}
function parseOpera11(error, options) {
const filtered = applySlice(
// @ts-expect-error missing stack property
error.stack.split("\n").filter((line) => {
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
}),
options
);
return filtered.map((line) => {
const tokens = line.split("@");
const locationParts = extractLocation(tokens.pop());
const functionCall = tokens.shift() || "";
const functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || undefined;
let argsRaw;
if (functionCall.match(/\(([^)]*)\)/))
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, "$1");
const args = argsRaw === undefined || argsRaw === "[arguments not available]" ? undefined : argsRaw.split(",");
return {
function: functionName,
args,
file: locationParts[0],
line: locationParts[1] ? +locationParts[1] : undefined,
col: locationParts[2] ? +locationParts[2] : undefined,
raw: line
};
});
}
export { extractLocation, parse, parseFFOrSafari, parseFFOrSafariString, parseOpera, parseOpera10, parseOpera11, parseOpera9, parseStack, parseV8OrIE, parseV8OrIeString };