bpms_site/.svn/pristine/74/7448bea18c301b6c7ef9599f4f0584c37ec9a850.svn-base
2025-11-02 16:38:49 +03:30

43 lines
1.8 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "parseComponentStack", {
enumerable: true,
get: function() {
return parseComponentStack;
}
});
function parseComponentStack(componentStack) {
const componentStackFrames = [];
for (const line of componentStack.trim().split("\n")){
// Get component and file from the component stack line
const match = /at ([^ ]+)( \((.*)\))?/.exec(line);
if (match == null ? void 0 : match[1]) {
const component = match[1];
const webpackFile = match[3];
// Stop parsing the component stack if we reach a Next.js component
if (webpackFile == null ? void 0 : webpackFile.includes("next/dist")) {
break;
}
const modulePath = webpackFile == null ? void 0 : webpackFile.replace(/^(webpack-internal:\/\/\/|file:\/\/)(\(.*\)\/)?/, "");
var _modulePath_split;
const [file, lineNumber, column] = (_modulePath_split = modulePath == null ? void 0 : modulePath.split(":")) != null ? _modulePath_split : [];
componentStackFrames.push({
component,
file,
lineNumber: lineNumber ? Number(lineNumber) : undefined,
column: column ? Number(column) : undefined
});
}
}
return componentStackFrames;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=parse-component-stack.js.map