mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
New file watching implementation
Reviewed By: davidaurelio Differential Revision: D4161662 fbshipit-source-id: 9a2a399304c83b411a8b0b74ea015c18b599fbaf
This commit is contained in:
committed by
Facebook Github Bot
parent
c22b00e58f
commit
e8a623a2ab
+7
-13
@@ -16,8 +16,6 @@ const Module = require('./Module');
|
||||
const Package = require('./Package');
|
||||
const Polyfill = require('./Polyfill');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
import type Cache from './Cache';
|
||||
import type {
|
||||
DepGraphHelpers,
|
||||
@@ -69,8 +67,6 @@ class ModuleCache {
|
||||
this._assetDependencies = assetDependencies;
|
||||
this._moduleOptions = moduleOptions;
|
||||
this._packageModuleMap = new WeakMap();
|
||||
|
||||
fastfs.on('change', this._processFileChange.bind(this));
|
||||
}
|
||||
|
||||
getModule(filePath: string) {
|
||||
@@ -149,16 +145,14 @@ class ModuleCache {
|
||||
});
|
||||
}
|
||||
|
||||
_processFileChange(type, filePath, root) {
|
||||
const absPath = path.join(root, filePath);
|
||||
|
||||
if (this._moduleCache[absPath]) {
|
||||
this._moduleCache[absPath].invalidate();
|
||||
delete this._moduleCache[absPath];
|
||||
processFileChange(type: string, filePath: string) {
|
||||
if (this._moduleCache[filePath]) {
|
||||
this._moduleCache[filePath].invalidate();
|
||||
delete this._moduleCache[filePath];
|
||||
}
|
||||
if (this._packageCache[absPath]) {
|
||||
this._packageCache[absPath].invalidate();
|
||||
delete this._packageCache[absPath];
|
||||
if (this._packageCache[filePath]) {
|
||||
this._packageCache[filePath].invalidate();
|
||||
delete this._packageCache[filePath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user