@gusnips/vite 0.8.34 → 0.8.36

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.
Files changed (57) hide show
  1. package/README.md +20 -20
  2. package/dist/catalog.d.ts +5 -6
  3. package/dist/catalog.d.ts.map +1 -1
  4. package/dist/catalog.js +5 -6
  5. package/dist/catalog.js.map +1 -1
  6. package/dist/contrast.js +8 -8
  7. package/dist/contrast.js.map +1 -1
  8. package/dist/head.d.ts +35 -36
  9. package/dist/head.d.ts.map +1 -1
  10. package/dist/head.js +20 -20
  11. package/dist/head.js.map +1 -1
  12. package/dist/i18n.d.ts +8 -7
  13. package/dist/i18n.d.ts.map +1 -1
  14. package/dist/i18n.js +5 -4
  15. package/dist/i18n.js.map +1 -1
  16. package/dist/icons.d.ts +6 -6
  17. package/dist/icons.d.ts.map +1 -1
  18. package/dist/icons.js +2 -2
  19. package/dist/icons.js.map +1 -1
  20. package/dist/index.d.ts +7 -7
  21. package/dist/index.js +7 -7
  22. package/dist/node.d.ts +24 -25
  23. package/dist/node.d.ts.map +1 -1
  24. package/dist/node.js +26 -26
  25. package/dist/node.js.map +1 -1
  26. package/dist/og.d.ts +7 -7
  27. package/dist/og.d.ts.map +1 -1
  28. package/dist/og.js +2 -2
  29. package/dist/og.js.map +1 -1
  30. package/dist/pre-paint.d.ts +3 -3
  31. package/dist/preset.d.ts +9 -9
  32. package/dist/preset.js +3 -3
  33. package/dist/render.d.ts +9 -9
  34. package/dist/render.js +4 -4
  35. package/dist/render.js.map +1 -1
  36. package/dist/sitemap.d.ts +26 -27
  37. package/dist/sitemap.d.ts.map +1 -1
  38. package/dist/sitemap.js +18 -18
  39. package/dist/sitemap.js.map +1 -1
  40. package/dist/theme.d.ts +1 -2
  41. package/dist/theme.d.ts.map +1 -1
  42. package/dist/theme.js +1 -2
  43. package/dist/theme.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/catalog.ts +5 -6
  46. package/src/contrast.ts +8 -8
  47. package/src/head.ts +36 -37
  48. package/src/i18n.ts +8 -7
  49. package/src/icons.ts +7 -7
  50. package/src/index.ts +7 -7
  51. package/src/node.ts +28 -29
  52. package/src/og.ts +8 -8
  53. package/src/pre-paint.ts +3 -3
  54. package/src/preset.ts +9 -9
  55. package/src/render.ts +10 -10
  56. package/src/sitemap.ts +27 -28
  57. package/src/theme.ts +1 -2
package/src/sitemap.ts CHANGED
@@ -12,19 +12,19 @@ import type { Alternate } from "./head.ts";
12
12
  /**
13
13
  * Where a rendered page lands.
14
14
  *
15
- * FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves
16
- * the directory form at `/pricing/` and answers `/pricing` with a 308 to it — so every address
17
- * the app advertises in its canonical and its sitemap would be a redirect rather than a page.
18
- * A flat file answers `/pricing` — the address the canonical and the sitemap name — with a 200,
19
- * and normalizes `/pricing/` to it with a 308.
15
+ * FLAT (`pricing.html`), not directory-style (`pricing/index.html`). Cloudflare Pages serves the
16
+ * directory form at `/pricing/` and answers `/pricing` with a 308 to it, so every address the app
17
+ * advertises in its canonical and its sitemap would be a redirect rather than a page. A flat file
18
+ * answers the advertised `/pricing` address with a 200, and normalizes `/pricing/` to it with a
19
+ * 308.
20
20
  *
21
21
  * This said "200 either way" until somebody measured it. On a live Pages deployment `/precos/`
22
- * answers `308` with `location: /precos`, which then answers 200. The rule is untouched by that
23
- * — the ADVERTISED form is the one that must be a page, and it is — but the parenthetical was
24
- * inherited from a donor comment and repeated into an adopter's commit message as a live bug
25
- * before anyone checked. It also has a consequence worth knowing: on a host that normalizes,
26
- * `hydrateOrMount`'s slash tolerance can never fire, because the browser is redirected before it
27
- * runs. That tolerance earns its place on hosts that serve both forms, not on this one.
22
+ * answers `308` with `location: /precos`, which then answers 200. The rule is untouched: the
23
+ * ADVERTISED form is the one that must be a page, and it is. But the parenthetical was inherited
24
+ * from a donor comment and repeated into an adopter's commit message as a live bug before anyone
25
+ * checked. It also has a consequence worth knowing: on a host that normalizes, `hydrateOrMount`'s
26
+ * slash tolerance can never fire, because the browser is redirected before it runs. That tolerance
27
+ * earns its place on hosts that serve both forms, not on this one.
28
28
  *
29
29
  * That is Cloudflare Pages, not every host. Firebase Hosting serves the directory form at
30
30
  * `/pricing` itself with `trailingSlash: false`, and an adopter there names its own files. What
@@ -49,7 +49,7 @@ export function pageFile(routePath: string): string {
49
49
  export function siteOrigin(url: string): string {
50
50
  if (!/^https?:\/\/[^/]+/.test(url))
51
51
  throw new Error(
52
- `prerender: "${url}" is not an absolute origin — it needs a scheme, as in https://example.com`,
52
+ `prerender: "${url}" is not an absolute origin. It needs a scheme, as in https://example.com`,
53
53
  );
54
54
  return url.replace(/\/+$/, "");
55
55
  }
@@ -57,10 +57,10 @@ export function siteOrigin(url: string): string {
57
57
  /**
58
58
  * The origin the template already declares, read out of its canonical.
59
59
  *
60
- * One file is the answer for the head Vite ships and for every file written after it, so there
61
- * is no second place for a domain to drift to — no env var the script has to resolve beside
62
- * it. Demanded rather than defaulted, for the reason `bakeHead` demands the tag: a template
63
- * without one would hand every page somebody else's origin, quietly.
60
+ * One file is the answer for the head Vite ships and for every file written after it, so there is
61
+ * no second place for a domain to drift to and no env var the script has to resolve beside it.
62
+ * Demanded rather than defaulted, for the reason `bakeHead` demands the tag: a template without one
63
+ * would hand every page somebody else's origin, quietly.
64
64
  */
