Skip to content

refactor: group the module model, the diagnostics and four more out of lib/ root - #22202

Merged
alexander-akait merged 3 commits into
mainfrom
refactor/group-more-lib-directories
Sep 20, 2026
Merged

alexander-akait merged 3 commits into
mainfrom
refactor/group-more-lib-directories

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

Continues the lib/ grouping from #22118 and #22191. 21 files move out of lib/ root (66 → 49): a new lib/module/ takes the module model — the Module base class and NormalModule, the ModuleFactory hierarchy, Generator and CodeGenerationResults, ModuleProfile and the two type-constant files — and a new lib/diagnostics/ takes the plugins that raise a build-wide warning of their own plus NoEmitOnErrorsPlugin; CircularModulesPlugin, LibraryTemplatePlugin, PlatformPlugin and HotModuleReplacementPlugin join optimize/, library/, config/ and hmr/. Behaviour is unchanged: every file moves as a git rename and types.d.ts regenerates byte-identical.

Four re-exports are owed and kept — NormalModule, RawModule, NullFactory and LibraryTemplatePlugin, each required at the top level by a package that depends on or peers webpack 5. Module and Generator are not: their only importer also imports lib/DependenciesBlockVariable and lib/JavascriptGenerator, both removed in webpack 5, so they are recorded as unreachable instead. The three serializable classes keep their old request restorable through registerLegacyRequest, so a cache pack written before this still loads.

The scan tool gains one rule: --write no longer records a path the removed map already names, so the two maps are disjoint and the request count means what it says. AGENTS.md gains a required section on moving a file out of lib/ root, listing the five places a path hides — of which only require() is caught by anything automatic — and two stale file references it already carried are corrected.

What kind of change does this PR introduce?

refactor

Did you add tests for your changes?

No new cases — test/unitCases/deepPathShims.unittest.js already asserts every deep path the recorded scan names still resolves, and covers the four new re-exports off the same record. Generator.unittest.js needed its stack-frame expectation updated to the new path.

Does this PR introduce a breaking change?

No. compiler.webpack.* and the documented API are unchanged, every deep path the scan found either still resolves or is re-exported, and a pre-move persistent cache pack still restores.

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

n/a — the Architecture listing in AGENTS.md gains a bullet per new directory, plus the new section on how to perform a move.

Use of AI

Claude Code performed the moves and reference rewrites and ran the verification; each grouping was reviewed before pushing. yarn lint passes all nine stages, yarn fix:special leaves types.d.ts byte-identical, ConfigCacheTestCases reports no Pack got invalid line across 16578 tests, and each re-export decision was made by reading the importing package's declared webpack range and its actual import site rather than its download count.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GWQWGaxh78jX2Ffh4EZ878


Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bf58839

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 328 files, which is 28 over the limit of 300.

To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: Repository: webpack/webpack/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 278821e7-5a5f-4586-9aed-a51d74895750

📥 Commits

Reviewing files that changed from the base of the PR and between 39f17ad and bf58839.

