diff --git a/react-packager/src/DependencyResolver/Cache/index.js b/react-packager/src/DependencyResolver/Cache/index.js index 06d346d6..4e1698cb 100644 --- a/react-packager/src/DependencyResolver/Cache/index.js +++ b/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/react-packager/src/DependencyResolver/DependencyGraph/index.js b/react-packager/src/DependencyResolver/DependencyGraph/index.js index ed09f91a..bc5d85d7 100644 --- a/react-packager/src/DependencyResolver/DependencyGraph/index.js +++ b/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/react-packager/src/DependencyResolver/ModuleCache.js b/react-packager/src/DependencyResolver/ModuleCache.js index fac1820b..3fcfb173 100644 --- a/react-packager/src/DependencyResolver/ModuleCache.js +++ b/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/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js b/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js index f7fb3558..cbff314a 100644 --- a/react-packager/src/DependencyResolver/__tests__/fastfs-integrated-test.js +++ b/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');