MCPcopy
hub / github.com/webpack/webpack / createFsInfo

Function createFsInfo

test/FileSystemInfo.unittest.js:140–177  ·  view source on GitHub ↗
(/** @type {IFs} */ fs)

Source from the content-addressed store, hash-verified

138 };
139
140 const createFsInfo = (/** @type {IFs} */ fs) => {
141 /** @type {import("../lib/logging/Logger").Logger & Record<string, (...args: unknown[]) => unknown>} */
142 const logger =
143 /** @type {import("../lib/logging/Logger").Logger & Record<string, (...args: unknown[]) => unknown>} */ (
144 /** @type {unknown} */ ({
145 error: (/** @type {unknown[]} */ ...args) => {
146 throw new Error(util.format(...args));
147 }
148 })
149 );
150 /** @type {import("../lib/FileSystemInfo") & Record<string, unknown>} */
151 const fsInfo =
152 /** @type {import("../lib/FileSystemInfo") & Record<string, unknown>} */ (
153 new FileSystemInfo(
154 /** @type {import("../lib/util/fs").InputFileSystem} */ (
155 /** @type {unknown} */ (fs)
156 ),
157 {
158 logger,
159 unmanagedPaths,
160 managedPaths,
161 immutablePaths,
162 hashFunction: "sha256"
163 }
164 )
165 );
166 for (const method of ["warn", "info", "log", "debug"]) {
167 fsInfo.logs = [];
168 fsInfo[method] = [];
169 logger[method] = (/** @type {unknown[]} */ ...args) => {
170 const msg = util.format(...args);
171 /** @type {string[]} */ (fsInfo[method]).push(msg);
172 /** @type {string[]} */ (fsInfo.logs).push(`[${method}] ${msg}`);
173 };
174 }
175 fsInfo.addFileTimestamps(new Map(ignored.map((i) => [i, "ignore"])));
176 return fsInfo;
177 };
178
179 const createSnapshot = (
180 /** @type {IFs} */ fs,

Callers 6

createSnapshotFunction · 0.85
expectSnapshotStateFunction · 0.85
getSnapshotFunction · 0.85
buildFsInfoWithSnapshotFunction · 0.85
buildWithStatsFunction · 0.85

Calls 2

addFileTimestampsMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected