GeezerVison is showing github.com — feat(css): range a declaration's value on its node by alexander-akait · Pull Request #22896 · webpack/webpack
Conversation
alexander-akait
commented
Oct 24, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Step 3 of the CSS node data model (follows #22886): a declaration's value is now a range on its node, so a visitor reads it without slicing the declaration's text. !important was already a node flag.
new SourceProcessor()
.use({ [NodeType.Declaration]: (path) => path.rangeOf(Part.value) })
.process("a{color: RED !important}");
// before: null
// after: [9, 12] → "RED"
Output is byte-identical to main (tooling/hash-css-outputs.js, 6678 entries) and speed is neutral (minify pass over Bootstrap, Tailwind, Materialize, Spectre and Pico: executed instructions +0.1%, interleaved wall time within ±2%).
The other steps were measured and left out because none of them could be neutral in JS: recording each printed value as a field costs ~0.4% of a pass for ~1k reads; keeping selector lists as parts saves ~800 splits per pass but allocates a list per rule; keying the duplicate-rule map by prelude came out +0.16% to +0.73%, since finding the prelude costs what hashing the full rule did.
What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes: test/unitCases/css/parser.unittest.js (value range with and without !important and with an empty value; the path-reads table now expects the range on a declaration).
Does this PR introduce a breaking change?
No. rangeOf(Part.value) on a declaration returned null before; it now returns the value's range (still null for an empty value).
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a (the experimental webpack.css.syntax API documents Part.value in its JSDoc).
Use of AI
Written with Claude Code: it implemented the change, ran the output-hash, unit-test, lint and speed gates, and measured the steps left out; the plan and gates were set by the author.
Generated by Claude Code
Summary by CodeRabbit
- Improvements
- CSS minification is faster.
- Declaration value ranges now exclude
!important, return no range for empty values, and cover values containing multiple parts.
- Declaration value ranges are available for path-based access, improving how CSS values are identified.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
`startOf`/`endOf(Part.value)` now answer for a declaration as for a
`url()`: its value without the `!important`, which the node carries as
a flag. Recording the printed value as a field as well costs ~0.4% of
a minify pass for ~1k reads per pass, so that waits for the printer
that writes into the node store.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is packaged and the instant preview of its latest commit is available.
Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@22896
yarn add -D webpack@https://pkg.pr.new/webpack@22896
pnpm add -D webpack@https://pkg.pr.new/webpack@22896
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Types CoverageCoverage after merging feat/css-declaration-value-range into main will be
Coverage Report| File | Stmts | Branches | Funcs | Lines | Uncovered Lines |
|---|
| bin | | webpack.js | 98.84% | 100% | 100% | 98.84% | 113 | | declarations | | WebpackOptions.ts | 99.94% | 100% | 100% | 99.94% | 4240 | | examples | | build-common.js | 100% | 100% | 100% | 100% | | | buildAll.js | 100% | 100% | 100% | 100% | | | examples.js | 100% | 100% | 100% | 100% | | | template-common.js | 98.21% | 100% | 100% | 98.21% | 72 | | examples/custom-javascript-parser | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/custom-javascript-parser/internals | | acorn-parse.js | 100% | 100% | 100% | 100% | | | meriyah-parse.js | 100% | 100% | 100% | 100% | | | oxc-parse.js | 100% | 100% | 100% | 100% | | | examples/markdown | | webpack.config.mjs | 100% | 100% | 100% | 100% | | | examples/module-federation | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/reexport-components | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/ssr | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/typescript | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/typescript-non-erasable | | test.filter.js | 50% | 100% | 100% | 50% | 5 | | examples/virtual-modules | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-bindgen-esm | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-complex | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-emscripten | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-simple | | test.filter.js | 100% | 100% | 100% | 100% | | | examples/wasm-simple-source-phase | | test.filter.js | 100% | 100% | 100% | 100% | | | lib | | Chunk.js | 100% | 100% | 100% | 100% | | | Compilation.js | 98.74% | 100% | 100% | 98.74% | 1823, 2135, 2142, 2150, 2172, 2175, 3161, 3720, 3763, 4354, 4358, 4484, 4505, 4630, 4667, 4674, 4727–4728, 4732, 4737, 4753–4754, 4768–4769, 4774–4775, 5303, 5329, 6250, 6267, 6285, 6301, 6316, 6341, 6344, 6756, 6759–6760, 6765, 6780, 6863, 6887, 883–884 | | Compiler.js | 98.81% | 100% | 100% | 98.81% | 1107, 1144, 1147, 1323–1324, 1332, 848, 932, 972 | | Dependency.js | 100% | 100% | 100% | 100% | | | DependencyTemplate.js | 100% | 100% | 100% | 100% | | | EntryPlugin.js | 100% | 100% | 100% | 100% | | | Entrypoint.js | 100% | 100% | 100% | 100% | | | ExternalsPlugin.js | 100% | 100% | 100% | 100% | | | FileSystemInfo.js | 100% | 100% | 100% | 100% | | | InitFragment.js | 100% | 100% | 100% | 100% | | | LibraryTemplatePlugin.js | 100% | 100% | 100% | 100% | | | ModuleFilenameHelpers.js | 100% | 100% | 100% | 100% | | | ModuleNotFoundError.js | 100% | 100% | 100% | 100% | | | MultiCompiler.js | 98.91% | 100% | 100% | 98.91% | 489, 561, 748, 813 | | NormalModule.js | 100% | 100% | 100% | 100% | | | NullFactory.js | 100% | 100% | 100% | 100% | | | ProgressPlugin.js | 100% | 100% | 100% | 100% | | | RawModule.js | 100% | 100% | 100% | 100% | | | RequestShortener.js | 100% | 100% | 100% | 100% | | | SingleEntryPlugin.js | 100% | 100% | 100% | 100% | | | WebpackError.js | 100% | 100% | 100% | 100% | | | index.js | 100% | 100% | 100% | 100% | | | webpack.js | 98.59% | 100% | 100% | 98.59% | 306, 308 | | lib/asset | | AssetBytesGenerator.js | 100% | 100% | 100% | 100% | | | AssetBytesParser.js | 91.67% | 100% | 100% | 91.67% | 27 | | AssetGenerator.js | 100% | 100% | 100% | 100% | | | AssetModule.js | 100% | 100% | 100% | 100% | | | AssetModulesPlugin.js | 98.45% | 100% | 100% | 98.45% | 334, 360, 363, 493, 58 | | AssetParser.js | 96.15% | 100% | 100% | 96.15% | 47 | | AssetSourceGenerator.js | 100% | 100% | 100% | 100% | | | AssetSourceParser.js | 91.67% | 100% | 100% | 91.67% | 27 | | RawDataUrlModule.js | 100% | 100% | 100% | 100% | | | WebManifestGenerator.js | 100% | 100% | 100% | 100% | | | WebManifestParser.js | 100% | 100% | 100% | 100% | | | lib/async-modules | | AsyncModuleHelpers.js | 100% | 100% | 100% | 100% | | | AwaitDependenciesInitFragment.js | 100% | 100% | 100% | 100% | | | InferAsyncModulesPlugin.js | 100% | 100% | 100% | 100% | | | isGeneratorLowered.js | 100% | 100% | 100% | 100% | | | lib/bun | | BunTargetPlugin.js | 100% | 100% | 100% | 100% | | | lib/cache | | AddBuildDependenciesPlugin.js | 100% | 100% | 100% | 100% | | | AddManagedPathsPlugin.js | 100% | 100% | 100% | 100% | | | Cache.js | 98.25% | 100% | 100% | 98.25% | 104 | | CacheFacade.js | 100% | 100% | 100% | 100% | | | IdleFileCachePlugin.js | 97.92% | 100% | 100% | 97.92% | 75, 87, 95 | | MemoryCachePlugin.js | 92% | 100% | 100% | 92% | 33, 42 | | MemoryWithGcCachePlugin.js | 93.42% | 100% | 100% | 93.42% | 106, 120–121, 130, 88 | | PackFileCacheStrategy.js | 96.54% | 100% | 100% | 96.54% | 1304, 1404, 1408, 1470, 1716, 1796, 1819, 1849, 684, 703, 713–715, 717, 733–734, 739, 742, 744, 749, 754, 779, 785, 819, 825, 831, 836, 847, 856, 861–862, 864, 881, 887–888, 890 | | ResolverCachePlugin.js | 100% | 100% | 100% | 100% | | | getLazyHashedEtag.js | 100% | 100% | 100% | 100% | | | mergeEtags.js | 100% | 100% | 100% | 100% | | | lib/config | | OptionsApply.js | 100% | 100% | 100% | 100% | | | PlatformPlugin.js | 100% | 100% | 100% | 100% | | | WebpackOptionsApply.js | 100% | 100% | 100% | 100% | | | WebpackOptionsDefaulter.js | 100% | 100% | 100% | 100% | | | browserslistTargetHandler.js | 100% | 100% | 100% | 100% | | | cli.js | 98.89% | 100% | 100% | 98.89% | 114, 549, 581, 631 | | defaults.js | 99.59% | 100% | 100% | 99.59% | 1633–1635, 1643, 288, 548 | | defineConfig.js | 100% | 100% | 100% | 100% | | | getClaimedAssetTypes.js | 100% | 100% | 100% | 100% | | | normalization.js | 99.14% | 100% | 100% | 99.14% | 285–286, 356, 371 | | target.js | 100% | 100% | 100% | 100% | | | validateSchema.js | 94.67% | 100% | 100% | 94.67% | 100, 87, 89, 98 | | lib/container | | ContainerEntryDependency.js | 100% | 100% | 100% | 100% | | | ContainerEntryModule.js | 100% | 100% | 100% | 100% | | | ContainerEntryModuleFactory.js | 100% | 100% | 100% | 100% | | | ContainerExposedDependency.js | 100% | 100% | 100% | 100% | | | ContainerPlugin.js | 100% | 100% | 100% | 100% | | | ContainerReferencePlugin.js | 100% | 100% | 100% | 100% | | | FallbackDependency.js | 100% | 100% | 100% | 100% | | | FallbackItemDependency.js | 100% | 100% | 100% | 100% | | | FallbackModule.js | 100% | 100% | 100% | 100% | | | FallbackModuleFactory.js | 100% | 100% | 100% | 100% | | | HoistContainerReferencesPlugin.js | 100% | 100% | 100% | 100% | | | ModuleFederationPlugin.js | 100% | 100% | 100% | 100% | | | RemoteModule.js | 100% | 100% | 100% | 100% | | | RemoteRuntimeModule.js | 100% | 100% | 100% | 100% | | | RemoteToExternalDependency.js | 100% | 100% | 100% | 100% | | | declaredRemotes.js | 100% | 100% | 100% | 100% | | | moduleFederationHooks.js | 100% | 100% | 100% | 100% | | | options.js | 100% | 100% | 100% | 100% | | | lib/context | | ContextExclusionPlugin.js | 100% | 100% | 100% | 100% | | | ContextModule.js | 99.88% | 100% | 100% | 99.88% | 1495 | | ContextModuleFactory.js | 95.70% | 100% | 100% | 95.70% | 230, 257, 276, 280–281, 289, 466, 487, 492, 534, 543, 545, 549, 552, 558–559 | | ContextReplacementPlugin.js | 100% | 100% | 100% | 100% | | | lib/css | | CssGenerator.js | 99.29% | 100% | 100% | 99.29% | 1085, 129, 305, 837 | | CssInjectStyleRuntimeModule.js | 100% | 100% | 100% | 100% | | | CssLoadingRuntimeModule.js | 100% | 100% | 100% | 100% | | | CssModule.js | 100% | 100% | 100% | 100% | | | CssModulesPlugin.js | 98.72% | 100% | 100% | 98.72% | 217, 418, 432, 445, 458, 481, 494, 507, 520 | | CssParser.js | 99.76% | 100% | 100% | 99.76% | 1090, 2425, 3072, 3075, 3081, 3514, 943 | | CssServerStylesRuntimeModule.js | 100% | 100% | 100% | 100% | | | conventions.js | 100% | 100% | 100% | 100% | | | cssMinify.js | 100% | 100% | 100% | 100% | | | data.js | 99.84% | 100% | 100% | 99.84% | 229, 5605 | | syntax-parser.js | 99.70% | 100% | 100% | 99.70% | 11354–11355, 11907–11908, 11945, 12155, 12204, 14605, 14666–14669, 14774–14775, 14873–14874, 15647, 15943, 15945, 16500, 16892, 16934, 19324, 2739, 3446, 3448, 3453, 3466, 4216, 4222 | | syntax-printer.js | 99.33% | 100% | 100% | 99.33% | 2611–2612, 2614–2615, 2617–2618, 2623, 2893–2896, 2989, 356, 3690, 4115, 4251, 4928, 5242, 6143, 730 | | syntax.js | 100% | 100% | 100% | 100% | | | topologicalSort.js | 100% | 100% | 100% | 100% | | | lib/debug | | ProfilingPlugin.js | 100% | 100% | 100% | 100% | | | lib/define | | DefinePlugin.js | 99.42% | 100% | 100% | 99.42% | 1488, 936, 938, 943, 967 | | DotenvPlugin.js | 97.61% | 100% | 100% | 97.61% | 276, 395, 443, 456–457 | | EnvironmentPlugin.js | 100% | 100% | 100% | 100% | | | lib/deno | | DenoTargetPlugin.js | 100% | 100% | 100% | 100% | | | lib/dependencies | | ConstDependency.js | 100% | 100% | 100% | 100% | | | ContextElementDependency.js | 100% | 100% | 100% | 100% | | | NullDependency.js | 100% | 100% | 100% | 100% | | | lib/dependencies/amd | | AMDDefineDependency.js | 100% | 100% | 100% | 100% | | | AMDDefineDependencyParserPlugin.js | 100% | 100% | 100% | 100% | | | AMDPlugin.js | 99.31% | 100% | 100% | 99.31% | 54 | | AMDRequireArrayDependency.js | 100% | 100% | 100% | 100% | | | AMDRequireContextDependency.js | 100% | 100% | 100% | 100% | | | AMDRequireDependenciesBlock.js | 100% | 100% | 100% | 100% | | | AMDRequireDependenciesBlockParserPlugin.js | 100% | 100% | 100% | 100% | | | AMDRequireDependency.js | 100% | 100% | 100% | 100% | | | AMDRequireItemDependency.js | 100% | 100% | 100% | 100% | | | AMDRuntimeModules.js | 95.45% | 100% | 100% | 95.45% | 65 | | LocalModule.js | 100% | 100% | 100% | 100% | | | LocalModuleDependency.js | 100% | 100% | 100% | 100% | | | LocalModulesHelpers.js | 100% | 100% | 100% | 100% | | | RequireJsStuffPlugin.js | 100% | 100% | 100% | 100% | | | UnsupportedDependency.js | 100% | 100% | 100% | 100% | | | lib/dependencies/commonjs | | CommonJsDependencyHelpers.js | 98.63% | 100% | 100% | 98.63% | 43 | | CommonJsExportRequireDependency.js | 99.21% | 100% | 100% | 99.21% | 413, 415, |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 8dbf5d2 and 5a7e26e.
Files selected for processing: 1
-
.changeset/060-css-minify-property-ids.md
Files skipped from review as they are similar to previous changes: 1
-
- .changeset/060-css-minify-property-ids.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Walkthrough
-
The CSS parser now provides declaration value ranges through Part.value and its start and end accessors. The ranges exclude !important; empty declarations have no range. Tests cover these cases and multi-token values. The changeset release type changes from patch to minor.
Changes: CSS declaration value ranges
| Layer / File(s) |
Summary |
Declaration value range accessors lib/css/syntax-parser.js, test/unitCases/css/parser.unittest.js, .changeset/060-css-minify-property-ids.md |
Part.value is supported for declarations. Its start and end accessors return the offsets of the first and last value children. Empty declarations return -1. Tests cover !important, empty values, and multi-token values. The changeset changes the release type to minor. |
Possibly related PRs
- webpack/webpack#22881: It changes CSS parse entry points to return node references through the
A accessor. This PR adds declaration value range behavior to that accessor model.
Priority: Low
Change: Feature
Merge Risk: Minimal · up to 5a7e2
-
No actionable issue remains identified for this change; it is ready for normal merge checks.
Pre-merge checks: 3 · 1
-
Failed checks: 1 inconclusive
| Check name |
Status |
Explanation |
Resolution |
| Title check |
 |
The title uses valid Conventional Commit syntax, uses the allowed type feat, and accurately describes the declaration value range change. The branch prefix is not provided, so the type-to-branch-pre… |
Provide the branch name or branch prefix. Confirm that it uses the feat prefix. |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title uses valid Conventional Commit syntax, uses the allowed type feat, and accurately describes the declaration value range change. The branch prefix is not provided, so the type-to-branch-prefix requirement cannot be verified.
Resolution
Provide the branch name or branch prefix. Confirm that it uses the feat prefix.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Generated code size
Comparing base (63e2d8e) to head (5a7e26e). Merging this pull request will not change the code webpack generates.
| What moved |
Tests |
Assets |
Gzip |
Raw |
Test edit |
| Changed, test untouched |
0 |
0 |
— |
— |
— |
| Changed, test edited |
0 |
0 |
— |
— |
— |
| New |
0 |
0 |
— |
— |
— |
| Deleted |
0 |
0 |
— |
— |
— |
| Unchanged |
— |
9197 |
— |
— |
— |
Read Changed, test untouched first: the test is byte-identical on both sides, so webpack generated the difference. Changed, test edited moved partly because the test did — Test edit is how many bytes the test gained, and a bundle that grew by less is not a regression. New and Deleted are whole files, not deltas — a new asset was created, not grown, so it reads gray (⚪ added) — and adding tests cannot bury a real change. Gzip decides, because that is what users download; raw is the tiebreak, and brotli and zstd are per asset below.
No asset changed size.
No runtime gained or lost a runtime module.
Built test/configCases with the defaults a user gets: 2289 test(s), 9197 asset(s), 101 emitted nothing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging this PR will regress 1 benchmark
2 warnings, 1 note
⚠️ 117 benchmarks are dominated by system calls
System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
Learn more about system calls
See affected benchmarks
⚠️ Base and head ran on different runner types
Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.
Learn more about Macro Runners
Open the report in CodSpeed to investigate
ℹ️ 46 benchmarks have no flamegraph
The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.
See affected benchmarks
⚡ 4 improved benchmarks
❌ 1 regressed benchmark
✅ 346 untouched benchmarks
Performance Changes
|
Mode |
Benchmark |
BASE |
HEAD |
Efficiency |
| ❌ |
Memory |
benchmark "common-libs", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
158.7 KB |
199.8 KB |
-20.61% |
| ⚡ |
Memory |
benchmark "cache-filesystem-modified", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,621.3 KB |
153.1 KB |
×11 |
| ⚡ |
Memory |
benchmark "json-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
535.1 KB |
146.8 KB |
×3.6 |
| ⚡ |
Memory |
benchmark "many-chunks-esm", scenario '{"name":"mode-production","mode":"production"}' |
723.2 KB |
341.1 KB |
×2.1 |
| ⚡ |
Memory |
benchmark "module-unsafe-cache", scenario '{"name":"mode-production","mode":"production"}' |
1,413.2 KB |
809.5 KB |
+74.58% |
Tip Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feat/css-declaration-value-range (5a7e26e) with main (63e2d8e)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
area: css
CSS support (lib/css)
area: types
types.d.ts, JSDoc annotations, hand-maintained declarations
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|