
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
source-map-diff
Advanced tools
Compare current sourcemap to the previous to understand why it changed in size.
A powerful tool that helps you analyze JavaScript bundle size changes by comparing source maps.
# Using npm
npm install source-map-diff
# Using yarn
yarn add source-map-diff
import {
sourceMapDiff,
sourceMapDiffAsHtml,
sourceMapDiffForConsole
} from 'source-map-diff';
// Basic comparison returning structured data
async function compareBuilds() {
const result = await sourceMapDiff({
previousSrc: './dist/previous-build.js',
currentSrc: './dist/current-build.js'
});
console.log('Total files changed:', result.length);
}
// Generate HTML output
async function generateHtmlReport() {
const html = await sourceMapDiffAsHtml({
previousSrc: 'https://example.com/previous.js',
currentSrc: './dist/current.js'
});
// Write to file or insert into a webpage
console.log(html);
}
// Console output with colors
async function logToConsole() {
const output = await sourceMapDiffForConsole({
previousSrc: './dist/v1.0.0.js',
currentSrc: './dist/v1.1.0.js'
});
// Already formatted with colors for terminal display
console.log(output);
}
Returns a Promise for HTML output that can be put on a web page. Classnames are included but not styling.
import { sourceMapDiffAsHtml } from 'source-map-diff';
const html = await sourceMapDiffAsHtml({
previousSrc: './dist/bundle.v1.js',
currentSrc: './dist/bundle.v2.js'
});
Returns a Promise for color console output.
import { sourceMapDiffForConsole } from 'source-map-diff';
const consoleOutput = await sourceMapDiffForConsole({
previousSrc: 'https://mysite.com/v1/main.js',
currentSrc: 'https://mysite.com/v2/main.js'
});
console.log(consoleOutput);
Returns a Promise for structured data you can use for custom reporting:
import { sourceMapDiff } from 'source-map-diff';
// Type of the returned data
interface FileSizeComparison {
filename: string;
added: boolean; // File was not in the previous bundle
removed: boolean; // File was removed from the current bundle
isIncreased: boolean; // File grew in size
isDecreased: boolean; // File decreased in size
isSame: boolean; // File did not change size
previousSize: number; // Byte count in previous bundle
currentSize: number; // Byte count in current bundle
changeInSize: number; // Change in bytes
}
// Example usage
const result = await sourceMapDiff({
previousSrc: './old.js',
currentSrc: './new.js'
});
// Find files with the biggest increases
const increases = result
.filter(item => item.isIncreased)
.sort((a, b) => b.changeInSize - a.changeInSize);
console.table(increases);
Basic usage:
# Compare local files
npx source-map-diff --previousSrc ./dist/old.js --currentSrc ./dist/new.js
# Compare with URLs
npx source-map-diff \
--previousSrc https://mysite.com/v1/bundle.js \
--currentSrc https://mysite.com/v2/bundle.js
# HTML output (useful for reports)
npx source-map-diff --previousSrc <file> --currentSrc <file> --format html > report.html
# JSON output (useful for further processing)
npx source-map-diff --previousSrc <file> --currentSrc <file> --format json > changes.json
# Default console output with colors
npx source-map-diff --previousSrc <file> --currentSrc <file>
FAQs
Compare source maps to understand why a bundle changed in size.
We found that source-map-diff demonstrated a healthy version release cadence and project activity because the last version was released less than 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.