mirror of https://github.com/status-im/metro.git
Send HMR updates only for files on the bundle
Summary: public Compute the dependencies of the bundle entry file just before sending HMR updates. In case the file that was changed doesn't belong to the bundle bail. Reviewed By: vjeux Differential Revision: D2793736 fb-gh-sync-id: f858e71b0dd5fe4f5b2307a22c6cef627eb66a22
This commit is contained in:
parent
d59f716a22
commit
dcbc6708e3
|
@ -310,6 +310,10 @@ class Bundler {
|
|||
this._transformer.invalidateFile(filePath);
|
||||
}
|
||||
|
||||
getShallowDependencies(entryFile) {
|
||||
return this._resolver.getShallowDependencies(entryFile);
|
||||
}
|
||||
|
||||
getDependencies(main, isDev, platform) {
|
||||
return this._resolver.getDependencies(main, { dev: isDev, platform });
|
||||
}
|
||||
|
|
|
@ -133,6 +133,14 @@ class DependencyGraph {
|
|||
return this._loading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise with the direct dependencies the module associated to
|
||||
* the given entryPath has.
|
||||
*/
|
||||
getShallowDependencies(entryPath) {
|
||||
return this._moduleCache.getModule(entryPath).getDependencies();
|
||||
}
|
||||
|
||||
getDependencies(entryPath, platform) {
|
||||
return this.load().then(() => {
|
||||
platform = this._getRequestPlatform(entryPath, platform);
|
||||
|
|
|
@ -99,6 +99,10 @@ class Resolver {
|
|||
this._polyfillModuleNames = opts.polyfillModuleNames || [];
|
||||
}
|
||||
|
||||
getShallowDependencies(entryFile) {
|
||||
return this._depGraph.getShallowDependencies(entryFile);
|
||||
}
|
||||
|
||||
getDependencies(main, options) {
|
||||
const opts = getDependenciesValidateOpts(options);
|
||||
|
||||
|
|
|
@ -246,6 +246,10 @@ class Server {
|
|||
});
|
||||
}
|
||||
|
||||
getShallowDependencies(entryFile) {
|
||||
return this._bundler.getShallowDependencies(entryFile);
|
||||
}
|
||||
|
||||
getDependencies(options) {
|
||||
return Promise.resolve().then(() => {
|
||||
if (!options.platform) {
|
||||
|
|
Loading…
Reference in New Issue