GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(xml): support attribute sorting in the shared HTML printer by alexander-akait · Pull Request #22689 · webpack/webpack

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Oct 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow up #22269 with optional XML/SVG attribute sorting. Reuse the HTML printer's frequency-based ordering through xml: true, preserving case, namespaces and DTD defaults.

<!-- Input -->
<svg  z = "1" a = "2" />
<!-- Default -->
<svg z="1" a="2"/>
<!-- sortAttributes: true -->
<svg a="2" z="1"/>

The XML comparison now measures sorting and checks its invariants. Gzip improves on Feather (10,296 → 10,207 bytes) but grows on Bootstrap Icons (226,976 → 227,035 bytes), so sorting stays off by default.

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes: XML printer, minimizer and comparison unit tests, plus optimization/minimize-xml build/cache snapshots. Targeted tests, the 77-document invariant sweep and full lint pass.

Does this PR introduce a breaking change?

No.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

Document optimization.minimizeOptions.xml.sortAttributes (default false); its declaration and generated types describe the option.

Use of AI

Used Codex to implement the shared printer change, add tests and run validation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alexander-akait
feat(xml): support attribute sorting in the shared HTML printer
a517d7f
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: webpack/webpack/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8aafd69d-6da3-4be7-ba6b-49cc8b605123
📥 Commits

Reviewing files that changed from the base of the PR and between bd464b2 and a517d7f.

