From 69a46e2c6eadbcb3f52177f4e3a297f96f94eaef Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Mon, 23 May 2016 10:27:23 -0700 Subject: [PATCH] Update node-haste dependency to 2.12.0 Summary: Update to node-haste 2.12.0 to support pass through configuration of supported platforms. Closes https://github.com/facebook/react-native/pull/7660 Differential Revision: D3335034 Pulled By: mkonicek fbshipit-source-id: d238b90a90d51654301d61251ceb26d183fef57a --- react-packager/src/AssetServer/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/react-packager/src/AssetServer/index.js b/react-packager/src/AssetServer/index.js index 1a7bb75e..c9b198a5 100644 --- a/react-packager/src/AssetServer/index.js +++ b/react-packager/src/AssetServer/index.js @@ -51,7 +51,7 @@ class AssetServer { } get(assetPath, platform = null) { - const assetData = getAssetDataFromName(assetPath); + const assetData = getAssetDataFromName(assetPath, new Set([platform])); return this._getAssetRecord(assetPath, platform).then(record => { for (let i = 0; i < record.scales.length; i++) { if (record.scales[i] >= assetData.resolution) { @@ -64,7 +64,7 @@ class AssetServer { } getAssetData(assetPath, platform = null) { - const nameData = getAssetDataFromName(assetPath); + const nameData = getAssetDataFromName(assetPath, new Set([platform])); const data = { name: nameData.name, type: nameData.type, @@ -115,7 +115,7 @@ class AssetServer { .then(res => { const dir = res[0]; const files = res[1]; - const assetData = getAssetDataFromName(filename); + const assetData = getAssetDataFromName(filename, new Set([platform])); const map = this._buildAssetMap(dir, files, platform); @@ -166,8 +166,8 @@ class AssetServer { }); } - _buildAssetMap(dir, files) { - const assets = files.map(getAssetDataFromName); + _buildAssetMap(dir, files, platform) { + const assets = files.map(this._getAssetDataFromName.bind(this, new Set([platform]))); const map = Object.create(null); assets.forEach(function(asset, i) { const file = files[i]; @@ -194,6 +194,10 @@ class AssetServer { return map; } + + _getAssetDataFromName(platform, file) { + return getAssetDataFromName(file, platform); + } } function getAssetKey(assetName, platform) {