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

22
node_modules/error-stack-parser-es/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2023-PRESENT Anthony Fu <https://github.com/antfu>
Copyright (c) 2017 Eric Wendelin and other 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.

40
node_modules/error-stack-parser-es/README.md generated vendored Normal file
View File

@@ -0,0 +1,40 @@
# error-stack-parser-es
[![NPM version](https://img.shields.io/npm/v/error-stack-parser-es?color=a1b858&label=)](https://www.npmjs.com/package/error-stack-parser-es)
A port of [stacktracejs/error-stack-parser](https://github.com/stacktracejs/error-stack-parser), rewrite with TypeScript and ES Modules.
## Usage
```ts
import { parse } from 'error-stack-parser-es'
const stacktrace = parse(new Error('BOOM!'))
```
Refer to [stacktracejs/error-stack-parser](https://github.com/stacktracejs/error-stack-parser) for more details.
### Lite API
Additionally, this fork added a lite version of the API representation for the stack frames. You can import it from `error-stack-parser-es/lite`. For example, `line` and `col` instead of `lineNumber` and `columnNumber`.
```ts
import { parse } from 'error-stack-parser-es/lite'
const stacktrace = parse(new Error('BOOM!'))
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]
```
It also allows you to parse directly from a stacktrace string (which does not support Opera stacktrace format).
```ts
import { parseStack } from 'error-stack-parser-es/lite'
const stacktrace = parseStack('Error\n at method (file.js:1:2)')
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]
```
## License
[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
[MIT](./LICENSE) License © 2017 [Eric Wendelin](https://github.com/eriwen)

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 };

83
node_modules/error-stack-parser-es/package.json generated vendored Normal file
View File

@@ -0,0 +1,83 @@
{
"name": "error-stack-parser-es",
"type": "module",
"version": "1.0.5",
"packageManager": "pnpm@9.15.3",
"description": "Cross-browser Error parser",
"maintainers": [
"Anthony Fu <anthonyfu117@hotmail.com> (https://antfu.me)",
"Eric Wendelin <me@eriwen.com> (https://www.eriwen.com)",
"Victor Homyakov <vkhomyackov@gmail.com> (https://github.com/victor-homyakov)",
"Oliver Salzburg (https://github.com/oliversalzburg)",
"Ben Gourley (https://github.com/bengourley)"
],
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/antfu/error-stack-parser-es#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/error-stack-parser-es.git"
},
"bugs": "https://github.com/antfu/error-stack-parser-es/issues",
"keywords": [],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./lite": {
"types": "./dist/lite.d.ts",
"import": "./dist/lite.mjs",
"require": "./dist/lite.cjs"
}
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./dist/index.d.ts"
]
}
},
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub",
"lint": "eslint .",
"prepublishOnly": "nr build",
"release": "bumpp && npm publish",
"start": "esno src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@antfu/eslint-config": "^3.12.2",
"@antfu/ni": "^23.2.0",
"@antfu/utils": "^8.0.0",
"@types/node": "^22.10.5",
"bumpp": "^9.9.3",
"eslint": "^9.17.0",
"esno": "^4.8.0",
"lint-staged": "^15.3.0",
"pnpm": "^9.15.3",
"rimraf": "^6.0.1",
"simple-git-hooks": "^2.11.1",
"typescript": "^5.7.3",
"unbuild": "^3.2.0",
"vite": "^6.0.7",
"vitest": "^2.1.8"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}