@cloudhal/astro-renderer 0.3.11 → 0.3.12
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/src/locales.d.ts +1 -7
- package/dist/src/locales.js +3 -18
- package/package.json +6 -6
package/dist/src/locales.d.ts
CHANGED
|
@@ -11,8 +11,7 @@ import type { HeadMeta } from "./seo.js";
|
|
|
11
11
|
import type { GraphSource } from "./source.js";
|
|
12
12
|
/** `<html dir>` for a locale. Kurdish written in Latin (`ku-Latn`) is the one exception handled. */
|
|
13
13
|
export declare function textDirection(locale: string): "ltr" | "rtl";
|
|
14
|
-
|
|
15
|
-
export declare function localeRouting(site: Site): Routing;
|
|
14
|
+
export { localeRouting, localeUrl, localizedPath } from "@cloudhal/core-ts/locale-paths";
|
|
16
15
|
/** The locale a host serves on its own (`localization.domains`), if any. */
|
|
17
16
|
export declare function hostLocale(site: Site, host: string): string | undefined;
|
|
18
17
|
export interface LocaleRequest {
|
|
@@ -29,10 +28,6 @@ export interface LocaleRequest {
|
|
|
29
28
|
* redirect to the canonical URL; a locale served by its own domain is never a prefix.
|
|
30
29
|
*/
|
|
31
30
|
export declare function localeRequest(site: Site, host: string, path: string): LocaleRequest;
|
|
32
|
-
/** A graph path as a URL path of `locale` on the site's own host (no domain mapping). */
|
|
33
|
-
export declare function localizedPath(site: Site, locale: string, path: string): string;
|
|
34
|
-
/** The absolute URL of a graph path in `locale`: its own domain when it has one. */
|
|
35
|
-
export declare function localeUrl(site: Site, locale: string, path: string, origin: string): string;
|
|
36
31
|
/** One language version of a page or entry for `hreflang` and the language switcher. */
|
|
37
32
|
export interface Alternate {
|
|
38
33
|
/** BCP 47 locale, or `x-default`. */
|
|
@@ -84,4 +79,3 @@ export declare function localizeHead(meta: HeadMeta, site: Site, input: {
|
|
|
84
79
|
alternates: readonly Alternate[];
|
|
85
80
|
translation?: Localized["translation"];
|
|
86
81
|
}): HeadMeta;
|
|
87
|
-
export {};
|
package/dist/src/locales.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { entryPath, termSlug } from "@cloudhal/core-ts";
|
|
11
|
+
import { localeRouting, localeUrl, localizedPath } from "@cloudhal/core-ts/locale-paths";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -36,11 +37,8 @@ export function textDirection(locale ) {
|
|
|
36
37
|
return RTL.has(language) ? "rtl" : "ltr";
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export function localeRouting(site ) {
|
|
42
|
-
return site.localization?.routing ?? "prefix-except-default";
|
|
43
|
-
}
|
|
40
|
+
// The URL helpers live in core-ts (Studio builds the same addresses); re-exported unchanged.
|
|
41
|
+
export { localeRouting, localeUrl, localizedPath } from "@cloudhal/core-ts/locale-paths";
|
|
44
42
|
|
|
45
43
|
/** The locale a host serves on its own (`localization.domains`), if any. */
|
|
46
44
|
export function hostLocale(site , host ) {
|
|
@@ -89,19 +87,6 @@ export function localeRequest(site , host , path )
|
|
|
89
87
|
return { locale: site.defaultLocale, path };
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
/** A graph path as a URL path of `locale` on the site's own host (no domain mapping). */
|
|
93
|
-
export function localizedPath(site , locale , path ) {
|
|
94
|
-
const prefixed = localeRouting(site) === "prefix-all" || locale !== site.defaultLocale;
|
|
95
|
-
if (!prefixed) return path;
|
|
96
|
-
return path === "/" ? `/${locale}` : `/${locale}${path}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** The absolute URL of a graph path in `locale`: its own domain when it has one. */
|
|
100
|
-
export function localeUrl(site , locale , path , origin ) {
|
|
101
|
-
const domain = site.localization?.domains?.[locale];
|
|
102
|
-
return domain ? `https://${domain}${path}` : `${origin}${localizedPath(site, locale, path)}`;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
90
|
/** One language version of a page or entry for `hreflang` and the language switcher. */
|
|
106
91
|
|
|
107
92
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudhal/astro-renderer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Render a Cloudhal Site Graph with Astro: data sources (live/snapshot), section components and the cloudhal() integration",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://cloudhal.dev",
|
|
@@ -179,14 +179,14 @@
|
|
|
179
179
|
"README.md"
|
|
180
180
|
],
|
|
181
181
|
"dependencies": {
|
|
182
|
-
"@cloudhal/core-contracts": "0.3.
|
|
183
|
-
"@cloudhal/core-ts": "0.3.
|
|
184
|
-
"@cloudhal/storage": "0.3.
|
|
182
|
+
"@cloudhal/core-contracts": "0.3.12",
|
|
183
|
+
"@cloudhal/core-ts": "0.3.12",
|
|
184
|
+
"@cloudhal/storage": "0.3.12",
|
|
185
185
|
"marked": "^18.1.0",
|
|
186
186
|
"parse5": "8.0.1",
|
|
187
|
-
"@cloudhal/analytics": "0.3.
|
|
187
|
+
"@cloudhal/analytics": "0.3.12",
|
|
188
188
|
"vite": "^8.3.3",
|
|
189
|
-
"@cloudhal/comments": "0.3.
|
|
189
|
+
"@cloudhal/comments": "0.3.12"
|
|
190
190
|
},
|
|
191
191
|
"peerDependencies": {
|
|
192
192
|
"astro": "^7.3.0",
|