mirror of https://github.com/status-im/metro.git
packager: DependencyGraph: remove re-exported functions
Reviewed By: davidaurelio, cpojer Differential Revision: D5052149 fbshipit-source-id: 43f3877ceea038762ded6c42ab0481d215db2118
This commit is contained in:
parent
f7bf4b841b
commit
02d57294fe
|
@ -14,7 +14,7 @@
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const denodeify = require('denodeify');
|
const denodeify = require('denodeify');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const getAssetDataFromName = require('../node-haste/DependencyGraph').getAssetDataFromName;
|
const getAssetDataFromName = require('../node-haste/lib/getAssetDataFromName');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
import type {AssetData} from '../node-haste/lib/getAssetDataFromName';
|
import type {AssetData} from '../node-haste/lib/getAssetDataFromName';
|
||||||
|
@ -55,7 +55,10 @@ class AssetServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
get(assetPath: string, platform: ?string = null): Promise<Buffer> {
|
get(assetPath: string, platform: ?string = null): Promise<Buffer> {
|
||||||
const assetData = getAssetDataFromName(assetPath, new Set([platform]));
|
const assetData = getAssetDataFromName(
|
||||||
|
assetPath,
|
||||||
|
new Set(platform != null ? [platform] : []),
|
||||||
|
);
|
||||||
return this._getAssetRecord(assetPath, platform).then(record => {
|
return this._getAssetRecord(assetPath, platform).then(record => {
|
||||||
for (let i = 0; i < record.scales.length; i++) {
|
for (let i = 0; i < record.scales.length; i++) {
|
||||||
if (record.scales[i] >= assetData.resolution) {
|
if (record.scales[i] >= assetData.resolution) {
|
||||||
|
@ -74,7 +77,10 @@ class AssetServer {
|
||||||
scales: Array<number>,
|
scales: Array<number>,
|
||||||
type: string,
|
type: string,
|
||||||
|}> {
|
|}> {
|
||||||
const nameData = getAssetDataFromName(assetPath, new Set([platform]));
|
const nameData = getAssetDataFromName(
|
||||||
|
assetPath,
|
||||||
|
new Set(platform != null ? [platform] : []),
|
||||||
|
);
|
||||||
const {name, type} = nameData;
|
const {name, type} = nameData;
|
||||||
|
|
||||||
return this._getAssetRecord(assetPath, platform).then(record => {
|
return this._getAssetRecord(assetPath, platform).then(record => {
|
||||||
|
@ -135,7 +141,10 @@ class AssetServer {
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const dir = res[0];
|
const dir = res[0];
|
||||||
const files = res[1];
|
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);
|
const map = this._buildAssetMap(dir, files, platform);
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,14 @@ const FilesByDirNameIndex = require('./FilesByDirNameIndex');
|
||||||
const JestHasteMap = require('jest-haste-map');
|
const JestHasteMap = require('jest-haste-map');
|
||||||
const Module = require('./Module');
|
const Module = require('./Module');
|
||||||
const ModuleCache = require('./ModuleCache');
|
const ModuleCache = require('./ModuleCache');
|
||||||
const Polyfill = require('./Polyfill');
|
|
||||||
const ResolutionRequest = require('./DependencyGraph/ResolutionRequest');
|
const ResolutionRequest = require('./DependencyGraph/ResolutionRequest');
|
||||||
const ResolutionResponse = require('./DependencyGraph/ResolutionResponse');
|
const ResolutionResponse = require('./DependencyGraph/ResolutionResponse');
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const getAssetDataFromName = require('./lib/getAssetDataFromName');
|
|
||||||
const getInverseDependencies = require('./lib/getInverseDependencies');
|
|
||||||
const getPlatformExtension = require('./lib/getPlatformExtension');
|
const getPlatformExtension = require('./lib/getPlatformExtension');
|
||||||
const invariant = require('fbjs/lib/invariant');
|
const invariant = require('fbjs/lib/invariant');
|
||||||
const isAbsolutePath = require('absolute-path');
|
const isAbsolutePath = require('absolute-path');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const replacePatterns = require('./lib/replacePatterns');
|
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -288,22 +284,8 @@ class DependencyGraph extends EventEmitter {
|
||||||
return this._moduleCache.createPolyfill(options);
|
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() {
|
function NotFoundError() {
|
||||||
/* $FlowFixMe: monkey-patching */
|
/* $FlowFixMe: monkey-patching */
|
||||||
Error.call(this);
|
Error.call(this);
|
||||||
|
|
Loading…
Reference in New Issue