@real-router/browser-plugin 0.5.0 → 0.5.2
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 +8 -17
- package/dist/cjs/metafile-cjs.json +1 -1
- package/dist/esm/index.d.mts +8 -17
- package/dist/esm/metafile-esm.json +1 -1
- package/package.json +5 -5
package/dist/cjs/index.d.ts
CHANGED
|
@@ -218,7 +218,7 @@ type HistoryState = State$1 & Record<string, unknown>;
|
|
|
218
218
|
*/
|
|
219
219
|
declare function browserPluginFactory(opts?: Partial<BrowserPluginOptions>, browser?: Browser): PluginFactory;
|
|
220
220
|
|
|
221
|
-
type TransitionPhase = "deactivating" | "activating"
|
|
221
|
+
type TransitionPhase = "deactivating" | "activating";
|
|
222
222
|
type TransitionReason = "success" | "blocked" | "cancelled" | "error";
|
|
223
223
|
interface TransitionMeta {
|
|
224
224
|
phase: TransitionPhase;
|
|
@@ -253,7 +253,7 @@ interface StateMeta<P extends Params = Params> {
|
|
|
253
253
|
*
|
|
254
254
|
* All options are optional and have sensible defaults. Options can be combined to achieve
|
|
255
255
|
* complex navigation behaviors. The options object is stored in state.meta.options and is
|
|
256
|
-
* available to
|
|
256
|
+
* available to guards and event listeners.
|
|
257
257
|
*
|
|
258
258
|
* @see {@link Router.navigate} for navigation method that accepts these options
|
|
259
259
|
* @see {@link State.meta} for where options are stored after navigation
|
|
@@ -287,11 +287,11 @@ interface NavigationOptions {
|
|
|
287
287
|
*
|
|
288
288
|
* Without `reload`:
|
|
289
289
|
* - Navigation to current route throws SAME_STATES error
|
|
290
|
-
* - No lifecycle hooks
|
|
290
|
+
* - No lifecycle hooks execute
|
|
291
291
|
* - No events are fired
|
|
292
292
|
*
|
|
293
293
|
* With `reload`:
|
|
294
|
-
* - Full transition executes (deactivate → activate
|
|
294
|
+
* - Full transition executes (deactivate → activate)
|
|
295
295
|
* - All lifecycle hooks run again
|
|
296
296
|
* - TRANSITION_SUCCESS event fires with same state
|
|
297
297
|
* - State object is recreated (new reference)
|
|
@@ -342,16 +342,16 @@ interface NavigationOptions {
|
|
|
342
342
|
*
|
|
343
343
|
* @description
|
|
344
344
|
* When `true`, bypasses only the canDeactivate lifecycle hooks for segments being
|
|
345
|
-
* deactivated. canActivate guards
|
|
345
|
+
* deactivated. canActivate guards still execute normally. This allows
|
|
346
346
|
* forcing navigation away from routes with confirmation dialogs or unsaved changes.
|
|
347
347
|
*
|
|
348
348
|
* Skipped vs executed:
|
|
349
349
|
* ```
|
|
350
350
|
* // Normal transition
|
|
351
|
-
* deactivate(fromSegments) → activate(toSegments) →
|
|
351
|
+
* deactivate(fromSegments) → activate(toSegments) → success
|
|
352
352
|
*
|
|
353
353
|
* // With forceDeactivate: true
|
|
354
|
-
* [skip deactivate] → activate(toSegments) →
|
|
354
|
+
* [skip deactivate] → activate(toSegments) → success
|
|
355
355
|
* ```
|
|
356
356
|
*
|
|
357
357
|
* ⚠️ Data loss risk: Bypassing canDeactivate means unsaved changes will be lost
|
|
@@ -377,21 +377,12 @@ interface NavigationOptions {
|
|
|
377
377
|
*
|
|
378
378
|
* @description
|
|
379
379
|
* Automatically set by the router when a navigation is triggered by a redirect from
|
|
380
|
-
*
|
|
380
|
+
* guards or lifecycle hooks. This flag is used internally to track redirect chains
|
|
381
381
|
* and is stored in state.meta.options.redirected.
|
|
382
382
|
*
|
|
383
383
|
* @default false (auto-set by router during redirects)
|
|
384
384
|
*
|
|
385
385
|
* @example
|
|
386
|
-
* // Middleware triggers automatic redirect
|
|
387
|
-
* router.useMiddleware((toState, fromState, opts) => {
|
|
388
|
-
* if (!isAuthenticated && toState.name !== 'login') {
|
|
389
|
-
* // Router will automatically set redirected: true
|
|
390
|
-
* return { name: 'login', params: { next: toState.path } };
|
|
391
|
-
* }
|
|
392
|
-
* });
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
386
|
* // Accessing redirect flag in lifecycle
|
|
396
387
|
* router.addActivateGuard('dashboard', (toState, fromState) => {
|
|
397
388
|
* if (toState.meta?.options?.redirected) {
|
|
@@ -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":
|
|
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":7562,"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":15342,"imports":[{"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":42971},"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/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3335},"src/plugin.ts":{"bytesInOutput":8146},"src/index.ts":{"bytesInOutput":0}},"bytes":18576}}}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -218,7 +218,7 @@ type HistoryState = State$1 & Record<string, unknown>;
|
|
|
218
218
|
*/
|
|
219
219
|
declare function browserPluginFactory(opts?: Partial<BrowserPluginOptions>, browser?: Browser): PluginFactory;
|
|
220
220
|
|
|
221
|
-
type TransitionPhase = "deactivating" | "activating"
|
|
221
|
+
type TransitionPhase = "deactivating" | "activating";
|
|
222
222
|
type TransitionReason = "success" | "blocked" | "cancelled" | "error";
|
|
223
223
|
interface TransitionMeta {
|
|
224
224
|
phase: TransitionPhase;
|
|
@@ -253,7 +253,7 @@ interface StateMeta<P extends Params = Params> {
|
|
|
253
253
|
*
|
|
254
254
|
* All options are optional and have sensible defaults. Options can be combined to achieve
|
|
255
255
|
* complex navigation behaviors. The options object is stored in state.meta.options and is
|
|
256
|
-
* available to
|
|
256
|
+
* available to guards and event listeners.
|
|
257
257
|
*
|
|
258
258
|
* @see {@link Router.navigate} for navigation method that accepts these options
|
|
259
259
|
* @see {@link State.meta} for where options are stored after navigation
|
|
@@ -287,11 +287,11 @@ interface NavigationOptions {
|
|
|
287
287
|
*
|
|
288
288
|
* Without `reload`:
|
|
289
289
|
* - Navigation to current route throws SAME_STATES error
|
|
290
|
-
* - No lifecycle hooks
|
|
290
|
+
* - No lifecycle hooks execute
|
|
291
291
|
* - No events are fired
|
|
292
292
|
*
|
|
293
293
|
* With `reload`:
|
|
294
|
-
* - Full transition executes (deactivate → activate
|
|
294
|
+
* - Full transition executes (deactivate → activate)
|
|
295
295
|
* - All lifecycle hooks run again
|
|
296
296
|
* - TRANSITION_SUCCESS event fires with same state
|
|
297
297
|
* - State object is recreated (new reference)
|
|
@@ -342,16 +342,16 @@ interface NavigationOptions {
|
|
|
342
342
|
*
|
|
343
343
|
* @description
|
|
344
344
|
* When `true`, bypasses only the canDeactivate lifecycle hooks for segments being
|
|
345
|
-
* deactivated. canActivate guards
|
|
345
|
+
* deactivated. canActivate guards still execute normally. This allows
|
|
346
346
|
* forcing navigation away from routes with confirmation dialogs or unsaved changes.
|
|
347
347
|
*
|
|
348
348
|
* Skipped vs executed:
|
|
349
349
|
* ```
|
|
350
350
|
* // Normal transition
|
|
351
|
-
* deactivate(fromSegments) → activate(toSegments) →
|
|
351
|
+
* deactivate(fromSegments) → activate(toSegments) → success
|
|
352
352
|
*
|
|
353
353
|
* // With forceDeactivate: true
|
|
354
|
-
* [skip deactivate] → activate(toSegments) →
|
|
354
|
+
* [skip deactivate] → activate(toSegments) → success
|
|
355
355
|
* ```
|
|
356
356
|
*
|
|
357
357
|
* ⚠️ Data loss risk: Bypassing canDeactivate means unsaved changes will be lost
|
|
@@ -377,21 +377,12 @@ interface NavigationOptions {
|
|
|
377
377
|
*
|
|
378
378
|
* @description
|
|
379
379
|
* Automatically set by the router when a navigation is triggered by a redirect from
|
|
380
|
-
*
|
|
380
|
+
* guards or lifecycle hooks. This flag is used internally to track redirect chains
|
|
381
381
|
* and is stored in state.meta.options.redirected.
|
|
382
382
|
*
|
|
383
383
|
* @default false (auto-set by router during redirects)
|
|
384
384
|
*
|
|
385
385
|
* @example
|
|
386
|
-
* // Middleware triggers automatic redirect
|
|
387
|
-
* router.useMiddleware((toState, fromState, opts) => {
|
|
388
|
-
* if (!isAuthenticated && toState.name !== 'login') {
|
|
389
|
-
* // Router will automatically set redirected: true
|
|
390
|
-
* return { name: 'login', params: { next: toState.path } };
|
|
391
|
-
* }
|
|
392
|
-
* });
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
386
|
* // Accessing redirect flag in lifecycle
|
|
396
387
|
* router.addActivateGuard('dashboard', (toState, fromState) => {
|
|
397
388
|
* if (toState.meta?.options?.redirected) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"../type-guards/dist/esm/index.mjs":{"bytes":
|
|
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":7562,"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":15342,"imports":[{"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":42971},"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/dist/esm/index.mjs":{"bytesInOutput":2444},"src/browser.ts":{"bytesInOutput":4028},"src/constants.ts":{"bytesInOutput":205},"src/utils.ts":{"bytesInOutput":3335},"src/plugin.ts":{"bytesInOutput":8146},"src/index.ts":{"bytesInOutput":0}},"bytes":18576}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/browser-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
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,15 +45,15 @@
|
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@real-router/core": "^0.
|
|
48
|
+
"@real-router/core": "^0.25.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
|
-
"@real-router/logger-plugin": "^0.2.
|
|
55
|
-
"@real-router/persistent-params-plugin": "^0.1.
|
|
56
|
-
"type-guards": "^0.
|
|
54
|
+
"@real-router/logger-plugin": "^0.2.28",
|
|
55
|
+
"@real-router/persistent-params-plugin": "^0.1.28",
|
|
56
|
+
"type-guards": "^0.2.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "vitest",
|