webpack-sources
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Webpack-sources is a comprehensive library incorporated with multiple classes that represent a 'Source'. The key purpose of webpack-sources is to handle source code in the webpack. It allows the source code to be requested for its content, size, source map, and hash. An interesting feature of webpack-sources is that it assumes all its methods are expensive as they may need to do computations.
Using webpack-sources involves utilizing its collection of classes. Each class has its specific function. For instance, the 'source' function returns the represented source code as a String or Buffer.
Let's take the 'RawSource' class as an example. Here's how you would use it in your JavaScript code:
const RawSource = require('webpack-sources').RawSource;
// your source code here
let sourceCode = "console.log('Hello, World!')";
let rawSourceInstance = new RawSource(sourceCode);
rawSourceInstance.size(); // returns the size of the source code
rawSourceInstance.source(); // returns the source code
Note: The 'RawSource' class is utilized to represent source code that does not have a SourceMap.
The official documentation for webpack-sources is currently not separately available but can be understood through the README documentation available at the official GitHub page.