Socket
Socket
Sign inDemoInstall

@tanstack/router-core

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router-core - npm Package Compare versions

Comparing version 0.0.1-beta.184 to 0.0.1-beta.185

2

build/cjs/history.js

@@ -122,3 +122,3 @@ /**

const createHref = opts?.createHref ?? (path => path);
const getLocation = () => parseLocation(getHref(), history.state);
const getLocation = () => parseLocation(getHref(), window.history.state);
return createHistory({

@@ -125,0 +125,0 @@ getLocation,

@@ -123,3 +123,3 @@ /**

const createHref = opts?.createHref ?? (path => path);
const getLocation = () => parseLocation(getHref(), history.state);
const getLocation = () => parseLocation(getHref(), window.history.state);
return createHistory({

@@ -126,0 +126,0 @@ getLocation,

@@ -14,11 +14,11 @@ {

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "497b-31"
"uid": "4e91-31"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "497b-33"
"uid": "4e91-33"
},
{
"name": "@tanstack+store@0.0.1/node_modules/@tanstack/store/build/esm/index.js",
"uid": "497b-47"
"uid": "4e91-47"
}

@@ -31,43 +31,43 @@ ]

{
"uid": "497b-35",
"uid": "4e91-35",
"name": "history.ts"
},
{
"uid": "497b-37",
"uid": "4e91-37",
"name": "utils.ts"
},
{
"uid": "497b-39",
"uid": "4e91-39",
"name": "path.ts"
},
{
"uid": "497b-41",
"uid": "4e91-41",
"name": "qss.ts"
},
{
"uid": "497b-43",
"uid": "4e91-43",
"name": "route.ts"
},
{
"uid": "497b-45",
"uid": "4e91-45",
"name": "fileRoute.ts"
},
{
"uid": "497b-49",
"uid": "4e91-49",
"name": "searchParams.ts"
},
{
"uid": "497b-51",
"uid": "4e91-51",
"name": "router.ts"
},
{
"uid": "497b-53",
"uid": "4e91-53",
"name": "scroll-restoration.ts"
},
{
"uid": "497b-55",
"uid": "4e91-55",
"name": "defer.ts"
},
{
"uid": "497b-57",
"uid": "4e91-57",
"name": "index.ts"

@@ -83,92 +83,92 @@ }

"nodeParts": {
"497b-31": {
"4e91-31": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "497b-30"
"mainUid": "4e91-30"
},
"497b-33": {
"4e91-33": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "497b-32"
"mainUid": "4e91-32"
},
"497b-35": {
"renderedLength": 6455,
"4e91-35": {
"renderedLength": 6462,
"gzipLength": 1542,
"brotliLength": 0,
"mainUid": "497b-34"
"mainUid": "4e91-34"
},
"497b-37": {
"4e91-37": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "497b-36"
"mainUid": "4e91-36"
},
"497b-39": {
"4e91-39": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "497b-38"
"mainUid": "4e91-38"
},
"497b-41": {
"4e91-41": {
"renderedLength": 1371,
"gzipLength": 552,
"brotliLength": 0,
"mainUid": "497b-40"
"mainUid": "4e91-40"
},
"497b-43": {
"4e91-43": {
"renderedLength": 2536,
"gzipLength": 895,
"brotliLength": 0,
"mainUid": "497b-42"
"mainUid": "4e91-42"
},
"497b-45": {
"4e91-45": {
"renderedLength": 223,
"gzipLength": 143,
"brotliLength": 0,
"mainUid": "497b-44"
"mainUid": "4e91-44"
},
"497b-47": {
"4e91-47": {
"renderedLength": 1969,
"gzipLength": 653,
"brotliLength": 0,
"mainUid": "497b-46"
"mainUid": "4e91-46"
},
"497b-49": {
"4e91-49": {
"renderedLength": 1826,
"gzipLength": 579,
"brotliLength": 0,
"mainUid": "497b-48"
"mainUid": "4e91-48"
},
"497b-51": {
"4e91-51": {
"renderedLength": 41630,
"gzipLength": 9254,
"brotliLength": 0,
"mainUid": "497b-50"
"mainUid": "4e91-50"
},
"497b-53": {
"4e91-53": {
"renderedLength": 4430,
"gzipLength": 1190,
"brotliLength": 0,
"mainUid": "497b-52"
"mainUid": "4e91-52"
},
"497b-55": {
"4e91-55": {
"renderedLength": 682,
"gzipLength": 314,
"brotliLength": 0,
"mainUid": "497b-54"
"mainUid": "4e91-54"
},
"497b-57": {
"4e91-57": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "497b-56"
"mainUid": "4e91-56"
}
},
"nodeMetas": {
"497b-30": {
"4e91-30": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "497b-31"
"index.production.js": "4e91-31"
},

@@ -178,16 +178,16 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-42"
"uid": "4e91-42"
},
{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-32": {
"4e91-32": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "497b-33"
"index.production.js": "4e91-33"
},

@@ -197,10 +197,10 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-34": {
"4e91-34": {
"id": "/packages/router-core/src/history.ts",
"moduleParts": {
"index.production.js": "497b-35"
"index.production.js": "4e91-35"
},

@@ -210,13 +210,13 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-36": {
"4e91-36": {
"id": "/packages/router-core/src/utils.ts",
"moduleParts": {
"index.production.js": "497b-37"
"index.production.js": "4e91-37"
},

@@ -226,20 +226,20 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-38"
"uid": "4e91-38"
},
{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-38": {
"4e91-38": {
"id": "/packages/router-core/src/path.ts",
"moduleParts": {
"index.production.js": "497b-39"
"index.production.js": "4e91-39"
},
"imported": [
{
"uid": "497b-36"
"uid": "4e91-36"
}

@@ -249,16 +249,16 @@ ],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-42"
"uid": "4e91-42"
},
{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-40": {
"4e91-40": {
"id": "/packages/router-core/src/qss.ts",
"moduleParts": {
"index.production.js": "497b-41"
"index.production.js": "4e91-41"
},

@@ -268,20 +268,20 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-48"
"uid": "4e91-48"
}
]
},
"497b-42": {
"4e91-42": {
"id": "/packages/router-core/src/route.ts",
"moduleParts": {
"index.production.js": "497b-43"
"index.production.js": "4e91-43"
},
"imported": [
{
"uid": "497b-30"
"uid": "4e91-30"
},
{
"uid": "497b-38"
"uid": "4e91-38"
}

@@ -291,17 +291,17 @@ ],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-44"
"uid": "4e91-44"
}
]
},
"497b-44": {
"4e91-44": {
"id": "/packages/router-core/src/fileRoute.ts",
"moduleParts": {
"index.production.js": "497b-45"
"index.production.js": "4e91-45"
},
"imported": [
{
"uid": "497b-42"
"uid": "4e91-42"
}

@@ -311,10 +311,10 @@ ],

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-46": {
"4e91-46": {
"id": "/node_modules/.pnpm/@tanstack+store@0.0.1/node_modules/@tanstack/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "497b-47"
"index.production.js": "4e91-47"
},

@@ -324,14 +324,14 @@ "imported": [],

{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-48": {
"4e91-48": {
"id": "/packages/router-core/src/searchParams.ts",
"moduleParts": {
"index.production.js": "497b-49"
"index.production.js": "4e91-49"
},
"imported": [
{
"uid": "497b-40"
"uid": "4e91-40"
}

@@ -341,32 +341,32 @@ ],

{
"uid": "497b-56"
"uid": "4e91-56"
},
{
"uid": "497b-50"
"uid": "4e91-50"
}
]
},
"497b-50": {
"4e91-50": {
"id": "/packages/router-core/src/router.ts",
"moduleParts": {
"index.production.js": "497b-51"
"index.production.js": "4e91-51"
},
"imported": [
{
"uid": "497b-46"
"uid": "4e91-46"
},
{
"uid": "497b-30"
"uid": "4e91-30"
},
{
"uid": "497b-38"
"uid": "4e91-38"
},
{
"uid": "497b-48"
"uid": "4e91-48"
},
{
"uid": "497b-36"
"uid": "4e91-36"
},
{
"uid": "497b-34"
"uid": "4e91-34"
}

@@ -376,10 +376,10 @@ ],

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-52": {
"4e91-52": {
"id": "/packages/router-core/src/scroll-restoration.ts",
"moduleParts": {
"index.production.js": "497b-53"
"index.production.js": "4e91-53"
},

@@ -389,10 +389,10 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-54": {
"4e91-54": {
"id": "/packages/router-core/src/defer.ts",
"moduleParts": {
"index.production.js": "497b-55"
"index.production.js": "4e91-55"
},

@@ -402,53 +402,53 @@ "imported": [],

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-56": {
"4e91-56": {
"id": "/packages/router-core/src/index.ts",
"moduleParts": {
"index.production.js": "497b-57"
"index.production.js": "4e91-57"
},
"imported": [
{
"uid": "497b-30"
"uid": "4e91-30"
},
{
"uid": "497b-32"
"uid": "4e91-32"
},
{
"uid": "497b-34"
"uid": "4e91-34"
},
{
"uid": "497b-58"
"uid": "4e91-58"
},
{
"uid": "497b-38"
"uid": "4e91-38"
},
{
"uid": "497b-40"
"uid": "4e91-40"
},
{
"uid": "497b-42"
"uid": "4e91-42"
},
{
"uid": "497b-44"
"uid": "4e91-44"
},
{
"uid": "497b-59"
"uid": "4e91-59"
},
{
"uid": "497b-50"
"uid": "4e91-50"
},
{
"uid": "497b-48"
"uid": "4e91-48"
},
{
"uid": "497b-36"
"uid": "4e91-36"
},
{
"uid": "497b-52"
"uid": "4e91-52"
},
{
"uid": "497b-54"
"uid": "4e91-54"
}

@@ -459,3 +459,3 @@ ],

},
"497b-58": {
"4e91-58": {
"id": "/packages/router-core/src/link.ts",

@@ -466,7 +466,7 @@ "moduleParts": {},

{
"uid": "497b-56"
"uid": "4e91-56"
}
]
},
"497b-59": {
"4e91-59": {
"id": "/packages/router-core/src/routeInfo.ts",

@@ -477,3 +477,3 @@ "moduleParts": {},

{
"uid": "497b-56"
"uid": "4e91-56"
}

@@ -480,0 +480,0 @@ ]

@@ -19,3 +19,3 @@ export interface RouterHistory {

export interface RouterLocation extends ParsedPath {
state: any;
state: Record<string, any>;
}

@@ -22,0 +22,0 @@ type BlockerFn = (retry: () => void, cancel: () => void) => void;

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const s="pushstate",r="popstate",o="beforeunload",a=t=>(t.preventDefault(),t.returnValue=""),n=()=>{removeEventListener(o,a,{capture:!0})};function i(t){let e=t.getLocation(),s=()=>{},r=new Set,i=[],c=[];const h=()=>{if(i.length)i[0]?.(h,(()=>{i=[],n()}));else{for(;c.length;)c.shift()?.();t.subscriber||d()}},l=t=>{c.push(t),h()},d=()=>{e=t.getLocation(),r.forEach((t=>t()))};return{get location(){return e},subscribe:e=>(0===r.size&&(s="function"==typeof t.subscriber?t.subscriber(d):()=>{}),r.add(e),()=>{r.delete(e),0===r.size&&s()}),push:(e,s)=>{l((()=>{t.pushState(e,s)}))},replace:(e,s)=>{l((()=>{t.replaceState(e,s)}))},go:e=>{l((()=>{t.go(e)}))},back:()=>{l((()=>{t.back()}))},forward:()=>{l((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(i.push(t),1===i.length&&addEventListener(o,a,{capture:!0}),()=>{i=i.filter((e=>e!==t)),i.length||n()})}}function c(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),o=t?.createHref??(t=>t);return i({getLocation:()=>l(e(),history.state),subscriber:t=>{window.addEventListener(s,t),window.addEventListener(r,t);var e=window.history.pushState;window.history.pushState=function(){let s=e.apply(history,arguments);return t(),s};var o=window.history.replaceState;return window.history.replaceState=function(){let e=o.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=o,window.removeEventListener(s,t),window.removeEventListener(r,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:d()},"",o(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:d()},"",o(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>o(t)})}function h(t={initialEntries:["/"]}){const e=t.initialEntries;let s=t.initialIndex??e.length-1,r={};return i({getLocation:()=>l(e[s],r),subscriber:!1,pushState:(t,o)=>{r={...o,key:d()},e.push(t),s++},replaceState:(t,o)=>{r={...o,key:d()},e[s]=t},back:()=>{s--},forward:()=>{s=Math.min(s+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function l(t,e){let s=t.indexOf("#"),r=t.indexOf("?");return{href:t,pathname:t.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:t.length),hash:s>-1?t.substring(s):"",search:r>-1?t.slice(r,-1===s?void 0:s):"",state:e}}function d(){return(Math.random()+1).toString(36).substring(7)}function u(t){return t[t.length-1]}function p(t,e){return"function"==typeof t?t(e):t}function f(t,e){return e.reduce(((e,s)=>(e[s]=t[s],e)),{})}function m(t,e){if(t===e)return t;const s=e,r=Array.isArray(t)&&Array.isArray(s);if(r||y(t)&&y(s)){const e=r?t.length:Object.keys(t).length,o=r?s:Object.keys(s),a=o.length,n=r?[]:{};let i=0;for(let e=0;e<a;e++){const a=r?e:o[e];n[a]=m(t[a],s[a]),n[a]===t[a]&&i++}return e===a&&i===e?t:n}return s}function y(t){if(!g(t))return!1;const e=t.constructor;if(void 0===e)return!0;const s=e.prototype;return!!g(s)&&!!s.hasOwnProperty("isPrototypeOf")}function g(t){return"[object Object]"===Object.prototype.toString.call(t)}function w(t,e){return t===e||typeof t==typeof e&&(y(t)&&y(e)?!Object.keys(e).some((s=>!w(t[s],e[s]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,s)=>w(t,e[s])))))}function v(t){return b(t.filter(Boolean).join("/"))}function b(t){return t.replace(/\/{2,}/g,"/")}function _(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function S(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function R(t){return S(_(t))}function I(t,e,s){e=e.replace(new RegExp(`^${t}`),"/"),s=s.replace(new RegExp(`^${t}`),"/");let r=x(e);const o=x(s);o.forEach(((t,e)=>{if("/"===t.value)e?e===o.length-1&&r.push(t):r=[t];else if(".."===t.value)r.length>1&&"/"===u(r)?.value&&r.pop(),r.pop();else{if("."===t.value)return;r.push(t)}}));return b(v([t,...r.map((t=>t.value))]))}function x(t){if(!t)return[];const e=[];if("/"===(t=b(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const s=t.split("/").filter(Boolean);return e.push(...s.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function M(t,e,s=!1){return v(x(t).map((t=>{if("wildcard"===t.type){const r=e[t.value];return s?`${t.value}${r??""}`:r}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function E(t,e,s){const r=P(t,e,s);if(!s.to||r)return r??{}}function P(t,e,s){e="/"!=t?e.substring(t.length):e;const r=`${s.to??"$"}`,o=x(e),a=x(r);e.startsWith("/")||o.unshift({type:"pathname",value:"/"}),r.startsWith("/")||a.unshift({type:"pathname",value:"/"});const n={};return(()=>{for(let t=0;t<Math.max(o.length,a.length);t++){const e=o[t],r=a[t],i=t>=o.length-1,c=t>=a.length-1;if(r){if("wildcard"===r.type)return!!e?.value&&(n["*"]=v(o.slice(t).map((t=>t.value))),!0);if("pathname"===r.type){if("/"===r.value&&!e?.value)return!0;if(e)if(s.caseSensitive){if(r.value!==e.value)return!1}else if(r.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===r.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(n[r.value.substring(1)]=e.value)}}if(!i&&c)return!!s.fuzzy}return!0})()?n:void 0}function A(t,e){var s,r,o,a="";for(s in t)if(void 0!==(o=t[s]))if(Array.isArray(o))for(r=0;r<o.length;r++)a&&(a+="&"),a+=encodeURIComponent(s)+"="+encodeURIComponent(o[r]);else a&&(a+="&"),a+=encodeURIComponent(s)+"="+encodeURIComponent(o);return(e||"")+a}function L(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function D(t){for(var e,s,r={},o=t.split("&");e=o.shift();)void 0!==r[s=(e=e.split("=")).shift()]?r[s]=[].concat(r[s],L(e.shift())):r[s]=L(e.shift());return r}const B="__root__";class O{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,O.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const s=this.options,r=!s?.path&&!s?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=B:e(this.parentRoute);let o=r?B:s.path;o&&"/"!==o&&(o=R(o));const a=s?.id||o;let n=r?B:v([this.parentRoute.id===B?"":this.parentRoute.id,a]);o===B&&(o="/"),n!==B&&(n=v(["/",n]));const i=n===B?"/":v([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class $ extends O{constructor(t){super(t)}}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const s="pushstate",r="popstate",o="beforeunload",a=t=>(t.preventDefault(),t.returnValue=""),n=()=>{removeEventListener(o,a,{capture:!0})};function i(t){let e=t.getLocation(),s=()=>{},r=new Set,i=[],c=[];const h=()=>{if(i.length)i[0]?.(h,(()=>{i=[],n()}));else{for(;c.length;)c.shift()?.();t.subscriber||d()}},l=t=>{c.push(t),h()},d=()=>{e=t.getLocation(),r.forEach((t=>t()))};return{get location(){return e},subscribe:e=>(0===r.size&&(s="function"==typeof t.subscriber?t.subscriber(d):()=>{}),r.add(e),()=>{r.delete(e),0===r.size&&s()}),push:(e,s)=>{l((()=>{t.pushState(e,s)}))},replace:(e,s)=>{l((()=>{t.replaceState(e,s)}))},go:e=>{l((()=>{t.go(e)}))},back:()=>{l((()=>{t.back()}))},forward:()=>{l((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(i.push(t),1===i.length&&addEventListener(o,a,{capture:!0}),()=>{i=i.filter((e=>e!==t)),i.length||n()})}}function c(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),o=t?.createHref??(t=>t);return i({getLocation:()=>l(e(),window.history.state),subscriber:t=>{window.addEventListener(s,t),window.addEventListener(r,t);var e=window.history.pushState;window.history.pushState=function(){let s=e.apply(history,arguments);return t(),s};var o=window.history.replaceState;return window.history.replaceState=function(){let e=o.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=o,window.removeEventListener(s,t),window.removeEventListener(r,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:d()},"",o(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:d()},"",o(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>o(t)})}function h(t={initialEntries:["/"]}){const e=t.initialEntries;let s=t.initialIndex??e.length-1,r={};return i({getLocation:()=>l(e[s],r),subscriber:!1,pushState:(t,o)=>{r={...o,key:d()},e.push(t),s++},replaceState:(t,o)=>{r={...o,key:d()},e[s]=t},back:()=>{s--},forward:()=>{s=Math.min(s+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function l(t,e){let s=t.indexOf("#"),r=t.indexOf("?");return{href:t,pathname:t.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:t.length),hash:s>-1?t.substring(s):"",search:r>-1?t.slice(r,-1===s?void 0:s):"",state:e}}function d(){return(Math.random()+1).toString(36).substring(7)}function u(t){return t[t.length-1]}function p(t,e){return"function"==typeof t?t(e):t}function f(t,e){return e.reduce(((e,s)=>(e[s]=t[s],e)),{})}function m(t,e){if(t===e)return t;const s=e,r=Array.isArray(t)&&Array.isArray(s);if(r||y(t)&&y(s)){const e=r?t.length:Object.keys(t).length,o=r?s:Object.keys(s),a=o.length,n=r?[]:{};let i=0;for(let e=0;e<a;e++){const a=r?e:o[e];n[a]=m(t[a],s[a]),n[a]===t[a]&&i++}return e===a&&i===e?t:n}return s}function y(t){if(!g(t))return!1;const e=t.constructor;if(void 0===e)return!0;const s=e.prototype;return!!g(s)&&!!s.hasOwnProperty("isPrototypeOf")}function g(t){return"[object Object]"===Object.prototype.toString.call(t)}function w(t,e){return t===e||typeof t==typeof e&&(y(t)&&y(e)?!Object.keys(e).some((s=>!w(t[s],e[s]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,s)=>w(t,e[s])))))}function v(t){return b(t.filter(Boolean).join("/"))}function b(t){return t.replace(/\/{2,}/g,"/")}function _(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function S(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function R(t){return S(_(t))}function I(t,e,s){e=e.replace(new RegExp(`^${t}`),"/"),s=s.replace(new RegExp(`^${t}`),"/");let r=x(e);const o=x(s);o.forEach(((t,e)=>{if("/"===t.value)e?e===o.length-1&&r.push(t):r=[t];else if(".."===t.value)r.length>1&&"/"===u(r)?.value&&r.pop(),r.pop();else{if("."===t.value)return;r.push(t)}}));return b(v([t,...r.map((t=>t.value))]))}function x(t){if(!t)return[];const e=[];if("/"===(t=b(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const s=t.split("/").filter(Boolean);return e.push(...s.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function M(t,e,s=!1){return v(x(t).map((t=>{if("wildcard"===t.type){const r=e[t.value];return s?`${t.value}${r??""}`:r}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function E(t,e,s){const r=P(t,e,s);if(!s.to||r)return r??{}}function P(t,e,s){e="/"!=t?e.substring(t.length):e;const r=`${s.to??"$"}`,o=x(e),a=x(r);e.startsWith("/")||o.unshift({type:"pathname",value:"/"}),r.startsWith("/")||a.unshift({type:"pathname",value:"/"});const n={};return(()=>{for(let t=0;t<Math.max(o.length,a.length);t++){const e=o[t],r=a[t],i=t>=o.length-1,c=t>=a.length-1;if(r){if("wildcard"===r.type)return!!e?.value&&(n["*"]=v(o.slice(t).map((t=>t.value))),!0);if("pathname"===r.type){if("/"===r.value&&!e?.value)return!0;if(e)if(s.caseSensitive){if(r.value!==e.value)return!1}else if(r.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===r.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(n[r.value.substring(1)]=e.value)}}if(!i&&c)return!!s.fuzzy}return!0})()?n:void 0}function A(t,e){var s,r,o,a="";for(s in t)if(void 0!==(o=t[s]))if(Array.isArray(o))for(r=0;r<o.length;r++)a&&(a+="&"),a+=encodeURIComponent(s)+"="+encodeURIComponent(o[r]);else a&&(a+="&"),a+=encodeURIComponent(s)+"="+encodeURIComponent(o);return(e||"")+a}function L(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function D(t){for(var e,s,r={},o=t.split("&");e=o.shift();)void 0!==r[s=(e=e.split("=")).shift()]?r[s]=[].concat(r[s],L(e.shift())):r[s]=L(e.shift());return r}const B="__root__";class O{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,O.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const s=this.options,r=!s?.path&&!s?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=B:e(this.parentRoute);let o=r?B:s.path;o&&"/"!==o&&(o=R(o));const a=s?.id||o;let n=r?B:v([this.parentRoute.id===B?"":this.parentRoute.id,a]);o===B&&(o="/"),n!==B&&(n=v(["/",n]));const i=n===B?"/":v([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class $ extends O{constructor(t){super(t)}}
/**

@@ -14,0 +14,0 @@ * @tanstack/store/src/index.ts

{
"name": "@tanstack/router-core",
"author": "Tanner Linsley",
"version": "0.0.1-beta.184",
"version": "0.0.1-beta.185",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "tanstack/router",

@@ -25,3 +25,3 @@ // While the public API was clearly inspired by the "history" npm package,

export interface RouterLocation extends ParsedPath {
state: any
state: Record<string, any>
}

@@ -166,3 +166,3 @@

const createHref = opts?.createHref ?? ((path) => path)
const getLocation = () => parseLocation(getHref(), history.state)
const getLocation = () => parseLocation(getHref(), window.history.state)

@@ -169,0 +169,0 @@ return createHistory({

@@ -197,6 +197,3 @@ import { Store } from '@tanstack/store'

export interface RouterState<
TRouteTree extends AnyRoute = AnyRoute,
// TState extends LocationState = LocationState,
> {
export interface RouterState<TRouteTree extends AnyRoute = AnyRoute> {
status: 'idle' | 'pending'

@@ -203,0 +200,0 @@ isFetching: boolean

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc