{"id":13403769,"url":"https://github.com/evanw/node-source-map-support","last_synced_at":"2025-09-23T12:49:06.898Z","repository":{"id":6443384,"uuid":"7682781","full_name":"evanw/node-source-map-support","owner":"evanw","description":"Adds source map support to node.js (for stack traces)","archived":false,"fork":false,"pushed_at":"2024-08-03T12:06:40.000Z","size":1061,"stargazers_count":2193,"open_issues_count":127,"forks_count":225,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-09-15T04:42:14.337Z","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/evanw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2013-01-18T07:59:12.000Z","updated_at":"2025-09-13T22:04:29.000Z","dependencies_parsed_at":"2024-11-05T23:03:46.214Z","dependency_job_id":"d57f8690-6334-4858-925b-afcc444e2b34","html_url":"https://github.com/evanw/node-source-map-support","commit_stats":{"total_commits":253,"total_committers":73,"mean_commits":"3.4657534246575343","dds":0.6600790513833992,"last_synced_commit":"7b5b81eb14c9ee6c6537398262bf7dab8580621c"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/evanw/node-source-map-support","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fnode-source-map-support","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fnode-source-map-support/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fnode-source-map-support/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fnode-source-map-support/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evanw","download_url":"https://codeload.github.com/evanw/node-source-map-support/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fnode-source-map-support/sbom","scorecard":{"id":385858,"data":{"date":"2025-08-11","repo":{"name":"github.com/evanw/node-source-map-support","commit":"7b5b81eb14c9ee6c6537398262bf7dab8580621c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":2,"reason":"Found 5/17 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"43 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-jc84-3g44-wf2q","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-qg8p-v9q4-gh34","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-34r7-q49f-h37c","Warn: Project is vulnerable to: GHSA-c9f4-xj24-8jqx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T16:35:45.293Z","repository_id":6443384,"created_at":"2025-08-18T16:35:45.293Z","updated_at":"2025-08-18T16:35:45.293Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275260479,"owners_count":25433379,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-07-30T19:01:34.359Z","updated_at":"2025-09-23T12:49:06.862Z","avatar_url":"https://github.com/evanw.png","language":"JavaScript","readme":"# Source Map Support\n[![Build Status](https://travis-ci.org/evanw/node-source-map-support.svg?branch=master)](https://travis-ci.org/evanw/node-source-map-support)\n\nThis module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.\n\n## Installation and Usage\n\n#### Node support\n\n##### Node \u003e=12.12.0\n\nThis package is no longer required as [Node 12.12.0 introduced the `--enable-source-maps` flag.](https://nodejs.org/docs/latest-v16.x/api/cli.html#--enable-source-maps) (unless you're using the [`vm`](https://nodejs.org/api/vm.html) module, as `--enable-source-maps` does not work with `vm.runInThisContext`). \n\n##### Node \u003c12.12.0\n\n```\n$ npm install source-map-support\n```\n\nSource maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):\n\n```\n//# sourceMappingURL=path/to/source.map\n```\n\nIf multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be\nrespected (e.g. if a file mentions the comment in code, or went through multiple transpilers).\nThe path should either be absolute or relative to the compiled file.\n\nFrom here you have two options.\n\n##### CLI Usage\n\n```bash\nnode -r source-map-support/register compiled.js\n```\n\n##### Programmatic Usage\n\nPut the following line at the top of the compiled file.\n\n```js\nrequire('source-map-support').install();\n```\n\nIt is also possible to install the source map support directly by\nrequiring the `register` module which can be handy with ES6:\n\n```js\nimport 'source-map-support/register'\n\n// Instead of:\nimport sourceMapSupport from 'source-map-support'\nsourceMapSupport.install()\n```\nNote: if you're using babel-register, it includes source-map-support already.\n\nIt is also very useful with Mocha:\n\n```\n$ mocha --require source-map-support/register tests/\n```\n\n#### Browser support\n\nThis library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code.\n\nThis library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify.\n\n```html\n\u003cscript src=\"browser-source-map-support.js\"\u003e\u003c/script\u003e\n\u003cscript\u003esourceMapSupport.install();\u003c/script\u003e\n```\n\nThis library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency:\n\n```html\n\u003cscript\u003e\n  define(['browser-source-map-support'], function(sourceMapSupport) {\n    sourceMapSupport.install();\n  });\n\u003c/script\u003e\n```\n\n## Options\n\nThis module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer:\n\n```js\nrequire('source-map-support').install({\n  handleUncaughtExceptions: false\n});\n```\n\nThis module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access.\n\n```js\nrequire('source-map-support').install({\n  retrieveSourceMap: function(source) {\n    if (source === 'compiled.js') {\n      return {\n        url: 'original.js',\n        map: fs.readFileSync('compiled.js.map', 'utf8')\n      };\n    }\n    return null;\n  }\n});\n```\n\nThe module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment.\nIn some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'.\n\n```js\nrequire('source-map-support').install({\n  environment: 'node'\n});\n```\n\nTo support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps.\n\n\n```js\nrequire('source-map-support').install({\n  hookRequire: true\n});\n```\n\nThis monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage.\n\n## Demos\n\n#### Basic Demo\n\noriginal.js:\n\n```js\nthrow new Error('test'); // This is the original code\n```\n\ncompiled.js:\n\n```js\nrequire('source-map-support').install();\n\nthrow new Error('test'); // This is the compiled code\n// The next line defines the sourceMapping.\n//# sourceMappingURL=compiled.js.map\n```\n\ncompiled.js.map:\n\n```json\n{\n  \"version\": 3,\n  \"file\": \"compiled.js\",\n  \"sources\": [\"original.js\"],\n  \"names\": [],\n  \"mappings\": \";;AAAA,MAAM,IAAI\"\n}\n```\n\nRun compiled.js using node (notice how the stack trace uses original.js instead of compiled.js):\n\n```\n$ node compiled.js\n\noriginal.js:1\nthrow new Error('test'); // This is the original code\n      ^\nError: test\n    at Object.\u003canonymous\u003e (original.js:1:7)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n    at node.js:901:3\n```\n\n#### TypeScript Demo\n\ndemo.ts:\n\n```typescript\ndeclare function require(name: string);\nrequire('source-map-support').install();\nclass Foo {\n  constructor() { this.bar(); }\n  bar() { throw new Error('this is a demo'); }\n}\nnew Foo();\n```\n\nCompile and run the file using the TypeScript compiler from the terminal:\n\n```\n$ npm install source-map-support typescript\n$ node_modules/typescript/bin/tsc -sourcemap demo.ts\n$ node demo.js\n\ndemo.ts:5\n  bar() { throw new Error('this is a demo'); }\n                ^\nError: this is a demo\n    at Foo.bar (demo.ts:5:17)\n    at new Foo (demo.ts:4:24)\n    at Object.\u003canonymous\u003e (demo.ts:7:1)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n    at node.js:901:3\n```\n\nThere is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('source-map-support').install()` in the code base:\n\n```\n$ npm install source-map-support typescript\n$ node_modules/typescript/bin/tsc  -sourcemap demo.ts\n$ node -r source-map-support/register demo.js\n\ndemo.ts:5\n  bar() { throw new Error('this is a demo'); }\n                ^\nError: this is a demo\n    at Foo.bar (demo.ts:5:17)\n    at new Foo (demo.ts:4:24)\n    at Object.\u003canonymous\u003e (demo.ts:7:1)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n    at node.js:901:3\n```\n\n#### CoffeeScript Demo\n\ndemo.coffee:\n\n```coffee\nrequire('source-map-support').install()\nfoo = -\u003e\n  bar = -\u003e throw new Error 'this is a demo'\n  bar()\nfoo()\n```\n\nCompile and run the file using the CoffeeScript compiler from the terminal:\n\n```sh\n$ npm install source-map-support coffeescript\n$ node_modules/.bin/coffee --map --compile demo.coffee\n$ node demo.js\n\ndemo.coffee:3\n  bar = -\u003e throw new Error 'this is a demo'\n                     ^\nError: this is a demo\n    at bar (demo.coffee:3:22)\n    at foo (demo.coffee:4:3)\n    at Object.\u003canonymous\u003e (demo.coffee:5:1)\n    at Object.\u003canonymous\u003e (demo.coffee:1:1)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n```\n\n## Tests\n\nThis repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests:\n\n* Build the tests using `build.js`\n* Launch the HTTP server (`npm run serve-tests`) and visit\n  * http://127.0.0.1:1336/amd-test\n  * http://127.0.0.1:1336/browser-test\n  * http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details).\n* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/\n\n## License\n\nThis code is available under the [MIT license](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanw%2Fnode-source-map-support","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevanw%2Fnode-source-map-support","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanw%2Fnode-source-map-support/lists"}