isr-engine 2.6.21 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +97 -616
  2. package/dist/Logger-DqBS_3v8.cjs +184 -0
  3. package/dist/Logger-DqBS_3v8.cjs.map +1 -0
  4. package/dist/Logger-bg-doGwZ.js +174 -0
  5. package/dist/Logger-bg-doGwZ.js.map +1 -0
  6. package/dist/abVariantContext-BvAMuhjj.cjs +510 -0
  7. package/dist/abVariantContext-BvAMuhjj.cjs.map +1 -0
  8. package/dist/abVariantContext-Ud3aZ1yk.js +355 -0
  9. package/dist/abVariantContext-Ud3aZ1yk.js.map +1 -0
  10. package/dist/app/createISRApp.d.ts +2 -2
  11. package/dist/cli/cli.cjs +1 -1
  12. package/dist/cli/cli.js +1 -1
  13. package/dist/cli/start.d.ts +1 -1
  14. package/dist/config/loadConfig.d.ts +1 -1
  15. package/dist/config/normalizeEngineConfig.d.ts +1 -1
  16. package/dist/config/normalizeEngineConfig.d.ts.map +1 -1
  17. package/dist/config/resolveRuntimeRedis.d.ts +1 -1
  18. package/dist/{createCacheInspectorMiddleware-DYJ2WGYu.js → createCacheInspectorMiddleware-Bjku5v62.js} +10 -5
  19. package/dist/createCacheInspectorMiddleware-Bjku5v62.js.map +1 -0
  20. package/dist/{createCacheInspectorMiddleware-Byzz8ZlU.cjs → createCacheInspectorMiddleware-DG1_VLBS.cjs} +12 -5
  21. package/dist/createCacheInspectorMiddleware-DG1_VLBS.cjs.map +1 -0
  22. package/dist/{createISRApp-CylUYiIU.js → createISRApp-DYVU8ydT.js} +632 -100
  23. package/dist/createISRApp-DYVU8ydT.js.map +1 -0
  24. package/dist/{createISRApp-C9Bezuit.cjs → createISRApp-HX6X8UNb.cjs} +698 -129
  25. package/dist/createISRApp-HX6X8UNb.cjs.map +1 -0
  26. package/dist/{createImagePlugin-_ntL0DcT.js → createImagePlugin-BZJHOvN9.js} +67 -21
  27. package/dist/createImagePlugin-BZJHOvN9.js.map +1 -0
  28. package/dist/{createImagePlugin-birVNynL.cjs → createImagePlugin-Ca4t_WhM.cjs} +73 -21
  29. package/dist/createImagePlugin-Ca4t_WhM.cjs.map +1 -0
  30. package/dist/defaults/runtime/browserObservability.d.ts.map +1 -1
  31. package/dist/defaults/runtime/defineSiteHooks.cjs +2 -2
  32. package/dist/defaults/runtime/defineSiteHooks.js +2 -2
  33. package/dist/defaults/runtime/dev-style-resource-dispatcher.server.d.ts.map +1 -1
  34. package/dist/{defineSiteHooks-BeVy-qPH.js → defineSiteHooks-CV4tqHvB.js} +11 -5
  35. package/dist/{defineSiteHooks-BeVy-qPH.js.map → defineSiteHooks-CV4tqHvB.js.map} +1 -1
  36. package/dist/{defineSiteHooks-C3v3WLS8.cjs → defineSiteHooks-w2IrF5-D.cjs} +11 -5
  37. package/dist/{defineSiteHooks-C3v3WLS8.cjs.map → defineSiteHooks-w2IrF5-D.cjs.map} +1 -1
  38. package/dist/engine/ISREngine.d.ts +2 -2
  39. package/dist/engine/ISREngine.d.ts.map +1 -1
  40. package/dist/{i18n-CyJIoYJT.cjs → i18n-CS5QhOO0.cjs} +7 -30
  41. package/dist/i18n-CS5QhOO0.cjs.map +1 -0
  42. package/dist/{i18n-Dobe0Wxn.js → i18n-CnXYAgQE.js} +8 -25
  43. package/dist/i18n-CnXYAgQE.js.map +1 -0
  44. package/dist/index.d.ts +3 -3
  45. package/dist/isr/ISRRoutes.d.ts +5 -3
  46. package/dist/isr/ISRRoutes.d.ts.map +1 -1
  47. package/dist/isr-engine.cjs +619 -117
  48. package/dist/isr-engine.cjs.map +1 -1
  49. package/dist/isr-engine.js +609 -107
  50. package/dist/isr-engine.js.map +1 -1
  51. package/dist/logger/Logger.d.ts +6 -2
  52. package/dist/logger/Logger.d.ts.map +1 -1
  53. package/dist/logger/logRecord.d.ts +11 -0
  54. package/dist/logger/logRecord.d.ts.map +1 -0
  55. package/dist/logger/runtimeLogger.d.ts +6 -0
  56. package/dist/logger/runtimeLogger.d.ts.map +1 -0
  57. package/dist/metrics/PromMetrics.d.ts.map +1 -1
  58. package/dist/middlewares/LocaleRedirect.d.ts.map +1 -1
  59. package/dist/plugin/createCacheInspectorMiddleware.d.ts.map +1 -1
  60. package/dist/plugin/createDevCssHandoffPlugin.d.ts.map +1 -1
  61. package/dist/plugin/createFontPlugin.d.ts +1 -1
  62. package/dist/plugin/createFontPlugin.d.ts.map +1 -1
  63. package/dist/plugin/createIsrPlugin.d.ts.map +1 -1
  64. package/dist/plugin/googleFontAssets.d.ts +23 -0
  65. package/dist/plugin/googleFontAssets.d.ts.map +1 -0
  66. package/dist/plugin/isrCacheMiddleware.d.ts +5 -0
  67. package/dist/plugin/isrCacheMiddleware.d.ts.map +1 -1
  68. package/dist/plugin/remoteImageSource.d.ts +3 -3
  69. package/dist/plugin/remoteImageSource.d.ts.map +1 -1
  70. package/dist/rsc/ServerActions.d.ts.map +1 -1
  71. package/dist/rsc/cacheTag.d.ts.map +1 -1
  72. package/dist/rsc/index.cjs +8 -9
  73. package/dist/rsc/index.js +2 -3
  74. package/dist/rsc/revalidate.d.ts.map +1 -1
  75. package/dist/rsc/revalidationMetrics.d.ts +6 -0
  76. package/dist/rsc/revalidationMetrics.d.ts.map +1 -0
  77. package/dist/{rsc-lvWPTuVD.js → rsc-BJzB9s8U.js} +4 -6
  78. package/dist/rsc-BJzB9s8U.js.map +1 -0
  79. package/dist/{rsc-H7D_meHu.cjs → rsc-CYT6B6bf.cjs} +5 -7
  80. package/dist/rsc-CYT6B6bf.cjs.map +1 -0
  81. package/dist/server/manager.d.ts +1 -1
  82. package/dist/server/manager.d.ts.map +1 -1
  83. package/dist/server/opsConfig.d.ts +7 -1
  84. package/dist/server/opsConfig.d.ts.map +1 -1
  85. package/dist/server/productionRuntime.d.ts +3 -4
  86. package/dist/server/productionRuntime.d.ts.map +1 -1
  87. package/dist/server/requestLimits.d.ts +36 -0
  88. package/dist/server/requestLimits.d.ts.map +1 -0
  89. package/dist/server/safeRedirect.d.ts +6 -0
  90. package/dist/server/safeRedirect.d.ts.map +1 -0
  91. package/dist/server/types.d.ts +1 -1
  92. package/dist/ssg/spider.d.ts.map +1 -1
  93. package/dist/types/ISRConfig.d.ts +17 -0
  94. package/dist/types/ISRConfig.d.ts.map +1 -1
  95. package/dist/utils/cookie.d.ts.map +1 -1
  96. package/dist/utils/resolveFetchHandler.d.ts.map +1 -1
  97. package/package.json +30 -32
  98. package/src/defaults/runtime/browserObservability.ts +29 -13
  99. package/src/defaults/runtime/defineServerEntry.tsx +2 -2
  100. package/src/defaults/runtime/defineSiteHooks.ts +12 -7
  101. package/src/defaults/runtime/dev-style-resource-dispatcher.server.ts +2 -3
  102. package/src/types/ISRConfig.ts +21 -7
  103. package/src/utils/cookie.ts +5 -3
  104. package/src/utils/resolveFetchHandler.ts +1 -3
  105. package/dist/RequestContext-BVQ-rOmV.js +0 -58
  106. package/dist/RequestContext-BVQ-rOmV.js.map +0 -1
  107. package/dist/RequestContext-DgGEAxcW.cjs +0 -105
  108. package/dist/RequestContext-DgGEAxcW.cjs.map +0 -1
  109. package/dist/abVariantContext-CWCdRSdG.js +0 -549
  110. package/dist/abVariantContext-CWCdRSdG.js.map +0 -1
  111. package/dist/abVariantContext-Cqp-uxtd.cjs +0 -678
  112. package/dist/abVariantContext-Cqp-uxtd.cjs.map +0 -1
  113. package/dist/createCacheInspectorMiddleware-Byzz8ZlU.cjs.map +0 -1
  114. package/dist/createCacheInspectorMiddleware-DYJ2WGYu.js.map +0 -1
  115. package/dist/createISRApp-C9Bezuit.cjs.map +0 -1
  116. package/dist/createISRApp-CylUYiIU.js.map +0 -1
  117. package/dist/createImagePlugin-_ntL0DcT.js.map +0 -1
  118. package/dist/createImagePlugin-birVNynL.cjs.map +0 -1
  119. package/dist/i18n-CyJIoYJT.cjs.map +0 -1
  120. package/dist/i18n-Dobe0Wxn.js.map +0 -1
  121. package/dist/rsc-H7D_meHu.cjs.map +0 -1
  122. package/dist/rsc-lvWPTuVD.js.map +0 -1
