@ultimat3/render 31.47.1 → 31.49.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 +2 -2
- package/README.md +5 -2
- package/package.json +7 -7
- package/src/asset.ts +1 -1
- package/src/head.ts +2 -18
- package/src/html.ts +15 -0
- package/src/hydrate.ts +8 -1
- package/src/modes.ts +4 -2
- package/src/navigation-api.ts +10 -3
- package/src/navigation-history.ts +5 -2
- package/src/render-isr-result.ts +13 -1
- package/src/render-walk.ts +42 -2
- package/src/surfaces.ts +10 -2
package/CLAUDE.md
CHANGED
|
@@ -61,9 +61,9 @@ axiom 6). Never `cli` (upward).
|
|
|
61
61
|
| A byte count in a message | `formatBytes` from `@ultimat3/core`, never a local one. |
|
|
62
62
|
| Island bytes | **not this package's**: `@ultimat3/cli`'s `packages/cli/src/budgets.ts` measures the EMITTED document and is the gate. What stays here is the budget grammar (`parseByteBudget`) and `defaultIslandBudget`. |
|
|
63
63
|
| The hydration runtime's CSP | `HYDRATE_RUNTIME_BODIES` — every inline body `hydrateRuntime` can emit, hashed by `@ultimat3/cli`'s `script-csp.ts`; `runtimeBody` is the one string served and hashed † |
|
|
64
|
-
| Island markup | the props `<script>` is emitted INSIDE the wrapper by `render-walk.ts`; an assembler only adds `hydrateRuntime(directives)`. |
|
|
64
|
+
| Island markup | the props `<script>` is emitted INSIDE the wrapper by `render-walk.ts`; an assembler only adds `hydrateRuntime(directives)`. `boot` reads `:scope>script[data-x-props]` first — an id repeats per render (page under a modal) — and by id only a script in no island's wrapper. |
|
|
65
65
|
| Island boot | `el.__x` holds the boot PROMISE, never a boolean. |
|
|
66
|
-
| Island mount markers | `data-x-mounted=""` when `mount()` resolved, `data-x-failed="<message>"` when it rejected — set by the runtime, never by `emitIslandAttributes`. The rejection handler RETHROWS. Prelude sizes `As of 2026-
|
|
66
|
+
| Island mount markers | `data-x-mounted=""` when `mount()` resolved, `data-x-failed="<message>"` when it rejected — set by the runtime, never by `emitIslandAttributes`. The rejection handler RETHROWS. Prelude sizes `As of 2026-11-19`: `idle` 1,943, `visible` 986, `interaction` 1,828 B (what `DEFAULT_ISLAND_JS_BYTES` derives from). |
|
|
67
67
|
| A runtime that calls `boot` | TERMINATES the chain: `idle`/`visible` end in `.catch(hush)`, `interaction` passes `off` as the rejection arm. `hydrate-runtime.test.ts` reds on an unhandled rejection. |
|
|
68
68
|
| `idle` replays too | `idle` and `interaction` share ONE `catchUp(el)` in `hydrate.ts` (capture listeners for `data-x-events`, default `click`; a queue; `aim`; one flush). A caught event wakes an `idle` island early; each event replays once. `hydrate-replay.test.ts`. |
|
|
69
69
|
| Where `interaction` replays | `aim(el, ev)`, never `ev.target` (`mount` detaches the pressed node). Fallback order: `docs/history/render.md`. `hydrate-replay.test.ts`. |
|
package/README.md
CHANGED
|
@@ -236,7 +236,8 @@ From code — an island, an app script — `navigate(url, { replace? })`, `refre
|
|
|
236
236
|
`openModal(path)` and `closeModal()` go through the router when the page has one and fall back to
|
|
237
237
|
`location.assign`/`replace`/`reload` when it does not; they import the router's type only. An
|
|
238
238
|
island imports them from **`@ultimat3/render/client`**, never the barrel — see
|
|
239
|
-
[Two entry points](#two-entry-points).
|
|
239
|
+
[Two entry points](#two-entry-points). `navigate()` to a fragment of the page on screen (`#top`,
|
|
240
|
+
same path and query) is the browser's scroll, as a click on that link is: no fetch, no swap. [Navigating from code](../../wiki/Client-Navigation.md#navigating-from-code).
|
|
240
241
|
|
|
241
242
|
`refresh()` is the same page for the same visitor (`navigation-refresh.ts`): no view transition,
|
|
242
243
|
focus kept on the control the visitor was in (`markFocus`/`restoreFocus` in `navigation-dom.ts`: by
|
|
@@ -744,7 +745,9 @@ a job boundary the class is gone and the `code` is what survives — match on th
|
|
|
744
745
|
the route's `revalidate.tags` — `revalidate: { tags: [tag.post] }` answers `post e:post` — on a
|
|
745
746
|
miss, a hit and a served-stale response alike. That is what lets the same `invalidates` purge
|
|
746
747
|
the document at the CDN; before it, the edge held every ISR page for its whole `s-maxage`. A
|
|
747
|
-
|
|
748
|
+
served-stale response is never leased to a shared cache (`public, max-age=0, s-maxage=0`, no
|
|
749
|
+
`stale-while-revalidate`): nothing purges the edge again when the regeneration lands, so a lease
|
|
750
|
+
would undo the purge for the route's whole `ttl`. A TTL-only route carries neither header. A tag a CDN would split (whitespace, a comma) is refused
|
|
748
751
|
when the route registers — `X_ROUTE_MODE_INVALID`, naming the file — for file routes and
|
|
749
752
|
mounted routes both.
|
|
750
753
|
- **`stream`** flushes the shell first, then reveals holes in completion order with a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/render",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.49.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.49.0",
|
|
56
|
+
"@ultimat3/core": "31.49.0",
|
|
57
|
+
"@ultimat3/http": "31.49.0",
|
|
58
|
+
"@ultimat3/i18n": "31.49.0",
|
|
59
|
+
"@ultimat3/schema": "31.49.0",
|
|
60
|
+
"@ultimat3/seo": "31.49.0",
|
|
61
61
|
"sass": "1.107.1"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/asset.ts
CHANGED
|
@@ -100,7 +100,7 @@ export function asset(path: AssetPath): string {
|
|
|
100
100
|
if (problem !== undefined) {
|
|
101
101
|
throw new AssetMissingError(
|
|
102
102
|
`asset(${renderCauseValue(path)}): ${problem}`,
|
|
103
|
-
`asset('logo.svg') // a file under apps/web/site/${ASSET_DIR}/ with one of: ${ASSET_EXTENSIONS.join(', ')}`,
|
|
103
|
+
`asset('${ASSET_DIR}/logo.svg') // a file under apps/web/site/${ASSET_DIR}/ with one of: ${ASSET_EXTENSIONS.join(', ')}`,
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
const resolver = holder[RESOLVER_SLOT];
|
package/src/head.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { BudgetExceededError } from './errors';
|
|
|
13
13
|
// The raw-text escapers are `html.ts`'s and the text/attribute table is core's `escapeHtml` — a
|
|
14
14
|
// second one is how a character ends up missing.
|
|
15
15
|
import { headAttributes } from './head-attributes';
|
|
16
|
-
import { escapeJsonContent, escapeRawTextContent } from './html';
|
|
16
|
+
import { carriesJson, escapeJsonContent, escapeRawTextContent } from './html';
|
|
17
17
|
|
|
18
18
|
export type HeadTagKind = 'title' | 'base' | 'meta' | 'link' | 'script' | 'style';
|
|
19
19
|
|
|
@@ -132,23 +132,7 @@ function renderTag(tag: HeadTag): string {
|
|
|
132
132
|
*/
|
|
133
133
|
function contentOf(tag: HeadTag, raw: string): string {
|
|
134
134
|
if (tag.kind !== 'script' && tag.kind !== 'style') return escapeHtml(raw);
|
|
135
|
-
return carriesJson(tag) ? escapeJsonContent(raw) : escapeRawTextContent(raw);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* `application/ld+json`, `application/json`, any `…+json`: the body is data, not code.
|
|
140
|
-
*
|
|
141
|
-
* The MIME parameter is cut before the suffix test, because a real document writes
|
|
142
|
-
* `type="application/ld+json; charset=utf-8"` and that does not end in `json` — so the block built
|
|
143
|
-
* from route data, which is the path attacker text takes, silently took the raw-text escaper
|
|
144
|
-
* instead of the total one. `</` is escaped either way, so this was a weakened boundary rather than
|
|
145
|
-
* a break-out; the JSON rule is total on purpose, and a `charset` is not a reason to leave it.
|
|
146
|
-
*/
|
|
147
|
-
function carriesJson(tag: HeadTag): boolean {
|
|
148
|
-
const declared = tag.attrs?.['type'];
|
|
149
|
-
if (typeof declared !== 'string') return false;
|
|
150
|
-
const [type = ''] = declared.split(';');
|
|
151
|
-
return type.trim().toLowerCase().endsWith('json');
|
|
135
|
+
return carriesJson(tag.attrs?.['type']) ? escapeJsonContent(raw) : escapeRawTextContent(raw);
|
|
152
136
|
}
|
|
153
137
|
|
|
154
138
|
export type ThemeFallback = 'light' | 'dark' | 'system';
|
package/src/html.ts
CHANGED
|
@@ -61,6 +61,21 @@ export function escapeJsonContent(json: string): string {
|
|
|
61
61
|
.replaceAll('\u2029', '\\u2029');
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* `application/ld+json`, `application/json`, any `…+json`: the body is data, not code.
|
|
66
|
+
*
|
|
67
|
+
* The MIME parameter is cut before the suffix test, because a real document writes
|
|
68
|
+
* `type="application/ld+json; charset=utf-8"` and that does not end in `json` — so the block built
|
|
69
|
+
* from route data, which is the path attacker text takes, silently took the raw-text escaper
|
|
70
|
+
* instead of the total one. `</` is escaped either way, so this was a weakened boundary rather than
|
|
71
|
+
* a break-out; the JSON rule is total on purpose, and a `charset` is not a reason to leave it.
|
|
72
|
+
*/
|
|
73
|
+
export function carriesJson(declared: unknown): boolean {
|
|
74
|
+
if (typeof declared !== 'string') return false;
|
|
75
|
+
const [type = ''] = declared.split(';');
|
|
76
|
+
return type.trim().toLowerCase().endsWith('json');
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
/**
|
|
65
80
|
* JSX prop name → attribute name. Solid authors write the HTML spelling (`class`, `for`), but the
|
|
66
81
|
* React spellings compile too, and an author who writes one and gets no attribute has a bug with
|
package/src/hydrate.ts
CHANGED
|
@@ -126,13 +126,20 @@ export function requiredStrategies(
|
|
|
126
126
|
// runtime below would then flush its replay queue into an island that never mounted — the bug
|
|
127
127
|
// `el.__x`-as-a-promise was introduced to fix, reintroduced one layer further out.
|
|
128
128
|
//
|
|
129
|
+
// The props are the script INSIDE this wrapper (`render-walk.ts` emits it as a child), never the
|
|
130
|
+
// first one in the document carrying the id: an id is `<moduleId>-<instance>` per RENDER, so the
|
|
131
|
+
// page under a modal and the modal's document both hold `like-1`, and so does an island carried
|
|
132
|
+
// across a swap (`data-x-persist`). A script loose in the document — a hand-assembled page —
|
|
133
|
+
// is still read by id, and one that sits in another island's wrapper is that island's.
|
|
134
|
+
//
|
|
129
135
|
// `el.__x` resolves to whatever `mount()` returned. An island's `mount` may return `() => void`,
|
|
130
136
|
// its disposer (Solid's `render` answers one); the runtime keeps it there and
|
|
131
137
|
// `@ultimat3/testing`'s `mountIsland` calls it on dispose. Nothing here ever calls it.
|
|
132
138
|
const RUNTIME_PRELUDE = `
|
|
133
139
|
function boot(el){var e=el.getAttribute('data-x-entry');
|
|
134
140
|
if(!e)return Promise.resolve();if(el.__x)return el.__x;
|
|
135
|
-
var p=
|
|
141
|
+
var p=el.querySelector(':scope>script[data-x-props]');
|
|
142
|
+
if(!p){p=document.querySelector('script[data-x-props="'+el.getAttribute('data-x-island')+'"]');if(p&&p.closest('[data-x-island]'))p=null}
|
|
136
143
|
var props=p?JSON.parse(p.textContent||'{}'):{};
|
|
137
144
|
return el.__x=import(e).then(function(m){return m.mount(el,props)}).then(
|
|
138
145
|
function(r){el.setAttribute('${ISLAND_MOUNTED_ATTRIBUTE}','');return r},
|
package/src/modes.ts
CHANGED
|
@@ -244,7 +244,7 @@ export function defaultHydrate(surface: Surface): HydrateStrategy {
|
|
|
244
244
|
* runtimes an island gets unasked; `DEFAULT_ISLAND_HYDRATE`'s `'interaction'` is 1,669) =
|
|
245
245
|
* **19,581**. That is the worst case an app reaches without writing a number down. 20,480 is the
|
|
246
246
|
* next whole kilobyte above it, leaving 899 B of headroom and still under 2x 19,581, so a route
|
|
247
|
-
* bundling the same island twice is refused. `island-budget.test.ts` asserts all three. `visible` costs
|
|
247
|
+
* bundling the same island twice is refused. `island-budget.test.ts` asserts all three. `visible` costs 986, so an island route
|
|
248
248
|
* that declares it pays less; the default is what the budget has to clear.
|
|
249
249
|
*
|
|
250
250
|
* All three grew by 129 B on 2026-08-21 (from 881 / 615 / 687), when the prelude learned to mark a
|
|
@@ -257,7 +257,9 @@ export function defaultHydrate(surface: Surface): HydrateStrategy {
|
|
|
257
257
|
* shared `catchUp`, and both learned to aim a keyboard press by the pressed node's path (774 -> 1,744;
|
|
258
258
|
* `interaction` 1,251 -> 1,629), and `idle` became the worst case. The
|
|
259
259
|
* headroom absorbed all four and the conclusion is unchanged, which is the point of stating the
|
|
260
|
-
* arithmetic here rather than the answer alone.
|
|
260
|
+
* arithmetic here rather than the answer alone. As of 2026-11-19 `idle` is 1,943 (+59 B on
|
|
261
|
+
* 2026-10-05, a held island's listeners; +100 B in the shared prelude, `boot` reading the props
|
|
262
|
+
* script inside its own wrapper): 17,797 + 1,943 = 19,740, 740 B under the default. It is not
|
|
261
263
|
* derived from Solid's own size on purpose — this package may not import or name `solid-js`
|
|
262
264
|
* (`CLAUDE.md`), so a constant tracking the runtime's version would be a dependency in a comment.
|
|
263
265
|
*
|
package/src/navigation-api.ts
CHANGED
|
@@ -29,14 +29,21 @@ const page = (): NavigationWindow | undefined =>
|
|
|
29
29
|
/**
|
|
30
30
|
* Go to `url` (resolved against the page) as a click on a link to it would: through the router on
|
|
31
31
|
* this origin — its own rules and the server's gate decide swap, modal or full load — and as a
|
|
32
|
-
* document load anywhere else, or when the page has no router.
|
|
32
|
+
* document load anywhere else, or when the page has no router. A fragment of the page on screen
|
|
33
|
+
* (`#top`, same path and query) is the browser's: it scrolls, nothing is fetched or swapped.
|
|
33
34
|
*/
|
|
34
35
|
export function navigate(url: string, options: NavigateToOptions = {}): Promise<void> {
|
|
35
36
|
const win = page();
|
|
36
37
|
if (win === undefined) return Promise.resolve();
|
|
37
|
-
const
|
|
38
|
+
const from = new URL(win.location.href);
|
|
39
|
+
const to = new URL(url, from);
|
|
38
40
|
const router = win.__xNavigation;
|
|
39
|
-
|
|
41
|
+
// The link rule (`linkVerdict`'s `hashOnly`), asked here because the router's `navigate` is
|
|
42
|
+
// reached past it: a fragment of the page on screen is the browser's scroll, and a fetch plus a
|
|
43
|
+
// swap for it disposes every island on the page.
|
|
44
|
+
const fragmentOnly =
|
|
45
|
+
to.href.includes('#') && to.pathname === from.pathname && to.search === from.search;
|
|
46
|
+
if (router === undefined || to.origin !== from.origin || fragmentOnly) {
|
|
40
47
|
if (options.replace === true) win.location.replace(to.href);
|
|
41
48
|
else win.location.assign(to.href);
|
|
42
49
|
return Promise.resolve();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { isJsonObject } from '@ultimat3/core/page';
|
|
9
|
+
import { decodeSegment } from './decode-segment';
|
|
9
10
|
|
|
10
11
|
/** The router's own slot in `history.state`, beside whatever an app keeps there. */
|
|
11
12
|
export const STATE_KEY = '__x';
|
|
@@ -66,8 +67,10 @@ export function recordEntry(win: Window, landed: string, doc: string, mode: Hist
|
|
|
66
67
|
* `smooth`, and a new page is a new place, which a full load jumps to rather than glides to.
|
|
67
68
|
*/
|
|
68
69
|
export function scrollAfter(win: Window, doc: Document, url: string, mode: HistoryMode): void {
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
const raw = new URL(url).hash.slice(1);
|
|
71
|
+
// A malformed escape (`#50%`) is the raw id, as the browser's own fragment lookup reads it: a
|
|
72
|
+
// throw here is inside the swap, after the body was replaced and before any script ran.
|
|
73
|
+
const target = raw === '' ? null : doc.getElementById(decodeSegment(raw) ?? raw);
|
|
71
74
|
const saved = entryOf(win.history.state);
|
|
72
75
|
const to = (left: number, top: number): void =>
|
|
73
76
|
win.scrollTo({ left, top, behavior: 'instant' as ScrollBehavior });
|
package/src/render-isr-result.ts
CHANGED
|
@@ -62,6 +62,15 @@ function cacheControl(ttlMs: number | null, policy: IsrPolicy, ageMs: number): s
|
|
|
62
62
|
return stale === 0 ? base : `${base}, stale-while-revalidate=${stale}`;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* A served-stale answer is the copy the bust just withdrew. The edge was purged by surrogate key
|
|
67
|
+
* when the tag was busted and nothing purges it again when the regeneration lands, so a lease on
|
|
68
|
+
* this answer is the pre-write page for the route's whole ttl, then again under
|
|
69
|
+
* `stale-while-revalidate`. Storable (it keeps its validator and its purge keys) but never fresh
|
|
70
|
+
* in a shared cache: the edge asks again, and the next answer is the regenerated one.
|
|
71
|
+
*/
|
|
72
|
+
const SERVED_STALE_CACHE_CONTROL = 'public, max-age=0, s-maxage=0';
|
|
73
|
+
|
|
65
74
|
/**
|
|
66
75
|
* `entryTtlMs`'s reason, one field over: a store may hand back an entry with no `status`, or one
|
|
67
76
|
* that JSON turned into something else, on the request path. Absent is 200 — the only value any
|
|
@@ -108,7 +117,10 @@ export function isrResult(entry: IsrEntry, options: IsrResultOptions): RenderRes
|
|
|
108
117
|
}
|
|
109
118
|
const headers: Record<string, string> = {
|
|
110
119
|
...staticHeaders(entry.hash, buildId),
|
|
111
|
-
'cache-control':
|
|
120
|
+
'cache-control':
|
|
121
|
+
options.servedStale === true
|
|
122
|
+
? SERVED_STALE_CACHE_CONTROL
|
|
123
|
+
: cacheControl(entryTtlMs(entry), policy, options.ageMs),
|
|
112
124
|
vary,
|
|
113
125
|
};
|
|
114
126
|
// The keys an edge purges this document by — `@ultimat3/cache`'s list, never a second one, so
|
package/src/render-walk.ts
CHANGED
|
@@ -9,7 +9,13 @@ import { JSX_NODE } from '@ultimat3/core/render-node';
|
|
|
9
9
|
import { PrerenderFailedError } from './errors';
|
|
10
10
|
import type { HoleNode } from './hole';
|
|
11
11
|
import { isHoleNode } from './hole';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
carriesJson,
|
|
14
|
+
escapeJsonContent,
|
|
15
|
+
escapeRawTextContent,
|
|
16
|
+
renderAttributes,
|
|
17
|
+
VOID_ELEMENTS,
|
|
18
|
+
} from './html';
|
|
13
19
|
import { emitIslandAttributes, emitIslandProps } from './hydrate';
|
|
14
20
|
import type { IslandNode } from './island';
|
|
15
21
|
import { isIslandNode } from './island';
|
|
@@ -183,11 +189,45 @@ function emitNode(node: JsxNode, depth: number, walk: RenderHtmlOptions, out: Bu
|
|
|
183
189
|
if (VOID_ELEMENTS.has(type)) return;
|
|
184
190
|
const raw = (props as { innerHTML?: unknown }).innerHTML;
|
|
185
191
|
if (raw === undefined || raw === null) {
|
|
186
|
-
|
|
192
|
+
const children = (props as { children?: unknown }).children;
|
|
193
|
+
const text = type === 'script' || type === 'style' ? rawText(children, depth + 1) : undefined;
|
|
194
|
+
if (text === undefined) emit(children, depth + 1, walk, out);
|
|
195
|
+
else if (typeof text !== 'string') emit(text.resolved, depth + 1, walk, out);
|
|
196
|
+
else {
|
|
197
|
+
const json = type === 'script' && carriesJson((props as { type?: unknown }).type);
|
|
198
|
+
write(out, json ? escapeJsonContent(text) : escapeRawTextContent(text));
|
|
199
|
+
}
|
|
187
200
|
} else write(out, String(raw));
|
|
188
201
|
write(out, `</${type}>`);
|
|
189
202
|
}
|
|
190
203
|
|
|
204
|
+
/**
|
|
205
|
+
* The text a `<script>` or `<style>` holds, unescaped — the two raw text elements, where a
|
|
206
|
+
* character reference is never decoded, so `>` in a selector or `&&` in a condition
|
|
207
|
+
* reaches the parser as written and breaks it. When a child is anything but text (an element, a
|
|
208
|
+
* promise) the caller walks the children as any other, escaped — as `resolved`, the children with
|
|
209
|
+
* every thunk this read already called swapped for its value: a thunk runs once, never twice.
|
|
210
|
+
*/
|
|
211
|
+
function rawText(value: unknown, depth: number): string | { readonly resolved: unknown } {
|
|
212
|
+
assertDepth(depth);
|
|
213
|
+
if (value === null || value === undefined || value === false || value === true) return '';
|
|
214
|
+
if (typeof value === 'string') return value;
|
|
215
|
+
if (typeof value === 'number' || typeof value === 'bigint') return String(value);
|
|
216
|
+
if (typeof value === 'function') return rawText((value as () => unknown)(), depth + 1);
|
|
217
|
+
if (!Array.isArray(value) || isIslandNode(value) || isHoleNode(value)) return { resolved: value };
|
|
218
|
+
let text = '';
|
|
219
|
+
const resolved: unknown[] = [];
|
|
220
|
+
let markup = false;
|
|
221
|
+
for (const item of value) {
|
|
222
|
+
// Past the first non-text child no thunk is called here: the walk calls each, once.
|
|
223
|
+
const piece = markup ? { resolved: item } : rawText(item, depth + 1);
|
|
224
|
+
if (typeof piece === 'string') text += piece;
|
|
225
|
+
else markup = true;
|
|
226
|
+
resolved.push(typeof piece === 'string' ? piece : piece.resolved);
|
|
227
|
+
}
|
|
228
|
+
return markup ? { resolved } : text;
|
|
229
|
+
}
|
|
230
|
+
|
|
191
231
|
/**
|
|
192
232
|
* An island renders its SHELL on the server — the children the page wrote — and nothing of the
|
|
193
233
|
* client module: the specifier is data, so there is no import to follow and the static page's
|
package/src/surfaces.ts
CHANGED
|
@@ -275,8 +275,16 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
|
|
|
275
275
|
const chainText = i.chain.join(' → ');
|
|
276
276
|
const base = { entry: i.entry, importer: i.importer, imported: i.imported, chain: i.chain };
|
|
277
277
|
|
|
278
|
-
// Transitive, from the ENTRY: a site page reaching app/ through any number of hops.
|
|
279
|
-
|
|
278
|
+
// Transitive, from the ENTRY: a site page reaching app/ through any number of hops. The finding
|
|
279
|
+
// is the edge that CROSSES — the first one in the chain to land on app/. Every edge below it is
|
|
280
|
+
// app/ importing app/, which is legal, and reporting those told the author to delete a query's
|
|
281
|
+
// own policy and repo imports ahead of the one import that was wrong.
|
|
282
|
+
if (
|
|
283
|
+
i.entrySurface === 'site' &&
|
|
284
|
+
i.importedSurface === 'app' &&
|
|
285
|
+
!i.typeOnly &&
|
|
286
|
+
!i.chain.slice(0, -1).some((file) => surfaceOf(file) === 'app')
|
|
287
|
+
) {
|
|
280
288
|
return {
|
|
281
289
|
...base,
|
|
282
290
|
rule: 'site-imports-app',
|