3 lines
710 B
JavaScript
3 lines
710 B
JavaScript
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
function a(r,s,t){if(!r)return r;let e=r.replace(/\n\s+at\s.*/g,"");return t&&(e=e.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),e=e.replace(s?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),e=e.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),e=e.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),t&&(e=e.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),e}function n(r){return a(r,!1,!1)}function i(r){return a(r,!0,!0)}export{n as a,i as b};
|