Gathering detailed insights and metrics for adjust-sourcemap-loader
Gathering detailed insights and metrics for adjust-sourcemap-loader
Gathering detailed insights and metrics for adjust-sourcemap-loader
Gathering detailed insights and metrics for adjust-sourcemap-loader
@ampproject/remapping
Remap sequential sourcemaps through transformations to point at the original source code
karma-sourcemap-loader
Karma plugin that locates and loads existing javascript source map files.
path-loader
Utility that provides a single API for loading the content of a path/URL.
@jridgewell/sourcemap-codec
Encode/decode sourcemap mappings
npm install adjust-sourcemap-loader
96.1
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
11 Stars
56 Commits
9 Forks
2 Watching
1 Branches
4 Contributors
Updated on 14 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-2.5%
1,461,115
Compared to previous day
Last week
1.9%
7,607,198
Compared to previous week
Last month
7.2%
32,164,301
Compared to previous month
Last year
6.5%
367,324,835
Compared to previous year
2
1
Webpack loader that adjusts source maps.
Use as a loader to debug source-maps or to adjust source-maps between other loaders.
Use as a module filename template to ensure the final source-map are to your liking.
1require('adjust-sourcemap?format=absolute!babel?sourceMap');
Note that source maps must be enabled on any preceding loader. In the above example we use babel?sourceMap
.
It is preferable to adjust your webpack.config
so to avoid having to prefix every require()
statement:
1module.exports = { 2 module: { 3 loaders: [ 4 { 5 test : /\.js/, 6 loaders: ['adjust-sourcemap?format=absolute', 'babel?sourceMap'] 7 } 8 ] 9 } 10};
Specifying 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.
There 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
.
In the following example we ensure project-relative source-map sources are output.
1var templateFn = require('adjust-sourcemap-loader') 2 .moduleFilenameTemplate({ 3 format: 'projectRelative' 4 }); 5 6module.exports = { 7 output: { 8 ... 9 devtoolModuleFilenameTemplate : templateFn, 10 devtoolFallbackModuleFilenameTemplate: templateFn 11 } 12};
As a loader, options may be set using query parameters or by using programmatic parameters. Programmatic means the following in your webpack.config
.
1module.exports = { 2 adjustSourcemapLoader: { 3 ... 4 } 5}
Where ...
is a hash of any of the following options.
debug
: boolean|RegExp
May be used alone (boolean) or with a RegExp
to match the resource(s) you are interested in debugging.
fail
: boolean
Implies an Error if a source-map source cannot be decoded.
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.
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.
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.
Note that query parameters take precedence over programmatic parameters.
Built-in codecs that may be specified as a format
include:
absolute
outputRelative
projectRelative
webpackProtocol
sourceRelative
(works for loader only, not Module filename template)There 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.
The existing codecs may be found in /codec
, or on the loader itself:
1var inBuiltCodecs = require('adjust-sourcemap-loader').codecs, 2 myCodecs = [ 3 { 4 name : 'foo', 5 decode: function(uri) {...}, 6 encode: function(absolute) {...}, 7 root : function() {...} 8 }, 9 ... 10 ]; 11 12module.exports = { 13 adjustSourcemapLoader: { 14 codecs: inBuiltCodecs.concat(myCodecs) 15 } 16}
The 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.
A codec that detects generated code and cannot decode()
a URI to an absolute file path.
Instead of implementing encode()
or root()
it should instead specify abstract:true
. Its decode()
function then may return boolean
where it detects such generated sources.
For 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.
The loader will receive a source map as its second parameter, so long as the preceding loader was using source-maps.
The exception is the css-loader where the source-map is in the content, which is not currently supported .
The 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.
If 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
.
If a codec does not specify codec.encode() or codec.root() then it may not be used as the format
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
Found 5/17 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More