GT2/Ejectable/node_modules/expo-asset/build/resolveAssetSource.web.js.map

1 line
5.0 KiB
Plaintext

{"version":3,"file":"resolveAssetSource.web.js","sourceRoot":"","sources":["../src/resolveAssetSource.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,mBAA4C,MAAM,uBAAuB,CAAC;AAIjF,IAAI,wBAAwB,CAAC;AAC7B,IAAI,UAAqC,CAAC;AAC1C,IAAI,UAAqC,CAAC;AAC1C,IAAI,oBAA+C,CAAC;AAEpD,SAAS,sBAAsB;IAC7B,IAAI,oBAAoB,EAAE;QACxB,OAAO,oBAAoB,CAAC;KAC7B;IAED,IAAI,UAAU,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,UAAU,CAAC;IACjE,IAAI,CAAC,UAAU,EAAE;QACf,UAAU,GAAG,aAAa,IAAI,aAAa,CAAC,UAAU,CAAC;KACxD;IACD,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC;IAC5C,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,SAAS,eAAe;IACtB,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,mBAAmB,IAAI,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACpF,IAAI,KAAK,EAAE;YACT,mCAAmC;YACnC,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SACvB;aAAM;YACL,gCAAgC;YAChC,UAAU,GAAG,IAAI,CAAC;SACnB;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,qBAAqB,CAAC,SAAoC;IACjE,IAAI,SAAS,EAAE;QACb,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YACrC,8DAA8D;YAC9D,OAAO,IAAI,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react-native';\n\nimport { getAssetByID } from './AssetRegistry';\nimport AssetSourceResolver, { ResolvedAssetSource } from './AssetSourceResolver';\n\ndeclare let nativeExtensions: any;\n\nlet _customSourceTransformer;\nlet _serverURL: string | undefined | null;\nlet _scriptURL: string | undefined | null;\nlet _sourceCodeScriptURL: string | undefined | null;\n\nfunction getSourceCodeScriptURL(): string | undefined | null {\n if (_sourceCodeScriptURL) {\n return _sourceCodeScriptURL;\n }\n\n let sourceCode = nativeExtensions && nativeExtensions.SourceCode;\n if (!sourceCode) {\n sourceCode = NativeModules && NativeModules.SourceCode;\n }\n _sourceCodeScriptURL = sourceCode.scriptURL;\n return _sourceCodeScriptURL;\n}\n\nfunction getDevServerURL(): string | null {\n if (_serverURL === undefined) {\n const sourceCodeScriptURL = getSourceCodeScriptURL();\n const match = sourceCodeScriptURL && sourceCodeScriptURL.match(/^https?:\\/\\/.*?\\//);\n if (match) {\n // jsBundle was loaded from network\n _serverURL = match[0];\n } else {\n // jsBundle was loaded from file\n _serverURL = null;\n }\n }\n return _serverURL;\n}\n\nfunction _coerceLocalScriptURL(scriptURL: string | undefined | null): string | null {\n if (scriptURL) {\n if (scriptURL.startsWith('assets://')) {\n // android: running from within assets, no offline path to use\n return null;\n }\n scriptURL = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1);\n if (!scriptURL.includes('://')) {\n // Add file protocol in case we have an absolute file path and not a URL.\n // This shouldn't really be necessary. scriptURL should be a URL.\n scriptURL = 'file://' + scriptURL;\n }\n }\n return null;\n}\n\nfunction getScriptURL(): string | null {\n if (_scriptURL === undefined) {\n _scriptURL = _coerceLocalScriptURL(getSourceCodeScriptURL());\n }\n return _scriptURL;\n}\n\nexport function setCustomSourceTransformer(\n transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource\n): void {\n _customSourceTransformer = transformer;\n}\n\n/**\n * `source` is either a number (opaque type returned by require('./foo.png'))\n * or an `ImageSource` like { uri: '<http location || file path>' }\n */\nexport default function resolveAssetSource(source: any): ResolvedAssetSource | undefined {\n if (typeof source === 'object') {\n return source;\n }\n\n const asset = getAssetByID(source);\n if (!asset) {\n return undefined;\n }\n\n const resolver = new AssetSourceResolver(getDevServerURL(), getScriptURL(), asset);\n if (_customSourceTransformer) {\n return _customSourceTransformer(resolver);\n }\n return resolver.defaultAsset();\n}\n\nObject.defineProperty(resolveAssetSource, 'setCustomSourceTransformer', {\n get() {\n return setCustomSourceTransformer;\n },\n});\n\nexport const { pickScale } = AssetSourceResolver;\n"]}