UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

27 lines (25 loc) 1.15 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); //#region src/ui/runtime.ts function getRuntimeConfig() { if (typeof window === "undefined") throw new Error("Runtime config is only available in the browser"); if (!window.__RUNTIME_CONFIG__) throw new Error("Missing runtime config"); return window.__RUNTIME_CONFIG__; } function buildRuntimeHref(pathname, runtimeConfig) { const basePath = runtimeConfig?.runtime?.runtimeBasePath ?? "/"; if (basePath === "/") return pathname; if (!pathname.startsWith("/")) return `${basePath}/${pathname}`; return pathname === "/" ? basePath : `${basePath}${pathname}`; } function buildPublishedAccountHref(accountId) { return `/apps/${encodeURIComponent(accountId)}`; } function buildPublishedGatewayHref(accountId, gatewayId) { return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`; } //#endregion exports.buildPublishedAccountHref = buildPublishedAccountHref; exports.buildPublishedGatewayHref = buildPublishedGatewayHref; exports.buildRuntimeHref = buildRuntimeHref; exports.getRuntimeConfig = getRuntimeConfig; //# sourceMappingURL=runtime.cjs.map