65
65
  export function templateOrigin(template: string): string {
66
66
  const href =
@@ -77,11 +77,11 @@ export function templateOrigin(template: string): string {
77
77
  * The three things about a public page that do not translate: where it is, how often it
78
78
  * changes, and how it ranks against its siblings.
79
79
  *
80
- * A product's registry extends this with its own copy fields — one donor names an i18n key per
81
- * page, another keys its locale catalogs by `pageSlug` and stores no copy here at all. Where
82
- * the copy lives is the product's call. These three are what a sitemap needs from every one of
83
- * them, and the registry is the single source the prerender, the sitemap and the share cards
84
- * all walk, so a page can never be in one and missing from another.
80
+ * A product's registry extends this with its own copy fields. One donor names an i18n key per page,
81
+ * another keys its locale catalogs by `pageSlug` and stores no copy here at all. Where the copy
82
+ * lives is the product's call. These three are what a sitemap needs from every one of them, and the
83
+ * registry is the single source the prerender, the sitemap and the share cards all walk, so a page
84
+ * can never be in one and missing from another.
85
85
  */
86
86
  export interface PublicPage {
87
87
  path: string;
@@ -105,7 +105,7 @@ export function ogImagePath(path: string): string {
105
105
  export interface SitemapEntry {
106
106
  loc: string;
107
107
  changefreq: string;
108
- /** Already formatted — an app ranks its own pages, and that rule does not belong here. */
108
+ /** Already formatted, because an app ranks its own pages, and that rule does not belong here. */
109
109
  priority: string;
110
110
  /** `YYYY-MM-DD`. The one hint in a sitemap Google actually reads. One date for the whole
111
111
  * build is the honest answer: these pages ship together. */
@@ -144,8 +144,8 @@ export function sitemapXml(entries: readonly SitemapEntry[]): string {
144
144
  }
145
145
 
146
146
  /**
147
- * `sitemap.xml` for a single-language site, straight from the registry — the common case, and
148
- * the reason a registry exists: the sitemap can never drift from the routes the app serves.
147
+ * `sitemap.xml` for a single-language site, straight from the registry. This is the common case,
148
+ * and the reason a registry exists: the sitemap can never drift from the routes the app serves.
149
149
  *
150
150
  * A localized site walks its own locales and calls {@link sitemapXml}, because only it knows
151
151
  * how an address carries a language.
@@ -166,17 +166,16 @@ export function sitemapFor(origin: string, pages: readonly PublicPage[], lastmod
166
166
 
167
167
  export interface RobotsOptions {
168
168
  /** The origin this file is served from. Every sitemap path is resolved against it, so the
169
- * file can never advertise a host it is not on — a mistake one donor is still shipping,
169
+ * file can never advertise a host it is not on. One donor still ships that mistake,
170
170
  * where a static `robots.txt` and the build's fallback name different domains. */
171
171
  origin: string;
172
172
  /** Every sitemap on this ORIGIN, as paths (`/sitemap.xml`, `/docs/sitemap.xml`).
173
173
  *
174
174
  * A crawler reads only the robots.txt at the origin root. An app served from a
175
- * subdirectory therefore cannot ship its own — the one file at the root has to list its
175
+ * subdirectory therefore cannot ship its own. The one file at the root has to list its
176
176
  * sitemap too, or nothing ever finds it. */
177
177
  sitemaps: readonly string[];
178
- /** Paths to keep out of every index. A page nobody should be able to find by searching —
179
- * a per-request status page, an unsubscribe link — belongs here AND in `noindex`. */
178
+ /** 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`. */
180
179
  disallow?: readonly string[];
181
180
  }
182
181
 
package/src/theme.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
- * The delivery — a hashed same-origin file and one classic `<script src>`, never inline — is
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