📒 Files selected for processing (328)
  • AGENTS.md
  • lib/APIPlugin.js
  • lib/Chunk.js
  • lib/ChunkGroup.js
  • lib/CompatibilityPlugin.js
  • lib/Compilation.js
  • lib/Compiler.js
  • lib/ConcatenationScope.js
  • lib/ConstPlugin.js
  • lib/DefinePlugin.js
  • lib/Dependency.js
  • lib/ExportsInfoApiPlugin.js
  • lib/JavascriptMetaInfoPlugin.js
  • lib/LazyBarrel.js
  • lib/LibraryTemplatePlugin.js
  • lib/ModuleInfoHeaderPlugin.js
  • lib/NormalModule.js
  • lib/NullFactory.js
  • lib/Parser.js
  • lib/ProgressPlugin.js
  • lib/ProvidePlugin.js
  • lib/RawModule.js
  • lib/UseStrictPlugin.js
  • lib/WebpackIsIncludedPlugin.js
  • lib/asset/AssetBytesGenerator.js
  • lib/asset/AssetBytesParser.js
  • lib/asset/AssetGenerator.js
  • lib/asset/AssetModule.js
  • lib/asset/AssetModulesPlugin.js
  • lib/asset/AssetParser.js
  • lib/asset/AssetSourceGenerator.js
  • lib/asset/AssetSourceParser.js
  • lib/asset/RawDataUrlModule.js
  • lib/asset/WebManifestGenerator.js
  • lib/asset/WebManifestParser.js
  • lib/async-modules/AsyncModuleHelpers.js
  • lib/async-modules/AwaitDependenciesInitFragment.js
  • lib/async-modules/InferAsyncModulesPlugin.js
  • lib/async-modules/isGeneratorLowered.js
  • lib/config/PlatformPlugin.js
  • lib/config/WebpackOptionsApply.js
  • lib/config/defaults.js
  • lib/container/ContainerEntryModule.js
  • lib/container/ContainerEntryModuleFactory.js
  • lib/container/FallbackModule.js
  • lib/container/FallbackModuleFactory.js
  • lib/container/HoistContainerReferencesPlugin.js
  • lib/container/RemoteModule.js
  • lib/context/ContextModule.js
  • lib/context/ContextModuleFactory.js
  • lib/css/CssGenerator.js
  • lib/css/CssInjectStyleRuntimeModule.js
  • lib/css/CssLoadingRuntimeModule.js
  • lib/css/CssModule.js
  • lib/css/CssModulesPlugin.js
  • lib/css/CssParser.js
  • lib/css/syntax.js
  • lib/debug/ProfilingPlugin.js
  • lib/dependencies/AMDDefineDependencyParserPlugin.js
  • lib/dependencies/AMDPlugin.js
  • lib/dependencies/CommonJsDependencyHelpers.js
  • lib/dependencies/CommonJsExportRequireDependency.js
  • lib/dependencies/CommonJsExportsParserPlugin.js
  • lib/dependencies/CommonJsPlugin.js
  • lib/dependencies/CommonJsRequireDependency.js
  • lib/dependencies/ContextElementDependency.js
  • lib/dependencies/CssIcssExportDependency.js
  • lib/dependencies/CssIcssSymbolDependency.js
  • lib/dependencies/CssUrlDependency.js
  • lib/dependencies/DynamicExports.js
  • lib/dependencies/ExportsInfoDependency.js
  • lib/dependencies/ExternalModuleInitFragment.js
  • lib/dependencies/HarmonyCompatibilityDependency.js
  • lib/dependencies/HarmonyDetectionParserPlugin.js
  • lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js
  • lib/dependencies/HarmonyExportExpressionDependency.js
  • lib/dependencies/HarmonyExportImportedSpecifierDependency.js
  • lib/dependencies/HarmonyExportInitFragment.js
  • lib/dependencies/HarmonyExportSpecifierDependency.js
  • lib/dependencies/HarmonyExports.js
  • lib/dependencies/HarmonyImportBareSideEffectDependency.js
  • lib/dependencies/HarmonyImportDependency.js
  • lib/dependencies/HarmonyImportDependencyParserPlugin.js
  • lib/dependencies/HarmonyImportGuard.js
  • lib/dependencies/HarmonyImportSideEffectDependency.js
  • lib/dependencies/HarmonyImportSpecifierDependency.js
  • lib/dependencies/HarmonyModulesPlugin.js
  • lib/dependencies/HtmlEntryDependency.js
  • lib/dependencies/HtmlInlineHtmlDependency.js
  • lib/dependencies/HtmlInlineStyleDependency.js
  • lib/dependencies/HtmlSourceDependency.js
  • lib/dependencies/ImportDependency.js
  • lib/dependencies/ImportEagerDependency.js
  • lib/dependencies/ImportMetaContextPlugin.js
  • lib/dependencies/ImportMetaGlobDependencyParserPlugin.js
  • lib/dependencies/ImportMetaPlugin.js
  • lib/dependencies/ImportParserPlugin.js
  • lib/dependencies/ImportPlugin.js
  • lib/dependencies/ImportWeakDependency.js
  • lib/dependencies/LoaderPlugin.js
  • lib/dependencies/ModuleDependency.js
  • lib/dependencies/ModuleDependencyTemplateAsId.js
  • lib/dependencies/PureExpressionDependency.js
  • lib/dependencies/RequireContextPlugin.js
  • lib/dependencies/RequireEnsurePlugin.js
  • lib/dependencies/RequireIncludePlugin.js
  • lib/dependencies/RequireJsStuffPlugin.js
  • lib/dependencies/SystemPlugin.js
  • lib/dependencies/TopLevelAwaitDependency.js
  • lib/dependencies/URLDependency.js
  • lib/dependencies/URLPlugin.js
  • lib/dependencies/WorkerAndWorkletPlugin.js
  • lib/devtool/EvalSourceMapDevToolPlugin.js
  • lib/devtool/ModuleFilenameHelpers.js
  • lib/devtool/SourceMapDevToolPlugin.js
  • lib/diagnostics/IgnoreWarningsPlugin.js
  • lib/diagnostics/NoEmitOnErrorsPlugin.js
  • lib/diagnostics/WarnCaseSensitiveModulesPlugin.js
  • lib/diagnostics/WarnDeprecatedOptionPlugin.js
  • lib/diagnostics/WarnNoModeSetPlugin.js
  • lib/dll/DelegatedModule.js
  • lib/dll/DelegatedModuleFactoryPlugin.js
  • lib/dll/DllModule.js
  • lib/dll/DllModuleFactory.js
  • lib/dll/LibManifestPlugin.js
  • lib/errors/AsyncDependencyToInitialChunkError.js
  • lib/errors/BuildCycleError.js
  • lib/errors/CodeGenerationError.js
  • lib/errors/EnvironmentNotSupportAsyncWarning.js
  • lib/errors/ExternalStarReexportError.js
  • lib/errors/IgnoreErrorModuleFactory.js
  • lib/errors/InvalidDependenciesModuleWarning.js
  • lib/errors/ModuleDependencyError.js
  • lib/errors/ModuleDependencyWarning.js
  • lib/errors/ModuleHashingError.js
  • lib/errors/ModuleNotFoundError.js
  • lib/errors/ModuleRestoreError.js
  • lib/errors/ModuleStoreError.js
  • lib/errors/WebpackError.js
  • lib/esm/ModuleChunkFormatPlugin.js
  • lib/esm/ModuleChunkLoadingPlugin.js
  • lib/esm/ModuleChunkLoadingRuntimeModule.js
  • lib/externals/ExternalModule.js
  • lib/externals/ExternalModuleFactoryPlugin.js
  • lib/graph/ChunkGraph.js
  • lib/graph/ExportsInfo.js
  • lib/graph/ModuleGraph.js
  • lib/graph/ModuleGraphConnection.js
  • lib/graph/buildChunkGraph.js
  • lib/hmr/HotModuleReplacementPlugin.js
  • lib/hmr/LazyCompilationPlugin.js
  • lib/html/HtmlGenerator.js
  • lib/html/HtmlModule.js
  • lib/html/HtmlModulesPlugin.js
  • lib/html/HtmlParser.js
  • lib/html/builtinEmbeddedRenderer.js
  • lib/html/syntax.js
  • lib/ids/ChunkModuleIdRangePlugin.js
  • lib/ids/DeterministicModuleIdsPlugin.js
  • lib/ids/IdHelpers.js
  • lib/ids/OccurrenceModuleIdsPlugin.js
  • lib/ids/RecordIdsPlugin.js
  • lib/ids/SyncModuleIdsPlugin.js
  • lib/index.js
  • lib/javascript/ArrayPushCallbackChunkFormatPlugin.js
  • lib/javascript/ChunkFormatHelpers.js
  • lib/javascript/JavascriptGenerator.js
  • lib/javascript/JavascriptModule.js
  • lib/javascript/JavascriptModulesPlugin.js
  • lib/javascript/JavascriptParser.js
  • lib/json/JsonGenerator.js
  • lib/json/JsonModule.js
  • lib/json/JsonModulesPlugin.js
  • lib/json/JsonParser.js
  • lib/library/AbstractLibraryPlugin.js
  • lib/library/AssignLibraryPlugin.js
  • lib/library/ExportPropertyLibraryPlugin.js
  • lib/library/LibraryTemplatePlugin.js
  • lib/library/ModuleLibraryPlugin.js
  • lib/loaders/LoaderOptionsPlugin.js
  • lib/loaders/LoaderRunner.js
  • lib/loaders/LoaderTargetPlugin.js
  • lib/module/CodeGenerationResults.js
  • lib/module/Generator.js
  • lib/module/Module.js
  • lib/module/ModuleFactory.js
  • lib/module/ModuleProfile.js
  • lib/module/ModuleSourceTypeConstants.js
  • lib/module/ModuleTypeConstants.js
  • lib/module/NormalModule.js
  • lib/module/NormalModuleFactory.js
  • lib/module/NullFactory.js
  • lib/module/RawModule.js
  • lib/module/SelfModuleFactory.js
  • lib/node/CommonJsChunkLoadingPlugin.js
  • lib/node/NodeStuffPlugin.js
  • lib/node/ReadFileChunkLoadingRuntimeModule.js
  • lib/node/ReadFileCompileAsyncWasmPlugin.js
  • lib/node/ReadFileCompileWasmPlugin.js
  • lib/node/RequireChunkLoadingRuntimeModule.js
  • lib/optimize/AggressiveSplittingPlugin.js
  • lib/optimize/CircularModulesPlugin.js
  • lib/optimize/ConcatenatedModule.js
  • lib/optimize/ConstExportsPlugin.js
  • lib/optimize/FlagDependencyExportsPlugin.js
  • lib/optimize/FlagDependencyUsagePlugin.js
  • lib/optimize/FlagIncludedChunksPlugin.js
  • lib/optimize/InlineExports.js
  • lib/optimize/InnerGraph.js
  • lib/optimize/InnerGraphPlugin.js
  • lib/optimize/MangleExportsPlugin.js
  • lib/optimize/ModuleConcatenationPlugin.js
  • lib/optimize/RemoveParentModulesPlugin.js
  • lib/optimize/SideEffectsFlagPlugin.js
  • lib/optimize/SplitChunksPlugin.js
  • lib/performance/AnalyzableBailoutsPlugin.js
  • lib/performance/BroadContextsPlugin.js
  • lib/performance/CacheEffectivenessPlugin.js
  • lib/performance/DuplicateModulesPlugin.js
  • lib/performance/DuplicatePackagesPlugin.js
  • lib/performance/DuplicatePackagesWarning.js
  • lib/performance/DynamicExportsPlugin.js
  • lib/performance/EvalUsagePlugin.js
  • lib/performance/HotspotsPlugin.js
  • lib/performance/LargeModulesPlugin.js
  • lib/performance/MissingSideEffectsPlugin.js
  • lib/performance/MissingSourceMapsPlugin.js
  • lib/performance/PureAnnotationsPlugin.js
  • lib/performance/RedundantDynamicImportsPlugin.js
  • lib/performance/ScopeHoistingBailoutsPlugin.js
  • lib/performance/SizeLimitsPlugin.js
  • lib/performance/TopLevelThisPlugin.js
  • lib/performance/UnusedAliasesPlugin.js
  • lib/performance/UnusedAssetsPlugin.js
  • lib/performance/UnusedDefinesPlugin.js
  • lib/performance/UnusedModulesPlugin.js
  • lib/performance/getModuleSize.js
  • lib/performance/getSourceModules.js
  • lib/performance/hasOnlyUnusedExports.js
  • lib/performance/isOnlyReexported.js
  • lib/prefetch/AutomaticPrefetchPlugin.js
  • lib/prefetch/ResourceHintPlugin.js
  • lib/prefetch/parseResourceHintOptions.js
  • lib/resolve/IgnorePlugin.js
  • lib/resolve/NormalModuleReplacementPlugin.js
  • lib/runtime/DefinePropertyGettersRuntimeModule.js
  • lib/runtime/EnsureChunkRuntimeModule.js
  • lib/runtime/GetTrustedTypesPolicyRuntimeModule.js
  • lib/runtime/MakeDeferredNamespaceObjectRuntime.js
  • lib/runtime/OnChunksLoadedRuntimeModule.js
  • lib/runtime/RuntimeModule.js
  • lib/runtime/RuntimePlugin.js
  • lib/schemes/DataUriPlugin.js
  • lib/schemes/HttpUriPlugin.js
  • lib/schemes/VirtualUrlPlugin.js
  • lib/sharing/ConsumeSharedModule.js
  • lib/sharing/ConsumeSharedRuntimeModule.js
  • lib/sharing/ProvideSharedModule.js
  • lib/sharing/ProvideSharedModuleFactory.js
  • lib/sharing/ProvideSharedPlugin.js
  • lib/sharing/ShareRuntimeModule.js
  • lib/stats/DefaultStatsFactoryPlugin.js
  • lib/stats/StatsFactory.js
  • lib/template/ConditionalInitFragment.js
  • lib/template/DependencyTemplate.js
  • lib/template/InitFragment.js
  • lib/template/ModuleTemplate.js
  • lib/template/RuntimeTemplate.js
  • lib/template/Template.js
  • lib/template/TemplatedPathPlugin.js
  • lib/typescript/TypeScriptPlugin.js
  • lib/url/URLParserPlugin.js
  • lib/util/buildDiagnostics.js
  • lib/util/chainedImports.js
  • lib/util/comparators.js
  • lib/util/implicitTypeLoaderFallback.js
  • lib/util/internalSerializables.js
  • lib/util/preloadModuleType.js
  • lib/util/removeBOM.js
  • lib/wasm-async/AsyncWasmModule.js
  • lib/wasm-async/AsyncWebAssemblyGenerator.js
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js
  • lib/wasm-async/AsyncWebAssemblyModulesPlugin.js
  • lib/wasm-async/AsyncWebAssemblyParser.js
  • lib/wasm-async/UniversalCompileAsyncWasmPlugin.js
  • lib/wasm-sync/SyncWasmModule.js
  • lib/wasm-sync/WasmChunkLoadingRuntimeModule.js
  • lib/wasm-sync/WasmFinalizeExportsPlugin.js
  • lib/wasm-sync/WebAssemblyGenerator.js
  • lib/wasm-sync/WebAssemblyInInitialChunkError.js
  • lib/wasm-sync/WebAssemblyJavascriptGenerator.js
  • lib/wasm-sync/WebAssemblyModulesPlugin.js
  • lib/wasm-sync/WebAssemblyParser.js
  • lib/wasm-sync/WebAssemblyUtils.js
  • lib/web/FetchCompileAsyncWasmPlugin.js
  • lib/web/FetchCompileWasmPlugin.js
  • lib/web/JsonpChunkLoadingPlugin.js
  • lib/web/JsonpChunkLoadingRuntimeModule.js
  • lib/webworker/ImportScriptsChunkLoadingPlugin.js
  • lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js
  • schemas/WebpackOptions.json
  • test/CodeSizeTestCases.size.js
  • test/configCases/asset-modules/process-result-async-error/webpack.config.js
  • test/configCases/asset-modules/process-result-async-loader-error/webpack.config.js
  • test/configCases/asset-modules/process-result-non-error/webpack.config.js
  • test/configCases/asset-modules/process-result-rename-data-url/webpack.config.js
  • test/configCases/asset-modules/process-result-rename-inline/webpack.config.js
  • test/configCases/asset-modules/process-result-rename-query/webpack.config.js
  • test/configCases/asset-modules/process-result-rename/webpack.config.js
  • test/configCases/asset-modules/process-result-sync-throw/webpack.config.js
  • test/configCases/css/minify-embedded-no-devtool/webpack.config.js
  • test/configCases/errors/before-snapshot-non-error/webpack.config.js
  • test/helpers/SampleEmbeddedMinifyPlugin.js
  • test/helpers/analyzableConformance.js
  • test/hotCases/asset-modules/process-result-rename/webpack.config.js
  • test/specCases/test262.spectest.js
  • test/statsCases/split-chunks-dedup/webpack.config.js
  • test/unitCases/Compiler.unittest.js
  • test/unitCases/Generator.unittest.js
  • test/unitCases/HotModuleReplacementPlugin.unittest.js
  • test/unitCases/LazyCompilationBackend.unittest.js
  • test/unitCases/ModuleGraph.unittest.js
  • test/unitCases/NormalModule.unittest.js
  • test/unitCases/RuntimeTemplate.unittest.js
  • test/unitCases/removeBOM.unittest.js
  • test/watchCases/asset-modules/process-result-rename/webpack.config.js
  • tooling/deep-webpack-imports.json
  • tooling/find-deep-webpack-imports.js

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Install it locally:

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

