@easy-web/i18n 1.3.3 → 1.4.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/README.md +9 -143
- package/dist/index.d.ts +46 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/dist/factory.d.ts +0 -27
- package/dist/factory.d.ts.map +0 -1
- package/dist/factory.js +0 -38
- package/dist/factory.js.map +0 -1
- package/dist/formatters.d.ts +0 -6
- package/dist/formatters.d.ts.map +0 -1
- package/dist/formatters.js +0 -44
- package/dist/formatters.js.map +0 -1
- package/dist/localized-paths.d.ts +0 -80
- package/dist/localized-paths.d.ts.map +0 -1
- package/dist/localized-paths.js +0 -124
- package/dist/localized-paths.js.map +0 -1
- package/dist/routing.d.ts +0 -24
- package/dist/routing.d.ts.map +0 -1
- package/dist/routing.js +0 -38
- package/dist/routing.js.map +0 -1
- package/dist/seo.d.ts +0 -28
- package/dist/seo.d.ts.map +0 -1
- package/dist/seo.js +0 -81
- package/dist/seo.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,145 +1,11 @@
|
|
|
1
|
-
# @easy-web/i18n
|
|
1
|
+
# @easy-web/i18n (deprecated)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package is a compatibility layer. The localization helpers now live in [`@easy-web/core`](../core/README.md). Every export keeps working and re-exports the core implementation unchanged, but new code should import from `@easy-web/core/i18n`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Quick start
|
|
14
|
-
|
|
15
|
-
Create a central i18n instance using the factory. This ensures consistency across your routing, SEO, and formatting.
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { createI18n } from '@easy-web/i18n';
|
|
19
|
-
|
|
20
|
-
export const i18n = createI18n({
|
|
21
|
-
locales: ['de', 'en'] as const,
|
|
22
|
-
defaultLocale: 'de',
|
|
23
|
-
baseUrl: 'https://dev.ismaili.de'
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Paraglide setup
|
|
28
|
-
|
|
29
|
-
This library works alongside [Paraglide-JS](https://inlang.com/m/gerre34r/library-inlang-paraglideJs).
|
|
30
|
-
|
|
31
|
-
1. Initialize paraglide in your project.
|
|
32
|
-
2. Store your translation files in `messages/{locale}.json` (e.g., `messages/de.json`, `messages/en.json`).
|
|
33
|
-
3. Commit the generated paraglide output to git to ensure reliable builds.
|
|
34
|
-
|
|
35
|
-
## Astro config
|
|
36
|
-
|
|
37
|
-
Use the factory output to configure Astro's native i18n settings in `astro.config.mjs`:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { defineConfig } from 'astro/config';
|
|
41
|
-
import { i18n } from './src/lib/i18n'; // path to your factory instance
|
|
42
|
-
|
|
43
|
-
export default defineConfig({
|
|
44
|
-
i18n: {
|
|
45
|
-
locales: i18n.locales,
|
|
46
|
-
defaultLocale: i18n.defaultLocale,
|
|
47
|
-
routing: {
|
|
48
|
-
prefixDefaultLocale: false
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Intl formatters
|
|
55
|
-
|
|
56
|
-
The factory provides type-safe wrappers around standard `Intl` formatters.
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
const { format } = i18n;
|
|
60
|
-
const locale = 'de';
|
|
61
|
-
|
|
62
|
-
format.date(locale, new Date());
|
|
63
|
-
format.number(locale, 1234.56);
|
|
64
|
-
format.currency(locale, 99.99, 'EUR');
|
|
65
|
-
format.relativeTime(locale, -1, 'day');
|
|
66
|
-
format.list(locale, ['Apfel', 'Birne', 'Banane']);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## SEO hreflang
|
|
70
|
-
|
|
71
|
-
Automatically generate alternate links for your head section.
|
|
72
|
-
|
|
73
|
-
```astro
|
|
74
|
-
---
|
|
75
|
-
// BaseLayout.astro
|
|
76
|
-
import { i18n } from '../lib/i18n';
|
|
77
|
-
const links = i18n.getAlternateLinks(Astro.url.pathname);
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
<head>
|
|
81
|
-
{links.map(link => (
|
|
82
|
-
<link rel="alternate" hreflang={link.hreflang} href={link.href} />
|
|
83
|
-
))}
|
|
84
|
-
<link rel="canonical" href={i18n.getCanonicalUrl(Astro.url.pathname, Astro.currentLocale)} />
|
|
85
|
-
</head>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Routes whose slug differs per locale
|
|
89
|
-
|
|
90
|
-
By default alternates are derived by re-prefixing the current path, which
|
|
91
|
-
assumes the slug is identical in every locale. When it is not — DE
|
|
92
|
-
`/datenschutz/` versus EN `/en/privacy/` — that derivation produces
|
|
93
|
-
`/en/datenschutz/`, a URL that does not exist. Declare such routes:
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
export const i18n = createI18n({
|
|
97
|
-
locales: ['de', 'en'] as const,
|
|
98
|
-
defaultLocale: 'de',
|
|
99
|
-
baseUrl: 'https://dev.ismaili.de',
|
|
100
|
-
localizedPaths: [
|
|
101
|
-
{ de: '/datenschutz/', en: '/en/privacy/' },
|
|
102
|
-
{ de: '/kontakt/', en: '/en/contact/' },
|
|
103
|
-
],
|
|
104
|
-
});
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Matching ignores trailing slashes, query strings and hashes. Routes sharing a
|
|
108
|
-
slug across locales need no entry. `x-default` points at the default-locale
|
|
109
|
-
member of the group, and a locale absent from a group is omitted rather than
|
|
110
|
-
guessed.
|
|
111
|
-
|
|
112
|
-
Pass the same groups to `easyWebSeo()` from `@easy-web/seo` so the sitemap and
|
|
113
|
-
the page `<head>` agree — declare them once in a shared module and import it
|
|
114
|
-
into both.
|
|
115
|
-
|
|
116
|
-
### URL form
|
|
117
|
-
|
|
118
|
-
`getCanonicalUrl` and `getAlternateLinks` emit the URL form the site actually
|
|
119
|
-
serves, so the canonical and the self-referencing hreflang always match. The
|
|
120
|
-
default is a trailing slash, matching Astro's `directory` build output. Pass
|
|
121
|
-
`trailingSlash: 'never'` if the instance uses `build.format: 'file'`:
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
export const i18n = createI18n({
|
|
125
|
-
locales: ['de', 'en'] as const,
|
|
126
|
-
defaultLocale: 'de',
|
|
127
|
-
baseUrl: 'https://dev.ismaili.de',
|
|
128
|
-
trailingSlash: 'never',
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Callers may pass `/about` or `/about/` — the emitted URL is identical either way.
|
|
133
|
-
|
|
134
|
-
## Migration from v0.1
|
|
135
|
-
|
|
136
|
-
| v0.1 Primitive | v0.3 Factory (Recommended) | v0.3 Primitive |
|
|
137
|
-
| :--- | :--- | :--- |
|
|
138
|
-
| `localizedHref('/about', 'en')` | `i18n.localizedHref('/about', 'en')` | `localizedHref({path, locale, defaultLocale})` |
|
|
139
|
-
| `getLocaleFromPath(pathname)` | `i18n.getLocaleFromPath(pathname)` | `getLocaleFromPath({pathname, locales, defaultLocale})` |
|
|
140
|
-
|
|
141
|
-
Note: The `SupportedLocale` type is removed. Use the generic `L` inferred from the `createI18n` config.
|
|
142
|
-
|
|
143
|
-
## SSR caveat
|
|
144
|
-
|
|
145
|
-
`@easy-web/i18n` does not support SSR features like `Accept-Language` header detection or middleware. It is designed for static-prerender deployments on Azure Static Web Apps.
|
|
5
|
+
| Old import | New import |
|
|
6
|
+
| :--- | :--- |
|
|
7
|
+
| `import { createI18n, type I18nConfig } from '@easy-web/i18n'` | `import { createI18n, type I18nConfig } from '@easy-web/core/i18n'` |
|
|
8
|
+
| `import { formatDate, formatNumber, formatRelativeTime, formatList, formatCurrency } from '@easy-web/i18n'` | `import { ... } from '@easy-web/core/i18n'` |
|
|
9
|
+
| `import { localizedHref, getLocaleFromPath, getAlternateLinks, getCanonicalUrl } from '@easy-web/i18n'` | `import { ... } from '@easy-web/core/i18n'` |
|
|
10
|
+
| `import { toServedPath, ambientTrailingSlash, normalizeLocalizedPath, findLocalizedGroup, validateLocalizedPaths, stripQueryAndHash } from '@easy-web/i18n'` | `import { ... } from '@easy-web/core/i18n'` |
|
|
11
|
+
| `import type { LocalizedPathGroup, TrailingSlash, AlternateLink } from '@easy-web/i18n'` | `import type { ... } from '@easy-web/core/i18n'` |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @easy-web/i18n is a compatibility package. Everything it exports now lives
|
|
3
|
+
* in `@easy-web/core/i18n`; each symbol is re-exported here as a `@deprecated`
|
|
4
|
+
* alias so editors flag the old import path.
|
|
5
|
+
*/
|
|
6
|
+
import { ambientTrailingSlash as coreAmbientTrailingSlash, createI18n as coreCreateI18n, findLocalizedGroup as coreFindLocalizedGroup, formatCurrency as coreFormatCurrency, formatDate as coreFormatDate, formatList as coreFormatList, formatNumber as coreFormatNumber, formatRelativeTime as coreFormatRelativeTime, getAlternateLinks as coreGetAlternateLinks, getCanonicalUrl as coreGetCanonicalUrl, getLocaleFromPath as coreGetLocaleFromPath, localizedHref as coreLocalizedHref, normalizeLocalizedPath as coreNormalizeLocalizedPath, stripQueryAndHash as coreStripQueryAndHash, toServedPath as coreToServedPath, validateLocalizedPaths as coreValidateLocalizedPaths, type AlternateLink as CoreAlternateLink, type I18nConfig as CoreI18nConfig, type LocalizedPathGroup as CoreLocalizedPathGroup, type TrailingSlash as CoreTrailingSlash } from '@easy-web/core/i18n';
|
|
7
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
8
|
+
export declare const createI18n: typeof coreCreateI18n;
|
|
9
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
10
|
+
export declare const formatDate: typeof coreFormatDate;
|
|
11
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
12
|
+
export declare const formatNumber: typeof coreFormatNumber;
|
|
13
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
14
|
+
export declare const formatRelativeTime: typeof coreFormatRelativeTime;
|
|
15
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
16
|
+
export declare const formatList: typeof coreFormatList;
|
|
17
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
18
|
+
export declare const formatCurrency: typeof coreFormatCurrency;
|
|
19
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
20
|
+
export declare const stripQueryAndHash: typeof coreStripQueryAndHash;
|
|
21
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
22
|
+
export declare const ambientTrailingSlash: typeof coreAmbientTrailingSlash;
|
|
23
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
24
|
+
export declare const toServedPath: typeof coreToServedPath;
|
|
25
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
26
|
+
export declare const normalizeLocalizedPath: typeof coreNormalizeLocalizedPath;
|
|
27
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
28
|
+
export declare const findLocalizedGroup: typeof coreFindLocalizedGroup;
|
|
29
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
30
|
+
export declare const validateLocalizedPaths: typeof coreValidateLocalizedPaths;
|
|
31
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
32
|
+
export declare const localizedHref: typeof coreLocalizedHref;
|
|
33
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
34
|
+
export declare const getLocaleFromPath: typeof coreGetLocaleFromPath;
|
|
35
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
36
|
+
export declare const getAlternateLinks: typeof coreGetAlternateLinks;
|
|
37
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
38
|
+
export declare const getCanonicalUrl: typeof coreGetCanonicalUrl;
|
|
39
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
40
|
+
export type I18nConfig<L extends string> = CoreI18nConfig<L>;
|
|
41
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
42
|
+
export type LocalizedPathGroup = CoreLocalizedPathGroup;
|
|
43
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
44
|
+
export type TrailingSlash = CoreTrailingSlash;
|
|
45
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
46
|
+
export type AlternateLink = CoreAlternateLink;
|
|
6
47
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,oBAAoB,IAAI,wBAAwB,EAChD,UAAU,IAAI,cAAc,EAC5B,kBAAkB,IAAI,sBAAsB,EAC5C,cAAc,IAAI,kBAAkB,EACpC,UAAU,IAAI,cAAc,EAC5B,UAAU,IAAI,cAAc,EAC5B,YAAY,IAAI,gBAAgB,EAChC,kBAAkB,IAAI,sBAAsB,EAC5C,iBAAiB,IAAI,qBAAqB,EAC1C,eAAe,IAAI,mBAAmB,EACtC,iBAAiB,IAAI,qBAAqB,EAC1C,aAAa,IAAI,iBAAiB,EAClC,sBAAsB,IAAI,0BAA0B,EACpD,iBAAiB,IAAI,qBAAqB,EAC1C,YAAY,IAAI,gBAAgB,EAChC,sBAAsB,IAAI,0BAA0B,EACpD,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,UAAU,IAAI,cAAc,EACjC,KAAK,kBAAkB,IAAI,sBAAsB,EACjD,KAAK,aAAa,IAAI,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GED
|
@@ -1,6 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @easy-web/i18n is a compatibility package. Everything it exports now lives
|
|
3
|
+
* in `@easy-web/core/i18n`; each symbol is re-exported here as a `@deprecated`
|
|
4
|
+
* alias so editors flag the old import path.
|
|
5
|
+
*/
|
|
6
|
+
import { ambientTrailingSlash as coreAmbientTrailingSlash, createI18n as coreCreateI18n, findLocalizedGroup as coreFindLocalizedGroup, formatCurrency as coreFormatCurrency, formatDate as coreFormatDate, formatList as coreFormatList, formatNumber as coreFormatNumber, formatRelativeTime as coreFormatRelativeTime, getAlternateLinks as coreGetAlternateLinks, getCanonicalUrl as coreGetCanonicalUrl, getLocaleFromPath as coreGetLocaleFromPath, localizedHref as coreLocalizedHref, normalizeLocalizedPath as coreNormalizeLocalizedPath, stripQueryAndHash as coreStripQueryAndHash, toServedPath as coreToServedPath, validateLocalizedPaths as coreValidateLocalizedPaths, } from '@easy-web/core/i18n';
|
|
7
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
8
|
+
export const createI18n = coreCreateI18n;
|
|
9
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
10
|
+
export const formatDate = coreFormatDate;
|
|
11
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
12
|
+
export const formatNumber = coreFormatNumber;
|
|
13
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
14
|
+
export const formatRelativeTime = coreFormatRelativeTime;
|
|
15
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
16
|
+
export const formatList = coreFormatList;
|
|
17
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
18
|
+
export const formatCurrency = coreFormatCurrency;
|
|
19
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
20
|
+
export const stripQueryAndHash = coreStripQueryAndHash;
|
|
21
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
22
|
+
export const ambientTrailingSlash = coreAmbientTrailingSlash;
|
|
23
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
24
|
+
export const toServedPath = coreToServedPath;
|
|
25
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
26
|
+
export const normalizeLocalizedPath = coreNormalizeLocalizedPath;
|
|
27
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
28
|
+
export const findLocalizedGroup = coreFindLocalizedGroup;
|
|
29
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
30
|
+
export const validateLocalizedPaths = coreValidateLocalizedPaths;
|
|
31
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
32
|
+
export const localizedHref = coreLocalizedHref;
|
|
33
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
34
|
+
export const getLocaleFromPath = coreGetLocaleFromPath;
|
|
35
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
36
|
+
export const getAlternateLinks = coreGetAlternateLinks;
|
|
37
|
+
/** @deprecated Import from `@easy-web/core/i18n` instead. */
|
|
38
|
+
export const getCanonicalUrl = coreGetCanonicalUrl;
|
|
6
39
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,oBAAoB,IAAI,wBAAwB,EAChD,UAAU,IAAI,cAAc,EAC5B,kBAAkB,IAAI,sBAAsB,EAC5C,cAAc,IAAI,kBAAkB,EACpC,UAAU,IAAI,cAAc,EAC5B,UAAU,IAAI,cAAc,EAC5B,YAAY,IAAI,gBAAgB,EAChC,kBAAkB,I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,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AACvD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-web/i18n",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
"optional": false
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@easy-web/core": "1.4.0"
|
|
30
|
+
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@inlang/paraglide-js": "^2.0.0",
|
|
30
|
-
"astro": "^
|
|
33
|
+
"astro": "^7.3.5",
|
|
31
34
|
"vitest": "^3.2.4",
|
|
32
35
|
"@vitest/coverage-v8": "^3.2.4",
|
|
33
36
|
"typescript": "^5.5.0"
|
package/dist/factory.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { LocalizedPathGroup, TrailingSlash } from './localized-paths.js';
|
|
2
|
-
export interface I18nConfig<L extends string> {
|
|
3
|
-
locales: readonly L[];
|
|
4
|
-
defaultLocale: L;
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
localizedPaths?: readonly LocalizedPathGroup[];
|
|
7
|
-
/** Defaults to the form `@easy-web/seo` resolved from `astro.config.mjs`. */
|
|
8
|
-
trailingSlash?: TrailingSlash;
|
|
9
|
-
}
|
|
10
|
-
export declare function createI18n<L extends string>(cfg: I18nConfig<L>): {
|
|
11
|
-
locales: readonly L[];
|
|
12
|
-
defaultLocale: L;
|
|
13
|
-
localizedPaths: readonly Readonly<Record<string, string>>[];
|
|
14
|
-
trailingSlash: TrailingSlash;
|
|
15
|
-
localizedHref: (path: string, locale: L) => string;
|
|
16
|
-
getLocaleFromPath: (pathname: string) => L;
|
|
17
|
-
getAlternateLinks: (path: string) => import("./seo.js").AlternateLink[];
|
|
18
|
-
getCanonicalUrl: (path: string, locale: L) => string;
|
|
19
|
-
format: {
|
|
20
|
-
date: (locale: L, date: Date | number, opts?: Intl.DateTimeFormatOptions) => string;
|
|
21
|
-
number: (locale: L, value: number, opts?: Intl.NumberFormatOptions) => string;
|
|
22
|
-
relativeTime: (locale: L, value: number, unit: Intl.RelativeTimeFormatUnit, opts?: Intl.RelativeTimeFormatOptions) => string;
|
|
23
|
-
list: (locale: L, items: string[], opts?: Intl.ListFormatOptions) => string;
|
|
24
|
-
currency: (locale: L, value: number, currency: string, opts?: Omit<Intl.NumberFormatOptions, "style" | "currency">) => string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAI7E,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM;IAC1C,OAAO,EAAE,SAAS,CAAC,EAAE,CAAA;IACrB,aAAa,EAAE,CAAC,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC9C,6EAA6E;IAC7E,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;;;;;0BAQrC,MAAM,UAAU,CAAC,KAAG,MAAM;kCAElB,MAAM,KAAG,CAAC;8BAEd,MAAM;4BASR,MAAM,UAAU,CAAC,KAAG,MAAM;;uBASjC,CAAC,QAAQ,IAAI,GAAG,MAAM,SAAS,IAAI,CAAC,qBAAqB,KAAG,MAAM;yBAEhE,CAAC,SAAS,MAAM,SAAS,IAAI,CAAC,mBAAmB,KAAG,MAAM;+BAGjE,CAAC,SACF,MAAM,QACP,IAAI,CAAC,sBAAsB,SAC1B,IAAI,CAAC,yBAAyB,KACpC,MAAM;uBACM,CAAC,SAAS,MAAM,EAAE,SAAS,IAAI,CAAC,iBAAiB,KAAG,MAAM;2BAG/D,CAAC,SACF,MAAM,YACH,MAAM,SACT,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,UAAU,CAAC,KAC1D,MAAM;;EAGd"}
|
package/dist/factory.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { formatCurrency, formatDate, formatList, formatNumber, formatRelativeTime } from './formatters.js';
|
|
2
|
-
import { ambientTrailingSlash } from './localized-paths.js';
|
|
3
|
-
import { getLocaleFromPath, localizedHref } from './routing.js';
|
|
4
|
-
import { getAlternateLinks, getCanonicalUrl } from './seo.js';
|
|
5
|
-
export function createI18n(cfg) {
|
|
6
|
-
const trailingSlash = cfg.trailingSlash ?? ambientTrailingSlash();
|
|
7
|
-
return {
|
|
8
|
-
locales: cfg.locales,
|
|
9
|
-
defaultLocale: cfg.defaultLocale,
|
|
10
|
-
localizedPaths: cfg.localizedPaths ?? [],
|
|
11
|
-
trailingSlash,
|
|
12
|
-
localizedHref: (path, locale) => localizedHref({ path, locale, defaultLocale: cfg.defaultLocale }),
|
|
13
|
-
getLocaleFromPath: (pathname) => getLocaleFromPath({ pathname, locales: cfg.locales, defaultLocale: cfg.defaultLocale }),
|
|
14
|
-
getAlternateLinks: (path) => getAlternateLinks({
|
|
15
|
-
path,
|
|
16
|
-
locales: cfg.locales,
|
|
17
|
-
defaultLocale: cfg.defaultLocale,
|
|
18
|
-
baseUrl: cfg.baseUrl,
|
|
19
|
-
localizedPaths: cfg.localizedPaths,
|
|
20
|
-
trailingSlash,
|
|
21
|
-
}),
|
|
22
|
-
getCanonicalUrl: (path, locale) => getCanonicalUrl({
|
|
23
|
-
path,
|
|
24
|
-
locale,
|
|
25
|
-
defaultLocale: cfg.defaultLocale,
|
|
26
|
-
baseUrl: cfg.baseUrl,
|
|
27
|
-
trailingSlash,
|
|
28
|
-
}),
|
|
29
|
-
format: {
|
|
30
|
-
date: (locale, date, opts) => formatDate(locale, date, opts),
|
|
31
|
-
number: (locale, value, opts) => formatNumber(locale, value, opts),
|
|
32
|
-
relativeTime: (locale, value, unit, opts) => formatRelativeTime(locale, value, unit, opts),
|
|
33
|
-
list: (locale, items, opts) => formatList(locale, items, opts),
|
|
34
|
-
currency: (locale, value, currency, opts) => formatCurrency(locale, value, currency, opts),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=factory.js.map
|
package/dist/factory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAW7D,MAAM,UAAU,UAAU,CAAmB,GAAkB;IAC7D,MAAM,aAAa,GAAG,GAAG,CAAC,aAAa,IAAI,oBAAoB,EAAE,CAAA;IAEjE,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE;QACxC,aAAa;QACb,aAAa,EAAE,CAAC,IAAY,EAAE,MAAS,EAAU,EAAE,CACjD,aAAa,CAAC,EAAE,IAAI,EAAE,MAA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gB,EAChB,IAA2D,EACnD,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC;SAC3D;KACF,CAAA;AACH,CAAC"}
|
package/dist/formatters.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function formatDate(locale: string, date: Date | number, opts?: Intl.DateTimeFormatOptions): string;
|
|
2
|
-
export declare function formatNumber(locale: string, value: number, opts?: Intl.NumberFormatOptions): string;
|
|
3
|
-
export declare function formatRelativeTime(locale: string, value: number, unit: Intl.RelativeTimeFormatUnit, opts?: Intl.RelativeTimeFormatOptions): string;
|
|
4
|
-
export declare function formatList(locale: string, items: string[], opts?: Intl.ListFormatOptions): string;
|
|
5
|
-
export declare function formatCurrency(locale: string, value: number, currency: string, opts?: Omit<Intl.NumberFormatOptions, 'style' | 'currency'>): string;
|
|
6
|
-
//# sourceMappingURL=formatters.d.ts.map
|
package/dist/formatters.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AA6BA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAEzG;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAEnG;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,CAAC,sBAAsB,EACjC,IAAI,CAAC,EAAE,IAAI,CAAC,yBAAyB,GACpC,MAAM,CAER;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAEjG;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,UAAU,CAAC,GAC1D,MAAM,CAER"}
|
package/dist/formatters.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const dateFormatCache = new Map();
|
|
2
|
-
const numberFormatCache = new Map();
|
|
3
|
-
const relativeTimeFormatCache = new Map();
|
|
4
|
-
const listFormatCache = new Map();
|
|
5
|
-
function getDateFormat(locale, opts) {
|
|
6
|
-
const key = locale + ':' + JSON.stringify(opts);
|
|
7
|
-
if (!dateFormatCache.has(key))
|
|
8
|
-
dateFormatCache.set(key, new Intl.DateTimeFormat(locale, opts));
|
|
9
|
-
return dateFormatCache.get(key);
|
|
10
|
-
}
|
|
11
|
-
function getNumberFormat(locale, opts) {
|
|
12
|
-
const key = locale + ':' + JSON.stringify(opts);
|
|
13
|
-
if (!numberFormatCache.has(key))
|
|
14
|
-
numberFormatCache.set(key, new Intl.NumberFormat(locale, opts));
|
|
15
|
-
return numberFormatCache.get(key);
|
|
16
|
-
}
|
|
17
|
-
function getRelativeTimeFormat(locale, opts) {
|
|
18
|
-
const key = locale + ':' + JSON.stringify(opts);
|
|
19
|
-
if (!relativeTimeFormatCache.has(key))
|
|
20
|
-
relativeTimeFormatCache.set(key, new Intl.RelativeTimeFormat(locale, opts));
|
|
21
|
-
return relativeTimeFormatCache.get(key);
|
|
22
|
-
}
|
|
23
|
-
function getListFormat(locale, opts) {
|
|
24
|
-
const key = locale + ':' + JSON.stringify(opts);
|
|
25
|
-
if (!listFormatCache.has(key))
|
|
26
|
-
listFormatCache.set(key, new Intl.ListFormat(locale, opts));
|
|
27
|
-
return listFormatCache.get(key);
|
|
28
|
-
}
|
|
29
|
-
export function formatDate(locale, date, opts) {
|
|
30
|
-
return getDateFormat(locale, opts).format(date);
|
|
31
|
-
}
|
|
32
|
-
export function formatNumber(locale, value, opts) {
|
|
33
|
-
return getNumberFormat(locale, opts).format(value);
|
|
34
|
-
}
|
|
35
|
-
export function formatRelativeTime(locale, value, unit, opts) {
|
|
36
|
-
return getRelativeTimeFormat(locale, opts).format(value, unit);
|
|
37
|
-
}
|
|
38
|
-
export function formatList(locale, items, opts) {
|
|
39
|
-
return getListFormat(locale, opts).format(items);
|
|
40
|
-
}
|
|
41
|
-
export function formatCurrency(locale, value, currency, opts) {
|
|
42
|
-
return formatNumber(locale, value, { ...opts, style: 'currency', currency });
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=formatters.js.map
|
package/dist/formatters.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,IAAI,GAAG,EAA+B,CAAA;AAC9D,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA6B,CAAA;AAC9D,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAmC,CAAA;AAC1E,MAAM,eAAe,GAAG,IAAI,GAAG,EAA2B,CAAA;AAE1D,SAAS,aAAa,CAAC,MAAc,EAAE,IAAiC;IACtE,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9F,OAAO,eAAe,CAAC,GAAG,CAAC,GAAG,CAAE,CAAA;AAClC,CAAC;AAED,SAAS,eAAe,CAAC,MAAc,EAAE,IAA+B;IACtE,MAAM,GAAG,GAAG,MAAM,GAAG,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Aa,EAAE,IAA+B;IACzF,OAAO,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,KAAa,EACb,IAAiC,EACjC,IAAqC;IAErC,OAAO,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,KAAe,EAAE,IAA6B;IACvF,OAAO,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,KAAa,EACb,QAAgB,EAChB,IAA2D;IAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC9E,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared model for routes whose slug differs per locale.
|
|
3
|
-
*
|
|
4
|
-
* Both hreflang surfaces consume this one model:
|
|
5
|
-
*
|
|
6
|
-
* - `@easy-web/i18n` `getAlternateLinks()` renders the in-page
|
|
7
|
-
* `<link rel="alternate" hreflang>` tags.
|
|
8
|
-
* - `@easy-web/seo` renders the `xhtml:link` alternates in `sitemap-0.xml`.
|
|
9
|
-
*
|
|
10
|
-
* Keeping the model here is deliberate. Both surfaces previously derived
|
|
11
|
-
* alternates independently by stripping the locale prefix and re-prefixing the
|
|
12
|
-
* remaining path, which silently assumes the slug is identical in every locale.
|
|
13
|
-
* For a pair like DE `/datenschutz/` and EN `/en/privacy/` that assumption is
|
|
14
|
-
* wrong, and the two surfaces failed in different ways: the sitemap omitted the
|
|
15
|
-
* alternates entirely, while the page head emitted `/en/datenschutz/` — a URL
|
|
16
|
-
* that does not exist. One shared model means the two can no longer disagree.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* One translated route, keyed by Astro locale id.
|
|
20
|
-
*
|
|
21
|
-
* Values are complete public route paths including any locale prefix, written
|
|
22
|
-
* exactly as the route is served:
|
|
23
|
-
*
|
|
24
|
-
* ```ts
|
|
25
|
-
* { de: '/datenschutz/', en: '/en/privacy/' }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* Trailing slashes are insignificant for matching — consumers render the URL
|
|
29
|
-
* form appropriate to their surface.
|
|
30
|
-
*/
|
|
31
|
-
export type LocalizedPathGroup = Readonly<Record<string, string>>;
|
|
32
|
-
export declare function stripQueryAndHash(path: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Which URL form the site actually serves, mirroring Astro's `build.format`:
|
|
35
|
-
* `always` for `directory` output (`/about/`), `never` for `file` (`/about`).
|
|
36
|
-
*/
|
|
37
|
-
export type TrailingSlash = 'always' | 'never';
|
|
38
|
-
/**
|
|
39
|
-
* The URL form `@easy-web/seo` resolved from `astro.config.mjs`, for callers
|
|
40
|
-
* that run outside an Astro integration and so cannot read the config.
|
|
41
|
-
*
|
|
42
|
-
* Components and instance modules render links with this so internal hrefs
|
|
43
|
-
* point at the canonical URL instead of the form the host will redirect away.
|
|
44
|
-
*/
|
|
45
|
-
export declare function ambientTrailingSlash(): TrailingSlash;
|
|
46
|
-
/**
|
|
47
|
-
* Renders a path in the form the site actually serves.
|
|
48
|
-
*
|
|
49
|
-
* Canonical, hreflang alternates and the sitemap must all agree byte-for-byte,
|
|
50
|
-
* or Google treats `/about` and `/about/` as competing duplicates. Instances
|
|
51
|
-
* hand-write `pathname` props in mixed conventions, so every SEO URL is routed
|
|
52
|
-
* through this function rather than trusting the caller's spelling.
|
|
53
|
-
*/
|
|
54
|
-
export declare function toServedPath(path: string, style?: TrailingSlash): string;
|
|
55
|
-
/**
|
|
56
|
-
* Reduces a path to the form used for comparison and lookup: leading slash,
|
|
57
|
-
* no trailing slash (except root), no query string, no hash.
|
|
58
|
-
*
|
|
59
|
-
* This is what makes `/datenschutz`, `/datenschutz/` and `/datenschutz/?x=1`
|
|
60
|
-
* resolve to the same group. Astro hands `Astro.url.pathname` to the layout
|
|
61
|
-
* without a trailing slash while `@astrojs/sitemap` emits one, so lookup has to
|
|
62
|
-
* be insensitive to that difference.
|
|
63
|
-
*/
|
|
64
|
-
export declare function normalizeLocalizedPath(path: string): string;
|
|
65
|
-
/**
|
|
66
|
-
* Finds the group that claims `path`, or `undefined` when the route uses the
|
|
67
|
-
* same slug in every locale (the common case, handled by prefix derivation).
|
|
68
|
-
*/
|
|
69
|
-
export declare function findLocalizedGroup(path: string, groups: readonly LocalizedPathGroup[] | undefined): LocalizedPathGroup | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Validates declared groups against the configured locales.
|
|
72
|
-
*
|
|
73
|
-
* Returns a list of human-readable problems; an empty array means valid.
|
|
74
|
-
* Callers decide whether to throw or warn — `@easy-web/seo` fails the build,
|
|
75
|
-
* because a stale mapping produces output that is syntactically valid but
|
|
76
|
-
* silently wrong, which is precisely the failure mode this model exists to
|
|
77
|
-
* eliminate.
|
|
78
|
-
*/
|
|
79
|
-
export declare function validateLocalizedPaths(groups: readonly LocalizedPathGroup[], locales: readonly string[]): string[];
|
|
80
|
-
//# sourceMappingURL=localized-paths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localized-paths.d.ts","sourceRoot":"","sources":["../src/localized-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAEjE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,CAQpD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,aAAwB,GAAG,MAAM,CAQlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,GAChD,kBAAkB,GAAG,SAAS,CAUhC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,kBAAkB,EAAE,EACrC,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,EAAE,CAqDV"}
|
package/dist/localized-paths.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared model for routes whose slug differs per locale.
|
|
3
|
-
*
|
|
4
|
-
* Both hreflang surfaces consume this one model:
|
|
5
|
-
*
|
|
6
|
-
* - `@easy-web/i18n` `getAlternateLinks()` renders the in-page
|
|
7
|
-
* `<link rel="alternate" hreflang>` tags.
|
|
8
|
-
* - `@easy-web/seo` renders the `xhtml:link` alternates in `sitemap-0.xml`.
|
|
9
|
-
*
|
|
10
|
-
* Keeping the model here is deliberate. Both surfaces previously derived
|
|
11
|
-
* alternates independently by stripping the locale prefix and re-prefixing the
|
|
12
|
-
* remaining path, which silently assumes the slug is identical in every locale.
|
|
13
|
-
* For a pair like DE `/datenschutz/` and EN `/en/privacy/` that assumption is
|
|
14
|
-
* wrong, and the two surfaces failed in different ways: the sitemap omitted the
|
|
15
|
-
* alternates entirely, while the page head emitted `/en/datenschutz/` — a URL
|
|
16
|
-
* that does not exist. One shared model means the two can no longer disagree.
|
|
17
|
-
*/
|
|
18
|
-
export function stripQueryAndHash(path) {
|
|
19
|
-
const withoutHash = path.split('#')[0] ?? '';
|
|
20
|
-
return withoutHash.split('?')[0] ?? '';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The URL form `@easy-web/seo` resolved from `astro.config.mjs`, for callers
|
|
24
|
-
* that run outside an Astro integration and so cannot read the config.
|
|
25
|
-
*
|
|
26
|
-
* Components and instance modules render links with this so internal hrefs
|
|
27
|
-
* point at the canonical URL instead of the form the host will redirect away.
|
|
28
|
-
*/
|
|
29
|
-
export function ambientTrailingSlash() {
|
|
30
|
-
const runtime = globalThis;
|
|
31
|
-
return runtime.process?.env?.['EASY_WEB_SEO_TRAILING_SLASH'] === 'never'
|
|
32
|
-
? 'never'
|
|
33
|
-
: 'always';
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Renders a path in the form the site actually serves.
|
|
37
|
-
*
|
|
38
|
-
* Canonical, hreflang alternates and the sitemap must all agree byte-for-byte,
|
|
39
|
-
* or Google treats `/about` and `/about/` as competing duplicates. Instances
|
|
40
|
-
* hand-write `pathname` props in mixed conventions, so every SEO URL is routed
|
|
41
|
-
* through this function rather than trusting the caller's spelling.
|
|
42
|
-
*/
|
|
43
|
-
export function toServedPath(path, style = 'always') {
|
|
44
|
-
const normalized = normalizeLocalizedPath(path);
|
|
45
|
-
if (normalized === '/' || style === 'never') {
|
|
46
|
-
return normalized;
|
|
47
|
-
}
|
|
48
|
-
return `${normalized}/`;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Reduces a path to the form used for comparison and lookup: leading slash,
|
|
52
|
-
* no trailing slash (except root), no query string, no hash.
|
|
53
|
-
*
|
|
54
|
-
* This is what makes `/datenschutz`, `/datenschutz/` and `/datenschutz/?x=1`
|
|
55
|
-
* resolve to the same group. Astro hands `Astro.url.pathname` to the layout
|
|
56
|
-
* without a trailing slash while `@astrojs/sitemap` emits one, so lookup has to
|
|
57
|
-
* be insensitive to that difference.
|
|
58
|
-
*/
|
|
59
|
-
export function normalizeLocalizedPath(path) {
|
|
60
|
-
const withoutQuery = stripQueryAndHash(path);
|
|
61
|
-
const withLeadingSlash = withoutQuery.startsWith('/') ? withoutQuery : `/${withoutQuery}`;
|
|
62
|
-
const trimmed = withLeadingSlash.replace(/\/+$/, '');
|
|
63
|
-
return trimmed === '' ? '/' : trimmed;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Finds the group that claims `path`, or `undefined` when the route uses the
|
|
67
|
-
* same slug in every locale (the common case, handled by prefix derivation).
|
|
68
|
-
*/
|
|
69
|
-
export function findLocalizedGroup(path, groups) {
|
|
70
|
-
if (!groups || groups.length === 0) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
const target = normalizeLocalizedPath(path);
|
|
74
|
-
return groups.find((group) => Object.values(group).some((candidate) => normalizeLocalizedPath(candidate) === target));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Validates declared groups against the configured locales.
|
|
78
|
-
*
|
|
79
|
-
* Returns a list of human-readable problems; an empty array means valid.
|
|
80
|
-
* Callers decide whether to throw or warn — `@easy-web/seo` fails the build,
|
|
81
|
-
* because a stale mapping produces output that is syntactically valid but
|
|
82
|
-
* silently wrong, which is precisely the failure mode this model exists to
|
|
83
|
-
* eliminate.
|
|
84
|
-
*/
|
|
85
|
-
export function validateLocalizedPaths(groups, locales) {
|
|
86
|
-
const problems = [];
|
|
87
|
-
const claimedBy = new Map();
|
|
88
|
-
groups.forEach((group, index) => {
|
|
89
|
-
const label = `localizedPaths[${index}]`;
|
|
90
|
-
const declared = Object.keys(group);
|
|
91
|
-
const missing = locales.filter((locale) => !declared.includes(locale));
|
|
92
|
-
if (missing.length > 0) {
|
|
93
|
-
problems.push(`${label} is missing the locale(s): ${missing.join(', ')}.`);
|
|
94
|
-
}
|
|
95
|
-
const unknown = declared.filter((locale) => !locales.includes(locale));
|
|
96
|
-
if (unknown.length > 0) {
|
|
97
|
-
problems.push(`${label} declares unknown locale(s): ${unknown.join(', ')}.`);
|
|
98
|
-
}
|
|
99
|
-
const seenInGroup = new Set();
|
|
100
|
-
for (const locale of declared) {
|
|
101
|
-
const value = group[locale];
|
|
102
|
-
if (typeof value !== 'string' || !value.startsWith('/') || value.startsWith('//')) {
|
|
103
|
-
problems.push(`${label}.${locale} must be an absolute path beginning with a single "/", got: ${String(value)}.`);
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (value.includes('?') || value.includes('#')) {
|
|
107
|
-
problems.push(`${label}.${locale} must not contain a query string or hash, got: ${value}.`);
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
const normalized = normalizeLocalizedPath(value);
|
|
111
|
-
if (seenInGroup.has(normalized)) {
|
|
112
|
-
problems.push(`${label} maps more than one locale to the same path: ${normalized}.`);
|
|
113
|
-
}
|
|
114
|
-
seenInGroup.add(normalized);
|
|
115
|
-
const owner = claimedBy.get(normalized);
|
|
116
|
-
if (owner !== undefined && owner !== index) {
|
|
117
|
-
problems.push(`${normalized} is claimed by both localizedPaths[${owner}] and ${label}; each path may belong to only one group.`);
|
|
118
|
-
}
|
|
119
|
-
claimedBy.set(normalized, index);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return problems;
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=localized-paths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localized-paths.js","sourceRoot":"","sources":["../src/localized-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC5C,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACxC,CAAC;AAQD;;;;;;GAMG;AACH,MAAM,UAA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-prefixing so calling `localizedHref` on an
|
|
5
|
-
* already-prefixed path never produces a double-prefix (e.g. `/en/en/foo`).
|
|
6
|
-
* Query strings and hash fragments are preserved.
|
|
7
|
-
*
|
|
8
|
-
* @deprecated v0.1: localizedHref(path, locale) → v0.2: localizedHref({ path, locale, defaultLocale })
|
|
9
|
-
*/
|
|
10
|
-
export declare function localizedHref(opts: {
|
|
11
|
-
path: string;
|
|
12
|
-
locale: string;
|
|
13
|
-
defaultLocale: string;
|
|
14
|
-
}): string;
|
|
15
|
-
/**
|
|
16
|
-
* Extracts locale from URL pathname.
|
|
17
|
-
* @deprecated v0.1: getLocaleFromPath(pathname) → v0.2: getLocaleFromPath({ pathname, locales, defaultLocale })
|
|
18
|
-
*/
|
|
19
|
-
export declare function getLocaleFromPath(opts: {
|
|
20
|
-
pathname: string;
|
|
21
|
-
locales: readonly string[];
|
|
22
|
-
defaultLocale: string;
|
|
23
|
-
}): string;
|
|
24
|
-
//# sourceMappingURL=routing.d.ts.map
|
package/dist/routing.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAoBT;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAMT"}
|
package/dist/routing.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a localized path.
|
|
3
|
-
*
|
|
4
|
-
* De-localizes `path` before re-prefixing so calling `localizedHref` on an
|
|
5
|
-
* already-prefixed path never produces a double-prefix (e.g. `/en/en/foo`).
|
|
6
|
-
* Query strings and hash fragments are preserved.
|
|
7
|
-
*
|
|
8
|
-
* @deprecated v0.1: localizedHref(path, locale) → v0.2: localizedHref({ path, locale, defaultLocale })
|
|
9
|
-
*/
|
|
10
|
-
export function localizedHref(opts) {
|
|
11
|
-
const qIdx = opts.path.indexOf('?');
|
|
12
|
-
const pathWithHash = qIdx === -1 ? opts.path : opts.path.slice(0, qIdx);
|
|
13
|
-
const search = qIdx === -1 ? '' : opts.path.slice(qIdx);
|
|
14
|
-
const hIdx = pathWithHash.indexOf('#');
|
|
15
|
-
const pathOnly = hIdx === -1 ? pathWithHash : pathWithHash.slice(0, hIdx);
|
|
16
|
-
const hash = hIdx === -1 ? '' : pathWithHash.slice(hIdx);
|
|
17
|
-
const segments = pathOnly.split('/').filter(Boolean);
|
|
18
|
-
if (segments.length > 0 && (segments[0] === opts.locale || segments[0] === opts.defaultLocale)) {
|
|
19
|
-
segments.shift();
|
|
20
|
-
}
|
|
21
|
-
const cleanPath = '/' + segments.join('/');
|
|
22
|
-
if (opts.locale === opts.defaultLocale) {
|
|
23
|
-
return cleanPath + search + hash;
|
|
24
|
-
}
|
|
25
|
-
return '/' + opts.locale + (cleanPath === '/' ? '' : cleanPath) + search + hash;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Extracts locale from URL pathname.
|
|
29
|
-
* @deprecated v0.1: getLocaleFromPath(pathname) → v0.2: getLocaleFromPath({ pathname, locales, defaultLocale })
|
|
30
|
-
*/
|
|
31
|
-
export function getLocaleFromPath(opts) {
|
|
32
|
-
const segments = opts.pathname.split('/').filter(Boolean);
|
|
33
|
-
if (segments.length > 0 && opts.locales.includes(segments[0])) {
|
|
34
|
-
return segments[0];
|
|
35
|
-
}
|
|
36
|
-
return opts.defaultLocale;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=routing.js.map
|
package/dist/routing.js.map
DELETED
|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,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAE1C,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;QACvC,OAAO,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;IAClC,CAAC;IACD,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAIjC;IACC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACzD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,aAAa,CAAA;AAC3B,CAAC"}
|
package/dist/seo.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type LocalizedPathGroup, type TrailingSlash } from './localized-paths.js';
|
|
2
|
-
export type AlternateLink = {
|
|
3
|
-
hreflang: string;
|
|
4
|
-
href: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function getAlternateLinks(opts: {
|
|
7
|
-
path: string;
|
|
8
|
-
locales: readonly string[];
|
|
9
|
-
defaultLocale: string;
|
|
10
|
-
baseUrl: string;
|
|
11
|
-
/**
|
|
12
|
-
* Routes whose slug differs per locale. When `path` belongs to one of these
|
|
13
|
-
* groups the alternates are read from the group instead of being derived by
|
|
14
|
-
* re-prefixing `path`, which would otherwise point at a URL that does not
|
|
15
|
-
* exist (e.g. `/en/datenschutz` for the DE privacy page).
|
|
16
|
-
*/
|
|
17
|
-
localizedPaths?: readonly LocalizedPathGroup[];
|
|
18
|
-
/** URL form to emit; must match what the site serves. Defaults to Astro's `directory` output. */
|
|
19
|
-
trailingSlash?: TrailingSlash;
|
|
20
|
-
}): AlternateLink[];
|
|
21
|
-
export declare function getCanonicalUrl(opts: {
|
|
22
|
-
path: string;
|
|
23
|
-
locale: string;
|
|
24
|
-
defaultLocale: string;
|
|
25
|
-
baseUrl: string;
|
|
26
|
-
trailingSlash?: TrailingSlash;
|
|
27
|
-
}): string;
|
|
28
|
-
//# sourceMappingURL=seo.d.ts.map
|
package/dist/seo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../src/seo.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAiD9D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,cAAc,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC9C,iGAAiG;IACjG,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,aAAa,EAAE,CA8ClB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,MAAM,CAMT"}
|
package/dist/seo.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { findLocalizedGroup, toServedPath, } from './localized-paths.js';
|
|
2
|
-
function toServedUrl(url, style) {
|
|
3
|
-
const parsed = new URL(url);
|
|
4
|
-
parsed.pathname = toServedPath(parsed.pathname, style);
|
|
5
|
-
return parsed.href;
|
|
6
|
-
}
|
|
7
|
-
function normalizePath(path) {
|
|
8
|
-
return path.startsWith('/') ? path : `/${path}`;
|
|
9
|
-
}
|
|
10
|
-
function buildUrl(baseUrl, localePath, path, stripLocales = []) {
|
|
11
|
-
const base = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
|
|
12
|
-
const hashIdx = path.indexOf('#');
|
|
13
|
-
const hash = hashIdx !== -1 ? path.slice(hashIdx) : '';
|
|
14
|
-
const pathWithoutHash = hashIdx !== -1 ? path.slice(0, hashIdx) : path;
|
|
15
|
-
const queryIdx = pathWithoutHash.indexOf('?');
|
|
16
|
-
const search = queryIdx !== -1 ? pathWithoutHash.slice(queryIdx) : '';
|
|
17
|
-
const pathOnly = queryIdx !== -1 ? pathWithoutHash.slice(0, queryIdx) : pathWithoutHash;
|
|
18
|
-
const normalizedPathOnly = normalizePath(pathOnly);
|
|
19
|
-
const segments = normalizedPathOnly.split('/').filter((s, i) => i > 0 || s !== '');
|
|
20
|
-
const wasLocaleOnlyPath = segments.length === 1 && stripLocales.includes(segments[0] ?? '');
|
|
21
|
-
let cleanPath;
|
|
22
|
-
if (segments.length > 0 && stripLocales.includes(segments[0])) {
|
|
23
|
-
const rest = segments.slice(1);
|
|
24
|
-
cleanPath = rest.length > 0 ? `/${rest.join('/')}` : '/';
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
cleanPath = normalizedPathOnly;
|
|
28
|
-
}
|
|
29
|
-
const suffix = search + hash;
|
|
30
|
-
if (localePath === '') {
|
|
31
|
-
return base + cleanPath + suffix;
|
|
32
|
-
}
|
|
33
|
-
const localeSegment = `/${localePath}`;
|
|
34
|
-
if (cleanPath === '/') {
|
|
35
|
-
if (wasLocaleOnlyPath) {
|
|
36
|
-
return `${base}${localeSegment}${suffix}`;
|
|
37
|
-
}
|
|
38
|
-
return `${base}${localeSegment}/${suffix}`;
|
|
39
|
-
}
|
|
40
|
-
return `${base}${localeSegment}${cleanPath}${suffix}`;
|
|
41
|
-
}
|
|
42
|
-
export function getAlternateLinks(opts) {
|
|
43
|
-
const { path, locales, defaultLocale, baseUrl, localizedPaths } = opts;
|
|
44
|
-
const style = opts.trailingSlash ?? 'always';
|
|
45
|
-
const group = findLocalizedGroup(path, localizedPaths);
|
|
46
|
-
if (group) {
|
|
47
|
-
const base = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
|
|
48
|
-
const hrefFor = (locale) => {
|
|
49
|
-
const declared = group[locale];
|
|
50
|
-
return declared === undefined ? undefined : base + toServedPath(declared, style);
|
|
51
|
-
};
|
|
52
|
-
const links = [];
|
|
53
|
-
for (const locale of locales) {
|
|
54
|
-
const href = hrefFor(locale);
|
|
55
|
-
// Omit untranslated locales rather than inventing a URL — the bug this fixes.
|
|
56
|
-
if (href !== undefined) {
|
|
57
|
-
links.push({ hreflang: locale, href });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const fallback = hrefFor(defaultLocale);
|
|
61
|
-
if (fallback !== undefined) {
|
|
62
|
-
links.push({ hreflang: 'x-default', href: fallback });
|
|
63
|
-
}
|
|
64
|
-
return links;
|
|
65
|
-
}
|
|
66
|
-
const stripLocales = [...locales];
|
|
67
|
-
const links = locales.map((locale) => ({
|
|
68
|
-
hreflang: locale,
|
|
69
|
-
href: toServedUrl(buildUrl(baseUrl, locale !== defaultLocale ? locale : '', path, stripLocales), style),
|
|
70
|
-
}));
|
|
71
|
-
links.push({
|
|
72
|
-
hreflang: 'x-default',
|
|
73
|
-
href: toServedUrl(buildUrl(baseUrl, '', path, stripLocales), style),
|
|
74
|
-
});
|
|
75
|
-
return links;
|
|
76
|
-
}
|
|
77
|
-
export function getCanonicalUrl(opts) {
|
|
78
|
-
const { path, locale, defaultLocale, baseUrl } = opts;
|
|
79
|
-
return toServedUrl(buildUrl(baseUrl, locale !== defaultLocale ? locale : '', path, [locale, defaultLocale]), opts.trailingSlash ?? 'always');
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=seo.js.map
|
package/dist/seo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seo.js","sourceRoot":"","sources":["../src/seo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,GAGb,MAAM,sBAAsB,CAAA;AAI7B,SAAS,WAAW,CAAC,GAAW,EAAE,KAAoB;IACpD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IACtD,OAAO,MAAM,CAAC,IAAI,CAAA;AACpB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;AACjD,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,UAAkB,EAAE,IAAY,EAAE,eAAyB,EAAE;IAC9F,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAEnE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjC,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;I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