webpack-sources
3.7.1 · 18 Nov 2026MIT85.2M / weekRepositoryHomepagenpmAtom feed
53 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 3.x · latest line
3.7.1
18 Nov 2026Keep 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.
3.7.0
30 Oct 2026Add
util.sourceMap.originalPositionForto find the original position of a generated one.Keep an empty string in
sourcesContentinstead of dropping it.
3.6.0
26 Sep 2026Add
map({ scopes: true }), emitting the source mapscopesfield from the bindings a source declares.Create a cached source's map cache only once a map is asked for.
3.5.3
24 Sep 2026Hand out a recorded hash update as buffers, so cached data carries no big string.
3.5.2
24 Sep 2026Hash a string-backed source without materializing its buffer
RawSource.updateHashandOriginalSource.updateHashcalledbuffer(), which
encodes the string to UTF-8 and memoizes the result — so every source that was
hashed kept its content twice, as a string and as a buffer, for as long as the
source lived. Node hashes a string as UTF-8, the same bytesbuffer()produces,
so the string is hashed directly instead and no digest changes.Measured on a webpack build of three.js + lodash-es (1033 modules, 2.71 MB of
module source): retainedarrayBuffersafter the build drop from 8.74–8.76 MB
to 5.81 MB withdevtool: false, and from 9.35–12.11 MB to 6.42 MB withdevtool: "source-map"— disjoint over six and five runs. 1029Buffer.from
calls per build are removed, one per module. CPU is unchanged: hashing those
sources costs 9.23 ms via the buffer against 8.18 ms via the string, which no
whole-build timing can resolve.
3.5.1
6 Jul 2026Stream potential tokens in OriginalSource instead of materialising an array
OriginalSource.streamChunks(and thereforemap()/sourceAndMap()) previously built the fullsplitIntoPotentialTokensarray of substrings and then iterated it — even thoughmap()andsourceAndMap()run withfinalSource: trueand discard every chunk substring. The scan is now streamed by offset, so chunk substrings are only allocated when actually emitted. This removes the intermediate array and, on the dominant final-source paths, all per-token slices:map()/sourceAndMap()allocate ~38–46% less memory and run ~15–40% faster.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.Skip sorting ReplaceSource replacements when they were added in order.
Patch Changes
Stream potential tokens in OriginalSource instead of materialising an array
OriginalSource.streamChunks(and thereforemap()/sourceAndMap()) previously built the fullsplitIntoPotentialTokensarray of substrings and then iterated it — even thoughmap()andsourceAndMap()run withfinalSource: trueand discard every chunk substring. The scan is now streamed by offset, so chunk substrings are only allocated when actually emitted. This removes the intermediate array and, on the dominant final-source paths, all per-token slices:map()/sourceAndMap()allocate ~38–46% less memory and run ~15–40% faster.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.Skip sorting ReplaceSource replacements when they were added in order.
Use lookup table in splitIntoPotentialTokens for faster character classification
Replace multi-comparison chains (4 comparisons in phase 1, 6 in phase 2) with a single Uint8Array bitmask lookup per character. This reduces per-character branching overhead, yielding ~7% improvement on typical source and ~21% on large sources.
3.5.0
22 May 2026Add
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).
3.4.1
29 Apr 2026Implements more effective
buffersandbufferforReplaceSourceand improve performance in other places.
3.4.0
23 Apr 2026Add
Source.prototype.buffers()that returns the source asBuffer.ConcatSource,CachedSource, andCompatSourceimplement it without allocating an intermediate concatenated buffer, allowing consumers that can write multiple buffers at once (e.g. viawritev) to avoid the overhead ofBuffer.concatin deeply nested sources.Use Int32Array for signed VLQ delta accumulation in
readMappingsso cumulative values that go negative are preserved instead of wrapping to a large unsigned integerImproved performance in many places.
3.3.4
15 Feb 2026Sync
SourceMapSourceconstructor types withsourceAndMapmethod
3.3.3
20 Jun 2025Generate last column mapping even when source is missing for ConcatSource
3.3.2
2 Jun 2025Using
HashLikename insteadHash
3.3.1
2 Jun 2025Always use a buffer to calculate the hash
[Types] Added
debugIdandignoreListfields to RawSourceMap type
3.3.0
23 May 2025Added types
Added ability to reduce memory consumed
Avoid extra calculation for hash updates
3.2.3
11 Jan 20223.2.2
15 Nov 2021Source Code is splitted into lines via custom code instead of using a RegExp
3.2.1
13 Sep 2021RawSourceswith Buffers can now be concatenated withConcatSourceSource Code is splitted into lines via custom code instead of using a RegExp
3.2.0
2 Aug 2021Add
SourceMapSource.bufferfor better performanceMore efficient serialization of source mappings
Avoid crashing when trying to compare the name with the original source, but there is no
sourcesContentin SourceMap
3.1.2
30 Jul 2021Improve handling of invalid mappings (like zero sized or negative)
3.1.1
29 Jul 2021equal to 3.1.0
3.1.0
29 Jul 2021Improve handling of null sources and sourceContents
Faster streaming when only lines are mapped
3.0.4
29 Jul 2021Fix invalid mappings when multiple lines with multiple chunks are replaced
3.0.3
28 Jul 2021Restore backward-compat format for storing end position of replacements
3.0.2
28 Jul 2021Fix incorrect offset sign when doing replacements
3.0.1
27 Jul 2021Fix ConcatSource off-by-1 bug
3.0.0
26 Jul 2021Remove all dependencies
Refactoring for performance
- 2.x
2.3.1
20 Jul 2021Reading the note…
2.3.0
27 May 2021Reading the note…
2.2.0
29 Oct 2020Reading the note…
2.1.1
28 Oct 2020Reading the note…
2.1.0
26 Oct 2020Reading the note…
2.0.1
28 Sep 2020Reading the note…
2.0.0
17 Sep 2020Reading the note…
- 1.x
1.4.3
5 Aug 2019Reading the note…
1.4.2
5 Aug 2019Reading the note…
1.4.1
31 Jul 2019Reading the note…
1.4.0
31 Jul 2019Reading the note…
1.3.0
20 Sep 2018Reading the note…
1.2.0
29 Aug 2018Reading the note…
1.1.0
26 Nov 2017Reading the note…
1.0.2
4 Nov 2017Reading the note…
1.0.1
3 Jun 2017Reading the note…
1.0.0
3 Jun 2017Reading the note…
- 0.2.x
0.2.3
24 Mar 2017Reading the note…
0.2.2
24 Mar 2017Reading the note…
0.2.1
24 Mar 2017Reading the note…
0.2.0
7 Mar 2017Reading the note…
- 0.1.x
0.1.5
7 Mar 2017Reading the note…
0.1.4
15 Jan 2017Reading the note…
0.1.3
12 Nov 2016Reading the note…
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.