@real-router/browser-plugin 0.5.1 → 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.
@@ -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" | "middleware";
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 middleware, guards, and event listeners.
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 or middleware execute
290
+ * - No lifecycle hooks execute
291
291
  * - No events are fired
292
292
  *
293
293
  * With `reload`:
294
- * - Full transition executes (deactivate → activate → middleware)
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 and middleware still execute normally. This allows
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) → middleware → success
351
+ * deactivate(fromSegments) → activate(toSegments) → success
352
352
  *
353
353
  * // With forceDeactivate: true
354
- * [skip deactivate] → activate(toSegments) → middleware → success
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
- * middleware or lifecycle hooks. This flag is used internally to track redirect chains
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) {
@@ -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" | "middleware";
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 middleware, guards, and event listeners.
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 or middleware execute
290
+ * - No lifecycle hooks execute
291
291
  * - No events are fired
292
292
  *
293
293
  * With `reload`:
294
- * - Full transition executes (deactivate → activate → middleware)
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 and middleware still execute normally. This allows
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) → middleware → success
351
+ * deactivate(fromSegments) → activate(toSegments) → success
352
352
  *
353
353
  * // With forceDeactivate: true
354
- * [skip deactivate] → activate(toSegments) → middleware → success
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
- * middleware or lifecycle hooks. This flag is used internally to track redirect chains
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/browser-plugin",
3
- "version": "0.5.1",
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.24.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.27",
55
- "@real-router/persistent-params-plugin": "^0.1.27",
56
- "type-guards": "^0.2.1"
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",