@@ -1,16 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { c as requestContext, i as getRequestContext } from "./RequestContext-BVQ-rOmV.js";
3
- import { a as isUncacheable, b as recordHttpRequest, l as registerInvalidator, m as cacheRevalidatingGauge, p as cacheEntriesGauge, r as collectTags, s as runWithTagStore, v as l2ReadTimeoutsTotal, x as Logger } from "./abVariantContext-CWCdRSdG.js";
4
- import { a as withLocale, c as parseCookieHeader, i as resolveI18nConfig, l as readCookie, n as negotiateLocale } from "./i18n-Dobe0Wxn.js";
2
+ import { E as requestContext, S as getRequestContext, a as isUncacheable, f as setRevalidationMetricRecorder, l as registerInvalidator, r as collectTags, s as runWithTagStore } from "./abVariantContext-Ud3aZ1yk.js";
3
+ import { t as Logger } from "./Logger-bg-doGwZ.js";
4
+ import { c as readCookie, i as resolveI18nConfig, n as negotiateLocale, s as parseCookieHeader } from "./i18n-CnXYAgQE.js";
5
5
  import fs, { createReadStream } from "node:fs";
6
6
  import path from "node:path";
7
- import * as fs$4 from "fs";
8
- import fs$1 from "fs";
7
+ import express from "express";
8
+ import { ipKeyGenerator, rateLimit } from "express-rate-limit";
9
+ import ipaddr from "ipaddr.js";
9
10
  import * as path$2 from "path";
10
11
  import path$1 from "path";
12
+ import * as fs$4 from "fs";
13
+ import fs$1 from "fs";
11
14
  import fs$2 from "fs/promises";
12
15
  import ts from "typescript";
13
- import express from "express";
14
16
  import net from "node:net";
15
17
  import { createServer, loadConfigFromFile, mergeConfig } from "vite";
16
18
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -22,6 +24,7 @@ import { Readable } from "node:stream";
22
24
  import os from "node:os";
23
25
  import http from "node:http";
24
26
  import { LRUCache } from "lru-cache";
27
+ import { Counter, Gauge, Histogram, Registry, collectDefaultMetrics } from "prom-client";
25
28
  import { pathToFileURL as pathToFileURL$1 } from "url";
26
29
  import { createHash as createHash$1, randomUUID as randomUUID$1 } from "crypto";
27
30
  import * as esbuild from "esbuild";
@@ -117,6 +120,187 @@ function resolveCacheDurations(defaultTtl, overrides = {}, label = "route") {
117
120
  };
118
121
  }
119
122
  //#endregion
123
+ //#region src/server/requestLimits.ts
124
+ /** Per-process admission budgets for engine-owned work, not page-cache hits or application APIs. */
125
+ var DEFAULT_REQUEST_LIMITS = {
126
+ ops: {
127
+ windowMs: 6e4,
128
+ maxRequests: 120,
129
+ globalMaxRequests: 1200,
130
+ maxClients: 1e3
131
+ },
132
+ staticHtml: {
133
+ windowMs: 6e4,
134
+ maxRequests: 600,
135
+ globalMaxRequests: 12e3,
136
+ maxClients: 1e4
137
+ },
138
+ seo: {
139
+ windowMs: 6e4,
140
+ maxRequests: 120,
141
+ globalMaxRequests: 1200,
142
+ maxClients: 1e3
143
+ }
144
+ };
145
+ function resolveRequestLimitPolicy(category, input) {
146
+ if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) throw new TypeError(`server.requestLimits.${category} must be a positive admission policy`);
147
+ const defaults = DEFAULT_REQUEST_LIMITS[category];
148
+ const result = { ...defaults };
149
+ for (const field of [
150
+ "windowMs",
151
+ "maxRequests",
152
+ "globalMaxRequests",
153
+ "maxClients"
154
+ ]) {
155
+ const value = input?.[field] === void 0 ? defaults[field] : input[field];
156
+ if (!Number.isSafeInteger(value) || value <= 0 || value >= Number.MAX_SAFE_INTEGER) throw new TypeError(`server.requestLimits.${category}.${field} must be a positive safe integer`);
157
+ result[field] = value;
158
+ }
159
+ if (result.windowMs > 2147483647) throw new RangeError(`server.requestLimits.${category}.windowMs must be at most 2147483647`);
160
+ return result;
161
+ }
162
+ function validateRequestLimits(input) {
163
+ if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) throw new TypeError("server.requestLimits must be an object");
164
+ for (const category of [
165
+ "ops",
166
+ "staticHtml",
167
+ "seo"
168
+ ]) resolveRequestLimitPolicy(category, input?.[category]);
169
+ }
170
+ /**
171
+ * A timer-free express-rate-limit Store. Live quotas are never evicted to admit a new IP.
172
+ * A full store denies new clients until expiry; reclamation scans are bounded to once/second.
173
+ */
174
+ var BoundedRateLimitStore = class {
175
+ windowMs;
176
+ maxClients;
177
+ maxRequests;
178
+ localKeys = true;
179
+ clients = /* @__PURE__ */ new Map();
180
+ nextSweepAt = 0;
181
+ constructor(windowMs, maxClients, maxRequests) {
182
+ this.windowMs = windowMs;
183
+ this.maxClients = maxClients;
184
+ this.maxRequests = maxRequests;
185
+ }
186
+ get size() {
187
+ return this.clients.size;
188
+ }
189
+ get(key) {
190
+ const counter = this.clients.get(key);
191
+ if (!counter || counter.expiresAt <= Date.now()) return void 0;
192
+ return {
193
+ totalHits: counter.totalHits,
194
+ resetTime: new Date(counter.expiresAt)
195
+ };
196
+ }
197
+ increment(key) {
198
+ const now = Date.now();
199
+ if (now >= this.nextSweepAt) {
200
+ for (const [client, counter] of this.clients) if (counter.expiresAt <= now) this.clients.delete(client);
201
+ this.nextSweepAt = now + Math.min(this.windowMs, 1e3);
202
+ }
203
+ let counter = this.clients.get(key);
204
+ if (counter && counter.expiresAt <= now) {
205
+ this.clients.delete(key);
206
+ counter = void 0;
207
+ }
208
+ if (!counter) {
209
+ if (this.clients.size >= this.maxClients) {
210
+ const firstExpiry = this.clients.values().next().value?.expiresAt ?? this.nextSweepAt;
211
+ return {
212
+ totalHits: this.maxRequests + 1,
213
+ resetTime: new Date(Math.max(firstExpiry, this.nextSweepAt))
214
+ };
215
+ }
216
+ counter = {
217
+ totalHits: 0,
218
+ expiresAt: now + this.windowMs
219
+ };
220
+ this.clients.set(key, counter);
221
+ }
222
+ counter.totalHits = Math.min(counter.totalHits + 1, this.maxRequests + 1);
223
+ return {
224
+ totalHits: counter.totalHits,
225
+ resetTime: new Date(counter.expiresAt)
226
+ };
227
+ }
228
+ decrement(key) {
229
+ const counter = this.clients.get(key);
230
+ if (counter) counter.totalHits = Math.max(0, counter.totalHits - 1);
231
+ }
232
+ resetKey(key) {
233
+ this.clients.delete(key);
234
+ }
235
+ resetAll() {
236
+ this.clients.clear();
237
+ this.nextSweepAt = 0;
238
+ }
239
+ };
240
+ /** Connect has no req.ip. An unrestricted trust-proxy setting is never an IP identity boundary. */
241
+ function requestClientKey(req) {
242
+ const selected = req.app?.get("trust proxy") === true ? req.socket?.remoteAddress : req.ip ?? req.socket?.remoteAddress;
243
+ if (!selected || !ipaddr.isValid(selected)) return "unknown-client";
244
+ return ipKeyGenerator(ipaddr.process(selected).toString(), 56);
245
+ }
246
+ function createRequestLimiter(category, input) {
247
+ const policy = resolveRequestLimitPolicy(category, input);
248
+ const router = express.Router();
249
+ const common = {
250
+ windowMs: policy.windowMs,
251
+ standardHeaders: false,
252
+ legacyHeaders: false,
253
+ requestPropertyName: "isrRequestLimit",
254
+ handler: (req, res) => {
255
+ const remaining = (req.isrRequestLimit?.resetTime?.getTime() ?? Date.now() + policy.windowMs) - Date.now();
256
+ res.statusCode = 429;
257
+ res.setHeader("Retry-After", String(Math.max(1, Math.ceil(remaining / 1e3))));
258
+ res.setHeader("Cache-Control", "no-store");
259
+ res.setHeader("Content-Type", "application/json; charset=utf-8");
260
+ res.end("{\"error\":\"Too many requests\"}");
261
+ }
262
+ };
263
+ router.use(rateLimit({
264
+ ...common,
265
+ limit: policy.globalMaxRequests,
266
+ store: new BoundedRateLimitStore(policy.windowMs, 1, policy.globalMaxRequests),
267
+ keyGenerator: () => "origin"
268
+ }));
269
+ router.use(rateLimit({
270
+ ...common,
271
+ limit: policy.maxRequests,
272
+ store: new BoundedRateLimitStore(policy.windowMs, policy.maxClients, policy.maxRequests),
273
+ keyGenerator: requestClientKey
274
+ }));
275
+ return router;
276
+ }
277
+ /** Bridge an admission middleware into async work without treating its ended 429 as next(). */
278
+ function admitRequest(limiter, req, res) {
279
+ if (res.writableEnded || res.destroyed) return Promise.resolve(false);
280
+ return new Promise((resolve, reject) => {
281
+ const cleanup = () => {
282
+ res.removeListener("finish", onEnd);
283
+ res.removeListener("close", onEnd);
284
+ };
285
+ const onEnd = () => {
286
+ cleanup();
287
+ resolve(false);
288
+ };
289
+ res.once("finish", onEnd);
290
+ res.once("close", onEnd);
291
+ try {
292
+ limiter(req, res, (error) => {
293
+ cleanup();
294
+ if (error) reject(error);
295
+ else resolve(!res.writableEnded && !res.destroyed);
296
+ });
297
+ } catch (error) {
298
+ cleanup();
299
+ reject(error);
300
+ }
301
+ });
302
+ }
303
+ //#endregion
120
304
  //#region src/config/normalizeEngineConfig.ts
