@route-forge/core 2.2.0 → 2.2.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/README.md +1 -1
- package/README_zh.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/route-forge.global.js +1 -1
- package/dist/route-forge.global.js.map +1 -1
- package/dist/route-forge.global.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ Summary discovery reads from one source in this cascade: **embedded `window.__RO
|
|
|
116
116
|
|
|
117
117
|
For Laravel/Blade server-rendered first pages, the backend `@forgeSummary` directive inlines the summary as a one-shot, non-enumerable `window.__ROUTE_FORGE__` accessor that self-deletes on first read. When core finds it, it **skips the summary HTTP round-trip and completes discovery synchronously** — `route()` / `ready()` work immediately after `createRouteForge()` returns, eliminating the "routes not ready" first-paint flash. Level route tables are still lazy-loaded per level over HTTP (protected routes never enter the public HTML). A module-level memo lets a second instance (React StrictMode / a second provider) reuse the summary after the global is gone.
|
|
118
118
|
|
|
119
|
-
If no embed exists (standalone SPA, Vite dev), core falls back to the network summary automatically. `createRouteForge({ summary })` is the explicit, test/SSR-friendly entry.
|
|
119
|
+
If no embed exists (standalone SPA, Vite dev), core falls back to the network summary automatically. `createRouteForge({ summary })` is the explicit, test/SSR-friendly entry. When the summary comes entirely from the embed, the `options` argument itself may be omitted — call `createRouteForge()` bare.
|
|
120
120
|
|
|
121
121
|
> Honest scope: the one-shot self-delete only shrinks the summary's runtime footprint on `window`; the data is still present in the HTML source. This is a latency/flash optimization, **not** an XSS- or network-egavesdropping-proof boundary.
|
|
122
122
|
|
package/README_zh.md
CHANGED
|
@@ -117,7 +117,7 @@ await forge.ready()
|
|
|
117
117
|
|
|
118
118
|
对 Laravel/Blade 服务端直出的首页,后端 `@forgeSummary` 指令把摘要内联为一个一次性、不可枚举、读后自删的 `window.__ROUTE_FORGE__` 访问器。core 命中它时**跳过摘要 HTTP 往返、同步完成 discovery**——`createRouteForge()` 返回后 `route()` / `ready()` 立即可用,消除首屏"路由未就绪"闪烁。层级路由表**仍按 level 走 HTTP 懒加载**(受保护路由不进公开 HTML)。core 的 module 级 memo 让第二个实例(React StrictMode / 第二个 Provider)在全局自删后仍能复用摘要。
|
|
119
119
|
|
|
120
|
-
若页面无内嵌(SPA 独立部署 / Vite dev),core 自动回落网络摘要。`createRouteForge({ summary })` 是显式、便于测试/SSR
|
|
120
|
+
若页面无内嵌(SPA 独立部署 / Vite dev),core 自动回落网络摘要。`createRouteForge({ summary })` 是显式、便于测试/SSR 的入口。当摘要完全来自内嵌时,`options` 参数本身也可省略——直接 `createRouteForge()` 无参调用。
|
|
121
121
|
|
|
122
122
|
> 诚实边界:一次性自删只缩小摘要在 `window` 上的运行时驻留面,数据仍随 HTML 源码可见;这是延迟/闪烁优化,**不是**抗 XSS 或抗网络窃取的硬边界。
|
|
123
123
|
|
package/dist/index.cjs
CHANGED
|
@@ -1091,7 +1091,7 @@ function createBoundForgeFactory(deps) {
|
|
|
1091
1091
|
// src/forge.ts
|
|
1092
1092
|
var DEFAULT_TIMEOUT = 3e4;
|
|
1093
1093
|
var DEFAULT_CACHE_TTL = 3600;
|
|
1094
|
-
function createRouteForge(options) {
|
|
1094
|
+
function createRouteForge(options = {}) {
|
|
1095
1095
|
const bootstrapSummary = readEmbeddedSummary() ?? options.summary ?? null;
|
|
1096
1096
|
if (!bootstrapSummary && !options.endpoint) {
|
|
1097
1097
|
throw new TypeError(
|