⛔ Files ignored due to path filters: 6
  • declarations/WebpackOptions.ts is excluded by !declarations/**
  • schemas/WebpackOptions.check.js is excluded by !schemas/**/*.check.js
  • test/__snapshots__/Cli.basictest.js.snap is excluded by !**/*.snap, !test/**/__snapshots__/**
  • test/configCases/optimization/minimize-xml/__snapshots__/ConfigCacheTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**
  • test/configCases/optimization/minimize-xml/__snapshots__/ConfigTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**
  • types.d.ts is excluded by !types.d.ts
📒 Files selected for processing: 11
  • .changeset/020-html-syntax-xml-mode.md
  • lib/html/syntax-parser.js
  • lib/html/syntax-printer.js
  • lib/html/xmlMinify.js
  • schemas/WebpackOptions.json
  • test/configCases/optimization/minimize-xml/test.config.js
  • test/configCases/optimization/minimize-xml/webpack.config.js
  • test/unitCases/CompareXmlTools.unittest.js
  • test/unitCases/HtmlSyntax.unittest.js
  • test/unitCases/xmlMinify.unittest.js
  • tooling/compare-xml-tools.js
+----------------------------------------------------------------+
| Your exception handling needs a therapist and a boundary plan. |
+----------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
  • 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added area: config Options, defaults, validation (lib/config, schemas/) area: html Experimental HTML support (lib/html) area: types types.d.ts, JSDoc annotations, hand-maintained declarations area: tooling Repo tooling, codegen, CLI entry (tooling/, bin/) labels Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (c47e84f).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@c47e84f
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@c47e84f
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@c47e84f
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Types Coverage

Coverage after merging feat/xml-attribute-sorting into main will be
97.39%
Coverage Report…truncated

FileStmtsBranchesFuncsLinesUncovered Lines
bin
   webpack.js98.82%100%100%98.82%103
declarations
   WebpackOptions.ts99.94%100%100%99.94%4238
examples
   build-common.js100%100%100%100%
   buildAll.js100%100%100%100%
   examples.js100%100%100%100%
   template-common.js98.21%100%100%98.21%72
examples/custom-javascript-parser
   test.filter.js100%100%100%100%
examples/custom-javascript-parser/internals
   acorn-parse.js100%100%100%100%
   meriyah-parse.js100%100%100%100%
   oxc-parse.js100%100%100%100%
examples/markdown
   webpack.config.mjs100%100%100%100%
examples/module-federation
   test.filter.js100%100%100%100%
examples/reexport-components
   test.filter.js100%100%100%100%
examples/ssr
   test.filter.js100%100%100%100%
examples/typescript
   test.filter.js100%100%100%100%
examples/typescript-non-erasable
   test.filter.js50%100%100%50%5
examples/virtual-modules
   test.filter.js100%100%100%100%
examples/wasm-bindgen-esm
   test.filter.js100%100%100%100%
examples/wasm-complex
   test.filter.js100%100%100%100%
examples/wasm-emscripten
   test.filter.js100%100%100%100%
examples/wasm-simple
   test.filter.js100%100%100%100%
examples/wasm-simple-source-phase
   test.filter.js100%100%100%100%
lib
   Chunk.js100%100%100%100%
   Compilation.js98.67%100%100%98.67%1767, 2080, 2087, 2095, 2117, 2120, 23, 3080, 3617, 3655, 4244, 4248, 4375, 4396, 4521, 4558, 4565, 4618–4619, 4623, 4628, 4644–4645, 4659–4660, 4665–4666, 5190, 5216, 6046, 6063, 6081, 6097, 6112, 6137, 6140, 6508, 6511–6512, 6517, 6532, 6615, 6639, 843–844
   Compiler.js98.81%100%100%98.81%1116, 1153, 1156, 1336–1337, 1345, 848, 934, 975
   Dependency.js100%100%100%100%
   DependencyTemplate.js100%100%100%100%
   EntryPlugin.js100%100%100%100%
   Entrypoint.js100%100%100%100%
   ExternalsPlugin.js100%100%100%100%
   FileSystemInfo.js100%100%100%100%
   InitFragment.js100%100%100%100%
   LibraryTemplatePlugin.js100%100%100%100%
   ModuleFilenameHelpers.js100%100%100%100%
   ModuleNotFoundError.js100%100%100%100%
   MultiCompiler.js98.89%100%100%98.89%468, 540, 727, 792
   NormalModule.js100%100%100%100%
   NullFactory.js100%100%100%100%
   ProgressPlugin.js100%100%100%100%
   RawModule.js100%100%100%100%
   RequestShortener.js100%100%100%100%
   SingleEntryPlugin.js100%100%100%100%
   WebpackError.js100%100%100%100%
   index.js100%100%100%100%
   webpack.js98.56%100%100%98.56%302, 304
lib/asset
   AssetBytesGenerator.js100%100%100%100%
   AssetBytesParser.js100%100%100%100%
   AssetGenerator.js100%100%100%100%
   AssetModule.js100%100%100%100%
   AssetModulesPlugin.js98.45%100%100%98.45%335, 359, 362, 492, 59
   AssetParser.js100%100%100%100%
   AssetSourceGenerator.js100%100%100%100%
   AssetSourceParser.js100%100%100%100%
   RawDataUrlModule.js100%100%100%100%
   WebManifestGenerator.js100%100%100%100%
   WebManifestParser.js100%100%100%100%
lib/async-modules
   AsyncModuleHelpers.js100%100%100%100%
   AwaitDependenciesInitFragment.js100%100%100%100%
   InferAsyncModulesPlugin.js100%100%100%100%
   isGeneratorLowered.js100%100%100%100%
lib/bun
   BunTargetPlugin.js100%100%100%100%
lib/cache
   AddBuildDependenciesPlugin.js100%100%100%100%
   AddManagedPathsPlugin.js100%100%100%100%
   Cache.js96.49%100%100%96.49%10, 104
   CacheFacade.js100%100%100%100%
   IdleFileCachePlugin.js97.92%100%100%97.92%75, 87, 95
   MemoryCachePlugin.js92%100%100%92%33, 42
   MemoryWithGcCachePlugin.js93.42%100%100%93.42%106, 120–121, 130, 88
   PackFileCacheStrategy.js96.54%100%100%96.54%1304, 1404, 1408, 1470, 1716, 1800, 1823, 1853, 682, 701, 711–713, 715, 731–732, 737, 740, 742, 747, 752, 777, 783, 817, 823, 829, 834, 845, 854, 859–860, 862, 879, 885–886, 888
   ResolverCachePlugin.js100%100%100%100%
   getLazyHashedEtag.js100%100%100%100%
   mergeEtags.js100%100%100%100%
lib/config
   OptionsApply.js100%100%100%100%
   PlatformPlugin.js100%100%100%100%
   WebpackOptionsApply.js100%100%100%100%
   WebpackOptionsDefaulter.js100%100%100%100%
   browserslistTargetHandler.js100%100%100%100%
   cli.js98.88%100%100%98.88%114, 546, 578, 628
   defaults.js99.38%100%100%99.38%1624–1626, 1634, 283, 286, 291, 295, 544
   defineConfig.js100%100%100%100%
   getClaimedAssetTypes.js100%100%100%100%
   normalization.js99.14%100%100%99.14%285–286, 356, 371
   target.js100%100%100%100%
   validateSchema.js94.67%100%100%94.67%100, 87, 89, 98
lib/container
   ContainerEntryDependency.js100%100%100%100%
   ContainerEntryModule.js100%100%100%100%
   ContainerEntryModuleFactory.js100%100%100%100%
   ContainerExposedDependency.js100%100%100%100%
   ContainerPlugin.js100%100%100%100%
   ContainerReferencePlugin.js100%100%100%100%
   FallbackDependency.js100%100%100%100%
   FallbackItemDependency.js100%100%100%100%
   FallbackModule.js100%100%100%100%
   FallbackModuleFactory.js100%100%100%100%
   HoistContainerReferencesPlugin.js100%100%100%100%
   ModuleFederationPlugin.js100%100%100%100%
   RemoteModule.js100%100%100%100%
   RemoteRuntimeModule.js100%100%100%100%
   RemoteToExternalDependency.js100%100%100%100%
   declaredRemotes.js100%100%100%100%
   moduleFederationHooks.js100%100%100%100%
   options.js100%100%100%100%
lib/context
   ContextExclusionPlugin.js100%100%100%100%
   ContextModule.js99.88%100%100%99.88%1495
   ContextModuleFactory.js95.70%100%100%95.70%230, 257, 276, 280–281, 289, 466, 487, 492, 534, 543, 545, 549, 552, 558–559
   ContextReplacementPlugin.js100%100%100%100%
lib/css
   CssGenerator.js99.29%100%100%99.29%1092, 134, 301, 849
   CssInjectStyleRuntimeModule.js100%100%100%100%
   CssLoadingRuntimeModule.js100%100%100%100%
   CssModule.js100%100%100%100%
   CssModulesPlugin.js98.72%100%100%98.72%217, 418, 432, 445, 458, 481, 494, 507, 520
   CssParser.js99.76%100%100%99.76%1076, 2407, 3054, 3057, 3063, 3486, 929
   CssServerStylesRuntimeModule.js100%100%100%100%
   conventions.js98.65%100%100%98.65%93
   cssMinify.js100%100%100%100%
   data.js99.84%100%100%99.84%229, 5601
   syntax-parser.js99.69%100%100%99.69%10312–10313, 10849–10850, 10887, 11082, 11128, 13460–13463, 13563–13564, 13661–13662, 14307, 14604, 14606, 15115, 15481, 17597, 2608, 3313, 3315, 3320, 3339, 4088, 4094
   syntax-printer.js99.31%100%100%99.31%2539–2540, 2542–2543, 2545–2546, 2551, 2818–2821, 2914, 351, 3589, 4009, 4118, 4806, 5107, 5894, 725
   syntax.js100%100%100%100%
   topologicalSort.js100%100%100%100%
lib/debug
   ProfilingPlugin.js94.02%100%100%94.02%169, 417–419, 421, 425, 433, 437, 452, 580, 587, 596, 600, 609, 614, 620, 625, 92
lib/define
   DefinePlugin.js98.85%100%100%98.85%1493, 268–269, 285, 304, 378, 936, 938, 943, 967
   DotenvPlugin.js97.58%100%100%97.58%276, 391, 439, 452–453
   EnvironmentPlugin.js97.14%100%100%97.14%49
lib/deno
   DenoTargetPlugin.js100%100%100%100%
lib/dependencies
   ConstDependency.js100%100%100%100%
   ContextElementDependency.js100%100%100%100%
   NullDependency.js100%100%100%100%
lib/dependencies/amd
   AMDDefineDependency.js100%100%100%100%
   AMDDefineDependencyParserPlugin.js100%100%100%100%
   AMDPlugin.js99.31%100%100%99.31%54
   AMDRequireArrayDependency.js100%100%100%100%
   AMDRequireContextDependency.js100%100%100%100%
   AMDRequireDependenciesBlock.js100%100%100%100%
   AMDRequireDependenciesBlockParserPlugin.js100%100%100%100%
   AMDRequireDependency.js100%100%100%100%
   AMDRequireItemDependency.js100%100%100%100%
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.41%. Comparing base (bd464b2) to head (a517d7f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22689      +/-   ##
==========================================
- Coverage   96.41%   96.41%   -0.01%     
==========================================
  Files         776      776              
  Lines      134664   134669       +5     
  Branches    45201    45204       +3     
==========================================
  Hits       129840   129840              
- Misses       4824     4829       +5     
Flag Coverage Δ
css-parsing 24.81% <ø> (ø)
html5lib 26.54% <0.00%> (-0.01%) ⬇️
integration 81.32% <87.50%> (-0.01%) ⬇️
minify-corpora 90.36% <ø> (ø)
syntax-equivalence 76.57% <0.00%> (-0.02%) ⬇️
test262 55.56% <ø> (ø)
test262-parser 79.47% <ø> (ø)
unit 76.46% <100.00%> (+<0.01%) ⬆️
xmlconf 27.58% <57.14%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Generated code size

Comparing base (bd464b2) to head (a517d7f). Merging this pull request adds 2 new asset(s).

What moved Tests Assets Gzip Raw Test edit
Changed, test untouched 0 0 — — —
Changed, test edited 0 0 — — —
New 1 2 ⚪ added +794 B ⚪ added +1.17 KiB —
Deleted 0 0 — — —
Unchanged — 8840 — — —

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 that both runs emit changed size — everything below is new or deleted.

2 asset(s) this pull request adds
Asset Raw Gzip (9) Brotli (11) Zstd (19)
⚪ added optimization/minimize-xml 6/sorted.js 976 B 599 B 506 B 602 B
⚪ added optimization/minimize-xml 6/sorted.svg 221 B 195 B 147 B 180 B

No runtime that both runs build changed which runtime modules it carries.

1 runtime(s) this pull request adds or no longer builds
Runtime Modules
➕ optimization/minimize-xml 6/main 3

Built test/configCases with the defaults a user gets: 2242 test(s), 8842 asset(s), 100 emitted nothing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait marked this pull request as ready for review October 15, 2026 01:58
@alexander-akait
alexander-akait merged commit c47e84f into main Oct 15, 2026
68 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait deleted the feat/xml-attribute-sorting branch October 15, 2026 01:59
@codspeed

codspeed Bot commented Oct 15, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 86.89%

⚠️ 108 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

  • benchmark "cache-filesystem", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "context-esm", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "resolve-unsafe-cache", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • benchmark "wasm-modules-sync", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "devtool-source-map", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • benchmark "asset-modules-bytes", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • benchmark "json-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • benchmark "resolve-unsafe-cache", scenario '{"name":"mode-development","mode":"development"}'
  • benchmark "css-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}'
  • …and 98 more
ℹ️ 42 benchmarks have no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

  • benchmark "context-esm", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "wasm-modules-sync", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "loader-babel", scenario '{"name":"mode-development","mode":"development"}'
  • benchmark "three-long", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "asset-modules-source", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "asset-modules-bytes", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "concatenate-modules", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "context-commonjs", scenario '{"name":"mode-production","mode":"production"}'
  • benchmark "json-modules", scenario '{"name":"mode-production","mode":"production"}'
  • unit benchmark "scope-analyzer-unit", analyze 'lodash.js'
  • …and 32 more
⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 6 improved benchmarks
✅ 400 untouched benchmarks
⏩ 6 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Memory unit benchmark "css-printer-tailwind-unit", minify (deep nesting) 131.4 KB 35 KB ×3.8
⚡ Memory unit benchmark "scope-analyzer-unit", parse 'typescript.js' 948.1 KB 411.5 KB ×2.3
⚡ Memory unit benchmark "js-parser-unit", mode 'parse' 840.1 KB 454.6 KB +84.8%
⚡ Memory benchmark "no-minimize", scenario '{"name":"mode-development","mode":"development"}' 1.8 MB 1.2 MB +49.53%
⚡ Memory benchmark "no-exports-analysis", scenario '{"name":"mode-development","mode":"development"}' 1.7 MB 1.2 MB +40.41%
⚡ Memory benchmark "asset-modules-source", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 244.9 KB 193 KB +26.89%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/xml-attribute-sorting (a517d7f) with main (bd464b2)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait alexander-akait mentioned this pull request Oct 15, 2026
feat(xml): remove optional SVG metadata and editor data #22692
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area: config Options, defaults, validation (lib/config, schemas/) area: html Experimental HTML support (lib/html) area: tooling Repo tooling, codegen, CLI entry (tooling/, bin/) area: types types.d.ts, JSDoc annotations, hand-maintained declarations

Projects

None yet

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.

1 participant

@alexander-akait
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.