@docpensieve/core 0.5.0-beta.1 → 0.5.0-beta.2
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 +2 -2
- package/src/config.js +1 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docpensieve/core",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"description": "DocPensieve engine: loading, MDX compilation, structured data, site generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"types"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docpensieve/shared": "0.5.0-beta.
|
|
24
|
+
"@docpensieve/shared": "0.5.0-beta.2",
|
|
25
25
|
"@mdx-js/mdx": "^3.1.1",
|
|
26
26
|
"@shikijs/rehype": "^4.4.3",
|
|
27
27
|
"gray-matter": "^4.0.3",
|
package/src/config.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
DEFAULT_OUT_DIR,
|
|
17
17
|
THEME_FRAMEWORKS,
|
|
18
18
|
UI_STRINGS,
|
|
19
|
+
isLanguageCode,
|
|
19
20
|
} from '@docpensieve/shared';
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -197,24 +198,6 @@ export function normalizeConfig(userConfig) {
|
|
|
197
198
|
// be both. "../../elsewhere" wrote outside the output folder, "a/b" nested
|
|
198
199
|
// the version, "Été" produced an encoded URL.
|
|
199
200
|
const VERSION_SLUG = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
200
|
-
// A language code becomes a URL segment and the `lang` of the document. The
|
|
201
|
-
// standard is BCP 47, and Intl carries it: a regex of our own refused
|
|
202
|
-
// "zh-Hans-CN", which is valid, and accepted shapes that are not.
|
|
203
|
-
const isLanguageCode = (/** @type {string} */ value) => {
|
|
204
|
-
try {
|
|
205
|
-
Intl.getCanonicalLocales(value);
|
|
206
|
-
// Well formed is not the same as real: BCP 47 allows a language subtag
|
|
207
|
-
// of five to eight letters, so "francais" passes that check and would
|
|
208
|
-
// land in the markup as `lang="francais"` — a value no browser maps to
|
|
209
|
-
// a language, under a French address serving English wording. CLDR
|
|
210
|
-
// knows which tags name a language; the subtag alone is asked, so that
|
|
211
|
-
// a region, a script or a private extension does not get in the way.
|
|
212
|
-
const names = new Intl.DisplayNames(['en'], { type: 'language', fallback: 'none' });
|
|
213
|
-
return names.of(new Intl.Locale(value).language) !== undefined;
|
|
214
|
-
} catch {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
201
|
|
|
219
202
|
// A translation belongs to a version, since a version is what has pages.
|
|
220
203
|
// Written at the root, it was read by nobody: the build succeeded, no
|