121
305
  /**
122
306
  * Engine-owned config normalization.
@@ -155,6 +339,7 @@ function normalizeEngineConfig(config) {
155
339
  "invalidationChannel"
156
340
  ], "runtime.redis");
157
341
  if (!isRecord(config.server)) throw new Error("ssr.config.ts 必须显式声明 server 对象");
342
+ validateRequestLimits(config.server.requestLimits);
158
343
  if (!isRecord(config.ssg)) throw new Error("ssr.config.ts 必须显式声明 ssg 对象");
159
344
  if (!Array.isArray(config.ssg.routes) && typeof config.ssg.routes !== "function") throw new TypeError("ssr.config.ts ssg.routes must be an array or a route discovery function");
160
345
  if (Array.isArray(config.ssg.routes)) assertDistinctHtmlRouteIdentities(config.ssg.routes);
@@ -1326,7 +1511,7 @@ function resolveFetchHandler(module) {
1326
1511
  }
1327
1512
  var package_default = {
1328
1513
  name: "isr-engine",
1329
- version: "2.6.21",
1514
+ version: "3.1.0",
1330
1515
  description: "ISR/SSG/Fallback rendering orchestration on Vite + React 19 RSC.",
1331
1516
  license: "UNLICENSED",
1332
1517
  repository: {
@@ -1430,37 +1615,38 @@ var package_default = {
1430
1615
  "test:workers": "tsc --noEmit -p scripts/fixtures/tsconfig.json && node scripts/check-workers-runtime.mjs",
1431
1616
  "test:release": "node scripts/check-release.mjs"
1432
1617
  },
1433
- engines: { "node": ">=22.21.1" },
1618
+ engines: { "node": "24.15.0" },
1434
1619
  packageManager: "pnpm@9.15.9",
1435
1620
  dependencies: {
1436
- "@vitejs/plugin-rsc": "0.5.34",
1437
- "chalk": "^5.3.0",
1621
+ "@vitejs/plugin-rsc": "0.5.39",
1622
+ "chalk": "^6.0.1",
1438
1623
  "commander": "^12.1.0",
1439
1624
  "compression": "^1.8.2",
1440
1625
  "css-tree": "^3.2.1",
1441
1626
  "esbuild": "^0.28.2",
1442
1627
  "express": "^5.3.0",
1628
+ "express-rate-limit": "8.7.5",
1443
1629
  "helmet": "^7.1.0",
1444
1630
  "ipaddr.js": "^2.5.0",
1445
1631
  "lru-cache": "^10.4.3",
1446
- "ora": "^8.1.0",
1632
+ "ora": "^10.0.0",
1447
1633
  "parse5": "^8.0.1",
1634
+ "pino": "10.4.0",
1448
1635
  "prom-client": "^15.1.3",
1636
+ "rsc-html-stream": "0.0.7",
1449
1637
  "sharp": "^0.35.5",
1450
- "sitemap": "^8.0.0",
1451
- "typescript": "^5.6.2"
1638
+ "sitemap": "^10.0.0",
1639
+ "typescript": "^6.0.3"
1452
1640
  },
1453
1641
  peerDependencies: {
1454
- "react": "19.3.0-canary-bd6ea412-20260824",
1455
- "react-dom": "19.3.0-canary-bd6ea412-20260824",
1456
- "react-server-dom-webpack": "19.3.0-canary-bd6ea412-20260824",
1457
- "rsc-html-stream": "^0.0.7",
1642
+ "react": "19.3.1",
1643
+ "react-dom": "19.3.1",
1458
1644
  "vite": "8.1.6"
1459
1645
  },
1460
- optionalDependencies: { "ioredis": "^5.4.1" },
1646
+ optionalDependencies: { "ioredis": "^5.11.1" },
1461
1647
  devDependencies: {
1462
- "@eslint/js": "^9.15.0",
1463
- "@playwright/test": "^1.62.1",
1648
+ "@eslint/js": "^9.39.5",
1649
+ "@playwright/test": "1.65.1",
1464
1650
  "@semantic-release/commit-analyzer": "13.0.1",
1465
1651
  "@semantic-release/exec": "7.1.0",
1466
1652
  "@semantic-release/npm": "13.2.0",
@@ -1468,34 +1654,31 @@ var package_default = {
1468
1654
  "@types/compression": "^1.7.5",
1469
1655
  "@types/css-tree": "^3.2.0",
1470
1656
  "@types/express": "^5.0.0",
1471
- "@types/ioredis-mock": "^8.2.5",
1472
- "@types/node": "^22.7.4",
1657
+ "@types/ioredis-mock": "^8.2.8",
1658
+ "@types/node": "24.19.2",
1473
1659
  "@types/react": "^19.2.15",
1474
1660
  "@types/react-dom": "^19.0.0",
1475
- "@typescript-eslint/eslint-plugin": "^8.72.1",
1476
- "@typescript-eslint/parser": "^8.72.1",
1661
+ "@typescript-eslint/eslint-plugin": "8.72.2",
1662
+ "@typescript-eslint/parser": "8.72.2",
1477
1663
  "@vitest/coverage-v8": "^4.1.12",
1478
- "autocannon": "^8.0.0",
1479
1664
  "eslint": "^9.15.0",
1480
- "eslint-config-prettier": "^9.1.0",
1481
- "eslint-plugin-prettier": "^5.5.6",
1665
+ "eslint-config-prettier": "^10.1.8",
1666
+ "eslint-plugin-prettier": "^5.5.7",
1482
1667
  "eslint-plugin-react": "^7.37.2",
1483
- "eslint-plugin-react-hooks": "^5.0.0",
1668
+ "eslint-plugin-react-hooks": "^7.1.1",
1484
1669
  "globals": "^15.9.0",
1485
1670
  "happy-dom": "^21.0.4",
1486
1671
  "husky": "^9.1.7",
1487
1672
  "ioredis-mock": "^8.9.0",
1488
- "jsdom": "^29.1.1",
1489
1673
  "miniflare": "4.20260730.0",
1490
- "prettier": "^3.3.3",
1491
- "react": "19.3.0-canary-bd6ea412-20260824",
1492
- "react-dom": "19.3.0-canary-bd6ea412-20260824",
1493
- "react-server-dom-webpack": "19.3.0-canary-bd6ea412-20260824",
1674
+ "prettier": "^3.10.1",
1675
+ "react": "19.3.1",
1676
+ "react-dom": "19.3.1",
1494
1677
  "rimraf": "^6.1.4",
1495
- "rsc-html-stream": "^0.0.7",
1496
- "sass-embedded": "^1.79.4",
1497
- "semantic-release": "24.2.9",
1498
- "tsc-alias": "^1.8.17",
1678
+ "sass-embedded": "^1.108.2",
1679
+ "semantic-release": "25.0.9",
1680
+ "tsc-alias": "^1.9.10",
1681
+ "undici": "8.12.4",
1499
1682
  "vite": "8.1.6",
1500
1683
  "vitest": "^4.1.12"
1501
1684
  },
@@ -1511,7 +1694,7 @@ var package_default = {
1511
1694
  "undici@7": "7.30.2",
1512
1695
  "js-yaml@4": "4.3.2",
1513
1696
  "form-data@4": "4.0.6",
1514
- "@typescript-eslint/typescript-estree@8.72.1>minimatch": "11.0.5"
1697
+ "@typescript-eslint/typescript-estree>minimatch": "11.0.5"
1515
1698
  } }
1516
1699
  };
1517
1700
  //#endregion
@@ -2318,6 +2501,207 @@ function createHybridCacheStore(opts) {
2318
2501
  };
2319
2502
  }
2320
2503
  //#endregion
2504
+ //#region src/metrics/PromMetrics.ts
2505
+ /**
2506
+ * PromMetrics —— prom-client 包装,导出 Prometheus 文本格式
2507
+ *
2508
+ * 设计:
2509
+ * - prom-client 是 Node 生态的事实标准(Grafana / Datadog / Prometheus 直接抓取)
2510
+ * - 单 Registry,避免污染全局;用户业务可拿 `promRegistry` 自行注册自家 metric
2511
+ * - 响应时间用 Histogram(带桶),不是平均值 —— 才能正确算 P95/P99
2512
+ * - 默认采集 process_*(CPU / RSS / event-loop lag)—— 一行 collectDefaultMetrics
2513
+ */
2514
+ var PromMetrics_exports = /* @__PURE__ */ __exportAll({
2515
+ cacheEntriesGauge: () => cacheEntriesGauge,
2516
+ cacheHitsTotal: () => cacheHitsTotal,
2517
+ cacheRevalidatingGauge: () => cacheRevalidatingGauge,
2518
+ createPrometheusMetricsMiddleware: () => createPrometheusMetricsMiddleware,
2519
+ httpRequestDurationSeconds: () => httpRequestDurationSeconds,
2520
+ httpRequestsTotal: () => httpRequestsTotal,
2521
+ invalidatorFailuresTotal: () => invalidatorFailuresTotal,
2522
+ invalidatorRunsTotal: () => invalidatorRunsTotal,
2523
+ l2ReadTimeoutsTotal: () => l2ReadTimeoutsTotal,
2524
+ normalizeRoute: () => normalizeRoute,
2525
+ promRegistry: () => promRegistry,
2526
+ recordHttpRequest: () => recordHttpRequest
2527
+ });
2528
+ var promRegistry = new Registry();
2529
+ collectDefaultMetrics({
2530
+ register: promRegistry,
2531
+ prefix: "isr_"
2532
+ });
2533
+ var httpRequestsTotal = new Counter({
2534
+ name: "isr_http_requests_total",
2535
+ help: "Total ISR HTTP requests",
2536
+ labelNames: [
2537
+ "method",
2538
+ "route",
2539
+ "status",
2540
+ "mode",
2541
+ "cache"
2542
+ ],
2543
+ registers: [promRegistry]
2544
+ });
2545
+ var httpRequestDurationSeconds = new Histogram({
2546
+ name: "isr_http_request_duration_seconds",
2547
+ help: "ISR HTTP request duration",
2548
+ labelNames: [
2549
+ "method",
2550
+ "route",
2551
+ "mode",
2552
+ "cache"
2553
+ ],
2554
+ buckets: [
2555
+ .001,
2556
+ .005,
2557
+ .01,
2558
+ .025,
2559
+ .05,
2560
+ .1,
2561
+ .25,
2562
+ .5,
2563
+ 1,
2564
+ 2.5,
2565
+ 5
2566
+ ],
2567
+ registers: [promRegistry]
2568
+ });
2569
+ var cacheEntriesGauge = new Gauge({
2570
+ name: "isr_cache_entries",
2571
+ help: "Current ISR cache entries (L1 LRU size)",
2572
+ labelNames: ["backend"],
2573
+ registers: [promRegistry]
2574
+ });
2575
+ var cacheRevalidatingGauge = new Gauge({
2576
+ name: "isr_cache_revalidating_inflight",
2577
+ help: "Number of in-flight background revalidations",
2578
+ registers: [promRegistry]
2579
+ });
2580
+ var cacheHitsTotal = new Counter({
2581
+ name: "isr_cache_hits_total",
2582
+ help: "ISR cache hits",
2583
+ labelNames: ["status"],
2584
+ registers: [promRegistry]
2585
+ });
2586
+ var invalidatorRunsTotal = new Counter({
2587
+ name: "isr_invalidator_runs_total",
2588
+ help: "Total revalidate dispatches (one increment per revalidatePath/Tag call with ≥1 invalidator)",
2589
+ labelNames: ["kind", "target"],
2590
+ registers: [promRegistry]
2591
+ });
2592
+ var invalidatorFailuresTotal = new Counter({
2593
+ name: "isr_invalidator_failures_total",
2594
+ help: "Per-invalidator failures during revalidate dispatch (one increment per failing invalidator)",
2595
+ labelNames: ["kind", "target"],
2596
+ registers: [promRegistry]
2597
+ });
2598
+ var l2ReadTimeoutsTotal = new Counter({
2599
+ name: "isr_l2_read_timeouts_total",
2600
+ help: "L2 cache async read timeouts (raceWithTimeout fired before underlying promise resolved)",
2601
+ registers: [promRegistry]
2602
+ });
2603
+ /**
2604
+ * 路由归一化 —— 防 Prometheus label 基数爆炸。
2605
+ *
2606
+ * 动态段(id / uuid / hex / 长 hash)直接作为 label 值会让时间序列数爆炸
2607
+ * (每个 /books/123 都是新序列),Prometheus 存储成本线性暴涨、查询变慢。
2608
+ *
2609
+ * 规则:
2610
+ * - 纯数字段(1 ~ 20 位) → `:id`
2611
+ * - UUID v1-v5 → `:uuid`
2612
+ * - 长 hex(≥16 字符全 hex)→ `:hash`
2613
+ * - base64url/大小写混合长串(≥24 字符,含数字和字母)→ `:hash`
2614
+ *
2615
+ * 命中任意规则即替换;其他保留原样(`/books` `/about` 保留)。
2616
+ *
2617
+ * 可用 `addRouteNormalizeRule(pattern, replacement)` 扩展业务特有规则。
2618
+ */
2619
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2620
+ var LONG_HEX_RE = /^[0-9a-f]{16,}$/i;
2621
+ var OPAQUE_ID_RE = /^[A-Za-z0-9_-]{24,}$/;
2622
+ var PURE_DIGIT_RE = /^\d{1,20}$/;
2623
+ var customRules = [];
2624
+ function normalizeRoute(route) {
2625
+ if (!route || route === "/") return "/";
2626
+ const segments = route.split("/");
2627
+ for (let i = 0; i < segments.length; i++) {
2628
+ const seg = segments[i];
2629
+ if (!seg) continue;
2630
+ let replaced = null;
2631
+ for (const rule of customRules) {
2632
+ replaced = rule(seg);
2633
+ if (replaced) break;
2634
+ }
2635
+ if (replaced) {
2636
+ segments[i] = replaced;
2637
+ continue;
2638
+ }
2639
+ if (PURE_DIGIT_RE.test(seg)) segments[i] = ":id";
2640
+ else if (UUID_RE.test(seg)) segments[i] = ":uuid";
2641
+ else if (LONG_HEX_RE.test(seg)) segments[i] = ":hash";
2642
+ else if (OPAQUE_ID_RE.test(seg)) segments[i] = ":hash";
2643
+ }
2644
+ return segments.join("/");
2645
+ }
2646
+ setRevalidationMetricRecorder((event, kind, target) => {
2647
+ (event === "run" ? invalidatorRunsTotal : invalidatorFailuresTotal).inc({
2648
+ kind,
2649
+ target: kind === "path" ? normalizeRoute(target) : target
2650
+ });
2651
+ });
2652
+ /** 一行调用更新所有计数 —— 给 isrCacheMiddleware / 中间件用 */
2653
+ function recordHttpRequest(opts) {
2654
+ const route = normalizeRoute(opts.route);
2655
+ httpRequestsTotal.inc({
2656
+ method: opts.method,
2657
+ route,
2658
+ status: String(opts.status),
2659
+ mode: opts.mode,
2660
+ cache: opts.cache
2661
+ });
2662
+ httpRequestDurationSeconds.observe({
2663
+ method: opts.method,
2664
+ route,
2665
+ mode: opts.mode,
2666
+ cache: opts.cache
2667
+ }, opts.durationMs / 1e3);
2668
+ if (opts.cache) cacheHitsTotal.inc({ status: opts.cache });
2669
+ }
2670
+ /**
2671
+ * Express / connect 中间件:暴露 /metrics 端点(Prometheus text exposition format)
2672
+ *
2673
+ * 认证:可选 Bearer token —— 未设 token 时保持旧行为(匿名可访问)。
2674
+ * 生产建议:`createPrometheusMetricsMiddleware({ token: process.env.METRICS_TOKEN })`。
2675
+ */
2676
+ function createPrometheusMetricsMiddleware(pathOrOptions = {}) {
2677
+ const options = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
2678
+ const path = options.path ?? "/metrics";
2679
+ const token = options.token && options.token !== "" ? options.token : null;
2680
+ const unauthorizedStatus = options.unauthorizedStatus ?? 401;
2681
+ return async function(req, res, next) {
2682
+ if (req.url !== path || req.method !== "GET") return next();
2683
+ if (token) {
2684
+ const authHeader = req.headers?.["authorization"];
2685
+ const raw = Array.isArray(authHeader) ? authHeader[0] : authHeader;
2686
+ if (!(typeof raw === "string" && raw === `Bearer ${token}`)) {
2687
+ res.statusCode = unauthorizedStatus;
2688
+ res.setHeader("WWW-Authenticate", "Bearer realm=\"metrics\"");
2689
+ res.end("Unauthorized");
2690
+ return;
2691
+ }
2692
+ }
2693
+ try {
2694
+ const body = await promRegistry.metrics();
2695
+ res.setHeader("content-type", promRegistry.contentType);
2696
+ res.statusCode = 200;
2697
+ res.end(body);
2698
+ } catch (err) {
2699
+ res.statusCode = 500;
2700
+ res.end(`metrics error: ${err instanceof Error ? err.message : String(err)}`);
2701
+ }
2702
+ };
2703
+ }
2704
+ //#endregion
2321
2705
  //#region src/config/loadConfig.ts
