isr-engine 4.1.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.
- package/README.md +9 -0
- package/dist/CacheTagContext-Btmq8KCD.js +69 -0
- package/dist/CacheTagContext-Btmq8KCD.js.map +1 -0
- package/dist/{abVariantContext-CGBlCt0q.js → abVariantContext-yWZOqscY.js} +118 -38
- package/dist/abVariantContext-yWZOqscY.js.map +1 -0
- package/dist/cache/RedisInvalidationBus.d.ts.map +1 -1
- package/dist/cache/RedisResponseCacheBackend.d.ts +1 -0
- package/dist/cache/RedisResponseCacheBackend.d.ts.map +1 -1
- package/dist/cache/ResponseCacheBackend.d.ts +6 -0
- package/dist/cache/ResponseCacheBackend.d.ts.map +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/config/defineConfig.js +1 -1
- package/dist/context/CacheTagContext.d.ts +10 -0
- package/dist/context/CacheTagContext.d.ts.map +1 -0
- package/dist/{createCacheInspectorMiddleware-D6c-CINz.js → createCacheInspectorMiddleware-glgtcBcQ.js} +2 -2
- package/dist/{createCacheInspectorMiddleware-D6c-CINz.js.map → createCacheInspectorMiddleware-glgtcBcQ.js.map} +1 -1
- package/dist/createCachedFetcher-CgJscexq.js +186 -0
- package/dist/createCachedFetcher-CgJscexq.js.map +1 -0
- package/dist/{createISRApp-DTlZvKBm.js → createISRApp-BG-s3uuL.js} +356 -162
- package/dist/createISRApp-BG-s3uuL.js.map +1 -0
- package/dist/defaults/runtime/contentRevalidation.d.ts +26 -0
- package/dist/defaults/runtime/contentRevalidation.d.ts.map +1 -0
- package/dist/defaults/runtime/createCachedFetcher.d.ts +8 -2
- package/dist/defaults/runtime/createCachedFetcher.d.ts.map +1 -1
- package/dist/defaults/runtime/defineSiteHooks.d.ts +4 -7
- package/dist/defaults/runtime/defineSiteHooks.d.ts.map +1 -1
- package/dist/defaults/runtime/defineSiteHooks.js +655 -2
- package/dist/defaults/runtime/defineSiteHooks.js.map +1 -0
- package/dist/defaults/runtime/locale-links.client.d.ts.map +1 -1
- package/dist/defaults/runtime/renderCancellation.d.ts +3 -0
- package/dist/defaults/runtime/renderCancellation.d.ts.map +1 -0
- package/dist/engine/ISREngine.d.ts.map +1 -1
- package/dist/engine/seo/SEOEngine.d.ts +3 -0
- package/dist/engine/seo/SEOEngine.d.ts.map +1 -1
- package/dist/engine/seo/resolveSeoConfig.d.ts +6 -0
- package/dist/engine/seo/resolveSeoConfig.d.ts.map +1 -1
- package/dist/{i18n-B2mWmifk.js → i18n-BZpAOZeO.js} +3 -2
- package/dist/{i18n-B2mWmifk.js.map → i18n-BZpAOZeO.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/isr/ISRRoutes.d.ts +2 -0
- package/dist/isr/ISRRoutes.d.ts.map +1 -1
- package/dist/isr-engine.js +7 -7
- package/dist/middlewares/LocaleRedirect.d.ts +4 -3
- package/dist/middlewares/LocaleRedirect.d.ts.map +1 -1
- package/dist/plugin/coherentCacheStore.d.ts.map +1 -1
- package/dist/plugin/isrCacheMiddleware.d.ts +7 -6
- package/dist/plugin/isrCacheMiddleware.d.ts.map +1 -1
- package/dist/plugin/isrCacheStore.d.ts +2 -0
- package/dist/plugin/isrCacheStore.d.ts.map +1 -1
- package/dist/rsc/browser.d.ts +3 -0
- package/dist/rsc/browser.d.ts.map +1 -1
- package/dist/rsc/browser.js +4 -9
- package/dist/rsc/browser.js.map +1 -1
- package/dist/rsc/cacheTag.d.ts +1 -8
- package/dist/rsc/cacheTag.d.ts.map +1 -1
- package/dist/rsc/index.d.ts +1 -1
- package/dist/rsc/index.d.ts.map +1 -1
- package/dist/rsc/index.js +4 -3
- package/dist/rsc/revalidate.d.ts +18 -9
- package/dist/rsc/revalidate.d.ts.map +1 -1
- package/dist/{rsc-DWwcqD4W.js → rsc-BYq2vvnh.js} +2 -2
- package/dist/{rsc-DWwcqD4W.js.map → rsc-BYq2vvnh.js.map} +1 -1
- package/dist/runtime/LocaleLink.d.ts.map +1 -1
- package/dist/runtime/i18n.d.ts +3 -0
- package/dist/runtime/i18n.d.ts.map +1 -1
- package/dist/runtime/localePreference.d.ts +7 -0
- package/dist/runtime/localePreference.d.ts.map +1 -0
- package/dist/server/contentRevalidationRoute.d.ts +4 -0
- package/dist/server/contentRevalidationRoute.d.ts.map +1 -0
- package/dist/server/manager.d.ts.map +1 -1
- package/dist/server/opsConfig.d.ts +6 -1
- package/dist/server/opsConfig.d.ts.map +1 -1
- package/dist/server/productionRuntime.d.ts +2 -0
- package/dist/server/productionRuntime.d.ts.map +1 -1
- package/dist/server/publishedSitemap.d.ts +8 -0
- package/dist/server/publishedSitemap.d.ts.map +1 -0
- package/dist/types/ISRConfig.d.ts +27 -0
- package/dist/types/ISRConfig.d.ts.map +1 -1
- package/dist/utils/cookie.d.ts +2 -2
- package/dist/utils/cookie.d.ts.map +1 -1
- package/dist/utils/isrPath.d.ts +6 -0
- package/dist/utils/isrPath.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/context/CacheTagContext.ts +20 -0
- package/src/defaults/entry.server.ssr.tsx +10 -0
- package/src/defaults/runtime/contentRevalidation.ts +96 -0
- package/src/defaults/runtime/createCachedFetcher.ts +76 -20
- package/src/defaults/runtime/defineServerEntry.tsx +30 -29
- package/src/defaults/runtime/defineSiteHooks.ts +117 -80
- package/src/defaults/runtime/locale-links.client.ts +14 -4
- package/src/defaults/runtime/renderCancellation.ts +10 -0
- package/src/runtime/LocaleLink.tsx +8 -2
- package/src/runtime/i18n.ts +4 -0
- package/src/runtime/localePreference.ts +36 -0
- package/src/types/ISRConfig.ts +29 -0
- package/src/utils/cookie.ts +11 -4
- package/src/utils/isrPath.ts +24 -0
- package/dist/abVariantContext-CGBlCt0q.js.map +0 -1
- package/dist/cookie-DcUeYm6E.js +0 -42
- package/dist/cookie-DcUeYm6E.js.map +0 -1
- package/dist/createISRApp-DTlZvKBm.js.map +0 -1
- package/dist/defineSiteHooks-iwLiVChy.js +0 -716
- package/dist/defineSiteHooks-iwLiVChy.js.map +0 -1
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
import { i as resolveI18nConfig, n as negotiateLocale, r as parseLocale, s as trimTrailingSlashes } from "./i18n-B2mWmifk.js";
|
|
2
|
-
import { r as readCookie } from "./cookie-DcUeYm6E.js";
|
|
3
|
-
// src/defaults/runtime/createCachedFetcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* createCachedFetcher —— 通用 TTL + 并发去重数据加载器
|
|
6
|
-
*
|
|
7
|
-
* 设计目标:
|
|
8
|
-
* - 给 i18n / SEO 这类「url 或本地 json」加载场景一个唯一的成熟实现
|
|
9
|
-
* - 同 key 的并发请求自动合并为一次(避免缓存击穿)
|
|
10
|
-
* - 过期后台刷新可选(SWR 模式)
|
|
11
|
-
*
|
|
12
|
-
* 用例:
|
|
13
|
-
* const loadMessages = createCachedFetcher<IntlPayload>({
|
|
14
|
-
* key: ({ locale }) => `intl:${locale}`,
|
|
15
|
-
* ttl: 60_000,
|
|
16
|
-
* fetch: async ({ locale }) => {
|
|
17
|
-
* const r = await fetch(`https://cdn.example.com/i18n/${locale}.json`);
|
|
18
|
-
* return r.json();
|
|
19
|
-
* },
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // 在 hook 里用:
|
|
23
|
-
* loadIntl: (url) => loadMessages({ locale: detectLocale(url) }),
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* 极简 LRU —— 利用 Map 的插入顺序保留特性
|
|
27
|
-
*
|
|
28
|
-
* 不引外部 lru-cache 包是为了规避用户 RSC bundle 的 ESM/CJS interop 抖动
|
|
29
|
-
* (lru-cache@10 双发布在 rolldown 里偶发 default vs 命名导出错位)
|
|
30
|
-
* 本文件用于 i18n / SEO 数据的请求级缓存(典型 < 100 条),简单 Map 完全够用
|
|
31
|
-
*/
|
|
32
|
-
var TinyLRU = class {
|
|
33
|
-
max;
|
|
34
|
-
store = /* @__PURE__ */ new Map();
|
|
35
|
-
constructor(max) {
|
|
36
|
-
this.max = max;
|
|
37
|
-
}
|
|
38
|
-
get(k) {
|
|
39
|
-
const v = this.store.get(k);
|
|
40
|
-
if (v !== void 0) {
|
|
41
|
-
this.store.delete(k);
|
|
42
|
-
this.store.set(k, v);
|
|
43
|
-
}
|
|
44
|
-
return v;
|
|
45
|
-
}
|
|
46
|
-
set(k, v) {
|
|
47
|
-
if (this.store.has(k)) this.store.delete(k);
|
|
48
|
-
this.store.set(k, v);
|
|
49
|
-
if (this.store.size > this.max) {
|
|
50
|
-
const oldest = this.store.keys().next().value;
|
|
51
|
-
if (oldest !== void 0) this.store.delete(oldest);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
function createCachedFetcher(opts) {
|
|
56
|
-
const ttl = opts.ttl ?? 6e4;
|
|
57
|
-
const cache = new TinyLRU(opts.max ?? 500);
|
|
58
|
-
const inflight = /* @__PURE__ */ new Map();
|
|
59
|
-
async function load(arg) {
|
|
60
|
-
try {
|
|
61
|
-
const v = await opts.fetch(arg);
|
|
62
|
-
cache.set(opts.key(arg), {
|
|
63
|
-
value: v,
|
|
64
|
-
expiresAt: Date.now() + ttl
|
|
65
|
-
});
|
|
66
|
-
return v;
|
|
67
|
-
} catch (err) {
|
|
68
|
-
if (opts.fallback) return await opts.fallback(arg, err);
|
|
69
|
-
throw err;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return async function cachedFetcher(arg) {
|
|
73
|
-
const key = opts.key(arg);
|
|
74
|
-
const entry = cache.get(key);
|
|
75
|
-
const now = Date.now();
|
|
76
|
-
if (entry && entry.expiresAt > now) return entry.value;
|
|
77
|
-
if (entry && opts.swr) {
|
|
78
|
-
if (!inflight.has(key)) {
|
|
79
|
-
const p = load(arg).finally(() => inflight.delete(key));
|
|
80
|
-
inflight.set(key, p);
|
|
81
|
-
p.catch(() => {});
|
|
82
|
-
}
|
|
83
|
-
return entry.value;
|
|
84
|
-
}
|
|
85
|
-
const existing = inflight.get(key);
|
|
86
|
-
if (existing) return existing;
|
|
87
|
-
const p = load(arg).finally(() => inflight.delete(key));
|
|
88
|
-
inflight.set(key, p);
|
|
89
|
-
return p;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
// src/defaults/runtime/defineSiteHooks.ts
|
|
93
|
-
/**
|
|
94
|
-
* defineSiteHooks —— 高阶 FaaS hooks 工厂(声明式配置 → 完整 ServerEntryHooks)
|
|
95
|
-
*
|
|
96
|
-
* 让用户的 src/entry.server.tsx 收紧到「只写请求期 hooks」。
|
|
97
|
-
* 部署/平台配置(api/site/redis/experiments/i18n/seo/telemetry)放
|
|
98
|
-
* ssr.config.ts 的 runtime 字段;entry.server.tsx 只保留 beforeRequest / onError。
|
|
99
|
-
* 注:experiments 是 experimentation platform 的通用字段名,业务侧可理解为 A/B testing。
|
|
100
|
-
* 内部固化:
|
|
101
|
-
* - i18n 字典缓存(createCachedFetcher: TTL/SWR/dedup/fallback)
|
|
102
|
-
* - SEO 路由表 pattern → resolver
|
|
103
|
-
* - locale 检测(cookie → Accept-Language → 默认)
|
|
104
|
-
* - i18n/seo 远端相对 endpoint 统一使用 runtime.services.api
|
|
105
|
-
* - 服务端渲染错误打印 + runtime.telemetry errors endpoint 上报
|
|
106
|
-
*
|
|
107
|
-
* beforeRequest 的边界:
|
|
108
|
-
* - 它在每次 HTTP/RSC 请求进入渲染前执行。
|
|
109
|
-
* - 返回值会合并进 RequestContext,Server Component 用 getRequestContext() 读取。
|
|
110
|
-
* - 适合放 userId / tenantId / requestSegment 这类请求现场字段。
|
|
111
|
-
* - 不适合放 Redis、SEO、i18n、A/B 定义、慢 API 或数据库查询。
|
|
112
|
-
* - A/B variant 由 runtime.experiments + engine middleware 注入,页面用 getVariant()。
|
|
113
|
-
*
|
|
114
|
-
* 用户态写法(商业项目推荐):
|
|
115
|
-
* import { defineAdminSiteHooks } from 'isr-engine/site-hooks';
|
|
116
|
-
*
|
|
117
|
-
* export default defineAdminSiteHooks({
|
|
118
|
-
* beforeRequest: req => ({
|
|
119
|
-
* userId: req.headers.get('x-user-id') ?? undefined,
|
|
120
|
-
* tenantId: req.headers.get('x-tenant-id') ?? 'public',
|
|
121
|
-
* requestSegment: req.headers.get('x-segment') ?? 'default',
|
|
122
|
-
* }),
|
|
123
|
-
* });
|
|
124
|
-
*/
|
|
125
|
-
function createEmptyRuntimeConfig() {
|
|
126
|
-
return {
|
|
127
|
-
site: void 0,
|
|
128
|
-
services: {
|
|
129
|
-
api: void 0,
|
|
130
|
-
telemetry: void 0
|
|
131
|
-
},
|
|
132
|
-
redis: void 0,
|
|
133
|
-
experiments: {},
|
|
134
|
-
i18n: void 0,
|
|
135
|
-
seo: void 0,
|
|
136
|
-
telemetry: false
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function escapeSeoPatternLiteral(literal) {
|
|
140
|
-
return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
141
|
-
}
|
|
142
|
-
/** Both SEO entry points recognize named parameters and a terminal /* before escaping literals. */
|
|
143
|
-
function compileSeoPattern(pattern, captureWildcard = false) {
|
|
144
|
-
const paramNames = [];
|
|
145
|
-
const wildcard = pattern.endsWith("/*");
|
|
146
|
-
const base = wildcard ? pattern.slice(0, -2) : pattern;
|
|
147
|
-
let cursor = 0;
|
|
148
|
-
let source = "";
|
|
149
|
-
for (const match of base.matchAll(/:(\w+)/g)) {
|
|
150
|
-
source += escapeSeoPatternLiteral(base.slice(cursor, match.index)) + "([^/]+)";
|
|
151
|
-
paramNames.push(match[1]);
|
|
152
|
-
cursor = match.index + match[0].length;
|
|
153
|
-
}
|
|
154
|
-
source += escapeSeoPatternLiteral(base.slice(cursor));
|
|
155
|
-
if (wildcard) {
|
|
156
|
-
if (captureWildcard) paramNames.push("wildcard");
|
|
157
|
-
source += captureWildcard ? "(?:/(.*))?" : "(?:/.*)?";
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
re: new RegExp(`^${source}$`),
|
|
161
|
-
paramNames
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function fillTemplate(template, vars) {
|
|
165
|
-
return template.replace(/\{(\w+)\}/g, (_, k) => encodeURIComponent(vars[k] ?? ""));
|
|
166
|
-
}
|
|
167
|
-
function createAdminIntlLoader(options = {}) {
|
|
168
|
-
const endpoint = options.endpoint ?? "/api/i18n/{locale}/manifest";
|
|
169
|
-
const fallbackMessages = options.fallbackMessages ?? {};
|
|
170
|
-
const defaultLocale = options.defaultLocale;
|
|
171
|
-
const supportedLocales = Object.keys(fallbackMessages);
|
|
172
|
-
return async (locale, ctx) => {
|
|
173
|
-
const normalizedLocale = supportedLocales.length && defaultLocale ? matchConfiguredLocale(locale, supportedLocales) ?? defaultLocale : locale;
|
|
174
|
-
const remoteUrl = resolveAdminUrl(endpoint, { locale: normalizedLocale }, ctx);
|
|
175
|
-
const remoteMessages = extractIntlMessagesOrNull(remoteUrl ? await fetchJsonWithTimeout(remoteUrl, options.timeoutMs) : null);
|
|
176
|
-
const localMessages = fallbackMessages[normalizedLocale] ?? (defaultLocale ? fallbackMessages[defaultLocale] : void 0) ?? {};
|
|
177
|
-
return {
|
|
178
|
-
locale: normalizedLocale,
|
|
179
|
-
messages: remoteMessages ?? normalizeMessages(localMessages),
|
|
180
|
-
direction: rtlOf(normalizedLocale),
|
|
181
|
-
source: remoteMessages ? options.remoteSource ?? "remote" : options.fallbackSource ?? "local-fallback"
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
function createAdminSeoLoader(options = {}) {
|
|
186
|
-
const endpoint = options.endpoint ?? "/api/seo?path={pathname}";
|
|
187
|
-
const fallbackEntries = options.fallbackEntries ?? [];
|
|
188
|
-
const compiledResolvers = (options.dynamicResolvers ?? []).map((resolver) => ({
|
|
189
|
-
...compileSeoPattern(resolver.pattern, true),
|
|
190
|
-
resolver
|
|
191
|
-
}));
|
|
192
|
-
return async (params, ctx) => {
|
|
193
|
-
const pathname = normalizePathname(params.pathname || "/");
|
|
194
|
-
const remoteUrl = resolveAdminUrl(endpoint, {
|
|
195
|
-
...params,
|
|
196
|
-
pathname
|
|
197
|
-
}, ctx);
|
|
198
|
-
const remoteMeta = extractSeoMetaOrNull(remoteUrl ? await fetchJsonWithTimeout(remoteUrl, options.timeoutMs) : null);
|
|
199
|
-
if (remoteMeta) return remoteMeta;
|
|
200
|
-
if (compiledResolvers.length > 0) for (const compiled of compiledResolvers) {
|
|
201
|
-
const m = pathname.match(compiled.re);
|
|
202
|
-
if (!m) continue;
|
|
203
|
-
const resolverParams = {};
|
|
204
|
-
compiled.paramNames.forEach((name, i) => {
|
|
205
|
-
resolverParams[name] = m[i + 1] ?? "";
|
|
206
|
-
});
|
|
207
|
-
try {
|
|
208
|
-
const result = await compiled.resolver.resolve({
|
|
209
|
-
pathname,
|
|
210
|
-
params: resolverParams,
|
|
211
|
-
locale: typeof params.locale === "string" ? params.locale : void 0,
|
|
212
|
-
services: ctx.services
|
|
213
|
-
});
|
|
214
|
-
if (result) return result;
|
|
215
|
-
} catch (err) {
|
|
216
|
-
console.warn("[seo] dynamic resolver threw, falling through to fallback", err);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const fallback = fallbackEntries.find((entry) => normalizePathname(entry.path) === pathname);
|
|
220
|
-
if (!fallback) return null;
|
|
221
|
-
const meta = { ...fallback };
|
|
222
|
-
delete meta.path;
|
|
223
|
-
delete meta.group;
|
|
224
|
-
return meta;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function defineAdminSiteHooks(options = {}) {
|
|
228
|
-
return createAdminSiteHooks(options, createEmptyRuntimeConfig());
|
|
229
|
-
}
|
|
230
|
-
function createAdminSeoEntry(seo, runtimeSeo) {
|
|
231
|
-
return {
|
|
232
|
-
load: createAdminSeoLoader({
|
|
233
|
-
endpoint: seo.endpoint ?? runtimeSeo.endpoint,
|
|
234
|
-
fallbackEntries: normalizeAdminSeoFallbackEntries(seo.fallbackLocal ?? runtimeSeo.fallbackLocal),
|
|
235
|
-
timeoutMs: seo.timeoutMs ?? runtimeSeo.timeoutMs,
|
|
236
|
-
dynamicResolvers: seo.dynamicResolvers ?? runtimeSeo.dynamicResolvers
|
|
237
|
-
}),
|
|
238
|
-
ttl: seo.ttl ?? runtimeSeo.ttl ?? 6e4
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function createAdminSiteHooks(options, runtime) {
|
|
242
|
-
const runtimeI18n = runtime.i18n ?? {};
|
|
243
|
-
const runtimeSeo = runtime.seo ?? {};
|
|
244
|
-
const i18n = options.i18n ?? {};
|
|
245
|
-
const seo = options.seo ?? {};
|
|
246
|
-
const fallbackMessages = i18n.fallbackLocal ?? runtimeI18n.fallbackLocal ?? {};
|
|
247
|
-
const locales = i18n.locales ?? runtimeI18n.locales ?? (Object.keys(fallbackMessages).length > 0 ? Object.keys(fallbackMessages) : ["en"]);
|
|
248
|
-
const defaultLocale = i18n.defaultLocale ?? runtimeI18n.defaultLocale ?? locales[0] ?? "en";
|
|
249
|
-
const output = createSiteHooks({
|
|
250
|
-
beforeRequest: options.beforeRequest,
|
|
251
|
-
onError: options.onError,
|
|
252
|
-
headExtras: options.headExtras,
|
|
253
|
-
intl: {
|
|
254
|
-
locales,
|
|
255
|
-
defaultLocale,
|
|
256
|
-
prefixDefault: i18n.prefixDefault ?? runtimeI18n.prefixDefault,
|
|
257
|
-
detect: i18n.detect,
|
|
258
|
-
load: createAdminIntlLoader({
|
|
259
|
-
endpoint: i18n.endpoint ?? runtimeI18n.endpoint,
|
|
260
|
-
fallbackMessages,
|
|
261
|
-
defaultLocale,
|
|
262
|
-
timeoutMs: i18n.timeoutMs ?? runtimeI18n.timeoutMs,
|
|
263
|
-
remoteSource: i18n.remoteSource ?? runtimeI18n.remoteSource,
|
|
264
|
-
fallbackSource: i18n.fallbackSource ?? runtimeI18n.fallbackSource
|
|
265
|
-
}),
|
|
266
|
-
ttl: i18n.ttl ?? runtimeI18n.ttl ?? 6e4
|
|
267
|
-
},
|
|
268
|
-
seo: { "/*": createAdminSeoEntry(seo, runtimeSeo) }
|
|
269
|
-
}, runtime);
|
|
270
|
-
Object.defineProperty(output, "__configureRuntime", {
|
|
271
|
-
enumerable: false,
|
|
272
|
-
configurable: true,
|
|
273
|
-
value: (nextRuntime) => createAdminSiteHooks(options, nextRuntime)
|
|
274
|
-
});
|
|
275
|
-
return output;
|
|
276
|
-
}
|
|
277
|
-
function defineSiteHooks(config) {
|
|
278
|
-
return createSiteHooks(config, createEmptyRuntimeConfig());
|
|
279
|
-
}
|
|
280
|
-
function applyRuntimeToServerHooks(hooks, runtime) {
|
|
281
|
-
const maybeRuntimeAware = hooks;
|
|
282
|
-
if (typeof maybeRuntimeAware.__configureRuntime === "function") return maybeRuntimeAware.__configureRuntime(runtime);
|
|
283
|
-
const baseHooks = hooks;
|
|
284
|
-
const services = resolveRuntimeServices(runtime);
|
|
285
|
-
const siteBaseUrl = baseHooks.siteBaseUrl ?? runtime.site;
|
|
286
|
-
const apiBaseUrl = baseHooks.apiBaseUrl ?? services.api;
|
|
287
|
-
const hasUserContentHooks = !!baseHooks.intl || typeof baseHooks.loadIntl === "function" || typeof baseHooks.loadSeoMeta === "function";
|
|
288
|
-
if (!hasUserContentHooks && hasRuntimeContentConfig(runtime)) {
|
|
289
|
-
const runtimeHooks = createAdminSiteHooks({
|
|
290
|
-
beforeRequest: baseHooks.beforeRequest,
|
|
291
|
-
onError: baseHooks.onError
|
|
292
|
-
}, runtime);
|
|
293
|
-
return {
|
|
294
|
-
...hooks,
|
|
295
|
-
siteBaseUrl,
|
|
296
|
-
apiBaseUrl,
|
|
297
|
-
intl: runtimeHooks.intl,
|
|
298
|
-
beforeRequest: runtimeHooks.beforeRequest,
|
|
299
|
-
loadIntl: runtimeHooks.loadIntl,
|
|
300
|
-
loadSeoMeta: runtimeHooks.loadSeoMeta,
|
|
301
|
-
onError: runtimeHooks.onError
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
const runtimeSeo = runtime.seo;
|
|
305
|
-
const runtimeSeoHook = !hasUserContentHooks && runtimeSeo?.dynamicResolvers?.length ? createSiteHooks({
|
|
306
|
-
intl: runtime.i18n,
|
|
307
|
-
seo: { "/*": createAdminSeoEntry({}, runtimeSeo) }
|
|
308
|
-
}, runtime).loadSeoMeta : void 0;
|
|
309
|
-
return {
|
|
310
|
-
...hooks,
|
|
311
|
-
siteBaseUrl,
|
|
312
|
-
apiBaseUrl,
|
|
313
|
-
...runtimeSeoHook && { loadSeoMeta: runtimeSeoHook }
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
function createSiteHooks(config, runtime) {
|
|
317
|
-
const services = resolveRuntimeServices(runtime);
|
|
318
|
-
const api = services.api ?? "";
|
|
319
|
-
const site = runtime.site ?? "";
|
|
320
|
-
const runtimeCtx = {
|
|
321
|
-
runtime,
|
|
322
|
-
services,
|
|
323
|
-
telemetry: services.telemetry,
|
|
324
|
-
site: site || void 0
|
|
325
|
-
};
|
|
326
|
-
const fetchJson = async (path, baseUrl) => {
|
|
327
|
-
try {
|
|
328
|
-
if (!baseUrl) return null;
|
|
329
|
-
const r = await fetch(baseUrl + path);
|
|
330
|
-
if (!r.ok) return null;
|
|
331
|
-
return await r.json();
|
|
332
|
-
} catch {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
const intlCfg = config.intl ?? {};
|
|
337
|
-
const supportedLocales = intlCfg.locales?.length ? intlCfg.locales : void 0;
|
|
338
|
-
const negotiationConfig = supportedLocales ? resolveI18nConfig(intlCfg) : {
|
|
339
|
-
locales: ["zh-CN", "en"],
|
|
340
|
-
defaultLocale: intlCfg.defaultLocale ?? "zh-CN"
|
|
341
|
-
};
|
|
342
|
-
const detectLocale = intlCfg.detect ?? ((req) => {
|
|
343
|
-
if (supportedLocales) try {
|
|
344
|
-
const pathname = new URL(req.url).pathname;
|
|
345
|
-
const first = (pathname.endsWith("_.rsc") ? pathname.slice(0, -5) || "/" : pathname).split("/")[1];
|
|
346
|
-
if (first && supportedLocales.includes(first)) return first;
|
|
347
|
-
} catch {}
|
|
348
|
-
const localeCookie = readCookie(req, "locale");
|
|
349
|
-
if (localeCookie) {
|
|
350
|
-
const matchedCookie = supportedLocales ? matchConfiguredLocale(localeCookie, supportedLocales) : localeCookie;
|
|
351
|
-
if (matchedCookie) return matchedCookie;
|
|
352
|
-
}
|
|
353
|
-
return negotiateLocale(req.headers.get("accept-language"), negotiationConfig);
|
|
354
|
-
});
|
|
355
|
-
const intlLoader = createCachedFetcher({
|
|
356
|
-
key: (locale) => `intl:${locale}`,
|
|
357
|
-
ttl: intlCfg.ttl ?? 6e4,
|
|
358
|
-
swr: true,
|
|
359
|
-
fetch: async (locale) => {
|
|
360
|
-
if (intlCfg.load) return await intlCfg.load(locale, runtimeCtx) ?? {
|
|
361
|
-
locale,
|
|
362
|
-
messages: {},
|
|
363
|
-
direction: rtlOf(locale)
|
|
364
|
-
};
|
|
365
|
-
if (intlCfg.endpoint) {
|
|
366
|
-
const url = fillTemplate(intlCfg.endpoint, { locale });
|
|
367
|
-
const json = await fetchJson(url, services.api);
|
|
368
|
-
if (json !== null && intlCfg.transform) {
|
|
369
|
-
const transformed = await intlCfg.transform(json, locale);
|
|
370
|
-
if (transformed) return {
|
|
371
|
-
...transformed,
|
|
372
|
-
direction: transformed.direction ?? rtlOf(transformed.locale)
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
return {
|
|
376
|
-
locale,
|
|
377
|
-
messages: extractIntlMessages(json),
|
|
378
|
-
direction: rtlOf(locale)
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
return {
|
|
382
|
-
locale,
|
|
383
|
-
messages: {},
|
|
384
|
-
direction: rtlOf(locale)
|
|
385
|
-
};
|
|
386
|
-
},
|
|
387
|
-
fallback: (locale) => ({
|
|
388
|
-
locale,
|
|
389
|
-
messages: {},
|
|
390
|
-
direction: rtlOf(locale)
|
|
391
|
-
})
|
|
392
|
-
});
|
|
393
|
-
const seoRoutes = [];
|
|
394
|
-
const remoteCaches = /* @__PURE__ */ new Map();
|
|
395
|
-
for (const [pattern, value] of Object.entries(config.seo ?? {})) {
|
|
396
|
-
const { re, paramNames } = compileSeoPattern(pattern);
|
|
397
|
-
if (typeof value === "function") {
|
|
398
|
-
seoRoutes.push({
|
|
399
|
-
re,
|
|
400
|
-
paramNames,
|
|
401
|
-
resolver: value
|
|
402
|
-
});
|
|
403
|
-
continue;
|
|
404
|
-
}
|
|
405
|
-
if ("endpoint" in value && typeof value.endpoint === "string") {
|
|
406
|
-
const remote = value;
|
|
407
|
-
const cache = createCachedFetcher({
|
|
408
|
-
key: (paramKey) => `seo:${pattern}:${paramKey}`,
|
|
409
|
-
ttl: remote.ttl ?? 3e5,
|
|
410
|
-
fetch: async (paramKey) => {
|
|
411
|
-
const params = JSON.parse(paramKey);
|
|
412
|
-
const data = await fetchJson(fillTemplate(remote.endpoint, params), services.api);
|
|
413
|
-
if (data === null) return null;
|
|
414
|
-
return remote.transform(data, params);
|
|
415
|
-
},
|
|
416
|
-
fallback: () => null
|
|
417
|
-
});
|
|
418
|
-
remoteCaches.set(pattern, cache);
|
|
419
|
-
seoRoutes.push({
|
|
420
|
-
re,
|
|
421
|
-
paramNames,
|
|
422
|
-
resolver: (params) => cache(JSON.stringify(params))
|
|
423
|
-
});
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
if ("load" in value && typeof value.load === "function") {
|
|
427
|
-
const local = value;
|
|
428
|
-
const cache = createCachedFetcher({
|
|
429
|
-
key: (paramKey) => `seo-local:${pattern}:${paramKey}`,
|
|
430
|
-
ttl: local.ttl ?? 3e5,
|
|
431
|
-
fetch: async (paramKey) => {
|
|
432
|
-
const params = JSON.parse(paramKey);
|
|
433
|
-
return await local.load(params, runtimeCtx);
|
|
434
|
-
},
|
|
435
|
-
fallback: () => null
|
|
436
|
-
});
|
|
437
|
-
remoteCaches.set(pattern, cache);
|
|
438
|
-
seoRoutes.push({
|
|
439
|
-
re,
|
|
440
|
-
paramNames,
|
|
441
|
-
resolver: (params) => cache(JSON.stringify(params))
|
|
442
|
-
});
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
const staticMeta = value;
|
|
446
|
-
const withDefaults = {
|
|
447
|
-
...staticMeta,
|
|
448
|
-
canonical: staticMeta.canonical ?? (site && pattern && pattern !== "/*" ? `${site}${pattern}` : staticMeta.canonical)
|
|
449
|
-
};
|
|
450
|
-
seoRoutes.push({
|
|
451
|
-
re,
|
|
452
|
-
paramNames,
|
|
453
|
-
resolver: () => withDefaults
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
const platformOnError = createPlatformOnError(runtime, runtimeCtx);
|
|
457
|
-
const onError = async (err, req, ctx) => {
|
|
458
|
-
platformOnError(err, req, ctx);
|
|
459
|
-
if (config.onError) await config.onError(err, req, ctx);
|
|
460
|
-
};
|
|
461
|
-
const output = {
|
|
462
|
-
siteBaseUrl: site || void 0,
|
|
463
|
-
apiBaseUrl: api || void 0,
|
|
464
|
-
intl: config.intl,
|
|
465
|
-
headExtras: config.headExtras,
|
|
466
|
-
async beforeRequest(req, _engineCtx) {
|
|
467
|
-
return {
|
|
468
|
-
locale: detectLocale(req),
|
|
469
|
-
...config.beforeRequest ? await config.beforeRequest(req) : {}
|
|
470
|
-
};
|
|
471
|
-
},
|
|
472
|
-
async loadIntl(req) {
|
|
473
|
-
return intlLoader(detectLocale(req));
|
|
474
|
-
},
|
|
475
|
-
async loadSeoMeta(req) {
|
|
476
|
-
const url = new URL(req.url);
|
|
477
|
-
const locale = detectLocale(req);
|
|
478
|
-
let pathForRouting = url.pathname;
|
|
479
|
-
if (pathForRouting.endsWith("_.rsc")) pathForRouting = pathForRouting.slice(0, -5) || "/";
|
|
480
|
-
const intlConfig = config.intl;
|
|
481
|
-
const cleanPath = intlConfig?.locales && intlConfig.locales.length > 0 ? parseLocale(pathForRouting, {
|
|
482
|
-
locales: intlConfig.locales,
|
|
483
|
-
defaultLocale: intlConfig.defaultLocale ?? intlConfig.locales[0],
|
|
484
|
-
prefixDefault: intlConfig.prefixDefault
|
|
485
|
-
}).pathname : pathForRouting;
|
|
486
|
-
for (const { re, paramNames, resolver } of seoRoutes) {
|
|
487
|
-
const m = cleanPath.match(re);
|
|
488
|
-
if (m) {
|
|
489
|
-
const params = {
|
|
490
|
-
pathname: cleanPath,
|
|
491
|
-
locale
|
|
492
|
-
};
|
|
493
|
-
paramNames.forEach((n, i) => params[n] = m[i + 1] ?? "");
|
|
494
|
-
return await resolver(params);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return null;
|
|
498
|
-
},
|
|
499
|
-
onError
|
|
500
|
-
};
|
|
501
|
-
Object.defineProperty(output, "__configureRuntime", {
|
|
502
|
-
enumerable: false,
|
|
503
|
-
configurable: true,
|
|
504
|
-
value: (nextRuntime) => createSiteHooks(config, nextRuntime)
|
|
505
|
-
});
|
|
506
|
-
return output;
|
|
507
|
-
}
|
|
508
|
-
function rtlOf(locale) {
|
|
509
|
-
return /^(ar|he|fa|ur)/.test(locale) ? "rtl" : "ltr";
|
|
510
|
-
}
|
|
511
|
-
function matchConfiguredLocale(value, supportedLocales) {
|
|
512
|
-
const lower = value.toLowerCase();
|
|
513
|
-
const exact = supportedLocales.find((locale) => locale.toLowerCase() === lower);
|
|
514
|
-
if (exact) return exact;
|
|
515
|
-
const prefix = lower.split("-")[0];
|
|
516
|
-
return supportedLocales.find((locale) => locale.toLowerCase().split("-")[0] === prefix);
|
|
517
|
-
}
|
|
518
|
-
function extractIntlMessages(data) {
|
|
519
|
-
return extractIntlMessagesOrNull(data) ?? {};
|
|
520
|
-
}
|
|
521
|
-
function extractIntlMessagesOrNull(data) {
|
|
522
|
-
if (!data || typeof data !== "object") return null;
|
|
523
|
-
const raw = data;
|
|
524
|
-
const dataValue = raw.data;
|
|
525
|
-
const candidate = raw.strings ?? raw.messages ?? (isRecord(dataValue) && "strings" in dataValue ? dataValue.strings : dataValue);
|
|
526
|
-
if (!candidate || typeof candidate !== "object") return null;
|
|
527
|
-
return normalizeMessages(candidate);
|
|
528
|
-
}
|
|
529
|
-
function normalizeMessages(messages) {
|
|
530
|
-
if (isFlatRecord(messages)) return expandDottedRecord(messages);
|
|
531
|
-
return messages;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* 逐层剥 envelope —— admin 在不同分支返回三种 shape:
|
|
535
|
-
* - flat:`{ title, description, ... }`(admin no-locale fast path)
|
|
536
|
-
* - 单层:`{ data: { title, ... } }`(旧版本)
|
|
537
|
-
* - 双层:`{ status, code, data: { data: { title, ... }, version } }`
|
|
538
|
-
* (api-envelope plugin 包了一层,resolvePublic 自己又是 `{ data, version }`,
|
|
539
|
-
* 所以 locale-aware 路径会双层 wrap)
|
|
540
|
-
*
|
|
541
|
-
* 停止条件:候选对象有 `title` / `description`(SEO 形状),或没有 `data` 字段可剥。
|
|
542
|
-
*/
|
|
543
|
-
function extractSeoMetaOrNull(data) {
|
|
544
|
-
let candidate = data;
|
|
545
|
-
for (let i = 0; i < 4; i++) {
|
|
546
|
-
if (!isRecord(candidate)) return null;
|
|
547
|
-
if ("title" in candidate || "description" in candidate) break;
|
|
548
|
-
if ("data" in candidate) {
|
|
549
|
-
candidate = candidate.data;
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
return null;
|
|
553
|
-
}
|
|
554
|
-
if (!isRecord(candidate)) return null;
|
|
555
|
-
return candidate;
|
|
556
|
-
}
|
|
557
|
-
function normalizeAdminSeoFallbackEntries(entries = []) {
|
|
558
|
-
return entries.filter((entry) => typeof entry.path === "string");
|
|
559
|
-
}
|
|
560
|
-
function createPlatformOnError(runtime, ctx) {
|
|
561
|
-
const reportServerError = createServerErrorEndpointReporter(runtime, ctx);
|
|
562
|
-
return (err, req, errorCtx) => {
|
|
563
|
-
console.error("[onError]", {
|
|
564
|
-
traceId: errorCtx.traceId,
|
|
565
|
-
locale: errorCtx.locale,
|
|
566
|
-
url: req.url,
|
|
567
|
-
msg: err instanceof Error ? err.message : String(err)
|
|
568
|
-
});
|
|
569
|
-
reportServerError?.(err, req, errorCtx);
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
function createServerErrorEndpointReporter(runtime, ctx) {
|
|
573
|
-
const config = runtime.telemetry;
|
|
574
|
-
if (config === false || !config || config.errors === false) return null;
|
|
575
|
-
const endpoint = resolveAdminUrl((config.errors ?? {}).endpoint ?? "/api/observability/errors", {}, ctx, { baseUrl: (runtimeCtx) => runtimeCtx.services.telemetry ?? runtimeCtx.services.api });
|
|
576
|
-
if (!endpoint) return null;
|
|
577
|
-
const app = config.app ?? "isr-engine-app";
|
|
578
|
-
const release = config.release;
|
|
579
|
-
const environment = config.environment;
|
|
580
|
-
const includeQueryString = config.includeQueryString === true;
|
|
581
|
-
return (err, req, errorCtx) => {
|
|
582
|
-
const id = createServerReportId();
|
|
583
|
-
if (!id) return;
|
|
584
|
-
const report = normalizeServerErrorReport(err, req, errorCtx, {
|
|
585
|
-
id,
|
|
586
|
-
release,
|
|
587
|
-
environment,
|
|
588
|
-
includeQueryString
|
|
589
|
-
});
|
|
590
|
-
fetch(endpoint, {
|
|
591
|
-
method: "POST",
|
|
592
|
-
headers: {
|
|
593
|
-
"content-type": "application/json",
|
|
594
|
-
accept: "application/json"
|
|
595
|
-
},
|
|
596
|
-
body: JSON.stringify({
|
|
597
|
-
app,
|
|
598
|
-
sentAt: Date.now(),
|
|
599
|
-
reports: [report]
|
|
600
|
-
}),
|
|
601
|
-
signal: typeof AbortSignal !== "undefined" ? AbortSignal.timeout(1e3) : void 0
|
|
602
|
-
}).catch(() => {});
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
function normalizeServerErrorReport(err, req, ctx, options) {
|
|
606
|
-
const error = err instanceof Error ? err : null;
|
|
607
|
-
const message = error?.message || String(err);
|
|
608
|
-
const name = error?.name || "Error";
|
|
609
|
-
const url = safeRequestPath(req.url, options.includeQueryString);
|
|
610
|
-
return {
|
|
611
|
-
id: options.id,
|
|
612
|
-
ts: Date.now(),
|
|
613
|
-
level: "error",
|
|
614
|
-
message,
|
|
615
|
-
name,
|
|
616
|
-
stack: error?.stack,
|
|
617
|
-
release: options.release,
|
|
618
|
-
environment: options.environment,
|
|
619
|
-
url,
|
|
620
|
-
source: "server-render",
|
|
621
|
-
tags: {
|
|
622
|
-
traceId: ctx.traceId,
|
|
623
|
-
locale: ctx.locale
|
|
624
|
-
},
|
|
625
|
-
extra: {
|
|
626
|
-
method: req.method,
|
|
627
|
-
pathname: url.split("?")[0] || "/"
|
|
628
|
-
},
|
|
629
|
-
fingerprint: [
|
|
630
|
-
"server-render",
|
|
631
|
-
name,
|
|
632
|
-
message.slice(0, 160)
|
|
633
|
-
]
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function safeRequestPath(rawUrl, includeQueryString) {
|
|
637
|
-
try {
|
|
638
|
-
const url = new URL(rawUrl);
|
|
639
|
-
return includeQueryString ? `${url.pathname}${url.search}` : url.pathname;
|
|
640
|
-
} catch {
|
|
641
|
-
return includeQueryString ? rawUrl : "/";
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
function createServerReportId() {
|
|
645
|
-
try {
|
|
646
|
-
return `srv_${crypto.randomUUID()}`;
|
|
647
|
-
} catch {
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
async function fetchJsonWithTimeout(url, timeoutMs = 1200) {
|
|
652
|
-
try {
|
|
653
|
-
const response = await fetch(url, {
|
|
654
|
-
headers: { Accept: "application/json" },
|
|
655
|
-
signal: timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : void 0
|
|
656
|
-
});
|
|
657
|
-
if (!response.ok) return null;
|
|
658
|
-
return await response.json();
|
|
659
|
-
} catch {
|
|
660
|
-
return null;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
function resolveAdminUrl(endpoint, vars, ctx, options = {}) {
|
|
664
|
-
const filled = fillTemplate(endpoint, vars);
|
|
665
|
-
if (/^(https?:)?\/\//i.test(filled)) return filled;
|
|
666
|
-
const base = resolveRuntimeServiceBase(ctx, options.baseUrl);
|
|
667
|
-
if (!base) return null;
|
|
668
|
-
return `${trimTrailingSlashes(base)}/${filled.replace(/^\/+/, "")}`;
|
|
669
|
-
}
|
|
670
|
-
function resolveRuntimeServiceBase(ctx, baseUrl) {
|
|
671
|
-
if (typeof baseUrl === "function") return baseUrl(ctx) ?? null;
|
|
672
|
-
if (baseUrl) return baseUrl;
|
|
673
|
-
return ctx.services.api ?? null;
|
|
674
|
-
}
|
|
675
|
-
function resolveRuntimeServices(runtime) {
|
|
676
|
-
const services = runtime.services ?? {};
|
|
677
|
-
const api = services.api;
|
|
678
|
-
return {
|
|
679
|
-
api,
|
|
680
|
-
telemetry: services.telemetry ?? api
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function hasRuntimeContentConfig(runtime) {
|
|
684
|
-
return !!(runtime.i18n?.endpoint || runtime.i18n?.fallbackLocal || runtime.seo?.endpoint || runtime.seo?.fallbackLocal || runtime.telemetry);
|
|
685
|
-
}
|
|
686
|
-
function normalizePathname(pathname) {
|
|
687
|
-
if (pathname === "/") return "/";
|
|
688
|
-
return trimTrailingSlashes(pathname) || "/";
|
|
689
|
-
}
|
|
690
|
-
function isRecord(value) {
|
|
691
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
692
|
-
}
|
|
693
|
-
function isFlatRecord(value) {
|
|
694
|
-
if (!value || typeof value !== "object") return false;
|
|
695
|
-
return Object.keys(value).some((key) => key.includes("."));
|
|
696
|
-
}
|
|
697
|
-
function expandDottedRecord(flat) {
|
|
698
|
-
const out = {};
|
|
699
|
-
for (const [key, value] of Object.entries(flat)) {
|
|
700
|
-
const parts = key.split(".");
|
|
701
|
-
let cur = out;
|
|
702
|
-
parts.forEach((part, index) => {
|
|
703
|
-
if (index === parts.length - 1) {
|
|
704
|
-
cur[part] = value;
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
const next = cur[part];
|
|
708
|
-
if (!next || typeof next !== "object") cur[part] = {};
|
|
709
|
-
cur = cur[part];
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
return out;
|
|
713
|
-
}
|
|
714
|
-
export { defineSiteHooks as a, defineAdminSiteHooks as i, createAdminIntlLoader as n, createCachedFetcher as o, createAdminSeoLoader as r, applyRuntimeToServerHooks as t };
|
|
715
|
-
|
|
716
|
-
//# sourceMappingURL=defineSiteHooks-iwLiVChy.js.map
|