MCPcopy Index your code
hub / github.com/darkreader/darkreader / onChange

Function onChange

tasks/bundle-css.js:105–126  ·  view source on GitHub ↗
(changedFiles, watcher, platforms)

Source from the content-addressed store, hash-verified

103
104 /** @type {(changedFiles: string[], watcher: FSWatcher, platforms: any) => Promise<void>} */
105 const onChange = async (changedFiles, watcher, platforms) => {
106 const entries = cssEntries.filter((entry) => {
107 const entryFile = getEntryFile(entry);
108 return changedFiles.some((changed) => {
109 return entry.watchFiles?.includes(changed) || changed === entryFile;
110 });
111 });
112 for (const entry of entries) {
113 const css = await bundleCSSEntry(entry, true);
114 await writeFiles(entry.dest, platforms, true, css);
115 }
116
117 const newWatchFiles = getWatchFiles();
118 watcher.unwatch(
119 currentWatchFiles.filter((oldFile) => !newWatchFiles.includes(oldFile))
120 );
121 watcher.add(
122 newWatchFiles.filter((newFile) => currentWatchFiles.includes(newFile))
123 );
124
125 reload.reload({type: reload.CSS});
126 };
127
128 return createTask(
129 'bundle-css',

Callers

nothing calls this directly

Calls 5

getEntryFileFunction · 0.85
bundleCSSEntryFunction · 0.85
getWatchFilesFunction · 0.85
addMethod · 0.80
writeFilesFunction · 0.70

Tested by

no test coverage detected