@ultimat3/render 31.30.0 → 31.32.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/package.json +8 -8
- package/src/head-seo.ts +9 -6
- package/src/hydrate.ts +8 -5
- package/src/islands.ts +5 -1
- package/src/modes.ts +3 -1
- package/src/route-path.ts +4 -1
- package/src/surfaces.ts +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/render",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.32.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.
|
|
61
|
-
"sass": "1.
|
|
55
|
+
"@ultimat3/cache": "31.32.0",
|
|
56
|
+
"@ultimat3/core": "31.32.0",
|
|
57
|
+
"@ultimat3/http": "31.32.0",
|
|
58
|
+
"@ultimat3/i18n": "31.32.0",
|
|
59
|
+
"@ultimat3/schema": "31.32.0",
|
|
60
|
+
"@ultimat3/seo": "31.32.0",
|
|
61
|
+
"sass": "1.107.1"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/head-seo.ts
CHANGED
|
@@ -8,12 +8,15 @@ import { renderMeta } from '@ultimat3/seo';
|
|
|
8
8
|
import type { HeadRenderers, HeadTag } from './head';
|
|
9
9
|
|
|
10
10
|
/** Attributes that identify a tag for dedupe, read in this order. */
|
|
11
|
-
const IDENTITY: Readonly<Record<SeoHeadTag['tag'], readonly string[]>> =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const IDENTITY: Readonly<Record<SeoHeadTag['tag'], readonly string[]>> = Object.assign(
|
|
12
|
+
Object.create(null),
|
|
13
|
+
{
|
|
14
|
+
title: [],
|
|
15
|
+
meta: ['name', 'property', 'http-equiv', 'charset', 'media'],
|
|
16
|
+
link: ['rel', 'hreflang', 'sizes'],
|
|
17
|
+
script: ['type'],
|
|
18
|
+
} satisfies Readonly<Record<SeoHeadTag['tag'], readonly string[]>>,
|
|
19
|
+
);
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Open Graph properties a document carries once PER VALUE. Keyed by property alone, the dedupe
|
package/src/hydrate.ts
CHANGED
|
@@ -239,11 +239,14 @@ const RUNTIME_INTERACTION = `
|
|
|
239
239
|
each('[data-x-hydrate="interaction"]',catchUp)
|
|
240
240
|
`.trim();
|
|
241
241
|
|
|
242
|
-
const RUNTIME_PARTS: Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>> =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
const RUNTIME_PARTS: Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>> = Object.assign(
|
|
243
|
+
Object.create(null),
|
|
244
|
+
{
|
|
245
|
+
idle: RUNTIME_IDLE,
|
|
246
|
+
visible: RUNTIME_VISIBLE,
|
|
247
|
+
interaction: RUNTIME_INTERACTION,
|
|
248
|
+
} satisfies Readonly<Record<Exclude<HydrateStrategy, 'never'>, string>>,
|
|
249
|
+
);
|
|
247
250
|
|
|
248
251
|
/**
|
|
249
252
|
* Emission order, and the order the subsets below are enumerated in. Derived from core's one
|
package/src/islands.ts
CHANGED
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
* reached, through `registerRoute`, and it is what puts a number on a route that declares none.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const UNITS: Readonly<Record<string, number>> =
|
|
17
|
+
const UNITS: Readonly<Record<string, number>> = Object.assign(Object.create(null), {
|
|
18
|
+
b: 1,
|
|
19
|
+
kb: 1024,
|
|
20
|
+
mb: 1024 * 1024,
|
|
21
|
+
} satisfies Readonly<Record<string, number>>);
|
|
18
22
|
|
|
19
23
|
/** `'40kb'` → 40960. Throws nothing: an unparseable budget is `null` and skipped. */
|
|
20
24
|
export function parseByteBudget(budget: string | undefined): number | null {
|
package/src/modes.ts
CHANGED
|
@@ -210,7 +210,9 @@ export function assertModeInvariants(config: RouteShape, ctx: ModeCheckContext):
|
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
const prerenderable =
|
|
214
|
+
Object.hasOwn(MODE_SPECS, config.render) && MODE_SPECS[config.render].prerenderable;
|
|
215
|
+
if (config.prerender !== undefined && !prerenderable) {
|
|
214
216
|
throw new RouteModeInvalidError(
|
|
215
217
|
`${ctx.file} declares prerender with render: '${config.render}', which is not prerenderable`,
|
|
216
218
|
`remove prerender from ${ctx.file} or change render to 'static' | 'isr'`,
|
package/src/route-path.ts
CHANGED
|
@@ -99,7 +99,10 @@ function assertRouteFilename(
|
|
|
99
99
|
surface: RouteSurface,
|
|
100
100
|
basename: string | undefined,
|
|
101
101
|
): void {
|
|
102
|
-
|
|
102
|
+
// Own keys only: an `Object.prototype` member is never the filename a surface accepts.
|
|
103
|
+
const expected = Object.hasOwn(ROUTE_FILENAME, surface)
|
|
104
|
+
? ROUTE_FILENAME[surface]
|
|
105
|
+
: ROUTE_FILENAME.site;
|
|
103
106
|
if (basename === expected) return;
|
|
104
107
|
|
|
105
108
|
// The directory the author meant is the file's own path minus its extension: `site/pricing.tsx`
|
package/src/surfaces.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* aspirational. Violations are build errors, resolved through the whole chain.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type
|
|
8
|
+
import { type RenderMode, renderFixShellArg, type Surface } from '@ultimat3/core';
|
|
9
9
|
import { byCodeUnit } from './code-unit-order';
|
|
10
10
|
import { SurfaceBoundaryError } from './errors';
|
|
11
11
|
|
|
@@ -276,13 +276,15 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
|
|
|
276
276
|
...base,
|
|
277
277
|
rule: 'site-imports-app',
|
|
278
278
|
cause: chainText,
|
|
279
|
-
fix: `x fix boundary ${i.entry} (or move ${i.imported} out of the shared graph)`,
|
|
279
|
+
fix: `x fix boundary ${renderFixShellArg(i.entry, '<entry file>')} (or move ${i.imported} out of the shared graph)`,
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
const from = i.importerSurface;
|
|
283
283
|
const to = i.importedSurface;
|
|
284
284
|
if (from === null || to === null || from === to) return null;
|
|
285
|
-
|
|
285
|
+
// Own keys only: a surface that is not one has no rule, and a prototype member is not a rule.
|
|
286
|
+
const spec = Object.hasOwn(SURFACE_SPECS, from) ? SURFACE_SPECS[from] : undefined;
|
|
287
|
+
if (spec === undefined) return null;
|
|
286
288
|
if (spec.mayImport.includes(to)) return null;
|
|
287
289
|
if (i.typeOnly && spec.mayImportTypes.includes(to)) return null;
|
|
288
290
|
// Reported above, from the site entry that reaches it — one crossing, one finding.
|
|
@@ -324,5 +326,7 @@ export function assertSurfaceBoundary(graph: ImportGraph): void {
|
|
|
324
326
|
}
|
|
325
327
|
|
|
326
328
|
export function surfaceAllows(surface: Surface, mode: RenderMode): boolean {
|
|
327
|
-
return
|
|
329
|
+
return (
|
|
330
|
+
Object.hasOwn(SURFACE_SPECS, surface) && SURFACE_SPECS[surface].allowedModes.includes(mode)
|
|
331
|
+
);
|
|
328
332
|
}
|