@react-native/assets-registry
Advanced tools
Comparing version 0.77.0-rc.6 to 0.77.0-rc.7
{ | ||
"name": "@react-native/assets-registry", | ||
"version": "0.77.0-rc.6", | ||
"version": "0.77.0-rc.7", | ||
"description": "Asset support code for React Native.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,4 +7,4 @@ /** | ||
* | ||
* @flow strict | ||
* @format | ||
* @flow strict | ||
*/ | ||
@@ -14,3 +14,3 @@ | ||
import type {PackagerAsset} from './registry.js'; | ||
/*:: import type {PackagerAsset} from './registry.js'; */ | ||
@@ -32,3 +32,3 @@ const androidScaleSuffix = { | ||
*/ | ||
function getAndroidAssetSuffix(scale: number): string { | ||
function getAndroidAssetSuffix(scale /*: number */) /*: string */ { | ||
if (scale.toString() in androidScaleSuffix) { | ||
@@ -59,5 +59,5 @@ // $FlowFixMe[invalid-computed-prop] | ||
function getAndroidResourceFolderName( | ||
asset: PackagerAsset, | ||
scale: number, | ||
): string { | ||
asset /*: PackagerAsset */, | ||
scale /*: number */, | ||
) /*: string */ { | ||
if (!drawableFileTypes.has(asset.type)) { | ||
@@ -80,3 +80,5 @@ return 'raw'; | ||
function getAndroidResourceIdentifier(asset: PackagerAsset): string { | ||
function getAndroidResourceIdentifier( | ||
asset /*: PackagerAsset */, | ||
) /*: string */ { | ||
return (getBasePath(asset) + '/' + asset.name) | ||
@@ -89,3 +91,3 @@ .toLowerCase() | ||
function getBasePath(asset: PackagerAsset): string { | ||
function getBasePath(asset /*: PackagerAsset */) /*: string */ { | ||
const basePath = asset.httpServerLocation; | ||
@@ -92,0 +94,0 @@ return basePath.startsWith('/') ? basePath.slice(1) : basePath; |
@@ -13,2 +13,3 @@ /** | ||
/*:: | ||
export type AssetDestPathResolver = 'android' | 'generic'; | ||
@@ -29,6 +30,7 @@ | ||
}; | ||
*/ | ||
const assets: Array<PackagerAsset> = []; | ||
const assets /*: Array<PackagerAsset> */ = []; | ||
function registerAsset(asset: PackagerAsset): number { | ||
function registerAsset(asset /*: PackagerAsset */) /*: number */ { | ||
// `push` returns new array length, so the first asset will | ||
@@ -39,3 +41,3 @@ // get id 1 (not 0) to make the value truthy | ||
function getAssetByID(assetId: number): PackagerAsset { | ||
function getAssetByID(assetId /*: number */) /*: PackagerAsset */ { | ||
return assets[assetId - 1]; | ||
@@ -42,0 +44,0 @@ } |
4723
121