{"name":"@jridgewell/source-map","version":"0.3.11","description":"Packages @jridgewell/trace-mapping and @jridgewell/gen-mapping into the familiar source-map API","keywords":["sourcemap","source","map"],"main":"dist/source-map.umd.js","module":"dist/source-map.mjs","types":"types/source-map.d.cts","exports":{".":[{"import":{"types":"./types/source-map.d.mts","default":"./dist/source-map.mjs"},"default":{"types":"./types/source-map.d.cts","default":"./dist/source-map.umd.js"}},"./dist/source-map.umd.js"],"./package.json":"./package.json"},"scripts":{"benchmark":"run-s build:code benchmark:*","benchmark:install":"cd benchmark && npm install","benchmark:only":"node --expose-gc benchmark/index.js","build":"run-s -n build:code build:types","build:code":"node ../../esbuild.mjs source-map.ts","build:types":"run-s build:types:force build:types:emit build:types:mts","build:types:force":"rimraf tsconfig.build.tsbuildinfo","build:types:emit":"tsc --project tsconfig.build.json","build:types:mts":"node ../../mts-types.mjs","clean":"run-s -n clean:code clean:types","clean:code":"tsc --build --clean tsconfig.build.json","clean:types":"rimraf dist types","test":"run-s -n test:types test:only test:format","test:format":"prettier --check '{src,test}/**/*.ts'","test:only":"mocha","test:types":"eslint '{src,test}/**/*.ts'","lint":"run-s -n lint:types lint:format","lint:format":"npm run test:format -- --write","lint:types":"npm run test:types -- --fix","prepublishOnly":"npm run-s -n build test"},"homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/source-map","repository":{"type":"git","url":"git+https://github.com/jridgewell/sourcemaps.git","directory":"packages/source-map"},"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.25"},"_id":"@jridgewell/source-map@0.3.11","gitHead":"095a5825c482003597a30aa380b50159219f3618","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"_nodeVersion":"24.4.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==","shasum":"b21835cbd36db656b857c2ad02ebd413cc13a9ba","tarball":"http://registry-npm.ywwl.com/@jridgewell/source-map/download/@jridgewell/source-map-0.3.11.tgz","fileCount":12,"unpackedSize":33473,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC79JET7UH0nCL5ToBNT7u911z1nYIrq5USicQODXohSAiEAs76qUo3xVSwG9OXb7LQI9EIUM8YxqABxLq44WjwsD10="}],"size":7371,"noattachment":false,"key":"/@jridgewell/source-map/-/@jridgewell/source-map-0.3.11.tgz"},"_npmUser":{"name":"jridgewell","email":"justin+npm@ridgewell.name"},"directories":{},"maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/source-map_0.3.11_1754981026238_0.9230700533960869"},"_hasShrinkwrap":false,"readme":"# @jridgewell/source-map\n\n> Packages `@jridgewell/trace-mapping` and `@jridgewell/gen-mapping` into the familiar source-map API\n\nThis isn't the full API, but it's the core functionality. This wraps\n[@jridgewell/trace-mapping][trace-mapping] and [@jridgewell/gen-mapping][gen-mapping]\nimplementations.\n\n## Installation\n\n```sh\nnpm install @jridgewell/source-map\n```\n\n## Usage\n\nTODO\n\n### SourceMapConsumer\n\n```typescript\nimport { SourceMapConsumer } from '@jridgewell/source-map';\nconst smc = new SourceMapConsumer({\n  version: 3,\n  names: ['foo'],\n  sources: ['input.js'],\n  mappings: 'AAAAA',\n});\n```\n\n#### SourceMapConsumer.fromSourceMap(mapGenerator[, mapUrl])\n\nTransforms a `SourceMapGenerator` into a `SourceMapConsumer`.\n\n```typescript\nconst smg = new SourceMapGenerator();\n\nconst smc = SourceMapConsumer.fromSourceMap(map);\nsmc.originalPositionFor({ line: 1, column: 0 });\n```\n\n#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.originalPositionFor({ line: 1, column: 0 });\n```\n\n#### SourceMapConsumer.prototype.mappings\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.mappings; // AAAA\n```\n\n#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.allGeneratedpositionsfor({ line: 1, column: 5, source: \"baz.ts\" });\n// [\n//   { line: 2, column: 8 }\n// ]\n```\n\n#### SourceMapConsumer.prototype.eachMapping(callback[, context[, order]])\n\n> This implementation currently does not support the \"order\" parameter.\n> This function can only iterate in Generated order.\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.eachMapping((mapping) => {\n// { source: 'baz.ts',\n//   generatedLine: 4,\n//   generatedColumn: 5,\n//   originalLine: 4,\n//   originalColumn: 5,\n//   name: null }\n});\n```\n\n#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.generatedPositionFor({ line: 1, column: 5, source: \"baz.ts\" });\n// { line: 2, column: 8 }\n```\n\n#### SourceMapConsumer.prototype.hasContentsOfAllSources()\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.hasContentsOfAllSources();\n// true\n```\n\n#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])\n\n```typescript\nconst smc = new SourceMapConsumer(map);\nsmc.generatedPositionFor(\"baz.ts\");\n// \"export default ...\"\n```\n\n#### SourceMapConsumer.prototype.version\n\nReturns the source map's version\n\n### SourceMapGenerator\n\n```typescript\nimport { SourceMapGenerator } from '@jridgewell/source-map';\nconst smg = new SourceMapGenerator({\n  file: 'output.js',\n  sourceRoot: 'https://example.com/',\n});\n```\n\n#### SourceMapGenerator.fromSourceMap(map)\n\nTransform a `SourceMapConsumer` into a `SourceMapGenerator`.\n\n```typescript\nconst smc = new SourceMapConsumer();\nconst smg = SourceMapGenerator.fromSourceMap(smc);\n```\n\n#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])\n\n> This method is not implemented yet\n\n#### SourceMapGenerator.prototype.addMapping(mapping)\n\n```typescript\nconst smg = new SourceMapGenerator();\nsmg.addMapping({\n  generated: { line: 1, column: 0 },\n  source: 'input.js',\n  original: { line: 1, column: 0 },\n  name: 'foo',\n});\n```\n\n#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)\n\n```typescript\nconst smg = new SourceMapGenerator();\nsmg.setSourceContent('input.js', 'foobar');\n```\n\n#### SourceMapGenerator.prototype.toJSON()\n\n```typescript\nconst smg = new SourceMapGenerator();\nsmg.toJSON(); // { version: 3, names: [], sources: [], mappings: '' }\n```\n\n#### SourceMapGenerator.prototype.toString()\n\n```typescript\nconst smg = new SourceMapGenerator();\nsmg.toJSON(); // \"{version:3,names:[],sources:[],mappings:''}\"\n```\n\n#### SourceMapGenerator.prototype.toDecodedMap()\n\n```typescript\nconst smg = new SourceMapGenerator();\nsmg.toDecodedMap(); // { version: 3, names: [], sources: [], mappings: [] }\n```\n\n## Known differences with other implementations\n\nThis implementation has some differences with `source-map` and `source-map-js`.\n\n- `SourceMapConsumer.prototype.eachMapping()`\n  - Does not support the `order` argument\n- `SourceMapGenerator.prototype.applySourceMap()`\n  - Not implemented\n\n[trace-mapping]: https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping/\n[gen-mapping]: https://github.com/jridgewell/sourcemaps/tree/main/packages/gen-mapping/\n","publish_time":1754981026471,"_cnpm_publish_time":1754981026471,"dist-tags":{"latest":"0.3.11"}}