Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(id: number, handleFn: HandleFunction) {
// TODO Make this not a subclass
// $FlowFixMe
super();
this.id = id;
this.handleFn = handleFn;
handleFn('_registerWorker', [
WorkerFarm.getWorkerApi().createReverseHandle(event => {
switch (event.type) {
case 'writeFile':
this.files.set(event.path, event.entry);
break;
case 'unlink':
this.files.delete(event.path);
this.dirs.delete(event.path);
this.symlinks.delete(event.path);
break;
case 'mkdir':
this.dirs.set(event.path, new Directory());
break;
case 'symlink':
this.symlinks.set(event.path, event.target);
break;
}
export function installPackage(
fs: FileSystem,
modules: Array,
filePath: FilePath,
options?: InstallOptions,
): Promise {
if (WorkerFarm.isWorker()) {
let workerApi = WorkerFarm.getWorkerApi();
return workerApi.callMaster({
location: __filename,
args: [fs, modules, filePath, options],
method: '_addToInstallQueue',
});
}
return _addToInstallQueue(fs, modules, filePath, options);
}