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AC3F,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACrC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE1B,OAAO,SAAS,CAAC,IAAI,CAAC;AACxB,CAAC","sourcesContent":["import URL from 'url-parse';\n\nexport function getFilename(url: string): string {\n const { pathname } = new URL(url, {});\n return pathname.substring(pathname.lastIndexOf('/') + 1);\n}\n\nexport function getFileExtension(url: string): string {\n const filename = getFilename(url);\n const dotIndex = filename.lastIndexOf('.');\n // Ignore leading dots for hidden files\n return dotIndex > 0 ? filename.substring(dotIndex) : '';\n}\n\n/**\n * Returns the base URL from a manifest's URL. For example, given a manifest hosted at\n * https://example.com/app/manifest.json, the base URL would be https://example.com/app/. Query\n * parameters and fragments also are removed.\n *\n * For an Expo-hosted project with a manifest hosted at https://expo.io/@user/project/index.exp, the\n * base URL would be https://expo.io/@user/project.\n *\n * We also normalize the \"exp\" protocol to \"http\" to handle internal URLs with the Expo schemes used\n * to tell the OS to open the URLs in the the Expo client.\n */\nexport function getManifestBaseUrl(manifestUrl: string): string {\n const urlObject = new URL(manifestUrl, {});\n\n // Change the scheme to http(s) if it is exp(s)\n if (urlObject.protocol === 'exp:') {\n urlObject.set('protocol', 'http:');\n } else if (urlObject.protocol === 'exps:') {\n urlObject.set('protocol', 'https:');\n }\n\n // Trim filename, query parameters, and fragment, if any\n const directory = urlObject.pathname.substring(0, urlObject.pathname.lastIndexOf('/') + 1);\n urlObject.set('pathname', directory);\n urlObject.set('query', '');\n urlObject.set('hash', '');\n\n return urlObject.href;\n}\n"]} |