From 82dcddcb1235b51fa96a6a780ffff73bcfcc9ab0 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 25 Apr 2017 11:49:41 -0700 Subject: [PATCH] packager: buck library: expose asset content Reviewed By: davidaurelio Differential Revision: D4945778 fbshipit-source-id: ea132a3d284ed09c59c69afbdd7b707af9e521b9 --- packages/metro-bundler/src/Bundler/index.js | 4 ++-- packages/metro-bundler/src/ModuleGraph/types.flow.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/metro-bundler/src/Bundler/index.js b/packages/metro-bundler/src/Bundler/index.js index e38e70cd..873bf083 100644 --- a/packages/metro-bundler/src/Bundler/index.js +++ b/packages/metro-bundler/src/Bundler/index.js @@ -68,7 +68,7 @@ export type GetTransformOptions = ( getDependenciesOf: string => Promise>, ) => Promise; -type AssetDescriptor = { +export type AssetDescriptor = { +__packager_asset: boolean, +httpServerLocation: string, +width: ?number, @@ -79,7 +79,7 @@ type AssetDescriptor = { +type: string, }; -type ExtendedAssetDescriptor = AssetDescriptor & { +export type ExtendedAssetDescriptor = AssetDescriptor & { +fileSystemLocation: string, +files: Array, }; diff --git a/packages/metro-bundler/src/ModuleGraph/types.flow.js b/packages/metro-bundler/src/ModuleGraph/types.flow.js index de86d678..fd27309e 100644 --- a/packages/metro-bundler/src/ModuleGraph/types.flow.js +++ b/packages/metro-bundler/src/ModuleGraph/types.flow.js @@ -140,3 +140,11 @@ export type LibraryOptions = {| platform?: string, root: string, |}; + +export type Base64Content = string; + +export type Library = {| + files: Array, + /* cannot be a Map because it's JSONified later on */ + assets: {[destFilePath: string]: Base64Content}, +|};