@github-actions github-actions Bot added area: wasm WebAssembly modules (lib/wasm-*) area: module-federation Module Federation (lib/container, lib/sharing) area: parser JavaScript parsing and dependency analysis (lib/javascript, lib/dependencies) area: config Options, defaults, validation (lib/config, schemas/) area: css CSS support (lib/css) area: html Experimental HTML support (lib/html) area: loaders Loader execution and loader API (lib/loaders) area: optimization Tree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids) area: runtime Emitted runtime and chunk loading across targets (lib/runtime, lib/web, lib/node, lib/esm) area: watch Watching, HMR, lazy compilation (lib/hmr, hot/) area: tooling Repo tooling, codegen, CLI entry (tooling/, bin/) labels Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Generated code size

Comparing base (39f17ad) to head (bf58839). Merging this pull request changes the size of 9 asset(s) whose tests it leaves untouched.

What moved Tests Assets Gzip Raw Test edit
Changed, test untouched 5 9 🔴 ↑ +27 B 🔴 ↑ +182 B —
Changed, test edited 0 0 — — —
New 0 0 — — —
Deleted 0 0 — — —
Unchanged — 7738 — — —

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, so 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.

9 asset(s) changed size, test untouched
Asset Before After Change Gzip (9) Brotli (11) Zstd (19)
🔴 ↑ asset-modules/data-url-broken [hash] 878 B 906 B +28 B (+3.19%) +6 B (+1.54%) +2 B (+0.63%) +4 B (+1.04%)
🔴 ↑ errors/module-parse-error [hash].module.wasm 1.04 KiB 1.07 KiB +28 B (+2.63%) +3 B (+0.68%) -4 B (-1.11%) +3 B (+0.68%)
🔴 ↑ errors/module-parse-error 888.bundle0.js 1.15 KiB 1.17 KiB +28 B (+2.39%) +3 B (+0.60%) +9 B (+2.23%) +4 B (+0.80%)
🔴 ↑ asset-modules/data-url-broken bundle0.js 4.34 KiB 4.37 KiB +28 B (+0.63%) +3 B (+0.20%) +3 B (+0.24%) +3 B (+0.20%)
🔴 ↑ asset-modules/process-result-async-error [hash].png 547 B 568 B +21 B (+3.84%) +2 B (+0.75%) +6 B (+2.64%) +3 B (+1.20%)
🔴 ↑ asset-modules/process-result-async-error bundle0.js 3.67 KiB 3.69 KiB +21 B (+0.56%) +3 B (+0.23%) +2 B (+0.18%) -3 B (-0.22%)
🔴 ↑ loaders/options bundle0.js 4.24 KiB 4.25 KiB +14 B (+0.32%) +3 B (+0.26%) +10 B (+1.03%) +3 B (+0.26%)
🔴 ↑ asset-modules/process-result-non-error [hash].png 275 B 282 B +7 B (+2.55%) +2 B (+0.97%) — +4 B (+2.07%)
🔴 ↑ asset-modules/process-result-non-error bundle0.js 3.78 KiB 3.78 KiB +7 B (+0.18%) +2 B (+0.14%) +3 B (+0.25%) +3 B (+0.20%)

