@ultimat3/render 31.38.1 → 31.40.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/CLAUDE.md +1 -1
- package/package.json +7 -7
- package/src/route-pattern.ts +2 -25
package/CLAUDE.md
CHANGED
|
@@ -87,7 +87,7 @@ axiom 6). Never `cli` (upward).
|
|
|
87
87
|
| ISR regeneration | `@ultimat3/core`'s `singleFlight`, `deadlineMs` = `regenerateDeadlineMs` (`DEFAULT_ISR_REGENERATE_DEADLINE_MS`, 30 s; `finiteCount` ≥ 1, no opt-out), `schedule` injectable. Past it the PATH is free; the hung render runs on, and `latest` (by identity) drops its result once a newer run started. `render-isr-flight.test.ts`, on a hand-fired scheduler. |
|
|
88
88
|
| Which route a stored ISR path is | exact path first, else the MOST SPECIFIC pattern: `route-pattern.ts`'s `compilePattern` (never a second compiler), sorted on `CompiledPattern.specificity`. Never table order: `describePages()` sorts `*` before `:`. |
|
|
89
89
|
| `CompiledPattern.specificity` | the ONE ordering rule, read by ISR, `@ultimat3/cli`'s sitemap extras and `@ultimat3/admin`'s `adminRouteMatch`: `@ultimat3/core`'s `routeRank(path)` — the request trie's order as one integer, shared with `@ultimat3/pwa`'s worker rule order. Never a local rank. |
|
|
90
|
-
| `compilePattern`'s regex | a `*catch-all` owns its separator, `(?:/(.*))?`, so the bare prefix `static-path.ts` writes for an empty rest (`/docs`) matches; a literal
|
|
90
|
+
| `compilePattern`'s regex | a `*catch-all` owns its separator, `(?:/(.*))?`, so the bare prefix `static-path.ts` writes for an empty rest (`/docs`) matches; a literal segment is `@ultimat3/core`'s `literalSegmentPattern` (pwa's worker rules too): raw, or each character `encodeURIComponent` escapes as its escape, either hex case — a store key is `canonicalPath`'s, and `precios-españa` arrives as `precios-espa%C3%B1a`. A gratuitous escape (`%70osts`) is not owned since 31.40; no store key carries one. `route-pattern.test.ts`. |
|
|
91
91
|
| Marking a page stale | `IsrStore.markStale(path)` in place, never `set({ ...entry, stale: true })`. |
|
|
92
92
|
| ISR store bound | `memoryIsrStore()`: entries + bytes, LRU (`markStale` keeps place). Shared: `storageIsrStore`, write-then-verify fence, oldest write first. Every call awaited. |
|
|
93
93
|
| A `RenderResult.status` | `finiteStatus(subject, status)` (`finite-status.ts`), 200–599 whole, at every site that takes one from a caller; `isRenderStatus` is the TOTAL read of a stored `IsrEntry.status`. The name carries `finite` so `bun run finite-bounds` recognises it. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/render",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.40.0",
|
|
4
4
|
"description": "The route primitive and the five render modes: static, isr, ssr, stream, spa.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"test": "bun test"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@ultimat3/cache": "31.
|
|
56
|
-
"@ultimat3/core": "31.
|
|
57
|
-
"@ultimat3/http": "31.
|
|
58
|
-
"@ultimat3/i18n": "31.
|
|
59
|
-
"@ultimat3/schema": "31.
|
|
60
|
-
"@ultimat3/seo": "31.
|
|
55
|
+
"@ultimat3/cache": "31.40.0",
|
|
56
|
+
"@ultimat3/core": "31.40.0",
|
|
57
|
+
"@ultimat3/http": "31.40.0",
|
|
58
|
+
"@ultimat3/i18n": "31.40.0",
|
|
59
|
+
"@ultimat3/schema": "31.40.0",
|
|
60
|
+
"@ultimat3/seo": "31.40.0",
|
|
61
61
|
"sass": "1.107.1"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/route-pattern.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* file only reads a pattern string.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { routeRank } from '@ultimat3/core';
|
|
7
|
+
import { literalSegmentPattern, routeRank } from '@ultimat3/core';
|
|
8
8
|
|
|
9
9
|
export interface CompiledPattern {
|
|
10
10
|
readonly source: string;
|
|
@@ -17,29 +17,6 @@ export interface CompiledPattern {
|
|
|
17
17
|
readonly specificity: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/** A regex metacharacter, matched as itself. */
|
|
21
|
-
const escapeRegex = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* A literal segment as a pathname may spell it: each character raw OR percent-encoded, either hex
|
|
25
|
-
* case. A route file is named in Unicode (`precios-españa`) and `URL.pathname` encodes it
|
|
26
|
-
* (`precios-espa%C3%B1a`), so a literal-only pattern never matched the key it was asked about.
|
|
27
|
-
*/
|
|
28
|
-
function literalPattern(segment: string): string {
|
|
29
|
-
let out = '';
|
|
30
|
-
for (const char of segment) {
|
|
31
|
-
const encoded = [...new TextEncoder().encode(char)]
|
|
32
|
-
.map((byte) => {
|
|
33
|
-
const hex = byte.toString(16).toUpperCase().padStart(2, '0');
|
|
34
|
-
const digit = (d: string): string => (/[A-F]/.test(d) ? `[${d}${d.toLowerCase()}]` : d);
|
|
35
|
-
return `%${digit(hex[0] ?? '0')}${digit(hex[1] ?? '0')}`;
|
|
36
|
-
})
|
|
37
|
-
.join('');
|
|
38
|
-
out += `(?:${escapeRegex(char)}|${encoded})`;
|
|
39
|
-
}
|
|
40
|
-
return out;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
20
|
export function compilePattern(path: string): CompiledPattern {
|
|
44
21
|
const keys: string[] = [];
|
|
45
22
|
const segments = path.split('/').filter((s) => s.length > 0);
|
|
@@ -55,7 +32,7 @@ export function compilePattern(path: string): CompiledPattern {
|
|
|
55
32
|
keys.push(segment.slice(1));
|
|
56
33
|
return '/([^/]+)';
|
|
57
34
|
}
|
|
58
|
-
return `/${
|
|
35
|
+
return `/${literalSegmentPattern(segment)}`;
|
|
59
36
|
});
|
|
60
37
|
|
|
61
38
|
return {
|