1 line
2.1 KiB
Plaintext
1 line
2.1 KiB
Plaintext
{"version":3,"file":"EmbeddedAssets.js","sourceRoot":"","sources":["../src/EmbeddedAssets.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,gFAAgF;AAChF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;AAE9D,sDAAsD;AACtD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,IAAmB;IACnE,MAAM,cAAc,GAAG,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;IAC/C,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE;QAC3D,sEAAsE;QACtE,mFAAmF;QACnF,MAAM,SAAS,GAAG,SAAS,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC3D,IAAI,SAAS,CAAC,YAAY,KAAK,YAAY,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC5E,OAAO,IAAI,CAAC;SACb;QACD,OAAO,GAAG,UAAU,CAAC,eAAe,GAAG,SAAS,EAAE,CAAC;KACpD;IACD,OAAO,WAAW,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC;AAC7C,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport * as FileSystem from 'expo-file-system';\n\nimport { getLocalAssets } from './PlatformUtils';\n\n// Fast lookup check if assets are available in the local bundle in managed apps\nconst bundledAssets = new Set(FileSystem.bundledAssets || []);\n\n// localAssets are provided by the expo-updates module\nconst localAssets = getLocalAssets();\n\n/**\n * Returns the local URI of an embedded asset from its hash and type, or null if the asset is not\n * included in the app bundle.\n */\nexport function getEmbeddedAssetUri(hash: string, type: string | null): string | null {\n const localAssetsKey = `${hash}.${type ?? ''}`;\n if (!localAssets.hasOwnProperty(localAssetsKey) && !__DEV__) {\n // check legacy location in case we're in Expo client/managed workflow\n // TODO(eric): remove this once bundledAssets is no longer exported from FileSystem\n const assetName = `asset_${hash}${type ? `.${type}` : ''}`;\n if (Constants.appOwnership !== 'standalone' || !bundledAssets.has(assetName)) {\n return null;\n }\n return `${FileSystem.bundleDirectory}${assetName}`;\n }\n return localAssets[localAssetsKey] ?? null;\n}\n"]} |