{"_id":"@_baba/stack-mapper","name":"@_baba/stack-mapper","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@_baba/stack-mapper","version":"0.0.1","description":"A CLI tool to map stack traces to source code.","bin":{"stackmapper":"bin/cli.js"},"main":"./dist/cli.js","keywords":["sourcemap","source-map","stack","stacktrace","stack-trace","debug","cli","error","errors","node","nodejs","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/BABA983/stack-mapper.git"},"author":{"name":"BABA","email":"raoqidi@foxmail.com"},"license":"MIT","scripts":{"dev":"tsc --watch","build":"rimraf dist && ./node_modules/.bin/tsc -p tsconfig.build.json","test":"vitest"},"dependencies":{"commander":"^12.1.0","source-map":"^0.7.4","stacktrace-parser":"^0.1.10"},"devDependencies":{"@types/node":"^20.16.5","rimraf":"^6.0.1","typescript":"^5.6.2","vitest":"^2.1.0"},"engines":{"node":">=20.14.0"},"_id":"@_baba/stack-mapper@0.0.1","gitHead":"f643157e9a077a6e9331623394108e981aee673e","bugs":{"url":"https://github.com/BABA983/stack-mapper/issues"},"homepage":"https://github.com/BABA983/stack-mapper#readme","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-0q8+rheL7VxdyC4Sf1yx/tXdrCRVgbSKvRzUwGe7kk5Fa0L5kl0948hFHJXwKW1O2oRgC6T4a6v4CTiGLoJmxw==","shasum":"4db2feab7870efa91ae6be4f638a5041eaded1c3","tarball":"https://registry.npmjs.org/@_baba/stack-mapper/-/stack-mapper-0.0.1.tgz","fileCount":7,"unpackedSize":12981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICqMNqYQEgqvRRhgVgBpDM9zpEeds59Qrt/1n2pM3qxLAiEAvdHGDgkO42p5PjYKUqvJsCKVxvJ4VRlQ6egrmtBIFok="}]},"_npmUser":{"name":"_baba","email":"raoqidi@foxmail.com"},"directories":{},"maintainers":[{"name":"_baba","email":"raoqidi@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stack-mapper_0.0.1_1726243813342_0.5912038302593294"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-13T16:10:13.219Z","0.0.1":"2024-09-13T16:10:13.474Z","modified":"2024-09-13T16:10:13.711Z"},"maintainers":[{"name":"_baba","email":"raoqidi@foxmail.com"}],"description":"A CLI tool to map stack traces to source code.","homepage":"https://github.com/BABA983/stack-mapper#readme","keywords":["sourcemap","source-map","stack","stacktrace","stack-trace","debug","cli","error","errors","node","nodejs","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/BABA983/stack-mapper.git"},"author":{"name":"BABA","email":"raoqidi@foxmail.com"},"bugs":{"url":"https://github.com/BABA983/stack-mapper/issues"},"license":"MIT","readme":"# stack-mapper\n\nA CLI tool to map stack traces to source code.\n\n## Usage\n\n```bash\n$ npm install -g @_baba/stack-mapper\n\nUsage: stackmapper [options]\n\nOptions:\n  -v, --version         output the version number\n  -s, --stack <string>  The error stack trace\n  -m, --map <string>    The source map directory\n  --verbose             Verbose output (default: false)\n  -h, --help            display help for command\n```\n\n## Example\n\n```bash\n$ stack-mapper -s \"TypeError: Cannot read properties of undefined (reading 'children')\n    at tab.js:2:2942105\n    at Array.map (<anonymous>)\n    at Hk (tab.js:2:2941959)\n    at ii (tab.js:2:248044)\n    at Ui (tab.js:2:257436)\n    at qc (tab.js:2:300769)\n    at Ol (tab.js:2:287143)\n    at Sl (tab.js:2:287071)\n    at El (tab.js:2:286934)\n    at yl (tab.js:2:283931)\" -m \"./\"\n------- STACK TRACE -------\nTypeError: Cannot read properties of undefined (reading 'children')\n    at children (webpack://app-tab/src/components/AppTab/index.tsx:443:32)\n    at Array.map (<anonymous>:null:null)\n    at map (webpack://app-tab/src/components/AppTab/index.tsx:431:34)\n    at c (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:157:243)\n    at Ch (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:180:153)\n    at li (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:269:342)\n    at ck (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:250:346)\n    at bk (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:250:277)\n    at ak (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:250:137)\n    at Tj (webpack://app-tab/node_modules/react-dom/cjs/react-dom.production.min.js:243:162)\n```\n\n## Testing\n\nThe fixtures are generated from the [vite](https://vitejs.dev/)\n\n```ts\nexport function setupCounter(element: HTMLButtonElement) {\n  let counter = 0;\n  console.log(new Error(\"test\").stack);\n  const setCounter = (count: number) => {\n    counter = count;\n    element.innerHTML = `count is ${counter}`;\n  };\n  element.addEventListener(\"click\", () => setCounter(counter + 1));\n  setCounter(0);\n}\n```\n\n## Why I wrote this tool\n\n`sourcemapping` is the tool that I used in the past, but it is not maintained for a long time and sometime I found that it was not working for some reason.\n\nI never write a CLI tool like this before, so I just try to write a new one ;)\n\n## Reference\n\n- [source-map](https://github.com/mozilla/source-map)\n- [stacktrace-parser](https://github.com/stacktracejs/stacktrace-parser)\n- [sourcemapping](https://github.com/7ippo/sourcemapping)","readmeFilename":"README.md"}