convert-source-map
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Convert-source-map is a potent JavaScript tool that serves as a converter for source-maps through various formats and allows alterations and additions to properties. It is particularly useful for developers who work extensively with source maps in their projects and require a consistent way to convert between different source-map formats. Its functionality extends beyond simple conversion, as it allows developers to add or change properties directly. This package can make the handling of source maps significantly easier and more efficient.
The convert-source-map package is implemented in JavaScript, and is utilized by importing it and making function calls with necessary parameters. Here is a practical usage example on how you can convert a source-map from one format to another, and how you can modify its properties:
var convert = require('convert-source-map');
// Convert a source-map from one format to another.
var json = convert
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.toJSON();
// Modify properties of a source-map.
var modified = convert
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.setProperty('sources', [ 'SRC/FOO.JS' ])
.toJSON();
console.log(json);
console.log(modified);
The complete documentation of convert-source-map can be accessed directly from the package's GitHub repository. The documentation provides a comprehensive understanding of how convert-source-map can be used, it covers information about all the different functions and options offered by the package. To better grasp the functionality offered by convert-source-map, it is highly recommended to read the full API documentation.