INNER CODE UNIT · TypeScript
setupWatcher
akirarika/milkio · packages/cookbook/src/watcher/index.ts:227
function setupWatcher(mode: string, root: string, appRoot: string, validDirs: string[], options: CookbookOptions, project: CookbookWatcherExtensionProject) {
const extensionChangeFiles: Array<CookbookWatcherFile[]> = Array.from({ length: imports.length }, () => []);
let isProcessing = false;
let debounceTimer: any = null;
const currentBatchChanges = new Map<string, boolean>();
if (!allFiles.has(root)) {
allFiles.set(root, new Map());
}
const projectFiles = allFiles.get(root)!;
const processBatch = async () => {
isProcessing = true;
consola.info(chalk.gray(`[${getRate()}] ✨ type-safety applying..`));
try {
const batch = new Map(currentBatchChanges);
currentBatchChanges.clear();