UNPKG

mongoku

Version:

[![CI](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml/badge.svg)](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)

30 lines (27 loc) 1.02 kB
import { i as initial_base, b as base } from './server-Crjo4w1q.js'; import { r as resolve_route } from './routing-EDfUNu8L.js'; import { G as try_get_request_store } from './root-otUAnOAR.js'; function resolve(id, params) { if (!id.startsWith("/")) { throw new Error( `Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${id}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.` ); } const resolved = resolve_route( id, /** @type {Record<string, string>} */ params ); { const store = try_get_request_store(); if (store && !store.state.prerendering?.fallback) { const after_base = store.event.url.pathname.slice(initial_base.length); const segments = after_base.split("/").slice(2); const prefix = segments.map(() => "..").join("/") || "."; return prefix + resolved; } } return base + resolved; } export { resolve as r }; //# sourceMappingURL=server2-D_y4YbpC.js.map