{"_id":"@jridgewell/remapping","_rev":"5-2398e3ba04b4ab5dcb981986aac3925e","name":"@jridgewell/remapping","dist-tags":{"latest":"2.3.5"},"versions":{"2.3.1":{"name":"@jridgewell/remapping","version":"2.3.1","keywords":["source","map","remap"],"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","_id":"@jridgewell/remapping@2.3.1","maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"dist":{"shasum":"5bae581e59f0d18903b68b3d0d428794881c667c","tarball":"https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.1.tgz","fileCount":32,"integrity":"sha512-ZFTwvLNs3+zzLZDxsVsWhgXNFhAq6UvcbgcN+mbO5D+rtyl4+Qjp4Haz79zj4bGmc6gUb+qOP1nHR8ij9qFliQ==","signatures":[{"sig":"MEQCIErG+JF8AK1H9kHnAYPUcN0qKIvnb/YPf4xqE4yiV/2QAiBSuXvl9v3rqZ8QZmtTG6fXX+EEHX2bR8O+mkGDgwtFtg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58016},"main":"dist/remapping.umd.js","types":"types/remapping.d.cts","module":"dist/remapping.mjs","exports":{".":[{"import":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"},"browser":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"},"require":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"},"module-sync":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"}},"./dist/remapping.umd.js"],"./package.json":"./package.json"},"gitHead":"90648758f7150574cf6cfd073acadb86f37cf24f","scripts":{"lint":"run-s -n lint:types lint:format","test":"run-s -n test:types test:only test:format","build":"run-s -n build:code build:types","clean":"run-s -n clean:code clean:types","benchmark":"run-s build:code benchmark:*","test:only":"mocha","build:code":"node ../../esbuild.mjs remapping.ts","clean:code":"tsc --build --clean tsconfig.build.json","lint:types":"npm run test:types -- --fix","test:types":"eslint '{src,test}/**/*.ts'","build:types":"run-s build:types:force build:types:emit build:types:mts","clean:types":"rimraf dist types","lint:format":"npm run test:format -- --write","test:format":"prettier --check '{src,test}/**/*.ts'","benchmark:only":"node --expose-gc benchmark/index.js","prepublishOnly":"npm run-s -n build test","build:types:mts":"node ../../mts-types.mjs","build:types:emit":"tsc --project tsconfig.build.json","benchmark:install":"cd benchmark && npm install","build:types:force":"rimraf tsconfig.build.tsbuildinfo"},"_npmUser":{"name":"jridgewell","actor":{"name":"jridgewell","type":"user","email":"justin+npm@ridgewell.name"},"email":"justin+npm@ridgewell.name"},"repository":{"url":"git+https://github.com/jridgewell/sourcemaps.git","type":"git","directory":"packages/remapping"},"_npmVersion":"10.2.3","description":"Remap sequential sourcemaps through transformations to point at the original source code","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.24"},"_hasShrinkwrap":false,"devDependencies":{"source-map":"0.6.1"},"_npmOperationalInternal":{"tmp":"tmp/remapping_2.3.1_1751233442325_0.9587459729845582","host":"s3://npm-registry-packages-npm-production"}},"2.3.2":{"name":"@jridgewell/remapping","version":"2.3.2","keywords":["source","map","remap"],"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","_id":"@jridgewell/remapping@2.3.2","maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"dist":{"shasum":"c02bc3d1664fd6dae3ba78fff47b146459933ec3","tarball":"https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.2.tgz","fileCount":32,"integrity":"sha512-nVdLIUMnRtrxDxcIBdeGltzPyvrtC3/d4DrUQcL4nCL1cubAnX6ROIPXFi0XWSMHuiyH+oUPVY+g7WEovMhXcg==","signatures":[{"sig":"MEUCICE2zmM6QIYs1kmdbBolUPv3BEiWbnT12lF2cGBFm1llAiEAzwxNFT124/m7qa7LeP0pSmy5ZFAKhSuvYOPtqR3oOCQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57890},"main":"dist/remapping.umd.js","types":"types/remapping.d.cts","module":"dist/remapping.mjs","exports":{".":[{"import":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"},"browser":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"},"require":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"}},"./dist/remapping.umd.js"],"./package.json":"./package.json"},"gitHead":"dad47801cf1793389c88aeea2b2f688e98113eaa","scripts":{"lint":"run-s -n lint:types lint:format","test":"run-s -n test:types test:only test:format","build":"run-s -n build:code build:types","clean":"run-s -n clean:code clean:types","benchmark":"run-s build:code benchmark:*","test:only":"mocha","build:code":"node ../../esbuild.mjs remapping.ts","clean:code":"tsc --build --clean tsconfig.build.json","lint:types":"npm run test:types -- --fix","test:types":"eslint '{src,test}/**/*.ts'","build:types":"run-s build:types:force build:types:emit build:types:mts","clean:types":"rimraf dist types","lint:format":"npm run test:format -- --write","test:format":"prettier --check '{src,test}/**/*.ts'","benchmark:only":"node --expose-gc benchmark/index.js","prepublishOnly":"npm run-s -n build test","build:types:mts":"node ../../mts-types.mjs","build:types:emit":"tsc --project tsconfig.build.json","benchmark:install":"cd benchmark && npm install","build:types:force":"rimraf tsconfig.build.tsbuildinfo"},"_npmUser":{"name":"jridgewell","actor":{"name":"jridgewell","type":"user","email":"justin+npm@ridgewell.name"},"email":"justin+npm@ridgewell.name"},"repository":{"url":"git+https://github.com/jridgewell/sourcemaps.git","type":"git","directory":"packages/remapping"},"_npmVersion":"10.2.3","description":"Remap sequential sourcemaps through transformations to point at the original source code","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.24"},"_hasShrinkwrap":false,"devDependencies":{"source-map":"0.6.1"},"_npmOperationalInternal":{"tmp":"tmp/remapping_2.3.2_1751259838042_0.7932460274267101","host":"s3://npm-registry-packages-npm-production"}},"2.3.3":{"name":"@jridgewell/remapping","version":"2.3.3","keywords":["source","map","remap"],"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","_id":"@jridgewell/remapping@2.3.3","maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"dist":{"shasum":"4e162c4c6f158a3908add7db9e2cc66b7e7b93fe","tarball":"https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.3.tgz","fileCount":32,"integrity":"sha512-ABQqI4f6xRPwTcySKyRk9qDQpzL9Tgu0iAH/cLcfACinqORdTYR5DzhzKexHrHJOYnWuyMfbOpYCvFrA9+xT7A==","signatures":[{"sig":"MEYCIQD1GLw3m6/kwQ8eKNiZw7yvfJl2XIkhfigq9IJDa644PQIhAIJnBFDvBUAlhmzD7pa2T2zoMw81AoxyxGcWJAkNdnL/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58218},"main":"dist/remapping.umd.js","types":"types/remapping.d.cts","module":"dist/remapping.mjs","exports":{".":[{"import":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"},"browser":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"},"require":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"}},"./dist/remapping.umd.js"],"./package.json":"./package.json"},"gitHead":"d2578bd71829135bee7f510e62f898bcde97e80a","scripts":{"lint":"run-s -n lint:types lint:format","test":"run-s -n test:types test:only test:format","build":"run-s -n build:code build:types","clean":"run-s -n clean:code clean:types","benchmark":"run-s build:code benchmark:*","test:only":"mocha","build:code":"node ../../esbuild.mjs remapping.ts","clean:code":"tsc --build --clean tsconfig.build.json","lint:types":"npm run test:types -- --fix","test:types":"eslint '{src,test}/**/*.ts'","build:types":"run-s build:types:force build:types:emit build:types:mts","clean:types":"rimraf dist types","lint:format":"npm run test:format -- --write","test:format":"prettier --check '{src,test}/**/*.ts'","benchmark:only":"node --expose-gc benchmark/index.js","prepublishOnly":"npm run-s -n build test","build:types:mts":"node ../../mts-types.mjs","build:types:emit":"tsc --project tsconfig.build.json","benchmark:install":"cd benchmark && npm install","build:types:force":"rimraf tsconfig.build.tsbuildinfo"},"_npmUser":{"name":"jridgewell","actor":{"name":"jridgewell","type":"user","email":"justin+npm@ridgewell.name"},"email":"justin+npm@ridgewell.name"},"repository":{"url":"git+https://github.com/jridgewell/sourcemaps.git","type":"git","directory":"packages/remapping"},"_npmVersion":"10.2.3","description":"Remap sequential sourcemaps through transformations to point at the original source code","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.24"},"_hasShrinkwrap":false,"devDependencies":{"source-map":"0.6.1"},"_npmOperationalInternal":{"tmp":"tmp/remapping_2.3.3_1751306899728_0.9638992010783838","host":"s3://npm-registry-packages-npm-production"}},"2.3.4":{"name":"@jridgewell/remapping","version":"2.3.4","keywords":["source","map","remap"],"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","_id":"@jridgewell/remapping@2.3.4","maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"dist":{"shasum":"231002d80f23252cda81b2233e1592119e1b78ea","tarball":"https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.4.tgz","fileCount":32,"integrity":"sha512-aG+WvAz17rhbzhKNkSeMLgbkPPK82ovXdONvmucbGhUqcroRFLLVhoGAk4xEI17gHpXgNX3sr0/B1ybRUsbEWw==","signatures":[{"sig":"MEUCICUrsD70icSMr1OzlM4qIwIaxGQbHJyUSk+FEtoPvVb4AiEA5L0Sn5UEHgFC3H1EJAEiYh/nIxWkN5JkSp4TwpxMv7M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59270},"main":"dist/remapping.umd.js","types":"types/remapping.d.cts","module":"dist/remapping.mjs","exports":{".":[{"import":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"},"browser":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"},"require":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"}},"./dist/remapping.umd.js"],"./package.json":"./package.json"},"gitHead":"3c6286e949d58c2bc6e27334385349c6a83c6d7d","scripts":{"lint":"run-s -n lint:types lint:format","test":"run-s -n test:types test:only test:format","build":"run-s -n build:code build:types","clean":"run-s -n clean:code clean:types","benchmark":"run-s build:code benchmark:*","test:only":"mocha","build:code":"node ../../esbuild.mjs remapping.ts","clean:code":"tsc --build --clean tsconfig.build.json","lint:types":"npm run test:types -- --fix","test:types":"eslint '{src,test}/**/*.ts'","build:types":"run-s build:types:force build:types:emit build:types:mts","clean:types":"rimraf dist types","lint:format":"npm run test:format -- --write","test:format":"prettier --check '{src,test}/**/*.ts'","benchmark:only":"node --expose-gc benchmark/index.js","prepublishOnly":"npm run-s -n build test","build:types:mts":"node ../../mts-types.mjs","build:types:emit":"tsc --project tsconfig.build.json","benchmark:install":"cd benchmark && npm install","build:types:force":"rimraf tsconfig.build.tsbuildinfo"},"_npmUser":{"name":"jridgewell","actor":{"name":"jridgewell","type":"user","email":"justin+npm@ridgewell.name"},"email":"justin+npm@ridgewell.name"},"repository":{"url":"git+https://github.com/jridgewell/sourcemaps.git","type":"git","directory":"packages/remapping"},"_npmVersion":"10.2.3","description":"Remap sequential sourcemaps through transformations to point at the original source code","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.24"},"_hasShrinkwrap":false,"devDependencies":{"source-map":"0.6.1"},"_npmOperationalInternal":{"tmp":"tmp/remapping_2.3.4_1751393921011_0.9735265522139789","host":"s3://npm-registry-packages-npm-production"}},"2.3.5":{"name":"@jridgewell/remapping","version":"2.3.5","description":"Remap sequential sourcemaps through transformations to point at the original source code","keywords":["source","map","remap"],"main":"dist/remapping.umd.js","module":"dist/remapping.mjs","types":"types/remapping.d.cts","exports":{".":[{"import":{"types":"./types/remapping.d.mts","default":"./dist/remapping.mjs"},"default":{"types":"./types/remapping.d.cts","default":"./dist/remapping.umd.js"}},"./dist/remapping.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 remapping.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/remapping","repository":{"type":"git","url":"git+https://github.com/jridgewell/sourcemaps.git","directory":"packages/remapping"},"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","dependencies":{"@jridgewell/gen-mapping":"^0.3.5","@jridgewell/trace-mapping":"^0.3.24"},"devDependencies":{"source-map":"0.6.1"},"_id":"@jridgewell/remapping@2.3.5","gitHead":"095a5825c482003597a30aa380b50159219f3618","bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"_nodeVersion":"24.4.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==","shasum":"375c476d1972947851ba1e15ae8f123047445aa1","tarball":"https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz","fileCount":32,"unpackedSize":59366,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDmnq5itLnV7/riJcHN0MZ4pwbZicCcpV9JGXDLgqWb+AIgak7hXSDglw9tX3DNlTtgq3jAG4XEYqiEx29bztRnx0Y="}]},"_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/remapping_2.3.5_1754981015120_0.8388612836259222"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-29T21:44:02.256Z","modified":"2025-08-12T06:43:35.514Z","2.3.1":"2025-06-29T21:44:02.513Z","2.3.2":"2025-06-30T05:03:58.242Z","2.3.3":"2025-06-30T18:08:19.904Z","2.3.4":"2025-07-01T18:18:41.180Z","2.3.5":"2025-08-12T06:43:35.321Z"},"bugs":{"url":"https://github.com/jridgewell/sourcemaps/issues"},"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","homepage":"https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping","keywords":["source","map","remap"],"repository":{"type":"git","url":"git+https://github.com/jridgewell/sourcemaps.git","directory":"packages/remapping"},"description":"Remap sequential sourcemaps through transformations to point at the original source code","maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"readme":"# @jridgewell/remapping\n\n> Remap sequential sourcemaps through transformations to point at the original source code\n\nRemapping allows you to take the sourcemaps generated through transforming your code and \"remap\"\nthem to the original source locations. Think \"my minified code, transformed with babel and bundled\nwith webpack\", all pointing to the correct location in your original source code.\n\nWith remapping, none of your source code transformations need to be aware of the input's sourcemap,\nthey only need to generate an output sourcemap. This greatly simplifies building custom\ntransformations (think a find-and-replace).\n\n## Installation\n\n```sh\nnpm install @jridgewell/remapping\n```\n\n## Usage\n\n```typescript\nfunction remapping(\n map: SourceMap | SourceMap[],\n loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),\n options?: { excludeContent: boolean, decodedMappings: boolean }\n): SourceMap;\n\n// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the\n// \"source\" location (where child sources are resolved relative to, or the location of original\n// source), and the ability to override the \"content\" of an original source for inclusion in the\n// output sourcemap.\ntype LoaderContext = {\n readonly importer: string;\n readonly depth: number;\n source: string;\n content: string | null | undefined;\n}\n```\n\n`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer\nin the sourcemap, the `loader` will be called with the resolved path. If the path itself represents\na transformed file (it has a sourcmap associated with it), then the `loader` should return that\nsourcemap. If not, the path will be treated as an original, untransformed source code.\n\n```js\n// Babel transformed \"helloworld.js\" into \"transformed.js\"\nconst transformedMap = JSON.stringify({\n file: 'transformed.js',\n // 1st column of 2nd line of output file translates into the 1st source\n // file, line 3, column 2\n mappings: ';CAEE',\n sources: ['helloworld.js'],\n version: 3,\n});\n\n// Uglify minified \"transformed.js\" into \"transformed.min.js\"\nconst minifiedTransformedMap = JSON.stringify({\n file: 'transformed.min.js',\n // 0th column of 1st line of output file translates into the 1st source\n // file, line 2, column 1.\n mappings: 'AACC',\n names: [],\n sources: ['transformed.js'],\n version: 3,\n});\n\nconst remapped = remapping(\n minifiedTransformedMap,\n (file, ctx) => {\n\n // The \"transformed.js\" file is an transformed file.\n if (file === 'transformed.js') {\n // The root importer is empty.\n console.assert(ctx.importer === '');\n // The depth in the sourcemap tree we're currently loading.\n // The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.\n console.assert(ctx.depth === 1);\n\n return transformedMap;\n }\n\n // Loader will be called to load transformedMap's source file pointers as well.\n console.assert(file === 'helloworld.js');\n // `transformed.js`'s sourcemap points into `helloworld.js`.\n console.assert(ctx.importer === 'transformed.js');\n // This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.\n console.assert(ctx.depth === 2);\n return null;\n }\n);\n\nconsole.log(remapped);\n// {\n// file: 'transpiled.min.js',\n// mappings: 'AAEE',\n// sources: ['helloworld.js'],\n// version: 3,\n// };\n```\n\nIn this example, `loader` will be called twice:\n\n1. `\"transformed.js\"`, the first source file pointer in the `minifiedTransformedMap`. We return the\n associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can\n be traced through it into the source files it represents.\n2. `\"helloworld.js\"`, our original, unmodified source code. This file does not have a sourcemap, so\n we return `null`.\n\nThe `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If\nyou were to read the `mappings`, it says \"0th column of the first line output line points to the 1st\ncolumn of the 2nd line of the file `helloworld.js`\".\n\n### Multiple transformations of a file\n\nAs a convenience, if you have multiple single-source transformations of a file, you may pass an\narray of sourcemap files in the order of most-recent transformation sourcemap first. Note that this\nchanges the `importer` and `depth` of each call to our loader. So our above example could have been\nwritten as:\n\n```js\nconst remapped = remapping(\n [minifiedTransformedMap, transformedMap],\n () => null\n);\n\nconsole.log(remapped);\n// {\n// file: 'transpiled.min.js',\n// mappings: 'AAEE',\n// sources: ['helloworld.js'],\n// version: 3,\n// };\n```\n\n### Advanced control of the loading graph\n\n#### `source`\n\nThe `source` property can overridden to any value to change the location of the current load. Eg,\nfor an original source file, it allows us to change the location to the original source regardless\nof what the sourcemap source entry says. And for transformed files, it allows us to change the\nrelative resolving location for child sources of the loaded sourcemap.\n\n```js\nconst remapped = remapping(\n minifiedTransformedMap,\n (file, ctx) => {\n\n if (file === 'transformed.js') {\n // We pretend the transformed.js file actually exists in the 'src/' directory. When the nested\n // source files are loaded, they will now be relative to `src/`.\n ctx.source = 'src/transformed.js';\n return transformedMap;\n }\n\n console.assert(file === 'src/helloworld.js');\n // We could futher change the source of this original file, eg, to be inside a nested directory\n // itself. This will be reflected in the remapped sourcemap.\n ctx.source = 'src/nested/transformed.js';\n return null;\n }\n);\n\nconsole.log(remapped);\n// {\n// …,\n// sources: ['src/nested/helloworld.js'],\n// };\n```\n\n\n#### `content`\n\nThe `content` property can be overridden when we encounter an original source file. Eg, this allows\nyou to manually provide the source content of the original file regardless of whether the\n`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove\nthe source content.\n\n```js\nconst remapped = remapping(\n minifiedTransformedMap,\n (file, ctx) => {\n\n if (file === 'transformed.js') {\n // transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap\n // would not include any `sourcesContent` values.\n return transformedMap;\n }\n\n console.assert(file === 'helloworld.js');\n // We can read the file to provide the source content.\n ctx.content = fs.readFileSync(file, 'utf8');\n return null;\n }\n);\n\nconsole.log(remapped);\n// {\n// …,\n// sourcesContent: [\n// 'console.log(\"Hello world!\")',\n// ],\n// };\n```\n\n### Options\n\n#### excludeContent\n\nBy default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the\n`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce\nthe size out the sourcemap.\n\n#### decodedMappings\n\nBy default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the\n`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of\nencoding into a VLQ string.\n","readmeFilename":"README.md"}