Return concrete file paths to the client

Reviewed By: @martinbigio

Differential Revision: D2465182
This commit is contained in:
Amjad Masad 2015-09-22 15:43:24 -07:00 committed by facebook-github-bot-5
parent a2b8762e4d
commit 0671b2b6f2
3 changed files with 14 additions and 0 deletions

View File

@ -217,6 +217,12 @@ describe('AssetServer', () => {
type: 'png',
name: 'b',
scales: [1, 2, 4, 4.5],
files: [
'/root/imgs/b@1x.png',
'/root/imgs/b@2x.png',
'/root/imgs/b@4x.png',
'/root/imgs/b@4.5x.png',
],
hash: 'wow such hash',
});
});
@ -253,6 +259,12 @@ describe('AssetServer', () => {
type: 'jpg',
name: 'b',
scales: [1, 2, 4, 4.5],
files: [
'/root/imgs/b@1x.jpg',
'/root/imgs/b@2x.jpg',
'/root/imgs/b@4x.jpg',
'/root/imgs/b@4.5x.jpg',
],
hash: 'wow such hash',
});
});

View File

@ -60,6 +60,7 @@ class AssetServer {
return this._getAssetRecord(assetPath, platform).then(record => {
data.scales = record.scales;
data.files = record.files;
return Promise.all(
record.files.map(file => stat(file))

View File

@ -268,6 +268,7 @@ class Bundler {
width: dimensions.width / module.resolution,
height: dimensions.height / module.resolution,
scales: assetData.scales,
files: assetData.files,
hash: assetData.hash,
name: assetData.name,
type: assetData.type,