@iyulab/router 0.11.0 → 0.11.1
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/CHANGELOG.md +19 -0
- package/dist/index.js +10 -6
- package/dist/react.js +1 -1
- package/dist/share-Dl02vMhW.js +1142 -0
- package/package.json +3 -2
- package/dist/share-BaGC5VOl.js +0 -245
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.11.1] - 2026-08-20
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Route matching threw `ReferenceError: URLPattern is not defined` on browsers that ship
|
|
8
|
+
without the URL Pattern API.** The router constructs routes with the global `URLPattern`
|
|
9
|
+
constructor directly; browsers that have not yet shipped it (older Safari and Firefox
|
|
10
|
+
releases are still common in the field) failed synchronously in `new Router(...)`, before
|
|
11
|
+
any route could render. A guarded polyfill (`urlpattern-polyfill`, self-installs only when
|
|
12
|
+
`globalThis.URLPattern` is absent) is now imported by the router's internals, so browsers
|
|
13
|
+
without native support get a working fallback and browsers with native support are
|
|
14
|
+
unaffected at runtime.
|
|
15
|
+
|
|
16
|
+
### Internal
|
|
17
|
+
|
|
18
|
+
- Router's own `URLPattern` construction now runs through a small local type shim — the
|
|
19
|
+
polyfill package's bundled types have not yet caught up to the constructor's `options`
|
|
20
|
+
argument (`ignoreCase`), even though its runtime implementation already supports it.
|
|
21
|
+
|
|
3
22
|
## [0.11.0] - 2026-08-07
|
|
4
23
|
|
|
5
24
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isExternalUrl, i as absolutePath, n as __decorate, o as parseUrl, r as __decorateMetadata, s as UOutlet, t as ULink } from "./share-
|
|
1
|
+
import { a as isExternalUrl, i as absolutePath, n as __decorate, o as parseUrl, r as __decorateMetadata, s as UOutlet, t as ULink } from "./share-Dl02vMhW.js";
|
|
2
2
|
import { LitElement, css, html } from "lit";
|
|
3
3
|
import { customElement, property } from "lit/decorators.js";
|
|
4
4
|
//#region src/types/RouteError.ts
|
|
@@ -289,6 +289,12 @@ function findAnchorFrom(event) {
|
|
|
289
289
|
//#endregion
|
|
290
290
|
//#region src/internals/route-helpers.ts
|
|
291
291
|
/**
|
|
292
|
+
* `urlpattern-polyfill`의 번들 타입 선언이 `options` 인자를 아직 반영하지 않는다(런타임
|
|
293
|
+
* 구현은 WHATWG 스펙대로 `ignoreCase`를 지원한다 — `dist/index.js`의 3항 생성자 실측
|
|
294
|
+
* 확인됨). 그 타입 공백만 좁혀서 캐스트한다.
|
|
295
|
+
*/
|
|
296
|
+
var createURLPattern = URLPattern;
|
|
297
|
+
/**
|
|
292
298
|
* 라우트들을 다음 사항에 따라 재귀적으로 재설정합니다.
|
|
293
299
|
* - 각 라우트에 고유 `id`를 랜덤하게 부여합니다.
|
|
294
300
|
* - `path`를 URLPattern 객체로 변환합니다.
|
|
@@ -303,13 +309,11 @@ function setRoutes(routes, basepath) {
|
|
|
303
309
|
route.id ||= getRandomID();
|
|
304
310
|
route.ignoreCase ||= false;
|
|
305
311
|
if (route.index === true) {
|
|
306
|
-
route.path = new
|
|
312
|
+
route.path = new createURLPattern({ pathname: `${basepath}{/}?` }, { ignoreCase: route.ignoreCase });
|
|
307
313
|
route.force ||= true;
|
|
308
314
|
} else {
|
|
309
|
-
if (typeof route.path === "string") {
|
|
310
|
-
|
|
311
|
-
route.path = new URLPattern({ pathname: `${absolutePathStr}{/}?` }, { ignoreCase: route.ignoreCase });
|
|
312
|
-
} else if (route.path instanceof URLPattern) {} else route.path = new URLPattern({ pathname: `${basepath}{/}?` }, { ignoreCase: route.ignoreCase });
|
|
315
|
+
if (typeof route.path === "string") route.path = new createURLPattern({ pathname: `${absolutePath(basepath, route.path)}{/}?` }, { ignoreCase: route.ignoreCase });
|
|
316
|
+
else if (route.path instanceof URLPattern) {} else route.path = new createURLPattern({ pathname: `${basepath}{/}?` }, { ignoreCase: route.ignoreCase });
|
|
313
317
|
if (route.children && route.children.length > 0) {
|
|
314
318
|
const childBasepath = route.path.pathname.replace("{/}?", "");
|
|
315
319
|
route.children = setRoutes(route.children, childBasepath);
|
package/dist/react.js
CHANGED