{"_id":"@jest/source-map@30.5.2","bugs":{"url":"https://github.com/jestjs/jest/issues"},"dist":{"shasum":"454b15d5709e7b6d81cb5619d68106482b424da0","tarball":"http://registry-npm.ywwl.com/@jest/source-map/download/@jest/source-map-30.5.2.tgz","fileCount":6,"integrity":"sha512-c5CehvkbfHX6yyNg7bMn2ylqlp9AHXuZ/3hPH/Lh5bxD/vefd/lV9HBjMqXef9yQNqkdwyZvkLSVSwB38hy8Qw==","signatures":[{"sig":"MEUCIB2oXy/ELRxqCdf6eZ0XYJUkMUEUwphPnpjjVTvk8X8CAiEAuSwOT9SiCv5sF/Sg5k8CkgYjW0lKj43Bvzr7wTGNDOg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD6xbJi3E6KM1VSfnT+ccyzPkOT+JBQsziywueJNP2D0gIhAPL6HaJZezZXxUnoo6U1VKKQ0qF9uIQr9OVVfbOpS8WD"}],"unpackedSize":36568,"size":11140,"noattachment":false,"key":"/@jest/source-map/-/@jest/source-map-30.5.2.tgz"},"main":"./build/index.js","name":"@jest/source-map","types":"./build/index.d.ts","engines":{"node":"^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/index.mjs","default":"./build/index.js","require":"./build/index.js"},"./package.json":"./package.json"},"gitHead":"202dd8a14777c270607c2416bd5034c3c0abc984","license":"MIT","version":"30.5.2","_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"homepage":"https://github.com/jestjs/jest#readme","repository":{"url":"git+https://github.com/jestjs/jest.git","type":"git","directory":"packages/jest-source-map"},"_npmVersion":"lerna/4.11.5/node@v26.8.1+arm64 (darwin)","description":"Applies source maps to stack traces, so a failing test points at the code you wrote rather than at the code Jest ran.","directories":{},"maintainers":[{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"simenb","email":"sbekkhus91@gmail.com"},{"name":"rickhanlonii","email":"rickhanlonii@gmail.com"},{"name":"openjs-operations","email":"operations@openjsf.org"},{"name":"cpojer","email":"christoph.pojer@gmail.com"}],"_nodeVersion":"26.8.1","dependencies":{"callsites":"^3.1.0","graceful-fs":"^4.2.11","convert-source-map":"^2.0.0","@jridgewell/trace-mapping":"^0.3.31"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/graceful-fs":"^4.1.9","@types/convert-source-map":"^2.0.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/source-map_30.5.2_1789739979879_0.2853447010750796"},"readme":"# @jest/source-map\n\nApplies source maps to stack traces, so a failing test points at the code you wrote rather than at the code Jest ran.\n\nThis is a module used internally by Jest. It exists because `--enable-source-maps` and `module.setSourceMapsSupport()` do not cover code compiled through `vm`, which is how Jest evaluates test files, and because Node offers no way to register a map for a filename — Jest serves maps from its own transform pipeline rather than from `sourceMappingURL` comments on disk.\n\n## Install\n\n```sh\n$ npm install --save @jest/source-map\n```\n\n## API\n\n### `SourceMapSupport#install(sourceMaps?: SourceMapRegistry | null, options?: SourceMapSupportInstallOptions): void`\n\nReplaces `Error.prepareStackTrace` in the current realm, so reading `.stack` on any error renders frames against the original sources. `jest-runner` holds one instance per worker and installs once per test file.\n\n`sourceMaps` maps a transformed file to the `.map` file Jest wrote into its transform cache — inside Jest, `runtime.getSourceMaps()`. The `sources` inside a map resolve with URL semantics against the transformed file, not against the map's own location. Files missing from the registry fall back to a `sourceMappingURL` comment on the file itself, which covers pre-compiled output that ships its own map.\n\n```javascript\nimport {SourceMapSupport} from '@jest/source-map';\n\nconst sourceMapSupport = new SourceMapSupport();\nsourceMapSupport.install(new Map([['/build/app.js', '/cache/app.js.map']]));\n\nnew Error('boom').stack;\n// Error: boom\n//     at greet (/src/app.ts:12:9)\n```\n\nThe formatter stays installed for the lifetime of the process, and each call swaps in a new registry. Nothing is restored, deliberately: an error thrown after a test finishes — a stray timer, a floating promise — is the one users have the hardest time placing, and it would otherwise report a position in the transformed file.\n\nA map that cannot be parsed is reported once via `console.warn`; pass `{suppressWarnings: true}` to turn that off.\n\n### `SourceMapSupport#getCallsite(level: number, sourceMaps?: SourceMapRegistry | null): CallSite`\n\nReturns a single remapped [`CallSite`](https://v8.dev/docs/stack-trace-api#customizing-stack-traces), `level` frames above the caller. Used for `--testLocationInResults`. Shares its parsed maps with the installed formatter, so each `.map` file is read once.\n\n### `getCallsite(level: number, sourceMaps?: SourceMapRegistry | null): CallSite`\n\nDeprecated free-function alias of `SourceMapSupport#getCallsite`.\n\n### `SourceMapRegistry`\n\n`Map<string, string>` — transformed file path to source map path.\n\n## Function names are chosen for readability, not for the spec\n\nA frame is named after the source map's `name` at the frame's **own** position. That name is the identifier being _called_ there rather than the enclosing function, so every frame gets annotated with the call on its line:\n\n```\nat Object.toBeTruthy (assertionCount.test.js:12:17)\nat Object.setTimeout (inside.js:9:3)\n```\n\nThe spec-correct reading takes the name from the _caller's_ position instead. It is what [`source-map-support@0.5.14`](https://github.com/evanw/node-source-map-support/pull/253) switched to, and it collapses the frames above to `Object.<anonymous>`, because V8 has no name of its own for a module-level frame. Positions are identical either way — only names differ, and only where V8 could not name the frame.\n\nThis package optimises for reading a test failure, so it keeps the annotation. If you need the spec semantics, `getCallsite` hands back a `CallSite` you can map yourself.\n","publish_time":1789739979969,"_cnpm_publish_time":1789739979969,"dist-tags":{"latest":"30.5.2","next":"30.0.0-rc.1"}}