@route-forge/core 1.4.0 → 2.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/README.md +10 -6
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.ts +1 -1
- package/dist/index.cjs +618 -508
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -50
- package/dist/index.d.ts +61 -50
- package/dist/index.js +618 -508
- package/dist/index.js.map +1 -1
- package/dist/route-forge.global.js +618 -508
- package/dist/route-forge.global.js.map +1 -1
- package/dist/route-forge.global.min.js +2 -2
- package/dist/{types-BFlrOTrN.d.cts → types-C51rXaiY.d.cts} +6 -17
- package/dist/{types-BFlrOTrN.d.ts → types-C51rXaiY.d.ts} +6 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,18 +196,22 @@ unsub()
|
|
|
196
196
|
| Level load | 拉取某层级路由元数据 | `forge.isLoaded(level)` |
|
|
197
197
|
| API request | 业务接口请求 | `forge.isLoading()` |
|
|
198
198
|
|
|
199
|
-
### `
|
|
199
|
+
### `ready()` 后挂载应用
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
推荐在 `ready()` resolve 后挂载应用(auto-discovery + eager 层级全部完成),
|
|
202
|
+
失败走 `catch`(onSummaryReady 回调已移除,统一走 ready——完整成功/失败语义链):
|
|
202
203
|
|
|
203
204
|
```ts
|
|
204
205
|
const forge = createRouteForge({
|
|
205
206
|
endpoint: '/_forge/routes',
|
|
206
|
-
onSummaryReady: () => {
|
|
207
|
-
// 摘要端点完成,路由数据已可用
|
|
208
|
-
app.mount('#app')
|
|
209
|
-
},
|
|
210
207
|
})
|
|
208
|
+
// 成功:摘要 + eager 完成后挂载;失败:接住 reject,避免静默白屏
|
|
209
|
+
forge.ready()
|
|
210
|
+
.then(() => app.mount('#app'))
|
|
211
|
+
.catch((err) => {
|
|
212
|
+
console.error('[route-forge] init failed', err)
|
|
213
|
+
// 按业务需要降级:渲染错误页 / 重试 / 上报
|
|
214
|
+
})
|
|
211
215
|
```
|
|
212
216
|
|
|
213
217
|
### `forge.ready()` 方法
|
package/dist/codegen.d.cts
CHANGED
package/dist/codegen.d.ts
CHANGED