@webjsdev/core 0.7.61 → 0.7.62
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 +1 -1
- package/src/metadata.d.ts +46 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webjsdev/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The runtime for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Ships the html and css template tags, the WebComponent base class, signals, directives, and the isomorphic renderers.",
|
|
6
6
|
"types": "./index.d.ts",
|
package/src/metadata.d.ts
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
/** A URL or relative path. Relative values resolve against `metadataBase`. */
|
|
21
21
|
type MetadataUrl = string;
|
|
22
|
+
/** A URL that may also be given as a `URL` object (Open Graph / Twitter fields). */
|
|
23
|
+
type MetadataUrlOrUrl = string | URL;
|
|
22
24
|
|
|
23
25
|
/** `title` accepts a plain string or the template object Next.js uses. */
|
|
24
26
|
export type TitleMetadata =
|
|
@@ -64,7 +66,11 @@ export interface RobotsMetadata {
|
|
|
64
66
|
|
|
65
67
|
/** `alternates`: canonical + i18n / media / type alternates. */
|
|
66
68
|
export interface AlternatesMetadata {
|
|
67
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Defaults to the site URL + the page's pathname when a site URL is known
|
|
71
|
+
* (`metadataBase` or the `SITE_URL` env var). `null` opts the page out.
|
|
72
|
+
*/
|
|
73
|
+
canonical?: MetadataUrl | null;
|
|
68
74
|
/** hreflang -> URL, e.g. `{ 'es-ES': '/es' }`. */
|
|
69
75
|
languages?: Record<string, MetadataUrl>;
|
|
70
76
|
/** media query -> URL, e.g. `{ '(max-width: 600px)': '/mobile' }`. */
|
|
@@ -103,30 +109,55 @@ export type IconsMetadata =
|
|
|
103
109
|
| Array<{ rel: string; url: MetadataUrl; sizes?: string; type?: string }>;
|
|
104
110
|
};
|
|
105
111
|
|
|
112
|
+
/** An Open Graph / Twitter image: a URL, or a URL with its details. */
|
|
113
|
+
export type MetadataImage =
|
|
114
|
+
| MetadataUrlOrUrl
|
|
115
|
+
| { url: MetadataUrlOrUrl; secureUrl?: MetadataUrlOrUrl; width?: number | string; height?: number | string; alt?: string; type?: string };
|
|
116
|
+
|
|
106
117
|
/**
|
|
107
|
-
* `openGraph`.
|
|
108
|
-
*
|
|
109
|
-
*
|
|
118
|
+
* `openGraph`. Next's shape: `images` (one or many, string or object) emits
|
|
119
|
+
* `og:image` plus `og:image:width` / `height` / `alt` / `type`; camelCase keys
|
|
120
|
+
* become snake_case (`siteName` -> `og:site_name`); article fields emit
|
|
121
|
+
* `article:*`. Raw `og:<key>` names (`image`, `site_name`, `'image:width'`)
|
|
122
|
+
* still work. When unset, `title`, `description`, `url` (the canonical),
|
|
123
|
+
* `type` (`website`) and `images` (the nearest `opengraph-image` route) are
|
|
124
|
+
* filled in from the page.
|
|
110
125
|
*/
|
|
111
126
|
export interface OpenGraphMetadata {
|
|
112
127
|
type?: string;
|
|
113
128
|
title?: string;
|
|
114
129
|
description?: string;
|
|
115
|
-
url?:
|
|
116
|
-
|
|
130
|
+
url?: MetadataUrlOrUrl;
|
|
131
|
+
siteName?: string;
|
|
132
|
+
locale?: string;
|
|
133
|
+
images?: MetadataImage | MetadataImage[];
|
|
134
|
+
image?: MetadataImage;
|
|
117
135
|
site_name?: string;
|
|
118
|
-
|
|
136
|
+
publishedTime?: string | Date;
|
|
137
|
+
modifiedTime?: string | Date;
|
|
138
|
+
expirationTime?: string | Date;
|
|
139
|
+
authors?: string | string[];
|
|
140
|
+
section?: string;
|
|
141
|
+
tags?: string | string[];
|
|
142
|
+
[key: string]: unknown;
|
|
119
143
|
}
|
|
120
144
|
|
|
121
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* `twitter` card. `images` emits `twitter:image` (+ `twitter:image:alt`).
|
|
147
|
+
* `card` defaults to `summary_large_image` when the page has an image, else
|
|
148
|
+
* `summary`.
|
|
149
|
+
*/
|
|
122
150
|
export interface TwitterMetadata {
|
|
123
151
|
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
124
152
|
title?: string;
|
|
125
153
|
description?: string;
|
|
126
|
-
|
|
154
|
+
images?: MetadataImage | MetadataImage[];
|
|
155
|
+
image?: MetadataImage;
|
|
127
156
|
site?: string;
|
|
157
|
+
siteId?: string;
|
|
128
158
|
creator?: string;
|
|
129
|
-
|
|
159
|
+
creatorId?: string;
|
|
160
|
+
[key: string]: unknown;
|
|
130
161
|
}
|
|
131
162
|
|
|
132
163
|
/** A startup-image entry for `appleWebApp.startupImage`. */
|
|
@@ -200,8 +231,11 @@ export interface Metadata {
|
|
|
200
231
|
/** -> `<meta name="referrer">`. */
|
|
201
232
|
referrer?: string;
|
|
202
233
|
|
|
203
|
-
/**
|
|
204
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Base for resolving every relative URL in this object. Defaults to the
|
|
236
|
+
* `SITE_URL` env var (the app's public origin).
|
|
237
|
+
*/
|
|
238
|
+
metadataBase?: string | URL;
|
|
205
239
|
|
|
206
240
|
/** -> `<meta name="viewport">`. String form OR object form. */
|
|
207
241
|
viewport?: string | ViewportMetadata;
|