Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@parcel/source-map
Advanced tools
@parcel/source-map is a library for working with source maps, which are files that map from the transformed source code back to the original source code. This is useful for debugging and understanding the transformations applied to the code.
Creating a Source Map
This feature allows you to create a new source map and add mappings to it using VLQ (Variable Length Quantity) encoding.
const { SourceMap } = require('@parcel/source-map');
const map = new SourceMap();
map.addVLQMap({
version: 3,
file: 'out.js',
sources: ['foo.js', 'bar.js'],
names: ['src', 'maps', 'are', 'fun'],
mappings: 'AA,AB;;ABCDE;' // VLQ encoded mappings
});
console.log(map.toBuffer());
Adding a Mapping
This feature allows you to add individual mappings to the source map, specifying the generated and original positions, the source file, and an optional name.
const { SourceMap } = require('@parcel/source-map');
const map = new SourceMap();
map.addMapping({
generated: { line: 1, column: 5 },
original: { line: 2, column: 10 },
source: 'source.js',
name: 'myFunction'
});
console.log(map.toBuffer());
Loading an Existing Source Map
This feature allows you to load an existing source map into the SourceMap object, enabling further manipulation or inspection.
const { SourceMap } = require('@parcel/source-map');
const existingMap = {
version: 3,
file: 'out.js',
sources: ['foo.js', 'bar.js'],
names: ['src', 'maps', 'are', 'fun'],
mappings: 'AA,AB;;ABCDE;'
};
const map = new SourceMap();
map.addVLQMap(existingMap);
console.log(map.toBuffer());
Generating Source Map Buffer
This feature allows you to generate a buffer representation of the source map, which can be written to a file or used in other ways.
const { SourceMap } = require('@parcel/source-map');
const map = new SourceMap();
map.addMapping({
generated: { line: 1, column: 5 },
original: { line: 2, column: 10 },
source: 'source.js',
name: 'myFunction'
});
const buffer = map.toBuffer();
console.log(buffer);
The 'source-map' package is a library for generating and consuming source maps. It provides similar functionalities to @parcel/source-map, such as creating source maps, adding mappings, and loading existing maps. However, 'source-map' is more widely used and has a larger community.
The 'source-map-support' package provides source map support for stack traces in Node.js. While it does not offer the same level of manipulation capabilities as @parcel/source-map, it is useful for debugging purposes by providing better error stack traces.
The 'convert-source-map' package allows you to convert source maps from/to different formats and embed/extract them from code. It complements @parcel/source-map by providing additional utilities for working with source maps in various formats.
FAQs
A source map library purpose-build for the Parcel bundler with a focus on fast combining and manipulating of source-maps.
The npm package @parcel/source-map receives a total of 311,772 weekly downloads. As such, @parcel/source-map popularity was classified as popular.
We found that @parcel/source-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.