@farm.js/core 0.1.16 → 0.1.17
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/dist/agent-runtime.d.mts +3 -3
- package/dist/agent-runtime.d.ts +3 -3
- package/dist/api/client.cjs +62 -28
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/client.mjs +3 -3
- package/dist/api/route-manager.cjs +69 -32
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +65 -29
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api/runtime.mjs +6 -3
- package/dist/{api-client-B-n3pm_Q.d.mts → api-client-Cx54IR5g.d.mts} +2 -2
- package/dist/{api-client-C0_NZEBl.d.ts → api-client-DykpaKcY.d.ts} +2 -2
- package/dist/api.cjs +106 -33
- package/dist/api.d.mts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/api.mjs +8 -8
- package/dist/{app-AyjEsCBq.d.ts → app-BHY_10Lm.d.ts} +3 -3
- package/dist/{app-CYPHeOo_.d.mts → app-BMk0do23.d.mts} +3 -3
- package/dist/app-markdown.d.mts +4 -4
- package/dist/app-markdown.d.ts +4 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/cache.cjs +62 -28
- package/dist/cache.d.mts +11 -1
- package/dist/cache.d.ts +11 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-7HDZYYS4.mjs → chunk-4OOBRCJX.mjs} +27 -5
- package/dist/{chunk-NHHKW2T6.mjs → chunk-56DAX2BE.mjs} +170 -52
- package/dist/{chunk-B76DT5Y6.mjs → chunk-57J3Y7Y3.mjs} +1 -1
- package/dist/{chunk-MOQNHLTS.mjs → chunk-5QOEPUYE.mjs} +5 -2
- package/dist/{chunk-HKLRP3BN.mjs → chunk-5SPPCN5J.mjs} +1 -1
- package/dist/{chunk-LUC2FAGW.mjs → chunk-6VQIKZZO.mjs} +1 -1
- package/dist/{chunk-7ZWL7XOU.mjs → chunk-76DG3LF3.mjs} +1 -1
- package/dist/{chunk-EWDK36MM.mjs → chunk-A72YEUZ3.mjs} +1 -1
- package/dist/{chunk-ZHOIQC6U.mjs → chunk-ATERBVHQ.mjs} +2 -2
- package/dist/{chunk-27JNCYEK.mjs → chunk-EN7WTEAY.mjs} +2 -2
- package/dist/{chunk-IGO2HEV7.mjs → chunk-F6SJAKFJ.mjs} +62 -28
- package/dist/{chunk-GSDIZACQ.mjs → chunk-FG5H2VCJ.mjs} +2 -2
- package/dist/{chunk-LZK5CXDW.mjs → chunk-KLSSO6YD.mjs} +2 -2
- package/dist/{chunk-KUO3GBPK.mjs → chunk-L6V3P73N.mjs} +1 -1
- package/dist/{chunk-TYVVIQ5M.mjs → chunk-MVIWBEJF.mjs} +32 -25
- package/dist/{chunk-KTGFMHET.mjs → chunk-N6UROPT7.mjs} +1 -1
- package/dist/{chunk-NDD2YVGU.mjs → chunk-NRVGEI5I.mjs} +10 -3
- package/dist/{chunk-IXTEENRS.mjs → chunk-QGVJVSNX.mjs} +5 -5
- package/dist/{chunk-6SCB2MXB.mjs → chunk-SXHV42UQ.mjs} +16 -1
- package/dist/{chunk-OWTIOHON.mjs → chunk-SYGGPS4A.mjs} +2 -2
- package/dist/{chunk-NC333MFA.mjs → chunk-TSWW5BVH.mjs} +7 -4
- package/dist/{chunk-LK6FGAQR.mjs → chunk-UDBJCUPA.mjs} +7 -4
- package/dist/{chunk-NUD6XBMO.mjs → chunk-UTBVHYS3.mjs} +2 -2
- package/dist/{chunk-76MNRHTS.mjs → chunk-UUYF3CHN.mjs} +2 -2
- package/dist/{chunk-VVTREAG5.mjs → chunk-WD4YXVLV.mjs} +11 -3
- package/dist/{chunk-UQZPTIML.mjs → chunk-WD5PNSOB.mjs} +2 -2
- package/dist/{chunk-DPZUDPVJ.mjs → chunk-XP777LRD.mjs} +1 -1
- package/dist/{chunk-KATQ6I56.mjs → chunk-XWAYMDLB.mjs} +1 -1
- package/dist/{chunk-IL5RWYK7.mjs → chunk-YD4J4XCI.mjs} +1 -1
- package/dist/{chunk-Q3MDL7TM.mjs → chunk-ZCNJKLA2.mjs} +30 -11
- package/dist/{client-plugins-CqVtZi5X.d.ts → client-plugins-C089bQhN.d.ts} +2 -2
- package/dist/{client-plugins-CIPRtSsW.d.mts → client-plugins-JXXmZliS.d.mts} +2 -2
- package/dist/client-plugins.d.mts +3 -3
- package/dist/client-plugins.d.ts +3 -3
- package/dist/client.cjs +62 -28
- package/dist/client.d.mts +8 -8
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +6 -6
- package/dist/config.d.mts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/cron.mjs +2 -2
- package/dist/{devtools-IU7LKZOH.mjs → devtools-UFVTMQX5.mjs} +7 -7
- package/dist/docs.cjs +18 -10
- package/dist/docs.mjs +9 -9
- package/dist/{endpoint-kSAxE52R.d.ts → endpoint-1zA994xL.d.ts} +1 -1
- package/dist/{endpoint-Bu3XgeMK.d.mts → endpoint-DAc96i93.d.mts} +1 -1
- package/dist/env.cjs +39 -5
- package/dist/env.d.mts +5 -3
- package/dist/env.d.ts +5 -3
- package/dist/env.mjs +2 -1
- package/dist/index.cjs +311 -93
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +34 -34
- package/dist/integrations.d.mts +3 -3
- package/dist/integrations.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +342 -121
- package/dist/internal/build-runtime.d.mts +5 -5
- package/dist/internal/build-runtime.d.ts +5 -5
- package/dist/internal/build-runtime.mjs +23 -23
- package/dist/internal/cli-runtime.cjs +77 -31
- package/dist/internal/cli-runtime.mjs +13 -13
- package/dist/internal/client-error-overlay.cjs +1 -1
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +3 -3
- package/dist/internal/compression-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.cjs +14 -2
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +101 -41
- package/dist/internal/production-runtime.d.mts +9 -9
- package/dist/internal/production-runtime.d.ts +9 -9
- package/dist/internal/production-runtime.mjs +6 -6
- package/dist/markdown.cjs +16 -1
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-8g__AMPM.d.ts → metadata-BcNJP4fq.d.ts} +1 -1
- package/dist/{metadata-OMX6wFNf.d.mts → metadata-C1Z9vLbb.d.mts} +1 -1
- package/dist/middleware.cjs +10 -3
- package/dist/middleware.d.mts +5 -5
- package/dist/middleware.d.ts +5 -5
- package/dist/middleware.mjs +4 -4
- package/dist/{nitro-3N4ZXRYM.mjs → nitro-CVZ36JM5.mjs} +4 -4
- package/dist/plugin.cjs +256 -105
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime-W3M0eNDV.d.mts → production-runtime-jcrTlRTb.d.mts} +1 -1
- package/dist/{production-runtime-BJh7o6Cr.d.ts → production-runtime-oKmC0WU-.d.ts} +1 -1
- package/dist/{render-plan-io7pvDNc.d.mts → render-plan-BLIfc4jt.d.mts} +1 -1
- package/dist/{render-plan-Be4ZGTJP.d.ts → render-plan-DOB9cV-h.d.ts} +1 -1
- package/dist/renderer-client.cjs +62 -28
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +3 -3
- package/dist/{request-DZkHYQ89.d.mts → request-Cr53NRHr.d.mts} +1 -1
- package/dist/{request-G8JhKr4F.d.ts → request-Dt2gNuQD.d.ts} +1 -1
- package/dist/request.d.mts +4 -4
- package/dist/request.d.ts +4 -4
- package/dist/{route-C_eLaFTZ.d.mts → route-B0XrsrFk.d.mts} +1 -1
- package/dist/{route-BxNJT447.d.ts → route-DOEpbyWZ.d.ts} +1 -1
- package/dist/{route-rendering-BcLLPJgN.d.ts → route-rendering-CWYd8Mv1.d.ts} +1 -1
- package/dist/{route-rendering-CbAKr1TY.d.mts → route-rendering-CeFBEAoZ.d.mts} +1 -1
- package/dist/routes.cjs +68 -31
- package/dist/routes.d.mts +4 -4
- package/dist/routes.d.ts +4 -4
- package/dist/routes.mjs +2 -2
- package/dist/server-fn-client.d.mts +3 -3
- package/dist/server-fn-client.d.ts +3 -3
- package/dist/server-fn.cjs +72 -30
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.d.mts +4 -4
- package/dist/server-plugins.d.ts +4 -4
- package/dist/server-query-client.cjs +62 -28
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query-client.mjs +4 -4
- package/dist/server-query.cjs +72 -30
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +239 -80
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +22 -22
- package/dist/{spa-router-BcS_4nqm.d.mts → spa-router-CQWiYGxS.d.mts} +2 -2
- package/dist/{spa-router-BzFBUJkn.d.ts → spa-router-Wjiw-8hB.d.ts} +2 -2
- package/dist/testing.cjs +73 -32
- package/dist/testing.d.mts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.mjs +11 -7
- package/dist/{utils-C4yrAhNc.d.ts → utils-B0XJmG_b.d.ts} +1 -1
- package/dist/{utils-5kQP1mFR.d.mts → utils-uUxF0K0P.d.mts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +260 -109
- package/dist/vite.d.mts +3 -3
- package/dist/vite.d.ts +3 -3
- package/dist/vite.mjs +19 -19
- package/dist/workflows.mjs +2 -2
- package/package.json +2 -2
- package/dist/{chunk-VO5SCWF5.mjs → chunk-BNGS6KJ6.mjs} +0 -0
- package/dist/{chunk-MUUZJLCI.mjs → chunk-EGJDUF4Q.mjs} +3 -3
- package/dist/{chunk-4L7SZOHZ.mjs → chunk-YHOCRI4H.mjs} +3 -3
|
@@ -2030,6 +2030,8 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2030
2030
|
constructor(config = {}) {
|
|
2031
2031
|
this.entries = /* @__PURE__ */ new Map();
|
|
2032
2032
|
this.inflight = /* @__PURE__ */ new Map();
|
|
2033
|
+
/** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
|
|
2034
|
+
this.entriesByTag = /* @__PURE__ */ new Map();
|
|
2033
2035
|
this.invalidatedTagVersions = /* @__PURE__ */ new Map();
|
|
2034
2036
|
this.activeGenerations = /* @__PURE__ */ new Set();
|
|
2035
2037
|
this.version = 0;
|
|
@@ -2048,6 +2050,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2048
2050
|
configure(config = {}) {
|
|
2049
2051
|
this.generation++;
|
|
2050
2052
|
this.entries.clear();
|
|
2053
|
+
this.entriesByTag.clear();
|
|
2051
2054
|
this.inflight.clear();
|
|
2052
2055
|
this.invalidatedTagVersions.clear();
|
|
2053
2056
|
this.activeGenerations.clear();
|
|
@@ -2214,14 +2217,12 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2214
2217
|
return entry;
|
|
2215
2218
|
}
|
|
2216
2219
|
delete(key) {
|
|
2217
|
-
const deleted = this.
|
|
2218
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
2220
|
+
const deleted = this.deleteLocalEntry(key);
|
|
2219
2221
|
emitFarmEvent({ type: "cache.delete", key, deleted });
|
|
2220
2222
|
return deleted;
|
|
2221
2223
|
}
|
|
2222
2224
|
async deleteAsync(key) {
|
|
2223
|
-
const deleted = this.
|
|
2224
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
2225
|
+
const deleted = this.deleteLocalEntry(key);
|
|
2225
2226
|
if (this.adapter) {
|
|
2226
2227
|
await this.adapter.delete(this.createAdapterKey(key));
|
|
2227
2228
|
}
|
|
@@ -2232,6 +2233,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2232
2233
|
const count = this.entries.size;
|
|
2233
2234
|
this.generation++;
|
|
2234
2235
|
this.entries.clear();
|
|
2236
|
+
this.entriesByTag.clear();
|
|
2235
2237
|
this.inflight.clear();
|
|
2236
2238
|
this.invalidatedTagVersions.clear();
|
|
2237
2239
|
this.activeGenerations.clear();
|
|
@@ -2317,23 +2319,32 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2317
2319
|
return cached.value;
|
|
2318
2320
|
}
|
|
2319
2321
|
const inflight = this.inflight.get(key);
|
|
2320
|
-
if (inflight) {
|
|
2322
|
+
if (inflight && !this.wasInvalidatedSince(inflight.tags, inflight.startVersion)) {
|
|
2321
2323
|
emitFarmEvent({ type: "cache.dedupe", key });
|
|
2322
|
-
return inflight;
|
|
2324
|
+
return inflight.promise;
|
|
2323
2325
|
}
|
|
2324
2326
|
const tags = Array.from(normalizeCacheOptionsTags(options));
|
|
2325
2327
|
const generation = this.generation;
|
|
2328
|
+
const startVersion = this.version;
|
|
2326
2329
|
const promise = this.fillCacheEntry(key, producer, options, tags, generation).catch((error) => {
|
|
2327
2330
|
emitFarmEvent({ type: "cache.error", key, operation: "set", error });
|
|
2328
2331
|
throw error;
|
|
2329
2332
|
}).finally(() => {
|
|
2330
|
-
if (this.inflight.get(key) === promise) {
|
|
2333
|
+
if (this.inflight.get(key)?.promise === promise) {
|
|
2331
2334
|
this.inflight.delete(key);
|
|
2332
2335
|
}
|
|
2333
2336
|
});
|
|
2334
|
-
this.inflight.set(key, promise);
|
|
2337
|
+
this.inflight.set(key, { promise, tags, startVersion });
|
|
2335
2338
|
return promise;
|
|
2336
2339
|
}
|
|
2340
|
+
/** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
|
|
2341
|
+
wasInvalidatedSince(tags, version) {
|
|
2342
|
+
for (const tag of tags) {
|
|
2343
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
2344
|
+
if (invalidatedVersion !== void 0 && invalidatedVersion > version) return true;
|
|
2345
|
+
}
|
|
2346
|
+
return false;
|
|
2347
|
+
}
|
|
2337
2348
|
async fillCacheEntry(key, producer, options, tags, generation) {
|
|
2338
2349
|
const adapter = this.adapter;
|
|
2339
2350
|
const namespace = this.namespace;
|
|
@@ -2374,7 +2385,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2374
2385
|
return value;
|
|
2375
2386
|
} finally {
|
|
2376
2387
|
this.activeGenerations.delete(activeGeneration);
|
|
2377
|
-
this.pruneInvalidatedTagVersions();
|
|
2388
|
+
this.pruneInvalidatedTagVersions(activeGeneration.tags);
|
|
2378
2389
|
if (leaseToken && adapter?.releaseLease) {
|
|
2379
2390
|
try {
|
|
2380
2391
|
await adapter.releaseLease(leaseKey, leaseToken);
|
|
@@ -2419,18 +2430,9 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2419
2430
|
}
|
|
2420
2431
|
return void 0;
|
|
2421
2432
|
}
|
|
2422
|
-
countEntriesForTag(tag) {
|
|
2423
|
-
let count = 0;
|
|
2424
|
-
for (const entry of this.entries.values()) {
|
|
2425
|
-
if (entry.tags.has(tag)) {
|
|
2426
|
-
count++;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
return count;
|
|
2430
|
-
}
|
|
2431
2433
|
countEntriesForTags(tags) {
|
|
2432
2434
|
let count = 0;
|
|
2433
|
-
for (const entry of this.
|
|
2435
|
+
for (const entry of this.entriesByTag.get(tags[0]) ?? []) {
|
|
2434
2436
|
if (tags.every((tag) => entry.tags.has(tag))) {
|
|
2435
2437
|
count++;
|
|
2436
2438
|
}
|
|
@@ -2438,10 +2440,10 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2438
2440
|
return count;
|
|
2439
2441
|
}
|
|
2440
2442
|
invalidateTag(normalizedTag) {
|
|
2441
|
-
const count = this.
|
|
2443
|
+
const count = this.entriesByTag.get(normalizedTag)?.size ?? 0;
|
|
2442
2444
|
this.invalidatedTagVersions.delete(normalizedTag);
|
|
2443
2445
|
this.invalidatedTagVersions.set(normalizedTag, ++this.version);
|
|
2444
|
-
this.pruneInvalidatedTagVersions();
|
|
2446
|
+
this.pruneInvalidatedTagVersions([normalizedTag]);
|
|
2445
2447
|
return count;
|
|
2446
2448
|
}
|
|
2447
2449
|
toPublicEntry(entry) {
|
|
@@ -2471,19 +2473,51 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2471
2473
|
this.entries.set(key, entry);
|
|
2472
2474
|
}
|
|
2473
2475
|
storeLocalEntry(entry) {
|
|
2474
|
-
|
|
2476
|
+
const removed = [];
|
|
2477
|
+
const replaced = this.detachLocalEntry(entry.key);
|
|
2478
|
+
if (replaced) removed.push(replaced);
|
|
2475
2479
|
this.entries.set(entry.key, entry);
|
|
2480
|
+
for (const tag of entry.tags) {
|
|
2481
|
+
let tagged = this.entriesByTag.get(tag);
|
|
2482
|
+
if (!tagged) this.entriesByTag.set(tag, tagged = /* @__PURE__ */ new Set());
|
|
2483
|
+
tagged.add(entry);
|
|
2484
|
+
}
|
|
2476
2485
|
while (this.entries.size > this.maxEntries) {
|
|
2477
2486
|
const oldestKey = this.entries.keys().next().value;
|
|
2478
2487
|
if (oldestKey === void 0) break;
|
|
2479
|
-
this.
|
|
2488
|
+
removed.push(this.detachLocalEntry(oldestKey));
|
|
2480
2489
|
}
|
|
2481
|
-
this.pruneInvalidatedTagVersions();
|
|
2490
|
+
for (const removedEntry of removed) this.pruneInvalidatedTagVersions(removedEntry.tags);
|
|
2482
2491
|
}
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2492
|
+
deleteLocalEntry(key) {
|
|
2493
|
+
const entry = this.detachLocalEntry(key);
|
|
2494
|
+
if (!entry) return false;
|
|
2495
|
+
this.pruneInvalidatedTagVersions(entry.tags);
|
|
2496
|
+
return true;
|
|
2497
|
+
}
|
|
2498
|
+
detachLocalEntry(key) {
|
|
2499
|
+
const entry = this.entries.get(key);
|
|
2500
|
+
if (!entry) return void 0;
|
|
2501
|
+
this.entries.delete(key);
|
|
2502
|
+
for (const tag of entry.tags) {
|
|
2503
|
+
const tagged = this.entriesByTag.get(tag);
|
|
2504
|
+
if (!tagged) continue;
|
|
2505
|
+
tagged.delete(entry);
|
|
2506
|
+
if (tagged.size === 0) this.entriesByTag.delete(tag);
|
|
2507
|
+
}
|
|
2508
|
+
return entry;
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Drop invalidation versions that no local entry or active fill can be stale against.
|
|
2512
|
+
* Callers pass only the tags whose dependents just changed, so the cost is bounded by
|
|
2513
|
+
* the entries sharing those tags rather than by the whole cache.
|
|
2514
|
+
*/
|
|
2515
|
+
pruneInvalidatedTagVersions(tags) {
|
|
2516
|
+
tags: for (const tag of tags) {
|
|
2517
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
2518
|
+
if (invalidatedVersion === void 0) continue;
|
|
2519
|
+
for (const entry of this.entriesByTag.get(tag) ?? []) {
|
|
2520
|
+
if (entry.createdVersion < invalidatedVersion) continue tags;
|
|
2487
2521
|
}
|
|
2488
2522
|
for (const generation of this.activeGenerations) {
|
|
2489
2523
|
if (generation.tags.has(tag) && generation.createdVersion < invalidatedVersion)
|
|
@@ -4397,7 +4431,7 @@ function parseColonParam(segment) {
|
|
|
4397
4431
|
};
|
|
4398
4432
|
}
|
|
4399
4433
|
__name(parseColonParam, "parseColonParam");
|
|
4400
|
-
function compilePathPattern(pattern) {
|
|
4434
|
+
function compilePathPattern(pattern, trailingSlash = false) {
|
|
4401
4435
|
const params = [];
|
|
4402
4436
|
const segments = pattern.split("/").filter(Boolean);
|
|
4403
4437
|
if (segments.length === 0) {
|
|
@@ -4433,11 +4467,18 @@ function compilePathPattern(pattern) {
|
|
|
4433
4467
|
});
|
|
4434
4468
|
return {
|
|
4435
4469
|
kind: "path",
|
|
4436
|
-
regex: new RegExp(`^${parts.join("")}$`),
|
|
4470
|
+
regex: new RegExp(`^${parts.join("")}${trailingSlash ? "/?" : ""}$`),
|
|
4437
4471
|
params
|
|
4438
4472
|
};
|
|
4439
4473
|
}
|
|
4440
4474
|
__name(compilePathPattern, "compilePathPattern");
|
|
4475
|
+
function compileMatcherPattern(pattern) {
|
|
4476
|
+
if (typeof pattern === "string" && pattern !== "*" && !pattern.endsWith("(.*)")) {
|
|
4477
|
+
return compilePathPattern(pattern, true);
|
|
4478
|
+
}
|
|
4479
|
+
return compilePattern(pattern);
|
|
4480
|
+
}
|
|
4481
|
+
__name(compileMatcherPattern, "compileMatcherPattern");
|
|
4441
4482
|
function compilePattern(pattern) {
|
|
4442
4483
|
if (pattern instanceof RegExp) {
|
|
4443
4484
|
return { kind: "regexp", regex: pattern };
|
|
@@ -4457,7 +4498,7 @@ __name(compilePattern, "compilePattern");
|
|
|
4457
4498
|
function compileMiddlewareConfig(config) {
|
|
4458
4499
|
const compiled = {
|
|
4459
4500
|
matcher: config.matcher ? toMatcherList(config.matcher).map(
|
|
4460
|
-
(matcher) => typeof matcher === "function" ? matcher :
|
|
4501
|
+
(matcher) => typeof matcher === "function" ? matcher : compileMatcherPattern(matcher)
|
|
4461
4502
|
) : void 0,
|
|
4462
4503
|
exclude: config.exclude?.map(compilePattern)
|
|
4463
4504
|
};
|
|
@@ -6180,6 +6221,7 @@ function manageFarmHtmlPreloads(html, config) {
|
|
|
6180
6221
|
{
|
|
6181
6222
|
index,
|
|
6182
6223
|
kind,
|
|
6224
|
+
href: readHtmlAttribute(element.value, "href"),
|
|
6183
6225
|
highPriority: readHtmlAttribute(element.value, "fetchpriority")?.toLowerCase() === "high"
|
|
6184
6226
|
}
|
|
6185
6227
|
] : [];
|
|
@@ -6203,6 +6245,7 @@ function manageFarmLinkHeaderPreloads(value, config) {
|
|
|
6203
6245
|
{
|
|
6204
6246
|
index,
|
|
6205
6247
|
kind,
|
|
6248
|
+
href: getLinkHeaderTarget(link),
|
|
6206
6249
|
highPriority: getLinkHeaderParameter(link, "fetchpriority")?.toLowerCase() === "high"
|
|
6207
6250
|
}
|
|
6208
6251
|
] : [];
|
|
@@ -6225,6 +6268,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
6225
6268
|
candidates.push({
|
|
6226
6269
|
index,
|
|
6227
6270
|
kind,
|
|
6271
|
+
href: readHtmlAttribute(element.value, "href"),
|
|
6228
6272
|
highPriority: readHtmlAttribute(element.value, "fetchpriority")?.toLowerCase() === "high"
|
|
6229
6273
|
});
|
|
6230
6274
|
}
|
|
@@ -6234,6 +6278,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
6234
6278
|
candidates.push({
|
|
6235
6279
|
index: headerOffset + index,
|
|
6236
6280
|
kind,
|
|
6281
|
+
href: getLinkHeaderTarget(link),
|
|
6237
6282
|
highPriority: getLinkHeaderParameter(link, "fetchpriority")?.toLowerCase() === "high"
|
|
6238
6283
|
});
|
|
6239
6284
|
}
|
|
@@ -6282,24 +6327,33 @@ function selectPreloadsWithinBudget(candidates, config) {
|
|
|
6282
6327
|
const removed = /* @__PURE__ */ new Set();
|
|
6283
6328
|
const warnings = [];
|
|
6284
6329
|
for (const kind of ["image", "font"]) {
|
|
6285
|
-
const
|
|
6330
|
+
const resources = /* @__PURE__ */ new Map();
|
|
6331
|
+
for (const candidate of candidates) {
|
|
6332
|
+
if (candidate.kind !== kind) continue;
|
|
6333
|
+
const key = candidate.href ?? `#${candidate.index}`;
|
|
6334
|
+
const hints = resources.get(key);
|
|
6335
|
+
if (hints) hints.push(candidate);
|
|
6336
|
+
else resources.set(key, [candidate]);
|
|
6337
|
+
}
|
|
6286
6338
|
const limit = kind === "image" ? config.maxImages : config.maxFonts;
|
|
6287
|
-
if (
|
|
6288
|
-
const
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6339
|
+
if (resources.size <= limit) continue;
|
|
6340
|
+
const ranked = [...resources.values()].map((hints) => ({
|
|
6341
|
+
hints,
|
|
6342
|
+
index: hints[0].index,
|
|
6343
|
+
highPriority: hints.some((hint) => hint.highPriority)
|
|
6344
|
+
})).sort(
|
|
6345
|
+
(left, right) => Number(right.highPriority) - Number(left.highPriority) || left.index - right.index
|
|
6292
6346
|
);
|
|
6293
6347
|
if (config.mode === "enforce") {
|
|
6294
|
-
for (const
|
|
6295
|
-
|
|
6348
|
+
for (const resource of ranked.slice(limit)) {
|
|
6349
|
+
for (const hint of resource.hints) removed.add(hint.index);
|
|
6296
6350
|
}
|
|
6297
6351
|
}
|
|
6298
6352
|
warnings.push({
|
|
6299
6353
|
kind,
|
|
6300
|
-
count:
|
|
6354
|
+
count: resources.size,
|
|
6301
6355
|
budget: limit,
|
|
6302
|
-
removed: config.mode === "enforce" ?
|
|
6356
|
+
removed: config.mode === "enforce" ? resources.size - limit : 0
|
|
6303
6357
|
});
|
|
6304
6358
|
}
|
|
6305
6359
|
return { removed, warnings };
|
|
@@ -6317,6 +6371,12 @@ function getLinkHeaderPreloadKind(link) {
|
|
|
6317
6371
|
return normalizePreloadKind(getLinkHeaderParameter(link, "as"));
|
|
6318
6372
|
}
|
|
6319
6373
|
__name(getLinkHeaderPreloadKind, "getLinkHeaderPreloadKind");
|
|
6374
|
+
function getLinkHeaderTarget(link) {
|
|
6375
|
+
const start = link.indexOf("<");
|
|
6376
|
+
const end = link.indexOf(">", start + 1);
|
|
6377
|
+
return start === -1 || end === -1 ? void 0 : link.slice(start + 1, end).trim();
|
|
6378
|
+
}
|
|
6379
|
+
__name(getLinkHeaderTarget, "getLinkHeaderTarget");
|
|
6320
6380
|
function getLinkHeaderParameter(link, name) {
|
|
6321
6381
|
const uriEnd = link.indexOf(">");
|
|
6322
6382
|
if (uriEnd === -1) return void 0;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export { _runWithAfterRequest } from '../after.mjs';
|
|
2
|
-
export { m as mergeRouteRenderingDirectiveConfig } from '../route-rendering-
|
|
2
|
+
export { m as mergeRouteRenderingDirectiveConfig } from '../route-rendering-CeFBEAoZ.mjs';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from '../workflows-CR9ex-gz.mjs';
|
|
4
4
|
export { a as FarmServerConfig, b as bufferFarmRequestBody, c as cloneFarmRequestWithContext, d as createFarmNodeRequestAbortSignal, e as createFarmRequestBodyErrorResponse, m as matchesFarmIfNoneMatch, r as readFarmRequestBody, f as readNodeRequestBody, g as resolveFarmServerConfig } from '../workflows-CR9ex-gz.mjs';
|
|
5
|
-
export { _ as _runWithCurrentRequest, g as getCurrentRequest, r as resolveFarmWebRequestOrigin } from '../request-
|
|
6
|
-
import { aw as APIRequestRuntime, w as FarmConfig, I as FarmContextFactoryInput } from '../client-plugins-
|
|
7
|
-
export { aH as applyFarmCspNonceToResponse, az as collectFarmLlmsTxtPages, ay as createFarmAgentRobots, aA as createFarmDefaultLlmsTxt, aB as createFarmLlmsMarkdownReader, ax as createFarmMetadataRouteResponse, aD as manageFarmDocumentPreloads, aE as manageFarmHtmlPreloads, aF as manageFarmLinkHeaderPreloads, aC as renderFarmLlmsFullTxt, aG as reportFarmPreloadWarnings, aI as resolveFarmSecurityConfig } from '../client-plugins-
|
|
5
|
+
export { _ as _runWithCurrentRequest, g as getCurrentRequest, r as resolveFarmWebRequestOrigin } from '../request-Cr53NRHr.mjs';
|
|
6
|
+
import { aw as APIRequestRuntime, w as FarmConfig, I as FarmContextFactoryInput } from '../client-plugins-JXXmZliS.mjs';
|
|
7
|
+
export { aH as applyFarmCspNonceToResponse, az as collectFarmLlmsTxtPages, ay as createFarmAgentRobots, aA as createFarmDefaultLlmsTxt, aB as createFarmLlmsMarkdownReader, ax as createFarmMetadataRouteResponse, aD as manageFarmDocumentPreloads, aE as manageFarmHtmlPreloads, aF as manageFarmLinkHeaderPreloads, aC as renderFarmLlmsFullTxt, aG as reportFarmPreloadWarnings, aI as resolveFarmSecurityConfig } from '../client-plugins-JXXmZliS.mjs';
|
|
8
8
|
export { configureFarmCache, createFarmCacheKey, getFarmDataCache, normalizeRevalidatePath } from '../cache.mjs';
|
|
9
9
|
import { g as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from '../types-Z0aotQ8w.mjs';
|
|
10
10
|
export { c as createFarmLocaleCookie, g as getFarmLocaleVaryHeaders } from '../resolver-DhW0CqZN.mjs';
|
|
11
11
|
import { F as FarmLocalePathConfig } from '../index-a-8Z5kZU.mjs';
|
|
12
12
|
export { l as localizeFarmHref, a as localizeFarmPathname, s as stripFarmLocaleFromPathname } from '../index-a-8Z5kZU.mjs';
|
|
13
|
-
export { a as addMetadataImageReference, b as addMetadataMarkdownAlternate, m as mergeMetadata, r as renderMetadataHead, c as resolveFarmNotFoundMetadata } from '../metadata-
|
|
14
|
-
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner } from '../production-runtime-
|
|
13
|
+
export { a as addMetadataImageReference, b as addMetadataMarkdownAlternate, m as mergeMetadata, r as renderMetadataHead, c as resolveFarmNotFoundMetadata } from '../metadata-C1Z9vLbb.mjs';
|
|
14
|
+
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner } from '../production-runtime-jcrTlRTb.mjs';
|
|
15
15
|
export { g as getFarmRedirectError, i as isFarmNotFoundError, a as isFarmRedirectError } from '../navigation-errors-Dvwpzaer.mjs';
|
|
16
16
|
export { configureFarmObservability, emitFarmEvent, runWithFarmRequestSpan } from '../observability.mjs';
|
|
17
17
|
export { f as createFarmInstrumentationLifecycle, r as resolveFarmInstrumentationRuntime } from '../instrumentation-runtime-CE06JLHZ.mjs';
|
|
18
18
|
export { _setDefaultFarmThemeConfig, getTheme } from '../theme/server.mjs';
|
|
19
19
|
import { c as FarmThemeRuntime, d as FarmThemeConfig, R as ResolvedFarmThemeConfig, a as FarmThemePreference } from '../types-DQnyD3VD.mjs';
|
|
20
20
|
export { d as applyFarmBasePath, r as resolveFarmTrailingSlashRedirect, s as searchParamsToObject, b as setFarmBasePath, a as setFarmTrailingSlashPreference, c as stripFarmBasePath } from '../base-path-BU16ETmo.mjs';
|
|
21
|
-
export { m as matchFarmPageRoute, p as parseRoutePath } from '../utils-
|
|
21
|
+
export { m as matchFarmPageRoute, p as parseRoutePath } from '../utils-uUxF0K0P.mjs';
|
|
22
22
|
import 'node:http';
|
|
23
23
|
import '../lifecycle-DK06VuKP.mjs';
|
|
24
|
-
import '../route-
|
|
25
|
-
import '../endpoint-
|
|
24
|
+
import '../route-B0XrsrFk.mjs';
|
|
25
|
+
import '../endpoint-DAc96i93.mjs';
|
|
26
26
|
import '../renderer.mjs';
|
|
27
27
|
import '../deployment.mjs';
|
|
28
28
|
import 'http';
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export { _runWithAfterRequest } from '../after.js';
|
|
2
|
-
export { m as mergeRouteRenderingDirectiveConfig } from '../route-rendering-
|
|
2
|
+
export { m as mergeRouteRenderingDirectiveConfig } from '../route-rendering-CWYd8Mv1.js';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from '../workflows-CR9ex-gz.js';
|
|
4
4
|
export { a as FarmServerConfig, b as bufferFarmRequestBody, c as cloneFarmRequestWithContext, d as createFarmNodeRequestAbortSignal, e as createFarmRequestBodyErrorResponse, m as matchesFarmIfNoneMatch, r as readFarmRequestBody, f as readNodeRequestBody, g as resolveFarmServerConfig } from '../workflows-CR9ex-gz.js';
|
|
5
|
-
export { _ as _runWithCurrentRequest, g as getCurrentRequest, r as resolveFarmWebRequestOrigin } from '../request-
|
|
6
|
-
import { aw as APIRequestRuntime, w as FarmConfig, I as FarmContextFactoryInput } from '../client-plugins-
|
|
7
|
-
export { aH as applyFarmCspNonceToResponse, az as collectFarmLlmsTxtPages, ay as createFarmAgentRobots, aA as createFarmDefaultLlmsTxt, aB as createFarmLlmsMarkdownReader, ax as createFarmMetadataRouteResponse, aD as manageFarmDocumentPreloads, aE as manageFarmHtmlPreloads, aF as manageFarmLinkHeaderPreloads, aC as renderFarmLlmsFullTxt, aG as reportFarmPreloadWarnings, aI as resolveFarmSecurityConfig } from '../client-plugins-
|
|
5
|
+
export { _ as _runWithCurrentRequest, g as getCurrentRequest, r as resolveFarmWebRequestOrigin } from '../request-Dt2gNuQD.js';
|
|
6
|
+
import { aw as APIRequestRuntime, w as FarmConfig, I as FarmContextFactoryInput } from '../client-plugins-C089bQhN.js';
|
|
7
|
+
export { aH as applyFarmCspNonceToResponse, az as collectFarmLlmsTxtPages, ay as createFarmAgentRobots, aA as createFarmDefaultLlmsTxt, aB as createFarmLlmsMarkdownReader, ax as createFarmMetadataRouteResponse, aD as manageFarmDocumentPreloads, aE as manageFarmHtmlPreloads, aF as manageFarmLinkHeaderPreloads, aC as renderFarmLlmsFullTxt, aG as reportFarmPreloadWarnings, aI as resolveFarmSecurityConfig } from '../client-plugins-C089bQhN.js';
|
|
8
8
|
export { configureFarmCache, createFarmCacheKey, getFarmDataCache, normalizeRevalidatePath } from '../cache.js';
|
|
9
9
|
import { g as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from '../types-Z0aotQ8w.js';
|
|
10
10
|
export { c as createFarmLocaleCookie, g as getFarmLocaleVaryHeaders } from '../resolver-PPEeiJ6M.js';
|
|
11
11
|
import { F as FarmLocalePathConfig } from '../index-BWVfxIsO.js';
|
|
12
12
|
export { l as localizeFarmHref, a as localizeFarmPathname, s as stripFarmLocaleFromPathname } from '../index-BWVfxIsO.js';
|
|
13
|
-
export { a as addMetadataImageReference, b as addMetadataMarkdownAlternate, m as mergeMetadata, r as renderMetadataHead, c as resolveFarmNotFoundMetadata } from '../metadata-
|
|
14
|
-
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner } from '../production-runtime-
|
|
13
|
+
export { a as addMetadataImageReference, b as addMetadataMarkdownAlternate, m as mergeMetadata, r as renderMetadataHead, c as resolveFarmNotFoundMetadata } from '../metadata-BcNJP4fq.js';
|
|
14
|
+
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner } from '../production-runtime-oKmC0WU-.js';
|
|
15
15
|
export { g as getFarmRedirectError, i as isFarmNotFoundError, a as isFarmRedirectError } from '../navigation-errors-Dvwpzaer.js';
|
|
16
16
|
export { configureFarmObservability, emitFarmEvent, runWithFarmRequestSpan } from '../observability.js';
|
|
17
17
|
export { f as createFarmInstrumentationLifecycle, r as resolveFarmInstrumentationRuntime } from '../instrumentation-runtime-CE06JLHZ.js';
|
|
18
18
|
export { _setDefaultFarmThemeConfig, getTheme } from '../theme/server.js';
|
|
19
19
|
import { c as FarmThemeRuntime, d as FarmThemeConfig, R as ResolvedFarmThemeConfig, a as FarmThemePreference } from '../types-DQnyD3VD.js';
|
|
20
20
|
export { d as applyFarmBasePath, r as resolveFarmTrailingSlashRedirect, s as searchParamsToObject, b as setFarmBasePath, a as setFarmTrailingSlashPreference, c as stripFarmBasePath } from '../base-path-BU16ETmo.js';
|
|
21
|
-
export { m as matchFarmPageRoute, p as parseRoutePath } from '../utils-
|
|
21
|
+
export { m as matchFarmPageRoute, p as parseRoutePath } from '../utils-B0XJmG_b.js';
|
|
22
22
|
import 'node:http';
|
|
23
23
|
import '../lifecycle-DK06VuKP.js';
|
|
24
|
-
import '../route-
|
|
25
|
-
import '../endpoint-
|
|
24
|
+
import '../route-DOEpbyWZ.js';
|
|
25
|
+
import '../endpoint-1zA994xL.js';
|
|
26
26
|
import '../renderer.js';
|
|
27
27
|
import '../deployment.js';
|
|
28
28
|
import 'http';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyProductionMiddlewareHeaders,
|
|
3
3
|
createProductionMiddlewareRunner
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-N6UROPT7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createFarmInstrumentationLifecycle,
|
|
7
7
|
resolveFarmInstrumentationRuntime
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getDefaultErrorStatusText,
|
|
23
23
|
renderFarmLocaleAlternateLinks,
|
|
24
24
|
resolveDefaultErrorStatus
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-76DG3LF3.mjs";
|
|
26
26
|
import {
|
|
27
27
|
mergeRouteRenderingDirectiveConfig
|
|
28
28
|
} from "../chunk-DAO7JGTS.mjs";
|
|
@@ -47,8 +47,8 @@ import {
|
|
|
47
47
|
renderFarmLlmsFullTxt,
|
|
48
48
|
reportFarmPreloadWarnings,
|
|
49
49
|
resolveFarmSecurityConfig
|
|
50
|
-
} from "../chunk-
|
|
51
|
-
import "../chunk-
|
|
50
|
+
} from "../chunk-ZCNJKLA2.mjs";
|
|
51
|
+
import "../chunk-SXHV42UQ.mjs";
|
|
52
52
|
import {
|
|
53
53
|
farmSecretsMatch
|
|
54
54
|
} from "../chunk-2UC36WAC.mjs";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
import {
|
|
61
61
|
_runWithMiddlewareContext,
|
|
62
62
|
_runWithMiddlewareData
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-NRVGEI5I.mjs";
|
|
64
64
|
import "../chunk-5TISYEQF.mjs";
|
|
65
65
|
import {
|
|
66
66
|
_runWithAPIRequestRuntime
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
createFarmCacheKey,
|
|
113
113
|
getFarmDataCache,
|
|
114
114
|
normalizeRevalidatePath
|
|
115
|
-
} from "../chunk-
|
|
115
|
+
} from "../chunk-F6SJAKFJ.mjs";
|
|
116
116
|
import "../chunk-4SIYUGRY.mjs";
|
|
117
117
|
import "../chunk-C4NCTZLM.mjs";
|
|
118
118
|
import {
|
package/dist/markdown.cjs
CHANGED
|
@@ -139,8 +139,16 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
139
139
|
if (!hasMarkdownExtension) {
|
|
140
140
|
headersOut.set("Vary", "Accept");
|
|
141
141
|
}
|
|
142
|
+
for (const token of pageResponse.headers.get("vary")?.split(",") ?? []) {
|
|
143
|
+
const name = token.trim();
|
|
144
|
+
if (name && name.toLowerCase() !== "accept") appendHeaderToken(headersOut, "Vary", name);
|
|
145
|
+
}
|
|
146
|
+
const pageCacheControl = pageResponse.headers.get("cache-control");
|
|
142
147
|
const cache = target.route?.cache ?? options.config?.cache ?? false;
|
|
143
|
-
headersOut.set(
|
|
148
|
+
headersOut.set(
|
|
149
|
+
"Cache-Control",
|
|
150
|
+
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
|
|
151
|
+
);
|
|
144
152
|
return new Response(options.request.method === "HEAD" ? null : markdown, {
|
|
145
153
|
status: pageResponse.status,
|
|
146
154
|
headers: headersOut
|
|
@@ -370,6 +378,13 @@ function isHtmlResponse(response) {
|
|
|
370
378
|
return contentType.includes("text/html");
|
|
371
379
|
}
|
|
372
380
|
__name(isHtmlResponse, "isHtmlResponse");
|
|
381
|
+
function isPrivateCacheControl(value) {
|
|
382
|
+
return value.split(",").some((directive) => {
|
|
383
|
+
const name = directive.split("=", 1)[0].trim().toLowerCase();
|
|
384
|
+
return name === "private" || name === "no-store";
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
__name(isPrivateCacheControl, "isPrivateCacheControl");
|
|
373
388
|
function createMarkdownCacheHeader(cache) {
|
|
374
389
|
if (cache === false || cache <= 0) {
|
|
375
390
|
return "no-store";
|
package/dist/markdown.mjs
CHANGED
package/dist/middleware.cjs
CHANGED
|
@@ -1611,7 +1611,7 @@ function parseColonParam(segment) {
|
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
1613
|
__name(parseColonParam, "parseColonParam");
|
|
1614
|
-
function compilePathPattern(pattern) {
|
|
1614
|
+
function compilePathPattern(pattern, trailingSlash = false) {
|
|
1615
1615
|
const params = [];
|
|
1616
1616
|
const segments = pattern.split("/").filter(Boolean);
|
|
1617
1617
|
if (segments.length === 0) {
|
|
@@ -1647,11 +1647,18 @@ function compilePathPattern(pattern) {
|
|
|
1647
1647
|
});
|
|
1648
1648
|
return {
|
|
1649
1649
|
kind: "path",
|
|
1650
|
-
regex: new RegExp(`^${parts.join("")}$`),
|
|
1650
|
+
regex: new RegExp(`^${parts.join("")}${trailingSlash ? "/?" : ""}$`),
|
|
1651
1651
|
params
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
1654
|
__name(compilePathPattern, "compilePathPattern");
|
|
1655
|
+
function compileMatcherPattern(pattern) {
|
|
1656
|
+
if (typeof pattern === "string" && pattern !== "*" && !pattern.endsWith("(.*)")) {
|
|
1657
|
+
return compilePathPattern(pattern, true);
|
|
1658
|
+
}
|
|
1659
|
+
return compilePattern(pattern);
|
|
1660
|
+
}
|
|
1661
|
+
__name(compileMatcherPattern, "compileMatcherPattern");
|
|
1655
1662
|
function compilePattern(pattern) {
|
|
1656
1663
|
if (pattern instanceof RegExp) {
|
|
1657
1664
|
return { kind: "regexp", regex: pattern };
|
|
@@ -1671,7 +1678,7 @@ __name(compilePattern, "compilePattern");
|
|
|
1671
1678
|
function compileMiddlewareConfig(config) {
|
|
1672
1679
|
const compiled = {
|
|
1673
1680
|
matcher: config.matcher ? toMatcherList(config.matcher).map(
|
|
1674
|
-
(matcher) => typeof matcher === "function" ? matcher :
|
|
1681
|
+
(matcher) => typeof matcher === "function" ? matcher : compileMatcherPattern(matcher)
|
|
1675
1682
|
) : void 0,
|
|
1676
1683
|
exclude: config.exclude?.map(compilePattern)
|
|
1677
1684
|
};
|
package/dist/middleware.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ep as MiddlewareChain, eu as RateLimitStorage, ev as RateLimitStatus, ew as MemoryRateLimitStorageOptions, an as MiddlewareContext, ak as FarmMiddlewareConfig, el as MiddlewareFunction, am as MiddlewareConfig, u as MiddlewareProps } from './client-plugins-
|
|
2
|
-
export { eq as CookieJar, er as CookieOptions, ey as MiddlewareResult, eo as MiddlewareStore, ex as NextFunction, es as RateLimitConfig, et as RateLimitIncrementResult, aj as ReadonlyMiddlewareStore, em as RequestMiddleware, en as RequestMiddlewareContext } from './client-plugins-
|
|
1
|
+
import { ep as MiddlewareChain, eu as RateLimitStorage, ev as RateLimitStatus, ew as MemoryRateLimitStorageOptions, an as MiddlewareContext, ak as FarmMiddlewareConfig, el as MiddlewareFunction, am as MiddlewareConfig, u as MiddlewareProps } from './client-plugins-JXXmZliS.mjs';
|
|
2
|
+
export { eq as CookieJar, er as CookieOptions, ey as MiddlewareResult, eo as MiddlewareStore, ex as NextFunction, es as RateLimitConfig, et as RateLimitIncrementResult, aj as ReadonlyMiddlewareStore, em as RequestMiddleware, en as RequestMiddlewareContext } from './client-plugins-JXXmZliS.mjs';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
4
|
import { ViteDevServer, Plugin } from 'vite';
|
|
5
5
|
import { a as FarmServerConfig, R as ResolvedFarmServerConfig } from './workflows-CR9ex-gz.mjs';
|
|
6
6
|
import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.mjs';
|
|
7
|
-
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner, g as getMiddlewareContext, d as getMiddlewareData, e as getMiddlewareValue, m as matchesMiddlewareConfig } from './production-runtime-
|
|
7
|
+
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner, g as getMiddlewareContext, d as getMiddlewareData, e as getMiddlewareValue, m as matchesMiddlewareConfig } from './production-runtime-jcrTlRTb.mjs';
|
|
8
8
|
import './lifecycle-DK06VuKP.mjs';
|
|
9
|
-
import './route-
|
|
10
|
-
import './endpoint-
|
|
9
|
+
import './route-B0XrsrFk.mjs';
|
|
10
|
+
import './endpoint-DAc96i93.mjs';
|
|
11
11
|
import './cache.mjs';
|
|
12
12
|
import './renderer.mjs';
|
|
13
13
|
import './deployment.mjs';
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ep as MiddlewareChain, eu as RateLimitStorage, ev as RateLimitStatus, ew as MemoryRateLimitStorageOptions, an as MiddlewareContext, ak as FarmMiddlewareConfig, el as MiddlewareFunction, am as MiddlewareConfig, u as MiddlewareProps } from './client-plugins-
|
|
2
|
-
export { eq as CookieJar, er as CookieOptions, ey as MiddlewareResult, eo as MiddlewareStore, ex as NextFunction, es as RateLimitConfig, et as RateLimitIncrementResult, aj as ReadonlyMiddlewareStore, em as RequestMiddleware, en as RequestMiddlewareContext } from './client-plugins-
|
|
1
|
+
import { ep as MiddlewareChain, eu as RateLimitStorage, ev as RateLimitStatus, ew as MemoryRateLimitStorageOptions, an as MiddlewareContext, ak as FarmMiddlewareConfig, el as MiddlewareFunction, am as MiddlewareConfig, u as MiddlewareProps } from './client-plugins-C089bQhN.js';
|
|
2
|
+
export { eq as CookieJar, er as CookieOptions, ey as MiddlewareResult, eo as MiddlewareStore, ex as NextFunction, es as RateLimitConfig, et as RateLimitIncrementResult, aj as ReadonlyMiddlewareStore, em as RequestMiddleware, en as RequestMiddlewareContext } from './client-plugins-C089bQhN.js';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
4
|
import { ViteDevServer, Plugin } from 'vite';
|
|
5
5
|
import { a as FarmServerConfig, R as ResolvedFarmServerConfig } from './workflows-CR9ex-gz.js';
|
|
6
6
|
import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.js';
|
|
7
|
-
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner, g as getMiddlewareContext, d as getMiddlewareData, e as getMiddlewareValue, m as matchesMiddlewareConfig } from './production-runtime-
|
|
7
|
+
export { _ as _runWithMiddlewareContext, b as _runWithMiddlewareData, a as applyProductionMiddlewareHeaders, c as createProductionMiddlewareRunner, g as getMiddlewareContext, d as getMiddlewareData, e as getMiddlewareValue, m as matchesMiddlewareConfig } from './production-runtime-oKmC0WU-.js';
|
|
8
8
|
import './lifecycle-DK06VuKP.js';
|
|
9
|
-
import './route-
|
|
10
|
-
import './endpoint-
|
|
9
|
+
import './route-DOEpbyWZ.js';
|
|
10
|
+
import './endpoint-1zA994xL.js';
|
|
11
11
|
import './cache.js';
|
|
12
12
|
import './renderer.js';
|
|
13
13
|
import './deployment.js';
|
package/dist/middleware.mjs
CHANGED
|
@@ -7,23 +7,23 @@ import {
|
|
|
7
7
|
memoryRateLimitStorage,
|
|
8
8
|
middleware,
|
|
9
9
|
unwrapMiddleware
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A72YEUZ3.mjs";
|
|
11
11
|
import {
|
|
12
12
|
applyProductionMiddlewareHeaders,
|
|
13
13
|
createProductionMiddlewareRunner,
|
|
14
14
|
matchesMiddlewareConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N6UROPT7.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MiddlewareManager,
|
|
18
18
|
createContext
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-57J3Y7Y3.mjs";
|
|
20
20
|
import {
|
|
21
21
|
_runWithMiddlewareContext,
|
|
22
22
|
_runWithMiddlewareData,
|
|
23
23
|
getMiddlewareContext,
|
|
24
24
|
getMiddlewareData,
|
|
25
25
|
getMiddlewareValue
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NRVGEI5I.mjs";
|
|
27
27
|
import "./chunk-5TISYEQF.mjs";
|
|
28
28
|
import "./chunk-I2BHUNBU.mjs";
|
|
29
29
|
import "./chunk-7GNWGLWB.mjs";
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
createFarmCronCloudflareConfig,
|
|
6
6
|
mergeScheduledTasks,
|
|
7
7
|
prepareFarmCronForNitro
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YHOCRI4H.mjs";
|
|
9
9
|
import {
|
|
10
10
|
createBundledEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4OOBRCJX.mjs";
|
|
12
12
|
import {
|
|
13
13
|
prepareFarmWorkflowsForNitro
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-ONUEYC6N.mjs";
|
|
14
|
+
} from "./chunk-EGJDUF4Q.mjs";
|
|
16
15
|
import "./chunk-2UC36WAC.mjs";
|
|
16
|
+
import "./chunk-ONUEYC6N.mjs";
|
|
17
17
|
import {
|
|
18
18
|
resolveFarmAPIServerBasePath
|
|
19
19
|
} from "./chunk-I6XDAKWQ.mjs";
|