@iyulab/router 0.10.2 → 0.10.4

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.4] - 2026-08-01
4
+
5
+ ### Documentation
6
+
7
+ - 체인지로그에서 **발견 정황 서술과 내부 참조를 제거**했다. 결함이 무엇이고 어떤 조건에서
8
+ 재현되는지는 그대로다. 코드 변경은 없다 — 게시본 문서를 정리하기 위한 패치 릴리스다.
9
+
10
+ ## [0.10.3] - 2026-07-24
11
+
12
+ ### Fixed
13
+ - **root 안에 `<u-outlet>` 이 없을 때 초기화 실패가 삼켜지던 문제 수정** (React + Vite 소비 앱의 E2E 실측). `waitOutlet` 은 타임아웃 시 서술적 오류로 reject 하지만, `Router` 생성자가 `void waitOutlet(...).then(...)` 로 거부를 처리하지 않아 폴링 타임아웃(최대 10초) 뒤 unhandled rejection 으로만 새어 나갔다 — 소비자에겐 원인 없는 빈 화면이었다. 이제 `.catch()` 로 `console.error('Router initialization failed:', …)` 에 명시적으로 표면화한다.
14
+
15
+ ### Documentation
16
+ - README에 "React + Vite" 섹션 추가 — 아웃렛의 `react-dom/client` 동적 import 가 Vite dev 사전번들(`optimizeDeps`)에서 깨지는 CJS interop 을 `optimizeDeps.exclude: ['@iyulab/router']` + `include: ['react-dom/client']` 로 해소하는 소비 설정 명시(초안 #2).
17
+ - Quick Start 에 root 의 `<u-outlet>` 요구 + 부재 시 로그 메시지 명시.
18
+
3
19
  ## [0.10.2] - 2026-07-15
4
20
 
5
21
  ### Changed
@@ -14,7 +30,7 @@
14
30
  ## [0.10.0] - 2026-06-11
15
31
 
16
32
  ### Changed
17
- - Click interception now checks route matching before `preventDefault()`: same-origin anchors that do not match any registered route are passed through to native browser navigation instead of rendering the fallback (soft-404). This fixes apps with `basepath: '/'` greedily intercepting every same-origin link — e.g. cross-app links on a shared host (ISSUE-1781049600-router-basepath-root-greedy-intercept)
33
+ - Click interception now checks route matching before `preventDefault()`: same-origin anchors that do not match any registered route are passed through to native browser navigation instead of rendering the fallback (soft-404). This fixes apps with `basepath: '/'` greedily intercepting every same-origin link — e.g. cross-app links on a shared host
18
34
 
19
35
  ### Added
20
36
  - Vitest-based test infrastructure (`npm test`) with coverage for anchor click interception behavior
package/README.md CHANGED
@@ -29,6 +29,35 @@ const router = new Router({
29
29
  router.go('/users/1');
30
30
  ```
31
31
 
32
+ > The router renders matched output into a `<u-outlet>` inside `root`. Make sure one exists:
33
+ >
34
+ > ```html
35
+ > <div id="app"><u-outlet></u-outlet></div>
36
+ > ```
37
+ >
38
+ > If `root` contains no `<u-outlet>`, the router logs
39
+ > `Router initialization failed: Timed out waiting for <u-outlet>` and renders nothing.
40
+
41
+ ## React + Vite
42
+
43
+ The outlet renders React content by dynamically importing `react-dom/client` when a route
44
+ returns a React element. Under Vite's dev pre-bundling (`optimizeDeps`), this CommonJS
45
+ interop can break — `TypeError: createRoot is not a function` by default, or
46
+ `ReferenceError: module is not defined` if only the router is excluded. Pre-bundle
47
+ `react-dom/client` while leaving the router itself unbundled:
48
+
49
+ ```ts
50
+ // vite.config.ts
51
+ import { defineConfig } from 'vite';
52
+
53
+ export default defineConfig({
54
+ optimizeDeps: {
55
+ exclude: ['@iyulab/router'],
56
+ include: ['react-dom/client'],
57
+ },
58
+ });
59
+ ```
60
+
32
61
  ## Skills Usage
33
62
 
34
63
  Install the `iyulab-router` skill for agent-friendly package guidance.
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-BUgoWpfZ.js";
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-CZzCH0Yf.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
@@ -120,8 +120,9 @@ var UErrorPage = class UErrorPage extends LitElement {
120
120
  }
121
121
  render() {
122
122
  const error = this.error || this.getDefaultError();
123
+ const icon = this.getErrorIcon(error.code);
123
124
  return html`
124
- <div class="icon">${this.getErrorIcon(error.code)}</div>
125
+ <div class="icon">${icon}</div>
125
126
  <div class="code">${error.code}</div>
126
127
  <div class="message">${error.message}</div>
127
128
  `;
@@ -419,6 +420,8 @@ var Router = class {
419
420
  if (config.useIntercept !== false) this._rootElement.addEventListener("click", this.handleRootElementClick);
420
421
  if (config.initialLoad !== false) waitOutlet(this._rootElement).then(() => {
421
422
  this.go(window.location.href);
423
+ }).catch((error) => {
424
+ console.error("Router initialization failed:", error instanceof Error ? error.message : error);
422
425
  });
423
426
  }
424
427
  /** 객체를 정리하고 이벤트 리스너를 제거합니다. */
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s as UOutlet$1, t as ULink$1 } from "./share-BUgoWpfZ.js";
1
+ import { s as UOutlet$1, t as ULink$1 } from "./share-CZzCH0Yf.js";
2
2
  import React from "react";
3
3
  import { createComponent } from "@lit/react";
4
4
  //#region src/react.ts
@@ -126,12 +126,12 @@ function catchBasepath(basepath) {
126
126
  return basepath;
127
127
  }
128
128
  //#endregion
129
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorateMetadata.js
129
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorateMetadata.js
130
130
  function __decorateMetadata(k, v) {
131
131
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
132
132
  }
133
133
  //#endregion
134
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
134
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
135
135
  function __decorate(decorators, target, key, desc) {
136
136
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
137
137
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/router",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "A modern client-side router for web applications with support for Lit and React components",
5
5
  "keywords": [
6
6
  "lit",