Skip to content

Commit 210e0a4

Browse files
chore(release): new release (#245)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f38af31 commit 210e0a4

6 files changed

Lines changed: 25 additions & 27 deletions

.changeset/original-source-stream-potential-tokens.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/perf-mappings-writer-replace-final-source.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/replace-source-skip-presorted-sort.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/split-into-potential-tokens-lookup-table.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# webpack-sources
22

3+
## 3.5.1
4+
5+
### Patch Changes
6+
7+
- perf: stream potential tokens in OriginalSource instead of materialising an array (by [@alexander-akait](https://github.com/alexander-akait) in [#246](https://github.com/webpack/webpack-sources/pull/246))
8+
9+
`OriginalSource.streamChunks` (and therefore `map()` / `sourceAndMap()`) previously built the full `splitIntoPotentialTokens` array of substrings and then iterated it — even though `map()` and `sourceAndMap()` run with `finalSource: true` and 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.
10+
11+
- Reduce allocations and CPU in `map()` / `sourceAndMap()`: mappings are serialized into a reused byte buffer instead of per-mapping strings, `ReplaceSource` verifies original content through a line-offset index instead of splitting sources into line arrays, and `ReplaceSource.streamChunks` emits position-only chunks and returns the final source directly when `finalSource` is requested. (by [@alexander-akait](https://github.com/alexander-akait) in [#251](https://github.com/webpack/webpack-sources/pull/251))
12+
13+
- Skip sorting ReplaceSource replacements when they were added in order. (by [@alexander-akait](https://github.com/alexander-akait) in [#249](https://github.com/webpack/webpack-sources/pull/249))
14+
15+
- perf: use lookup table in splitIntoPotentialTokens for faster character classification (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#240](https://github.com/webpack/webpack-sources/pull/240))
16+
17+
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.
18+
319
## 3.5.0
420

521
### Minor Changes

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
22
"name": "webpack-sources",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "Source code handling classes for webpack",
5-
"keywords": ["webpack", "source-map"],
5+
"keywords": [
6+
"webpack",
7+
"source-map"
8+
],
69
"homepage": "https://github.com/webpack/webpack-sources#readme",
710
"bugs": {
811
"url": "https://github.com/webpack/webpack-sources/issues"
@@ -15,7 +18,10 @@
1518
"author": "Tobias Koppers @sokra",
1619
"main": "lib/index.js",
1720
"types": "types.d.ts",
18-
"files": ["lib/", "types.d.ts"],
21+
"files": [
22+
"lib/",
23+
"types.d.ts"
24+
],
1925
"scripts": {
2026
"lint": "npm run lint:code && npm run lint:types && npm run lint:types-test && npm run lint:special",
2127
"lint:code": "eslint --cache .",

0 commit comments

Comments
 (0)