@real-router/browser-plugin 0.5.3 → 0.5.5

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.
@@ -259,7 +259,6 @@ interface StateMeta<P extends Params = Params> {
259
259
  * @see {@link State.meta} for where options are stored after navigation
260
260
  */
261
261
  interface NavigationOptions {
262
- [key: string]: string | number | boolean | Record<string, unknown> | undefined;
263
262
  /**
264
263
  * Replace the current history entry instead of pushing a new one.
265
264
  *
@@ -395,6 +394,17 @@ interface NavigationOptions {
395
394
  * @see {@link NavigationOptions.redirected} for the input mechanism
396
395
  */
397
396
  redirected?: boolean | undefined;
397
+ /**
398
+ * Optional abort signal for cancelling the navigation.
399
+ *
400
+ * @description
401
+ * When provided, this signal can be used to cancel the navigation operation.
402
+ * If the signal is aborted, the navigation will be cancelled and any pending
403
+ * guards or transitions will be interrupted.
404
+ *
405
+ * @default undefined
406
+ */
407
+ signal?: AbortSignal | undefined;
398
408
  }
399
409
  interface Params {
400
410
  [key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- var e=require("@real-router/core"),t=require("@real-router/logger"),r=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function n(e,t=new WeakSet){if(null==e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("function"===r||"symbol"===r)return!1;if(Array.isArray(e))return!t.has(e)&&(t.add(e),e.every(e=>n(e,t)));if("object"===r){if(t.has(e))return!1;t.add(e);const r=Object.getPrototypeOf(e);return(null===r||r===Object.prototype)&&Object.values(e).every(e=>n(e,t))}return!1}function a(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function o(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);if(null!==t&&t!==Object.prototype)return!1;let r=!1;for(const t in e){if(!Object.hasOwn(e,t))continue;const n=e[t];if(!a(n)){const e=typeof n;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||n(e)}function s(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||("number"===t?Number.isFinite(e):!!Array.isArray(e)&&e.every(e=>{const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}))}function i(e){if("object"!=typeof e||null===e)return!1;const t=e;return!("params"in t&&!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;for(const t in e)if(Object.hasOwn(e,t)&&!s(e[t]))return!1;return!0}(t.params)||"options"in t&&"object"!=typeof t.options||"id"in t&&"number"!=typeof t.id)}function l(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||r.test(e)))}(e.name)&&"string"==typeof e.path&&o(e.params)}function c(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!l(t)&&(void 0===t.meta||i(t.meta))}function u(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!l(t)&&"meta"in t&&i(t.meta)}var h={forceDeactivate:!0,useHash:!1,hashPrefix:"",base:"",mergeState:!1,preserveHash:!0},p="popstate",f="browser-plugin",g=new Map,d=e=>{const t=g.get(e);if(void 0!==t)return t;const r=e.replaceAll(/[$()*+.?[\\\]^{|}-]/g,String.raw`\$&`);return g.set(e,r),r};function b(e,t,r,n,a){const o={meta:e.meta,name:e.name,params:e.params,path:e.path},s=a.mergeState&&n.getState()?{...n.getState(),...o}:o;r?n.replaceState(s,"",t):n.pushState(s,"",t)}function m(t,r,n,a,o,s,i){t&&t.code===e.errorCodes.CANNOT_DEACTIVATE&&r&&n&&!a&&b(n,o.buildUrl(n.name,n.params),!0,s,i)}function y(e,t){return e in t}function v(e,t,r){const n=typeof t;return n===r||void 0===t||(console.warn(`[${f}] Invalid type for '${e}': expected ${r}, got ${n}`),!1)}var S=()=>{},w=()=>globalThis.location.pathname,T=(()=>{let e,t=!1;return()=>{const r=globalThis.navigator.userAgent;return r!==e&&(e=r,t=!r.includes("Trident")),t}})(),$=(e,t,r)=>{globalThis.history.pushState(e,t??"",r)},P=(e,t,r)=>{globalThis.history.replaceState(e,t??"",r)},H=(e,t)=>{const r=t.useHash&&!T();return globalThis.addEventListener("popstate",e),r&&globalThis.addEventListener("hashchange",e),()=>{globalThis.removeEventListener("popstate",e),r&&globalThis.removeEventListener("hashchange",e)}},j=(()=>{const e=new Map;return t=>{let r=e.get(t);return r||(r=new RegExp(t),e.set(t,r)),r}})(),A=e=>{const{useHash:t,hashPrefix:r="",base:n=""}=e;if(!r&&!n){const e=t?globalThis.location.hash.slice(1):globalThis.location.pathname;return(O(e)||"/")+globalThis.location.search}const a=d(r),o=d(n),s=t?globalThis.location.hash.replace(j(`^#${a}`),""):globalThis.location.pathname.replace(j(`^${o}`),"");return(O(s)||"/")+globalThis.location.search},O=e=>{try{return encodeURI(decodeURI(e))}catch(r){return t.logger.warn(f,`Could not encode path "${e}"`,r),e}},x=()=>{if(globalThis.history.state){if(u(globalThis.history.state))return globalThis.history.state;t.logger.warn(f,"History state is not a valid state object, ignoring",globalThis.history.state)}},L=()=>globalThis.location.hash;exports.browserPluginFactory=function(r,n=function(){return void 0!==globalThis.window&&globalThis.history?{getBase:w,pushState:$,replaceState:P,addPopstateListener:H,getLocation:A,getState:x,getHash:L}:function(){let e=!1;const r=r=>{e||(t.logger.warn(f,`Browser plugin is running in a non-browser environment. Method "${r}" is a no-op. This is expected for SSR, but may indicate misconfiguration if you expected browser behavior.`),e=!0)};return{getBase:()=>(r("getBase"),""),pushState:()=>{r("pushState")},replaceState:()=>{r("replaceState")},addPopstateListener:()=>(r("addPopstateListener"),S),getLocation:()=>(r("getLocation"),""),getState:()=>{r("getState")},getHash:()=>(r("getHash"),"")}}()}()){const a=function(e,t){if(!e)return!1;let r=!1;for(const n of Object.keys(e))y(n,t)&&(v(n,e[n],typeof t[n])||(r=!0));if(!0===e.useHash&&"preserveHash"in e&&console.warn(`[${f}] preserveHash ignored in hash mode`),!1===e.useHash&&"hashPrefix"in e){const t=e.hashPrefix;void 0!==t&&""!==t&&console.warn(`[${f}] hashPrefix ignored in history mode`)}return r}(r,h);let o={...h,...r};a&&(console.warn(`[${f}] Using default options due to invalid types`),o={...h}),!0===o.useHash?delete o.preserveHash:delete o.hashPrefix,o.base&&"string"==typeof o.base&&(o.base.startsWith("/")||(o.base=`/${o.base}`),o.base.endsWith("/")&&(o.base=o.base.slice(0,-1)));const s=new Map,i=e=>{const t=s.get(e);if(void 0!==t)return t;const r=new RegExp(e);return s.set(e,r),r},l=o.forceDeactivate,u=void 0===l?{source:p,replace:!0}:{forceDeactivate:l,source:p,replace:!0};let g;return function(t){const r=t,a=e.getPluginApi(t),s=r.start;let l,h=!1,p=null;const y=()=>o.base??"",v=o.hashPrefix??"",S=d(v),w=o.useHash?`#${v}`:"",T=S?i(`^#${S}`):null;function $(){if(p){const e=p;p=null,console.warn(`[${f}] Processing deferred popstate event`),P(e)}}async function P(e){if(h)return console.warn(`[${f}] Transition in progress, deferring popstate event`),void(p=e);try{const t=r.getState(),s=function(e,t,r,n){return c(e.state)?t.makeState(e.state.name,e.state.params,e.state.path,{...e.state.meta,params:e.state.meta?.params??{},options:e.state.meta?.options??{}},e.state.meta?.id):t.matchPath(r.getLocation(n))}(e,a,n,o),i=!c(e.state);if(!s&&function(e,t,r){const n=t.getOptions(),{defaultRoute:a}=n;return!!a&&(e.navigateToDefault({...r,reload:!0,replace:!0}),!0)}(r,a,u))return;if(function(e,t,r){return!e||!(!t||!r.areStatesEqual(e,t,!1))}(s,t,r))return;if(!s)return;h=!0;try{m(void 0,await a.navigateToState(s,t,u),t,i,r,n,o)}catch(e){m(e,void 0,t,i,r,n,o)}finally{h=!1,$()}}catch(e){h=!1,console.error(`[${f}] Critical error in onPopState`,e);try{const e=r.getState();if(e){const t=r.buildUrl(e.name,e.params);n.replaceState(e,"",t)}}catch(e){console.error(`[${f}] Failed to recover from critical error`,e)}$()}}return r.start=e=>s(e??n.getLocation(o)),r.buildUrl=(e,t)=>{const n=r.buildPath(e,t);return y()+w+n},r.matchUrl=e=>{const t=(e=>{try{const t=new URL(e,globalThis.location.origin),r=t.pathname,n=t.hash,a=t.search,s=y();if(!["http:","https:"].includes(t.protocol))return console.warn(`[${f}] Invalid URL protocol in ${e}`),null;if(o.useHash)return(T?n.replace(T,""):n.slice(1))+a;if(s){const e=d(s),t=i(`^${e}`),n=r.replace(t,"");return(n.startsWith("/")?"":"/")+n+a}return r+a}catch(t){return console.warn(`[${f}] Could not parse url ${e}`,t),null}})(e);return t?a.matchPath(t):void 0},r.replaceHistoryState=(e,t={})=>{const s=a.buildState(e,t);if(!s)throw new Error(`[real-router] Cannot replace state: route "${e}" is not found`);b(a.makeState(s.name,s.params,r.buildPath(s.name,s.params),{params:s.meta,options:{}},1),r.buildUrl(e,t),!0,n,o)},Object.defineProperty(r,"lastKnownState",{get:()=>l,set(e){l=e?Object.freeze({...e}):void 0},enumerable:!0,configurable:!0}),{onStart:()=>{g&&g(),g=n.addPopstateListener(e=>{P(e)},o)},onStop:()=>{g&&(g(),g=void 0)},onTransitionSuccess:(e,t,a)=>{r.lastKnownState=e;const s=(a.replace??!t)||!!a.reload&&r.areStatesEqual(e,t,!1),i=r.buildUrl(e.name,e.params);b(e,!o.preserveHash||t&&t.path!==e.path?i:i+n.getHash(),s,n,o)},teardown:()=>{g&&(g(),g=void 0),r.start=s,delete r.buildUrl,delete r.matchUrl,delete r.replaceHistoryState,delete r.lastKnownState}}}},exports.isHistoryState=u,exports.isState=c;//# sourceMappingURL=index.js.map
1
+ "use strict";var e=require("@real-router/core"),t=require("@real-router/logger"),r=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function n(e,t=new WeakSet){if(null==e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("function"===r||"symbol"===r)return!1;if(Array.isArray(e))return!t.has(e)&&(t.add(e),e.every(e=>n(e,t)));if("object"===r){if(t.has(e))return!1;t.add(e);const r=Object.getPrototypeOf(e);return(null===r||r===Object.prototype)&&Object.values(e).every(e=>n(e,t))}return!1}function a(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function o(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);if(null!==t&&t!==Object.prototype)return!1;let r=!1;for(const t in e){if(!Object.hasOwn(e,t))continue;const n=e[t];if(!a(n)){const e=typeof n;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||n(e)}function s(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||("number"===t?Number.isFinite(e):!!Array.isArray(e)&&e.every(e=>{const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}))}function i(e){if("object"!=typeof e||null===e)return!1;const t=e;return!("params"in t&&!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;for(const t in e)if(Object.hasOwn(e,t)&&!s(e[t]))return!1;return!0}(t.params)||"options"in t&&"object"!=typeof t.options||"id"in t&&"number"!=typeof t.id)}function l(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||r.test(e)))}(e.name)&&"string"==typeof e.path&&o(e.params)}function c(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!l(t)&&(void 0===t.meta||i(t.meta))}function u(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!l(t)&&"meta"in t&&i(t.meta)}var h={forceDeactivate:!0,useHash:!1,hashPrefix:"",base:"",mergeState:!1,preserveHash:!0},p="popstate",f="browser-plugin",g=new Map,d=e=>{const t=g.get(e);if(void 0!==t)return t;const r=e.replaceAll(/[$()*+.?[\\\]^{|}-]/g,String.raw`\$&`);return g.set(e,r),r};function b(e,t,r,n,a){const o={meta:e.meta,name:e.name,params:e.params,path:e.path},s=a.mergeState&&n.getState()?{...n.getState(),...o}:o;r?n.replaceState(s,"",t):n.pushState(s,"",t)}function m(t,r,n,a,o,s,i){t&&t.code===e.errorCodes.CANNOT_DEACTIVATE&&r&&n&&!a&&b(n,o.buildUrl(n.name,n.params),!0,s,i)}function y(e,t){return e in t}function v(e,t,r){const n=typeof t;return n===r||void 0===t||(console.warn(`[${f}] Invalid type for '${e}': expected ${r}, got ${n}`),!1)}var S=()=>{},w=()=>globalThis.location.pathname,T=(()=>{let e,t=!1;return()=>{const r=globalThis.navigator.userAgent;return r!==e&&(e=r,t=!r.includes("Trident")),t}})(),$=(e,t,r)=>{globalThis.history.pushState(e,t??"",r)},P=(e,t,r)=>{globalThis.history.replaceState(e,t??"",r)},H=(e,t)=>{const r=t.useHash&&!T();return globalThis.addEventListener("popstate",e),r&&globalThis.addEventListener("hashchange",e),()=>{globalThis.removeEventListener("popstate",e),r&&globalThis.removeEventListener("hashchange",e)}},j=(()=>{const e=new Map;return t=>{let r=e.get(t);return r||(r=new RegExp(t),e.set(t,r)),r}})(),A=e=>{const{useHash:t,hashPrefix:r="",base:n=""}=e;if(!r&&!n){const e=t?globalThis.location.hash.slice(1):globalThis.location.pathname;return(O(e)||"/")+globalThis.location.search}const a=d(r),o=d(n),s=t?globalThis.location.hash.replace(j(`^#${a}`),""):globalThis.location.pathname.replace(j(`^${o}`),"");return(O(s)||"/")+globalThis.location.search},O=e=>{try{return encodeURI(decodeURI(e))}catch(r){return t.logger.warn(f,`Could not encode path "${e}"`,r),e}},x=()=>{if(globalThis.history.state){if(u(globalThis.history.state))return globalThis.history.state;t.logger.warn(f,"History state is not a valid state object, ignoring",globalThis.history.state)}},L=()=>globalThis.location.hash;exports.browserPluginFactory=function(r,n=function(){return void 0!==globalThis.window&&globalThis.history?{getBase:w,pushState:$,replaceState:P,addPopstateListener:H,getLocation:A,getState:x,getHash:L}:function(){let e=!1;const r=r=>{e||(t.logger.warn(f,`Browser plugin is running in a non-browser environment. Method "${r}" is a no-op. This is expected for SSR, but may indicate misconfiguration if you expected browser behavior.`),e=!0)};return{getBase:()=>(r("getBase"),""),pushState:()=>{r("pushState")},replaceState:()=>{r("replaceState")},addPopstateListener:()=>(r("addPopstateListener"),S),getLocation:()=>(r("getLocation"),""),getState:()=>{r("getState")},getHash:()=>(r("getHash"),"")}}()}()){const a=function(e,t){if(!e)return!1;let r=!1;for(const n of Object.keys(e))y(n,t)&&(v(n,e[n],typeof t[n])||(r=!0));if(!0===e.useHash&&"preserveHash"in e&&console.warn(`[${f}] preserveHash ignored in hash mode`),!1===e.useHash&&"hashPrefix"in e){const t=e.hashPrefix;void 0!==t&&""!==t&&console.warn(`[${f}] hashPrefix ignored in history mode`)}return r}(r,h);let o={...h,...r};a&&(console.warn(`[${f}] Using default options due to invalid types`),o={...h}),!0===o.useHash?delete o.preserveHash:delete o.hashPrefix,o.base&&"string"==typeof o.base&&(o.base.startsWith("/")||(o.base=`/${o.base}`),o.base.endsWith("/")&&(o.base=o.base.slice(0,-1)));const s=new Map,i=e=>{const t=s.get(e);if(void 0!==t)return t;const r=new RegExp(e);return s.set(e,r),r},l=o.forceDeactivate,u=void 0===l?{source:p,replace:!0}:{forceDeactivate:l,source:p,replace:!0};let g;return function(t){const r=t,a=e.getPluginApi(t),s=r.start;let l,h=!1,p=null;const y=()=>o.base??"",v=o.hashPrefix??"",S=d(v),w=o.useHash?`#${v}`:"",T=S?i(`^#${S}`):null;function $(){if(p){const e=p;p=null,console.warn(`[${f}] Processing deferred popstate event`),P(e)}}async function P(e){if(h)return console.warn(`[${f}] Transition in progress, deferring popstate event`),void(p=e);try{const t=r.getState(),s=function(e,t,r,n){return c(e.state)?t.makeState(e.state.name,e.state.params,e.state.path,{...e.state.meta,params:e.state.meta?.params??{},options:e.state.meta?.options??{}},e.state.meta?.id):t.matchPath(r.getLocation(n))}(e,a,n,o),i=!c(e.state);if(!s&&function(e,t,r){const n=t.getOptions(),{defaultRoute:a}=n;return!!a&&(e.navigateToDefault({...r,reload:!0,replace:!0}),!0)}(r,a,u))return;if(function(e,t,r){return!e||!(!t||!r.areStatesEqual(e,t,!1))}(s,t,r))return;if(!s)return;h=!0;try{m(void 0,await a.navigateToState(s,t,u),t,i,r,n,o)}catch(e){m(e,void 0,t,i,r,n,o)}finally{h=!1,$()}}catch(e){h=!1,console.error(`[${f}] Critical error in onPopState`,e);try{const e=r.getState();if(e){const t=r.buildUrl(e.name,e.params);n.replaceState(e,"",t)}}catch(e){console.error(`[${f}] Failed to recover from critical error`,e)}$()}}return r.start=e=>s(e??n.getLocation(o)),r.buildUrl=(e,t)=>{const n=r.buildPath(e,t);return y()+w+n},r.matchUrl=e=>{const t=(e=>{try{const t=new URL(e,globalThis.location.origin),r=t.pathname,n=t.hash,a=t.search,s=y();if(!["http:","https:"].includes(t.protocol))return console.warn(`[${f}] Invalid URL protocol in ${e}`),null;if(o.useHash)return(T?n.replace(T,""):n.slice(1))+a;if(s){const e=d(s),t=i(`^${e}`),n=r.replace(t,"");return(n.startsWith("/")?"":"/")+n+a}return r+a}catch(t){return console.warn(`[${f}] Could not parse url ${e}`,t),null}})(e);return t?a.matchPath(t):void 0},r.replaceHistoryState=(e,t={})=>{const s=a.buildState(e,t);if(!s)throw new Error(`[real-router] Cannot replace state: route "${e}" is not found`);b(a.makeState(s.name,s.params,r.buildPath(s.name,s.params),{params:s.meta,options:{}},1),r.buildUrl(e,t),!0,n,o)},Object.defineProperty(r,"lastKnownState",{get:()=>l,set(e){l=e?Object.freeze({...e}):void 0},enumerable:!0,configurable:!0}),{onStart:()=>{g&&g(),g=n.addPopstateListener(e=>{P(e)},o)},onStop:()=>{g&&(g(),g=void 0)},onTransitionSuccess:(e,t,a)=>{r.lastKnownState=e;const s=(a.replace??!t)||!!a.reload&&r.areStatesEqual(e,t,!1),i=r.buildUrl(e.name,e.params);b(e,!o.preserveHash||t&&t.path!==e.path?i:i+n.getHash(),s,n,o)},teardown:()=>{g&&(g(),g=void 0),r.start=s,delete r.buildUrl,delete r.matchUrl,delete r.replaceHistoryState,delete r.lastKnownState}}}},exports.isHistoryState=u,exports.isState=c;//# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"../type-guards/dist/esm/index.mjs":{"bytes":3561,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":1668,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":7620,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/browser.ts":{"bytes":6860,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/plugin.ts":{"bytes":15544,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/browser.ts","kind":"import-statement","original":"./browser"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1442,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":43312},"dist/cjs/index.js":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["browserPluginFactory","isHistoryState","isState"],"entryPoint":"src/index.ts","inputs":{"src/plugin.ts":{"bytesInOutput":8257},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3328},"src/index.ts":{"bytesInOutput":0}},"bytes":18698}}}
1
+ {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"../type-guards/dist/esm/index.mjs":{"bytes":3618,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":1668,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":7620,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/browser.ts":{"bytes":6860,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/plugin.ts":{"bytes":15544,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/browser.ts","kind":"import-statement","original":"./browser"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1442,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":43312},"dist/cjs/index.js":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["browserPluginFactory","isHistoryState","isState"],"entryPoint":"src/index.ts","inputs":{"src/plugin.ts":{"bytesInOutput":8257},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3328},"src/index.ts":{"bytesInOutput":0}},"bytes":18698}}}
@@ -259,7 +259,6 @@ interface StateMeta<P extends Params = Params> {
259
259
  * @see {@link State.meta} for where options are stored after navigation
260
260
  */
261
261
  interface NavigationOptions {
262
- [key: string]: string | number | boolean | Record<string, unknown> | undefined;
263
262
  /**
264
263
  * Replace the current history entry instead of pushing a new one.
265
264
  *
@@ -395,6 +394,17 @@ interface NavigationOptions {
395
394
  * @see {@link NavigationOptions.redirected} for the input mechanism
396
395
  */
397
396
  redirected?: boolean | undefined;
397
+ /**
398
+ * Optional abort signal for cancelling the navigation.
399
+ *
400
+ * @description
401
+ * When provided, this signal can be used to cancel the navigation operation.
402
+ * If the signal is aborted, the navigation will be cancelled and any pending
403
+ * guards or transitions will be interrupted.
404
+ *
405
+ * @default undefined
406
+ */
407
+ signal?: AbortSignal | undefined;
398
408
  }
399
409
  interface Params {
400
410
  [key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
@@ -1 +1 @@
1
- {"inputs":{"../type-guards/dist/esm/index.mjs":{"bytes":3561,"imports":[],"format":"esm"},"src/constants.ts":{"bytes":1668,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":7620,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"src/browser.ts":{"bytes":6860,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/plugin.ts":{"bytes":15544,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/browser.ts","kind":"import-statement","original":"./browser"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/index.ts":{"bytes":1442,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"}],"format":"esm"}},"outputs":{"dist/esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43312},"dist/esm/index.mjs":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["browserPluginFactory","isHistoryState","isState"],"entryPoint":"src/index.ts","inputs":{"src/plugin.ts":{"bytesInOutput":8257},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3328},"src/index.ts":{"bytesInOutput":0}},"bytes":18698}}}
1
+ {"inputs":{"../type-guards/dist/esm/index.mjs":{"bytes":3618,"imports":[],"format":"esm"},"src/constants.ts":{"bytes":1668,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":7620,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"}],"format":"esm"},"src/browser.ts":{"bytes":6860,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/plugin.ts":{"bytes":15544,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/browser.ts","kind":"import-statement","original":"./browser"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/index.ts":{"bytes":1442,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"}],"format":"esm"}},"outputs":{"dist/esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43312},"dist/esm/index.mjs":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["browserPluginFactory","isHistoryState","isState"],"entryPoint":"src/index.ts","inputs":{"src/plugin.ts":{"bytesInOutput":8257},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3328},"src/index.ts":{"bytesInOutput":0}},"bytes":18698}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/browser-plugin",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "type": "commonjs",
5
5
  "description": "Browser integration plugin with History API, hash routing, and popstate support",
6
6
  "main": "./dist/cjs/index.js",
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "sideEffects": false,
47
47
  "dependencies": {
48
- "@real-router/core": "^0.26.0",
48
+ "@real-router/core": "^0.28.0",
49
49
  "@real-router/logger": "^0.2.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@testing-library/jest-dom": "6.9.1",
53
53
  "jsdom": "27.4.0",
54
- "type-guards": "^0.2.3"
54
+ "type-guards": "^0.2.5"
55
55
  },
56
56
  "scripts": {
57
57
  "test": "vitest",