isr-engine 4.2.0 → 4.3.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.
Files changed (58) hide show
  1. package/README.md +5 -1
  2. package/dist/{contentRevalidation-D3SZwwbX.js → CacheTagContext-Btmq8KCD.js} +20 -7
  3. package/dist/CacheTagContext-Btmq8KCD.js.map +1 -0
  4. package/dist/{abVariantContext-BNInoflb.js → abVariantContext-yWZOqscY.js} +94 -36
  5. package/dist/abVariantContext-yWZOqscY.js.map +1 -0
  6. package/dist/cli/cli.js +1 -1
  7. package/dist/context/CacheTagContext.d.ts +10 -0
  8. package/dist/context/CacheTagContext.d.ts.map +1 -0
  9. package/dist/{createCacheInspectorMiddleware-CDOoJXGO.js → createCacheInspectorMiddleware-glgtcBcQ.js} +2 -2
  10. package/dist/{createCacheInspectorMiddleware-CDOoJXGO.js.map → createCacheInspectorMiddleware-glgtcBcQ.js.map} +1 -1
  11. package/dist/{createCachedFetcher-Y7zbGgjb.js → createCachedFetcher-CgJscexq.js} +29 -10
  12. package/dist/createCachedFetcher-CgJscexq.js.map +1 -0
  13. package/dist/{createISRApp-DA3-5Ezk.js → createISRApp-BG-s3uuL.js} +74 -56
  14. package/dist/createISRApp-BG-s3uuL.js.map +1 -0
  15. package/dist/defaults/runtime/contentRevalidation.d.ts +5 -2
  16. package/dist/defaults/runtime/contentRevalidation.d.ts.map +1 -1
  17. package/dist/defaults/runtime/createCachedFetcher.d.ts +5 -1
  18. package/dist/defaults/runtime/createCachedFetcher.d.ts.map +1 -1
  19. package/dist/defaults/runtime/defineSiteHooks.d.ts +2 -0
  20. package/dist/defaults/runtime/defineSiteHooks.d.ts.map +1 -1
  21. package/dist/defaults/runtime/defineSiteHooks.js +29 -23
  22. package/dist/defaults/runtime/defineSiteHooks.js.map +1 -1
  23. package/dist/defaults/runtime/renderCancellation.d.ts +3 -0
  24. package/dist/defaults/runtime/renderCancellation.d.ts.map +1 -0
  25. package/dist/engine/seo/resolveSeoConfig.d.ts +1 -0
  26. package/dist/engine/seo/resolveSeoConfig.d.ts.map +1 -1
  27. package/dist/isr-engine.js +4 -4
  28. package/dist/plugin/isrCacheMiddleware.d.ts.map +1 -1
  29. package/dist/rsc/browser.js +1 -1
  30. package/dist/rsc/browser.js.map +1 -1
  31. package/dist/rsc/cacheTag.d.ts +1 -8
  32. package/dist/rsc/cacheTag.d.ts.map +1 -1
  33. package/dist/rsc/index.js +3 -2
  34. package/dist/rsc/revalidate.d.ts +3 -2
  35. package/dist/rsc/revalidate.d.ts.map +1 -1
  36. package/dist/{rsc-CbZ-BsWD.js → rsc-BYq2vvnh.js} +2 -2
  37. package/dist/{rsc-CbZ-BsWD.js.map → rsc-BYq2vvnh.js.map} +1 -1
  38. package/dist/server/contentRevalidationRoute.d.ts +4 -0
  39. package/dist/server/contentRevalidationRoute.d.ts.map +1 -0
  40. package/dist/server/opsConfig.d.ts +6 -1
  41. package/dist/server/opsConfig.d.ts.map +1 -1
  42. package/dist/server/productionRuntime.d.ts.map +1 -1
  43. package/dist/server/publishedSitemap.d.ts.map +1 -1
  44. package/dist/types/ISRConfig.d.ts +4 -0
  45. package/dist/types/ISRConfig.d.ts.map +1 -1
  46. package/package.json +2 -2
  47. package/src/context/CacheTagContext.ts +20 -0
  48. package/src/defaults/entry.server.ssr.tsx +10 -0
  49. package/src/defaults/runtime/contentRevalidation.ts +9 -3
  50. package/src/defaults/runtime/createCachedFetcher.ts +45 -10
  51. package/src/defaults/runtime/defineServerEntry.tsx +26 -28
  52. package/src/defaults/runtime/defineSiteHooks.ts +42 -25
  53. package/src/defaults/runtime/renderCancellation.ts +10 -0
  54. package/src/types/ISRConfig.ts +4 -0
  55. package/dist/abVariantContext-BNInoflb.js.map +0 -1
  56. package/dist/contentRevalidation-D3SZwwbX.js.map +0 -1
  57. package/dist/createCachedFetcher-Y7zbGgjb.js.map +0 -1
  58. package/dist/createISRApp-DA3-5Ezk.js.map +0 -1
@@ -1,13 +1,16 @@
1
1
  /** Data and response cache scopes to invalidate after a content write commits. */
2
2
  export interface ContentRevalidationOptions {
3
+ /** Exact site paths, including any locale prefix. */
3
4
  paths?: readonly string[];
5
+ /** Business pathnames expanded using the runtime's routing config and the supplied locales. */
6
+ localizedPaths?: readonly string[];
4
7
  tags?: readonly string[];
5
8
  locales?: readonly string[];
6
9
  sitemap?: boolean;
7
10
  }
8
11
  export interface ContentPublication {
9
12
  id: string;
10
- scopes: Readonly<Required<ContentRevalidationOptions>>;
13
+ scopes: Readonly<Omit<Required<ContentRevalidationOptions>, 'localizedPaths'>>;
11
14
  }
12
15
  type ContentInvalidation = ContentPublication['scopes'] & {
13
16
  allPageMetadata?: true;
@@ -18,6 +21,6 @@ export declare function registerContentInvalidator(invalidate: ContentInvalidato
18
21
  }): () => void;
19
22
  /** The default scope recovers page metadata after a missed Redis notification. */
20
23
  export declare function invalidateContentCaches(scopes?: ContentInvalidation): void;
21
- export declare function normalizeContentScopes(input: unknown): ContentPublication['scopes'];
24
+ export declare function normalizeContentScopes(input: unknown): ContentPublication['scopes'] & Pick<ContentRevalidationOptions, 'localizedPaths'>;
22
25
  export {};
23
26
  //# sourceMappingURL=contentRevalidation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contentRevalidation.d.ts","sourceRoot":"","sources":["../../../src/defaults/runtime/contentRevalidation.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;CACxD;AAED,KAAK,mBAAmB,GAAG,k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E,IAAY,EAAE;;CAAK,GACpB,MAAM,IAAI,CAUZ;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CACrC,MAAM,GAAE,mBAMP,GACA,IAAI,CAiBN;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,kBAAkB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAyBnF"}
