{"name":"adjust-sourcemap-loader","version":"5.0.0","description":"Webpack loader that adjusts source maps","main":"index.js","engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/bholloway/adjust-sourcemap-loader.git"},"keywords":["webpack","loader","source-map","sourcemap","sources","resolve","adjust"],"author":{"name":"bholloway"},"license":"MIT","bugs":{"url":"https://github.com/bholloway/adjust-sourcemap-loader/issues"},"homepage":"https://github.com/bholloway/adjust-sourcemap-loader","dependencies":{"loader-utils":"^3.2.0","regex-parser":"^2.2.11"},"devDependencies":{"jshint":"^2.13.5"},"scripts":{"lint":"jshint index.js lib codec"},"gitHead":"b4280b7d38dcc073d17c617dc813af81f08b4e40","_id":"adjust-sourcemap-loader@5.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"bholloway","email":"npm@bholloway.com"},"dist":{"integrity":"sha512-wtrCI9uKl7FWAj4F5pLHjMpHMg3k28UONiS0oMML97DBt06xvJ8Z3NDAY6HNmsUj8yxB4GMGLUbIoaJ2YhLwTQ==","shasum":"3bd5557f25ee730295cfa451dd330a41b49ad662","tarball":"http://registry-npm.ywwl.com/adjust-sourcemap-loader/download/adjust-sourcemap-loader-5.0.0.tgz","fileCount":33,"unpackedSize":41995,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCY36/bISJlGiGw1kNiyhor558Z3hWqUOJzrVGWwt0l3AIgY+uC6x446F943w3pUUs+MRHKViPesPXW2lySaxwSWfA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSLGbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMVw//c5R35TQQ055GlZ1PV0E1HGR/jPzjpf32NXdBLeKCzhk9spKf\r\nBmEc+W9+OJYRAw+k54HdLYVHdGw4POTmrAvvRJmZ/FoxCSObyC15pozYyxL7\r\nACvapVuA2O0Rsg+FxbjTEDU1GUuxqdHwJETECCd1DaTiOXV2tSkCpgDsWCOV\r\nvoCMKnNZpJ3GCCY0xNVHyeHXVO04GrqpfO+lryPlspcVb/gydpkvV9CF301j\r\nSlPSXzcPB5f3wAtpP4J38UsapZRIo5TwkzA4p9rQ8t2KjUwk/3rIiNZVU8xV\r\nR6f1I2rnEqtM8xwt3R2oy6D9YUjuIL4QMdl4WE9rxJf680BF6LtjVuAAvyPk\r\npjdAZ7MQL675L4JI+Eom8Lutroiw74kF4hmqhmhEYn7+Mnc7MrkwgMxC1hWn\r\n8Ml/1Rwy39I3BPN8yxJphoYEb8gwnjMkKmIASHizKwapBRUC4Y1kgMP6YnEe\r\nnCaaqJ2wMYkL+x/2kEI9n1vyS1/4gJuCd3XyuU0WkxyQpmOgslF4HBiXWEVD\r\ngcR7bnyXi65C1gI3xHJYxbhZV6zA0LQLPEroz3F7tr9XZN4pAuBWZ1Fdq3Ds\r\nvJ/U7/+LHWntWQOi0abBANE23H6JXtOO7jlgcusR40Ax9NyNsu9kKwpsn09a\r\nTcktXmrYLD0tWLfTSQl8P37bWWlVKpzfRLg=\r\n=MeAY\r\n-----END PGP SIGNATURE-----\r\n","size":11655,"noattachment":false,"key":"/adjust-sourcemap-loader/-/adjust-sourcemap-loader-5.0.0.tgz"},"directories":{},"maintainers":[{"name":"bholloway","email":"npm@bholloway.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adjust-sourcemap-loader_5.0.0_1665708442842_0.8936593589817787"},"_hasShrinkwrap":false,"readme":"# Adjust Source-map Loader\n\n[![NPM](https://nodei.co/npm/adjust-sourcemap-loader.png)](http://github.com/bholloway/adjust-sourcemap-loader)\n\nWebpack loader that adjusts source maps.\n\nUse as a **loader** to debug source-maps or to adjust source-maps between other loaders.\n\nUse as a **module filename template** to ensure the final source-map are to your liking.\n\n## Usage : Loader\n\n``` javascript\nrequire('adjust-sourcemap?format=absolute!babel?sourceMap');\n```\n\n### Source maps required\n\nNote that **source maps** must be enabled on any preceding loader. In the above example we use `babel?sourceMap`.\n\n### Apply via webpack config\n\nIt is preferable to adjust your `webpack.config` so to avoid having to prefix every `require()` statement:\n\n``` javascript\nmodule.exports = {\n  module: {\n    loaders: [\n      {\n        test   : /\\.js/,\n        loaders: ['adjust-sourcemap?format=absolute', 'babel?sourceMap']\n      }\n    ]\n  }\n};\n```\n\n## Usage : Module filename template\n\nSpecifying a certain format as the final step in a loader chain will **not** influence the final source format that Webpack will output. Instead the format is determined by the **module filename template**.\n\nThere are limitations to the filename templating that Webpack provides. This package may also operate as a custom template function that will convert output source-map sources to the desired `format`.\n\nIn the following example we ensure project-relative source-map sources are output.\n\n```javascript\nvar templateFn = require('adjust-sourcemap-loader')\n  .moduleFilenameTemplate({\n    format: 'projectRelative'\n  });\n\nmodule.exports = {\n  output: {\n    ...\n    devtoolModuleFilenameTemplate        : templateFn,\n    devtoolFallbackModuleFilenameTemplate: templateFn\n  }\n};\n```\n\n## Options\n\nAs a loader, options may be set using [query parameters](https://webpack.github.io/docs/using-loaders.html#query-parameters) or by using [programmatic parameters](https://webpack.github.io/docs/how-to-write-a-loader.html#programmable-objects-as-query-option). Programmatic means the following in your `webpack.config`.\n\n```javascript\nmodule.exports = {\n   adjustSourcemapLoader: {\n      ...\n   }\n}\n```\n\nWhere `...` is a hash of any of the following options.\n\n* **`debug`** : `boolean|RegExp` May be used alone (boolean) or with a `RegExp` to match the resource(s) you are interested in debugging.\n\n* **`fail`** : `boolean` Implies an **Error** if a source-map source cannot be decoded.\n\n* **`format`** : `string` Optional output format for source-map `sources`. Must be the name of one of the available `codecs`. Omitting the format will result in **no change** and the outgoing source-map will match the incomming one.\n\n* **`root`** : `boolean` A boolean flag that indices that a `sourceRoot` path sould be included in the output map. This is contingent on a `format` being specified.\n\n* **`codecs`** : `Array.<{name:string, decode:function, encode:function, root:function}>` Optional Array of codecs. There are a number of built-in codecs available. If you specify you own codecs you will loose those that are built-in. However you can include them from the `codec/` directory.\n\nNote that **query** parameters take precedence over **programmatic** parameters.\n\n### Changing the format\n\nBuilt-in codecs that may be specified as a `format` include:\n\n* `absolute`\n* `outputRelative`\n* `projectRelative`\n* `webpackProtocol`\n* `sourceRelative` (works for loader only, **not** Module filename template)\n\n### Specifying codecs\n\nThere are additional built-in codecs that do not support encoding. These are still necessary to decode source-map sources. If you specify your own `options.codecs` then you should **also include the built-in codecs**. Otherwise you will find that some sources cannot be decoded.\n\nThe existing codecs may be found in `/codec`, or on the loader itself:\n\n```javascript\nvar inBuiltCodecs = require('adjust-sourcemap-loader').codecs,\n    myCodecs      = [\n      {\n        name  : 'foo',\n        decode: function(uri) {...},\n        encode: function(absolute) {...},\n        root  : function() {...}\n      },\n      ...\n    ];\n\nmodule.exports = {\n   adjustSourcemapLoader: {\n      codecs: inBuiltCodecs.concat(myCodecs)\n   }\n}\n```\n\nThe codec **order is important**. Those that come first have precedence. Any codec that detects a distinct URI should be foremost so that illegal paths are not encountered by successive codecs.\n\n### Abstract codecs\n\nA codec that detects generated code and cannot `decode()` a URI to an absolute file path.\n\nInstead of implementing `encode()` or `root()` it should instead specify `abstract:true`. Its `decode()` function then may return `boolean` where it detects such generated sources.\n\nFor example, a built-in abstract codec will match the **Webpack bootstrap** code and ensure that its illegal source uri is not encountered by later coders.\n\n## How it works\n\nThe loader will receive a source map as its second parameter, so long as the preceding loader was using source-maps.\n\nThe exception is the **css-loader** where the source-map is in the content, which is **not currently supported** .\n\nThe source-map `sources` are parsed by applying **codec.decode()** functions until one of them returns an absolute path to a file that exists. The exception is abstract codecs, where the source with remain unchanged.\n\nIf a format is specified then the source-map `sources` are recreated by applying the **codec.encode()** function for the stated `format` and (where the `root` option is specified) the **codec.root()** function will set the source-map `sourceRoot`.\n\nIf a codec does not specify **codec.encode()** or **codec.root()** then it may **not** be used as the `format`.\n\n","publish_time":1665708443079,"_cnpm_publish_time":1665708443079,"dist-tags":{"latest":"5.0.0","next":"2.0.0"}}