@vesk/runtime 0.2.50-canary.3 → 0.2.50-canary.5
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/index-client.d.ts +2 -0
- package/dist/index-client.d.ts.map +1 -1
- package/dist/index-client.js +1 -0
- package/dist/index-server.d.ts +2 -0
- package/dist/index-server.d.ts.map +1 -1
- package/dist/index-server.js +1 -0
- package/dist/metadata.d.ts +83 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +224 -0
- package/dist/resource.d.ts +14 -0
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +16 -2
- package/package.json +2 -2
package/dist/index-client.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ export type { VeskLeafComponent, VeskPrimitiveComponent, VeskTaggedLeafComponent
|
|
|
25
25
|
export { LoadingIndicator, useLoadingIndicator, configureLoadingIndicator, getLoadingProgress, isLoadingActive, getLoadingError, LOADING_INDICATOR_DEFAULT_COLOR, LOADING_INDICATOR_DEFAULT_ERROR_COLOR } from '@vesk/runtime/src/loading-indicator';
|
|
26
26
|
export type { LoadingIndicatorHandle, LoadingIndicatorOptions, LoadingIndicatorProps } from '@vesk/runtime/src/loading-indicator';
|
|
27
27
|
export { defineAction, getAction, clearActions, validateActionInput, issuesToFieldMap, isFormAction } from '@vesk/runtime/src/action';
|
|
28
|
+
export { defineMetadata, mergeMetadata, resolveTitle, metadataToHtml } from '@vesk/runtime/src/metadata';
|
|
29
|
+
export type { VeskMetadata, MetadataTitle, OpenGraphMetadata } from '@vesk/runtime/src/metadata';
|
|
28
30
|
//# sourceMappingURL=index-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-client.d.ts","sourceRoot":"","sources":["../src/index-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,IAAI,IAAI,EAAE,OAAO,EAAE,UAA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,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC7H,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxI,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,+BAA+B,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAC;AACrP,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAClI,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtI,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACzG,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index-client.js
CHANGED
|
@@ -19,3 +19,4 @@ export { Show, For, Switch, Match } from '@vesk/runtime/src/headless';
|
|
|
19
19
|
export { primitive, leaf, isPrimitive, isLeaf, isVeskComponent, toDomNode, rerenderNode } from '@vesk/runtime/src/primitive';
|
|
20
20
|
export { LoadingIndicator, useLoadingIndicator, configureLoadingIndicator, getLoadingProgress, isLoadingActive, getLoadingError, LOADING_INDICATOR_DEFAULT_COLOR, LOADING_INDICATOR_DEFAULT_ERROR_COLOR } from '@vesk/runtime/src/loading-indicator';
|
|
21
21
|
export { defineAction, getAction, clearActions, validateActionInput, issuesToFieldMap, isFormAction } from '@vesk/runtime/src/action';
|
|
22
|
+
export { defineMetadata, mergeMetadata, resolveTitle, metadataToHtml } from '@vesk/runtime/src/metadata';
|
package/dist/index-server.d.ts
CHANGED
|
@@ -18,4 +18,6 @@ export type { VeskLeafComponent, VeskPrimitiveComponent, VeskTaggedLeafComponent
|
|
|
18
18
|
export { LoadingIndicator, useLoadingIndicator, configureLoadingIndicator, getLoadingProgress, isLoadingActive, getLoadingError } from '@vesk/runtime/src/loading-indicator';
|
|
19
19
|
export type { LoadingIndicatorHandle, LoadingIndicatorOptions, LoadingIndicatorProps } from '@vesk/runtime/src/loading-indicator';
|
|
20
20
|
export { defineAction, getAction, clearActions, validateActionInput, issuesToFieldMap, isFormAction } from '@vesk/runtime/src/action';
|
|
21
|
+
export { defineMetadata, mergeMetadata, resolveTitle, metadataToHtml } from '@vesk/runtime/src/metadata';
|
|
22
|
+
export type { VeskMetadata, MetadataTitle, OpenGraphMetadata } from '@vesk/runtime/src/metadata';
|
|
21
23
|
//# sourceMappingURL=index-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-server.d.ts","sourceRoot":"","sources":["../src/index-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,IAAI,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC5S,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,sBAAsB,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC1P,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACtI,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M,qCAAqC,CAAC;AAClI,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtI,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACzG,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index-server.js
CHANGED
|
@@ -16,3 +16,4 @@ export { Show, For, Switch, Match } from '@vesk/runtime/src/headless';
|
|
|
16
16
|
export { primitive, leaf, isPrimitive, isLeaf, isVeskComponent, toDomNode, rerenderNode } from '@vesk/runtime/src/primitive';
|
|
17
17
|
export { LoadingIndicator, useLoadingIndicator, configureLoadingIndicator, getLoadingProgress, isLoadingActive, getLoadingError } from '@vesk/runtime/src/loading-indicator';
|
|
18
18
|
export { defineAction, getAction, clearActions, validateActionInput, issuesToFieldMap, isFormAction } from '@vesk/runtime/src/action';
|
|
19
|
+
export { defineMetadata, mergeMetadata, resolveTitle, metadataToHtml } from '@vesk/runtime/src/metadata';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A typed metadata API, for the same reason `<Head>` interpolation is a trap.
|
|
3
|
+
*
|
|
4
|
+
* Both bugs I hit writing the head pass were "silent and wrong": an expression
|
|
5
|
+
* the build-time evaluator could not resolve became an empty string, and an
|
|
6
|
+
* already-escaped string became double-escaped in the tab. Metadata goes
|
|
7
|
+
* through a *shape* instead — one place that knows what a title, a description
|
|
8
|
+
* and an OG tag look like, what is required, and how a layout's metadata
|
|
9
|
+
* merges with a page's.
|
|
10
|
+
*
|
|
11
|
+
* The static form is the interesting one:
|
|
12
|
+
*
|
|
13
|
+
* export const metadata = defineMetadata({ title: 'Pricing', description: '…' })
|
|
14
|
+
*
|
|
15
|
+
* which the compiler extracts at BUILD time, so the head never depends on the
|
|
16
|
+
* component's frame evaluating correctly. `metadataToHtml` is the single
|
|
17
|
+
* serializer both the build and the runtime use, so a title cannot be escaped
|
|
18
|
+
* twice or not at all.
|
|
19
|
+
*/
|
|
20
|
+
/** `title` is either a literal, or a default plus a template for children. */
|
|
21
|
+
export type MetadataTitle = string | {
|
|
22
|
+
default?: string;
|
|
23
|
+
template?: string;
|
|
24
|
+
absolute?: string;
|
|
25
|
+
};
|
|
26
|
+
export interface OpenGraphMetadata {
|
|
27
|
+
title?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
siteName?: string;
|
|
31
|
+
image?: string;
|
|
32
|
+
type?: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export interface VeskMetadata {
|
|
36
|
+
title?: MetadataTitle;
|
|
37
|
+
description?: string;
|
|
38
|
+
/** `noindex`/`nofollow` etc. */
|
|
39
|
+
robots?: string | Record<string, boolean>;
|
|
40
|
+
openGraph?: OpenGraphMetadata;
|
|
41
|
+
twitter?: OpenGraphMetadata & {
|
|
42
|
+
card?: string;
|
|
43
|
+
site?: string;
|
|
44
|
+
};
|
|
45
|
+
/** `hreflang` alternates: `{ 'en': '/en/pricing', 'de': '/de/pricing' }`. */
|
|
46
|
+
alternates?: Record<string, string> | {
|
|
47
|
+
canonical?: string;
|
|
48
|
+
languages?: Record<string, string>;
|
|
49
|
+
};
|
|
50
|
+
themeColor?: string;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Declare a route's metadata.
|
|
55
|
+
*
|
|
56
|
+
* Identity at runtime (so it costs nothing), validated at module load. The
|
|
57
|
+
* validation is deliberately loud and early: metadata is the part of a page
|
|
58
|
+
* nobody looks at until it is wrong in a search result, and a typo in a
|
|
59
|
+
* required field should fail the build, not the crawler.
|
|
60
|
+
*/
|
|
61
|
+
export declare function defineMetadata(input: VeskMetadata): VeskMetadata;
|
|
62
|
+
/** The document title a metadata object asks for, with template resolution. */
|
|
63
|
+
export declare function resolveTitle(meta: VeskMetadata | null | undefined, child?: VeskMetadata | null): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Merge metadata from the outside in: a layout, then a page, then a nested
|
|
66
|
+
* route. Later sources win per field, and the two nested groups (`openGraph`,
|
|
67
|
+
* `twitter`) merge field-wise so a page can set one OG key without restating
|
|
68
|
+
* the rest. Title template resolution happens on the way out.
|
|
69
|
+
*/
|
|
70
|
+
export declare function mergeMetadata(...sources: Array<VeskMetadata | null | undefined>): VeskMetadata;
|
|
71
|
+
/**
|
|
72
|
+
* Serialize metadata to head tags.
|
|
73
|
+
*
|
|
74
|
+
* The ONE serializer, used by the build-time path and the runtime path, so a
|
|
75
|
+
* title cannot be escaped twice (the bug where `&` reached the tab) or not
|
|
76
|
+
* at all. Text and attributes are escaped separately because they have
|
|
77
|
+
* different rules — escaping a `content` attribute as text is how you get
|
|
78
|
+
* `&amp;` in a meta description.
|
|
79
|
+
*/
|
|
80
|
+
export declare function metadataToHtml(meta: VeskMetadata | null | undefined, opts?: {
|
|
81
|
+
child?: VeskMetadata | null;
|
|
82
|
+
}): string;
|
|
83
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GACrB,MAAM,GACN;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB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AAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;CAAO,GAAG,MAAM,CA4DxH"}
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A typed metadata API, for the same reason `<Head>` interpolation is a trap.
|
|
3
|
+
*
|
|
4
|
+
* Both bugs I hit writing the head pass were "silent and wrong": an expression
|
|
5
|
+
* the build-time evaluator could not resolve became an empty string, and an
|
|
6
|
+
* already-escaped string became double-escaped in the tab. Metadata goes
|
|
7
|
+
* through a *shape* instead — one place that knows what a title, a description
|
|
8
|
+
* and an OG tag look like, what is required, and how a layout's metadata
|
|
9
|
+
* merges with a page's.
|
|
10
|
+
*
|
|
11
|
+
* The static form is the interesting one:
|
|
12
|
+
*
|
|
13
|
+
* export const metadata = defineMetadata({ title: 'Pricing', description: '…' })
|
|
14
|
+
*
|
|
15
|
+
* which the compiler extracts at BUILD time, so the head never depends on the
|
|
16
|
+
* component's frame evaluating correctly. `metadataToHtml` is the single
|
|
17
|
+
* serializer both the build and the runtime use, so a title cannot be escaped
|
|
18
|
+
* twice or not at all.
|
|
19
|
+
*/
|
|
20
|
+
const KNOWN_KEYS = new Set([
|
|
21
|
+
'title', 'description', 'robots', 'openGraph', 'twitter', 'alternates', 'themeColor',
|
|
22
|
+
]);
|
|
23
|
+
function assertPlainObject(value, where) {
|
|
24
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
25
|
+
throw new Error(`defineMetadata: ${where} must be a plain object, got ${Array.isArray(value) ? 'an array' : typeof value}`);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Declare a route's metadata.
|
|
31
|
+
*
|
|
32
|
+
* Identity at runtime (so it costs nothing), validated at module load. The
|
|
33
|
+
* validation is deliberately loud and early: metadata is the part of a page
|
|
34
|
+
* nobody looks at until it is wrong in a search result, and a typo in a
|
|
35
|
+
* required field should fail the build, not the crawler.
|
|
36
|
+
*/
|
|
37
|
+
export function defineMetadata(input) {
|
|
38
|
+
const meta = assertPlainObject(input, 'the argument');
|
|
39
|
+
if ('title' in meta && meta.title !== undefined) {
|
|
40
|
+
if (typeof meta.title !== 'string' && typeof meta.title !== 'object') {
|
|
41
|
+
throw new Error('defineMetadata: `title` must be a string or { default, template }');
|
|
42
|
+
}
|
|
43
|
+
if (typeof meta.title === 'object') {
|
|
44
|
+
const t = assertPlainObject(meta.title, '`title`');
|
|
45
|
+
for (const key of Object.keys(t)) {
|
|
46
|
+
if (key !== 'default' && key !== 'template' && key !== 'absolute') {
|
|
47
|
+
throw new Error(`defineMetadata: unknown \`title.${key}\` (expected default, template or absolute)`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if ('description' in meta && meta.description !== undefined && typeof meta.description !== 'string') {
|
|
53
|
+
throw new Error('defineMetadata: `description` must be a string');
|
|
54
|
+
}
|
|
55
|
+
for (const key of ['openGraph', 'twitter']) {
|
|
56
|
+
if (key in meta && meta[key] !== undefined)
|
|
57
|
+
assertPlainObject(meta[key], `\`${key}\``);
|
|
58
|
+
}
|
|
59
|
+
if ('alternates' in meta && meta.alternates !== undefined) {
|
|
60
|
+
const alt = assertPlainObject(meta.alternates, '`alternates`');
|
|
61
|
+
for (const key of Object.keys(alt)) {
|
|
62
|
+
if (key !== 'canonical' && key !== 'languages') {
|
|
63
|
+
throw new Error(`defineMetadata: unknown \`alternates.${key}\` (expected canonical or languages)`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Unknown top-level keys are almost always a typo (`descripton`, `ogTitle`),
|
|
68
|
+
// and they fail silently everywhere downstream — so name them here.
|
|
69
|
+
for (const key of Object.keys(meta)) {
|
|
70
|
+
if (!KNOWN_KEYS.has(key)) {
|
|
71
|
+
throw new Error(`defineMetadata: unknown key "${key}". Known keys: ${[...KNOWN_KEYS].join(', ')}. ` +
|
|
72
|
+
'(`openGraph` carries og:* tags, not top-level `ogTitle`.)');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return meta;
|
|
76
|
+
}
|
|
77
|
+
/** The document title a metadata object asks for, with template resolution. */
|
|
78
|
+
export function resolveTitle(meta, child) {
|
|
79
|
+
if (!meta || meta.title === undefined || meta.title === null)
|
|
80
|
+
return null;
|
|
81
|
+
if (typeof meta.title === 'string')
|
|
82
|
+
return meta.title;
|
|
83
|
+
if (meta.title.absolute)
|
|
84
|
+
return meta.title.absolute;
|
|
85
|
+
if (meta.title.default)
|
|
86
|
+
return meta.title.default;
|
|
87
|
+
// A `{ template }`-only parent takes the child's title.
|
|
88
|
+
if (meta.title.template && child) {
|
|
89
|
+
const childTitle = resolveTitle(child);
|
|
90
|
+
return childTitle === null ? null : meta.title.template.replace('%s', childTitle);
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Merge metadata from the outside in: a layout, then a page, then a nested
|
|
96
|
+
* route. Later sources win per field, and the two nested groups (`openGraph`,
|
|
97
|
+
* `twitter`) merge field-wise so a page can set one OG key without restating
|
|
98
|
+
* the rest. Title template resolution happens on the way out.
|
|
99
|
+
*/
|
|
100
|
+
export function mergeMetadata(...sources) {
|
|
101
|
+
const out = {};
|
|
102
|
+
let template;
|
|
103
|
+
let sawTemplate = false;
|
|
104
|
+
for (const source of sources) {
|
|
105
|
+
if (!source)
|
|
106
|
+
continue;
|
|
107
|
+
for (const [key, value] of Object.entries(source)) {
|
|
108
|
+
if (value === undefined)
|
|
109
|
+
continue;
|
|
110
|
+
if (key === 'openGraph' || key === 'twitter') {
|
|
111
|
+
out[key] = { ...(out[key] || {}), ...value };
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (key === 'title') {
|
|
115
|
+
// A parent's `{ template }` is kept so a child's title can be wrapped,
|
|
116
|
+
// but the child's own title wins for the document.
|
|
117
|
+
if (value && typeof value === 'object' && value.template) {
|
|
118
|
+
sawTemplate = true;
|
|
119
|
+
template = value.template || template;
|
|
120
|
+
}
|
|
121
|
+
out.title = value;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
out[key] = value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (sawTemplate && out.title !== undefined) {
|
|
128
|
+
const own = out.title;
|
|
129
|
+
if (typeof own === 'string')
|
|
130
|
+
out.title = { absolute: own };
|
|
131
|
+
else if (own && typeof own === 'object' && own.template) {
|
|
132
|
+
out.title = { default: own.default, template: own.template || template };
|
|
133
|
+
}
|
|
134
|
+
else if (own && typeof own === 'object') {
|
|
135
|
+
out.title = { ...own, template: template };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
function escapeAttr(value) {
|
|
141
|
+
return String(value)
|
|
142
|
+
.split('&').join('&')
|
|
143
|
+
.split('<').join('<')
|
|
144
|
+
.split('>').join('>')
|
|
145
|
+
.split('"').join('"');
|
|
146
|
+
}
|
|
147
|
+
function escapeText(value) {
|
|
148
|
+
return String(value).split('&').join('&').split('<').join('<').split('>').join('>');
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Serialize metadata to head tags.
|
|
152
|
+
*
|
|
153
|
+
* The ONE serializer, used by the build-time path and the runtime path, so a
|
|
154
|
+
* title cannot be escaped twice (the bug where `&` reached the tab) or not
|
|
155
|
+
* at all. Text and attributes are escaped separately because they have
|
|
156
|
+
* different rules — escaping a `content` attribute as text is how you get
|
|
157
|
+
* `&amp;` in a meta description.
|
|
158
|
+
*/
|
|
159
|
+
export function metadataToHtml(meta, opts = {}) {
|
|
160
|
+
if (!meta)
|
|
161
|
+
return '';
|
|
162
|
+
const lines = [];
|
|
163
|
+
const title = resolveTitle(meta, opts.child);
|
|
164
|
+
if (title !== null)
|
|
165
|
+
lines.push(`<title data-vesk-head>${escapeText(title)}</title>`);
|
|
166
|
+
if (typeof meta.description === 'string' && meta.description.length > 0) {
|
|
167
|
+
lines.push(`<meta name="description" content="${escapeAttr(meta.description)}" data-vesk-head />`);
|
|
168
|
+
}
|
|
169
|
+
if (meta.robots) {
|
|
170
|
+
const content = typeof meta.robots === 'string'
|
|
171
|
+
? meta.robots
|
|
172
|
+
: Object.entries(meta.robots).filter(([, on]) => on).map(([k]) => k).join(', ');
|
|
173
|
+
if (content)
|
|
174
|
+
lines.push(`<meta name="robots" content="${escapeAttr(content)}" data-vesk-head />`);
|
|
175
|
+
}
|
|
176
|
+
if (meta.themeColor) {
|
|
177
|
+
lines.push(`<meta name="theme-color" content="${escapeAttr(meta.themeColor)}" data-vesk-head />`);
|
|
178
|
+
}
|
|
179
|
+
const og = meta.openGraph;
|
|
180
|
+
if (og) {
|
|
181
|
+
const ogTitle = resolveTitle(og) ?? title;
|
|
182
|
+
const ogFields = [
|
|
183
|
+
['og:title', ogTitle],
|
|
184
|
+
['og:description', og.description ?? meta.description],
|
|
185
|
+
['og:url', og.url],
|
|
186
|
+
['og:site_name', og.siteName],
|
|
187
|
+
['og:image', og.image],
|
|
188
|
+
['og:type', og.type],
|
|
189
|
+
];
|
|
190
|
+
for (const [prop, value] of ogFields) {
|
|
191
|
+
if (value === undefined || value === null || value === '')
|
|
192
|
+
continue;
|
|
193
|
+
lines.push(`<meta property="${prop}" content="${escapeAttr(value)}" data-vesk-head />`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const tw = meta.twitter;
|
|
197
|
+
if (tw) {
|
|
198
|
+
const twFields = [
|
|
199
|
+
['twitter:card', tw.card],
|
|
200
|
+
['twitter:site', tw.site],
|
|
201
|
+
['twitter:title', resolveTitle(tw) ?? title],
|
|
202
|
+
['twitter:description', tw.description ?? meta.description],
|
|
203
|
+
['twitter:image', tw.image],
|
|
204
|
+
];
|
|
205
|
+
for (const [name, value] of twFields) {
|
|
206
|
+
if (value === undefined || value === null || value === '')
|
|
207
|
+
continue;
|
|
208
|
+
lines.push(`<meta name="${name}" content="${escapeAttr(value)}" data-vesk-head />`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const alt = meta.alternates;
|
|
212
|
+
if (alt) {
|
|
213
|
+
if (typeof alt === 'object' && typeof alt.canonical === 'string') {
|
|
214
|
+
lines.push(`<link rel="canonical" href="${escapeAttr(alt.canonical)}" data-vesk-head />`);
|
|
215
|
+
}
|
|
216
|
+
const languages = alt.languages;
|
|
217
|
+
if (languages && typeof languages === 'object') {
|
|
218
|
+
for (const [lang, href] of Object.entries(languages)) {
|
|
219
|
+
lines.push(`<link rel="alternate" hreflang="${escapeAttr(lang)}" href="${escapeAttr(href)}" data-vesk-head />`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return lines.join('\n');
|
|
224
|
+
}
|
package/dist/resource.d.ts
CHANGED
|
@@ -21,6 +21,20 @@ export interface UseFetchOptions<T> extends Omit<RequestInit, 'body'> {
|
|
|
21
21
|
timeout?: number;
|
|
22
22
|
enabled?: boolean;
|
|
23
23
|
dedupe?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* How SSR treats this resource. `'wait'` (default) holds the document
|
|
26
|
+
* until it settles, so the data is in the SSR handoff. `'defer'` starts the
|
|
27
|
+
* fetch but excludes it from the settle barrier, so the document flushes
|
|
28
|
+
* without it.
|
|
29
|
+
*
|
|
30
|
+
* The right choice for a resource inside a `{#client}` island: the island's
|
|
31
|
+
* server output is a placeholder the client fills on hydration, so making
|
|
32
|
+
* the document wait for that fetch delays every other byte on the page to
|
|
33
|
+
* buy data the client was going to fetch anyway. The cost is one extra
|
|
34
|
+
* client-side request for that island; the saving is the whole page's
|
|
35
|
+
* time-to-first-byte.
|
|
36
|
+
*/
|
|
37
|
+
ssr?: 'wait' | 'defer';
|
|
24
38
|
}
|
|
25
39
|
export declare class HttpError extends Error {
|
|
26
40
|
status: number;
|
package/dist/resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAQhE,MAAM,WAAW,QAAQ,CAAC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAQhE,MAAM,WAAW,QAAQ,CAAC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,M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AAE,MAAM,CAAC,GAAG;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,KAC5H,QAAQ,CAAC,MAAM,CAAC;;AAiBnB,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAU5E"}
|
package/dist/resource.js
CHANGED
|
@@ -382,8 +382,22 @@ function writeCache(key, data) {
|
|
|
382
382
|
if (!entry || entry.data !== data)
|
|
383
383
|
getClientCache().set(key, { data, fetchedAt: Date.now() });
|
|
384
384
|
}
|
|
385
|
-
function trackSsrPromise(promise) {
|
|
385
|
+
function trackSsrPromise(promise, defer = false) {
|
|
386
386
|
const tk = g().__vsk_ssr_token || '';
|
|
387
|
+
if (defer) {
|
|
388
|
+
// Deliberately NOT in the settle barrier's array. It is still tracked so
|
|
389
|
+
// nothing waits on it, and the data still lands in the token's slot if
|
|
390
|
+
// it happens to arrive before serialization (a race we take for free).
|
|
391
|
+
// Late data is simply absent from the handoff, which is correct: the
|
|
392
|
+
// consumer is an island that fetches on hydration anyway.
|
|
393
|
+
const deferredKey = tk ? `__vsk_ssr_deferred_${tk}` : '__vsk_ssr_deferred';
|
|
394
|
+
if (!g()[deferredKey])
|
|
395
|
+
g()[deferredKey] = [];
|
|
396
|
+
g()[deferredKey].push(promise);
|
|
397
|
+
// Never leave a rejection unobserved on a promise nobody awaits.
|
|
398
|
+
promise.then(undefined, () => { });
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
387
401
|
const promisesKey = tk ? `__vsk_ssr_promises_${tk}` : '__vsk_ssr_promises';
|
|
388
402
|
if (!g()[promisesKey])
|
|
389
403
|
g()[promisesKey] = [];
|
|
@@ -463,7 +477,7 @@ function startRequest(handle, skipCache) {
|
|
|
463
477
|
// handoff. Only the resource state needs wiring up here.
|
|
464
478
|
attachSettle(handle, prom);
|
|
465
479
|
}
|
|
466
|
-
trackSsrPromise(prom);
|
|
480
|
+
trackSsrPromise(prom, options.ssr === 'defer');
|
|
467
481
|
return prom;
|
|
468
482
|
}
|
|
469
483
|
if (!skipCache && options.staleTime && options.staleTime > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/runtime",
|
|
3
|
-
"version": "0.2.50-canary.
|
|
3
|
+
"version": "0.2.50-canary.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk runtime — reactivity, blocks, DOM operations, hydration",
|
|
6
6
|
"main": "./dist/index-client.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vesk/compiler": "^0.2.50-canary.
|
|
54
|
+
"@vesk/compiler": "^0.2.50-canary.5"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"typecheck": "tsc --noEmit",
|