Files

23 lines
935 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchRootFile = void 0;
const file_watcher_1 = require("./file-watcher");
const live_events_1 = require("./preview-server/live-events");
const project_info_1 = require("./preview-server/project-info");
const watchRootFile = async (remotionRoot, entryPoint) => {
const rootFile = await (0, project_info_1.getProjectInfo)(remotionRoot, entryPoint);
if (!rootFile.rootFile) {
return;
}
(0, file_watcher_1.installFileWatcher)({
file: rootFile.rootFile,
onChange: () => {
// Don't care if changed, added or deleted - should trigger a refetch in the frontend all the time
(0, live_events_1.waitForLiveEventsListener)().then((listener) => {
listener.sendEventToClient({ type: 'root-file-changed' });
});
},
});
};
exports.watchRootFile = watchRootFile;