UNPKG

@snap/camera-kit

Version:
32 lines 1.68 kB
import { __awaiter } from "tslib"; import { WasmFeatures, getPlatformCapabilities } from "../../platform/platformCapabilities"; import { getPlatformInfo } from "../../platform/platformInfo"; const wasmCapabilitiesToLensCoreBuildFlavor = { [WasmFeatures.Default]: "release", [WasmFeatures.ExceptionHandling]: "rel-neh", [WasmFeatures.SIMD]: "release-simd", [WasmFeatures.ExceptionHandling | WasmFeatures.SIMD]: "rel-simd-neh", }; const wasmAssets = ["LensCoreWebAssembly.js", "LensCoreWebAssembly.wasm"]; export function getRequiredBootstrapURLs(endpointOverride) { return __awaiter(this, void 0, void 0, function* () { const endpoint = endpointOverride === null || endpointOverride === void 0 ? void 0 : endpointOverride.replace(/[\/]+$/, ""); const { wasm } = yield getPlatformCapabilities(); if (!wasm.supported) throw wasm.error; const { lensCore } = getPlatformInfo(); const flavor = wasmCapabilitiesToLensCoreBuildFlavor[wasm.wasmFeatures]; if (!flavor) throw new Error(`Could not determine a LensCore build flavor corresponding to the bitstring ` + `${wasm.wasmFeatures.toString(2)}. CameraKit cannot be bootstrapped.`); const version = lensCore.version; const buildNumber = lensCore.buildNumber; return wasmAssets.map((asset) => { if (endpoint) return `${endpoint}/${asset}`; const { origin, pathname, search } = new URL(lensCore.baseUrl); return `${origin}${pathname}/${version}/${buildNumber}/${flavor}/${asset}${search}`; }); }); } //# sourceMappingURL=bootstrapURLs.js.map