webpack-sources
3.7.1 · 18 Nov 2026MIT85.2M / weekRepositoryHomepagenpmAtom feed
Upgrading webpack-sources From 3.4.1 to 3.7.1
7 releases in betweenevery note read
Release by release
- Fixed
Keep a
RawSourcecreated from aBufferwithconvertToStringintact afterclearCache(). Its only copy of the content was dropped, sosize()andupdateHash()threw on sources webpack restored from the filesystem cache. Bytes that are not valid UTF-8 are now kept as they were.
- Fixed
- New
Add
util.sourceMap.originalPositionForto find the original position of a generated one. - Fixed
Keep an empty string in
sourcesContentinstead of dropping it.
- New
- New
Add
map({ scopes: true }), emitting the source mapscopesfield from the bindings a source declares. - Fixed
Create a cached source's map cache only once a map is asked for.
- New
- Fixed
Hand out a recorded hash update as buffers, so cached data carries no big string.
- Fixed
- New
Hash a string-backed source without materializing its buffer
- New
- New
Stream potential tokens in OriginalSource instead of materialising an array
- New
Use lookup table in splitIntoPotentialTokens for faster character classification
- Fixed
Reduce allocations and CPU in
map()/sourceAndMap(): mappings are serialized into a reused byte buffer instead of per-mapping strings,ReplaceSourceverifies original content through a line-offset index instead of splitting sources into line arrays, andReplaceSource.streamChunksemits position-only chunks and returns the final source directly whenfinalSourceis requested. - Fixed
Skip sorting ReplaceSource replacements when they were added in order.
- New
- New
Add
clearCache(options?, visited?)method toSourcethat recursively releases cached data (CachedSourcecached maps/buffers/strings,SourceMapSourceparsed/serialized map caches, and dual-buffer caches in leaf sources). Lets consumers like webpack'sSourceMapDevToolPluginreclaim memory between chunks rather than accumulating per-task source map data across an entire build. Options:maps(defaulttrue) drops cached source maps;source(defaulttrue) drops cached source/buffer copies — passfalseto keep source available for downstream plugins;parsedMap(defaultfalse) additionally drops the parsed object form onSourceMapSourceinstances when a buffer or string form survives (the combination{ maps: true, source: false, parsedMap: true }matches theSourceMapDevToolPlugincall shape in webpack/webpack#20963). The optionalvisitedWeakSetdeduplicates the walk when the same child is reachable through multiple parents (e.g. modules shared across chunks).
- New
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.