@gusnips/vite 0.8.35 → 0.8.37
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/README.md +20 -20
- package/dist/catalog.d.ts +5 -6
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +5 -6
- package/dist/catalog.js.map +1 -1
- package/dist/contrast.js +8 -8
- package/dist/contrast.js.map +1 -1
- package/dist/head.d.ts +35 -36
- package/dist/head.d.ts.map +1 -1
- package/dist/head.js +20 -20
- package/dist/head.js.map +1 -1
- package/dist/i18n.d.ts +8 -7
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +5 -4
- package/dist/i18n.js.map +1 -1
- package/dist/icons.d.ts +6 -6
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -2
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/node.d.ts +24 -25
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +26 -26
- package/dist/node.js.map +1 -1
- package/dist/og.d.ts +7 -7
- package/dist/og.d.ts.map +1 -1
- package/dist/og.js +2 -2
- package/dist/og.js.map +1 -1
- package/dist/pre-paint.d.ts +3 -3
- package/dist/preset.d.ts +9 -9
- package/dist/preset.js +3 -3
- package/dist/render.d.ts +9 -9
- package/dist/render.js +4 -4
- package/dist/render.js.map +1 -1
- package/dist/sitemap.d.ts +26 -27
- package/dist/sitemap.d.ts.map +1 -1
- package/dist/sitemap.js +18 -18
- package/dist/sitemap.js.map +1 -1
- package/dist/theme.d.ts +1 -2
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +1 -2
- package/dist/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/catalog.ts +5 -6
- package/src/contrast.ts +8 -8
- package/src/head.ts +36 -37
- package/src/i18n.ts +8 -7
- package/src/icons.ts +7 -7
- package/src/index.ts +7 -7
- package/src/node.ts +28 -29
- package/src/og.ts +8 -8
- package/src/pre-paint.ts +3 -3
- package/src/preset.ts +9 -9
- package/src/render.ts +10 -10
- package/src/sitemap.ts +27 -28
- package/src/theme.ts +1 -2
package/dist/og.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fitting copy into a share card.
|
|
3
3
|
*
|
|
4
|
-
* The card's ART
|
|
4
|
+
* The card's ART, including the palette, lockup and size ladder, is the product, and it stays in
|
|
5
5
|
* the product. What ships here is the part two independent generators got wrong the same way:
|
|
6
6
|
* deciding what happens when a headline does not fit.
|
|
7
7
|
*
|
|
@@ -20,7 +20,7 @@ export interface OgOverflow {
|
|
|
20
20
|
/** The string as given. */
|
|
21
21
|
text: string;
|
|
22
22
|
maxLines: number;
|
|
23
|
-
/** Characters per line at this size
|
|
23
|
+
/** Characters per line at this size, the budget the text exceeded. */
|
|
24
24
|
maxChars: number;
|
|
25
25
|
size: number;
|
|
26
26
|
}
|
|
@@ -34,11 +34,11 @@ export interface FitOptions {
|
|
|
34
34
|
/**
|
|
35
35
|
* Average glyph advance as a fraction of the font size.
|
|
36
36
|
*
|
|
37
|
-
* Character-budget estimation rather than real metrics: an SVG rasterizer gives no measuring
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* Character-budget estimation rather than real metrics: an SVG rasterizer gives no measuring API,
|
|
38
|
+
* and card copy is short enough that the estimate never drifts more than a word. Measure it off a
|
|
39
|
+
* rendered card and round UP. A budget that is too generous overflows the column, while one that
|
|
40
|
+
* is too mean only breaks a line early. Donor values: ~0.5 for a display face at headline sizes,
|
|
41
|
+
* ~0.46 for body copy.
|
|
42
42
|
*/
|
|
43
43
|
advance: number;
|
|
44
44
|
/** Names this line in an overflow report. `"pricing headline"`, not `"line 1"`. */
|
package/dist/og.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../src/og.ts"],"names":[],"mappings":"AAAA;;;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
|
|
|
1
1
|
/**
|
|
2
2
|
* Fitting copy into a share card.
|
|
3
3
|
*
|
|
4
|
-
* The card's ART
|
|
4
|
+
* The card's ART, including the palette, lockup and size ladder, is the product, and it stays in
|
|
5
5
|
* the product. What ships here is the part two independent generators got wrong the same way:
|
|
6
6
|
* deciding what happens when a headline does not fit.
|
|
7
7
|
*
|
|
@@ -53,7 +53,7 @@ export function fitText(text, options) {
|
|
|
53
53
|
}
|
|
54
54
|
/** One overflow, as the line an operator reads in a failed build. */
|
|
55
55
|
export function describeOverflow(overflow) {
|
|
56
|
-
return (`${overflow.label}
|
|
56
|
+
return (`${overflow.label}: ${String(overflow.maxLines)} lines of ~${String(overflow.maxChars)} ` +
|
|
57
57
|
`chars at ${String(overflow.size)}px, ${String(overflow.text.length)} chars given\n` +
|
|
58
58
|
` ${JSON.stringify(overflow.text)}`);
|
|
59
59
|
}
|
package/dist/og.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.js","sourceRoot":"","sources":["../src/og.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,iGAAiG;AACjG,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAW,CAAC;AA0C/D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,OAAmB;IACvD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAa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,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3B,OAAO,UAAU;QACf,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QACtE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,gBAAgB,CAAC,QAAoB;IACnD,OAAO,CACL,GAAG,QAAQ,CAAC,KAAK,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;QACzF,YAAY,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB;QACpF,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CACvC,CAAC;AACJ,CAAC"}
|
package/dist/pre-paint.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export interface PrePaintScriptOptions {
|
|
|
5
5
|
/** The script's full text. It runs alone, so it must not reference anything outside itself. */
|
|
6
6
|
source: string;
|
|
7
7
|
/**
|
|
8
|
-
* Where the tag goes. `"head"` (the end of `<head>`) when the script reads elements above it
|
|
8
|
+
* Where the tag goes. `"head"` (the end of `<head>`) when the script reads elements above it, as
|
|
9
9
|
* the theme reads `<meta name="theme-color">`. `"head-prepend"` when it only needs to run as
|
|
10
|
-
* early as possible: a classic script after a stylesheet waits for that stylesheet, so the
|
|
11
|
-
*
|
|
10
|
+
* early as possible: a classic script after a stylesheet waits for that stylesheet, so the locale
|
|
11
|
+
* gate goes first and redirects without downloading the page's CSS.
|
|
12
12
|
*/
|
|
13
13
|
position?: "head" | "head-prepend";
|
|
14
14
|
}
|
package/dist/preset.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import type { Plugin, PluginOption, UserConfig } from "vite";
|
|
|
5
5
|
* `index.html` cannot import TypeScript, so a brand name or tagline written there is a literal
|
|
6
6
|
* that drifts from the one the app renders. This injects them from the module that owns them.
|
|
7
7
|
*
|
|
8
|
-
* Vite already replaces `%VITE_FOO%` from the environment, and that is the right tool
|
|
9
|
-
* value
|
|
10
|
-
* belongs in a typed module the app imports, not in a `.env` nobody reviews.
|
|
8
|
+
* Vite already replaces `%VITE_FOO%` from the environment, and that is the right tool for an
|
|
9
|
+
* environment value, such as an API URL or a build id. It is the wrong one for brand identity,
|
|
10
|
+
* which belongs in a typed module the app imports, not in a `.env` nobody reviews.
|
|
11
11
|
*/
|
|
12
12
|
export declare function htmlPlaceholders(values: Readonly<Record<string, string>>): Plugin;
|
|
13
13
|
export interface WebPresetOptions {
|
|
14
|
-
/** The app folder
|
|
14
|
+
/** The app folder holding `index.html`. In a `vite.config.ts` that is
|
|
15
15
|
* `import.meta.dirname`. `@` resolves to `<root>/src`. */
|
|
16
16
|
root: string;
|
|
17
17
|
/** Dev server port. Two apps in one repo must not share one, which is why it has no clever
|
|
@@ -25,11 +25,11 @@ export interface WebPresetOptions {
|
|
|
25
25
|
/**
|
|
26
26
|
* The workspace scope to bundle into the SSR build, as in `"@acme"`.
|
|
27
27
|
*
|
|
28
|
-
* INSURANCE, not a fix. Measured: Vite already bundles linked workspace dependencies in an
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* INSURANCE, not a fix. Measured: Vite already bundles linked workspace dependencies in an SSR
|
|
29
|
+
* build. One donor runs without this declaration and its SSR output has zero bare imports. It is
|
|
30
|
+
* here because workspace packages are consumed as TypeScript SOURCE through subpath exports, and
|
|
31
|
+
* leaving them external would hand the runtime `.ts` files with Vite-only semantics in them
|
|
32
|
+
* (aliases, `?raw`, `define`) if that behaviour ever changed.
|
|
33
33
|
*/
|
|
34
34
|
ssrScope?: string;
|
|
35
35
|
/** More plugins, after the preset's own: `[themeScript(THEME)]`. */
|
package/dist/preset.js
CHANGED
|
@@ -14,9 +14,9 @@ import path from "node:path";
|
|
|
14
14
|
* `index.html` cannot import TypeScript, so a brand name or tagline written there is a literal
|
|
15
15
|
* that drifts from the one the app renders. This injects them from the module that owns them.
|
|
16
16
|
*
|
|
17
|
-
* Vite already replaces `%VITE_FOO%` from the environment, and that is the right tool
|
|
18
|
-
* value
|
|
19
|
-
* belongs in a typed module the app imports, not in a `.env` nobody reviews.
|
|
17
|
+
* Vite already replaces `%VITE_FOO%` from the environment, and that is the right tool for an
|
|
18
|
+
* environment value, such as an API URL or a build id. It is the wrong one for brand identity,
|
|
19
|
+
* which belongs in a typed module the app imports, not in a `.env` nobody reviews.
|
|
20
20
|
*/
|
|
21
21
|
export function htmlPlaceholders(values) {
|
|
22
22
|
return {
|
package/dist/render.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One page, as the markup that goes inside `<div id="root">`.
|
|
3
3
|
*
|
|
4
|
-
* This is the build-time half of `main.tsx`, and the app's `entry-server.tsx` is expected to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* This is the build-time half of `main.tsx`, and the app's `entry-server.tsx` is expected to be
|
|
5
|
+
* four lines around it: the same `<App />` and the same route table the browser runs, with a
|
|
6
|
+
* `StaticRouter` in place of the history the build does not have. `main.tsx` is deliberately NOT
|
|
7
|
+
* reused because it reads `window.location`, registers listeners and starts analytics at module
|
|
8
8
|
* scope, none of which mean anything here.
|
|
9
9
|
*
|
|
10
10
|
* No `node:` import: this file is bundled into the SSR build by Vite, and it is React's own
|
|
@@ -15,9 +15,9 @@ import type { ReactNode } from "react";
|
|
|
15
15
|
* Render a tree to markup with `prerender` from `react-dom/static`.
|
|
16
16
|
*
|
|
17
17
|
* **Never `renderToString`.** With `lazy()` routes behind a `<Suspense fallback={<Spinner />}>`,
|
|
18
|
-
* `renderToString` renders the FALLBACK
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `renderToString` renders the FALLBACK. It would write a loading screen into every file and pass
|
|
19
|
+
* every gate that only asks whether the root has children. `prerender` waits for the tree to
|
|
20
|
+
* settle, which is also why this is async and why the whole renderer contract is.
|
|
21
21
|
*
|
|
22
22
|
* Two more halves of the same lesson are here too: `onError` is captured and rethrown, so a
|
|
23
23
|
* render failure fails the build rather than shipping a partial page; and an empty result is
|
|
@@ -28,8 +28,8 @@ export declare function renderTree(tree: ReactNode): Promise<string>;
|
|
|
28
28
|
/**
|
|
29
29
|
* What an SSR entry exports, and what {@link loadRenderer} looks for.
|
|
30
30
|
*
|
|
31
|
-
* `context` is opaque on purpose. A multi-locale app builds its i18n instance per call
|
|
32
|
-
* languages render in one process and a shared singleton would have them racing for one `lng
|
|
31
|
+
* `context` is opaque on purpose. A multi-locale app builds its i18n instance per call. Three
|
|
32
|
+
* languages render in one process and a shared singleton would have them racing for one `lng`,
|
|
33
33
|
* while a single-locale app ignores the argument and keeps its singleton.
|
|
34
34
|
*/
|
|
35
35
|
export type PageRenderer<Context = unknown> = (route: string, context?: Context) => Promise<string>;
|
package/dist/render.js
CHANGED
|
@@ -22,9 +22,9 @@ const HOISTED_HEAD = /^(?:<title>[^<]*<\/title>|<meta\b[^>]*\/?>|<link\b[^>]*\/?
|
|
|
22
22
|
* Render a tree to markup with `prerender` from `react-dom/static`.
|
|
23
23
|
*
|
|
24
24
|
* **Never `renderToString`.** With `lazy()` routes behind a `<Suspense fallback={<Spinner />}>`,
|
|
25
|
-
* `renderToString` renders the FALLBACK
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* `renderToString` renders the FALLBACK. It would write a loading screen into every file and pass
|
|
26
|
+
* every gate that only asks whether the root has children. `prerender` waits for the tree to
|
|
27
|
+
* settle, which is also why this is async and why the whole renderer contract is.
|
|
28
28
|
*
|
|
29
29
|
* Two more halves of the same lesson are here too: `onError` is captured and rethrown, so a
|
|
30
30
|
* render failure fails the build rather than shipping a partial page; and an empty result is
|
|
@@ -43,7 +43,7 @@ export async function renderTree(tree) {
|
|
|
43
43
|
throw failure;
|
|
44
44
|
const markup = html.replace(HOISTED_HEAD, "");
|
|
45
45
|
if (markup.trim() === "")
|
|
46
|
-
throw new Error("renderTree: the tree rendered to nothing
|
|
46
|
+
throw new Error("renderTree: the tree rendered to nothing. Usually a router whose location or basename " +
|
|
47
47
|
"matches no route, which React reports as an empty string rather than an error");
|
|
48
48
|
return markup;
|
|
49
49
|
}
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAaA,+FAA+F;AAC/F,gGAAgG;AAChG,yFAAyF;AACzF,8FAA8F;AAC9F,4FAA4F;AAC5F,oEAAoE;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,mEAAmE,CAAC;AAEzF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAe;IAC9C,IAAI,OAAgB,CAAC;IACrB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE;QACxC,OAAO,CAAC,KAAc;YACpB,OAAO,KAAK,KAAK,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,OAAO,CAAC;IAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QACtB,MAAM,IAAI,KAAK,CACb,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAaA,+FAA+F;AAC/F,gGAAgG;AAChG,yFAAyF;AACzF,8FAA8F;AAC9F,4FAA4F;AAC5F,oEAAoE;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,mEAAmE,CAAC;AAEzF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAe;IAC9C,IAAI,OAAgB,CAAC;IACrB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE;QACxC,OAAO,CAAC,KAAc;YACpB,OAAO,KAAK,KAAK,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,OAAO,CAAC;IAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QACtB,MAAM,IAAI,KAAK,CACb,wFAAwF;YACtF,+EAA+E,CAClF,CAAC;IACJ,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/sitemap.d.ts
CHANGED
|
@@ -2,19 +2,19 @@ import type { Alternate } from "./head.ts";
|
|
|
2
2
|
/**
|
|
3
3
|
* Where a rendered page lands.
|
|
4
4
|
*
|
|
5
|
-
* FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves the
|
|
6
|
+
* directory form at `/pricing/` and answers `/pricing` with a 308 to it, so every address the app
|
|
7
|
+
* advertises in its canonical and its sitemap would be a redirect rather than a page. A flat file
|
|
8
|
+
* answers the advertised `/pricing` address with a 200, and normalizes `/pricing/` to it with a
|
|
9
|
+
* 308.
|
|
10
10
|
*
|
|
11
11
|
* This said "200 either way" until somebody measured it. On a live Pages deployment `/precos/`
|
|
12
|
-
* answers `308` with `location: /precos`, which then answers 200. The rule is untouched
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* answers `308` with `location: /precos`, which then answers 200. The rule is untouched: the
|
|
13
|
+
* ADVERTISED form is the one that must be a page, and it is. But the parenthetical was inherited
|
|
14
|
+
* from a donor comment and repeated into an adopter's commit message as a live bug before anyone
|
|
15
|
+
* checked. It also has a consequence worth knowing: on a host that normalizes, `hydrateOrMount`'s
|
|
16
|
+
* slash tolerance can never fire, because the browser is redirected before it runs. That tolerance
|
|
17
|
+
* earns its place on hosts that serve both forms, not on this one.
|
|
18
18
|
*
|
|
19
19
|
* That is Cloudflare Pages, not every host. Firebase Hosting serves the directory form at
|
|
20
20
|
* `/pricing` itself with `trailingSlash: false`, and an adopter there names its own files. What
|
|
@@ -36,21 +36,21 @@ export declare function siteOrigin(url: string): string;
|
|
|
36
36
|
/**
|
|
37
37
|
* The origin the template already declares, read out of its canonical.
|
|
38
38
|
*
|
|
39
|
-
* One file is the answer for the head Vite ships and for every file written after it, so there
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* One file is the answer for the head Vite ships and for every file written after it, so there is
|
|
40
|
+
* no second place for a domain to drift to and no env var the script has to resolve beside it.
|
|
41
|
+
* Demanded rather than defaulted, for the reason `bakeHead` demands the tag: a template without one
|
|
42
|
+
* would hand every page somebody else's origin, quietly.
|
|
43
43
|
*/
|
|
44
44
|
export declare function templateOrigin(template: string): string;
|
|
45
45
|
/**
|
|
46
46
|
* The three things about a public page that do not translate: where it is, how often it
|
|
47
47
|
* changes, and how it ranks against its siblings.
|
|
48
48
|
*
|
|
49
|
-
* A product's registry extends this with its own copy fields
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
49
|
+
* A product's registry extends this with its own copy fields. One donor names an i18n key per page,
|
|
50
|
+
* another keys its locale catalogs by `pageSlug` and stores no copy here at all. Where the copy
|
|
51
|
+
* lives is the product's call. These three are what a sitemap needs from every one of them, and the
|
|
52
|
+
* registry is the single source the prerender, the sitemap and the share cards all walk, so a page
|
|
53
|
+
* can never be in one and missing from another.
|
|
54
54
|
*/
|
|
55
55
|
export interface PublicPage {
|
|
56
56
|
path: string;
|
|
@@ -66,7 +66,7 @@ export declare function ogImagePath(path: string): string;
|
|
|
66
66
|
export interface SitemapEntry {
|
|
67
67
|
loc: string;
|
|
68
68
|
changefreq: string;
|
|
69
|
-
/** Already formatted
|
|
69
|
+
/** Already formatted, because an app ranks its own pages, and that rule does not belong here. */
|
|
70
70
|
priority: string;
|
|
71
71
|
/** `YYYY-MM-DD`. The one hint in a sitemap Google actually reads. One date for the whole
|
|
72
72
|
* build is the honest answer: these pages ship together. */
|
|
@@ -78,8 +78,8 @@ export interface SitemapEntry {
|
|
|
78
78
|
/** `sitemap.xml`, from whichever registry the caller walks. */
|
|
79
79
|
export declare function sitemapXml(entries: readonly SitemapEntry[]): string;
|
|
80
80
|
/**
|
|
81
|
-
* `sitemap.xml` for a single-language site, straight from the registry
|
|
82
|
-
* the reason a registry exists: the sitemap can never drift from the routes the app serves.
|
|
81
|
+
* `sitemap.xml` for a single-language site, straight from the registry. This is the common case,
|
|
82
|
+
* and the reason a registry exists: the sitemap can never drift from the routes the app serves.
|
|
83
83
|
*
|
|
84
84
|
* A localized site walks its own locales and calls {@link sitemapXml}, because only it knows
|
|
85
85
|
* how an address carries a language.
|
|
@@ -87,17 +87,16 @@ export declare function sitemapXml(entries: readonly SitemapEntry[]): string;
|
|
|
87
87
|
export declare function sitemapFor(origin: string, pages: readonly PublicPage[], lastmod?: string): string;
|
|
88
88
|
export interface RobotsOptions {
|
|
89
89
|
/** The origin this file is served from. Every sitemap path is resolved against it, so the
|
|
90
|
-
* file can never advertise a host it is not on
|
|
90
|
+
* file can never advertise a host it is not on. One donor still ships that mistake,
|
|
91
91
|
* where a static `robots.txt` and the build's fallback name different domains. */
|
|
92
92
|
origin: string;
|
|
93
93
|
/** Every sitemap on this ORIGIN, as paths (`/sitemap.xml`, `/docs/sitemap.xml`).
|
|
94
94
|
*
|
|
95
95
|
* A crawler reads only the robots.txt at the origin root. An app served from a
|
|
96
|
-
* subdirectory therefore cannot ship its own
|
|
96
|
+
* subdirectory therefore cannot ship its own. The one file at the root has to list its
|
|
97
97
|
* sitemap too, or nothing ever finds it. */
|
|
98
98
|
sitemaps: readonly string[];
|
|
99
|
-
/** Paths to keep out of every index. A page nobody should be able to find by searching
|
|
100
|
-
* a per-request status page, an unsubscribe link — belongs here AND in `noindex`. */
|
|
99
|
+
/** Paths to keep out of every index. A per-request status page or an unsubscribe link that nobody should be able to find by searching belongs here AND in `noindex`. */
|
|
101
100
|
disallow?: readonly string[];
|
|
102
101
|
}
|
|
103
102
|
export declare function robotsTxt({ origin, sitemaps, disallow }: RobotsOptions): string;
|
package/dist/sitemap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASvD;AAED;;;;;;;;;GASG;AACH,MAAM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hD;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,QAAQ,EAAE,MAAM,CAAC;IACjB;iEAC6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;iFAC6E;IAC7E,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACnC;AAED,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAyBnE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAYjG;AAED,MAAM,WAAW,aAAa;IAC5B;;uFAEmF;IACnF,MAAM,EAAE,MAAM,CAAC;IACf;;;;iDAI6C;IAC7C,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,wKAAwK;IACxK,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAa,EAAE,EAAE,aAAa,GAAG,MAAM,CAQpF"}
|
package/dist/sitemap.js
CHANGED
|
@@ -8,19 +8,19 @@ import { escapeAttr } from "./escape.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Where a rendered page lands.
|
|
10
10
|
*
|
|
11
|
-
* FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves the
|
|
12
|
+
* directory form at `/pricing/` and answers `/pricing` with a 308 to it, so every address the app
|
|
13
|
+
* advertises in its canonical and its sitemap would be a redirect rather than a page. A flat file
|
|
14
|
+
* answers the advertised `/pricing` address with a 200, and normalizes `/pricing/` to it with a
|
|
15
|
+
* 308.
|
|
16
16
|
*
|
|
17
17
|
* This said "200 either way" until somebody measured it. On a live Pages deployment `/precos/`
|
|
18
|
-
* answers `308` with `location: /precos`, which then answers 200. The rule is untouched
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
* answers `308` with `location: /precos`, which then answers 200. The rule is untouched: the
|
|
19
|
+
* ADVERTISED form is the one that must be a page, and it is. But the parenthetical was inherited
|
|
20
|
+
* from a donor comment and repeated into an adopter's commit message as a live bug before anyone
|
|
21
|
+
* checked. It also has a consequence worth knowing: on a host that normalizes, `hydrateOrMount`'s
|
|
22
|
+
* slash tolerance can never fire, because the browser is redirected before it runs. That tolerance
|
|
23
|
+
* earns its place on hosts that serve both forms, not on this one.
|
|
24
24
|
*
|
|
25
25
|
* That is Cloudflare Pages, not every host. Firebase Hosting serves the directory form at
|
|
26
26
|
* `/pricing` itself with `trailingSlash: false`, and an adopter there names its own files. What
|
|
@@ -43,16 +43,16 @@ export function pageFile(routePath) {
|
|
|
43
43
|
*/
|
|
44
44
|
export function siteOrigin(url) {
|
|
45
45
|
if (!/^https?:\/\/[^/]+/.test(url))
|
|
46
|
-
throw new Error(`prerender: "${url}" is not an absolute origin
|
|
46
|
+
throw new Error(`prerender: "${url}" is not an absolute origin. It needs a scheme, as in https://example.com`);
|
|
47
47
|
return url.replace(/\/+$/, "");
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* The origin the template already declares, read out of its canonical.
|
|
51
51
|
*
|
|
52
|
-
* One file is the answer for the head Vite ships and for every file written after it, so there
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
52
|
+
* One file is the answer for the head Vite ships and for every file written after it, so there is
|
|
53
|
+
* no second place for a domain to drift to and no env var the script has to resolve beside it.
|
|
54
|
+
* Demanded rather than defaulted, for the reason `bakeHead` demands the tag: a template without one
|
|
55
|
+
* would hand every page somebody else's origin, quietly.
|
|
56
56
|
*/
|
|
57
57
|
export function templateOrigin(template) {
|
|
58
58
|
const href = /<link[^>]*rel="canonical"[^>]*href="([^"]*)"/.exec(template)?.[1] ??
|
|
@@ -94,8 +94,8 @@ export function sitemapXml(entries) {
|
|
|
94
94
|
` xmlns:xhtml="http://www.w3.org/1999/xhtml">\n${urls}\n</urlset>\n`);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* `sitemap.xml` for a single-language site, straight from the registry
|
|
98
|
-
* the reason a registry exists: the sitemap can never drift from the routes the app serves.
|
|
97
|
+
* `sitemap.xml` for a single-language site, straight from the registry. This is the common case,
|
|
98
|
+
* and the reason a registry exists: the sitemap can never drift from the routes the app serves.
|
|
99
99
|
*
|
|
100
100
|
* A localized site walks its own locales and calls {@link sitemapXml}, because only it knows
|
|
101
101
|
* how an address carries a language.
|
package/dist/sitemap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB;IACxC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO,CAAC;AAC3D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"sit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AChC,OAAO,UAAU,CACf,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,IAAI,CAAC,eAAe;QAChC,uFAAuF;QACvF,kEAAkE;QAClE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAClC,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC;KAC1C,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC;AAiBD,MAAM,UAAU,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,EAAiB;IAC1E,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,CACL,2BAA2B;QAC3B,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,IAAI;QACJ,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
package/dist/theme.d.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* It lives behind its own subpath because it imports the controller, and that module imports
|
|
6
6
|
* React. The barrel stays free of React so a script that only wants a sitemap does not load it.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* `prePaintScript`'s, and that module says why. What is particular to the theme:
|
|
8
|
+
* `prePaintScript` owns the delivery: a hashed same-origin file and one classic `<script src>`, never inline, and that module says why. What is particular to the theme:
|
|
10
9
|
*
|
|
11
10
|
* - **Not hand-written.** The file is `startTheme`'s own source, called with your options. The
|
|
12
11
|
* script that paints first and the controller the app talks to cannot disagree, because they
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAEzD"}
|
package/dist/theme.js
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* It lives behind its own subpath because it imports the controller, and that module imports
|
|
6
6
|
* React. The barrel stays free of React so a script that only wants a sitemap does not load it.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* `prePaintScript`'s, and that module says why. What is particular to the theme:
|
|
8
|
+
* `prePaintScript` owns the delivery: a hashed same-origin file and one classic `<script src>`, never inline, and that module says why. What is particular to the theme:
|
|
10
9
|
*
|
|
11
10
|
* - **Not hand-written.** The file is `startTheme`'s own source, called with your options. The
|
|
12
11
|
* script that paints first and the controller the app talks to cannot disagree, because they
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAqB,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,2FAA2F;AAC3F,MAAM,UAAU,iBAAiB,CAAC,OAAqB;IACrD,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,OAAqB;IAC/C,OAAO,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AACjG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gusnips/vite",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.37",
|
|
4
4
|
"description": "The build-time half of a prerendered Vite SPA: head baking, sitemap, robots, the prerender driver, a shared vite preset, and the translation catalog check.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"release:major": "bun pm version major && bun publish --access public"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@gusnips/react": "0.9.
|
|
76
|
+
"@gusnips/react": "0.9.26"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@tailwindcss/cli": "^4",
|
package/src/catalog.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build-time i18n: one string out of a raw locale catalog, by dotted key.
|
|
3
3
|
*
|
|
4
|
-
* The prerender reads the SAME JSON the app initializes i18next from, without initializing
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The prerender reads the SAME JSON the app initializes i18next from, without initializing i18next.
|
|
5
|
+
* A localized build renders every language in one process, and a singleton would race on `lng`. So
|
|
6
|
+
* this is deliberately not a translator: no plurals, no interpolation, no fallback chain. A
|
|
7
|
+
* `<title>` is one string, and every donor that needed one wrote exactly this function.
|
|
8
8
|
*
|
|
9
|
-
* A miss returns the KEY. That
|
|
10
|
-
* tab and in a search result — instead of an empty tag nobody notices.
|
|
9
|
+
* A miss returns the KEY. That makes a stale key visible as `seo.old.title` in a tab or search result instead of an empty tag nobody notices.
|
|
11
10
|
*
|
|
12
11
|
* `hasOwnProperty` and not `in`: `in` walks the prototype, so `faq.constructor.name` resolves to
|
|
13
12
|
* `"Object"` and ships as a page title. Both donor copies used `in` and neither had noticed.
|
package/src/contrast.ts
CHANGED
|
@@ -334,7 +334,7 @@ async function checkBundle(
|
|
|
334
334
|
problem({
|
|
335
335
|
rule: "floor",
|
|
336
336
|
message:
|
|
337
|
-
`${mode}: cannot measure ${token} on ${against}
|
|
337
|
+
`${mode}: cannot measure ${token} on ${against}, because one of them is no longer a ` +
|
|
338
338
|
`hex colour. Keep the values hex, or teach this check the new notation; ` +
|
|
339
339
|
`do not let the floor go unmeasured.`,
|
|
340
340
|
});
|
|
@@ -357,7 +357,7 @@ async function checkBundle(
|
|
|
357
357
|
if (!dark.has(name))
|
|
358
358
|
problem({
|
|
359
359
|
rule: "rebind",
|
|
360
|
-
message: `\`${name}\` is missing from the .dark block
|
|
360
|
+
message: `\`${name}\` is missing from the .dark block, so one mode keeps the light value`,
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
363
|
// A fill chosen against a white page lands on the 3:1 line on a near-black card instead of
|
|
@@ -369,7 +369,7 @@ async function checkBundle(
|
|
|
369
369
|
problem({
|
|
370
370
|
rule: "retune",
|
|
371
371
|
message:
|
|
372
|
-
`--color-primary (${day}) is the same fill in both modes
|
|
372
|
+
`--color-primary (${day}) is the same fill in both modes. Lift it for dark, and ` +
|
|
373
373
|
`flip --color-primary-foreground with it`,
|
|
374
374
|
});
|
|
375
375
|
}
|
|
@@ -406,7 +406,7 @@ async function checkBundle(
|
|
|
406
406
|
class: cls,
|
|
407
407
|
at: firstAt(scanned, cls),
|
|
408
408
|
message:
|
|
409
|
-
"compiled to no rule
|
|
409
|
+
"compiled to no rule: a token Tailwind does not have, or a class built dynamically",
|
|
410
410
|
});
|
|
411
411
|
continue;
|
|
412
412
|
}
|
|
@@ -425,7 +425,7 @@ async function checkBundle(
|
|
|
425
425
|
rule: "untokened",
|
|
426
426
|
class: cls,
|
|
427
427
|
at: `${file}:${String(line)}`,
|
|
428
|
-
message: `paints ${prop} with a literal colour
|
|
428
|
+
message: `paints ${prop} with a literal colour. Point it at a theme token instead`,
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
continue;
|
|
@@ -438,8 +438,8 @@ async function checkBundle(
|
|
|
438
438
|
class: cls,
|
|
439
439
|
at: `${file}:${String(line)}`,
|
|
440
440
|
message:
|
|
441
|
-
`paints ${prop} from \`${token}\`, which the theme never declares
|
|
442
|
-
`
|
|
441
|
+
`paints ${prop} from \`${token}\`, which the theme never declares. ` +
|
|
442
|
+
`A default-palette rung reads right in one mode and vanishes in the other`,
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
}
|
|
@@ -457,7 +457,7 @@ async function checkBundle(
|
|
|
457
457
|
class: variant,
|
|
458
458
|
at: firstAt(scanned, variant),
|
|
459
459
|
message:
|
|
460
|
-
`paints the same ${base} the base state already has
|
|
460
|
+
`paints the same ${base} the base state already has, so the state changes nothing. ` +
|
|
461
461
|
`If these are on different elements, ignore this.`,
|
|
462
462
|
});
|
|
463
463
|
}
|