@justai/cuts 0.129.7 → 0.130.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 +1 -1
- package/src/Base.astro +40 -3
package/package.json
CHANGED
package/src/Base.astro
CHANGED
|
@@ -54,8 +54,21 @@ interface Props {
|
|
|
54
54
|
* rather than narrowed to a shape only this package would recognise.
|
|
55
55
|
*/
|
|
56
56
|
t: Record<string, unknown>;
|
|
57
|
-
/**
|
|
58
|
-
|
|
57
|
+
/**
|
|
58
|
+
* DEPRECATED — declare the origin in astro.config.mjs (`site:`) and stop passing this.
|
|
59
|
+
*
|
|
60
|
+
* The origin now comes from `Astro.site`, which every persona already has to declare for the
|
|
61
|
+
* build. Passing it here as well is the second declaration site this docstring warns about
|
|
62
|
+
* twenty lines above, and it went wrong exactly the way the locale list did: compress-image was
|
|
63
|
+
* copied from cleanmylink and shipped with cleanmylink's origin in this prop while its
|
|
64
|
+
* astro.config was correct. For a day, canonical, og:site_name and all fourteen hreflang hrefs
|
|
65
|
+
* named another product — while og:url and og:image, three lines apart in the same head, read
|
|
66
|
+
* `Astro.site` and were right. One head, two truths, and nothing said so.
|
|
67
|
+
*
|
|
68
|
+
* Still accepted so no persona has to change on the same day this ships; it is now checked
|
|
69
|
+
* rather than trusted, and a build where the two disagree fails.
|
|
70
|
+
*/
|
|
71
|
+
site?: string;
|
|
59
72
|
/** From the consuming repo's src/i18n — never from this package. */
|
|
60
73
|
locales: readonly string[];
|
|
61
74
|
defaultLocale: string;
|
|
@@ -87,13 +100,37 @@ interface Props {
|
|
|
87
100
|
}
|
|
88
101
|
|
|
89
102
|
const {
|
|
90
|
-
lang, t, site, locales, defaultLocale, favicon,
|
|
103
|
+
lang, t, site: siteProp, locales, defaultLocale, favicon,
|
|
91
104
|
themeDark,
|
|
92
105
|
themeLight,
|
|
93
106
|
gaId = "G-13L3BP6XCW",
|
|
94
107
|
kind = "app",
|
|
95
108
|
} = Astro.props;
|
|
96
109
|
|
|
110
|
+
// ── ONE HOME FOR THE ORIGIN ───────────────────────────────────────────────────────────────────
|
|
111
|
+
// queries: canonical yanlış · başka personanın alan adı · site prop · hreflang yanlış domain
|
|
112
|
+
//
|
|
113
|
+
// A wrong origin renders perfectly. That is the whole difficulty: nothing is red, the page is
|
|
114
|
+
// valid, and the only symptom is search engines being told this page belongs to someone else.
|
|
115
|
+
// The failure has to be moved to a place where it CANNOT be quiet, and a static build is the one
|
|
116
|
+
// place available — so a disagreement is an error, not a warning. A warning in a build log is the
|
|
117
|
+
// same silence with more steps.
|
|
118
|
+
const site = Astro.site?.origin ?? siteProp;
|
|
119
|
+
if (!site) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
"[@justai/cuts] No origin. Declare it once, in astro.config.mjs:\n" +
|
|
122
|
+
' export default personaConfig({ site: "https://<persona>.app.zone", ... })',
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (siteProp && Astro.site && new URL(siteProp).origin !== Astro.site.origin) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
"[@justai/cuts] Two origins, and they disagree:\n" +
|
|
128
|
+
` astro.config.mjs ${Astro.site.origin}\n` +
|
|
129
|
+
` <Base site=…> ${new URL(siteProp).origin}\n` +
|
|
130
|
+
"astro.config wins — it is what the sitemap, the build and og:url already use. Drop the prop.",
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
97
134
|
// queries: theme-color · a grey band under the game on iPhone · Safari's bottom bar colour ·
|
|
98
135
|
// the browser chrome does not match the game · game persona theme colour
|
|
99
136
|
//
|