2322
2706
  /**
2323
2707
  * 配置加载工具
@@ -2402,6 +2786,31 @@ async function resolveImportPath(filePath, options) {
2402
2786
  }
2403
2787
  //#endregion
2404
2788
  //#region src/server/opsConfig.ts
2789
+ var opsConfig_exports = /* @__PURE__ */ __exportAll({
2790
+ bindRuntimeOpsConfig: () => bindRuntimeOpsConfig,
2791
+ createOpsAuthMiddleware: () => createOpsAuthMiddleware,
2792
+ getOpsRequestLimiter: () => getOpsRequestLimiter,
2793
+ getRuntimeOpsConfig: () => getRuntimeOpsConfig,
2794
+ resolveOpsConfig: () => resolveOpsConfig
2795
+ });
2796
+ var opsLimiters = /* @__PURE__ */ new WeakMap();
2797
+ var runtimeOpsConfigs = /* @__PURE__ */ new WeakMap();
2798
+ /** Carry one resolved policy from the Vite plugin into its owning Express runtime. */
2799
+ function bindRuntimeOpsConfig(owner, resolved) {
2800
+ runtimeOpsConfigs.set(owner, resolved);
2801
+ }
2802
+ function getRuntimeOpsConfig(owner) {
2803
+ return runtimeOpsConfigs.get(owner);
2804
+ }
2805
+ /** Share one ops admission budget across endpoint handlers owned by this runtime. */
2806
+ function getOpsRequestLimiter(resolved) {
2807
+ let limiter = opsLimiters.get(resolved);
2808
+ if (!limiter) {
2809
+ limiter = createRequestLimiter("ops", resolved.requestLimit);
2810
+ opsLimiters.set(resolved, limiter);
2811
+ }
2812
+ return limiter;
2813
+ }
2405
2814
  var OPS_ENDPOINT_PATHS = {
2406
2815
  health: "/health",
2407
2816
  metrics: "/metrics",
@@ -2470,6 +2879,7 @@ function resolveOpsConfig(config, env) {
2470
2879
  const authToken = trimToUndefined(ops?.authToken);
2471
2880
  return {
2472
2881
  authToken,
2882
+ requestLimit: resolveRequestLimitPolicy("ops", config?.server?.requestLimits?.ops),
2473
2883
  tokenHeader: trimToUndefined(ops?.tokenHeader) ?? DEFAULT_TOKEN_HEADER,
2474
2884
  health: resolveEndpointConfig("health", ops?.health, defaults.health, env, authToken, warnings),
2475
2885
  metrics: resolveEndpointConfig("metrics", ops?.metrics, defaults.metrics, env, authToken, warnings),
@@ -4284,6 +4694,7 @@ function createIsrCacheHandler(config, options = {}) {
4284
4694
  pathTagPrefix: `__isr_path:${cacheNamespace}:`,
4285
4695
  staticSeed: options.staticSeed,
4286
4696
  staticSeedInfo: options.staticSeedInfo,
4697
+ staticSeedAdmission: options.staticSeedAdmission,
4287
4698
  seeded
4288
4699
  }).catch((err) => {
4289
4700
  logger$5.warn("ISR cache handler 异常,回退到下游处理:", err);
@@ -4400,24 +4811,30 @@ function createIsrCacheMiddleware(explicitConfig, options = {}) {
4400
4811
  logger$5.info(`📋 ISR cache: 自动加载 ssr.config.ts 成功(mode=${rules.globalMode}, overrides=${Object.keys(rules.routes).length})`);
4401
4812
  }
4402
4813
  const opsConfig = resolveOpsConfig(resolvedConfig, "development");
4814
+ const { bindRuntimeOpsConfig, getOpsRequestLimiter } = await Promise.resolve().then(() => opsConfig_exports);
4815
+ const opsLimiter = getOpsRequestLimiter(opsConfig);
4816
+ const metricsAuth = createOpsAuthMiddleware("metrics", opsConfig);
4403
4817
  const nextHandler = createIsrCacheHandler(resolvedConfig, withRuntimeCacheOptions(resolvedConfig, {
4404
4818
  ...options,
4405
4819
  development: true
4406
4820
  }));
4407
4821
  try {
4408
- const inspector = opsConfig.inventory.enabled ? (await import("./createCacheInspectorMiddleware-DYJ2WGYu.js")).createCacheInspectorMiddleware(nextHandler, opsConfig) : void 0;
4822
+ const inspector = opsConfig.inventory.enabled ? (await import("./createCacheInspectorMiddleware-Bjku5v62.js")).createCacheInspectorMiddleware(nextHandler, opsConfig) : void 0;
4409
4823
  handler = nextHandler;
4410
4824
  server.middlewares.use((req, res, next) => {
4411
4825
  if (handler !== nextHandler) return next();
4412
4826
  if (opsConfig.metrics.enabled && req.url === "/metrics" && req.method === "GET") {
4413
- createOpsAuthMiddleware("metrics", opsConfig)(req, res, () => {
4414
- import("./abVariantContext-CWCdRSdG.js").then((n) => n.f).then(async ({ promRegistry }) => {
4415
- const body = await promRegistry.metrics();
4416
- res.setHeader("content-type", promRegistry.contentType);
4417
- res.end(body);
4418
- }).catch((err) => {
4419
- res.statusCode = 500;
4420
- res.end(`metrics error: ${String(err)}`);
4827
+ opsLimiter(req, res, (error) => {
4828
+ if (error) return next(error);
4829
+ metricsAuth(req, res, () => {
4830
+ Promise.resolve().then(() => PromMetrics_exports).then(async ({ promRegistry }) => {
4831
+ const body = await promRegistry.metrics();
4832
+ res.setHeader("content-type", promRegistry.contentType);
4833
+ res.end(body);
4834
+ }).catch((err) => {
4835
+ res.statusCode = 500;
4836
+ res.end(`metrics error: ${String(err)}`);
4837
+ });
4421
4838
  });
4422
4839
  });
4423
4840
  return;
@@ -4428,6 +4845,7 @@ function createIsrCacheMiddleware(explicitConfig, options = {}) {
4428
4845
  });
4429
4846
  else nextHandler(req, res, next);
4430
4847
  });
4848
+ bindRuntimeOpsConfig(server, opsConfig);
4431
4849
  mounted = true;
4432
4850
  if (inspector) logger$5.info("🔍 ISR cache inventory 已启用:GET /__isr/cache/inventory");
4433
4851
  } catch (error) {
@@ -4442,6 +4860,25 @@ function createIsrCacheMiddleware(explicitConfig, options = {}) {
4442
4860
  }
4443
4861
  };
4444
4862
  }
4863
+ function seedDenial(res) {
4864
+ const retryAfter = res.getHeader("Retry-After");
4865
+ return {
4866
+ statusCode: res.statusCode >= 400 && res.statusCode <= 599 ? res.statusCode : 503,
4867
+ retryAfter: typeof retryAfter === "string" || typeof retryAfter === "number" ? String(retryAfter) : void 0
4868
+ };
4869
+ }
4870
+ function sendSeedDenial(res, denial) {
4871
+ if (res.destroyed || res.writableEnded) return;
4872
+ if (res.headersSent) {
4873
+ res.destroy();
4874
+ return;
4875
+ }
4876
+ res.statusCode = denial.statusCode;
4877
+ res.setHeader("Cache-Control", "no-store");
4878
+ res.setHeader("Content-Type", "application/json; charset=utf-8");
4879
+ if (denial.retryAfter) res.setHeader("Retry-After", denial.retryAfter);
4880
+ res.end(JSON.stringify({ error: denial.statusCode === 429 ? "Too many requests" : "Static seed admission unavailable" }));
4881
+ }
4445
4882
  /**
4446
4883
  * 单次请求的缓存处理
4447
4884
  */
@@ -4530,17 +4967,32 @@ async function handleRequest(req, res, next, ctx) {
4530
4967
  }
4531
4968
  if (!isActive()) return;
4532
4969
  if (!entry && ctx.state.invalidationGeneration === 0 && resolved.mode === "ssg" && ctx.staticSeed && (!ctx.staticSeedInfo || ctx.staticSeedInfo(logicalPath)) && !url.includes("?") && !url.endsWith(RSC_URL_POSTFIX) && !ctx.variantIsolation && !ctx.hostIsolation) {
4533
- if (!ctx.seeded.has(cacheKey)) {
4534
- const seedTask = (async () => {
4970
+ let seedTask = ctx.seeded.get(cacheKey);
4971
+ const leader = !seedTask;
4972
+ if (!seedTask) {
4973
+ seedTask = Promise.resolve().then(async () => {
4974
+ try {
4975
+ if (ctx.staticSeedAdmission && !await ctx.staticSeedAdmission(req, res)) return seedDenial(res);
4976
+ } catch (error) {
4977
+ logger$5.warn("SSG seed admission failed; refusing origin fallback", error);
4978
+ if (!res.headersSent && !res.writableEnded && !res.destroyed) {
4979
+ res.statusCode = 503;
4980
+ res.setHeader("Cache-Control", "no-store");
4981
+ res.end("Static seed admission unavailable");
4982
+ } else if (!res.writableEnded && !res.destroyed) res.destroy(error instanceof Error ? error : void 0);
4983
+ return seedDenial(res);
4984
+ }
4985
+ if (!isActive()) return seedDenial(res);
4535
4986
  const generation = ctx.state.invalidationGeneration;
4987
+ if (generation !== 0) return true;
4536
4988
  const seed = await raceWithTimeout(ctx.staticSeed(logicalPath, String(res.getHeader("content-security-policy") || "default-src 'self'")), ctx.l2ReadTimeoutMs);
4537
4989
  if (!seed) {
4538
4990
  ctx.seeded.delete(cacheKey);
4539
- return;
4991
+ return true;
4540
4992
  }
4541
4993
  const lease = ctx.cache.coherence ? await raceWithTimeout(ctx.cache.coherence.beginRender(), ctx.l2ReadTimeoutMs) : void 0;
4542
- if (generation !== 0 || lease && lease.revision !== "0") return;
4543
- if (generation !== ctx.state.invalidationGeneration) return;
4994
+ if (lease && lease.revision !== "0") return true;
4995
+ if (generation !== ctx.state.invalidationGeneration) return true;
4544
4996
  const ttl = resolved.ttlSeconds * 1e3;
4545
4997
  const seededEntry = {
4546
4998
  ...seed,
@@ -4549,19 +5001,25 @@ async function handleRequest(req, res, next, ctx) {
4549
5001
  hardExpiresAt: seed.storedAt + ttl + resolved.swrSeconds * 1e3,
4550
5002
  pathTag: `${ctx.pathTagPrefix}${logicalPath}`
4551
5003
  };
4552
- if (Date.now() >= seededEntry.hardExpiresAt) return;
5004
+ if (Date.now() >= seededEntry.hardExpiresAt) return true;
4553
5005
  if (ctx.cache.coherence) {
4554
5006
  if (lease && ctx.cache.coherence.seed) await raceWithTimeout(ctx.cache.coherence.seed(cacheKey, seededEntry, lease), ctx.l2ReadTimeoutMs);
4555
5007
  } else ctx.cache.set(cacheKey, seededEntry);
4556
- })();
5008
+ return true;
5009
+ });
4557
5010
  ctx.seeded.set(cacheKey, seedTask);
4558
5011
  }
4559
5012
  try {
4560
- await ctx.seeded.get(cacheKey);
5013
+ const result = await seedTask;
5014
+ if (result !== true) {
5015
+ if (ctx.seeded.get(cacheKey) === seedTask) ctx.seeded.delete(cacheKey);
5016
+ if (!leader && isActive()) sendSeedDenial(res, result);
5017
+ return;
5018
+ }
4561
5019
  if (!isActive()) return;
4562
5020
  entry = ctx.cache.getAsync ? await raceWithTimeout(ctx.cache.getAsync(cacheKey), ctx.l2ReadTimeoutMs) : ctx.cache.get(cacheKey);
4563
5021
  } catch (error) {
4564
- ctx.seeded.delete(cacheKey);
5022
+ if (ctx.seeded.get(cacheKey) === seedTask) ctx.seeded.delete(cacheKey);
4565
5023
  logger$5.warn("SSG build seed unavailable; rendering origin", error);
4566
5024
  }
4567
5025
  }
@@ -5186,6 +5644,36 @@ function refreshHeaders(req, ctx) {
5186
5644
  return headers;
5187
5645
  }
5188
5646
  //#endregion
5647
+ //#region src/server/safeRedirect.ts
5648
+ var REDIRECT_ORIGIN = "https://isr.invalid";
5649
+ /** Validate the final Location value against a fixed origin, never an untrusted Host header. */
5650
+ function isSafeLocalRedirect(target) {
5651
+ if (!target.startsWith("/") || target.startsWith("//")) return false;
5652
+ for (const character of target) {
5653
+ const code = character.charCodeAt(0);
5654
+ if (code < 32 || code === 127) return false;
5655
+ }
5656
+ const pathEnd = target.search(/[?#]/);
5657
+ if (target.slice(0, pathEnd < 0 ? void 0 : pathEnd).includes("\\")) return false;
5658
+ try {
5659
+ return new URL(target, REDIRECT_ORIGIN).origin === REDIRECT_ORIGIN;
5660
+ } catch {
5661
+ return false;
5662
+ }
5663
+ }
5664
+ function readRedirectQuery(url) {
5665
+ const delimiter = url.indexOf("?");
5666
+ return delimiter < 0 ? void 0 : url.slice(delimiter + 1);
5667
+ }
5668
+ function redirectLocal(res, status, pathname, query) {
5669
+ const target = query === void 0 ? pathname : `${pathname}?${query}`;
5670
+ if (!isSafeLocalRedirect(target)) {
5671
+ res.status(400).end();
5672
+ return;
5673
+ }
5674
+ res.redirect(status, target);
5675
+ }
5676
+ //#endregion
5189
5677
  //#region src/security/staticCspManifest.ts
5190
5678
  var STATIC_CSP_MANIFEST = "static-csp-manifest.json";
5191
5679
  var SCHEMA_VERSION = 3;
@@ -5503,6 +5991,7 @@ async function createProductionRuntime(config, options = {}) {
5503
5991
  if (errors.length) throw new AggregateError(errors.map((result) => result.reason), "Production runtime cleanup failed");
5504
5992
  })();
5505
5993
  try {
5994
+ validateRequestLimits(config.server.requestLimits);
5506
5995
  const runtime = config.runtime;
5507
5996
  applyTelemetryIntegrationEnv(runtime);
5508
5997
  const sentryIntegration = runtime?.telemetry ? runtime.telemetry.integrations?.sentry : void 0;
@@ -5524,7 +6013,7 @@ async function createProductionRuntime(config, options = {}) {
5524
6013
  app.use(createSecurityMiddleware(false, extraConnectSrc));
5525
6014
  app.use(createCompressionMiddleware());
5526
6015
  if (extraConnectSrc.length > 0) logger$8.info(`🔒 CSP connect-src 加入:${extraConnectSrc.join(", ")}`);
5527
- const { requestContext } = await import("./RequestContext-BVQ-rOmV.js").then((n) => n.t);
6016
+ const { requestContext } = await import("./abVariantContext-Ud3aZ1yk.js").then((n) => n.y);
5528
6017
  const { createServerRequestContext, applyAnonCookie } = await Promise.resolve().then(() => createServerRequestContext_exports);
5529
6018
  const cookieDomain = runtime?.cookieDomain;
5530
6019
  app.use((req, res, next) => {
@@ -5534,7 +6023,7 @@ async function createProductionRuntime(config, options = {}) {
5534
6023
  });
5535
6024
  if (runtime?.i18n?.prefixDefault) {
5536
6025
  const { createLocaleRedirectMiddleware } = await Promise.resolve().then(() => LocaleRedirect_exports);
5537
- const { resolveI18nConfig } = await import("./i18n-Dobe0Wxn.js").then((n) => n.t);
6026
+ const { resolveI18nConfig } = await import("./i18n-CnXYAgQE.js").then((n) => n.t);
5538
6027
  const middleware = createLocaleRedirectMiddleware({ i18n: resolveI18nConfig(runtime.i18n) });
5539
6028
  if (middleware) {
5540
6029
  app.use(middleware);
@@ -5571,7 +6060,7 @@ async function createProductionRuntime(config, options = {}) {
5571
6060
  const expKeys = manifestLoader ? Object.keys(manifestLoader.getCurrent()) : Object.keys(runtime?.experiments ?? {});
5572
6061
  logger$8.info(`🧪 A/B testing 已启用:${expKeys.join(", ") || "(empty)"}${manifestLoader ? " [manifest]" : " [static]"}${exposureQueue ? " + exposure tracking" : ""}`);
5573
6062
  }
5574
- if (opsConfig.health.enabled) app.get("/health", createOpsAuthMiddleware("health", opsConfig), (_req, res) => {
6063
+ if (opsConfig.health.enabled) app.get("/health", getOpsRequestLimiter(opsConfig), createOpsAuthMiddleware("health", opsConfig), (_req, res) => {
5575
6064
  res.json({
5576
6065
  status: "healthy",
5577
6066
  version: package_default.version,
@@ -5580,11 +6069,25 @@ async function createProductionRuntime(config, options = {}) {
5580
6069
  });
5581
6070
  });
5582
6071
  options.setupRoutes?.(app);
6072
+ const staticHtmlLimiter = createRequestLimiter("staticHtml", config.server.requestLimits?.staticHtml);
6073
+ const seoLimiter = createRequestLimiter("seo", config.server.requestLimits?.seo);
6074
+ app.use((req, res, next) => {
6075
+ if (req.method !== "GET" && req.method !== "HEAD") return next();
6076
+ let pathname;
6077
+ try {
6078
+ pathname = normalizeStaticAssetPathname(req.path).toLowerCase().replace(/\/$/, "");
6079
+ } catch {
6080
+ res.status(400).end();
6081
+ return;
6082
+ }
6083
+ if (pathname === "/sitemap.xml" || pathname === "/robots.txt") return seoLimiter(req, res, next);
6084
+ next();
6085
+ });
5583
6086
  app.use(createStaticAssetMiddleware(clientDir));
5584
6087
  app.use("/assets", (_req, res) => {
5585
6088
  res.status(404).set("Cache-Control", "no-store").end();
5586
6089
  });
5587
- const { createImageMiddleware } = await import("./createImagePlugin-_ntL0DcT.js").then((n) => n.r);
6090
+ const { createImageMiddleware } = await import("./createImagePlugin-BZJHOvN9.js").then((n) => n.r);
5588
6091
  const { resolveImageOptions } = await Promise.resolve().then(() => resolveImageOptions_exports);
5589
6092
  app.use(createImageMiddleware(resolveImageOptions(config.runtime.images), {}, clientDir));
5590
6093
  const { createAutoCacheStore } = await Promise.resolve().then(() => createAutoCacheStore_exports);
@@ -5606,6 +6109,7 @@ async function createProductionRuntime(config, options = {}) {
5606
6109
  }, {
5607
6110
  buildId: process.env.APP_VERSION ?? staticCspIndex.buildId,
5608
6111
  resolveInvalidationPath: resolveSsgIdentity,
6112
+ staticSeedAdmission: (req, res) => admitRequest(staticHtmlLimiter, req, res),
5609
6113
  staticSeedInfo: (pathname) => {
5610
6114
  const htmlPath = ssgFiles.get(pathname);
5611
6115
  if (!htmlPath) return;
@@ -5656,7 +6160,7 @@ async function createProductionRuntime(config, options = {}) {
5656
6160
  });
5657
6161
  cleanups.push(() => cache.destroy());
5658
6162
  if (opsConfig.inventory.enabled) {
5659
- const { createCacheInspectorMiddleware } = await import("./createCacheInspectorMiddleware-DYJ2WGYu.js");
6163
+ const { createCacheInspectorMiddleware } = await import("./createCacheInspectorMiddleware-Bjku5v62.js");
5660
6164
  app.use(createCacheInspectorMiddleware(cache, opsConfig));
5661
6165
  logger$8.info("🔍 ISR cache inventory 已启用:GET /__isr/cache/inventory");
5662
6166
  }
@@ -5669,20 +6173,20 @@ async function createProductionRuntime(config, options = {}) {
5669
6173
  res.status(400).end();
5670
6174
  return;
5671
6175
  }
5672
- if (!ssgAliases.get(logical)) return next();
5673
- const canonical = resolveSsgIdentity(req.path);
6176
+ const known = ssgAliases.get(logical);
6177
+ if (!known) return next();
6178
+ const canonical = explicitRoutes.get(logical) ?? known;
5674
6179
  if (req.path === canonical) return next();
5675
- const queryStart = req.url.indexOf("?");
5676
- res.redirect(308, canonical + (queryStart < 0 ? "" : req.url.slice(queryStart)));
6180
+ redirectLocal(res, 308, canonical, readRedirectQuery(req.url));
5677
6181
  });
5678
6182
  app.use(cache);
5679
- const staticHtml = createStaticHtmlMiddleware(clientDir, staticCspIndex);
6183
+ const staticHtml = createStaticHtmlMiddlewareWithLimiter(clientDir, staticCspIndex, staticHtmlLimiter);
5680
6184
  app.use((req, res, next) => {
5681
6185
  if (res.getHeader("X-Resolved-Mode") === "ssg" || ssgAliases.has(decodeHtmlPathname(req.path)) && explicitRoutes.has(decodeHtmlPathname(req.path))) return next();
5682
6186
  staticHtml(req, res, next);
5683
6187
  });
5684
- const { promRegistry } = await import("./abVariantContext-CWCdRSdG.js").then((n) => n.f);
5685
- if (opsConfig.metrics.enabled) app.get("/metrics", createOpsAuthMiddleware("metrics", opsConfig), async (_req, res) => {
6188
+ const { promRegistry } = await Promise.resolve().then(() => PromMetrics_exports);
6189
+ if (opsConfig.metrics.enabled) app.get("/metrics", getOpsRequestLimiter(opsConfig), createOpsAuthMiddleware("metrics", opsConfig), async (_req, res) => {
5686
6190
  try {
5687
6191
  res.set("content-type", promRegistry.contentType);
5688
6192
  res.end(await promRegistry.metrics());
@@ -5712,7 +6216,7 @@ async function createProductionRuntime(config, options = {}) {
5712
6216
  res.end(seo.generateRobotsTxt());
5713
6217
  });
5714
6218
  const { renderError500Html } = await import("./error500-template-DhaZzLOB.js");
5715
- const { getTraceId } = await import("./RequestContext-BVQ-rOmV.js").then((n) => n.t);
6219
+ const { getTraceId } = await import("./abVariantContext-Ud3aZ1yk.js").then((n) => n.y);
5716
6220
  app.all(/.*/, createProductionRequestHandler(rscHandler, (err, _req, res) => {
5717
6221
  logger$8.error("[Server]", "请求处理异常", err);
5718
6222
  if (!res.headersSent) {
@@ -5843,8 +6347,25 @@ async function pipeWebResponse(response, res) {
5843
6347
  else nodeReadable.pipe(res);
5844
6348
  });
5845
6349
  }
5846
- /** Static HTML can only be served from the build index validated before startup. */
5847
- function createStaticHtmlMiddleware(clientDir, index) {
6350
+ function createStaticHtmlMiddlewareWithLimiter(clientDir, index, limiter) {
6351
+ const targets = /* @__PURE__ */ new WeakMap();
6352
+ const guarded = express.Router();
6353
+ guarded.use(limiter);
6354
+ guarded.use((req, res, next) => {
6355
+ const target = targets.get(req);
6356
+ targets.delete(req);
6357
+ if (!target) return next();
6358
+ res.setHeader("Content-Security-Policy", applyStaticScriptPolicy(String(res.getHeader("Content-Security-Policy") ?? "default-src 'self'"), target.hashes));
6359
+ res.setHeader("Cache-Control", "public, max-age=3600");
6360
+ res.setHeader("X-Served-By", "ssg-static");
6361
+ res.sendFile(target.htmlPath, {
6362
+ root: clientDir,
6363
+ maxAge: "1h",
6364
+ dotfiles: "ignore"
6365
+ }, (error) => {
6366
+ if (error) next(error);
6367
+ });
6368
+ });
5848
6369
  return (req, res, next) => {
5849
6370
  if (req.method !== "GET" && req.method !== "HEAD") return next();
5850
6371
  let pathname;
@@ -5858,19 +6379,17 @@ function createStaticHtmlMiddleware(clientDir, index) {
5858
6379
  const htmlPath = relative.endsWith("/") || !relative ? relative + "index.html" : relative.toLowerCase().endsWith(".html") ? relative : relative + "/index.html";
5859
6380
  const hashes = index.scriptHashes.get(htmlPath);
5860
6381
  if (!hashes) return next();
5861
- res.setHeader("Content-Security-Policy", applyStaticScriptPolicy(String(res.getHeader("Content-Security-Policy") ?? "default-src 'self'"), hashes));
5862
- res.setHeader("Cache-Control", "public, max-age=3600");
5863
- res.setHeader("X-Served-By", "ssg-static");
5864
- res.sendFile(htmlPath, {
5865
- root: clientDir,
5866
- maxAge: "1h",
5867
- dotfiles: "ignore"
5868
- }, (error) => {
5869
- if (error) next(error);
6382
+ targets.set(req, {
6383
+ htmlPath,
6384
+ hashes
5870
6385
  });
6386
+ guarded(req, res, next);
5871
6387
  };
5872
6388
  }
5873
6389
  /** Asset serving must never discover HTML outside the validated build manifest. */
6390
+ function normalizeStaticAssetPathname(pathname) {
6391
+ return path.posix.normalize(decodeURIComponent(new URL(`http://localhost${pathname}`).pathname).replaceAll("\\", "/"));
6392
+ }
5874
6393
  function createStaticAssetMiddleware(clientDir) {
5875
6394
  const assets = express.static(clientDir, {
5876
6395
  index: false,
@@ -5885,7 +6404,7 @@ function createStaticAssetMiddleware(clientDir) {
5885
6404
  return (req, res, next) => {
5886
6405
  let pathname;
5887
6406
  try {
5888
- pathname = path.posix.normalize(decodeURIComponent(new URL(`http://localhost${req.path}`).pathname).replaceAll("\\", "/"));
6407
+ pathname = normalizeStaticAssetPathname(req.path);
5889
6408
  } catch {
5890
6409
  res.status(400).end();
5891
6410
  return;
@@ -6411,7 +6930,11 @@ function createLocaleRedirectMiddleware(options) {
6411
6930
  const { i18n, skipPathPrefixes = [] } = options;
6412
6931
  if (!i18n.prefixDefault) return null;
6413
6932
  if (!i18n.locales || i18n.locales.length === 0) return null;
6414
- const localeSet = new Set(i18n.locales);
6933
+ const localePrefixes = new Map(i18n.locales.map((locale) => [locale, `/${locale}`]));
6934
+ function redirectLocale(res, status, prefix, path, suffix, url) {
6935
+ const tail = path.startsWith("/") ? path.slice(1) : path;
6936
+ redirectLocal(res, status, tail ? `${prefix}/${tail}${suffix}` : prefix + suffix, readRedirectQuery(url));
6937
+ }
6415
6938
  return function localeRedirectMiddleware(req, res, next) {
6416
6939
  if (req.method !== "GET" && req.method !== "HEAD") return next();
6417
6940
  const rawPath = req.path;
@@ -6427,20 +6950,22 @@ function createLocaleRedirectMiddleware(options) {
6427
6950
  if (path.includes(".")) return next();
6428
6951
  const first = path.split("/")[1];
6429
6952
  if (first) {
6430
- if (localeSet.has(first)) return next();
6953
+ if (localePrefixes.has(first)) return next();
6431
6954
  const ci = i18n.locales.find((l) => l.toLowerCase() === first.toLowerCase());
6432
- if (ci) {
6433
- const rest = path.slice(first.length + 1) || "/";
6434
- const search = req.url.includes("?") ? req.url.slice(req.url.indexOf("?")) : "";
6435
- const finalRest = rest === "/" ? "" : rest;
6436
- res.redirect(308, `/${ci}${finalRest}${rscSuffix}${search}`);
6955
+ const prefix = ci ? localePrefixes.get(ci) : void 0;
6956
+ if (prefix) {
6957
+ redirectLocale(res, 308, prefix, path.slice(first.length + 1) || "/", rscSuffix, req.url);
6437
6958
  return;
6438
6959
  }
6439
6960
  }
6440
6961
  const cookieLocale = readCookieLocale(typeof req.headers["cookie"] === "string" ? req.headers["cookie"] : "");
6441
- const target = (cookieLocale && localeSet.has(cookieLocale) ? cookieLocale : null) || negotiateLocale(typeof req.headers["accept-language"] === "string" ? req.headers["accept-language"] : null, i18n);
6442
- const search = req.url.includes("?") ? req.url.slice(req.url.indexOf("?")) : "";
6443
- res.redirect(302, withLocale(path, target, i18n) + rscSuffix + search);
6962
+ const target = (cookieLocale && localePrefixes.has(cookieLocale) ? cookieLocale : null) || negotiateLocale(typeof req.headers["accept-language"] === "string" ? req.headers["accept-language"] : null, i18n);
6963
+ const prefix = localePrefixes.get(target);
6964
+ if (!prefix) {
6965
+ res.status(400).end();
6966
+ return;
6967
+ }
6968
+ redirectLocale(res, 302, prefix, path, rscSuffix, req.url);
6444
6969
  };
6445
6970
  }
6446
6971
  function readCookieLocale(header) {
@@ -6496,11 +7021,13 @@ function loadProdManifest() {
6496
7021
  /**
6497
7022
  * 初始化开发模式服务器上下文
6498
7023
  */
6499
- async function initDevContext(requestHandler) {
7024
+ async function initDevContext(requestHandler, config) {
6500
7025
  logger$1.info("🔧 初始化开发模式服务器...");
7026
+ const viteDevMiddleware = await createViteDevServer();
7027
+ bindRuntimeOpsConfig(requestHandler, getRuntimeOpsConfig(viteDevMiddleware) ?? resolveOpsConfig(config, "development"));
6501
7028
  return {
6502
7029
  requestHandler,
6503
- viteDevMiddleware: await createViteDevServer(),
7030
+ viteDevMiddleware,
6504
7031
  isDev: true,
6505
7032
  manifest: null,
6506
7033
  httpServer: null
@@ -6511,7 +7038,7 @@ async function initDevContext(requestHandler) {
6511
7038
  */
6512
7039
  async function initServerContext(config) {
6513
7040
  if (serverContext) return serverContext;
6514
- serverContext = await initDevContext(express());
7041
+ serverContext = await initDevContext(express(), config);
6515
7042
  developmentCleanups.push(closeViteDevServer);
6516
7043
  applyBaseMiddlewaresWithOptions(serverContext);
6517
7044
  const cookieDomain = config?.runtime?.cookieDomain;
@@ -6647,14 +7174,18 @@ var ISRRoutes = class {
6647
7174
  logger;
6648
7175
  defaultMode;
6649
7176
  routes;
7177
+ requestLimits;
6650
7178
  constructor(engine, logger, config) {
6651
7179
  this.engine = engine;
6652
7180
  this.logger = logger;
6653
7181
  this.defaultMode = config.renderMode;
6654
7182
  this.routes = config.routes || {};
7183
+ this.requestLimits = config.requestLimits;
6655
7184
  }
6656
7185
  setup(requestHandler) {
6657
- requestHandler.get("/health", (_req, res) => {
7186
+ const seoLimiter = createRequestLimiter("seo", this.requestLimits?.seo);
7187
+ const opsConfig = getRuntimeOpsConfig(requestHandler) ?? resolveOpsConfig({ server: { requestLimits: this.requestLimits } }, "development");
7188
+ if (opsConfig.health.enabled) requestHandler.get("/health", getOpsRequestLimiter(opsConfig), createOpsAuthMiddleware("health", opsConfig), (_req, res) => {
6658
7189
  res.json({
6659
7190
  status: "healthy",
6660
7191
  version: package_default.version,
@@ -6664,7 +7195,7 @@ var ISRRoutes = class {
6664
7195
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
6665
7196
  });
6666
7197
  });
6667
- requestHandler.get("/sitemap.xml", async (_req, res) => {
7198
+ requestHandler.get("/sitemap.xml", seoLimiter, async (_req, res) => {
6668
7199
  try {
6669
7200
  const candidates = [
6670
7201
  path.resolve(process.cwd(), "dist/client/sitemap.xml"),
@@ -6689,7 +7220,7 @@ var ISRRoutes = class {
6689
7220
  res.status(500).send("Internal Server Error");
6690
7221
  }
6691
7222
  });
6692
- requestHandler.get("/robots.txt", async (_req, res) => {
7223
+ requestHandler.get("/robots.txt", seoLimiter, async (_req, res) => {
6693
7224
  try {
6694
7225
  const candidates = [
6695
7226
  path.resolve(process.cwd(), "dist/client/robots.txt"),
@@ -7237,7 +7768,8 @@ var ISREngine = class {
7237
7768
  if (!isDev()) return;
7238
7769
  new ISRRoutes(this, this.logger, {
7239
7770
  renderMode: this.config.renderMode,
7240
- routes: this.config.routes
7771
+ routes: this.config.routes,
7772
+ requestLimits: this.config.server.requestLimits
7241
7773
  }).setup(requestHandler);
7242
7774
  });
7243
7775
  return this.serverContext;
@@ -7317,6 +7849,6 @@ async function createISRApp(appOption) {
7317
7849
  };
7318
7850
  }
7319
7851
  //#endregion
7320
- export { CacheCleanup as $, FallbackChain as A, scanComponents as B, loadConfig as C, getRouteFallbackChain as D, getFallbackChain as E, logger$8 as F, parseRouteFromFile as G, scanRoutes as H, DEFAULT_PORT as I, isTestFile as J, parseRoutes as K, package_default as L, RenderModes as M, extractSsgRoutes as N, matchRoutePattern as O, spiderSsgRoutes as P, getEnv as Q, resolveFetchHandler as R, createOpsAuthMiddleware as S, createMemoryCacheStore as T, parseComponentFromFile as U, scanProject as V, parseComponents as W, isDev as X, readDirRecursive as Y, isProd as Z, RedisInvalidationBus as _, DEFAULT_SEO_CONFIG as a, createCoherentCacheStore as b, startAppServer as c, startServer as d, assertDistinctHtmlRouteIdentities as et, createProductionRuntime as f, createIsrCacheMiddleware as g, createIsrCacheHandler as h, createSEOEngine as i, InternalStrategies as j, resolveRenderMode as k, createABVariantMiddleware as l, generateStaticCspManifest as m, ISREngine as n, mergeSEOConfig as o, prepareProductionBuild as p, isCodeFile as q, SEOEngine as r, shutdownServer as s, createISRApp as t, resolveImageOptions as tt, closeServer as u, RedisCacheAdapter as v, createHybridCacheStore as w, createDevAssetRequestMiddleware as x, MemoryCacheAdapter as y, DEFAULT_SCAN_CONFIG as z };
7852
+ export { isCodeFile as $, createHybridCacheStore as A, spiderSsgRoutes as B, getOpsRequestLimiter as C, invalidatorRunsTotal as D, invalidatorFailuresTotal as E, resolveRenderMode as F, DEFAULT_SCAN_CONFIG as G, DEFAULT_PORT as H, FallbackChain as I, scanRoutes as J, scanComponents as K, InternalStrategies as L, getFallbackChain as M, getRouteFallbackChain as N, promRegistry as O, matchRoutePattern as P, parseRoutes as Q, RenderModes as R, createOpsAuthMiddleware as S, createPrometheusMetricsMiddleware as T, package_default as U, logger$8 as V, resolveFetchHandler as W, parseComponents as X, parseComponentFromFile as Y, parseRouteFromFile as Z, RedisInvalidationBus as _, DEFAULT_SEO_CONFIG as a, CacheCleanup as at, createCoherentCacheStore as b, startAppServer as c, startServer as d, isTestFile as et, createProductionRuntime as f, createIsrCacheMiddleware as g, createIsrCacheHandler as h, createSEOEngine as i, getEnv as it, createMemoryCacheStore as j, recordHttpRequest as k, createABVariantMiddleware as l, generateStaticCspManifest as m, ISREngine as n, isDev as nt, mergeSEOConfig as o, assertDistinctHtmlRouteIdentities as ot, prepareProductionBuild as p, scanProject as q, SEOEngine as r, isProd as rt, shutdownServer as s, resolveImageOptions as st, createISRApp as t, readDirRecursive as tt, closeServer as u, RedisCacheAdapter as v, loadConfig as w, createDevAssetRequestMiddleware as x, MemoryCacheAdapter as y, extractSsgRoutes as z };
7321
7853
 
7322
- //# sourceMappingURL=createISRApp-CylUYiIU.js.map
7854
+ //# sourceMappingURL=createISRApp-DYVU8ydT.js.map