No runtime gained or lost a runtime module.

Built test/configCases with the defaults a user gets: 2197 test(s), 7747 asset(s), 88 emitted nothing.

@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.36364% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.00%. Comparing base (39f17ad) to head (bf58839).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/module/NormalModule.js 96.55% 26 Missing ⚠️
lib/library/LibraryTemplatePlugin.js 22.22% 7 Missing ⚠️
lib/index.js 62.50% 3 Missing ⚠️
lib/module/NullFactory.js 50.00% 2 Missing ⚠️
lib/module/RawModule.js 96.42% 2 Missing ⚠️
lib/Dependency.js 50.00% 1 Missing ⚠️
lib/module/Module.js 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22202      +/-   ##
==========================================
+ Coverage   94.98%   95.00%   +0.01%     
==========================================
  Files         749      751       +2     
  Lines      104424   104428       +4     
  Branches    32161    32161              
==========================================
+ Hits        99189    99209      +20     
+ Misses       5235     5219      -16     
Flag Coverage Δ
css-parsing 23.79% <52.08%> (+<0.01%) ⬆️
html5lib 26.88% <52.04%> (+<0.01%) ⬆️
integration 83.72% <95.60%> (+<0.01%) ⬆️
syntax-equivalence 76.75% <100.00%> (ø)
test262 41.72% <65.34%> (+<0.01%) ⬆️
unit 74.92% <79.15%> (+<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.

@codspeed

codspeed Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 44.58%

⚠️ 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

⚡ 1 improved benchmark
❌ 5 regressed benchmarks
✅ 388 untouched benchmarks
⏩ 6 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory benchmark "side-effects-reexport", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 152.9 KB 903.2 KB -83.07%
❌ Memory benchmark "future-defaults", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 166.6 KB 663.9 KB -74.91%
❌ Memory benchmark "many-modules-interop-runtime", scenario '{"name":"mode-production","mode":"production"}', measure 'exec' 15.2 KB 22 KB -30.75%
❌ Simulation benchmark "wasm-modules-sync", scenario '{"name":"mode-development","mode":"development"}' 818.9 ms 1,146.3 ms -28.56%
❌ Memory benchmark "html-many-chunks", scenario '{"name":"mode-development","mode":"development"}' 1.7 MB 2.3 MB -26.3%
⚡ Memory benchmark "wasm-modules-async", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 412.7 KB 220.4 KB +87.19%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing refactor/group-more-lib-directories (bf58839) with main (1046319)2

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. ↩

  2. No successful run was found on main (39f17ad) during the generation of this report, so 1046319 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

A new `lib/diagnostics/` holds the plugins that raise a build-wide warning of
their own — a case-insensitive filesystem collision, a deprecated option, a
missing `mode` — plus `IgnoreWarningsPlugin`, which filters what they produced,
and `NoEmitOnErrorsPlugin`, which reacts to errors rather than raising one. The
classes they construct stay in `lib/errors/` and the `performance` hints in
`lib/performance/`. `CircularModulesPlugin` joins `lib/optimize/` beside the
passes that reason about the same cycles, and `LibraryTemplatePlugin`
`lib/library/`. `lib/` root goes from 66 files to 60.

`LibraryTemplatePlugin` keeps a re-export at its old path: `@aiot-toolkit/`
and `@hap-toolkit/dsl-xvm` depend on webpack 5 directly and
`@stylable/webpack-extensions` peers `^5.30.0`, and all three require it at the
top level, for 139k weekly downloads. Nothing else moved here is imported from
outside.

`schemas/WebpackOptions.json` follows the file its `tsType` points at, without
which `ignoreWarnings` regenerates as `any[]`. `types.d.ts` is byte-identical.
The `Module` base class and `NormalModule`, the `ModuleFactory` hierarchy that
builds them, the `Generator` base class and the `CodeGenerationResults` its
output lands in, `ModuleProfile`, and the two type-constant files leave `lib/`
root together. A module subclass a plugin owns stays with that plugin, so this
holds the ones every build has. Root goes from 60 files to 51.

Three classes carry a serialization request. Each moves to
`webpack/lib/module/<Name>` and keeps the old one restorable through
`registerLegacyRequest`, so a pack written before this still loads;
`internalSerializables` records both.

`NormalModule`, `RawModule` and `NullFactory` keep a re-export at their old
paths — webpack-5 packages require each at the top level, for 271k weekly
downloads between them. `Module` and `Generator` do not: their only importer is
hard-source-webpack-plugin, which also imports `lib/DependenciesBlockVariable`
and `lib/JavascriptGenerator`, both removed in webpack 5, so both paths are
recorded as unreachable instead.

Two `schemas/WebpackOptions.json` `tsType` paths follow the files they point at.
`types.d.ts` regenerates byte-identical.
`PlatformPlugin` pins the target platform a `target: false` build cannot infer,
so it joins the rest of the option handling in `lib/config/`, and
`HotModuleReplacementPlugin` joins the runtime modules and backend it drives in
`lib/hmr/`. Neither is imported by any package the ecosystem scan reaches, so
neither needs a re-export. Root goes from 51 files to 49.

The scan itself gains a rule and loses an ambiguity: `--write` now skips a path
the `removed` map names instead of recording it as a request too, so the two
maps are disjoint and the request count means what it says. Refreshing the
record over today's registry moved 25 such paths out of `requests`.

AGENTS.md gains a required section on moving a file out of `lib/` root — run
the scan, what earns a re-export, and the five places a path hides, of which
only `require()` is obvious. Two references it already carried had gone stale
under earlier moves and are corrected.
@alexander-akait
alexander-akait force-pushed the refactor/group-more-lib-directories branch from b9bc578 to bf58839 Compare September 20, 2026 15:07
@github-actions

Copy link
Copy Markdown
Contributor

Types Coverage

Coverage after merging refactor/group-more-lib-directories into main will be
98.33%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
bin
   webpack.js98.82%100%100%98.82%103
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/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
   APIPlugin.js100%100%100%100%
   AsyncDependenciesBlock.js100%100%100%100%
   BannerPlugin.js100%100%100%100%
   Chunk.js99.72%100%100%99.72%42
   ChunkGroup.js100%100%100%100%
   CleanPlugin.js97.81%100%100%97.81%111, 125, 128, 212, 232
   CompatibilityPlugin.js100%100%100%100%
   Compilation.js98.59%100%100%98.59%1759, 2080, 2087, 2095, 2117, 2120, 30, 3056, 3535–3536, 3568, 4157, 4161, 4260, 4281, 4406, 4443, 4450, 4503–4504, 4508, 4513, 4529–4530, 4544–4545, 4550–4551, 5074, 5100, 5930, 5947, 5965, 5981, 5996, 6021, 6024, 6392, 6395–6396, 6401, 6416, 6499, 6523, 6637, 839–840
   Compiler.js98.81%100%100%98.81%1116, 1153, 1156, 1336–1337, 1345, 848, 934, 975
   ConcatenationScope.js99.10%100%100%99.10%293
   ConstPlugin.js100%100%100%100%
   CopyPlugin.js99.79%100%100%99.79%160
   DefinePlugin.js99.14%100%100%99.14%1127, 200–201, 217, 236, 310
   DependenciesBlock.js100%100%100%100%
   Dependency.js98.54%100%100%98.54%498, 545
   DependencyTemplate.js100%100%100%100%
   DotenvPlugin.js98.07%100%100%98.07%391, 439, 452–453
   EntryPlugin.js100%100%100%100%
   Entrypoint.js100%100%100%100%
   EnvironmentPlugin.js97.14%100%100%97.14%49
   ExportsInfoApiPlugin.js100%100%100%100%
   ExternalsPlugin.js100%100%100%100%
   FileSystemInfo.js99.75%100%100%99.75%187, 285, 3947, 3962, 3986, 3989
   HotUpdateChunk.js100%100%100%100%
   InitFragment.js100%100%100%100%
   JavascriptMetaInfoPlugin.js100%100%100%100%
   LazyBarrel.js100%100%100%100%
   LibraryTemplatePlugin.js100%100%100%100%
   ManifestPlugin.js100%100%100%100%
   ModuleFilenameHelpers.js100%100%100%100%
   ModuleInfoHeaderPlugin.js100%100%100%100%
   ModuleNotFoundError.js100%100%100%100%
   MultiCompiler.js98.88%100%100%98.88%460, 532, 719, 784
   MultiStats.js100%100%100%100%
   NormalModule.js100%100%100%100%
   NullFactory.js100%100%100%100%
   Parser.js100%100%100%100%
   ProgressPlugin.js99.80%100%100%99.80%694
   ProvidePlugin.js100%100%100%100%
   RawModule.js100%100%100%100%
   RequestShortener.js100%100%100%100%
   SingleEntryPlugin.js100%100%100%100%
   Stats.js100%100%100%100%
   UseStrictPlugin.js100%100%100%100%
   WebpackError.js100%100%100%100%
   WebpackIsIncludedPlugin.js100%100%100%100%
   cli.js98.63%100%100%98.63%10, 117, 547, 579, 629, 903
   index.js99.73%100%100%99.73%184
   webpack.js97.12%100%100%97.12%10, 274, 296, 298
lib/asset
   AssetBytesGenerator.js100%100%100%100%
   AssetBytesParser.js100%100%100%100%
   AssetGenerator.js100%100%100%100%
   AssetModule.js100%100%100%100%
   AssetModulesPlugin.js98.15%100%100%98.15%338, 362, 365, 495, 57, 62
   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.55%100%100%96.55%1304, 1404, 1408, 1470, 1716, 1800, 1823, 1855, 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%
   defaults.js99.43%100%100%99.43%1614–1616, 1624, 283, 286, 291, 295
   defineConfig.js100%100%100%100%
   getClaimedAssetTypes.js100%100%100%100%
   normalization.js99.12%100%100%99.12%279–280, 346, 361
   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.66%100%100%95.66%230, 257, 276, 280–281, 289, 465, 486, 491, 532, 541, 543, 547, 550, 556–557
   ContextReplacementPlugin.js100%100%100%100%
lib/css
   CssGenerator.js99.47%100%100%99.47%1085, 136, 842
   CssInjectStyleRuntimeModule.js100%100%100%100%
   CssLoadingRuntimeModule.js100%100%100%100%
   CssModule.js82.98%100%100%82.98%186, 191–199, 201–206
   CssModulesPlugin.js99.85%100%100%99.85%826
   CssParser.js99.44%100%100%99.44%2225, 24, 2859, 2862, 2868, 2909, 2912, 2951, 2954, 3291, 4696, 4699, 841, 957, 988
   CssServerStylesRuntimeModule.js100%100%100%100%
   cssMinify.js96.43%100%100%96.43%132, 141
   data.js99.83%100%100%99.83%224, 4030
   syntax.js99.55%100%100%99.55%10007–10008, 10542–10543, 10577, 10733, 11934–11935, 11937–11938, 11940–11941, 11946, 124, 12961–12964, 13818, 13951, 14100, 14705, 15161, 15456, 16789, 17214, 17440, 18319, 2441, 3133, 3135, 3140, 3159, 3897, 3903, 6637, 6675, 6682, 7921
lib/debug
   ProfilingPlugin.js96.22%100%100%96.22%162, 418, 547, 554, 563,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: config Options, defaults, validation (lib/config, schemas/) area: css CSS support (lib/css) area: html Experimental HTML support (lib/html) area: loaders Loader execution and loader API (lib/loaders) area: module-federation Module Federation (lib/container, lib/sharing) area: optimization Tree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids) area: parser JavaScript parsing and dependency analysis (lib/javascript, lib/dependencies) area: runtime Emitted runtime and chunk loading across targets (lib/runtime, lib/web, lib/node, lib/esm) area: tooling Repo tooling, codegen, CLI entry (tooling/, bin/) area: wasm WebAssembly modules (lib/wasm-*) area: watch Watching, HMR, lazy compilation (lib/hmr, hot/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant