Skip to content

Commit 51058cd

Browse files
refactor: group the filesystem into lib/fs and ProgressPlugin into lib/logging (#22228)
* refactor: move ProgressPlugin into lib/logging It reports a build's progress through the same console surface the logger writes to, and already reached for `terminalColors` to do it. `lib/ProgressPlugin` stays as a re-export: webpack-stream declares `webpack ^5.21.2` and requires the path at the top of its index.js. * refactor: group the filesystem into lib/fs `fs.js` declares the `InputFileSystem` / `OutputFileSystem` surface every caller is typed against and the path helpers built on it; `FileSystemInfo` records the snapshots, timestamps and build dependencies a watch or a cache decides staleness from. They are one subject, so they get one directory. A filesystem a target supplies is not one of these — `NodeWatchFileSystem` stays in `lib/node/`. `lib/FileSystemInfo` stays as a re-export, since html-webpack-plugin declares `webpack ^5.20.0` and types against the path. `Snapshot` keeps its old serializer request restorable through `registerLegacyRequest`, so a pre-move cache pack still loads.
1 parent 0e0bd79 commit 51058cd

79 files changed

Lines changed: 5712 additions & 5681 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ The directory listings below are the canonical map of the repository. **Whenever
101101
- `lib/errors/` — Error and warning class hierarchy.
102102
- `lib/esm/` — ESM-specific output (e.g. `import.meta`).
103103
- `lib/externals/` — External modules: the `externals` option's module, factory plugin and the presets built on them.
104+
- `lib/fs/` — The filesystem webpack reads and writes through: `fs.js` declares the
105+
`InputFileSystem` / `OutputFileSystem` surface every caller is typed against and the
106+
path helpers built on it, and `FileSystemInfo` records the snapshots, timestamps and
107+
build dependencies a watch or a cache decides staleness from. A filesystem a target
108+
supplies is not one of these — `NodeWatchFileSystem` stays in `lib/node/`. The old
109+
`lib/FileSystemInfo` path stays as a re-export, since html-webpack-plugin types
110+
against it.
104111
- `lib/graph/` — The module and chunk graphs a compilation holds, and the things they
105112
are graphs of: `ModuleGraph` and its connections, `ChunkGraph` and the
106113
`buildChunkGraph` that fills it, and the `ExportsInfo` recording what each module
@@ -126,7 +133,9 @@ The directory listings below are the canonical map of the repository. **Whenever
126133
- `lib/loaders/` — Loader execution runtime (vendored loader-runner): pitching/normal loader
127134
iteration and loader module loading, plus the `LoaderOptionsPlugin` and
128135
`LoaderTargetPlugin` that feed the loader context.
129-
- `lib/logging/` — Logger API and console formatting.
136+
- `lib/logging/` — Logger API and console formatting, and `ProgressPlugin`, which
137+
reports a build's progress through that same surface. The old `lib/ProgressPlugin`
138+
path stays as a re-export, since webpack-stream requires it directly.
130139
- `lib/module/` — What a module is and what makes one: the `Module` base class and
131140
`NormalModule`, the `ModuleFactory` hierarchy that builds them (`NormalModuleFactory`,
132141
`NullFactory`, `SelfModuleFactory`), the `Parser` and `Generator` base classes every

‎lib/Compilation.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const {
1717
SyncWaterfallHook
1818
} = require("tapable");
1919
const { CachedSource } = require("webpack-sources");
20-
const FileSystemInfo = require("./FileSystemInfo");
2120
const { MultiItemCache } = require("./cache/CacheFacade");
2221
const ErrorHelpers = require("./errors/ErrorHelpers");
2322
const {
2423
makeWebpackError,
2524
tryRunOrWebpackError
2625
} = require("./errors/HookWebpackError");
2726
const WebpackError = require("./errors/WebpackError");
27+
const FileSystemInfo = require("./fs/FileSystemInfo");
2828
const Chunk = require("./graph/Chunk");
2929
const ChunkGraph = require("./graph/ChunkGraph");
3030
const ChunkGroup = require("./graph/ChunkGroup");
@@ -201,7 +201,7 @@ const { toError } = ErrorHelpers;
201201
* @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
202202
*/
203203
/** @import { RuntimeSpec } from "./util/runtime" */
204-
/** @import { InputFileSystem } from "./util/fs" */
204+
/** @import { InputFileSystem } from "./fs/fs" */
205205

206206
/**
207207
* Defines the callback callback.

‎lib/Compiler.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const Cache = require("./cache/Cache");
1717
const CacheFacade = require("./cache/CacheFacade");
1818
const ContextModuleFactory = require("./context/ContextModuleFactory");
1919
const WebpackError = require("./errors/WebpackError");
20+
const { PERMISSIONS_MASK, dirname, join, mkdirp } = require("./fs/fs");
2021
const ChunkGraph = require("./graph/ChunkGraph");
2122
const ModuleGraph = require("./graph/ModuleGraph");
2223
const { Logger } = require("./logging/Logger");
@@ -25,7 +26,6 @@ const ResolverFactory = require("./resolve/ResolverFactory");
2526
const Stats = require("./stats/Stats");
2627
const RequestShortener = require("./util/RequestShortener");
2728
const asyncLib = require("./util/async");
28-
const { PERMISSIONS_MASK, dirname, join, mkdirp } = require("./util/fs");
2929
const {
3030
WINDOWS_ABS_PATH_REGEXP,
3131
makePathsRelative
@@ -81,7 +81,7 @@ const getConcurrentCompilationError = memoize(() =>
8181
* OutputFileSystem,
8282
* TimeInfoEntries,
8383
* WatchFileSystem
84-
* } from "./util/fs"
84+
* } from "./fs/fs"
8585
*/
8686
/** @import { Schema, ValidationErrorConfiguration } from "schema-utils" */
8787

0 commit comments

Comments
 (0)