diff --git a/local-cli/server/util/attachHMRServer.js b/local-cli/server/util/attachHMRServer.js index bed4c1d84..ff35f4231 100644 --- a/local-cli/server/util/attachHMRServer.js +++ b/local-cli/server/util/attachHMRServer.js @@ -11,11 +11,10 @@ 'use strict'; +const getInverseDependencies = require('../../../packager/src//node-haste/lib/getInverseDependencies'); const querystring = require('querystring'); const url = require('url'); -const {getInverseDependencies} = require('../../../packager/src//node-haste/DependencyGraph'); - import type HMRBundle from '../../../packager/src/Bundler/HMRBundle'; import type Server from '../../../packager/src/Server'; import type ResolutionResponse diff --git a/packager/src/AssetServer/index.js b/packager/src/AssetServer/index.js index e2ffd01ca..79fe9ca82 100644 --- a/packager/src/AssetServer/index.js +++ b/packager/src/AssetServer/index.js @@ -14,7 +14,7 @@ const crypto = require('crypto'); const denodeify = require('denodeify'); const fs = require('fs'); -const getAssetDataFromName = require('../node-haste/DependencyGraph').getAssetDataFromName; +const getAssetDataFromName = require('../node-haste/lib/getAssetDataFromName'); const path = require('path'); import type {AssetData} from '../node-haste/lib/getAssetDataFromName'; @@ -55,7 +55,10 @@ class AssetServer { } get(assetPath: string, platform: ?string = null): Promise { - const assetData = getAssetDataFromName(assetPath, new Set([platform])); + const assetData = getAssetDataFromName( + assetPath, + new Set(platform != null ? [platform] : []), + ); return this._getAssetRecord(assetPath, platform).then(record => { for (let i = 0; i < record.scales.length; i++) { if (record.scales[i] >= assetData.resolution) { @@ -74,7 +77,10 @@ class AssetServer { scales: Array, type: string, |}> { - const nameData = getAssetDataFromName(assetPath, new Set([platform])); + const nameData = getAssetDataFromName( + assetPath, + new Set(platform != null ? [platform] : []), + ); const {name, type} = nameData; return this._getAssetRecord(assetPath, platform).then(record => { @@ -135,7 +141,10 @@ class AssetServer { .then(res => { const dir = res[0]; const files = res[1]; - const assetData = getAssetDataFromName(filename, new Set([platform])); + const assetData = getAssetDataFromName( + filename, + new Set(platform != null ? [platform] : []), + ); const map = this._buildAssetMap(dir, files, platform); diff --git a/packager/src/node-haste/DependencyGraph.js b/packager/src/node-haste/DependencyGraph.js index c0e547f10..369e81b20 100644 --- a/packager/src/node-haste/DependencyGraph.js +++ b/packager/src/node-haste/DependencyGraph.js @@ -16,18 +16,14 @@ const FilesByDirNameIndex = require('./FilesByDirNameIndex'); const JestHasteMap = require('jest-haste-map'); const Module = require('./Module'); const ModuleCache = require('./ModuleCache'); -const Polyfill = require('./Polyfill'); const ResolutionRequest = require('./DependencyGraph/ResolutionRequest'); const ResolutionResponse = require('./DependencyGraph/ResolutionResponse'); const fs = require('fs'); -const getAssetDataFromName = require('./lib/getAssetDataFromName'); -const getInverseDependencies = require('./lib/getInverseDependencies'); const getPlatformExtension = require('./lib/getPlatformExtension'); const invariant = require('fbjs/lib/invariant'); const isAbsolutePath = require('absolute-path'); const path = require('path'); -const replacePatterns = require('./lib/replacePatterns'); const util = require('util'); const { @@ -288,22 +284,8 @@ class DependencyGraph extends EventEmitter { return this._moduleCache.createPolyfill(options); } - static Module; - static Polyfill; - static getAssetDataFromName; - static replacePatterns; - static getInverseDependencies; - } -Object.assign(DependencyGraph, { - Module, - Polyfill, - getAssetDataFromName, - replacePatterns, - getInverseDependencies, -}); - function NotFoundError() { /* $FlowFixMe: monkey-patching */ Error.call(this);