diff --git a/packager/react-packager/src/DependencyResolver/Cache/index.js b/packager/react-packager/src/DependencyResolver/Cache/index.js index 06d346d62..4e1698cb3 100644 --- a/packager/react-packager/src/DependencyResolver/Cache/index.js +++ b/packager/react-packager/src/DependencyResolver/Cache/index.js @@ -53,7 +53,7 @@ class Cache { var recordP = this.has(filepath, field) ? this._data[filepath].data[field] - : this._set(filepath, field, loaderCb(filepath)); + : this.set(filepath, field, loaderCb(filepath)); return recordP.then(record => record); } @@ -77,7 +77,7 @@ class Cache { (field == null || Object.prototype.hasOwnProperty.call(this._data[filepath].data, field)); } - _set(filepath, field, loaderPromise) { + set(filepath, field, loaderPromise) { let record = this._data[filepath]; if (!record) { record = Object.create(null); diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js index ed09f91ad..bc5d85d78 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js @@ -158,6 +158,10 @@ class DependencyGraph { return this._moduleCache.getModule(entryFile); } + getAllModules() { + return this.load().then(() => this._moduleCache.getAllModules()); + } + getDependencies(entryPath, platform, recursive = true) { return this.load().then(() => { platform = this._getRequestPlatform(entryPath, platform); diff --git a/packager/react-packager/src/DependencyResolver/ModuleCache.js b/packager/react-packager/src/DependencyResolver/ModuleCache.js index fac1820b8..3fcfb173a 100644 --- a/packager/react-packager/src/DependencyResolver/ModuleCache.js +++ b/packager/react-packager/src/DependencyResolver/ModuleCache.js @@ -41,6 +41,10 @@ class ModuleCache { return this._moduleCache[filePath]; } + getAllModules() { + return this._moduleCache; + } + getAssetModule(filePath) { filePath = path.resolve(filePath); if (!this._moduleCache[filePath]) { diff --git a/packager/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js b/packager/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js index f7fb35588..cbff314af 100644 --- a/packager/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js +++ b/packager/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js @@ -8,7 +8,8 @@ */ 'use strict'; -jest.autoMockOff(); +jest.autoMockOff() + .dontMock('graceful-fs'); const Fastfs = require('../fastfs');