@real-router/core 0.111.2 → 0.111.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- import{i as e,r as t}from"./ingest-Wemkuwfp.mjs";const n=Object.hasOwn;function r(e,t){if(t.length!==0&&e!==void 0)for(let r of t){if(!n(e,r))continue;let t;try{t=e[r]}catch{return}if(t!==void 0)return r}}function i(e,t,n,i,a,s){let c=r(n,i);if(c!==void 0)throw TypeError(`[router.${e}] ${o(t,c,typeof a==`function`?a():a,s)}`)}function a(e,t,n,r){i(e,t,n,r,"the `params` bag this call is about to ship — the channel check above it read a different value, so the caller's object answered differently between the two reads")}function o(e,t,n="the `params` argument",r="Pass it in `search` instead"){return`Route "${e}" declares \`${t}\` as a query param, but it was given in ${n} — the path channel. ${r}; the two channels are separate since RFC-4 M2 and the router never moves a key between them.`}const s=new WeakMap;function c(e){let t=s.get(e);if(!t)throw TypeError(`[real-router] Invalid router instance — not found in internals registry`);return t}function l(e,t,n,r){i(t,n,r,e.getQueryParams(n))}function u(e,t){s.set(e,t)}function d(e,t,n){let r=t;for(let t of e){let e=r;r=(...n)=>t(e,...n)}return r(...n)}function f(e,t,n){return((...r)=>{let i=n.get(e);return!i||i.length===0?t(...r):d(i,t,r)})}function p(e,t,n){return(r,i,a)=>{let o=n.get(e);return!o||o.length===0?t(r,i,a):d(o,t,[r,i,a])}}const m=e=>e===58||e===42;function h(e){let t=[],n=0;for(let r=0;r<e.length;r+=1)e.charCodeAt(r)===47&&(t.push(e.slice(n,r)),n=r+1);return t.push(e.slice(n)),t}function g(e){let t=e.length;if(t===0)return{kind:`static`,text:``};if(!m(e.charCodeAt(0))){for(let n=0;n<t;n+=1){let r=e.charCodeAt(n);if(r===60||r===62)return{error:`constraint-removed`};if(m(r)&&n+1<t)return{error:`fused-marker`}}return e.charCodeAt(t-1)===63?{error:`name-less`}:{kind:`static`,text:e}}let n=e.charCodeAt(0)===42,r=1;for(;r<t;){let t=e.charCodeAt(r);if(t===60||t===62||t===63)break;r+=1}let i=e.slice(1,r);return i.length===0?{error:`name-less`}:m(i.charCodeAt(i.length-1))?{error:`trailing-marker`}:r<t?e.charCodeAt(r)===63?{error:`optional-removed`}:{error:`constraint-removed`}:n?{kind:`splat`,name:i}:{kind:`param`,name:i}}function _(e){for(let t of h(e)){let e=g(t);if(`error`in e)return e.error}}function v(e){let t=h(e);for(let e=0;e<t.length;e+=1){let n=g(t[e]);if(`error`in n){if(n.error===`optional-removed`){let n=t[e],r=[...t];return r[e]=n.slice(0,n.indexOf(`?`)),{code:`optional-removed`,segment:n,withoutSegment:t.filter((t,n)=>n!==e).join(`/`),requiredForm:r.join(`/`)}}return n.error===`constraint-removed`?{code:`constraint-removed`,segment:t[e]}:void 0}}}const y=/[<>]/u;function b(e){for(let t=0;t<e.length;t+=1){if(e.codePointAt(t)!==63)continue;let n=t+1<e.length?e.codePointAt(t+1):-1;if(n!==-1&&n!==47&&n!==63&&n!==60)return t}return-1}const x=Object.freeze([]),S=Object.freeze({}),C=Object.freeze({urlParams:x,queryParams:x,spatParams:x,paramTypeMap:S,pathPattern:``});function w(e,t,n,r){for(let i of h(e)){if(i.length===0)continue;let e=g(i);`error`in e||e.kind===`static`||(t.push(e.name),r[e.name]=`url`,e.kind===`splat`&&n.push(e.name))}}function T(n){let r=[],i=[],a=[],o=t(),s=b(n);if(s!==-1){let e=n.slice(s+1).split(`&`);for(let t of e){let e=t.trim();e.length>0&&(i.push(e),o[e]=`query`)}n=n.slice(0,s)}return w(n,r,a,o),E(r,i,a,e(o),n)}function E(e,t,n,r,i){return{urlParams:e.length===0?x:e,queryParams:t.length===0?x:t,spatParams:n.length===0?x:n,paramTypeMap:e.length===0&&t.length===0?S:r,pathPattern:i}}export{_ as a,f as c,u as d,l as f,o as g,r as h,v as i,p as l,a as m,y as n,g as o,i as p,T as r,h as s,C as t,c as u};
2
- //# sourceMappingURL=buildParamMeta-BCzlczgt.mjs.map