MCPcopy
hub / github.com/webpack/webpack / createSnapshot

Function createSnapshot

test/FileSystemInfo.unittest.js:179–211  ·  view source on GitHub ↗
(
		/** @type {IFs} */ fs,
		/** @type {SnapshotOptions} */ options,
		/** @type {(err?: Error | null, snapshot?: Snapshot | null, snapshot2?: Snapshot | null) => void} */ callback
	)

Source from the content-addressed store, hash-verified

177 };
178
179 const createSnapshot = (
180 /** @type {IFs} */ fs,
181 /** @type {SnapshotOptions} */ options,
182 /** @type {(err?: Error | null, snapshot?: Snapshot | null, snapshot2?: Snapshot | null) => void} */ callback
183 ) => {
184 const fsInfo = createFsInfo(fs);
185 fsInfo.createSnapshot(
186 Date.now() + 10000,
187 files,
188 directories,
189 missing,
190 options,
191 (err, snapshot) => {
192 if (err) return callback(err);
193 /** @type {Snapshot & Record<string, unknown>} */ (snapshot).name =
194 "initial snapshot";
195 // create another one to test the caching
196 fsInfo.createSnapshot(
197 Date.now() + 10000,
198 files,
199 directories,
200 missing,
201 options,
202 (err, snapshot2) => {
203 if (err) return callback(err);
204 /** @type {Snapshot & Record<string, unknown>} */ (snapshot2).name =
205 "cached snapshot";
206 callback(null, snapshot, snapshot2);
207 }
208 );
209 }
210 );
211 };
212
213 const clone = (/** @type {Record<string, unknown>} */ object) => {
214 const serialized = buffersSerializer.serialize(object, {});

Callers 1

Calls 3

createFsInfoFunction · 0.85
createSnapshotMethod · 0.80
callbackFunction · 0.70

Tested by

no test coverage detected