@void/isr 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.d.mts +6 -2
- package/dist/core.mjs +3 -2
- package/dist/index.d.mts +5 -4
- package/package.json +6 -5
package/dist/core.d.mts
CHANGED
|
@@ -83,9 +83,13 @@ export type IsrPageTtl = Readonly<{
|
|
|
83
83
|
* Only requests that match no page fall back to the flattened revalidate config.
|
|
84
84
|
*/
|
|
85
85
|
export declare function resolvePageTtl(pages: ReadonlyArray<IsrPageTtl> | undefined, revalidate: number | Record<string, number> | undefined, pathRevalidate: Record<string, number> | undefined, pathname: string): number;
|
|
86
|
+
interface SerializedHeaders {
|
|
87
|
+
[name: string]: string;
|
|
88
|
+
}
|
|
86
89
|
/** Extract response headers while removing ISR-managed and private headers. */
|
|
87
|
-
export declare function serializeHeaders(response: Response):
|
|
90
|
+
export declare function serializeHeaders(response: Response): SerializedHeaders;
|
|
88
91
|
/** Validate page data before storing it as the JSON ISR variant. */
|
|
89
92
|
export declare function normalizePageDataForJsonCache(raw: string): string | null;
|
|
90
93
|
/** Extract validated Void Pages data embedded in an HTML response. */
|
|
91
|
-
export declare function extractPageDataFromHtml(html: string): string | null;
|
|
94
|
+
export declare function extractPageDataFromHtml(html: string): string | null;
|
|
95
|
+
export {};
|
package/dist/core.mjs
CHANGED
|
@@ -190,7 +190,7 @@ function isSharedCacheableResponse(response) {
|
|
|
190
190
|
}
|
|
191
191
|
/** Resolve the first matching path TTL using Void route-pattern semantics. */
|
|
192
192
|
function resolvePathTtl(revalidate, pathname) {
|
|
193
|
-
if (revalidate
|
|
193
|
+
if (revalidate === null || revalidate === void 0) return 0;
|
|
194
194
|
if (typeof revalidate === "number") return revalidate;
|
|
195
195
|
for (const [pattern, ttl] of Object.entries(revalidate)) if (matchSegmentPattern(pattern, pathname)) return ttl;
|
|
196
196
|
return 0;
|
|
@@ -221,7 +221,8 @@ function serializeHeaders(response) {
|
|
|
221
221
|
function normalizePageDataForJsonCache(raw) {
|
|
222
222
|
try {
|
|
223
223
|
const parsed = JSON.parse(raw);
|
|
224
|
-
|
|
224
|
+
if (parsed === null || typeof parsed === "object" && ("deferred" in parsed && parsed.deferred !== void 0 || "deferredKeys" in parsed && parsed.deferredKeys !== void 0)) return null;
|
|
225
|
+
return raw;
|
|
225
226
|
} catch {
|
|
226
227
|
return null;
|
|
227
228
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -61,15 +61,16 @@ export declare function isrLegacyCacheVariantPrefix(projectId: string, deploymen
|
|
|
61
61
|
* original URLs or their query strings. Not cryptographic.
|
|
62
62
|
*/
|
|
63
63
|
export declare function hashOriginalUrl(originalUrl: string): string;
|
|
64
|
+
type IsrCacheKeyParts = {
|
|
65
|
+
normalizedPath: string;
|
|
66
|
+
variantToken: string | null;
|
|
67
|
+
};
|
|
64
68
|
/**
|
|
65
69
|
* Split an ISR KV key into its normalized path and its `#rw=` variant token
|
|
66
70
|
* (`null` for a direct hit). Pass the token to `isrEdgeCacheUrlForToken` to
|
|
67
71
|
* rebuild the matching edge-cache URL.
|
|
68
72
|
*/
|
|
69
|
-
export declare function splitIsrCacheKey(fullKey: string):
|
|
70
|
-
normalizedPath: string;
|
|
71
|
-
variantToken: string | null;
|
|
72
|
-
};
|
|
73
|
+
export declare function splitIsrCacheKey(fullKey: string): IsrCacheKeyParts;
|
|
73
74
|
/**
|
|
74
75
|
* Edge-cache (`caches.default`) URL for an ISR page. It carries the deployment
|
|
75
76
|
* id so a new deploy never reads older HTML, and the `json` variant keeps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/isr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Incremental revalidation and cache helpers for Void runtimes.",
|
|
5
5
|
"homepage": "https://void.cloud",
|
|
6
6
|
"bugs": {
|
|
@@ -34,16 +34,17 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@cloudflare/workers-types": "^5.
|
|
38
|
-
"@void/edge": "1.
|
|
37
|
+
"@cloudflare/workers-types": "^5.20261125.1",
|
|
38
|
+
"@void/edge": "1.12.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
+
"tsrs": "7.1.0-beta.tsrs4",
|
|
41
42
|
"typescript": "7.0.2",
|
|
42
|
-
"vite-plus": "1.
|
|
43
|
+
"vite-plus": "1.8.0"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "vp pack",
|
|
46
47
|
"dev": "vp pack --watch",
|
|
47
|
-
"typecheck": "
|
|
48
|
+
"typecheck": "tsrs --noEmit"
|
|
48
49
|
}
|
|
49
50
|
}
|