{"id":28166571,"url":"https://github.com/daniel-sc/js-stacktrace-sourcemapper","last_synced_at":"2025-10-17T01:57:22.693Z","repository":{"id":292951198,"uuid":"979153471","full_name":"daniel-sc/js-stacktrace-sourcemapper","owner":"daniel-sc","description":"Simple CLI tool that converts minified js stack traces to original source code locations using source maps.","archived":false,"fork":false,"pushed_at":"2025-05-07T04:51:41.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T00:48:49.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel-sc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-07T04:41:24.000Z","updated_at":"2025-05-07T04:54:39.000Z","dependencies_parsed_at":"2025-05-13T00:48:51.185Z","dependency_job_id":"62b8d625-7b37-44e0-8eb3-2812336f8d40","html_url":"https://github.com/daniel-sc/js-stacktrace-sourcemapper","commit_stats":null,"previous_names":["daniel-sc/js-stacktrace-sourcemapper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Fjs-stacktrace-sourcemapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Fjs-stacktrace-sourcemapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Fjs-stacktrace-sourcemapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Fjs-stacktrace-sourcemapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-sc","download_url":"https://codeload.github.com/daniel-sc/js-stacktrace-sourcemapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346569,"owners_count":22055809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-15T13:13:29.742Z","updated_at":"2025-10-17T01:57:22.686Z","avatar_url":"https://github.com/daniel-sc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-stacktrace-sourcemapper\n\nA simple CLI script to map stack traces of minified js/ts to original files and method names via source maps.\n\n## Installation\n\n```bash\n# clone the repo:\ngit clone git@github.com:daniel-sc/js-stacktrace-sourcemapper.git\ncd js-stacktrace-sourcemapper\n# install dependencies:\nbun install\n# or\nnpm install \u0026\u0026 node_modules/.bin/tsc remap.ts\n```\n\n## Usage\n\n```bash\nbun run remap.ts \u003cstacktrace-file\u003e\n# or\nnode remap.js \u003cstacktrace-file\u003e\n# or\ndeno run --compat --allow-net --allow-read remap.ts \u003cstacktrace-file\u003e\n```\n\nAlternatively, the stacktrace can be provided via stdin.\n\n## Example\n\nMinified stack trace:\n```\nError: NG0911\n    at mf (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:9266)\n    at Qo.onDestroy (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:21214)\n    at new Jo (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:33856)\n    at sp (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34594)\n    at aD (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34264)\n    at e._subscribe (https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js:1:14564)\n    at e._trySubscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5248)\n    at https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5191\n    at cn (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:2231)\n    at e.subscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5107)\n```\nCommand:\n```bash\nbun run remap.ts stacktrace.txt\n```\nOutput:\n```\nbun run .\\remap.ts .\\stack.txt\n[DEBUG] Script started\n[DEBUG] Input length: 809\n[DEBUG] Starting remapping\n[DEBUG] Preloading source maps\n[DEBUG] Loading source map for https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js\n[DEBUG] getSourceMapConsumer for https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js\n[DEBUG] Fetching URL: https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js\n[DEBUG] Fetched 265619 bytes from https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js\n[DEBUG] Extracting sourceMappingURL\n[DEBUG] sourceMappingURL found: chunk-YIFPV4U7.js.map\n[DEBUG] Resolved source map URL: https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js.map\n[DEBUG] Fetching URL: https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js.map\n[DEBUG] Fetched 2831319 bytes from https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js.map\n[DEBUG] Created SourceMapConsumer for https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js\n[DEBUG] Loading source map for https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js\n[DEBUG] getSourceMapConsumer for https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js\n[DEBUG] Fetching URL: https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js\n[DEBUG] Fetched 165037 bytes from https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js\n[DEBUG] Extracting sourceMappingURL\n[DEBUG] sourceMappingURL found: chunk-SN376BRJ.js.map\n[DEBUG] Resolved source map URL: https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js.map\n[DEBUG] Fetching URL: https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js.map\n[DEBUG] Fetched 516586 bytes from https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js.map\n[DEBUG] Created SourceMapConsumer for https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js\n[DEBUG] Remapping frames\n[DEBUG] Line: Error: NG0911\n[DEBUG] Line:     at mf (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:9266)\n[DEBUG] Mapped at mf (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:9266) -\u003e at mf (node_modules/@angular/core/fesm2022/core.mjs:3388:10)\n[DEBUG] Line:     at Qo.onDestroy (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:21214)\n[DEBUG] Mapped at Qo.onDestroy (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:21214) -\u003e at storeLViewOnDestroy (node_modules/@angular/core/fesm2022/core.mjs:5904:4)    \n[DEBUG] Line:     at new Jo (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:33856)\n[DEBUG] Mapped at new Jo (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:33856) -\u003e at onDestroy (node_modules/@angular/core/fesm2022/core.mjs:8671:43)\n[DEBUG] Line:     at sp (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34594)\n[DEBUG] Mapped at sp (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34594) -\u003e at sp (node_modules/@angular/core/fesm2022/core.mjs:8729:19)\n[DEBUG] Line:     at aD (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34264)\n[DEBUG] Mapped at aD (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:7:34264) -\u003e at afterRenderImpl (node_modules/@angular/core/fesm2022/core.mjs:8705:9)\n[DEBUG] Line:     at e._subscribe (https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js:1:14564)\n[DEBUG] Mapped at e._subscribe (https://cargodigital.sbbcargo.com/fr/chunk-SN376BRJ.js:1:14564) -\u003e at afterNextRender (node_modules/@sbb-esta/angular/fesm2022/autocomplete.mjs:715:8)\n[DEBUG] Line:     at e._trySubscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5248)\n[DEBUG] Mapped at e._trySubscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5248) -\u003e at _subscribe (node_modules/rxjs/dist/esm/internal/Observable.js:34:20)       \n[DEBUG] Line:     at https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5191\n[DEBUG] Mapped at https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5191 -\u003e at _trySubscribe (node_modules/rxjs/dist/esm/internal/Observable.js:28:114)\n[DEBUG] Line:     at cn (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:2231)\n[DEBUG] Mapped at cn (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:2231) -\u003e at cb (node_modules/rxjs/dist/esm/internal/util/errorContext.js:24:4)\n[DEBUG] Line:     at e.subscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5107)\n[DEBUG] Mapped at e.subscribe (https://cargodigital.sbbcargo.com/fr/chunk-YIFPV4U7.js:3:5107) -\u003e at errorContext (node_modules/rxjs/dist/esm/internal/Observable.js:23:6)\n[DEBUG] Completed remapping\nError: NG0911\n    at mf (node_modules/@angular/core/fesm2022/core.mjs:3388:10)\n    at storeLViewOnDestroy (node_modules/@angular/core/fesm2022/core.mjs:5904:4)\n    at onDestroy (node_modules/@angular/core/fesm2022/core.mjs:8671:43)\n    at sp (node_modules/@angular/core/fesm2022/core.mjs:8729:19)\n    at afterRenderImpl (node_modules/@angular/core/fesm2022/core.mjs:8705:9)\n    at afterNextRender (node_modules/@sbb-esta/angular/fesm2022/autocomplete.mjs:715:8)\n    at _subscribe (node_modules/rxjs/dist/esm/internal/Observable.js:34:20)\n    at _trySubscribe (node_modules/rxjs/dist/esm/internal/Observable.js:28:114)\n    at cb (node_modules/rxjs/dist/esm/internal/util/errorContext.js:24:4)\n    at errorContext (node_modules/rxjs/dist/esm/internal/Observable.js:23:6)\n```\n\n## Alternate Format Support\n\nThis tool also supports Firefox-style stack frames of the form:\n\n```\nI@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:3:35165\nMc@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:7:8322\nonDestroy@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:7:12992\nao@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:7:91814\nJC@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:7:92471\n@https://cargodigital.sbbcargo.com/de/chunk-QPFVX7ZD.js:5:7001\n_trySubscribe@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:3:5260\n@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:3:5206\nRn@https://cargodigital.sbbcargo.com/de/chunk-J6REQCBN.js:3:2232\n```\n\nWhen remapped, these lines are rewritten to their original sources, preserving the `name@file:line:column` style (or `@file:line:column` when no function name is present).\n\n## Caching\n\nTo avoid repeated network requests, fetched JavaScript files and source maps are cached on disk.\n\n- Default cache directory: `.sourcemapper-cache` (created alongside the script)\n- Override via env var: set `STACKTRACE_SOURCEMAP_CACHE_DIR` to a custom path\n\nOn subsequent runs, resources are read from the cache if present, so a fully cached stacktrace requires no network access.\n\n\n## Status\n\nThis was a quick hack to get the job done. \nIt works for me, but it is not a polished solution. \nFeel free to improve it and send a PR.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-sc%2Fjs-stacktrace-sourcemapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-sc%2Fjs-stacktrace-sourcemapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-sc%2Fjs-stacktrace-sourcemapper/lists"}