isr-engine 3.1.4 → 4.0.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 +3 -3
- package/dist/{abVariantContext-BtLsLN1J.js → abVariantContext-CGBlCt0q.js} +8 -15
- package/dist/abVariantContext-CGBlCt0q.js.map +1 -0
- package/dist/adapters/observability/index.js +4 -8
- package/dist/adapters/observability/index.js.map +1 -1
- package/dist/adapters/runtime/index.js +4 -8
- package/dist/adapters/runtime/index.js.map +1 -1
- package/dist/cli/cli.js +12 -14
- package/dist/cli/cli.js.map +1 -1
- package/dist/config/defineConfig.js +1 -2
- package/dist/{createCacheInspectorMiddleware-Cb_MZhLZ.js → createCacheInspectorMiddleware-C2QOaq2z.js} +2 -3
- package/dist/{createCacheInspectorMiddleware-Cb_MZhLZ.js.map → createCacheInspectorMiddleware-C2QOaq2z.js.map} +1 -1
- package/dist/{createISRApp-rD8EUB--.js → createISRApp-CR1EeHfI.js} +115 -171
- package/dist/createISRApp-CR1EeHfI.js.map +1 -0
- package/dist/defaults/auto-observability.js +1 -2
- package/dist/defaults/runtime/defineSiteHooks.js +2 -2
- package/dist/defaults/runtime/seo-runtime.d.ts +3 -3
- package/dist/defaults/runtime/seo-runtime.d.ts.map +1 -1
- package/dist/{defineSiteHooks-BWaDDJ4B.js → defineSiteHooks-DUEds_hB.js} +4 -6
- package/dist/{defineSiteHooks-BWaDDJ4B.js.map → defineSiteHooks-DUEds_hB.js.map} +1 -1
- package/dist/{error500-template-DhaZzLOB.js → error500-template-CFdKp8YG.js} +2 -3
- package/dist/{error500-template-DhaZzLOB.js.map → error500-template-CFdKp8YG.js.map} +1 -1
- package/dist/{i18n-BFCx28rB.js → i18n-CJ0leKhc.js} +4 -7
- package/dist/{i18n-BFCx28rB.js.map → i18n-CJ0leKhc.js.map} +1 -1
- package/dist/image/index.js +1 -2
- package/dist/image/index.js.map +1 -1
- package/dist/isr-engine.js +46 -57
- package/dist/isr-engine.js.map +1 -1
- package/dist/plugin/createDevCssHandoffPlugin.d.ts.map +1 -1
- package/dist/rsc/browser.js +1 -2
- package/dist/rsc/index.js +2 -2
- package/dist/{rsc-Da-Nc0OM.js → rsc-DWwcqD4W.js} +6 -10
- package/dist/rsc-DWwcqD4W.js.map +1 -0
- package/dist/runtime/LocaleContext.d.ts +1 -1
- package/dist/runtime/LocaleContext.d.ts.map +1 -1
- package/dist/runtime/boundary.d.ts +2 -2
- package/dist/runtime/boundary.d.ts.map +1 -1
- package/dist/server/middleware.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/defaults/runtime/defineClientEntry.tsx +2 -1
- package/src/defaults/runtime/defineServerEntry.tsx +12 -4
- package/src/defaults/runtime/seo-runtime.ts +22 -12
- package/dist/abVariantContext-BtLsLN1J.js.map +0 -1
- package/dist/createISRApp-rD8EUB--.js.map +0 -1
- package/dist/rsc-Da-Nc0OM.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDevCssHandoffPlugin.d.ts","sourceRoot":"","sources":["../../src/plugin/createDevCssHandoffPlugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,MAAM,EAIZ,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createDevCssHandoffPlugin.d.ts","sourceRoot":"","sources":["../../src/plugin/createDevCssHandoffPlugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,MAAM,EAIZ,MAAM,MAAM,CAAC;AAUd,eAAO,MAAM,gCAAgC,iDAAiD,CAAC;AAC/F,eAAO,MAAM,2BAA2B,yCAAyC,CAAC;AAClF,eAAO,MAAM,qBAAqB,0CAA0C,CAAC;AAC7E,eAAO,MAAM,8BAA8B,4CAA4C,CAAC;AAyBxF,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAOnE;AA6TD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAuFzF;AAmED,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CA0BzC;AAyRD,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,MAAM,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAuGzC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED,MAAM,WAAW,2BAA2B;IAC1C,0FAA0F;IAC1F,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,GAClB,2BAA2B,CAkI7B;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAG1E"}
|
package/dist/rsc/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/rsc/browser.ts
|
|
2
2
|
/**
|
|
3
3
|
* Browser stub for isr-engine/rsc.
|
|
4
4
|
*
|
|
@@ -79,7 +79,6 @@ function getCurrentI18n() {
|
|
|
79
79
|
function runWithI18n(_intl, fn) {
|
|
80
80
|
return fn();
|
|
81
81
|
}
|
|
82
|
-
//#endregion
|
|
83
82
|
export { LEGACY_SERVER_ACTION_ENDPOINT, RevalidationError, SERVER_ACTION_ENDPOINT, ServerActionUtils, cacheTag, collectTags, createServerAction, debugTagStore, getCurrentI18n, getI18n, getI18nLocale, getRequestContext, getServerActionEndpointCandidates, getVariant, isLegacyServerActionEndpoint, isUncacheable, markUncacheable, registerInvalidator, revalidatePath, revalidateTag, runWithI18n, runWithTagStore, serverActionsRegistry, shouldSkipServerActionEndpointRetry };
|
|
84
83
|
|
|
85
84
|
//# sourceMappingURL=browser.js.map
|
package/dist/rsc/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as getTraceId, S as getRequestId, a as isUncacheable, b as getExperiments, c as RevalidationError, d as revalidateTag, i as debugTagStore, l as registerInvalidator, n as cacheTag, o as markUncacheable, r as collectTags, s as runWithTagStore, t as getVariant, u as revalidatePath, w as getUserId, x as getRequestContext, y as getAnonId } from "../abVariantContext-
|
|
2
|
-
import { a as LEGACY_SERVER_ACTION_ENDPOINT, c as isLegacyServerActionEndpoint, d as createServerAction, f as serverActionsRegistry, i as getI18nLocale, l as shouldSkipServerActionEndpointRetry, n as runWithI18n, o as SERVER_ACTION_ENDPOINT, r as getI18n, s as getServerActionEndpointCandidates, t as getCurrentI18n, u as ServerActionUtils } from "../rsc-
|
|
1
|
+
import { C as getTraceId, S as getRequestId, a as isUncacheable, b as getExperiments, c as RevalidationError, d as revalidateTag, i as debugTagStore, l as registerInvalidator, n as cacheTag, o as markUncacheable, r as collectTags, s as runWithTagStore, t as getVariant, u as revalidatePath, w as getUserId, x as getRequestContext, y as getAnonId } from "../abVariantContext-CGBlCt0q.js";
|
|
2
|
+
import { a as LEGACY_SERVER_ACTION_ENDPOINT, c as isLegacyServerActionEndpoint, d as createServerAction, f as serverActionsRegistry, i as getI18nLocale, l as shouldSkipServerActionEndpointRetry, n as runWithI18n, o as SERVER_ACTION_ENDPOINT, r as getI18n, s as getServerActionEndpointCandidates, t as getCurrentI18n, u as ServerActionUtils } from "../rsc-DWwcqD4W.js";
|
|
3
3
|
export { LEGACY_SERVER_ACTION_ENDPOINT, RevalidationError, SERVER_ACTION_ENDPOINT, ServerActionUtils, cacheTag, collectTags, createServerAction, debugTagStore, getAnonId, getCurrentI18n, getExperiments, getI18n, getI18nLocale, getRequestContext, getRequestId, getServerActionEndpointCandidates, getTraceId, getUserId, getVariant, isLegacyServerActionEndpoint, isUncacheable, markUncacheable, registerInvalidator, revalidatePath, revalidateTag, runWithI18n, runWithTagStore, serverActionsRegistry, shouldSkipServerActionEndpointRetry };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as runtimeLogger, x as getRequestContext } from "./abVariantContext-
|
|
1
|
+
import { p as runtimeLogger, x as getRequestContext } from "./abVariantContext-CGBlCt0q.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
|
|
3
|
+
// src/rsc/ServerActions.ts
|
|
4
4
|
/**
|
|
5
5
|
* Server Actions —— engine 级元数据注册
|
|
6
6
|
*
|
|
@@ -77,8 +77,7 @@ var ServerActionUtils = {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
//#region src/rsc/constants.ts
|
|
80
|
+
// src/rsc/constants.ts
|
|
82
81
|
/**
|
|
83
82
|
* RSC / Flight 协议相关常量
|
|
84
83
|
*/
|
|
@@ -98,8 +97,7 @@ function isLegacyServerActionEndpoint(endpoint) {
|
|
|
98
97
|
function shouldSkipServerActionEndpointRetry(endpoint) {
|
|
99
98
|
return isLegacyServerActionEndpoint(endpoint);
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
//#region src/runtime/i18n-store.ts
|
|
100
|
+
// src/runtime/i18n-store.ts
|
|
103
101
|
var I18N_RUNTIME_STATE_KEY = "__ISR_ENGINE_I18N_RUNTIME_STATE__";
|
|
104
102
|
var runtimeState = getRuntimeState();
|
|
105
103
|
function registerServerI18nReader(reader) {
|
|
@@ -144,8 +142,7 @@ function interpolate(message, params) {
|
|
|
144
142
|
return value === void 0 || value === null ? match : String(value);
|
|
145
143
|
});
|
|
146
144
|
}
|
|
147
|
-
|
|
148
|
-
//#region src/defaults/runtime/i18n-server.ts
|
|
145
|
+
// src/defaults/runtime/i18n-server.ts
|
|
149
146
|
var store = new AsyncLocalStorage();
|
|
150
147
|
function runWithI18n(intl, fn) {
|
|
151
148
|
return store.run(intl ?? null, fn);
|
|
@@ -160,7 +157,6 @@ registerServerI18nReader(getCurrentI18n);
|
|
|
160
157
|
function isIntlPayload(value) {
|
|
161
158
|
return !!value && typeof value === "object" && typeof value.locale === "string";
|
|
162
159
|
}
|
|
163
|
-
//#endregion
|
|
164
160
|
export { LEGACY_SERVER_ACTION_ENDPOINT as a, isLegacyServerActionEndpoint as c, createServerAction as d, serverActionsRegistry as f, getI18nLocale as i, shouldSkipServerActionEndpointRetry as l, runWithI18n as n, SERVER_ACTION_ENDPOINT as o, getI18n as r, getServerActionEndpointCandidates as s, getCurrentI18n as t, ServerActionUtils as u };
|
|
165
161
|
|
|
166
|
-
//# sourceMappingURL=rsc-
|
|
162
|
+
//# sourceMappingURL=rsc-DWwcqD4W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsc-DWwcqD4W.js","names":["getCurrentI18n"],"sources":["../src/rsc/ServerActions.ts","../src/rsc/constants.ts","../src/runtime/i18n-store.ts","../src/defaults/runtime/i18n-server.ts"],"sourcesContent":["/**\n * Server Actions —— engine 级元数据注册\n *\n * 架构分工(方案 A 后):\n * - 协议传输:`@vitejs/plugin-rsc` 负责 encodeReply/decodeReply、loadServerAction、\n * Server Action 的 POST 路由、multipart 解码、响应 Flight 流等全部协议层工作\n * - 本模块职责:仅做元数据层面的注册表,供 engine 的调试 / 指标 / 管理面板使用\n *\n * 编写注意:\n * - 不重复实现执行/传输/序列化逻辑 —— 全部交给 plugin\n * - `createServerAction` 仅为便利 API:在 registry 中登记元数据,返回原函数\n * (不再伪造 `$$typeof`/`$$id` —— 这些由 plugin 的 transforms 在编译时注入到\n * `'use server'` 声明的模块导出上)\n */\n\nimport { runtimeLogger as logger } from '../logger/runtimeLogger';\n\nexport interface ServerActionMetadata {\n /** Action ID(应与 plugin 生成的 reference id 保持一致;自行注册时由调用方提供) */\n id: string;\n name: string;\n module?: string;\n line?: number;\n file?: string;\n}\n\nexport type ServerActionHandler = (...args: unknown[]) => Promise<unknown> | unknown;\n\nclass ServerActionsRegistry {\n private readonly metadata = new Map<string, ServerActionMetadata>();\n private initialized = false;\n\n async initialize(): Promise<void> {\n if (this.initialized) return;\n this.initialized = true;\n logger.info('✅ Server Actions Registry 已初始化');\n }\n\n async cleanup(): Promise<void> {\n this.metadata.clear();\n this.initialized = false;\n logger.info('✅ Server Actions Registry 已清理');\n }\n\n register(id: string, metadata: Omit<ServerActionMetadata, 'id'>): string {\n this.metadata.set(id, { id, ...metadata });\n return id;\n }\n\n getAllActions(): ServerActionMetadata[] {\n return Array.from(this.metadata.values());\n }\n\n hasAction(actionId: string): boolean {\n return this.metadata.has(actionId);\n }\n\n getMetadata(actionId: string): ServerActionMetadata | undefined {\n return this.metadata.get(actionId);\n }\n}\n\nexport const serverActionsRegistry = new ServerActionsRegistry();\n\n/**\n * 声明式注册:用于在服务端日志/管理面板中登记一个 action 的元数据\n *\n * 运行时执行请使用 `'use server'` 指令;本函数**不**改变执行语义,仅记录元数据\n */\nexport function createServerAction<T extends ServerActionHandler>(\n handler: T,\n metadata: Omit<ServerActionMetadata, 'id'> & { id: string }\n): T {\n serverActionsRegistry.register(metadata.id, metadata);\n return handler;\n}\n\nexport const ServerActionUtils = {\n isServer(): boolean {\n return typeof window === 'undefined';\n },\n isClient(): boolean {\n return typeof window !== 'undefined';\n },\n getExecutionContext() {\n if (this.isServer()) {\n return {\n environment: 'server' as const,\n nodeVersion: process.version,\n platform: process.platform,\n cwd: process.cwd(),\n };\n }\n return {\n environment: 'client' as const,\n userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined,\n url: typeof window !== 'undefined' ? window.location.href : undefined,\n timestamp: new Date().toISOString(),\n };\n },\n};\n","/**\n * RSC / Flight 协议相关常量\n */\n\nexport const SERVER_ACTION_ENDPOINT = '/_rsc/action';\nexport const LEGACY_SERVER_ACTION_ENDPOINT = '/api/server-actions';\nexport const SERVER_ACTION_ENDPOINTS = [SERVER_ACTION_ENDPOINT, LEGACY_SERVER_ACTION_ENDPOINT];\n\nexport function getServerActionEndpointCandidates(primaryEndpoint?: string): string[] {\n const candidates = new Set<string>();\n const endpoint = primaryEndpoint || SERVER_ACTION_ENDPOINT;\n\n candidates.add(endpoint);\n candidates.add(SERVER_ACTION_ENDPOINT);\n candidates.add(LEGACY_SERVER_ACTION_ENDPOINT);\n\n return Array.from(candidates);\n}\n\nexport function isLegacyServerActionEndpoint(endpoint: string): boolean {\n return endpoint === LEGACY_SERVER_ACTION_ENDPOINT;\n}\n\nexport function shouldSkipServerActionEndpointRetry(endpoint: string): boolean {\n return isLegacyServerActionEndpoint(endpoint);\n}\n","import type { IntlPayload } from '../defaults/runtime/seo-runtime';\n\nexport type I18nParams = Record<string, string | number | boolean | null | undefined>;\n\nexport type Translate = (key: string, params?: I18nParams, fallback?: string) => string;\n\ntype ServerReader = () => IntlPayload | null | undefined;\n\ninterface I18nRuntimeState {\n clientIntl: IntlPayload | null;\n serverReader: ServerReader | null;\n keyPathCache: Map<string, string[]>;\n}\n\nconst I18N_RUNTIME_STATE_KEY = '__ISR_ENGINE_I18N_RUNTIME_STATE__';\n\nconst runtimeState = getRuntimeState();\n\nexport function setClientI18n(intl: IntlPayload | null | undefined): void {\n runtimeState.clientIntl = intl ?? null;\n}\n\nexport function registerServerI18nReader(reader: ServerReader): void {\n runtimeState.serverReader = reader;\n}\n\nexport function getCurrentI18n(): IntlPayload | null {\n return runtimeState.serverReader?.() ?? runtimeState.clientIntl;\n}\n\nexport function getI18nLocale(fallback = ''): string {\n return getCurrentI18n()?.locale ?? fallback;\n}\n\nexport const getI18n: Translate = (key, params, fallback = key) => {\n const value = readPath(getCurrentI18n()?.messages, key);\n const message = typeof value === 'string' && value.trim() ? value : fallback;\n return interpolate(message, params);\n};\n\nfunction readPath(source: unknown, key: string): unknown {\n let path = runtimeState.keyPathCache.get(key);\n if (!path) {\n path = key.split('.');\n runtimeState.keyPathCache.set(key, path);\n }\n\n let cur = source;\n for (const part of path) {\n if (!cur || typeof cur !== 'object' || !(part in cur)) return undefined;\n cur = (cur as Record<string, unknown>)[part];\n }\n return cur;\n}\n\nfunction getRuntimeState(): I18nRuntimeState {\n const globalState = globalThis as typeof globalThis & {\n [I18N_RUNTIME_STATE_KEY]?: I18nRuntimeState;\n };\n\n globalState[I18N_RUNTIME_STATE_KEY] ??= {\n clientIntl: null,\n serverReader: null,\n keyPathCache: new Map<string, string[]>(),\n };\n\n return globalState[I18N_RUNTIME_STATE_KEY];\n}\n\nfunction interpolate(message: string, params?: I18nParams): string {\n if (!params) return message;\n return message.replace(/\\{(\\w+)\\}/g, (match, name) => {\n const value = params[name];\n return value === undefined || value === null ? match : String(value);\n });\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport type { IntlPayload } from './seo-runtime';\nimport { getI18n, getI18nLocale, registerServerI18nReader } from '../../runtime/i18n-store';\nimport { getRequestContext } from '../../context/RequestContext';\n\nconst store = new AsyncLocalStorage<IntlPayload | null>();\n\nexport function runWithI18n<T>(intl: IntlPayload | null | undefined, fn: () => T): T {\n return store.run(intl ?? null, fn);\n}\n\nexport function getCurrentI18n(): IntlPayload | null {\n const scoped = store.getStore();\n if (scoped) return scoped;\n const requestIntl = getRequestContext()?.intl;\n return isIntlPayload(requestIntl) ? requestIntl : null;\n}\n\nregisterServerI18nReader(getCurrentI18n);\n\nexport { getI18n, getI18nLocale };\nexport type { I18nParams, Translate } from '../../runtime/i18n-store';\n\nfunction isIntlPayload(value: unknown): value is IntlPayload {\n return !!value && typeof value === 'object' && typeof (value as IntlPayload).locale === 'string';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAM,wBAAN,MAA4B;CAC1B,2BAA4B,IAAI,IAAkC;CAClE,cAAsB;CAEtB,MAAM,aAA4B;EAChC,IAAI,KAAK,aAAa;EACtB,KAAK,cAAc;EACnB,cAAO,KAAK,gCAAgC;CAC9C;CAEA,MAAM,UAAyB;EAC7B,KAAK,SAAS,MAAM;E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OAAO,MAAM,IAAI,QAAQ,MAAM,EAAE;AACnC;AAEA,SAAgB,iBAAqC;CACnD,MAAM,SAAS,MAAM,SAAS;CAC9B,IAAI,QAAQ,OAAO;CACnB,MAAM,cAAc,kBAAkB,CAAC,EAAE;CACzC,OAAO,cAAc,WAAW,IAAI,cAAc;AACpD;AAEA,yBAAyB,cAAc;AAKvC,SAAS,cAAc,OAAsC;CAC3D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,OAAQ,MAAsB,WAAW;AAC1F"}
|
|
@@ -8,7 +8,7 @@ export declare function LocaleProvider({ locale, config, children, }: {
|
|
|
8
8
|
locale: string;
|
|
9
9
|
config: I18nConfig;
|
|
10
10
|
children: React.ReactNode;
|
|
11
|
-
}):
|
|
11
|
+
}): React.JSX.Element;
|
|
12
12
|
export declare function useLocale(): LocaleContextValue;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=LocaleContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleContext.d.ts","sourceRoot":"","sources":["../../src/runtime/LocaleContext.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACpB;AAID,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,
|
|
1
|
+
{"version":3,"file":"LocaleContext.d.ts","sourceRoot":"","sources":["../../src/runtime/LocaleContext.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACpB;AAID,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAGA;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|
|
@@ -16,12 +16,12 @@ interface BoundaryProps {
|
|
|
16
16
|
* 一站式 Boundary —— 同时套 ErrorBoundary + Suspense
|
|
17
17
|
* 业务最常用的形式:用 1 个组件框住有数据获取/有副作用的子树
|
|
18
18
|
*/
|
|
19
|
-
export declare function Boundary({ loading, error, onError, children }: BoundaryProps):
|
|
19
|
+
export declare function Boundary({ loading, error, onError, children }: BoundaryProps): React.JSX.Element;
|
|
20
20
|
/** 仅错误边界(不需要 Suspense 时用)*/
|
|
21
21
|
export declare function ErrorBoundary({ fallback, onError, children, }: {
|
|
22
22
|
fallback?: React.ReactElement;
|
|
23
23
|
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
24
24
|
children: React.ReactNode;
|
|
25
|
-
}):
|
|
25
|
+
}): React.JSX.Element;
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../src/runtime/boundary.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,aAAa;IACrB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA4DD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../src/runtime/boundary.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,aAAa;IACrB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA4DD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,qBAM5E;AAED,4BAA4B;AAC5B,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAMA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/server/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAgB,EAA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H,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAE7D;AAED,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,aAAa,EAClB,kBAAkB,GAAE;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CACX,GACL,IAAI,CAeN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAGzD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isr-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "ISR/SSG/Fallback rendering orchestration on Vite + React 19 RSC.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -115,14 +115,14 @@
|
|
|
115
115
|
"esbuild": "^0.28.2",
|
|
116
116
|
"express": "^5.3.0",
|
|
117
117
|
"express-rate-limit": "8.7.5",
|
|
118
|
-
"helmet": "^
|
|
118
|
+
"helmet": "^8.3.0",
|
|
119
119
|
"ipaddr.js": "^2.5.0",
|
|
120
|
-
"lru-cache": "^
|
|
120
|
+
"lru-cache": "^11.5.3",
|
|
121
121
|
"ora": "^10.0.0",
|
|
122
122
|
"parse5": "^8.0.1",
|
|
123
123
|
"pino": "10.4.0",
|
|
124
124
|
"prom-client": "^15.1.3",
|
|
125
|
-
"rsc-html-stream": "0.0.
|
|
125
|
+
"rsc-html-stream": "0.0.8",
|
|
126
126
|
"sharp": "^0.35.5",
|
|
127
127
|
"sitemap": "^10.0.0",
|
|
128
128
|
"typescript": "^6.0.3"
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"peerDependencies": {
|
|
131
131
|
"react": "19.3.1",
|
|
132
132
|
"react-dom": "19.3.1",
|
|
133
|
-
"vite": "8.
|
|
133
|
+
"vite": "8.3.8"
|
|
134
134
|
},
|
|
135
135
|
"optionalDependencies": {
|
|
136
136
|
"ioredis": "^5.11.1"
|
|
@@ -149,15 +149,15 @@
|
|
|
149
149
|
"@types/node": "24.19.2",
|
|
150
150
|
"@types/react": "^19.2.15",
|
|
151
151
|
"@types/react-dom": "^19.0.0",
|
|
152
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
153
|
-
"@typescript-eslint/parser": "8.
|
|
152
|
+
"@typescript-eslint/eslint-plugin": "8.73.0",
|
|
153
|
+
"@typescript-eslint/parser": "8.73.0",
|
|
154
154
|
"@vitest/coverage-v8": "^4.1.12",
|
|
155
155
|
"eslint": "^9.15.0",
|
|
156
156
|
"eslint-config-prettier": "^10.1.8",
|
|
157
157
|
"eslint-plugin-prettier": "^5.5.7",
|
|
158
158
|
"eslint-plugin-react": "^7.37.2",
|
|
159
159
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
160
|
-
"globals": "^
|
|
160
|
+
"globals": "^17.14.0",
|
|
161
161
|
"happy-dom": "^21.0.4",
|
|
162
162
|
"husky": "^9.1.7",
|
|
163
163
|
"ioredis-mock": "^8.9.0",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"semantic-release": "25.0.9",
|
|
171
171
|
"tsc-alias": "^1.9.10",
|
|
172
172
|
"undici": "8.12.4",
|
|
173
|
-
"vite": "8.
|
|
173
|
+
"vite": "8.3.8",
|
|
174
174
|
"vitest": "^4.1.12"
|
|
175
175
|
},
|
|
176
176
|
"pnpm": {
|
|
@@ -72,6 +72,7 @@ interface DefaultRscPayload {
|
|
|
72
72
|
seoMeta?: PageSeoMeta | null;
|
|
73
73
|
/** canonical / og:image 转绝对 URL 用 */
|
|
74
74
|
siteBaseUrl?: string | null;
|
|
75
|
+
routeStatus?: 404;
|
|
75
76
|
formState?: import('react-dom/client').ReactFormState;
|
|
76
77
|
returnValue?: { ok: boolean; data: unknown };
|
|
77
78
|
}
|
|
@@ -150,7 +151,7 @@ function transitionPayload(
|
|
|
150
151
|
|
|
151
152
|
function PayloadRoot({ payload, generation, styleIds }: DefaultRscPayloadState): React.ReactNode {
|
|
152
153
|
React.useLayoutEffect(() => {
|
|
153
|
-
applySeoToDocument(payload.seoMeta, payload.siteBaseUrl ?? undefined);
|
|
154
|
+
applySeoToDocument(payload.seoMeta, payload.siteBaseUrl ?? undefined, payload.routeStatus);
|
|
154
155
|
}, [payload]);
|
|
155
156
|
if (!import.meta.env.DEV || generation === undefined) return payload.root;
|
|
156
157
|
return (
|
|
@@ -61,6 +61,7 @@ interface DefaultRscPayload {
|
|
|
61
61
|
seoMeta?: PageSeoMeta | null;
|
|
62
62
|
/** 客户端 applySeoToDocument 用来把 canonical / og:image 转绝对 URL */
|
|
63
63
|
siteBaseUrl?: string | null;
|
|
64
|
+
routeStatus?: 404;
|
|
64
65
|
returnValue?: { ok: boolean; data: unknown };
|
|
65
66
|
formState?: ReactFormState;
|
|
66
67
|
}
|
|
@@ -248,7 +249,7 @@ export function defineServerEntry<C extends ServerCtx = ServerCtx>(
|
|
|
248
249
|
|
|
249
250
|
const response = await runWithI18n(intl, () =>
|
|
250
251
|
runRscPipeline(renderRequest, {
|
|
251
|
-
routeStatus: notFound
|
|
252
|
+
routeStatus: notFound ? 404 : undefined,
|
|
252
253
|
intl,
|
|
253
254
|
seoMeta,
|
|
254
255
|
siteBaseUrl: hooks.siteBaseUrl,
|
|
@@ -297,6 +298,7 @@ async function runRscPipeline(
|
|
|
297
298
|
extras: PipelineExtras
|
|
298
299
|
): Promise<Response> {
|
|
299
300
|
const { request } = renderRequest;
|
|
301
|
+
const responseRouteStatus = renderRequest.isAction ? undefined : extras.routeStatus;
|
|
300
302
|
|
|
301
303
|
let returnValue: DefaultRscPayload['returnValue'] | undefined;
|
|
302
304
|
let formState: ReactFormState | undefined;
|
|
@@ -337,6 +339,7 @@ async function runRscPipeline(
|
|
|
337
339
|
intl: extras.intl ?? null,
|
|
338
340
|
seoMeta: extras.seoMeta ?? null,
|
|
339
341
|
siteBaseUrl: extras.siteBaseUrl ?? null,
|
|
342
|
+
routeStatus: extras.routeStatus,
|
|
340
343
|
formState,
|
|
341
344
|
returnValue,
|
|
342
345
|
};
|
|
@@ -357,7 +360,7 @@ async function runRscPipeline(
|
|
|
357
360
|
|
|
358
361
|
if (renderRequest.isRsc) {
|
|
359
362
|
return new Response(rscStream, {
|
|
360
|
-
status: actionStatus ??
|
|
363
|
+
status: actionStatus ?? responseRouteStatus,
|
|
361
364
|
headers: { 'content-type': 'text/x-component;charset=utf-8' },
|
|
362
365
|
});
|
|
363
366
|
}
|
|
@@ -410,7 +413,12 @@ async function runRscPipeline(
|
|
|
410
413
|
let finalStream = ssrResult.stream;
|
|
411
414
|
if (!ssrResult.csrShellFallback) {
|
|
412
415
|
if (extras.seoMeta) {
|
|
413
|
-
finalStream = injectSeoMeta(
|
|
416
|
+
finalStream = injectSeoMeta(
|
|
417
|
+
finalStream,
|
|
418
|
+
extras.seoMeta,
|
|
419
|
+
extras.siteBaseUrl,
|
|
420
|
+
extras.routeStatus
|
|
421
|
+
);
|
|
414
422
|
}
|
|
415
423
|
if (extras.headExtras) {
|
|
416
424
|
finalStream = injectHeadExtras(finalStream, extras.headExtras);
|
|
@@ -418,7 +426,7 @@ async function runRscPipeline(
|
|
|
418
426
|
}
|
|
419
427
|
|
|
420
428
|
return new Response(finalStream, {
|
|
421
|
-
status: ssrResult.status ??
|
|
429
|
+
status: ssrResult.status ?? responseRouteStatus,
|
|
422
430
|
headers: responseHeaders,
|
|
423
431
|
});
|
|
424
432
|
}
|
|
@@ -70,7 +70,16 @@ function toAbsolute(href: string, baseUrl?: string): string {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
function resolveCanonical(
|
|
74
|
+
meta: PageSeoMeta,
|
|
75
|
+
baseUrl?: string,
|
|
76
|
+
routeStatus?: 404
|
|
77
|
+
): string | undefined {
|
|
78
|
+
if (meta.canonical) return toAbsolute(meta.canonical, baseUrl);
|
|
79
|
+
return routeStatus === 404 ? undefined : baseUrl;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function renderPageSeoMeta(meta: PageSeoMeta, baseUrl?: string, routeStatus?: 404): string {
|
|
74
83
|
const tags: string[] = [];
|
|
75
84
|
const esc = (s: string) =>
|
|
76
85
|
s.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
@@ -86,10 +95,8 @@ export function renderPageSeoMeta(meta: PageSeoMeta, baseUrl?: string): string {
|
|
|
86
95
|
if (meta.noindex) {
|
|
87
96
|
tags.push(`<meta data-isr-seo name="robots" content="noindex, nofollow">`);
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (href) tags.push(`<link data-isr-seo rel="canonical" href="${esc(href)}">`);
|
|
92
|
-
}
|
|
98
|
+
const canonical = resolveCanonical(meta, baseUrl, routeStatus);
|
|
99
|
+
if (canonical) tags.push(`<link data-isr-seo rel="canonical" href="${esc(canonical)}">`);
|
|
93
100
|
if (meta.alternates?.length) {
|
|
94
101
|
for (const a of meta.alternates) {
|
|
95
102
|
tags.push(
|
|
@@ -129,11 +136,12 @@ const HEAD_OPEN_RE = /<head\b[^>]*>/i;
|
|
|
129
136
|
export function injectSeoMeta(
|
|
130
137
|
source: ReadableStream<Uint8Array>,
|
|
131
138
|
meta: PageSeoMeta,
|
|
132
|
-
baseUrl?: string
|
|
139
|
+
baseUrl?: string,
|
|
140
|
+
routeStatus?: 404
|
|
133
141
|
): ReadableStream<Uint8Array> {
|
|
134
142
|
const encoder = new TextEncoder();
|
|
135
143
|
const decoder = new TextDecoder('utf-8', { fatal: false });
|
|
136
|
-
const injection = '\n ' + renderPageSeoMeta(meta, baseUrl) + '\n';
|
|
144
|
+
const injection = '\n ' + renderPageSeoMeta(meta, baseUrl, routeStatus) + '\n';
|
|
137
145
|
|
|
138
146
|
let buffer = '';
|
|
139
147
|
let injected = false;
|
|
@@ -179,7 +187,11 @@ export function clearInjectedSeo(): void {
|
|
|
179
187
|
}
|
|
180
188
|
|
|
181
189
|
/** Replace managed head metadata after the route commits. */
|
|
182
|
-
export function applySeoToDocument(
|
|
190
|
+
export function applySeoToDocument(
|
|
191
|
+
meta: PageSeoMeta | null | undefined,
|
|
192
|
+
baseUrl?: string,
|
|
193
|
+
routeStatus?: 404
|
|
194
|
+
): void {
|
|
183
195
|
if (typeof document === 'undefined' || !document.head) return;
|
|
184
196
|
const head = document.head;
|
|
185
197
|
clearInjectedSeo();
|
|
@@ -215,10 +227,8 @@ export function applySeoToDocument(meta: PageSeoMeta | null | undefined, baseUrl
|
|
|
215
227
|
if (meta.noindex) {
|
|
216
228
|
fragments.push(tag('meta', { name: 'robots', content: 'noindex, nofollow' }));
|
|
217
229
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (href) fragments.push(tag('link', { rel: 'canonical', href }));
|
|
221
|
-
}
|
|
230
|
+
const canonical = resolveCanonical(meta, baseUrl, routeStatus);
|
|
231
|
+
if (canonical) fragments.push(tag('link', { rel: 'canonical', href: canonical }));
|
|
222
232
|
if (meta.alternates?.length) {
|
|
223
233
|
for (const a of meta.alternates) {
|
|
224
234
|
fragments.push(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abVariantContext-BtLsLN1J.js","names":[],"sources":["../src/context/RequestContext.ts","../src/logger/logRecord.ts","../src/logger/runtimeLogger.ts","../src/rsc/revalidationMetrics.ts","../src/rsc/revalidate.ts","../src/rsc/cacheTag.ts","../src/middlewares/abVariantContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'async_hooks';\nimport type { ISRContextData } from '../types/ISRContext';\n\n// 复用 ISRContextData 类型,确保 ALS 中的数据结构与 ISRContext.data 一致\nexport type RequestContextState = ISRContextData;\n\nconst REQUEST_CONTEXT_KEY = '__ISR_ENGINE_REQUEST_CONTEXT__';\n\nfunction getGlobalRequestContext(): AsyncLocalStorage<RequestContextState> {\n const globalState = globalThis as typeof globalThis & {\n [REQUEST_CONTEXT_KEY]?: AsyncLocalStorage<RequestContextState>;\n };\n\n globalState[REQUEST_CONTEXT_KEY] ??= new AsyncLocalStorage<RequestContextState>();\n return globalState[REQUEST_CONTEXT_KEY];\n}\n\n// 全局 ALS 实例。dev 下 source/dist 可能同时被 Vite 加载,必须共享同一份请求上下文。\nexport const requestContext = getGlobalRequestContext();\n\n// 获取当前请求上下文的辅助函数\nexport const getRequestContext = (): RequestContextState | undefined => {\n return requestContext.getStore();\n};\n\n// 获取 Trace ID 的辅助函数 (安全访问)\nexport const getTraceId = (): string => {\n const store = requestContext.getStore();\n return store?.traceId || 'system';\n};\n\n// 获取 Request ID 的辅助函数 (安全访问)\nexport const getRequestId = (): string => {\n const store = requestContext.getStore();\n return store?.requestId || 'unknown';\n};\n\n/**\n * 获取 anonId —— 浏览器 / 设备维度稳定 UUID。\n *\n * engine 入口 createServerRequestContext 已保证 RequestContext 存在时这个字段必有值\n * (cookie 缺失会自动生成);context 不在时(极少数 dev / unit-test 场景)返回 'system'。\n * 业务侧用法:feature gating、telemetry user 维度聚合、个性化推荐 anchor。\n */\nexport const getAnonId = (): string => {\n const store = requestContext.getStore();\n return store?.anonId || 'system';\n};\n\n/**\n * 获取已登录用户 ID。业务侧 beforeRequest hook 解 session 写入;未登录返回 null。\n * 注意:不要把这里返回的字符串当 anonId 用 —— anonId 跨登录态稳定(一个浏览器永远\n * 同一份),userId 跨设备稳定但匿名期为 null。两者职责不同。\n */\nexport const getUserId = (): string | null => {\n const store = requestContext.getStore();\n return store?.userId ?? null;\n};\n\n/**\n * 获取本次请求生效的全部实验变体 —— `{ 'hero-style': 'bold', ... }`。\n * 由 ABVariantMiddleware 基于 hash(anonId + expKey) 确定性算出,不在 cookie 里持久化。\n * 没接 ABVariantMiddleware 时返回空对象。\n */\nexport const getExperiments = (): Record<string, string> => {\n const store = requestContext.getStore();\n return store?.experiments ?? {};\n};\n","export type LogValue = null | boolean | number | string | LogValue[] | { [key: string]: LogValue };\n\n/** Snapshot once so console and file output cannot invoke a caller's toJSON twice. */\nexport function snapshotLogArgument(value: unknown): LogValue {\n try {\n const seen = new WeakSet<object>();\n const serialized = JSON.stringify(value, (_key, item: unknown) => {\n if (typeof item === 'bigint') return `${item}n`;\n if (item && typeof item === 'object') {\n if (seen.has(item)) return '[Circular]';\n seen.add(item);\n if (item instanceof Error) {\n return {\n ...item,\n name: item.name,\n message: item.message,\n stack: item.stack,\n cause: item.cause,\n };\n }\n }\n return item;\n });\n return serialized === undefined ? String(value) : (JSON.parse(serialized) as LogValue);\n } catch {\n return '[Unserializable log argument]';\n }\n}\n\n/** JSON handles C0/CR/LF; these additional controls are legal raw JSON characters. */\nexport function escapeSupplementalLogControls(serialized: string): string {\n return serialized.replace(\n /[\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028-\\u202e\\u2066-\\u2069]/g,\n character => `\\\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`\n );\n}\n\n/** Keep every untrusted console field visibly quoted and inside one physical line. */\nexport function encodeLogField(value: LogValue): string {\n return escapeSupplementalLogControls(JSON.stringify(value));\n}\n\nexport function encodeSpinnerMessage(value: string): string {\n return encodeLogField(value).slice(1, -1);\n}\n","import { encodeLogField, snapshotLogArgument } from './logRecord';\n\ntype RuntimeLogLevel = 'debug' | 'info' | 'error';\ntype RuntimeLogger = Record<RuntimeLogLevel, (...args: unknown[]) => void>;\n\nconst LOGGER_KEY = Symbol.for('isr-engine:origin-logger');\nconst runtime = globalThis as typeof globalThis & { [LOGGER_KEY]?: RuntimeLogger };\n\nexport function setOriginLogger(logger: RuntimeLogger): void {\n runtime[LOGGER_KEY] = logger;\n}\n\n/** Rendered modules share the origin logger without bundling its file transport. */\nfunction log(level: RuntimeLogLevel, args: unknown[]): void {\n const origin = runtime[LOGGER_KEY];\n if (origin) {\n origin[level](...args);\n } else if (level !== 'debug') {\n console[level](encodeLogField({ level, args: args.map(snapshotLogArgument) }));\n }\n}\n\nexport const runtimeLogger: RuntimeLogger = {\n debug: (...args) => log('debug', args),\n info: (...args) => log('info', args),\n error: (...args) => log('error', args),\n};\n","type RevalidationMetricRecorder = (\n event: 'run' | 'failure',\n kind: 'path' | 'tag',\n target: string\n) => void;\n\nconst RECORDER_KEY = Symbol.for('isr-engine:revalidation-metric-recorder');\nconst runtime = globalThis as typeof globalThis & {\n [RECORDER_KEY]?: RevalidationMetricRecorder;\n};\n\n/** The Node origin owns the metrics registry, including events from the separate Vite RSC graph. */\nexport function setRevalidationMetricRecorder(recorder: RevalidationMetricRecorder): void {\n runtime[RECORDER_KEY] = recorder;\n}\n\nexport function recordRevalidationMetric(...args: Parameters<RevalidationMetricRecorder>): void {\n runtime[RECORDER_KEY]?.(...args);\n}\n","/**\n * 缓存失效契约 —— `revalidatePath(path)` 按路径精准失效;`revalidateTag(tag)` 按渲染期声明的 tag 失效\n *\n * 跨环境状态共享:\n * Server Action 在 Vite 的 `rsc` 环境中执行(模块图 A),\n * 而 ISR 缓存中间件注册 invalidator 在 Node 上下文(模块图 B),\n * 两份模块图下,同名模块可能各自持有独立的 ES 模块状态。\n * 因此本模块把 invalidator 注册表挂在 `globalThis` 上作为跨环境单例,\n * 确保 `revalidatePath/Tag` 调用能分发到所有已注册的 invalidator。\n *\n * 失败语义(v2.0.x 起):\n * 过去版本用 `Promise.all`,**首个失败的 invalidator 会抛出,剩余的可能仍在执行\n * 但 reject 被吞**——多 invalidator 场景下出现\"看似成功但部分缓存没清\"的脏状态。\n * 现在改为:\n * 1. `Promise.allSettled` 让所有 invalidator 都跑到底\n * 2. 每个失败单独打 metric + log(含 trace 上下文)\n * 3. 整体 ≥ 1 个失败 → 抛聚合 `RevalidationError`(含 successCount/failureCount/causes)\n * 调用方(Server Action)务必 `try { await revalidateTag(...) } catch (e) { ... }`,\n * 否则用户提交后看到的是 200 但底层有部分 cache 未清——这种\"沉默错误\"比抛错更危险。\n *\n * 用法:\n * 1. Server Action 内部调用 `revalidatePath('/books')` 或 `revalidateTag('books')`\n * 2. ISR cache 中间件 / ISREngine 启动时通过 `registerInvalidator(fn)` 注册\n * 3. 分发到所有注册的 invalidator,清理对应缓存条目\n *\n * 注意:\n * - 本模块不持有任何缓存实现,纯做路由分发\n * - 若未注册 invalidator(例如脱离 engine 的纯 RSC 场景),调用静默为 no-op\n */\n\nimport { runtimeLogger as logger } from '../logger/runtimeLogger';\nimport { recordRevalidationMetric } from './revalidationMetrics';\n\n/** Invalidator 签名:接收失效目标描述 */\nexport interface RevalidateInvalidator {\n (target: { kind: 'path'; value: string } | { kind: 'tag'; value: string }): Promise<void> | void;\n}\n\n/** 全局单例 key(Symbol.for 保证跨模块图复用同一注册表) */\nconst REGISTRY_KEY = Symbol.for('isr-engine:revalidate-registry');\n\ntype GlobalWithRegistry = typeof globalThis & {\n [REGISTRY_KEY]?: Set<RevalidateInvalidator>;\n};\n\nfunction getRegistry(): Set<RevalidateInvalidator> {\n const g = globalThis as GlobalWithRegistry;\n if (!g[REGISTRY_KEY]) {\n g[REGISTRY_KEY] = new Set<RevalidateInvalidator>();\n }\n return g[REGISTRY_KEY];\n}\n\n/**\n * 注册一个 invalidator 实例(通常由 ISR 缓存中间件 / ISREngine 调用)\n * 返回取消注册的函数\n */\nexport function registerInvalidator(fn: RevalidateInvalidator): () => void {\n const registry = getRegistry();\n registry.add(fn);\n return () => {\n registry.delete(fn);\n };\n}\n\n/**\n * 聚合失效错误 —— 当一个或多个 invalidator 失败时抛出。\n *\n * 含:\n * - successCount / failureCount:方便调用方决定补偿策略\n * - causes:每个失败的原始 Error(按注册顺序)\n * - target:触发本次 revalidate 的描述('tag:books' / 'path:/books')\n *\n * 注意:用 `extends Error` 而非 `AggregateError`,因为 AggregateError 在某些 Node\n * 版本对 stack/message 序列化不稳,自定义 class 更可控且 instanceof 检测可靠。\n */\nexport class RevalidationError extends Error {\n public readonly target: string;\n public readonly successCount: number;\n public readonly failureCount: number;\n public readonly causes: readonly Error[];\n\n constructor(\n target: string,\n successCount: number,\n failureCount: number,\n causes: readonly Error[]\n ) {\n super(\n `revalidate(${target}) —— ${failureCount} invalidator(s) failed, ` +\n `${successCount} succeeded. First cause: ${causes[0]?.message ?? '(unknown)'}`\n );\n this.name = 'RevalidationError';\n this.target = target;\n this.successCount = successCount;\n this.failureCount = failureCount;\n this.causes = causes;\n }\n}\n\ntype RevalidateTarget = { kind: 'path'; value: string } | { kind: 'tag'; value: string };\n\n/**\n * 内部统一分发:跑所有 invalidator,把失败聚合成 RevalidationError 抛出。\n *\n * `Promise.allSettled` 保证任意 invalidator 抛错都不会中断其他 invalidator 的执行——\n * 这样即使 Redis 回源失败,进程内 LRU 至少能清干净;进程内 LRU 失败也不会拖累 Redis。\n */\nasync function dispatch(target: RevalidateTarget): Promise<void> {\n const registry = getRegistry();\n const targetLabel = `${target.kind}:${target.value}`;\n if (registry.size === 0) {\n logger.debug(`revalidate(${targetLabel}) —— 无 invalidator 注册,忽略`);\n return;\n }\n\n recordRevalidationMetric('run', target.kind, target.value);\n\n // 包一层 async 函数:把同步抛错也转成 Promise rejection,让 allSettled 能统一处理\n // (直接 `fn(target)` 在 fn 同步抛错时会在 `.map` 里 escape,allSettled 收不到)\n const invalidators = Array.from(registry);\n const results = await Promise.allSettled(invalidators.map(async fn => fn(target)));\n\n const causes: Error[] = [];\n let successCount = 0;\n let failureCount = 0;\n\n results.forEach((r, idx) => {\n if (r.status === 'fulfilled') {\n successCount++;\n return;\n }\n failureCount++;\n const err = r.reason instanceof Error ? r.reason : new Error(String(r.reason));\n causes.push(err);\n recordRevalidationMetric('failure', target.kind, target.value);\n // 单独 log 每个失败,方便从 stack 定位是哪个 invalidator\n logger.error(`[revalidate] invalidator #${idx} failed for ${targetLabel}: ${err.message}`, err);\n });\n\n if (failureCount > 0) {\n throw new RevalidationError(targetLabel, successCount, failureCount, causes);\n }\n\n logger.debug(\n `✅ revalidate(${targetLabel}) —— 已分发到 ${registry.size} 个 invalidator(全部成功)`\n );\n}\n\n/**\n * 使指定路径的缓存失效\n *\n * @param path 形如 '/books' / '/posts/42' 的路径\n * @throws {RevalidationError} 任意 invalidator 失败时(其余仍执行完毕)\n */\nexport async function revalidatePath(path: string): Promise<void> {\n await dispatch({ kind: 'path', value: path });\n}\n\n/**\n * 使指定 tag 标记的所有缓存条目失效\n *\n * @param tag 业务语义 tag(如 'books' / `book:${id}`)\n * @throws {RevalidationError} 任意 invalidator 失败时(其余仍执行完毕)\n */\nexport async function revalidateTag(tag: string): Promise<void> {\n await dispatch({ kind: 'tag', value: tag });\n}\n","/**\n * 缓存 Tag 上下文 —— 支持 Server Component 在渲染期声明 tag,便于后续 revalidateTag 精细失效\n *\n * 协作模型:\n * 1. ISR 缓存中间件在进入 handler 前 `runWithTagStore(() => rscHandler(request))`\n * —— 给本次请求开一个 AsyncLocalStorage 作用域,内部放 `{ tags: Set<string> }`\n * 2. Server Component 体内任意位置调用 `cacheTag('books', `book:${id}`)`\n * → 写入当前作用域的 tags Set\n * 3. 响应捕获阶段 `collectTags()` 读出 tag 列表,写入 CachedEntry.tags\n * 4. `revalidateTag('books')` 被 invalidator 接收后,遍历 cache 条目,\n * 命中 tags 列表的精准清除(无副作用污染其他条目)\n *\n * 跨环境状态共享:\n * Server Component 在 Vite `rsc` 环境执行(模块图 A),\n * ISR 缓存中间件在 Node(模块图 B)。\n * ES 模块作用域的 `new AsyncLocalStorage()` 会被双模块图各持有一份副本,\n * 导致 cacheTag 写入的 store 与 collectTags 读取的 store 不互通。\n * 故本模块把 ALS 实例挂在 `globalThis` 上作为跨模块图单例(Symbol.for key)\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { runtimeLogger as logger } from '../logger/runtimeLogger';\n\ninterface TagStore {\n tags: Set<string>;\n /** 本次渲染过程中是否被显式标记为不可缓存(例如上游 fetch 失败) */\n uncacheable: boolean;\n}\n\nconst ALS_KEY = Symbol.for('isr-engine:cache-tag-als');\n\ntype GlobalWithALS = typeof globalThis & {\n [ALS_KEY]?: AsyncLocalStorage<TagStore>;\n};\n\nfunction getALS(): AsyncLocalStorage<TagStore> {\n const g = globalThis as GlobalWithALS;\n if (!g[ALS_KEY]) {\n g[ALS_KEY] = new AsyncLocalStorage<TagStore>();\n }\n return g[ALS_KEY];\n}\n\n/**\n * 在独立的 tag 作用域中执行 fn —— 通常由 ISR 缓存中间件在每次请求前调用\n *\n * fn 内部以及 fn 启动的任何 async/Promise 链路内,调用 cacheTag(...) 都会\n * 写入本作用域,不会污染父作用域或兄弟请求\n */\nexport function runWithTagStore<T>(fn: () => T | Promise<T>): T | Promise<T> {\n return getALS().run({ tags: new Set<string>(), uncacheable: false }, fn);\n}\n\n/**\n * 在 Server Component / loader 内显式声明本次渲染产物**不应入缓存**。\n * 适用场景:上游接口失败、降级渲染了一段错误提示 UI、命中风控/限流等\n * —— 渲染结果是 200,但内容会让用户困惑或马上过期,不应被 ISR HIT 反复回放。\n *\n * 调用一次即可;后续 cacheTag(...) 仍可继续调用但不会改变 uncacheable 决定。\n */\nexport function markUncacheable(): void {\n const store = getALS().getStore();\n if (store) {\n store.uncacheable = true;\n }\n}\n\n/** 读取本次渲染是否被标记为不可缓存(ISR 缓存中间件在响应捕获阶段调用) */\nexport function isUncacheable(): boolean {\n return getALS().getStore()?.uncacheable === true;\n}\n\n/**\n * Server Component / server action / server-only util 内声明:\n * 本次渲染/调用产出的缓存条目应关联以下 tag\n *\n * 多次调用会合并 tag;无 tag 作用域(例如脱离缓存中间件时)静默忽略\n */\nexport function cacheTag(...tags: string[]): void {\n const store = getALS().getStore();\n if (!store) {\n return;\n }\n for (const tag of tags) {\n if (typeof tag === 'string' && tag.length > 0) {\n store.tags.add(tag);\n }\n }\n}\n\n/**\n * 读取当前 tag 作用域的 tag 列表(ISR 缓存中间件在响应捕获阶段调用)\n */\nexport function collectTags(): string[] {\n const store = getALS().getStore();\n return store ? Array.from(store.tags) : [];\n}\n\n/**\n * 调试:打印当前 tag store 状态\n */\nexport function debugTagStore(label = ''): void {\n const store = getALS().getStore();\n logger.debug(\n `[cacheTag] ${label} store=${store ? JSON.stringify(Array.from(store.tags)) : '<none>'}`\n );\n}\n","/**\n * A/B variant 在 Server Component 里读取的 helper —— 与 express middleware 解耦\n *\n * RSC 环境通过本文件 import(不引入 express 类型,bundle 更轻);\n * Express 中间件在 ABVariantMiddleware.ts。\n */\nimport { getRequestContext } from '../context/RequestContext';\n\n/**\n * 在 Server Component 里读取 variant\n *\n * 不在 A/B middleware 后调用 → 返回 undefined\n */\nexport function getVariant(experimentName: string): string | undefined {\n const ctx = getRequestContext();\n const v = ctx?.flags?.[experimentName];\n return typeof v === 'string' ? v : undefined;\n}\n"],"mappings":";;;AAMA,IAAM,sBAAsB;AAE5B,SAAS,0BAAkE;CACzE,MAAM,cAAc;CAIpB,YAAY,yBAAyB,IAAI,kBAAuC;CAChF,OAAO,YAAY;AACrB;AAGA,IAAa,iBAAiB,wBAAwB;AAGtD,IAAa,0BAA2D;CACtE,OAAO,eAAe,SAAS;AACjC;AAGA,IAAa,mBAA2B;CAEtC,OADc,eAAe,SACtB,CAAA,EAAO,WAAW;AAC3B;AAGA,IAAa,qBAA6B;CAExC,OADc,eAAe,SACtB,CAAA,EAAO,aAAa;AAC7B;;;;;;;;AASA,IAAa,kBAA0B;CAErC,OADc,eAAe,SACtB,CAAA,EAAO,UAAU;AAC1B;;;;;;AAOA,IAAa,kBAAiC;CAE5C,OADc,eAAe,SACtB,CAAA,EAAO,UAAU;AAC1B;;;;;;AAOA,IAAa,uBAA+C;CAE1D,OADc,eAAe,SACtB,CAAA,EAAO,eAAe,CAAC;AAChC;;;;AChEA,SAAgB,oBAAoB,OAA0B;CAC5D,IAAI;EACF,MAAM,uBAAO,IAAI,QAAgB;EACjC,MAAM,aAAa,KAAK,UAAU,QAAQ,MAAM,SAAkB;GAChE,IAAI,OAAO,SAAS,UAAU,OAAO,GAAG,KAAK;GAC7C,IAAI,QAAQ,OAAO,SAA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