@liteforge/router 0.1.0
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/LICENSE +21 -0
- package/README.md +296 -0
- package/dist/components.d.ts +75 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +475 -0
- package/dist/components.js.map +1 -0
- package/dist/guards.d.ts +103 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +268 -0
- package/dist/guards.js.map +1 -0
- package/dist/history.d.ts +33 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +315 -0
- package/dist/history.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/lazy.d.ts +197 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +458 -0
- package/dist/lazy.js.map +1 -0
- package/dist/middleware.d.ts +69 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +215 -0
- package/dist/middleware.js.map +1 -0
- package/dist/route-matcher.d.ts +80 -0
- package/dist/route-matcher.d.ts.map +1 -0
- package/dist/route-matcher.js +482 -0
- package/dist/route-matcher.js.map +1 -0
- package/dist/router.d.ts +26 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +393 -0
- package/dist/router.js.map +1 -0
- package/dist/types.d.ts +459 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +62 -0
package/dist/router.js
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { signal, batch, emitNavigationStart, emitNavigationEnd, } from '@liteforge/core';
|
|
2
|
+
import { compileRoutes, matchRoutes, findRouteByName, createLocation, } from './route-matcher.js';
|
|
3
|
+
import { createMemoryHistory } from './history.js';
|
|
4
|
+
import { GuardRegistry, runGuards, collectRouteGuards, normalizeGuardResult } from './guards.js';
|
|
5
|
+
import { runMiddleware } from './middleware.js';
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Router Creation
|
|
8
|
+
// =============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* Create a router instance
|
|
11
|
+
*/
|
|
12
|
+
export function createRouter(options) {
|
|
13
|
+
const { routes: routeDefinitions, middleware = [], guards = [], history = createMemoryHistory(),
|
|
14
|
+
// base = '', // Reserved for future use
|
|
15
|
+
onError, lazyDefaults, } = options;
|
|
16
|
+
// Initialize guard registry
|
|
17
|
+
const guardRegistry = new GuardRegistry();
|
|
18
|
+
guardRegistry.registerAll(guards);
|
|
19
|
+
// Compile routes with guard registry and lazy defaults
|
|
20
|
+
const compiledRoutes = compileRoutes(routeDefinitions, guardRegistry.getMap(), lazyDefaults);
|
|
21
|
+
// Context accessor - will be set when router is attached to app
|
|
22
|
+
let contextAccessor = () => {
|
|
23
|
+
throw new Error('Router not attached to an app context');
|
|
24
|
+
};
|
|
25
|
+
// Reactive state signals
|
|
26
|
+
const pathSignal = signal(history.location.path);
|
|
27
|
+
const paramsSignal = signal({});
|
|
28
|
+
const querySignal = signal(history.location.query);
|
|
29
|
+
const hashSignal = signal(history.location.hash);
|
|
30
|
+
const matchedSignal = signal([]);
|
|
31
|
+
const locationSignal = signal(history.location);
|
|
32
|
+
const isNavigatingSignal = signal(false);
|
|
33
|
+
const preloadedDataSignal = signal(null);
|
|
34
|
+
// Navigation hooks
|
|
35
|
+
const beforeEachCallbacks = new Set();
|
|
36
|
+
const afterEachCallbacks = new Set();
|
|
37
|
+
// Track current location for from reference
|
|
38
|
+
let currentLocation = null;
|
|
39
|
+
// Navigation lock to prevent concurrent navigations
|
|
40
|
+
let navigationLock = false;
|
|
41
|
+
let pendingNavigation = null;
|
|
42
|
+
/**
|
|
43
|
+
* Update reactive state from location
|
|
44
|
+
*/
|
|
45
|
+
function updateState(location, matched, preloadedData = null) {
|
|
46
|
+
batch(() => {
|
|
47
|
+
pathSignal.set(location.path);
|
|
48
|
+
querySignal.set(location.query);
|
|
49
|
+
hashSignal.set(location.hash);
|
|
50
|
+
locationSignal.set(location);
|
|
51
|
+
matchedSignal.set(matched);
|
|
52
|
+
preloadedDataSignal.set(preloadedData);
|
|
53
|
+
// Extract params from all matched routes
|
|
54
|
+
const combinedParams = {};
|
|
55
|
+
for (const m of matched) {
|
|
56
|
+
Object.assign(combinedParams, m.params);
|
|
57
|
+
}
|
|
58
|
+
paramsSignal.set(combinedParams);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Attempt a single navigation step (may result in redirect)
|
|
63
|
+
*/
|
|
64
|
+
async function attemptNavigation(target, state) {
|
|
65
|
+
// Create target location
|
|
66
|
+
const targetLocation = createLocation(target, state);
|
|
67
|
+
// Match routes
|
|
68
|
+
const matched = matchRoutes(targetLocation.path, compiledRoutes);
|
|
69
|
+
if (!matched || matched.length === 0) {
|
|
70
|
+
// No route matched - update location anyway for 404 handling
|
|
71
|
+
return { type: 'success', preloadedData: null };
|
|
72
|
+
}
|
|
73
|
+
// Get the deepest matched route
|
|
74
|
+
const leafMatch = matched[matched.length - 1];
|
|
75
|
+
// Check for redirect
|
|
76
|
+
if (leafMatch.route.redirect) {
|
|
77
|
+
return { type: 'redirect', target: leafMatch.route.redirect };
|
|
78
|
+
}
|
|
79
|
+
// Build middleware context
|
|
80
|
+
const middlewareContext = {
|
|
81
|
+
to: targetLocation,
|
|
82
|
+
from: currentLocation,
|
|
83
|
+
params: leafMatch.params,
|
|
84
|
+
matched,
|
|
85
|
+
use: contextAccessor,
|
|
86
|
+
};
|
|
87
|
+
// Run beforeEach hooks (treated as guards)
|
|
88
|
+
for (const callback of beforeEachCallbacks) {
|
|
89
|
+
const result = await callback(middlewareContext);
|
|
90
|
+
const normalized = normalizeGuardResult(result);
|
|
91
|
+
if (!normalized.allowed) {
|
|
92
|
+
if (normalized.redirect) {
|
|
93
|
+
return { type: 'redirect', target: normalized.redirect };
|
|
94
|
+
}
|
|
95
|
+
return { type: 'blocked' };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Run global middleware
|
|
99
|
+
const middlewareResult = await runMiddleware(middleware, middlewareContext);
|
|
100
|
+
if (!middlewareResult.completed) {
|
|
101
|
+
if (middlewareResult.redirect) {
|
|
102
|
+
return { type: 'redirect', target: middlewareResult.redirect };
|
|
103
|
+
}
|
|
104
|
+
return { type: 'blocked' };
|
|
105
|
+
}
|
|
106
|
+
// Collect and run route guards (pass registry for dynamic guard resolution)
|
|
107
|
+
const routeGuards = collectRouteGuards(leafMatch.route, guardRegistry);
|
|
108
|
+
if (routeGuards.length > 0) {
|
|
109
|
+
const guardContext = {
|
|
110
|
+
to: targetLocation,
|
|
111
|
+
from: currentLocation,
|
|
112
|
+
params: leafMatch.params,
|
|
113
|
+
route: leafMatch.route,
|
|
114
|
+
use: contextAccessor,
|
|
115
|
+
};
|
|
116
|
+
const guardResult = await runGuards(routeGuards, guardContext);
|
|
117
|
+
if (!guardResult.allowed) {
|
|
118
|
+
if (guardResult.redirect) {
|
|
119
|
+
return { type: 'redirect', target: guardResult.redirect };
|
|
120
|
+
}
|
|
121
|
+
return { type: 'blocked' };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Run preload if defined
|
|
125
|
+
let preloadedData = null;
|
|
126
|
+
if (leafMatch.route.preload) {
|
|
127
|
+
try {
|
|
128
|
+
preloadedData = await leafMatch.route.preload({
|
|
129
|
+
to: targetLocation,
|
|
130
|
+
params: leafMatch.params,
|
|
131
|
+
use: contextAccessor,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return { type: 'error', error: error instanceof Error ? error : new Error(String(error)) };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { type: 'success', preloadedData };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Core navigation logic
|
|
142
|
+
*/
|
|
143
|
+
async function performNavigation(target, options = {}) {
|
|
144
|
+
const { replace = false, state } = options;
|
|
145
|
+
// Prevent concurrent navigations
|
|
146
|
+
if (navigationLock) {
|
|
147
|
+
pendingNavigation = target;
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
navigationLock = true;
|
|
151
|
+
isNavigatingSignal.set(true);
|
|
152
|
+
// Capture from path for debug events
|
|
153
|
+
const fromPath = currentLocation?.path ?? '';
|
|
154
|
+
// Compute toPath from target (string or object)
|
|
155
|
+
// Extract path without query string and hash
|
|
156
|
+
const toPath = typeof target === 'string'
|
|
157
|
+
? (target.split('?')[0]?.split('#')[0] ?? '/')
|
|
158
|
+
: target.path;
|
|
159
|
+
// Emit navigation start (zero cost if debug not enabled)
|
|
160
|
+
const navStartTime = performance.now();
|
|
161
|
+
emitNavigationStart(fromPath, toPath);
|
|
162
|
+
// Note: Individual guard results are emitted by executeGuard in guards.ts
|
|
163
|
+
// The NavigationEnd event receives an empty array since guards emit separately
|
|
164
|
+
const guardResults = [];
|
|
165
|
+
try {
|
|
166
|
+
let currentTarget = target;
|
|
167
|
+
let currentState = state;
|
|
168
|
+
let redirectCount = 0;
|
|
169
|
+
const maxRedirects = 10;
|
|
170
|
+
// Follow redirects until we reach a final destination
|
|
171
|
+
while (redirectCount < maxRedirects) {
|
|
172
|
+
const result = await attemptNavigation(currentTarget, currentState);
|
|
173
|
+
if (result.type === 'redirect') {
|
|
174
|
+
currentTarget = result.target;
|
|
175
|
+
currentState = undefined; // Clear state on redirect
|
|
176
|
+
redirectCount++;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (result.type === 'blocked') {
|
|
180
|
+
// Emit navigation end with blocked status
|
|
181
|
+
const duration = performance.now() - navStartTime;
|
|
182
|
+
emitNavigationEnd(fromPath, toPath, duration, guardResults);
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
if (result.type === 'error') {
|
|
186
|
+
// Emit navigation end with error status
|
|
187
|
+
const duration = performance.now() - navStartTime;
|
|
188
|
+
emitNavigationEnd(fromPath, toPath, duration, guardResults);
|
|
189
|
+
if (onError) {
|
|
190
|
+
onError(result.error);
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
// Success - finalize navigation
|
|
195
|
+
const finalTargetLocation = createLocation(currentTarget, currentState);
|
|
196
|
+
const matched = matchRoutes(finalTargetLocation.path, compiledRoutes) ?? [];
|
|
197
|
+
// Update history (use replace for redirects or if explicitly requested)
|
|
198
|
+
if (replace || redirectCount > 0) {
|
|
199
|
+
history.replace(currentTarget);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
history.push(currentTarget);
|
|
203
|
+
}
|
|
204
|
+
// Update reactive state
|
|
205
|
+
const previousLocation = currentLocation;
|
|
206
|
+
currentLocation = finalTargetLocation;
|
|
207
|
+
updateState(finalTargetLocation, matched, result.preloadedData);
|
|
208
|
+
// Run afterEach hooks
|
|
209
|
+
for (const callback of afterEachCallbacks) {
|
|
210
|
+
try {
|
|
211
|
+
callback({ to: finalTargetLocation, from: previousLocation });
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
console.error('afterEach hook error:', error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Emit navigation end with success
|
|
218
|
+
const duration = performance.now() - navStartTime;
|
|
219
|
+
emitNavigationEnd(fromPath, finalTargetLocation.path, duration, guardResults);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
// Too many redirects
|
|
223
|
+
const duration = performance.now() - navStartTime;
|
|
224
|
+
emitNavigationEnd(fromPath, toPath, duration, guardResults);
|
|
225
|
+
if (onError) {
|
|
226
|
+
onError(new Error(`Too many redirects (max ${maxRedirects})`));
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
// Emit navigation end with error
|
|
232
|
+
const duration = performance.now() - navStartTime;
|
|
233
|
+
emitNavigationEnd(fromPath, toPath, duration, guardResults);
|
|
234
|
+
if (onError) {
|
|
235
|
+
onError(error instanceof Error ? error : new Error(String(error)));
|
|
236
|
+
}
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
navigationLock = false;
|
|
241
|
+
isNavigatingSignal.set(false);
|
|
242
|
+
// Process pending navigation if any
|
|
243
|
+
if (pendingNavigation) {
|
|
244
|
+
const pending = pendingNavigation;
|
|
245
|
+
pendingNavigation = null;
|
|
246
|
+
// Use setTimeout to avoid stack overflow
|
|
247
|
+
setTimeout(() => navigate(pending), 0);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Navigate to a path or location
|
|
253
|
+
*/
|
|
254
|
+
async function navigate(target, options = {}) {
|
|
255
|
+
return performNavigation(target, options);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Listen to history changes (back/forward)
|
|
259
|
+
*/
|
|
260
|
+
const unlistenHistory = history.listen((location, action) => {
|
|
261
|
+
if (action === 'pop') {
|
|
262
|
+
// User pressed back/forward - sync state
|
|
263
|
+
const matched = matchRoutes(location.path, compiledRoutes);
|
|
264
|
+
currentLocation = location;
|
|
265
|
+
updateState(location, matched ?? []);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
// Initialize with current location
|
|
269
|
+
const initialMatched = matchRoutes(history.location.path, compiledRoutes);
|
|
270
|
+
currentLocation = history.location;
|
|
271
|
+
updateState(history.location, initialMatched ?? []);
|
|
272
|
+
// Router instance
|
|
273
|
+
const router = {
|
|
274
|
+
// Reactive signals (read-only access)
|
|
275
|
+
get path() {
|
|
276
|
+
return pathSignal;
|
|
277
|
+
},
|
|
278
|
+
get params() {
|
|
279
|
+
return paramsSignal;
|
|
280
|
+
},
|
|
281
|
+
get query() {
|
|
282
|
+
return querySignal;
|
|
283
|
+
},
|
|
284
|
+
get hash() {
|
|
285
|
+
return hashSignal;
|
|
286
|
+
},
|
|
287
|
+
get matched() {
|
|
288
|
+
return matchedSignal;
|
|
289
|
+
},
|
|
290
|
+
get location() {
|
|
291
|
+
return locationSignal;
|
|
292
|
+
},
|
|
293
|
+
get isNavigating() {
|
|
294
|
+
return isNavigatingSignal;
|
|
295
|
+
},
|
|
296
|
+
get preloadedData() {
|
|
297
|
+
return preloadedDataSignal;
|
|
298
|
+
},
|
|
299
|
+
// Navigation methods
|
|
300
|
+
navigate,
|
|
301
|
+
replace(target, options = {}) {
|
|
302
|
+
return navigate(target, { ...options, replace: true });
|
|
303
|
+
},
|
|
304
|
+
back() {
|
|
305
|
+
history.back();
|
|
306
|
+
},
|
|
307
|
+
forward() {
|
|
308
|
+
history.forward();
|
|
309
|
+
},
|
|
310
|
+
go(delta) {
|
|
311
|
+
history.go(delta);
|
|
312
|
+
},
|
|
313
|
+
// Guard management
|
|
314
|
+
registerGuard(guard) {
|
|
315
|
+
guardRegistry.register(guard);
|
|
316
|
+
},
|
|
317
|
+
unregisterGuard(name) {
|
|
318
|
+
guardRegistry.unregister(name);
|
|
319
|
+
},
|
|
320
|
+
// Navigation hooks
|
|
321
|
+
beforeEach(callback) {
|
|
322
|
+
beforeEachCallbacks.add(callback);
|
|
323
|
+
return () => {
|
|
324
|
+
beforeEachCallbacks.delete(callback);
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
afterEach(callback) {
|
|
328
|
+
afterEachCallbacks.add(callback);
|
|
329
|
+
return () => {
|
|
330
|
+
afterEachCallbacks.delete(callback);
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
// Route utilities
|
|
334
|
+
getRoute(name) {
|
|
335
|
+
return findRouteByName(name, compiledRoutes);
|
|
336
|
+
},
|
|
337
|
+
resolve(target) {
|
|
338
|
+
const location = createLocation(target);
|
|
339
|
+
const matched = matchRoutes(location.path, compiledRoutes);
|
|
340
|
+
const route = matched?.[matched.length - 1]?.route;
|
|
341
|
+
const params = matched?.[matched.length - 1]?.params ?? {};
|
|
342
|
+
return {
|
|
343
|
+
href: history.createHref(target),
|
|
344
|
+
route,
|
|
345
|
+
params,
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
// Cleanup
|
|
349
|
+
destroy() {
|
|
350
|
+
unlistenHistory();
|
|
351
|
+
history.destroy();
|
|
352
|
+
beforeEachCallbacks.clear();
|
|
353
|
+
afterEachCallbacks.clear();
|
|
354
|
+
guardRegistry.clear();
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
// Attach method to set context accessor (called by createApp)
|
|
358
|
+
router._setContextAccessor = (accessor) => {
|
|
359
|
+
contextAccessor = accessor;
|
|
360
|
+
};
|
|
361
|
+
// Expose compiled routes for RouterOutlet
|
|
362
|
+
router._compiledRoutes = compiledRoutes;
|
|
363
|
+
// Expose history for testing
|
|
364
|
+
router._history = history;
|
|
365
|
+
return router;
|
|
366
|
+
}
|
|
367
|
+
// =============================================================================
|
|
368
|
+
// Router Context
|
|
369
|
+
// =============================================================================
|
|
370
|
+
// Global router reference for components
|
|
371
|
+
let activeRouter = null;
|
|
372
|
+
/**
|
|
373
|
+
* Set the active router (called by createApp)
|
|
374
|
+
*/
|
|
375
|
+
export function setActiveRouter(router) {
|
|
376
|
+
activeRouter = router;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get the active router
|
|
380
|
+
*/
|
|
381
|
+
export function getActiveRouter() {
|
|
382
|
+
if (!activeRouter) {
|
|
383
|
+
throw new Error('No active router. Make sure to create a router and attach it to the app.');
|
|
384
|
+
}
|
|
385
|
+
return activeRouter;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Get the active router or null
|
|
389
|
+
*/
|
|
390
|
+
export function getActiveRouterOrNull() {
|
|
391
|
+
return activeRouter;
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,iBAAiB,CAA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