@docusaurus/core 3.6.3-canary-6179 → 3.6.3-canary-6181

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 (2) hide show
  1. package/lib/server/i18n.js +10 -2
  2. package/package.json +11 -13
@@ -10,7 +10,6 @@ exports.getDefaultLocaleConfig = getDefaultLocaleConfig;
10
10
  exports.loadI18n = loadI18n;
11
11
  const tslib_1 = require("tslib");
12
12
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
13
- const rtl_detect_1 = require("rtl-detect");
14
13
  function inferLanguageDisplayName(locale) {
15
14
  const tryLocale = (l) => {
16
15
  try {
@@ -58,11 +57,20 @@ function getDefaultCalendar(localeStr) {
58
57
  }
59
58
  return 'gregory';
60
59
  }
60
+ function getDefaultDirection(localeStr) {
61
+ const locale = new Intl.Locale(localeStr);
62
+ // see https://github.com/tc39/proposal-intl-locale-info
63
+ // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
64
+ // Node 18.0 implements a former version of the getTextInfo() proposal
65
+ // @ts-expect-error: The TC39 proposal was updated
66
+ const textInto = locale.getTextInfo?.() ?? locale.textInfo;
67
+ return textInto.direction;
68
+ }
61
69
  function getDefaultLocaleConfig(locale) {
62
70
  try {
63
71
  return {
64
72
  label: getDefaultLocaleLabel(locale),
65
- direction: (0, rtl_detect_1.getLangDir)(locale),
73
+ direction: getDefaultDirection(locale),
66
74
  htmlLang: locale,
67
75
  calendar: getDefaultCalendar(locale),
68
76
  path: locale,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "3.6.3-canary-6179",
4
+ "version": "3.6.3-canary-6181",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,13 +33,13 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@docusaurus/babel": "3.6.3-canary-6179",
37
- "@docusaurus/bundler": "3.6.3-canary-6179",
38
- "@docusaurus/logger": "3.6.3-canary-6179",
39
- "@docusaurus/mdx-loader": "3.6.3-canary-6179",
40
- "@docusaurus/utils": "3.6.3-canary-6179",
41
- "@docusaurus/utils-common": "3.6.3-canary-6179",
42
- "@docusaurus/utils-validation": "3.6.3-canary-6179",
36
+ "@docusaurus/babel": "3.6.3-canary-6181",
37
+ "@docusaurus/bundler": "3.6.3-canary-6181",
38
+ "@docusaurus/logger": "3.6.3-canary-6181",
39
+ "@docusaurus/mdx-loader": "3.6.3-canary-6181",
40
+ "@docusaurus/utils": "3.6.3-canary-6181",
41
+ "@docusaurus/utils-common": "3.6.3-canary-6181",
42
+ "@docusaurus/utils-validation": "3.6.3-canary-6181",
43
43
  "boxen": "^6.2.1",
44
44
  "chalk": "^4.1.2",
45
45
  "chokidar": "^3.5.3",
@@ -66,7 +66,6 @@
66
66
  "react-router": "^5.3.4",
67
67
  "react-router-config": "^5.1.1",
68
68
  "react-router-dom": "^5.3.4",
69
- "rtl-detect": "^1.0.4",
70
69
  "semver": "^7.5.4",
71
70
  "serve-handler": "^6.1.6",
72
71
  "shelljs": "^0.8.5",
@@ -78,13 +77,12 @@
78
77
  "webpack-merge": "^6.0.1"
79
78
  },
80
79
  "devDependencies": {
81
- "@docusaurus/module-type-aliases": "3.6.3-canary-6179",
82
- "@docusaurus/types": "3.6.3-canary-6179",
80
+ "@docusaurus/module-type-aliases": "3.6.3-canary-6181",
81
+ "@docusaurus/types": "3.6.3-canary-6181",
83
82
  "@total-typescript/shoehorn": "^0.1.2",
84
83
  "@types/detect-port": "^1.3.3",
85
84
  "@types/react-dom": "^18.2.7",
86
85
  "@types/react-router-config": "^5.0.7",
87
- "@types/rtl-detect": "^1.0.0",
88
86
  "@types/serve-handler": "^6.1.4",
89
87
  "@types/update-notifier": "^6.0.4",
90
88
  "@types/webpack-bundle-analyzer": "^4.7.0",
@@ -100,5 +98,5 @@
100
98
  "engines": {
101
99
  "node": ">=18.0"
102
100
  },
103
- "gitHead": "99fbc8751cc453fdd465b68a67e5ec1a070b931d"
101
+ "gitHead": "23a7d02de2f38dce2c440dbbaf0754f2129cdc2b"
104
102
  }