@real-router/browser-plugin 0.1.14 → 0.1.16
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.
- package/dist/cjs/index.d.ts +1 -46
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/metafile-cjs.json +1 -1
- package/dist/esm/index.d.mts +1 -46
- package/dist/esm/metafile-esm.json +1 -1
- package/package.json +3 -3
package/dist/cjs/index.d.ts
CHANGED
|
@@ -300,55 +300,12 @@ interface NavigationOptions {
|
|
|
300
300
|
* @see {@link Router.areStatesEqual} for state comparison logic
|
|
301
301
|
*/
|
|
302
302
|
reload?: boolean | undefined;
|
|
303
|
-
/**
|
|
304
|
-
* Preview navigation without any side effects (dry-run mode).
|
|
305
|
-
*
|
|
306
|
-
* @description
|
|
307
|
-
* When `true`, returns the would-be target state via callback WITHOUT:
|
|
308
|
-
* - Executing canDeactivate/canActivate guards
|
|
309
|
-
* - Executing middleware
|
|
310
|
-
* - Updating router state (`router.getState()` remains unchanged)
|
|
311
|
-
* - Emitting any transition events (TRANSITION_START, TRANSITION_SUCCESS, etc.)
|
|
312
|
-
*
|
|
313
|
-
* The callback receives `(undefined, toState)` where `toState` is the computed
|
|
314
|
-
* target state that WOULD result from this navigation.
|
|
315
|
-
*
|
|
316
|
-
* @default false
|
|
317
|
-
*
|
|
318
|
-
* @remarks
|
|
319
|
-
* This option is useful for:
|
|
320
|
-
* - Validating that a route exists and params are correct
|
|
321
|
-
* - SSR: previewing state for pre-rendering without side effects
|
|
322
|
-
* - Dry-run before actual navigation
|
|
323
|
-
*
|
|
324
|
-
* @deprecated Consider using `router.buildState()` + `router.makeState()` instead
|
|
325
|
-
* for clearer intent. This option may be removed in a future major version.
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* // Preview navigation - router.getState() is NOT changed
|
|
329
|
-
* router.navigate('users.view', { id: 123 }, { skipTransition: true }, (err, previewState) => {
|
|
330
|
-
* console.log(previewState); // { name: 'users.view', params: { id: 123 }, path: '/users/view/123', ... }
|
|
331
|
-
* console.log(router.getState()); // Still the previous state!
|
|
332
|
-
* });
|
|
333
|
-
*
|
|
334
|
-
* @example
|
|
335
|
-
* // Recommended alternative (clearer intent)
|
|
336
|
-
* const route = router.buildState('users.view', { id: 123 });
|
|
337
|
-
* if (route) {
|
|
338
|
-
* const path = router.buildPath(route.name, route.params);
|
|
339
|
-
* const previewState = router.makeState(route.name, route.params, path, { params: route.meta });
|
|
340
|
-
* }
|
|
341
|
-
*
|
|
342
|
-
* @see {@link forceDeactivate} for skipping only canDeactivate guards
|
|
343
|
-
* @see {@link force} for forcing navigation while preserving lifecycle
|
|
344
|
-
*/
|
|
345
|
-
skipTransition?: boolean | undefined;
|
|
346
303
|
/**
|
|
347
304
|
* Force navigation even if target state equals current state.
|
|
348
305
|
*
|
|
349
306
|
* @description
|
|
350
307
|
* When `true`, bypasses the "same state" equality check but still executes the full
|
|
351
|
-
* transition lifecycle
|
|
308
|
+
* transition lifecycle. Similar to `reload` but can be used
|
|
352
309
|
* for any forced navigation scenario.
|
|
353
310
|
*
|
|
354
311
|
* Difference from `reload`:
|
|
@@ -367,7 +324,6 @@ interface NavigationOptions {
|
|
|
367
324
|
* router.navigate('analytics', { event: 'pageview' }, { force: true });
|
|
368
325
|
*
|
|
369
326
|
* @see {@link reload} for semantic equivalent (preferred for refresh scenarios)
|
|
370
|
-
* @see {@link skipTransition} for bypassing entire lifecycle
|
|
371
327
|
*/
|
|
372
328
|
force?: boolean | undefined;
|
|
373
329
|
/**
|
|
@@ -400,7 +356,6 @@ interface NavigationOptions {
|
|
|
400
356
|
* });
|
|
401
357
|
* }
|
|
402
358
|
*
|
|
403
|
-
* @see {@link skipTransition} for bypassing all guards and middleware
|
|
404
359
|
* @see {@link Router.clearCanDeactivate} for programmatically clearing guards
|
|
405
360
|
*/
|
|
406
361
|
forceDeactivate?: boolean | undefined;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=require("@real-router/logger"),t=require("@real-router/core"),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||"redirected"in t&&"boolean"!=typeof t.redirected||"source"in t&&"string"!=typeof t.source)}function c(e){return"string"==typeof(t=e.name)&&(""===t||!(t.length>1e4)&&(!!t.startsWith("@@")||r.test(t)))&&"string"==typeof e.path&&o(e.params);var t}function l(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!c(t)&&(void 0===t.meta||i(t.meta))}function u(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!c(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=()=>{},d=new Map,b=e=>{const t=d.get(e);if(void 0!==t)return t;const r=e.replaceAll(/[$()*+.?[\\\]^{|}-]/g,String.raw`\$&`);return d.set(e,r),r};function m(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 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)},H=(e,t,r)=>{globalThis.history.replaceState(e,t??"",r)},P=(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}})(),L=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=b(r),o=b(n),s=t?globalThis.location.hash.replace(j(`^#${a}`),""):globalThis.location.pathname.replace(j(`^${o}`),"");return(O(s)||"/")+globalThis.location.search},O=t=>{try{return encodeURI(decodeURI(t))}catch(r){return e.logger.warn(f,`Could not encode path "${t}"`,r),t}},x=()=>{if(globalThis.history.state){if(u(globalThis.history.state))return globalThis.history.state;e.logger.warn(f,"History state is not a valid state object, ignoring",globalThis.history.state)}},A=()=>globalThis.location.hash;exports.browserPluginFactory=function(r,n=function(){return void 0!==globalThis.window&&globalThis.history?{getBase:w,pushState:$,replaceState:H,addPopstateListener:P,getLocation:L,getState:x,getHash:A}:function(){let t=!1;const r=r=>{t||(e.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.`),t=!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},c=o.forceDeactivate,u=void 0===c?{source:p,replace:!0}:{forceDeactivate:c,source:p,replace:!0};let d;return function(e){const r=e.start;let a,s=!1,c=null;const h=()=>o.base??"",y=o.hashPrefix??"",v=b(y),S=o.useHash?`#${y}`:"",w=v?i(`^#${v}`):null;function T(){if(c){const e=c;c=null,console.warn(`[${f}] Processing deferred popstate event`),$(e)}}function $(r){if(s)return console.warn(`[${f}] Transition in progress, deferring popstate event`),void(c=r);try{const a=e.getState(),i=function(e,t,r,n,a){return l(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??{},redirected:!!e.state.meta?.redirected,source:a},e.state.meta?.id):t.matchPath(r.getLocation(n),a)}(r,e,n,o,p),c=!l(r.state);if(!i&&function(e,t){const r=e.getOptions(),{defaultRoute:n}=r;return!!n&&(e.navigateToDefault({...t,reload:!0,replace:!0}),!0)}(e,u))return;if(function(e,t,r){return!e||!(!t||!r.areStatesEqual(e,t,!1))}(i,a,e))return;s=!0,e.navigateToState(i,a,u,(r,i)=>{s=!1,function(e,r,n,a,o,s,i){e&&e.code===t.errorCodes.CANNOT_DEACTIVATE&&r&&n&&!a&&m(n,o.buildUrl(n.name,n.params),!0,s,i)}(r,i,a,c,e,n,o),T()},!0)}catch(t){s=!1,console.error(`[${f}] Critical error in onPopState`,t);try{const t=e.getState();if(t){const r=e.buildUrl(t.name,t.params);n.replaceState(t,"",r)}}catch(e){console.error(`[${f}] Failed to recover from critical error`,e)}T()}}return e.start=(...t)=>{const[a,s]=function(e,t,r){if(0===e.length){const e=t.getLocation(r);return"/"===e?[void 0,g]:[e,g]}if(1===e.length)return"function"==typeof e[0]?[t.getLocation(r),e[0]]:[e[0],g];const[n,a]=e;return[n,a]}(t,n,o);return a?r(a,s):r(s),e},e.buildUrl=(t,r)=>{const n=e.buildPath(t,r);return h()+S+n},e.matchUrl=t=>{const r=(e=>{try{const t=new URL(e,globalThis.location.origin),r=t.pathname,n=t.hash,a=t.search,s=h();if(!["http:","https:"].includes(t.protocol))return console.warn(`[${f}] Invalid URL protocol in ${e}`),null;if(o.useHash)return(w?n.replace(w,""):n.slice(1))+a;if(s){const e=b(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}})(t);return r?e.matchPath(r,p):void 0},e.replaceHistoryState=(t,r={})=>{const a=e.buildState(t,r);if(!a)throw new Error(`[real-router] Cannot replace state: route "${t}" is not found`);m(e.makeState(a.name,a.params,e.buildPath(a.name,a.params),{params:a.meta,options:{},redirected:!1},1),e.buildUrl(t,r),!0,n,o)},Object.defineProperty(e,"lastKnownState",{get:()=>a,set(e){a=e?Object.freeze({...e}):void 0},enumerable:!0,configurable:!0}),{onStart:()=>{d&&d(),d=n.addPopstateListener($,o)},onStop:()=>{d&&(d(),d=void 0)},onTransitionSuccess:(t,r,a)=>{e.lastKnownState=t;const s=(a.replace??!r)||!!a.reload&&e.areStatesEqual(t,r,!1),i=e.buildUrl(t.name,t.params);m(t,!o.preserveHash||r&&r.path!==t.path?i:i+n.getHash(),s,n,o)},teardown:()=>{d&&(d(),d=void 0),e.start=r,delete e.buildUrl,delete e.matchUrl,delete e.replaceHistoryState,delete e.lastKnownState}}}},exports.isHistoryState=u,exports.isState=l;//# 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/src/guards/navigation.ts":{"bytes":
|
|
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/src/guards/navigation.ts":{"bytes":1304,"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"},"../type-guards/src/internal/router-error.ts":{"bytes":1468,"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"},"../type-guards/src/guards/routes.ts":{"bytes":2060,"imports":[{"path":"../type-guards/src/internal/router-error.ts","kind":"import-statement","original":"../internal/router-error"},{"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"},"../type-guards/src/guards/params.ts":{"bytes":7499,"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"},"../type-guards/src/internal/meta-fields.ts":{"bytes":1765,"imports":[{"path":"../type-guards/src/guards/params.ts","kind":"import-statement","original":"../guards/params"},{"path":"../type-guards/src/guards/routes.ts","kind":"import-statement","original":"../guards/routes"},{"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"},"../type-guards/src/guards/state.ts":{"bytes":2697,"imports":[{"path":"../type-guards/src/internal/meta-fields.ts","kind":"import-statement","original":"../internal/meta-fields"},{"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"},"../type-guards/src/guards/primitives.ts":{"bytes":1632,"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"},"../type-guards/src/guards/index.ts":{"bytes":486,"imports":[{"path":"../type-guards/src/guards/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"../type-guards/src/guards/routes.ts","kind":"import-statement","original":"./routes"},{"path":"../type-guards/src/guards/state.ts","kind":"import-statement","original":"./state"},{"path":"../type-guards/src/guards/primitives.ts","kind":"import-statement","original":"./primitives"},{"path":"../type-guards/src/guards/params.ts","kind":"import-statement","original":"./params"},{"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"},"../type-guards/src/validators/routes.ts":{"bytes":3141,"imports":[{"path":"../type-guards/src/internal/router-error.ts","kind":"import-statement","original":"../internal/router-error"},{"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"},"../type-guards/src/utilities/type-description.ts":{"bytes":1232,"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"},"../type-guards/src/validators/state.ts":{"bytes":1063,"imports":[{"path":"../type-guards/src/guards/index.ts","kind":"import-statement","original":"../guards"},{"path":"../type-guards/src/utilities/type-description.ts","kind":"import-statement","original":"../utilities/type-description"},{"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"},"../type-guards/src/validators/index.ts":{"bytes":197,"imports":[{"path":"../type-guards/src/validators/routes.ts","kind":"import-statement","original":"./routes"},{"path":"../type-guards/src/validators/state.ts","kind":"import-statement","original":"./state"},{"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"},"../type-guards/src/index.ts":{"bytes":1416,"imports":[{"path":"../type-guards/src/guards/index.ts","kind":"import-statement","original":"./guards"},{"path":"../type-guards/src/validators/index.ts","kind":"import-statement","original":"./validators"},{"path":"../type-guards/src/utilities/type-description.ts","kind":"import-statement","original":"./utilities/type-description"},{"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":8622,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/src/index.ts","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/src/index.ts","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":15508,"imports":[{"path":"../type-guards/src/index.ts","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":1277,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/src/index.ts","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":64460},"dist/cjs/index.js":{"imports":[{"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":{"../type-guards/src/internal/router-error.ts":{"bytesInOutput":101},"../type-guards/src/guards/routes.ts":{"bytesInOutput":288},"../type-guards/src/guards/params.ts":{"bytesInOutput":2778},"../type-guards/src/internal/meta-fields.ts":{"bytesInOutput":635},"../type-guards/src/guards/state.ts":{"bytesInOutput":502},"../type-guards/src/guards/index.ts":{"bytesInOutput":0},"../type-guards/src/index.ts":{"bytesInOutput":0},"src/browser.ts":{"bytesInOutput":4041},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3917},"src/plugin.ts":{"bytesInOutput":8322},"src/index.ts":{"bytesInOutput":0}},"bytes":21464}}}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -300,55 +300,12 @@ interface NavigationOptions {
|
|
|
300
300
|
* @see {@link Router.areStatesEqual} for state comparison logic
|
|
301
301
|
*/
|
|
302
302
|
reload?: boolean | undefined;
|
|
303
|
-
/**
|
|
304
|
-
* Preview navigation without any side effects (dry-run mode).
|
|
305
|
-
*
|
|
306
|
-
* @description
|
|
307
|
-
* When `true`, returns the would-be target state via callback WITHOUT:
|
|
308
|
-
* - Executing canDeactivate/canActivate guards
|
|
309
|
-
* - Executing middleware
|
|
310
|
-
* - Updating router state (`router.getState()` remains unchanged)
|
|
311
|
-
* - Emitting any transition events (TRANSITION_START, TRANSITION_SUCCESS, etc.)
|
|
312
|
-
*
|
|
313
|
-
* The callback receives `(undefined, toState)` where `toState` is the computed
|
|
314
|
-
* target state that WOULD result from this navigation.
|
|
315
|
-
*
|
|
316
|
-
* @default false
|
|
317
|
-
*
|
|
318
|
-
* @remarks
|
|
319
|
-
* This option is useful for:
|
|
320
|
-
* - Validating that a route exists and params are correct
|
|
321
|
-
* - SSR: previewing state for pre-rendering without side effects
|
|
322
|
-
* - Dry-run before actual navigation
|
|
323
|
-
*
|
|
324
|
-
* @deprecated Consider using `router.buildState()` + `router.makeState()` instead
|
|
325
|
-
* for clearer intent. This option may be removed in a future major version.
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* // Preview navigation - router.getState() is NOT changed
|
|
329
|
-
* router.navigate('users.view', { id: 123 }, { skipTransition: true }, (err, previewState) => {
|
|
330
|
-
* console.log(previewState); // { name: 'users.view', params: { id: 123 }, path: '/users/view/123', ... }
|
|
331
|
-
* console.log(router.getState()); // Still the previous state!
|
|
332
|
-
* });
|
|
333
|
-
*
|
|
334
|
-
* @example
|
|
335
|
-
* // Recommended alternative (clearer intent)
|
|
336
|
-
* const route = router.buildState('users.view', { id: 123 });
|
|
337
|
-
* if (route) {
|
|
338
|
-
* const path = router.buildPath(route.name, route.params);
|
|
339
|
-
* const previewState = router.makeState(route.name, route.params, path, { params: route.meta });
|
|
340
|
-
* }
|
|
341
|
-
*
|
|
342
|
-
* @see {@link forceDeactivate} for skipping only canDeactivate guards
|
|
343
|
-
* @see {@link force} for forcing navigation while preserving lifecycle
|
|
344
|
-
*/
|
|
345
|
-
skipTransition?: boolean | undefined;
|
|
346
303
|
/**
|
|
347
304
|
* Force navigation even if target state equals current state.
|
|
348
305
|
*
|
|
349
306
|
* @description
|
|
350
307
|
* When `true`, bypasses the "same state" equality check but still executes the full
|
|
351
|
-
* transition lifecycle
|
|
308
|
+
* transition lifecycle. Similar to `reload` but can be used
|
|
352
309
|
* for any forced navigation scenario.
|
|
353
310
|
*
|
|
354
311
|
* Difference from `reload`:
|
|
@@ -367,7 +324,6 @@ interface NavigationOptions {
|
|
|
367
324
|
* router.navigate('analytics', { event: 'pageview' }, { force: true });
|
|
368
325
|
*
|
|
369
326
|
* @see {@link reload} for semantic equivalent (preferred for refresh scenarios)
|
|
370
|
-
* @see {@link skipTransition} for bypassing entire lifecycle
|
|
371
327
|
*/
|
|
372
328
|
force?: boolean | undefined;
|
|
373
329
|
/**
|
|
@@ -400,7 +356,6 @@ interface NavigationOptions {
|
|
|
400
356
|
* });
|
|
401
357
|
* }
|
|
402
358
|
*
|
|
403
|
-
* @see {@link skipTransition} for bypassing all guards and middleware
|
|
404
359
|
* @see {@link Router.clearCanDeactivate} for programmatically clearing guards
|
|
405
360
|
*/
|
|
406
361
|
forceDeactivate?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"../type-guards/src/guards/navigation.ts":{"bytes":
|
|
1
|
+
{"inputs":{"../type-guards/src/guards/navigation.ts":{"bytes":1304,"imports":[],"format":"esm"},"../type-guards/src/internal/router-error.ts":{"bytes":1468,"imports":[],"format":"esm"},"../type-guards/src/guards/routes.ts":{"bytes":2060,"imports":[{"path":"../type-guards/src/internal/router-error.ts","kind":"import-statement","original":"../internal/router-error"}],"format":"esm"},"../type-guards/src/guards/params.ts":{"bytes":7499,"imports":[],"format":"esm"},"../type-guards/src/internal/meta-fields.ts":{"bytes":1765,"imports":[{"path":"../type-guards/src/guards/params.ts","kind":"import-statement","original":"../guards/params"},{"path":"../type-guards/src/guards/routes.ts","kind":"import-statement","original":"../guards/routes"}],"format":"esm"},"../type-guards/src/guards/state.ts":{"bytes":2697,"imports":[{"path":"../type-guards/src/internal/meta-fields.ts","kind":"import-statement","original":"../internal/meta-fields"}],"format":"esm"},"../type-guards/src/guards/primitives.ts":{"bytes":1632,"imports":[],"format":"esm"},"../type-guards/src/guards/index.ts":{"bytes":486,"imports":[{"path":"../type-guards/src/guards/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"../type-guards/src/guards/routes.ts","kind":"import-statement","original":"./routes"},{"path":"../type-guards/src/guards/state.ts","kind":"import-statement","original":"./state"},{"path":"../type-guards/src/guards/primitives.ts","kind":"import-statement","original":"./primitives"},{"path":"../type-guards/src/guards/params.ts","kind":"import-statement","original":"./params"}],"format":"esm"},"../type-guards/src/validators/routes.ts":{"bytes":3141,"imports":[{"path":"../type-guards/src/internal/router-error.ts","kind":"import-statement","original":"../internal/router-error"}],"format":"esm"},"../type-guards/src/utilities/type-description.ts":{"bytes":1232,"imports":[],"format":"esm"},"../type-guards/src/validators/state.ts":{"bytes":1063,"imports":[{"path":"../type-guards/src/guards/index.ts","kind":"import-statement","original":"../guards"},{"path":"../type-guards/src/utilities/type-description.ts","kind":"import-statement","original":"../utilities/type-description"}],"format":"esm"},"../type-guards/src/validators/index.ts":{"bytes":197,"imports":[{"path":"../type-guards/src/validators/routes.ts","kind":"import-statement","original":"./routes"},{"path":"../type-guards/src/validators/state.ts","kind":"import-statement","original":"./state"}],"format":"esm"},"../type-guards/src/index.ts":{"bytes":1416,"imports":[{"path":"../type-guards/src/guards/index.ts","kind":"import-statement","original":"./guards"},{"path":"../type-guards/src/validators/index.ts","kind":"import-statement","original":"./validators"},{"path":"../type-guards/src/utilities/type-description.ts","kind":"import-statement","original":"./utilities/type-description"}],"format":"esm"},"src/constants.ts":{"bytes":1668,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":8622,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../type-guards/src/index.ts","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/src/index.ts","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":15508,"imports":[{"path":"../type-guards/src/index.ts","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":1277,"imports":[{"path":"src/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"../type-guards/src/index.ts","kind":"import-statement","original":"type-guards"}],"format":"esm"}},"outputs":{"dist/esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":64460},"dist/esm/index.mjs":{"imports":[{"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":{"../type-guards/src/internal/router-error.ts":{"bytesInOutput":101},"../type-guards/src/guards/routes.ts":{"bytesInOutput":288},"../type-guards/src/guards/params.ts":{"bytesInOutput":2778},"../type-guards/src/internal/meta-fields.ts":{"bytesInOutput":635},"../type-guards/src/guards/state.ts":{"bytesInOutput":502},"../type-guards/src/guards/index.ts":{"bytesInOutput":0},"../type-guards/src/index.ts":{"bytesInOutput":0},"src/browser.ts":{"bytesInOutput":4041},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3917},"src/plugin.ts":{"bytesInOutput":8322},"src/index.ts":{"bytesInOutput":0}},"bytes":21464}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/browser-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
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",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@real-router/core": "^0.
|
|
46
|
+
"@real-router/core": "^0.13.0",
|
|
47
47
|
"@real-router/logger": "^0.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@testing-library/jest-dom": "6.9.1",
|
|
51
51
|
"jsdom": "27.4.0",
|
|
52
|
-
"type-guards": "^0.1.
|
|
52
|
+
"type-guards": "^0.1.7"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "vitest",
|