@@ -2,13 +2,17 @@ export interface CachedFetcherOptions<TArg, TValue> {
2
2
  /** 从入参生成缓存 key */
3
3
  key: (arg: TArg) => string;
4
4
  /** 实际加载逻辑(network / fs / dynamic import 都可) */
5
- fetch: (arg: TArg) => Promise<TValue>;
5
+ fetch: (arg: TArg, markDegraded?: () => void) => Promise<TValue>;
6
6
  /** 缓存 TTL(毫秒),默认 60s */
7
7
  ttl?: number;
8
8
  /** LRU 容量,默认 500 */
9
9
  max?: number;
10
10
  /** 启用 stale-while-revalidate:过期仍返回旧值,后台异步刷新(默认 false) */
11
11
  swr?: boolean;
12
+ /** Maximum time after expiry to reuse the last successful value on refresh errors. */
13
+ staleIfErrorMs?: number;
14
+ /** Called in each consumer's context when it receives a stale or degraded result. */
15
+ onDegraded?: () => void;
12
16
  /** 拉取失败时的回退值(如不提供则抛错) */
13
17
  fallback?: (arg: TArg, error: unknown) => TValue | Promise<TValue>;
14
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createCachedFetcher.d.ts","sourceRoot":"","sources":["../../../src/defaults/runtime/createCachedFetcher.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,oBAAoB,CAAC,IAAI,EAAE,MAAM;IAChD,kBAAkB;IAClB,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oBAAo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AAQ,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpE;AAaD,MAAM,MAAM,aAAa,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEzE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAC9C,IAAI,EAAE,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,GACvC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG;IAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,OAAO,GAAG,IAAI,CAAA;CAAE,CAsFtF"}
@@ -3,11 +3,13 @@ import type { DynamicSeoResolver, ISRConfig } from '../../types';
3
3
  import { type I18nConfig } from '../../runtime/i18n';
4
4
  export { getCookieHeader, parseCookieHeader, readCookie } from '../../utils/cookie';
5
5
  export type SiteRuntimeConfig = ISRConfig['runtime'];
6
+ declare const MARK_METADATA_DEGRADED: unique symbol;
6
7
  export interface SiteRuntimeContext {
7
8
  runtime: SiteRuntimeConfig;
8
9
  services: RuntimeServices;
9
10
  telemetry?: string;
10
11
  site?: string;
12
+ [MARK_METADATA_DEGRADED]?: () => void;
11
13
  }
12
14
  export interface RuntimeServices {
13
15
  api?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"defineSiteHooks.d.ts","sourceRoot":"","sources":["../../../src/defaults/runtime/defineSiteHooks.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EAGV,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU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AC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxD,WAAW,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3D,OAAO,EAAE,CACP,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACtC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,mEAAmE;IACnE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,iBAAiB,CAAC;CACxE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,CAE1E;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EACxD,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,iBAAiB,GACzB,CAAC,CA4DH"}
@@ -1,6 +1,6 @@
1
1
  import { i as resolveI18nConfig, n as negotiateLocale, r as parseLocale, s as trimTrailingSlashes } from "../../i18n-BZpAOZeO.js";
2
- import { a as getCookieHeader, i as readLocalePreference, l as contentPathname, o as parseCookieHeader, s as readCookie, t as createCachedFetcher } from "../../createCachedFetcher-Y7zbGgjb.js";
3
- import { r as registerContentInvalidator } from "../../contentRevalidation-D3SZwwbX.js";
2
+ import { a as getCookieHeader, i as readLocalePreference, l as contentPathname, o as parseCookieHeader, s as readCookie, t as createCachedFetcher } from "../../createCachedFetcher-CgJscexq.js";
3
+ import { a as registerContentInvalidator, n as markUncacheable } from "../../CacheTagContext-Btmq8KCD.js";
4
4
  // src/defaults/runtime/defineSiteHooks.ts
5
5
  /**
6
6
  * defineSiteHooks —— 高阶 FaaS hooks 工厂(声明式配置 → 完整 ServerEntryHooks)
@@ -35,6 +35,7 @@ import { r as registerContentInvalidator } from "../../contentRevalidation-D3SZw
35
35
  * });
36
36
  */
37
37
  var CONTENT_INVALIDATOR = Symbol("contentInvalidator");
38
+ var MARK_METADATA_DEGRADED = Symbol("markMetadataDegraded");
38
39
  function createEmptyRuntimeConfig() {
39
40
  return {
40
41
  site: void 0,
@@ -85,7 +86,7 @@ function createAdminIntlLoader(options = {}) {
85
86
  return async (locale, ctx) => {
86
87
  const normalizedLocale = supportedLocales.length && defaultLocale ? matchConfiguredLocale(locale, supportedLocales) ?? defaultLocale : locale;
87
88
  const remoteUrl = resolveAdminUrl(endpoint, { locale: normalizedLocale }, ctx);
88
- const remoteMessages = extractIntlMessagesOrNull(remoteUrl ? await fetchJsonWithTimeout(remoteUrl, options.timeoutMs) : null);
89
+ const remoteMessages = extractIntlMessagesOrNull(remoteUrl ? await fetchMetadataJson(remoteUrl, options.timeoutMs, ctx[MARK_METADATA_DEGRADED]) : null);
89
90
  const localMessages = fallbackMessages[normalizedLocale] ?? (defaultLocale ? fallbackMessages[defaultLocale] : void 0) ?? {};
90
91
  return {
91
92
  locale: normalizedLocale,
@@ -108,7 +109,7 @@ function createAdminSeoLoader(options = {}) {
108
109
  ...params,
109
110
  pathname
110
111
  }, ctx);
111
- const remoteMeta = extractSeoMetaOrNull(remoteUrl ? await fetchJsonWithTimeout(remoteUrl, options.timeoutMs) : null);
112
+ const remoteMeta = extractSeoMetaOrNull(remoteUrl ? await fetchMetadataJson(remoteUrl, options.timeoutMs, ctx[MARK_METADATA_DEGRADED]) : null);
112
113
  if (remoteMeta) return remoteMeta;
113
114
  if (compiledResolvers.length > 0) for (const compiled of compiledResolvers) {
114
115
  const m = pathname.match(compiled.re);
@@ -126,6 +127,7 @@ function createAdminSeoLoader(options = {}) {
126
127
  });
127
128
  if (result) return result;
128
129
  } catch (err) {
130
+ ctx[MARK_METADATA_DEGRADED]?.();
129
131
  console.warn("[seo] dynamic resolver threw, falling through to fallback", err);
130
132
  }
131
133
  }
@@ -236,16 +238,11 @@ function createSiteHooks(config, runtime) {
236
238
  telemetry: services.telemetry,
237
239
  site: site || void 0
238
240
  };
239
- const fetchJson = async (path, baseUrl) => {
240
- try {
241
- if (!baseUrl) return null;
242
- const r = await fetch(baseUrl + path);
243
- if (!r.ok) return null;
244
- return await r.json();
245
- } catch {
246
- return null;
247
- }
248
- };
241
+ const metadataContext = (markDegraded) => ({
242
+ ...runtimeCtx,
243
+ [MARK_METADATA_DEGRADED]: markDegraded
244
+ });
245
+ const fetchJson = (path, markDegraded) => api ? fetchMetadataJson(api + path, null, markDegraded) : Promise.resolve(null);
249
246
  const runtimeLocale = runtime.i18n;
250
247
  const rememberLocale = runtimeLocale?.prefixDefault && runtimeLocale.rememberLocale;
251
248
  const intlCfg = rememberLocale ? {
@@ -279,15 +276,16 @@ function createSiteHooks(config, runtime) {
279
276
  key: (locale) => `intl:${locale}`,
280
277
  ttl: intlCfg.ttl ?? 6e4,
281
278
  swr: true,
282
- fetch: async (locale) => {
283
- if (intlCfg.load) return await intlCfg.load(locale, runtimeCtx) ?? {
279
+ onDegraded: markUncacheable,
280
+ fetch: async (locale, markDegraded) => {
281
+ if (intlCfg.load) return await intlCfg.load(locale, metadataContext(markDegraded)) ?? {
284
282
  locale,
285
283
  messages: {},
286
284
  direction: rtlOf(locale)
287
285
  };
288
286
  if (intlCfg.endpoint) {
289
287
  const url = fillTemplate(intlCfg.endpoint, { locale });
290
- const json = await fetchJson(url, services.api);
288
+ const json = await fetchJson(url, markDegraded);
291
289
  if (json !== null && intlCfg.transform) {
292
290
  const transformed = await intlCfg.transform(json, locale);
293
291
  if (transformed) return {
@@ -333,8 +331,9 @@ function createSiteHooks(config, runtime) {
333
331
  const cache = createCachedFetcher({
334
332
  key: (request) => JSON.stringify(request),
335
333
  ttl: remote.ttl ?? 3e5,
336
- fetch: async ({ params }) => {
337
- const data = await fetchJson(fillTemplate(remote.endpoint, params), services.api);
334
+ onDegraded: markUncacheable,
335
+ fetch: async ({ params }, markDegraded) => {
336
+ const data = await fetchJson(fillTemplate(remote.endpoint, params), markDegraded);
338
337
  if (data === null) return null;
339
338
  return remote.transform(data, { ...params });
340
339
  },
@@ -353,7 +352,8 @@ function createSiteHooks(config, runtime) {
353
352
  const cache = createCachedFetcher({
354
353
  key: (request) => JSON.stringify(request),
355
354
  ttl: local.ttl ?? 3e5,
356
- fetch: async ({ params }) => local.load({ ...params }, runtimeCtx),
355
+ onDegraded: markUncacheable,
356
+ fetch: async ({ params }, markDegraded) => local.load({ ...params }, metadataContext(markDegraded)),
357
357
  fallback: () => null
358
358
  });
359
359
  seoCaches.push(cache);
@@ -582,15 +582,21 @@ function createServerReportId() {
582
582
  return null;
583
583
  }
584
584
  }
585
- async function fetchJsonWithTimeout(url, timeoutMs = 1200) {
585
+ async function fetchMetadataJson(url, timeoutMs = 1200, markDegraded) {
586
586
  try {
587
- const response = await fetch(url, {
587
+ const response = timeoutMs === null ? await fetch(url) : await fetch(url, {
588
588
  headers: { Accept: "application/json" },
589
589
  signal: timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : void 0
590
590
  });
591
- if (!response.ok) return null;
591
+ if (!response.ok) {
592
+ if (response.status !== 404) markDegraded?.();
593
+ response.body?.cancel().catch(() => void 0);
594
+ return null;
595
+ }
596
+ if (response.status === 204) return null;
592
597
  return await response.json();
593
598
  } catch {
599
+ markDegraded?.();
594
600
  return null;
595
601
  }
596
602
  }
@@ -1 +1 @@
1
- {"version":3,"file":"defineSiteHooks.js","names":[],"sources":["../../../src/defaults/runtime/defineSiteHooks.ts"],"sourcesContent":["/**\n * defineSiteHooks —— 高阶 FaaS hooks 工厂(声明式配置 → 完整 ServerEntryHooks)\n *\n * 让用户的 src/entry.server.tsx 收紧到「只写请求期 hooks」。\n * 部署/平台配置(api/site/redis/experiments/i18n/seo/telemetry)放\n * ssr.config.ts 的 runtime 字段;entry.server.tsx 只保留 beforeRequest / onError。\n * 注:experiments 是 experimentation platform 的通用字段名,业务侧可理解为 A/B testing。\n * 内部固化:\n * - i18n 字典缓存(createCachedFetcher: TTL/SWR/dedup/fallback)\n * - SEO 路由表 pattern → resolver\n * - locale 检测(cookie → Accept-Language → 默认)\n * - i18n/seo 远端相对 endpoint 统一使用 runtime.services.api\n * - 服务端渲染错误打印 + runtime.telemetry errors endpoint 上报\n *\n * beforeRequest 的边界:\n * - 它在每次 HTTP/RSC 请求进入渲染前执行。\n * - 返回值会合并进 RequestContext,Server Component 用 getRequestContext() 读取。\n * - 适合放 userId / tenantId / requestSegment 这类请求现场字段。\n * - 不适合放 Redis、SEO、i18n、A/B 定义、慢 API 或数据库查询。\n * - A/B variant 由 runtime.experiments + engine middleware 注入,页面用 getVariant()。\n *\n * 用户态写法(商业项目推荐):\n * import { defineAdminSiteHooks } from 'isr-engine/site-hooks';\n *\n * export default defineAdminSiteHooks({\n * beforeRequest: req => ({\n * userId: req.headers.get('x-user-id') ?? undefined,\n * tenantId: req.headers.get('x-tenant-id') ?? 'public',\n * requestSegment: req.headers.get('x-segment') ?? 'default',\n * }),\n * });\n */\nimport { trimTrailingSlashes } from '../../utils/trimTrailingSlashes';\nimport { contentPathname, RSC_URL_POSTFIX } from '../../utils/isrPath';\nimport { createCachedFetcher } from './createCachedFetcher';\nimport { registerContentInvalidator } from './contentRevalidation';\nimport type { IntlPayload, PageSeoMeta } from './seo-runtime';\nimport type {\n DynamicSeoResolver,\n ISRConfig,\n RuntimeI18nConfig,\n RuntimeSeoConfig,\n} from '../../types';\nimport { readCookie } from '../../utils/cookie';\nimport {\n negotiateLocale,\n parseLocale,\n resolveI18nConfig,\n type I18nConfig,\n} from '../../runtime/i18n';\nimport { readLocalePreference } from '../../runtime/localePreference';\n\nexport { getCookieHeader, parseCookieHeader, readCookie } from '../../utils/cookie';\n\nexport type SiteRuntimeConfig = ISRConfig['runtime'];\n\nconst CONTENT_INVALIDATOR = Symbol('contentInvalidator');\n\nexport interface SiteRuntimeContext {\n runtime: SiteRuntimeConfig;\n services: RuntimeServices;\n telemetry?: string;\n site?: string;\n}\n\nexport interface RuntimeServices {\n api?: string;\n telemetry?: string;\n}\n\nfunction createEmptyRuntimeConfig(): SiteRuntimeConfig {\n return {\n site: undefined,\n services: { api: undefined, telemetry: undefined },\n redis: undefined,\n experiments: {},\n i18n: undefined,\n seo: undefined,\n telemetry: false,\n };\n}\n\nexport type RuntimeServiceBase = string | ((ctx: SiteRuntimeContext) => string | null | undefined);\n\nexport type IntlMessagesByLocale = Record<string, Record<string, unknown>>;\n\nexport interface CreateAdminIntlLoaderOptions {\n /** 远端字典端点;相对路径会用 runtime.services.api 拼接 */\n endpoint?: string;\n /** 本地兜底字典,通常来自 ssr.config.ts runtime.i18n.fallbackLocal */\n fallbackMessages?: IntlMessagesByLocale;\n /** 远端和本地都无法命中时使用的 locale */\n defaultLocale?: string;\n /** 远端请求超时,默认 1200ms */\n timeoutMs?: number;\n /** 响应头 / dev inspector 里显示的远端来源名 */\n remoteSource?: string;\n /** 响应头 / dev inspector 里显示的 fallback 来源名 */\n fallbackSource?: string;\n}\n\nexport interface AdminSeoFallbackEntry extends PageSeoMeta {\n path: string;\n group?: string;\n}\n\nexport interface CreateAdminSeoLoaderOptions {\n /** 远端 SEO 端点;支持 {pathname} 和路由 params 占位符 */\n endpoint?: string;\n /** 本地兜底 SEO 条目,通常来自 ssr.config.ts runtime.seo.fallbackLocal */\n fallbackEntries?: readonly AdminSeoFallbackEntry[];\n /** 远端请求超时,默认 1200ms */\n timeoutMs?: number;\n /**\n * 参数化路径解析器;admin endpoint 没命中且 fallback 也没命中时按 pattern 匹配\n * 调一个用户函数。让业务页面零 SEO 代码,所有动态 SEO 集中在 ssr.config.ts。\n */\n dynamicResolvers?: readonly DynamicSeoResolver[];\n}\n\nexport interface DefineAdminSiteHooksOptions {\n i18n?: {\n locales?: readonly string[];\n defaultLocale?: string;\n endpoint?: string;\n ttl?: number;\n prefixDefault?: boolean;\n detect?: IntlConfig['detect'];\n fallbackLocal?: IntlMessagesByLocale;\n timeoutMs?: number;\n remoteSource?: string;\n fallbackSource?: string;\n };\n seo?: {\n endpoint?: string;\n ttl?: number;\n fallbackLocal?: readonly Record<string, unknown>[];\n timeoutMs?: number;\n /** 参数化路径的 SEO 解析器(参考 RuntimeSeoConfig.dynamicResolvers)。 */\n dynamicResolvers?: readonly DynamicSeoResolver[];\n };\n beforeRequest?: SiteHooksConfig['beforeRequest'];\n onError?: SiteHooksConfig['onError'];\n headExtras?: SiteHooksConfig['headExtras'];\n}\n\nexport interface IntlConfig extends Partial<I18nConfig> {\n // ─── 翻译消息加载层(被 SEO/Header 等消费)─────────────────────\n /** 远程 endpoint;`{locale}` 占位符自动替换 */\n endpoint?: string;\n /** 远端响应适配器;支持 admin manifest / SaaS CMS 等非标准响应 */\n transform?: (\n data: unknown,\n locale: string\n ) => IntlPayload | null | undefined | Promise<IntlPayload | null | undefined>;\n /** 本地或自定义加载器;与 endpoint 互斥(优先级更高) */\n load?: (locale: string, ctx: SiteRuntimeContext) => Promise<IntlPayload | null>;\n /** locale 检测(默认:URL locale → cookie `locale` → Accept-Language → defaultLocale) */\n detect?: (req: Request) => string;\n /** 缓存 TTL 毫秒,默认 60_000 */\n ttl?: number;\n}\n\n/** 仅静态值,无远程拉取(PageSeoMeta 直接复用,无需扩展) */\nexport type SeoStaticEntry = PageSeoMeta;\n\nexport interface SeoRemoteEntry<T = unknown> {\n /** 远程 endpoint;`{paramName}` 占位符自动替换为路由捕获组 */\n endpoint: string;\n /** 把远程响应转成 PageSeoMeta */\n transform: (data: T, params: Record<string, string>) => PageSeoMeta | null;\n /** 缓存 TTL 毫秒,默认 300_000(5 分钟) */\n ttl?: number;\n}\n\nexport interface SeoLocalEntry {\n /** 本地加载器:dynamic import / fs.readFile / 内存 Map 都可 */\n load: (\n params: Record<string, string>,\n ctx: SiteRuntimeContext\n ) => Promise<PageSeoMeta | null> | PageSeoMeta | null;\n /** 缓存 TTL 毫秒,默认 300_000 */\n ttl?: number;\n}\n\nexport type SeoEntry = SeoStaticEntry | SeoRemoteEntry | SeoLocalEntry;\n\nexport interface SiteHooksConfig {\n /** i18n 配置 */\n intl?: IntlConfig;\n /** SEO 路由表:path pattern(支持 `:param`)→ 静态 meta 或 remote loader */\n seo?: Record<string, SeoEntry | (() => Promise<PageSeoMeta | null> | PageSeoMeta | null)>;\n /**\n * 错误回调。平台默认会先执行 console + runtime.telemetry errors endpoint 上报;\n * 自定义 onError 作为业务补充回调追加执行,不会关闭平台默认上报。\n */\n onError?: (\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string }\n ) => void | Promise<void>;\n /**\n * 请求级 ctx 扩展(除 engine 基线字段 + locale 之外的业务字段)。\n *\n * 典型用途:userId、tenantId、requestSegment、审计字段。\n * 返回值会合并进 RequestContext;Server Component 使用\n * `getRequestContext()` 读取,Client Component 需要由 Server Component\n * 作为 props 传入。\n *\n * 注意:\n * - 这里处在首屏关键路径上,应只做 header/cookie 解析。\n * - 不要在这里查数据库或慢 API。\n * - 不要在这里解析 A/B cookie;页面用 `getVariant()`。\n */\n beforeRequest?: (req: Request) => Record<string, unknown> | Promise<Record<string, unknown>>;\n /**\n * 注入到 `<head>` 末尾(`</head>` 之前)的 raw HTML 字符串。\n *\n * 通过 SSR HTML stream transformer 注入,**完全脱离 React 树** —— 不进 client RSC\n * payload,不触发 React 19 + plugin-rsc 的 head children mismatch hydration 错误。\n *\n * 典型用途:\n * - 主题 init inline blocking script(避免 FOUC,next-themes 同款)\n * - GA / GTM snippet\n * - A/B variant flag injection\n * - CSP nonce / preload hints\n *\n * 业务侧返回完整的标签 HTML(含 `<script>` / `<style>` / `<meta>` 外壳)。返回\n * 空字符串 / undefined 时跳过注入。\n *\n * ctx.nonce:当前请求的 CSP nonce(engine 自动注入)。业务侧的 inline `<script>`\n * 必须带上 nonce 属性,否则被 nonce-based CSP 阻断:\n *\n * ```ts\n * import { THEME_INIT_SCRIPT } from '@app/ui/theme-utils';\n *\n * defineAdminSiteHooks({\n * headExtras: ({ nonce }) =>\n * `<script${nonce ? ` nonce=\"${nonce}\"` : ''}>${THEME_INIT_SCRIPT}</script>`,\n * });\n * ```\n */\n headExtras?: (ctx: { nonce?: string }) => string | undefined;\n}\n\ninterface CompiledSeoPattern {\n re: RegExp;\n paramNames: string[];\n}\n\ninterface SeoRouteRequest {\n pathname: string;\n locale: string;\n params: Record<string, string>;\n}\n\ninterface CompiledRoute extends CompiledSeoPattern {\n resolver: (request: SeoRouteRequest) => Promise<PageSeoMeta | null> | PageSeoMeta | null;\n}\n\nfunction escapeSeoPatternLiteral(literal: string): string {\n return literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Both SEO entry points recognize named parameters and a terminal /* before escaping literals. */\nfunction compileSeoPattern(pattern: string, captureWildcard = false): CompiledSeoPattern {\n const paramNames: string[] = [];\n const wildcard = pattern.endsWith('/*');\n const base = wildcard ? pattern.slice(0, -2) : pattern;\n let cursor = 0;\n let source = '';\n for (const match of base.matchAll(/:(\\w+)/g)) {\n source += escapeSeoPatternLiteral(base.slice(cursor, match.index)) + '([^/]+)';\n paramNames.push(match[1]);\n cursor = match.index + match[0].length;\n }\n source += escapeSeoPatternLiteral(base.slice(cursor));\n\n if (wildcard) {\n if (captureWildcard) paramNames.push('wildcard');\n source += captureWildcard ? '(?:/(.*))?' : '(?:/.*)?';\n }\n return { re: new RegExp(`^${source}$`), paramNames };\n}\n\nfunction fillTemplate(template: string, vars: Record<string, string>): string {\n return template.replace(/\\{(\\w+)\\}/g, (_, k) => encodeURIComponent(vars[k] ?? ''));\n}\n\nexport function createAdminIntlLoader(\n options: CreateAdminIntlLoaderOptions = {}\n): NonNullable<IntlConfig['load']> {\n const endpoint = options.endpoint ?? '/api/i18n/{locale}/manifest';\n const fallbackMessages = options.fallbackMessages ?? {};\n const defaultLocale = options.defaultLocale;\n const supportedLocales = Object.keys(fallbackMessages);\n\n return async (locale, ctx) => {\n const normalizedLocale =\n supportedLocales.length && defaultLocale\n ? (matchConfiguredLocale(locale, supportedLocales) ?? defaultLocale)\n : locale;\n const remoteUrl = resolveAdminUrl(endpoint, { locale: normalizedLocale }, ctx);\n const remote = remoteUrl\n ? await fetchJsonWithTimeout<unknown>(remoteUrl, options.timeoutMs)\n : null;\n const remoteMessages = extractIntlMessagesOrNull(remote);\n const localMessages =\n fallbackMessages[normalizedLocale] ??\n (defaultLocale ? fallbackMessages[defaultLocale] : undefined) ??\n {};\n const messages = remoteMessages ?? normalizeMessages(localMessages);\n\n return {\n locale: normalizedLocale,\n messages,\n direction: rtlOf(normalizedLocale),\n source: remoteMessages\n ? (options.remoteSource ?? 'remote')\n : (options.fallbackSource ?? 'local-fallback'),\n };\n };\n}\n\nexport function createAdminSeoLoader(\n options: CreateAdminSeoLoaderOptions = {}\n): SeoLocalEntry['load'] {\n const endpoint = options.endpoint ?? '/api/seo?path={pathname}';\n const fallbackEntries = options.fallbackEntries ?? [];\n // 编译一次 + 缓存。N 个 resolver 在每个请求里只是 N 次正则 test,cost 可忽略。\n const compiledResolvers = (options.dynamicResolvers ?? []).map(resolver => ({\n ...compileSeoPattern(resolver.pattern, true),\n resolver,\n }));\n\n return async (params, ctx) => {\n const pathname = normalizePathname(params.pathname || '/');\n\n // 1. admin endpoint —— 运营在 dashboard 给具体 path 配过的覆盖优先级最高\n const remoteUrl = resolveAdminUrl(endpoint, { ...params, pathname }, ctx);\n const remote = remoteUrl\n ? await fetchJsonWithTimeout<unknown>(remoteUrl, options.timeoutMs)\n : null;\n const remoteMeta = extractSeoMetaOrNull(remote);\n if (remoteMeta) return remoteMeta;\n\n // 2. dynamic resolvers —— 参数化路径的请求期数据驱动\n if (compiledResolvers.length > 0) {\n for (const compiled of compiledResolvers) {\n const m = pathname.match(compiled.re);\n if (!m) continue;\n const resolverParams: Record<string, string> = {};\n compiled.paramNames.forEach((name, i) => {\n resolverParams[name] = m[i + 1] ?? '';\n });\n try {\n const result = await compiled.resolver.resolve({\n pathname,\n params: resolverParams,\n locale: typeof params.locale === 'string' ? params.locale : undefined,\n services: ctx.services,\n });\n if (result) return result as PageSeoMeta;\n } catch (err) {\n // resolver 抛错不阻塞渲染:业务异常时把 SEO 当 null 处理\n console.warn('[seo] dynamic resolver threw, falling through to fallback', err);\n }\n // 同 pattern 没命中数据就继续找下一个 resolver / fallback;不退出。\n // 例:/books/:id 解析失败时,可能匹配了更宽的 /:scope/:id resolver 兜底。\n }\n }\n\n // 3. fallbackLocal —— build 期冻结的兜底\n const fallback = fallbackEntries.find(entry => normalizePathname(entry.path) === pathname);\n if (!fallback) return null;\n const meta = { ...fallback } as Record<string, unknown>;\n delete meta.path;\n delete meta.group;\n return meta as PageSeoMeta;\n };\n}\n\nexport function defineAdminSiteHooks(options: DefineAdminSiteHooksOptions = {}): ServerHooksOutput {\n return createAdminSiteHooks(options, createEmptyRuntimeConfig());\n}\n\nfunction createAdminSeoEntry(\n seo: NonNullable<DefineAdminSiteHooksOptions['seo']>,\n runtimeSeo: Partial<RuntimeSeoConfig>\n): SeoLocalEntry {\n return {\n load: createAdminSeoLoader({\n endpoint: seo.endpoint ?? runtimeSeo.endpoint,\n fallbackEntries: normalizeAdminSeoFallbackEntries(\n seo.fallbackLocal ?? runtimeSeo.fallbackLocal\n ),\n timeoutMs: seo.timeoutMs ?? runtimeSeo.timeoutMs,\n dynamicResolvers: seo.dynamicResolvers ?? runtimeSeo.dynamicResolvers,\n }),\n ttl: seo.ttl ?? runtimeSeo.ttl ?? 60_000,\n };\n}\n\nfunction createAdminSiteHooks(\n options: DefineAdminSiteHooksOptions,\n runtime: SiteRuntimeConfig\n): ServerHooksOutput {\n const runtimeI18n: Partial<RuntimeI18nConfig> = runtime.i18n ?? {};\n const runtimeSeo: Partial<RuntimeSeoConfig> = runtime.seo ?? {};\n const i18n = options.i18n ?? {};\n const seo = options.seo ?? {};\n const fallbackMessages = i18n.fallbackLocal ?? runtimeI18n.fallbackLocal ?? {};\n const locales =\n i18n.locales ??\n runtimeI18n.locales ??\n (Object.keys(fallbackMessages).length > 0 ? Object.keys(fallbackMessages) : ['en']);\n const defaultLocale = i18n.defaultLocale ?? runtimeI18n.defaultLocale ?? locales[0] ?? 'en';\n\n const output = createSiteHooks(\n {\n beforeRequest: options.beforeRequest,\n onError: options.onError,\n headExtras: options.headExtras,\n intl: {\n locales,\n defaultLocale,\n prefixDefault: i18n.prefixDefault ?? runtimeI18n.prefixDefault,\n detect: i18n.detect,\n load: createAdminIntlLoader({\n endpoint: i18n.endpoint ?? runtimeI18n.endpoint,\n fallbackMessages,\n defaultLocale,\n timeoutMs: i18n.timeoutMs ?? runtimeI18n.timeoutMs,\n remoteSource: i18n.remoteSource ?? runtimeI18n.remoteSource,\n fallbackSource: i18n.fallbackSource ?? runtimeI18n.fallbackSource,\n }),\n ttl: i18n.ttl ?? runtimeI18n.ttl ?? 60_000,\n },\n seo: {\n '/*': createAdminSeoEntry(seo, runtimeSeo),\n },\n },\n runtime\n );\n Object.defineProperty(output, '__configureRuntime', {\n enumerable: false,\n configurable: true,\n value: (nextRuntime: SiteRuntimeConfig) => createAdminSiteHooks(options, nextRuntime),\n });\n return output;\n}\n\nexport interface ServerHooksOutput {\n /** site URL —— SEO 注入时把 image/canonical 等相对路径解析为绝对 URL */\n siteBaseUrl?: string;\n /** 浏览器可访问的 API base —— 注入到 csr-shell 的 window.__API_BASE__ */\n apiBaseUrl?: string;\n /**\n * 原始 intl 配置(用户在 defineSiteHooks 里写的那份),透传出来给 app.tsx 的 parseLocale 用\n * —— 让 i18n 配置只声明一次,不需要单独 i18n.config.ts\n */\n intl?: IntlConfig;\n beforeRequest: (\n req: Request,\n engineCtx: { traceId: string; startedAt: number }\n ) => Promise<Record<string, unknown>>;\n loadIntl: (req: Request) => Promise<IntlPayload | null>;\n loadSeoMeta: (req: Request) => Promise<PageSeoMeta | null>;\n onError: (\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string }\n ) => void | Promise<void>;\n /** 注入 `<head>` 末尾的 raw HTML —— 详见 SiteHooksConfig.headExtras 注释 */\n headExtras?: (ctx: { nonce?: string }) => string | undefined;\n __configureRuntime?: (runtime: SiteRuntimeConfig) => ServerHooksOutput;\n}\n\nexport function defineSiteHooks(config: SiteHooksConfig): ServerHooksOutput {\n return createSiteHooks(config, createEmptyRuntimeConfig());\n}\n\nexport function applyRuntimeToServerHooks<T extends object>(\n hooks: T,\n runtime: SiteRuntimeConfig\n): T {\n const maybeRuntimeAware = hooks as T & {\n __configureRuntime?: (runtime: SiteRuntimeConfig) => T;\n };\n if (typeof maybeRuntimeAware.__configureRuntime === 'function') {\n return maybeRuntimeAware.__configureRuntime(runtime);\n }\n const baseHooks = hooks as T & {\n siteBaseUrl?: string;\n apiBaseUrl?: string;\n intl?: unknown;\n loadIntl?: unknown;\n loadSeoMeta?: unknown;\n beforeRequest?: SiteHooksConfig['beforeRequest'];\n onError?: SiteHooksConfig['onError'];\n };\n const services = resolveRuntimeServices(runtime);\n const siteBaseUrl = baseHooks.siteBaseUrl ?? runtime.site;\n const apiBaseUrl = baseHooks.apiBaseUrl ?? services.api;\n const hasUserContentHooks =\n !!baseHooks.intl ||\n typeof baseHooks.loadIntl === 'function' ||\n typeof baseHooks.loadSeoMeta === 'function';\n\n if (!hasUserContentHooks && hasRuntimeContentConfig(runtime)) {\n const runtimeHooks = createAdminSiteHooks(\n {\n beforeRequest: baseHooks.beforeRequest,\n onError: baseHooks.onError,\n },\n runtime\n );\n return {\n ...hooks,\n siteBaseUrl,\n apiBaseUrl,\n intl: runtimeHooks.intl,\n beforeRequest: runtimeHooks.beforeRequest,\n loadIntl: runtimeHooks.loadIntl,\n loadSeoMeta: runtimeHooks.loadSeoMeta,\n onError: runtimeHooks.onError,\n } as T;\n }\n\n // A dynamic SEO table on its own does not opt a plain server entry into the admin i18n\n // loader or wrap its beforeRequest callback.\n const runtimeSeo = runtime.seo;\n const runtimeSeoHook =\n !hasUserContentHooks && runtimeSeo?.dynamicResolvers?.length\n ? createSiteHooks(\n { intl: runtime.i18n, seo: { '/*': createAdminSeoEntry({}, runtimeSeo) } },\n runtime\n ).loadSeoMeta\n : undefined;\n return {\n ...hooks,\n siteBaseUrl,\n apiBaseUrl,\n ...(runtimeSeoHook && { loadSeoMeta: runtimeSeoHook }),\n } as T;\n}\n\nfunction createSiteHooks(config: SiteHooksConfig, runtime: SiteRuntimeConfig): ServerHooksOutput {\n const services = resolveRuntimeServices(runtime);\n const api = services.api ?? '';\n const site = runtime.site ?? '';\n const runtimeCtx: SiteRuntimeContext = {\n runtime,\n services,\n telemetry: services.telemetry,\n site: site || undefined,\n };\n const fetchJson = async (path: string, baseUrl?: string): Promise<unknown> => {\n try {\n if (!baseUrl) return null;\n const r = await fetch(baseUrl + path);\n if (!r.ok) return null;\n return await r.json();\n } catch {\n return null;\n }\n };\n\n // ─── i18n 缓存(一次创建,请求级复用)──────────────\n const runtimeLocale = runtime.i18n;\n const rememberLocale = runtimeLocale?.prefixDefault && runtimeLocale.rememberLocale;\n const intlCfg = rememberLocale\n ? { ...config.intl, ...resolveI18nConfig(runtimeLocale) }\n : (config.intl ?? {});\n const supportedLocales = intlCfg.locales?.length ? intlCfg.locales : undefined;\n const negotiationConfig = supportedLocales\n ? resolveI18nConfig(intlCfg)\n : { locales: ['zh-CN', 'en'], defaultLocale: intlCfg.defaultLocale ?? 'zh-CN' };\n // 默认 detect 优先级(业界标准 i18n 顺序):\n // 1. URL pathname 前缀 /en-US/... → 'en-US' ← 显式路由意图,最高优先级\n // 2. engine locale preference on the unprefixed root / legacy locale cookie\n // 3. Accept-Language 头 ← 浏览器系统语言\n // 4. defaultLocale ← 兜底\n //\n // 关键:前缀路由(prefixDefault:true 等场景)下,URL 是源真值。如果不优先用\n // URL,curl /en-US 但 Accept-Language 是 zh 会被错误降级到 zh-CN,跟用户\n // 明确写在 URL 里的意图相反。\n // 业务侧可通过 intlCfg.detect 完全覆盖(任何 (req) => string 都行)。\n const detectLocale =\n intlCfg.detect ??\n ((req: Request): string => {\n // 1. URL 前缀\n if (supportedLocales) {\n try {\n const pathname = new URL(req.url).pathname;\n // 客户端 RSC 导航 URL 带 `_.rsc` 后缀(如 `/ja_.rsc`),不剥掉的话\n // 首段会变成 `ja_.rsc` 命中不了 locale,从而错误回退到 cookie /\n // Accept-Language / defaultLocale —— 这正是「切换语言必须刷新才生效」\n // 的根因(RSC 导航拿到的 intl 语言与 URL 前缀不一致)。\n const cleanPath = pathname.endsWith('_.rsc')\n ? pathname.slice(0, -'_.rsc'.length) || '/'\n : pathname;\n const first = cleanPath.split('/')[1];\n if (first && supportedLocales.includes(first)) return first;\n if (cleanPath === '/' && rememberLocale && runtimeLocale) {\n const preference = readLocalePreference(req, runtimeLocale);\n if (preference) return preference;\n }\n } catch {\n // 非法 URL(极少见,比如内部调用喂了相对路径)→ 继续后续策略\n }\n }\n // 2. cookie\n const localeCookie = readCookie(req, 'locale');\n if (localeCookie) {\n const matchedCookie = supportedLocales\n ? matchConfiguredLocale(localeCookie, supportedLocales)\n : localeCookie;\n if (matchedCookie) return matchedCookie;\n }\n // 3. Accept-Language → 4. fallbackLocale\n return negotiateLocale(req.headers.get('accept-language'), negotiationConfig);\n });\n\n const intlLoader = createCachedFetcher<string, IntlPayload>({\n key: locale => `intl:${locale}`,\n ttl: intlCfg.ttl ?? 60_000,\n swr: true,\n fetch: async locale => {\n if (intlCfg.load) {\n const r = await intlCfg.load(locale, runtimeCtx);\n return r ?? { locale, messages: {}, direction: rtlOf(locale) };\n }\n if (intlCfg.endpoint) {\n const url = fillTemplate(intlCfg.endpoint, { locale });\n const json = await fetchJson(url, services.api);\n if (json !== null && intlCfg.transform) {\n const transformed = await intlCfg.transform(json, locale);\n if (transformed) {\n return {\n ...transformed,\n direction: transformed.direction ?? rtlOf(transformed.locale),\n };\n }\n }\n return {\n locale,\n messages: extractIntlMessages(json),\n direction: rtlOf(locale),\n };\n }\n return { locale, messages: {}, direction: rtlOf(locale) };\n },\n fallback: locale => ({ locale, messages: {}, direction: rtlOf(locale) }),\n });\n\n // ─── SEO 路由表编译 + 远程 loader 缓存(每个 pattern 一份)─────\n const seoRoutes: CompiledRoute[] = [];\n const seoCaches: Array<\n ReturnType<typeof createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>>\n > = [];\n const seoLocaleConfig = supportedLocales ? resolveI18nConfig(intlCfg) : undefined;\n const seoPath = (pathname: string) =>\n seoLocaleConfig ? parseLocale(pathname, seoLocaleConfig).pathname : pathname;\n\n for (const [pattern, value] of Object.entries(config.seo ?? {})) {\n const { re, paramNames } = compileSeoPattern(pattern);\n\n if (typeof value === 'function') {\n // 自定义 resolver\n const resolve = value as (\n params: Record<string, string>\n ) => PageSeoMeta | null | Promise<PageSeoMeta | null>;\n seoRoutes.push({ re, paramNames, resolver: ({ params }) => resolve(params) });\n continue;\n }\n if ('endpoint' in value && typeof (value as SeoRemoteEntry).endpoint === 'string') {\n const remote = value as SeoRemoteEntry;\n const cache = createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>({\n key: request => JSON.stringify(request),\n ttl: remote.ttl ?? 300_000,\n fetch: async ({ params }) => {\n const data = await fetchJson(fillTemplate(remote.endpoint, params), services.api);\n if (data === null) return null;\n return remote.transform(data, { ...params });\n },\n fallback: () => null,\n });\n seoCaches.push(cache);\n seoRoutes.push({ re, paramNames, resolver: cache });\n continue;\n }\n if ('load' in value && typeof (value as SeoLocalEntry).load === 'function') {\n const local = value as SeoLocalEntry;\n const cache = createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>({\n key: request => JSON.stringify(request),\n ttl: local.ttl ?? 300_000,\n fetch: async ({ params }) => local.load({ ...params }, runtimeCtx),\n fallback: () => null,\n });\n seoCaches.push(cache);\n seoRoutes.push({ re, paramNames, resolver: cache });\n continue;\n }\n // 静态 meta\n const staticMeta = value as SeoStaticEntry;\n const withDefaults: PageSeoMeta = {\n ...staticMeta,\n canonical:\n staticMeta.canonical ??\n (site && pattern && pattern !== '/*' ? `${site}${pattern}` : staticMeta.canonical),\n };\n seoRoutes.push({ re, paramNames, resolver: () => withDefaults });\n }\n\n // ─── onError ─────\n const platformOnError = createPlatformOnError(runtime, runtimeCtx);\n const onError: ServerHooksOutput['onError'] = async (err, req, ctx) => {\n platformOnError(err, req, ctx);\n if (config.onError) {\n await config.onError(err, req, ctx);\n }\n };\n\n const output: ServerHooksOutput = {\n siteBaseUrl: site || undefined,\n apiBaseUrl: api || undefined,\n intl: rememberLocale ? intlCfg : config.intl,\n headExtras: config.headExtras,\n async beforeRequest(req, _engineCtx) {\n const locale = detectLocale(req);\n const userExt = config.beforeRequest ? await config.beforeRequest(req) : {};\n return { locale, ...userExt };\n },\n async loadIntl(req) {\n return intlLoader(detectLocale(req));\n },\n async loadSeoMeta(req) {\n const url = new URL(req.url);\n const locale = detectLocale(req);\n // 客户端 RSC 导航 fetch 的 URL 带 _.rsc 后缀(详见 defaults/runtime/request.tsx)。\n // 先剥后缀,否则 /zh-CN/books/1_.rsc 永远 match 不到 /books/:id route → seoMeta=null →\n // 客户端导航后 head 不更新。HTML 请求没这个后缀,原行为不变。\n // SEO 表是按\"业务规范路径\"('/' / '/books' / '/about')入库的,\n // 不带 locale 前缀。请求 URL 是带前缀的('/en-US/'、'/zh-CN/books'),\n // 直接喂给 admin 查不到。先用 parseLocale 把 locale 段剥掉,\n // 再去 seoRoutes 里匹配 + 调 admin endpoint。\n // locale 单独传给 resolver,支持 endpoint 模板里的 {locale}。\n const pathForRouting = url.pathname.endsWith(RSC_URL_POSTFIX)\n ? url.pathname.slice(0, -RSC_URL_POSTFIX.length) || '/'\n : url.pathname;\n const cleanPath = seoPath(pathForRouting);\n\n for (const { re, paramNames, resolver } of seoRoutes) {\n const m = cleanPath.match(re);\n if (m) {\n const params: Record<string, string> = {\n pathname: cleanPath,\n locale,\n };\n paramNames.forEach((n, i) => (params[n] = m[i + 1] ?? ''));\n return await resolver({ pathname: cleanPath, locale, params });\n }\n }\n return null;\n },\n onError,\n };\n const invalidate: Parameters<typeof registerContentInvalidator>[0] = scopes => {\n const locales = new Set(scopes.locales);\n if (scopes.allPageMetadata || locales.size) {\n intlLoader.invalidate(\n locale => !!scopes.allPageMetadata || locales.has(locale.toLowerCase())\n );\n }\n if (scopes.allPageMetadata || scopes.tags.length) {\n for (const cache of seoCaches) cache.invalidate();\n return;\n }\n if (!scopes.paths.length && !locales.size) return;\n const paths = new Set(\n scopes.paths.map(pathname => trimTrailingSlashes(seoPath(contentPathname(pathname))))\n );\n for (const cache of seoCaches) {\n cache.invalidate(\n ({ pathname, locale }) =>\n paths.has(trimTrailingSlashes(pathname)) || locales.has(locale.toLowerCase())\n );\n }\n };\n // Keep the weak listener alive when the runtime copies these hooks into a server entry.\n Object.defineProperty(output.loadIntl, CONTENT_INVALIDATOR, { value: invalidate });\n Object.defineProperty(output.loadSeoMeta, CONTENT_INVALIDATOR, { value: invalidate });\n registerContentInvalidator(invalidate, { weak: true });\n Object.defineProperty(output, '__configureRuntime', {\n enumerable: false,\n configurable: true,\n value: (nextRuntime: SiteRuntimeConfig) => createSiteHooks(config, nextRuntime),\n });\n return output;\n}\n\nfunction rtlOf(locale: string): 'ltr' | 'rtl' {\n return /^(ar|he|fa|ur)/.test(locale) ? 'rtl' : 'ltr';\n}\n\nfunction matchConfiguredLocale(\n value: string,\n supportedLocales: readonly string[]\n): string | undefined {\n const lower = value.toLowerCase();\n const exact = supportedLocales.find(locale => locale.toLowerCase() === lower);\n if (exact) return exact;\n const prefix = lower.split('-')[0];\n return supportedLocales.find(locale => locale.toLowerCase().split('-')[0] === prefix);\n}\n\nfunction extractIntlMessages(data: unknown): Record<string, unknown> {\n return extractIntlMessagesOrNull(data) ?? {};\n}\n\nfunction extractIntlMessagesOrNull(data: unknown): Record<string, unknown> | null {\n if (!data || typeof data !== 'object') return null;\n const raw = data as Record<string, unknown>;\n const dataValue = raw.data;\n const candidate =\n raw.strings ??\n raw.messages ??\n (isRecord(dataValue) && 'strings' in dataValue ? dataValue.strings : dataValue);\n if (!candidate || typeof candidate !== 'object') return null;\n return normalizeMessages(candidate as Record<string, unknown>);\n}\n\nfunction normalizeMessages(messages: Record<string, unknown>): Record<string, unknown> {\n if (isFlatRecord(messages)) {\n return expandDottedRecord(messages);\n }\n return messages;\n}\n\n/**\n * 逐层剥 envelope —— admin 在不同分支返回三种 shape:\n * - flat:`{ title, description, ... }`(admin no-locale fast path)\n * - 单层:`{ data: { title, ... } }`(旧版本)\n * - 双层:`{ status, code, data: { data: { title, ... }, version } }`\n * (api-envelope plugin 包了一层,resolvePublic 自己又是 `{ data, version }`,\n * 所以 locale-aware 路径会双层 wrap)\n *\n * 停止条件:候选对象有 `title` / `description`(SEO 形状),或没有 `data` 字段可剥。\n */\nfunction extractSeoMetaOrNull(data: unknown): PageSeoMeta | null {\n let candidate: unknown = data;\n for (let i = 0; i < 4; i++) {\n if (!isRecord(candidate)) return null;\n if ('title' in candidate || 'description' in candidate) break;\n if ('data' in candidate) {\n candidate = candidate.data;\n continue;\n }\n return null;\n }\n if (!isRecord(candidate)) return null;\n return candidate as PageSeoMeta;\n}\n\nfunction normalizeAdminSeoFallbackEntries(\n entries: readonly Record<string, unknown>[] = []\n): readonly AdminSeoFallbackEntry[] {\n return entries.filter(\n entry => typeof entry.path === 'string'\n ) as unknown as readonly AdminSeoFallbackEntry[];\n}\n\nfunction createPlatformOnError(\n runtime: SiteRuntimeConfig,\n ctx: SiteRuntimeContext\n): NonNullable<ServerHooksOutput['onError']> {\n const reportServerError = createServerErrorEndpointReporter(runtime, ctx);\n\n return (err, req, errorCtx) => {\n console.error('[onError]', {\n traceId: errorCtx.traceId,\n locale: errorCtx.locale,\n url: req.url,\n msg: err instanceof Error ? err.message : String(err),\n });\n reportServerError?.(err, req, errorCtx);\n };\n}\n\nfunction createServerErrorEndpointReporter(\n runtime: SiteRuntimeConfig,\n ctx: SiteRuntimeContext\n): ((err: unknown, req: Request, errorCtx: { traceId: string; locale?: string }) => void) | null {\n const config = runtime.telemetry;\n if (config === false || !config || config.errors === false) return null;\n\n const errors = config.errors ?? {};\n const endpoint = resolveAdminUrl(errors.endpoint ?? '/api/observability/errors', {}, ctx, {\n baseUrl: runtimeCtx => runtimeCtx.services.telemetry ?? runtimeCtx.services.api,\n });\n if (!endpoint) return null;\n\n const app = config.app ?? 'isr-engine-app';\n const release = config.release;\n const environment = config.environment;\n const includeQueryString = config.includeQueryString === true;\n\n return (err, req, errorCtx) => {\n const id = createServerReportId();\n if (!id) return;\n const report = normalizeServerErrorReport(err, req, errorCtx, {\n id,\n release,\n environment,\n includeQueryString,\n });\n\n void fetch(endpoint, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n accept: 'application/json',\n },\n body: JSON.stringify({\n app,\n sentAt: Date.now(),\n reports: [report],\n }),\n signal: typeof AbortSignal !== 'undefined' ? AbortSignal.timeout(1000) : undefined,\n }).catch(() => {\n /* 服务端错误上报不能阻断渲染兜底;失败交给进程日志和外层 adapter */\n });\n };\n}\n\nfunction normalizeServerErrorReport(\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string },\n options: {\n id: string;\n release?: string;\n environment?: string;\n includeQueryString?: boolean;\n }\n): Record<string, unknown> {\n const error = err instanceof Error ? err : null;\n const message = error?.message || String(err);\n const name = error?.name || 'Error';\n const url = safeRequestPath(req.url, options.includeQueryString);\n\n return {\n id: options.id,\n ts: Date.now(),\n level: 'error',\n message,\n name,\n stack: error?.stack,\n release: options.release,\n environment: options.environment,\n url,\n source: 'server-render',\n tags: {\n traceId: ctx.traceId,\n locale: ctx.locale,\n },\n extra: {\n method: req.method,\n pathname: url.split('?')[0] || '/',\n },\n fingerprint: ['server-render', name, message.slice(0, 160)],\n };\n}\n\nfunction safeRequestPath(rawUrl: string, includeQueryString?: boolean): string {\n try {\n const url = new URL(rawUrl);\n return includeQueryString ? `${url.pathname}${url.search}` : url.pathname;\n } catch {\n return includeQueryString ? rawUrl : '/';\n }\n}\n\nfunction createServerReportId(): string | null {\n try {\n return `srv_${crypto.randomUUID()}`;\n } catch {\n // Optional reporting must not weaken IDs or interrupt rendering without Web Crypto.\n return null;\n }\n}\n\nasync function fetchJsonWithTimeout<T>(url: string, timeoutMs = 1200): Promise<T | null> {\n try {\n const response = await fetch(url, {\n headers: { Accept: 'application/json' },\n signal: timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : undefined,\n });\n if (!response.ok) return null;\n return (await response.json()) as T;\n } catch {\n return null;\n }\n}\n\nfunction resolveAdminUrl(\n endpoint: string,\n vars: Record<string, string>,\n ctx: SiteRuntimeContext,\n options: { baseUrl?: RuntimeServiceBase } = {}\n): string | null {\n const filled = fillTemplate(endpoint, vars);\n if (/^(https?:)?\\/\\//i.test(filled)) return filled;\n const base = resolveRuntimeServiceBase(ctx, options.baseUrl);\n if (!base) return null;\n return `${trimTrailingSlashes(base)}/${filled.replace(/^\\/+/, '')}`;\n}\n\nfunction resolveRuntimeServiceBase(\n ctx: SiteRuntimeContext,\n baseUrl?: RuntimeServiceBase\n): string | null {\n if (typeof baseUrl === 'function') {\n return baseUrl(ctx) ?? null;\n }\n if (baseUrl) return baseUrl;\n return ctx.services.api ?? null;\n}\n\nfunction resolveRuntimeServices(runtime: SiteRuntimeConfig): RuntimeServices {\n const services = runtime.services ?? {};\n const api = services.api;\n return {\n api,\n telemetry: services.telemetry ?? api,\n };\n}\n\nfunction hasRuntimeContentConfig(runtime: SiteRuntimeConfig): boolean {\n return !!(\n runtime.i18n?.endpoint ||\n runtime.i18n?.fallbackLocal ||\n runtime.seo?.endpoint ||\n runtime.seo?.fallbackLocal ||\n runtime.telemetry\n );\n}\n\nfunction normalizePathname(pathname: string): string {\n if (pathname === '/') return '/';\n return trimTrailingSlashes(pathname) || '/';\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isFlatRecord(value: unknown): boolean {\n if (!value || typeof value !== 'object') return false;\n return Object.keys(value as Record<string, unknown>).some(key => key.includes('.'));\n}\n\nfunction expandDottedRecord(flat: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(flat)) {\n const parts = key.split('.');\n let cur = out;\n parts.forEach((part, index) => {\n if (index === parts.length - 1) {\n cur[part] = value;\n return;\n }\n const next = cur[part];\n if (!next || typeof next !== 'object') cur[part] = {};\n cur = cur[part] as Record<string, unknown>;\n });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,IAAM,sBAAsB,OAAO,oBAAoB;AAcvD,SAAS,2BAA8C;CACrD,OAAO;EACL,MAAM,KAAA;EACN,UAAU;GAAE,KAAK,KAAA;GAAW,WAAW,KAAA;EAAU;EACjD,OAAO,KAAA;EACP,aAAa,CAAC;EACd,MAAM,KAAA;EACN,KAAK,KAAA;EACL,WAAW;CACb;AACF;AAoLA,SAAS,wBAAwB,SAAyB;CACxD,OAAO,QAAQ,QAAQ,uBAAuB,MAAM;AACtD;;AAGA,SAAS,kBAAkB,SAAiB,kBAAkB,OAA2B;CACvF,MAAM,aAAuB,CAAC;CAC9B,MAAM,WAAW,QAAQ,SAAS,IAAI;CACtC,MAAM,OAAO,WAAW,QAAQ,MAAM,GAAG,EAAE,IAAI;CAC/C,IAAI,SAAS;CACb,IAAI,SAAS;CACb,KAAK,MAAM,SAAS,KAAK,SAAS,SAAS,GAAG;EAC5C,UAAU,wBAAwB,KAAK,MAAM,QAAQ,MAAM,KAAK,CAAC,IAAI;EACrE,WAAW,KAAK,MAAM,EAAE;EACxB,SAAS,MAAM,QAAQ,MAAM,EAAE,CAAC;CAClC;CACA,UAAU,wBAAwB,KAAK,MAAM,MAAM,CAAC;CAEpD,IAAI,UAAU;EACZ,IAAI,iBAAiB,WAAW,KAAK,UAAU;EAC/C,UAAU,kBAAkB,eAAe;CAC7C;CACA,OAAO;EAAE,IAAI,IAAI,OAAO,IAAI,OAAO,EAAE;EAAG;CAAW;AACrD;AAEA,SAAS,aAAa,UAAkB,MAAsC;CAC5E,OAAO,SAAS,QAAQ,eAAe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Hooks.js","names":[],"sources":["../../../src/defaults/runtime/defineSiteHooks.ts"],"sourcesContent":["/**\n * defineSiteHooks —— 高阶 FaaS hooks 工厂(声明式配置 → 完整 ServerEntryHooks)\n *\n * 让用户的 src/entry.server.tsx 收紧到「只写请求期 hooks」。\n * 部署/平台配置(api/site/redis/experiments/i18n/seo/telemetry)放\n * ssr.config.ts 的 runtime 字段;entry.server.tsx 只保留 beforeRequest / onError。\n * 注:experiments 是 experimentation platform 的通用字段名,业务侧可理解为 A/B testing。\n * 内部固化:\n * - i18n 字典缓存(createCachedFetcher: TTL/SWR/dedup/fallback)\n * - SEO 路由表 pattern → resolver\n * - locale 检测(cookie → Accept-Language → 默认)\n * - i18n/seo 远端相对 endpoint 统一使用 runtime.services.api\n * - 服务端渲染错误打印 + runtime.telemetry errors endpoint 上报\n *\n * beforeRequest 的边界:\n * - 它在每次 HTTP/RSC 请求进入渲染前执行。\n * - 返回值会合并进 RequestContext,Server Component 用 getRequestContext() 读取。\n * - 适合放 userId / tenantId / requestSegment 这类请求现场字段。\n * - 不适合放 Redis、SEO、i18n、A/B 定义、慢 API 或数据库查询。\n * - A/B variant 由 runtime.experiments + engine middleware 注入,页面用 getVariant()。\n *\n * 用户态写法(商业项目推荐):\n * import { defineAdminSiteHooks } from 'isr-engine/site-hooks';\n *\n * export default defineAdminSiteHooks({\n * beforeRequest: req => ({\n * userId: req.headers.get('x-user-id') ?? undefined,\n * tenantId: req.headers.get('x-tenant-id') ?? 'public',\n * requestSegment: req.headers.get('x-segment') ?? 'default',\n * }),\n * });\n */\nimport { trimTrailingSlashes } from '../../utils/trimTrailingSlashes';\nimport { contentPathname, RSC_URL_POSTFIX } from '../../utils/isrPath';\nimport { createCachedFetcher } from './createCachedFetcher';\nimport { registerContentInvalidator } from './contentRevalidation';\nimport type { IntlPayload, PageSeoMeta } from './seo-runtime';\nimport type {\n DynamicSeoResolver,\n ISRConfig,\n RuntimeI18nConfig,\n RuntimeSeoConfig,\n} from '../../types';\nimport { readCookie } from '../../utils/cookie';\nimport {\n negotiateLocale,\n parseLocale,\n resolveI18nConfig,\n type I18nConfig,\n} from '../../runtime/i18n';\nimport { readLocalePreference } from '../../runtime/localePreference';\nimport { markUncacheable } from '../../context/CacheTagContext';\n\nexport { getCookieHeader, parseCookieHeader, readCookie } from '../../utils/cookie';\n\nexport type SiteRuntimeConfig = ISRConfig['runtime'];\n\nconst CONTENT_INVALIDATOR = Symbol('contentInvalidator');\nconst MARK_METADATA_DEGRADED = Symbol('markMetadataDegraded');\n\nexport interface SiteRuntimeContext {\n runtime: SiteRuntimeConfig;\n services: RuntimeServices;\n telemetry?: string;\n site?: string;\n [MARK_METADATA_DEGRADED]?: () => void;\n}\n\nexport interface RuntimeServices {\n api?: string;\n telemetry?: string;\n}\n\nfunction createEmptyRuntimeConfig(): SiteRuntimeConfig {\n return {\n site: undefined,\n services: { api: undefined, telemetry: undefined },\n redis: undefined,\n experiments: {},\n i18n: undefined,\n seo: undefined,\n telemetry: false,\n };\n}\n\nexport type RuntimeServiceBase = string | ((ctx: SiteRuntimeContext) => string | null | undefined);\n\nexport type IntlMessagesByLocale = Record<string, Record<string, unknown>>;\n\nexport interface CreateAdminIntlLoaderOptions {\n /** 远端字典端点;相对路径会用 runtime.services.api 拼接 */\n endpoint?: string;\n /** 本地兜底字典,通常来自 ssr.config.ts runtime.i18n.fallbackLocal */\n fallbackMessages?: IntlMessagesByLocale;\n /** 远端和本地都无法命中时使用的 locale */\n defaultLocale?: string;\n /** 远端请求超时,默认 1200ms */\n timeoutMs?: number;\n /** 响应头 / dev inspector 里显示的远端来源名 */\n remoteSource?: string;\n /** 响应头 / dev inspector 里显示的 fallback 来源名 */\n fallbackSource?: string;\n}\n\nexport interface AdminSeoFallbackEntry extends PageSeoMeta {\n path: string;\n group?: string;\n}\n\nexport interface CreateAdminSeoLoaderOptions {\n /** 远端 SEO 端点;支持 {pathname} 和路由 params 占位符 */\n endpoint?: string;\n /** 本地兜底 SEO 条目,通常来自 ssr.config.ts runtime.seo.fallbackLocal */\n fallbackEntries?: readonly AdminSeoFallbackEntry[];\n /** 远端请求超时,默认 1200ms */\n timeoutMs?: number;\n /**\n * 参数化路径解析器;admin endpoint 没命中且 fallback 也没命中时按 pattern 匹配\n * 调一个用户函数。让业务页面零 SEO 代码,所有动态 SEO 集中在 ssr.config.ts。\n */\n dynamicResolvers?: readonly DynamicSeoResolver[];\n}\n\nexport interface DefineAdminSiteHooksOptions {\n i18n?: {\n locales?: readonly string[];\n defaultLocale?: string;\n endpoint?: string;\n ttl?: number;\n prefixDefault?: boolean;\n detect?: IntlConfig['detect'];\n fallbackLocal?: IntlMessagesByLocale;\n timeoutMs?: number;\n remoteSource?: string;\n fallbackSource?: string;\n };\n seo?: {\n endpoint?: string;\n ttl?: number;\n fallbackLocal?: readonly Record<string, unknown>[];\n timeoutMs?: number;\n /** 参数化路径的 SEO 解析器(参考 RuntimeSeoConfig.dynamicResolvers)。 */\n dynamicResolvers?: readonly DynamicSeoResolver[];\n };\n beforeRequest?: SiteHooksConfig['beforeRequest'];\n onError?: SiteHooksConfig['onError'];\n headExtras?: SiteHooksConfig['headExtras'];\n}\n\nexport interface IntlConfig extends Partial<I18nConfig> {\n // ─── 翻译消息加载层(被 SEO/Header 等消费)─────────────────────\n /** 远程 endpoint;`{locale}` 占位符自动替换 */\n endpoint?: string;\n /** 远端响应适配器;支持 admin manifest / SaaS CMS 等非标准响应 */\n transform?: (\n data: unknown,\n locale: string\n ) => IntlPayload | null | undefined | Promise<IntlPayload | null | undefined>;\n /** 本地或自定义加载器;与 endpoint 互斥(优先级更高) */\n load?: (locale: string, ctx: SiteRuntimeContext) => Promise<IntlPayload | null>;\n /** locale 检测(默认:URL locale → cookie `locale` → Accept-Language → defaultLocale) */\n detect?: (req: Request) => string;\n /** 缓存 TTL 毫秒,默认 60_000 */\n ttl?: number;\n}\n\n/** 仅静态值,无远程拉取(PageSeoMeta 直接复用,无需扩展) */\nexport type SeoStaticEntry = PageSeoMeta;\n\nexport interface SeoRemoteEntry<T = unknown> {\n /** 远程 endpoint;`{paramName}` 占位符自动替换为路由捕获组 */\n endpoint: string;\n /** 把远程响应转成 PageSeoMeta */\n transform: (data: T, params: Record<string, string>) => PageSeoMeta | null;\n /** 缓存 TTL 毫秒,默认 300_000(5 分钟) */\n ttl?: number;\n}\n\nexport interface SeoLocalEntry {\n /** 本地加载器:dynamic import / fs.readFile / 内存 Map 都可 */\n load: (\n params: Record<string, string>,\n ctx: SiteRuntimeContext\n ) => Promise<PageSeoMeta | null> | PageSeoMeta | null;\n /** 缓存 TTL 毫秒,默认 300_000 */\n ttl?: number;\n}\n\nexport type SeoEntry = SeoStaticEntry | SeoRemoteEntry | SeoLocalEntry;\n\nexport interface SiteHooksConfig {\n /** i18n 配置 */\n intl?: IntlConfig;\n /** SEO 路由表:path pattern(支持 `:param`)→ 静态 meta 或 remote loader */\n seo?: Record<string, SeoEntry | (() => Promise<PageSeoMeta | null> | PageSeoMeta | null)>;\n /**\n * 错误回调。平台默认会先执行 console + runtime.telemetry errors endpoint 上报;\n * 自定义 onError 作为业务补充回调追加执行,不会关闭平台默认上报。\n */\n onError?: (\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string }\n ) => void | Promise<void>;\n /**\n * 请求级 ctx 扩展(除 engine 基线字段 + locale 之外的业务字段)。\n *\n * 典型用途:userId、tenantId、requestSegment、审计字段。\n * 返回值会合并进 RequestContext;Server Component 使用\n * `getRequestContext()` 读取,Client Component 需要由 Server Component\n * 作为 props 传入。\n *\n * 注意:\n * - 这里处在首屏关键路径上,应只做 header/cookie 解析。\n * - 不要在这里查数据库或慢 API。\n * - 不要在这里解析 A/B cookie;页面用 `getVariant()`。\n */\n beforeRequest?: (req: Request) => Record<string, unknown> | Promise<Record<string, unknown>>;\n /**\n * 注入到 `<head>` 末尾(`</head>` 之前)的 raw HTML 字符串。\n *\n * 通过 SSR HTML stream transformer 注入,**完全脱离 React 树** —— 不进 client RSC\n * payload,不触发 React 19 + plugin-rsc 的 head children mismatch hydration 错误。\n *\n * 典型用途:\n * - 主题 init inline blocking script(避免 FOUC,next-themes 同款)\n * - GA / GTM snippet\n * - A/B variant flag injection\n * - CSP nonce / preload hints\n *\n * 业务侧返回完整的标签 HTML(含 `<script>` / `<style>` / `<meta>` 外壳)。返回\n * 空字符串 / undefined 时跳过注入。\n *\n * ctx.nonce:当前请求的 CSP nonce(engine 自动注入)。业务侧的 inline `<script>`\n * 必须带上 nonce 属性,否则被 nonce-based CSP 阻断:\n *\n * ```ts\n * import { THEME_INIT_SCRIPT } from '@app/ui/theme-utils';\n *\n * defineAdminSiteHooks({\n * headExtras: ({ nonce }) =>\n * `<script${nonce ? ` nonce=\"${nonce}\"` : ''}>${THEME_INIT_SCRIPT}</script>`,\n * });\n * ```\n */\n headExtras?: (ctx: { nonce?: string }) => string | undefined;\n}\n\ninterface CompiledSeoPattern {\n re: RegExp;\n paramNames: string[];\n}\n\ninterface SeoRouteRequest {\n pathname: string;\n locale: string;\n params: Record<string, string>;\n}\n\ninterface CompiledRoute extends CompiledSeoPattern {\n resolver: (request: SeoRouteRequest) => Promise<PageSeoMeta | null> | PageSeoMeta | null;\n}\n\nfunction escapeSeoPatternLiteral(literal: string): string {\n return literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Both SEO entry points recognize named parameters and a terminal /* before escaping literals. */\nfunction compileSeoPattern(pattern: string, captureWildcard = false): CompiledSeoPattern {\n const paramNames: string[] = [];\n const wildcard = pattern.endsWith('/*');\n const base = wildcard ? pattern.slice(0, -2) : pattern;\n let cursor = 0;\n let source = '';\n for (const match of base.matchAll(/:(\\w+)/g)) {\n source += escapeSeoPatternLiteral(base.slice(cursor, match.index)) + '([^/]+)';\n paramNames.push(match[1]);\n cursor = match.index + match[0].length;\n }\n source += escapeSeoPatternLiteral(base.slice(cursor));\n\n if (wildcard) {\n if (captureWildcard) paramNames.push('wildcard');\n source += captureWildcard ? '(?:/(.*))?' : '(?:/.*)?';\n }\n return { re: new RegExp(`^${source}$`), paramNames };\n}\n\nfunction fillTemplate(template: string, vars: Record<string, string>): string {\n return template.replace(/\\{(\\w+)\\}/g, (_, k) => encodeURIComponent(vars[k] ?? ''));\n}\n\nexport function createAdminIntlLoader(\n options: CreateAdminIntlLoaderOptions = {}\n): NonNullable<IntlConfig['load']> {\n const endpoint = options.endpoint ?? '/api/i18n/{locale}/manifest';\n const fallbackMessages = options.fallbackMessages ?? {};\n const defaultLocale = options.defaultLocale;\n const supportedLocales = Object.keys(fallbackMessages);\n\n return async (locale, ctx) => {\n const normalizedLocale =\n supportedLocales.length && defaultLocale\n ? (matchConfiguredLocale(locale, supportedLocales) ?? defaultLocale)\n : locale;\n const remoteUrl = resolveAdminUrl(endpoint, { locale: normalizedLocale }, ctx);\n const remote = remoteUrl\n ? await fetchMetadataJson(remoteUrl, options.timeoutMs, ctx[MARK_METADATA_DEGRADED])\n : null;\n const remoteMessages = extractIntlMessagesOrNull(remote);\n const localMessages =\n fallbackMessages[normalizedLocale] ??\n (defaultLocale ? fallbackMessages[defaultLocale] : undefined) ??\n {};\n const messages = remoteMessages ?? normalizeMessages(localMessages);\n\n return {\n locale: normalizedLocale,\n messages,\n direction: rtlOf(normalizedLocale),\n source: remoteMessages\n ? (options.remoteSource ?? 'remote')\n : (options.fallbackSource ?? 'local-fallback'),\n };\n };\n}\n\nexport function createAdminSeoLoader(\n options: CreateAdminSeoLoaderOptions = {}\n): SeoLocalEntry['load'] {\n const endpoint = options.endpoint ?? '/api/seo?path={pathname}';\n const fallbackEntries = options.fallbackEntries ?? [];\n // 编译一次 + 缓存。N 个 resolver 在每个请求里只是 N 次正则 test,cost 可忽略。\n const compiledResolvers = (options.dynamicResolvers ?? []).map(resolver => ({\n ...compileSeoPattern(resolver.pattern, true),\n resolver,\n }));\n\n return async (params, ctx) => {\n const pathname = normalizePathname(params.pathname || '/');\n\n // 1. admin endpoint —— 运营在 dashboard 给具体 path 配过的覆盖优先级最高\n const remoteUrl = resolveAdminUrl(endpoint, { ...params, pathname }, ctx);\n const remote = remoteUrl\n ? await fetchMetadataJson(remoteUrl, options.timeoutMs, ctx[MARK_METADATA_DEGRADED])\n : null;\n const remoteMeta = extractSeoMetaOrNull(remote);\n if (remoteMeta) return remoteMeta;\n\n // 2. dynamic resolvers —— 参数化路径的请求期数据驱动\n if (compiledResolvers.length > 0) {\n for (const compiled of compiledResolvers) {\n const m = pathname.match(compiled.re);\n if (!m) continue;\n const resolverParams: Record<string, string> = {};\n compiled.paramNames.forEach((name, i) => {\n resolverParams[name] = m[i + 1] ?? '';\n });\n try {\n const result = await compiled.resolver.resolve({\n pathname,\n params: resolverParams,\n locale: typeof params.locale === 'string' ? params.locale : undefined,\n services: ctx.services,\n });\n if (result) return result as PageSeoMeta;\n } catch (err) {\n ctx[MARK_METADATA_DEGRADED]?.();\n // resolver 抛错不阻塞渲染:业务异常时把 SEO 当 null 处理\n console.warn('[seo] dynamic resolver threw, falling through to fallback', err);\n }\n // 同 pattern 没命中数据就继续找下一个 resolver / fallback;不退出。\n // 例:/books/:id 解析失败时,可能匹配了更宽的 /:scope/:id resolver 兜底。\n }\n }\n\n // 3. fallbackLocal —— build 期冻结的兜底\n const fallback = fallbackEntries.find(entry => normalizePathname(entry.path) === pathname);\n if (!fallback) return null;\n const meta = { ...fallback } as Record<string, unknown>;\n delete meta.path;\n delete meta.group;\n return meta as PageSeoMeta;\n };\n}\n\nexport function defineAdminSiteHooks(options: DefineAdminSiteHooksOptions = {}): ServerHooksOutput {\n return createAdminSiteHooks(options, createEmptyRuntimeConfig());\n}\n\nfunction createAdminSeoEntry(\n seo: NonNullable<DefineAdminSiteHooksOptions['seo']>,\n runtimeSeo: Partial<RuntimeSeoConfig>\n): SeoLocalEntry {\n return {\n load: createAdminSeoLoader({\n endpoint: seo.endpoint ?? runtimeSeo.endpoint,\n fallbackEntries: normalizeAdminSeoFallbackEntries(\n seo.fallbackLocal ?? runtimeSeo.fallbackLocal\n ),\n timeoutMs: seo.timeoutMs ?? runtimeSeo.timeoutMs,\n dynamicResolvers: seo.dynamicResolvers ?? runtimeSeo.dynamicResolvers,\n }),\n ttl: seo.ttl ?? runtimeSeo.ttl ?? 60_000,\n };\n}\n\nfunction createAdminSiteHooks(\n options: DefineAdminSiteHooksOptions,\n runtime: SiteRuntimeConfig\n): ServerHooksOutput {\n const runtimeI18n: Partial<RuntimeI18nConfig> = runtime.i18n ?? {};\n const runtimeSeo: Partial<RuntimeSeoConfig> = runtime.seo ?? {};\n const i18n = options.i18n ?? {};\n const seo = options.seo ?? {};\n const fallbackMessages = i18n.fallbackLocal ?? runtimeI18n.fallbackLocal ?? {};\n const locales =\n i18n.locales ??\n runtimeI18n.locales ??\n (Object.keys(fallbackMessages).length > 0 ? Object.keys(fallbackMessages) : ['en']);\n const defaultLocale = i18n.defaultLocale ?? runtimeI18n.defaultLocale ?? locales[0] ?? 'en';\n\n const output = createSiteHooks(\n {\n beforeRequest: options.beforeRequest,\n onError: options.onError,\n headExtras: options.headExtras,\n intl: {\n locales,\n defaultLocale,\n prefixDefault: i18n.prefixDefault ?? runtimeI18n.prefixDefault,\n detect: i18n.detect,\n load: createAdminIntlLoader({\n endpoint: i18n.endpoint ?? runtimeI18n.endpoint,\n fallbackMessages,\n defaultLocale,\n timeoutMs: i18n.timeoutMs ?? runtimeI18n.timeoutMs,\n remoteSource: i18n.remoteSource ?? runtimeI18n.remoteSource,\n fallbackSource: i18n.fallbackSource ?? runtimeI18n.fallbackSource,\n }),\n ttl: i18n.ttl ?? runtimeI18n.ttl ?? 60_000,\n },\n seo: {\n '/*': createAdminSeoEntry(seo, runtimeSeo),\n },\n },\n runtime\n );\n Object.defineProperty(output, '__configureRuntime', {\n enumerable: false,\n configurable: true,\n value: (nextRuntime: SiteRuntimeConfig) => createAdminSiteHooks(options, nextRuntime),\n });\n return output;\n}\n\nexport interface ServerHooksOutput {\n /** site URL —— SEO 注入时把 image/canonical 等相对路径解析为绝对 URL */\n siteBaseUrl?: string;\n /** 浏览器可访问的 API base —— 注入到 csr-shell 的 window.__API_BASE__ */\n apiBaseUrl?: string;\n /**\n * 原始 intl 配置(用户在 defineSiteHooks 里写的那份),透传出来给 app.tsx 的 parseLocale 用\n * —— 让 i18n 配置只声明一次,不需要单独 i18n.config.ts\n */\n intl?: IntlConfig;\n beforeRequest: (\n req: Request,\n engineCtx: { traceId: string; startedAt: number }\n ) => Promise<Record<string, unknown>>;\n loadIntl: (req: Request) => Promise<IntlPayload | null>;\n loadSeoMeta: (req: Request) => Promise<PageSeoMeta | null>;\n onError: (\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string }\n ) => void | Promise<void>;\n /** 注入 `<head>` 末尾的 raw HTML —— 详见 SiteHooksConfig.headExtras 注释 */\n headExtras?: (ctx: { nonce?: string }) => string | undefined;\n __configureRuntime?: (runtime: SiteRuntimeConfig) => ServerHooksOutput;\n}\n\nexport function defineSiteHooks(config: SiteHooksConfig): ServerHooksOutput {\n return createSiteHooks(config, createEmptyRuntimeConfig());\n}\n\nexport function applyRuntimeToServerHooks<T extends object>(\n hooks: T,\n runtime: SiteRuntimeConfig\n): T {\n const maybeRuntimeAware = hooks as T & {\n __configureRuntime?: (runtime: SiteRuntimeConfig) => T;\n };\n if (typeof maybeRuntimeAware.__configureRuntime === 'function') {\n return maybeRuntimeAware.__configureRuntime(runtime);\n }\n const baseHooks = hooks as T & {\n siteBaseUrl?: string;\n apiBaseUrl?: string;\n intl?: unknown;\n loadIntl?: unknown;\n loadSeoMeta?: unknown;\n beforeRequest?: SiteHooksConfig['beforeRequest'];\n onError?: SiteHooksConfig['onError'];\n };\n const services = resolveRuntimeServices(runtime);\n const siteBaseUrl = baseHooks.siteBaseUrl ?? runtime.site;\n const apiBaseUrl = baseHooks.apiBaseUrl ?? services.api;\n const hasUserContentHooks =\n !!baseHooks.intl ||\n typeof baseHooks.loadIntl === 'function' ||\n typeof baseHooks.loadSeoMeta === 'function';\n\n if (!hasUserContentHooks && hasRuntimeContentConfig(runtime)) {\n const runtimeHooks = createAdminSiteHooks(\n {\n beforeRequest: baseHooks.beforeRequest,\n onError: baseHooks.onError,\n },\n runtime\n );\n return {\n ...hooks,\n siteBaseUrl,\n apiBaseUrl,\n intl: runtimeHooks.intl,\n beforeRequest: runtimeHooks.beforeRequest,\n loadIntl: runtimeHooks.loadIntl,\n loadSeoMeta: runtimeHooks.loadSeoMeta,\n onError: runtimeHooks.onError,\n } as T;\n }\n\n // A dynamic SEO table on its own does not opt a plain server entry into the admin i18n\n // loader or wrap its beforeRequest callback.\n const runtimeSeo = runtime.seo;\n const runtimeSeoHook =\n !hasUserContentHooks && runtimeSeo?.dynamicResolvers?.length\n ? createSiteHooks(\n { intl: runtime.i18n, seo: { '/*': createAdminSeoEntry({}, runtimeSeo) } },\n runtime\n ).loadSeoMeta\n : undefined;\n return {\n ...hooks,\n siteBaseUrl,\n apiBaseUrl,\n ...(runtimeSeoHook && { loadSeoMeta: runtimeSeoHook }),\n } as T;\n}\n\nfunction createSiteHooks(config: SiteHooksConfig, runtime: SiteRuntimeConfig): ServerHooksOutput {\n const services = resolveRuntimeServices(runtime);\n const api = services.api ?? '';\n const site = runtime.site ?? '';\n const runtimeCtx: SiteRuntimeContext = {\n runtime,\n services,\n telemetry: services.telemetry,\n site: site || undefined,\n };\n const metadataContext = (markDegraded?: () => void): SiteRuntimeContext => ({\n ...runtimeCtx,\n [MARK_METADATA_DEGRADED]: markDegraded,\n });\n const fetchJson = (path: string, markDegraded?: () => void) =>\n api ? fetchMetadataJson(api + path, null, markDegraded) : Promise.resolve(null);\n\n // ─── i18n 缓存(一次创建,请求级复用)──────────────\n const runtimeLocale = runtime.i18n;\n const rememberLocale = runtimeLocale?.prefixDefault && runtimeLocale.rememberLocale;\n const intlCfg = rememberLocale\n ? { ...config.intl, ...resolveI18nConfig(runtimeLocale) }\n : (config.intl ?? {});\n const supportedLocales = intlCfg.locales?.length ? intlCfg.locales : undefined;\n const negotiationConfig = supportedLocales\n ? resolveI18nConfig(intlCfg)\n : { locales: ['zh-CN', 'en'], defaultLocale: intlCfg.defaultLocale ?? 'zh-CN' };\n // 默认 detect 优先级(业界标准 i18n 顺序):\n // 1. URL pathname 前缀 /en-US/... → 'en-US' ← 显式路由意图,最高优先级\n // 2. engine locale preference on the unprefixed root / legacy locale cookie\n // 3. Accept-Language 头 ← 浏览器系统语言\n // 4. defaultLocale ← 兜底\n //\n // 关键:前缀路由(prefixDefault:true 等场景)下,URL 是源真值。如果不优先用\n // URL,curl /en-US 但 Accept-Language 是 zh 会被错误降级到 zh-CN,跟用户\n // 明确写在 URL 里的意图相反。\n // 业务侧可通过 intlCfg.detect 完全覆盖(任何 (req) => string 都行)。\n const detectLocale =\n intlCfg.detect ??\n ((req: Request): string => {\n // 1. URL 前缀\n if (supportedLocales) {\n try {\n const pathname = new URL(req.url).pathname;\n // 客户端 RSC 导航 URL 带 `_.rsc` 后缀(如 `/ja_.rsc`),不剥掉的话\n // 首段会变成 `ja_.rsc` 命中不了 locale,从而错误回退到 cookie /\n // Accept-Language / defaultLocale —— 这正是「切换语言必须刷新才生效」\n // 的根因(RSC 导航拿到的 intl 语言与 URL 前缀不一致)。\n const cleanPath = pathname.endsWith('_.rsc')\n ? pathname.slice(0, -'_.rsc'.length) || '/'\n : pathname;\n const first = cleanPath.split('/')[1];\n if (first && supportedLocales.includes(first)) return first;\n if (cleanPath === '/' && rememberLocale && runtimeLocale) {\n const preference = readLocalePreference(req, runtimeLocale);\n if (preference) return preference;\n }\n } catch {\n // 非法 URL(极少见,比如内部调用喂了相对路径)→ 继续后续策略\n }\n }\n // 2. cookie\n const localeCookie = readCookie(req, 'locale');\n if (localeCookie) {\n const matchedCookie = supportedLocales\n ? matchConfiguredLocale(localeCookie, supportedLocales)\n : localeCookie;\n if (matchedCookie) return matchedCookie;\n }\n // 3. Accept-Language → 4. fallbackLocale\n return negotiateLocale(req.headers.get('accept-language'), negotiationConfig);\n });\n\n const intlLoader = createCachedFetcher<string, IntlPayload>({\n key: locale => `intl:${locale}`,\n ttl: intlCfg.ttl ?? 60_000,\n swr: true,\n onDegraded: markUncacheable,\n fetch: async (locale, markDegraded) => {\n if (intlCfg.load) {\n const r = await intlCfg.load(locale, metadataContext(markDegraded));\n return r ?? { locale, messages: {}, direction: rtlOf(locale) };\n }\n if (intlCfg.endpoint) {\n const url = fillTemplate(intlCfg.endpoint, { locale });\n const json = await fetchJson(url, markDegraded);\n if (json !== null && intlCfg.transform) {\n const transformed = await intlCfg.transform(json, locale);\n if (transformed) {\n return {\n ...transformed,\n direction: transformed.direction ?? rtlOf(transformed.locale),\n };\n }\n }\n return {\n locale,\n messages: extractIntlMessages(json),\n direction: rtlOf(locale),\n };\n }\n return { locale, messages: {}, direction: rtlOf(locale) };\n },\n fallback: locale => ({ locale, messages: {}, direction: rtlOf(locale) }),\n });\n\n // ─── SEO 路由表编译 + 远程 loader 缓存(每个 pattern 一份)─────\n const seoRoutes: CompiledRoute[] = [];\n const seoCaches: Array<\n ReturnType<typeof createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>>\n > = [];\n const seoLocaleConfig = supportedLocales ? resolveI18nConfig(intlCfg) : undefined;\n const seoPath = (pathname: string) =>\n seoLocaleConfig ? parseLocale(pathname, seoLocaleConfig).pathname : pathname;\n\n for (const [pattern, value] of Object.entries(config.seo ?? {})) {\n const { re, paramNames } = compileSeoPattern(pattern);\n\n if (typeof value === 'function') {\n // 自定义 resolver\n const resolve = value as (\n params: Record<string, string>\n ) => PageSeoMeta | null | Promise<PageSeoMeta | null>;\n seoRoutes.push({ re, paramNames, resolver: ({ params }) => resolve(params) });\n continue;\n }\n if ('endpoint' in value && typeof (value as SeoRemoteEntry).endpoint === 'string') {\n const remote = value as SeoRemoteEntry;\n const cache = createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>({\n key: request => JSON.stringify(request),\n ttl: remote.ttl ?? 300_000,\n onDegraded: markUncacheable,\n fetch: async ({ params }, markDegraded) => {\n const data = await fetchJson(fillTemplate(remote.endpoint, params), markDegraded);\n if (data === null) return null;\n return remote.transform(data, { ...params });\n },\n fallback: () => null,\n });\n seoCaches.push(cache);\n seoRoutes.push({ re, paramNames, resolver: cache });\n continue;\n }\n if ('load' in value && typeof (value as SeoLocalEntry).load === 'function') {\n const local = value as SeoLocalEntry;\n const cache = createCachedFetcher<SeoRouteRequest, PageSeoMeta | null>({\n key: request => JSON.stringify(request),\n ttl: local.ttl ?? 300_000,\n onDegraded: markUncacheable,\n fetch: async ({ params }, markDegraded) =>\n local.load({ ...params }, metadataContext(markDegraded)),\n fallback: () => null,\n });\n seoCaches.push(cache);\n seoRoutes.push({ re, paramNames, resolver: cache });\n continue;\n }\n // 静态 meta\n const staticMeta = value as SeoStaticEntry;\n const withDefaults: PageSeoMeta = {\n ...staticMeta,\n canonical:\n staticMeta.canonical ??\n (site && pattern && pattern !== '/*' ? `${site}${pattern}` : staticMeta.canonical),\n };\n seoRoutes.push({ re, paramNames, resolver: () => withDefaults });\n }\n\n // ─── onError ─────\n const platformOnError = createPlatformOnError(runtime, runtimeCtx);\n const onError: ServerHooksOutput['onError'] = async (err, req, ctx) => {\n platformOnError(err, req, ctx);\n if (config.onError) {\n await config.onError(err, req, ctx);\n }\n };\n\n const output: ServerHooksOutput = {\n siteBaseUrl: site || undefined,\n apiBaseUrl: api || undefined,\n intl: rememberLocale ? intlCfg : config.intl,\n headExtras: config.headExtras,\n async beforeRequest(req, _engineCtx) {\n const locale = detectLocale(req);\n const userExt = config.beforeRequest ? await config.beforeRequest(req) : {};\n return { locale, ...userExt };\n },\n async loadIntl(req) {\n return intlLoader(detectLocale(req));\n },\n async loadSeoMeta(req) {\n const url = new URL(req.url);\n const locale = detectLocale(req);\n // 客户端 RSC 导航 fetch 的 URL 带 _.rsc 后缀(详见 defaults/runtime/request.tsx)。\n // 先剥后缀,否则 /zh-CN/books/1_.rsc 永远 match 不到 /books/:id route → seoMeta=null →\n // 客户端导航后 head 不更新。HTML 请求没这个后缀,原行为不变。\n // SEO 表是按\"业务规范路径\"('/' / '/books' / '/about')入库的,\n // 不带 locale 前缀。请求 URL 是带前缀的('/en-US/'、'/zh-CN/books'),\n // 直接喂给 admin 查不到。先用 parseLocale 把 locale 段剥掉,\n // 再去 seoRoutes 里匹配 + 调 admin endpoint。\n // locale 单独传给 resolver,支持 endpoint 模板里的 {locale}。\n const pathForRouting = url.pathname.endsWith(RSC_URL_POSTFIX)\n ? url.pathname.slice(0, -RSC_URL_POSTFIX.length) || '/'\n : url.pathname;\n const cleanPath = seoPath(pathForRouting);\n\n for (const { re, paramNames, resolver } of seoRoutes) {\n const m = cleanPath.match(re);\n if (m) {\n const params: Record<string, string> = {\n pathname: cleanPath,\n locale,\n };\n paramNames.forEach((n, i) => (params[n] = m[i + 1] ?? ''));\n return await resolver({ pathname: cleanPath, locale, params });\n }\n }\n return null;\n },\n onError,\n };\n const invalidate: Parameters<typeof registerContentInvalidator>[0] = scopes => {\n const locales = new Set(scopes.locales);\n if (scopes.allPageMetadata || locales.size) {\n intlLoader.invalidate(\n locale => !!scopes.allPageMetadata || locales.has(locale.toLowerCase())\n );\n }\n if (scopes.allPageMetadata || scopes.tags.length) {\n for (const cache of seoCaches) cache.invalidate();\n return;\n }\n if (!scopes.paths.length && !locales.size) return;\n const paths = new Set(\n scopes.paths.map(pathname => trimTrailingSlashes(seoPath(contentPathname(pathname))))\n );\n for (const cache of seoCaches) {\n cache.invalidate(\n ({ pathname, locale }) =>\n paths.has(trimTrailingSlashes(pathname)) || locales.has(locale.toLowerCase())\n );\n }\n };\n // Keep the weak listener alive when the runtime copies these hooks into a server entry.\n Object.defineProperty(output.loadIntl, CONTENT_INVALIDATOR, { value: invalidate });\n Object.defineProperty(output.loadSeoMeta, CONTENT_INVALIDATOR, { value: invalidate });\n registerContentInvalidator(invalidate, { weak: true });\n Object.defineProperty(output, '__configureRuntime', {\n enumerable: false,\n configurable: true,\n value: (nextRuntime: SiteRuntimeConfig) => createSiteHooks(config, nextRuntime),\n });\n return output;\n}\n\nfunction rtlOf(locale: string): 'ltr' | 'rtl' {\n return /^(ar|he|fa|ur)/.test(locale) ? 'rtl' : 'ltr';\n}\n\nfunction matchConfiguredLocale(\n value: string,\n supportedLocales: readonly string[]\n): string | undefined {\n const lower = value.toLowerCase();\n const exact = supportedLocales.find(locale => locale.toLowerCase() === lower);\n if (exact) return exact;\n const prefix = lower.split('-')[0];\n return supportedLocales.find(locale => locale.toLowerCase().split('-')[0] === prefix);\n}\n\nfunction extractIntlMessages(data: unknown): Record<string, unknown> {\n return extractIntlMessagesOrNull(data) ?? {};\n}\n\nfunction extractIntlMessagesOrNull(data: unknown): Record<string, unknown> | null {\n if (!data || typeof data !== 'object') return null;\n const raw = data as Record<string, unknown>;\n const dataValue = raw.data;\n const candidate =\n raw.strings ??\n raw.messages ??\n (isRecord(dataValue) && 'strings' in dataValue ? dataValue.strings : dataValue);\n if (!candidate || typeof candidate !== 'object') return null;\n return normalizeMessages(candidate as Record<string, unknown>);\n}\n\nfunction normalizeMessages(messages: Record<string, unknown>): Record<string, unknown> {\n if (isFlatRecord(messages)) {\n return expandDottedRecord(messages);\n }\n return messages;\n}\n\n/**\n * 逐层剥 envelope —— admin 在不同分支返回三种 shape:\n * - flat:`{ title, description, ... }`(admin no-locale fast path)\n * - 单层:`{ data: { title, ... } }`(旧版本)\n * - 双层:`{ status, code, data: { data: { title, ... }, version } }`\n * (api-envelope plugin 包了一层,resolvePublic 自己又是 `{ data, version }`,\n * 所以 locale-aware 路径会双层 wrap)\n *\n * 停止条件:候选对象有 `title` / `description`(SEO 形状),或没有 `data` 字段可剥。\n */\nfunction extractSeoMetaOrNull(data: unknown): PageSeoMeta | null {\n let candidate: unknown = data;\n for (let i = 0; i < 4; i++) {\n if (!isRecord(candidate)) return null;\n if ('title' in candidate || 'description' in candidate) break;\n if ('data' in candidate) {\n candidate = candidate.data;\n continue;\n }\n return null;\n }\n if (!isRecord(candidate)) return null;\n return candidate as PageSeoMeta;\n}\n\nfunction normalizeAdminSeoFallbackEntries(\n entries: readonly Record<string, unknown>[] = []\n): readonly AdminSeoFallbackEntry[] {\n return entries.filter(\n entry => typeof entry.path === 'string'\n ) as unknown as readonly AdminSeoFallbackEntry[];\n}\n\nfunction createPlatformOnError(\n runtime: SiteRuntimeConfig,\n ctx: SiteRuntimeContext\n): NonNullable<ServerHooksOutput['onError']> {\n const reportServerError = createServerErrorEndpointReporter(runtime, ctx);\n\n return (err, req, errorCtx) => {\n console.error('[onError]', {\n traceId: errorCtx.traceId,\n locale: errorCtx.locale,\n url: req.url,\n msg: err instanceof Error ? err.message : String(err),\n });\n reportServerError?.(err, req, errorCtx);\n };\n}\n\nfunction createServerErrorEndpointReporter(\n runtime: SiteRuntimeConfig,\n ctx: SiteRuntimeContext\n): ((err: unknown, req: Request, errorCtx: { traceId: string; locale?: string }) => void) | null {\n const config = runtime.telemetry;\n if (config === false || !config || config.errors === false) return null;\n\n const errors = config.errors ?? {};\n const endpoint = resolveAdminUrl(errors.endpoint ?? '/api/observability/errors', {}, ctx, {\n baseUrl: runtimeCtx => runtimeCtx.services.telemetry ?? runtimeCtx.services.api,\n });\n if (!endpoint) return null;\n\n const app = config.app ?? 'isr-engine-app';\n const release = config.release;\n const environment = config.environment;\n const includeQueryString = config.includeQueryString === true;\n\n return (err, req, errorCtx) => {\n const id = createServerReportId();\n if (!id) return;\n const report = normalizeServerErrorReport(err, req, errorCtx, {\n id,\n release,\n environment,\n includeQueryString,\n });\n\n void fetch(endpoint, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n accept: 'application/json',\n },\n body: JSON.stringify({\n app,\n sentAt: Date.now(),\n reports: [report],\n }),\n signal: typeof AbortSignal !== 'undefined' ? AbortSignal.timeout(1000) : undefined,\n }).catch(() => {\n /* 服务端错误上报不能阻断渲染兜底;失败交给进程日志和外层 adapter */\n });\n };\n}\n\nfunction normalizeServerErrorReport(\n err: unknown,\n req: Request,\n ctx: { traceId: string; locale?: string },\n options: {\n id: string;\n release?: string;\n environment?: string;\n includeQueryString?: boolean;\n }\n): Record<string, unknown> {\n const error = err instanceof Error ? err : null;\n const message = error?.message || String(err);\n const name = error?.name || 'Error';\n const url = safeRequestPath(req.url, options.includeQueryString);\n\n return {\n id: options.id,\n ts: Date.now(),\n level: 'error',\n message,\n name,\n stack: error?.stack,\n release: options.release,\n environment: options.environment,\n url,\n source: 'server-render',\n tags: {\n traceId: ctx.traceId,\n locale: ctx.locale,\n },\n extra: {\n method: req.method,\n pathname: url.split('?')[0] || '/',\n },\n fingerprint: ['server-render', name, message.slice(0, 160)],\n };\n}\n\nfunction safeRequestPath(rawUrl: string, includeQueryString?: boolean): string {\n try {\n const url = new URL(rawUrl);\n return includeQueryString ? `${url.pathname}${url.search}` : url.pathname;\n } catch {\n return includeQueryString ? rawUrl : '/';\n }\n}\n\nfunction createServerReportId(): string | null {\n try {\n return `srv_${crypto.randomUUID()}`;\n } catch {\n // Optional reporting must not weaken IDs or interrupt rendering without Web Crypto.\n return null;\n }\n}\n\nasync function fetchMetadataJson(\n url: string,\n timeoutMs: number | null = 1200,\n markDegraded?: () => void\n): Promise<unknown> {\n try {\n const response =\n timeoutMs === null\n ? await fetch(url)\n : await fetch(url, {\n headers: { Accept: 'application/json' },\n signal: timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : undefined,\n });\n if (!response.ok) {\n if (response.status !== 404) markDegraded?.();\n void response.body?.cancel().catch(() => undefined);\n return null;\n }\n if (response.status === 204) return null;\n return await response.json();\n } catch {\n markDegraded?.();\n return null;\n }\n}\n\nfunction resolveAdminUrl(\n endpoint: string,\n vars: Record<string, string>,\n ctx: SiteRuntimeContext,\n options: { baseUrl?: RuntimeServiceBase } = {}\n): string | null {\n const filled = fillTemplate(endpoint, vars);\n if (/^(https?:)?\\/\\//i.test(filled)) return filled;\n const base = resolveRuntimeServiceBase(ctx, options.baseUrl);\n if (!base) return null;\n return `${trimTrailingSlashes(base)}/${filled.replace(/^\\/+/, '')}`;\n}\n\nfunction resolveRuntimeServiceBase(\n ctx: SiteRuntimeContext,\n baseUrl?: RuntimeServiceBase\n): string | null {\n if (typeof baseUrl === 'function') {\n return baseUrl(ctx) ?? null;\n }\n if (baseUrl) return baseUrl;\n return ctx.services.api ?? null;\n}\n\nfunction resolveRuntimeServices(runtime: SiteRuntimeConfig): RuntimeServices {\n const services = runtime.services ?? {};\n const api = services.api;\n return {\n api,\n telemetry: services.telemetry ?? api,\n };\n}\n\nfunction hasRuntimeContentConfig(runtime: SiteRuntimeConfig): boolean {\n return !!(\n runtime.i18n?.endpoint ||\n runtime.i18n?.fallbackLocal ||\n runtime.seo?.endpoint ||\n runtime.seo?.fallbackLocal ||\n runtime.telemetry\n );\n}\n\nfunction normalizePathname(pathname: string): string {\n if (pathname === '/') return '/';\n return trimTrailingSlashes(pathname) || '/';\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isFlatRecord(value: unknown): boolean {\n if (!value || typeof value !== 'object') return false;\n return Object.keys(value as Record<string, unknown>).some(key => key.includes('.'));\n}\n\nfunction expandDottedRecord(flat: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(flat)) {\n const parts = key.split('.');\n let cur = out;\n parts.forEach((part, index) => {\n if (index === parts.length - 1) {\n cur[part] = value;\n return;\n }\n const next = cur[part];\n if (!next || typeof next !== 'object') cur[part] = {};\n cur = cur[part] as Record<string, unknown>;\n });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,IAAM,sBAAsB,OAAO,oBAAoB;AACvD,IAAM,yBAAyB,OAAO,sBAAsB;AAe5D,SAAS,2BAA8C;CACrD,OAAO;EACL,MAAM,KAAA;EACN,UAAU;GAAE,KAAK,KAAA;GAAW,WAAW,KAAA;EAAU;EACjD,OAAO,KAAA;EACP,aAAa,CAAC;EACd,MAAM,KAAA;EACN,KAAK,KAAA;EACL,WAAW;CACb;AACF;AAoLA,SAAS,wBAAwB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L;EACA,WAAW,SAAS,aAAa;CACnC;AACF;AAEA,SAAS,wBAAwB,SAAqC;CACpE,OAAO,CAAC,EACN,QAAQ,MAAM,YACd,QAAQ,MAAM,iBACd,QAAQ,KAAK,YACb,QAAQ,KAAK,iBACb,QAAQ;AAEZ;AAEA,SAAS,kBAAkB,UAA0B;CACnD,IAAI,aAAa,KAAK,OAAO;CAC7B,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE;AAEA,SAAS,aAAa,OAAyB;CAC7C,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,OAAO,OAAO,KAAK,KAAgC,CAAC,CAAC,MAAK,QAAO,IAAI,SAAS,GAAG,CAAC;AACpF;AAEA,SAAS,mBAAmB,MAAwD;CAClF,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,GAAG;EAC/C,MAAM,QAAQ,IAAI,MAAM,GAAG;EAC3B,IAAI,MAAM;EACV,MAAM,SAAS,MAAM,UAAU;GAC7B,IAAI,UAAU,MAAM,SAAS,GAAG;IAC9B,IAAI,QAAQ;IACZ;GACF;GACA,MAAM,OAAO,IAAI;GACjB,IAAI,CAAC,QAAQ,OAAO,SAAS,UAAU,IAAI,QAAQ,CAAC;GACpD,MAAM,IAAI;EACZ,CAAC;CACH;CACA,OAAO;AACT"}
@@ -0,0 +1,3 @@
1
+ export declare function isRenderCancellation(signal: AbortSignal | undefined, error: unknown): boolean;
2
+ export declare function createRenderErrorHandler(signal: AbortSignal | undefined): (error: unknown) => void;
3
+ //# sourceMappingURL=renderCancellation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCancellation.d.ts","sourceRoot":"","sources":["../../../src/defaults/runtime/renderCancellation.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAG7F;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,IAC9D,OAAO,OAAO,KAAG,IAAI,CAG9B"}
@@ -17,6 +17,7 @@ export declare function resolveSeoConfig(config: ISRConfig): ResolvedSeoConfig;
17
17
  export declare function resolveSitemapLastModified(config: ISRConfig): ReadonlyMap<string, string>;
18
18
  export declare function resolveSitemapLoader(config: ISRConfig, engine?: SEOEngine): {
19
19
  ttl: number;
20
+ staleIfErrorMs: number;
20
21
  load: () => Promise<string>;
21
22
  } | undefined;
22
23
  //# sourceMappingURL=resolveSeoConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveSeoConfig.d.ts","sourceRoot":"","sources":["../../../src/engine/seo/resolveSeoConfig.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,aAAa,EAAE,cAAc,GAAG,aAAa,GAAG,OAAO,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAuBrE;AAED,kDAAkD;AAClD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQzF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS;;;cAUzE"}
1
+ {"version":3,"file":"resolveSeoConfig.d.ts","sourceRoot":"","sources":["../../../src/engine/seo/resolveSeoConfig.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,aAAa,EAAE,cAAc,GAAG,aAAa,GAAG,OAAO,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAuBrE;AAED,kDAAkD;AAClD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQzF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS;;;;cAWzE"}
@@ -1,9 +1,9 @@
1
- import { $ as parseComponents, A as invalidatorRunsTotal, B as InternalStrategies, C as createCoherentCacheStore, D as loadConfig, F as getFallbackChain, H as extractSsgRoutes, I as getRouteFallbackChain, J as DEFAULT_SCAN_CONFIG, K as package_default, L as matchRoutePattern, M as recordHttpRequest, N as createHybridCacheStore, O as createPrometheusMetricsMiddleware, P as createMemoryCacheStore, Q as parseComponentFromFile, R as resolveRenderMode, S as MemoryCacheAdapter, U as spiderSsgRoutes, V as RenderModes, W as logger$1, X as scanProject, Y as scanComponents, Z as scanRoutes, _ as requestPinnedImage, at as isDev, b as RedisInvalidationBus, ct as CacheCleanup, d as SEOEngine, dt as resolveImageOptions, et as parseRouteFromFile, f as createSEOEngine, g as createImagePlugin, h as createImageMiddleware, i as startAppServer, it as readDirRecursive, j as promRegistry, k as invalidatorFailuresTotal, l as generateStaticCspManifest, lt as Logger, m as mergeSEOConfig, n as ISREngine, nt as isCodeFile, ot as isProd, p as DEFAULT_SEO_CONFIG, q as resolveFetchHandler, r as shutdownServer, rt as isTestFile, st as getEnv, t as createISRApp, tt as parseRoutes, u as createABVariantMiddleware, ut as assertDistinctHtmlRouteIdentities, v as createIsrCacheHandler, w as createDevAssetRequestMiddleware, x as RedisCacheAdapter, y as createIsrCacheMiddleware, z as FallbackChain } from "./createISRApp-DA3-5Ezk.js";
1
+ import { $ as parseComponents, A as invalidatorRunsTotal, B as InternalStrategies, C as createCoherentCacheStore, D as loadConfig, F as getFallbackChain, H as extractSsgRoutes, I as getRouteFallbackChain, J as DEFAULT_SCAN_CONFIG, K as package_default, L as matchRoutePattern, M as recordHttpRequest, N as createHybridCacheStore, O as createPrometheusMetricsMiddleware, P as createMemoryCacheStore, Q as parseComponentFromFile, R as resolveRenderMode, S as MemoryCacheAdapter, U as spiderSsgRoutes, V as RenderModes, W as logger$1, X as scanProject, Y as scanComponents, Z as scanRoutes, _ as requestPinnedImage, at as isDev, b as RedisInvalidationBus, ct as CacheCleanup, d as SEOEngine, et as parseRouteFromFile, f as createSEOEngine, g as createImagePlugin, h as createImageMiddleware, i as startAppServer, it as readDirRecursive, j as promRegistry, k as invalidatorFailuresTotal, l as generateStaticCspManifest, lt as Logger, m as mergeSEOConfig, n as ISREngine, nt as isCodeFile, ot as isProd, p as DEFAULT_SEO_CONFIG, q as resolveFetchHandler, r as shutdownServer, rt as isTestFile, st as getEnv, t as createISRApp, tt as parseRoutes, u as createABVariantMiddleware, ut as resolveImageOptions, v as createIsrCacheHandler, w as createDevAssetRequestMiddleware, x as RedisCacheAdapter, y as createIsrCacheMiddleware, z as FallbackChain } from "./createISRApp-BG-s3uuL.js";
2
2
  import { defineIsrConfig, defineRuntimeConfig } from "./config/defineConfig.js";
3
- import { C as getRequestContext, D as requestContext, c as RevalidationError, d as revalidateContent, f as revalidatePath, n as cacheTag, p as revalidateTag, r as collectTags, s as runWithTagStore, t as getVariant, u as registerInvalidator } from "./abVariantContext-BNInoflb.js";
4
- import { a as getCookieHeader, o as parseCookieHeader, s as readCookie, t as createCachedFetcher } from "./createCachedFetcher-Y7zbGgjb.js";
3
+ import { D as assertDistinctHtmlRouteIdentities, E as requestContext, S as getRequestContext, d as revalidatePath, f as revalidateTag, l as registerInvalidator, n as cacheTag, o as runWithTagStore, r as collectTags, s as RevalidationError, t as getVariant, u as revalidateContent } from "./abVariantContext-yWZOqscY.js";
4
+ import { a as getCookieHeader, o as parseCookieHeader, s as readCookie, t as createCachedFetcher } from "./createCachedFetcher-CgJscexq.js";
5
5
  import { applyRuntimeToServerHooks, createAdminIntlLoader, createAdminSeoLoader, defineAdminSiteHooks, defineSiteHooks } from "./defaults/runtime/defineSiteHooks.js";
6
- import { a as LEGACY_SERVER_ACTION_ENDPOINT, d as createServerAction, f as serverActionsRegistry, i as getI18nLocale, o as SERVER_ACTION_ENDPOINT, r as getI18n, u as ServerActionUtils } from "./rsc-CbZ-BsWD.js";
6
+ import { a as LEGACY_SERVER_ACTION_ENDPOINT, d as createServerAction, f as serverActionsRegistry, i as getI18nLocale, o as SERVER_ACTION_ENDPOINT, r as getI18n, u as ServerActionUtils } from "./rsc-BYq2vvnh.js";
7
7
  import { s as trimTrailingSlashes } from "./i18n-BZpAOZeO.js";
8
8
  import fs, { existsSync, promises, readFileSync, realpathSync } from "node:fs";
9
9
  import path from "node:path";
@@ -1 +1 @@
1
- {"version":3,"file":"isrCacheMiddleware.d.ts","sourceRoot":"","sources":["../../src/plugin/isrCacheMiddleware.ts"],"names":[],"mappings":"AA0CA,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQlG,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAA6B,MAAM,UAAU,CAAC;AAErE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,wCAAwC,CAAC;AAgChD,mCAAmC;AACnC,KAAK,WAAW,GAAG,cAAc,CAAC;AAElC,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tC,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,8BAA8B;IAC7C,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,aAAa,EAAE,8BAA8B,EAAE,CAAC;CAMjD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,EACtC,OAAO,GAAE,yBAA8B,GACtC,eAAe,CA6TjB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAsGR"}
@@ -19,7 +19,7 @@ async function revalidateTag() {
19
19
  await Promise.resolve();
20
20
  }
21
21
  async function revalidateContent(_options) {
22
- await Promise.resolve();
22
+ throw new Error("revalidateContent requires an active ISR runtime");
23
23
  }
24
24
  function registerInvalidator() {
25
25
  return () => {};