MCPcopy
hub / github.com/webpack/webpack / getDirectories

Function getDirectories

lib/CleanPlugin.js:60–80  ·  view source on GitHub ↗

* Returns set of directory paths. * @param {CurrentAssets} assets current assets * @returns {Set<string>} Set of directory paths

(assets)

Source from the content-addressed store, hash-verified

58 * @returns {Set<string>} Set of directory paths
59 */
60function getDirectories(assets) {
61 /** @type {Set<string>} */
62 const directories = new Set();
63 /**
64 * Adds the provided filename to this object.
65 * @param {string} filename asset filename
66 */
67 const addDirectory = (filename) => {
68 directories.add(path.dirname(filename));
69 };
70
71 // get directories of assets
72 for (const [asset] of assets) {
73 addDirectory(asset);
74 }
75 // and all parent directories
76 for (const directory of directories) {
77 addDirectory(directory);
78 }
79 return directories;
80}
81
82/** @typedef {Set<string>} Diff */
83

Callers 1

getDiffToFsFunction · 0.85

Calls 1

addDirectoryFunction · 0.85

Tested by

no test coverage detected