@docusaurus/theme-classic 0.0.0-4606 → 0.0.0-4610

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.
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getTranslationFiles = getTranslationFiles;
7
7
  exports.translateThemeConfig = translateThemeConfig;
8
8
 
9
- var _lodash = require("lodash");
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
10
 
11
11
  var _utils = require("@docusaurus/utils");
12
12
 
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
13
15
  /**
14
16
  * Copyright (c) Facebook, Inc. and its affiliates.
15
17
  *
@@ -27,10 +29,10 @@ function getNavbarTranslationFile(navbar) {
27
29
  }
28
30
 
29
31
  const allNavbarItems = flattenNavbarItems(navbar.items);
30
- const navbarItemsTranslations = (0, _lodash.chain)(allNavbarItems.filter(navbarItem => !!navbarItem.label)).keyBy(navbarItem => `item.label.${navbarItem.label}`).mapValues(navbarItem => ({
32
+ const navbarItemsTranslations = Object.fromEntries(allNavbarItems.filter(navbarItem => navbarItem.label).map(navbarItem => [`item.label.${navbarItem.label}`, {
31
33
  message: navbarItem.label,
32
34
  description: `Navbar item with label ${navbarItem.label}`
33
- })).value();
35
+ }]));
34
36
  const titleTranslations = navbar.title ? {
35
37
  title: {
36
38
  message: navbar.title,
@@ -71,14 +73,14 @@ function isMultiColumnFooterLinks(links) {
71
73
  }
72
74
 
73
75
  function getFooterTranslationFile(footer) {
74
- const footerLinkTitles = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.filter(link => !!link.title) : []).keyBy(link => `link.title.${link.title}`).mapValues(link => ({
76
+ const footerLinkTitles = Object.fromEntries((isMultiColumnFooterLinks(footer.links) ? footer.links.filter(link => link.title) : []).map(link => [`link.title.${link.title}`, {
75
77
  message: link.title,
76
78
  description: `The title of the footer links column with title=${link.title} in the footer`
77
- })).value();
78
- const footerLinkLabels = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => !!link.label) : footer.links.filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => ({
79
- message: linkItem.label,
80
- description: `The label of footer link with label=${linkItem.label} linking to ${linkItem.to ?? linkItem.href}`
81
- })).value();
79
+ }]));
80
+ const footerLinkLabels = Object.fromEntries((isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => link.label) : footer.links.filter(link => link.label)).map(link => [`link.item.label.${link.label}`, {
81
+ message: link.label,
82
+ description: `The label of footer link with label=${link.label} linking to ${link.to ?? link.href}`
83
+ }]));
82
84
  const copyright = footer.copyright ? {
83
85
  copyright: {
84
86
  message: footer.copyright,
@@ -135,7 +137,8 @@ function translateThemeConfig({
135
137
  themeConfig,
136
138
  translationFiles
137
139
  }) {
138
- const translationFilesMap = (0, _lodash.keyBy)(translationFiles, f => f.path);
140
+ const translationFilesMap = _lodash.default.keyBy(translationFiles, f => f.path);
141
+
139
142
  return { ...themeConfig,
140
143
  navbar: translateNavbar(themeConfig.navbar, translationFilesMap.navbar.content),
141
144
  footer: themeConfig.footer ? translateFooter(themeConfig.footer, translationFilesMap.footer.content) : undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4606",
3
+ "version": "0.0.0-4610",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4606",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4606",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4606",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4606",
28
- "@docusaurus/theme-common": "0.0.0-4606",
29
- "@docusaurus/theme-translations": "0.0.0-4606",
30
- "@docusaurus/utils": "0.0.0-4606",
31
- "@docusaurus/utils-common": "0.0.0-4606",
32
- "@docusaurus/utils-validation": "0.0.0-4606",
24
+ "@docusaurus/core": "0.0.0-4610",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4610",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4610",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4610",
28
+ "@docusaurus/theme-common": "0.0.0-4610",
29
+ "@docusaurus/theme-translations": "0.0.0-4610",
30
+ "@docusaurus/utils": "0.0.0-4610",
31
+ "@docusaurus/utils-common": "0.0.0-4610",
32
+ "@docusaurus/utils-validation": "0.0.0-4610",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -37,13 +37,13 @@
37
37
  "lodash": "^4.17.21",
38
38
  "postcss": "^8.4.6",
39
39
  "prism-react-renderer": "^1.2.1",
40
- "prismjs": "^1.26.0",
40
+ "prismjs": "^1.27.0",
41
41
  "react-router-dom": "^5.2.0",
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4606",
46
- "@docusaurus/types": "0.0.0-4606",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4610",
46
+ "@docusaurus/types": "0.0.0-4610",
47
47
  "@types/mdx-js__react": "^1.5.5",
48
48
  "@types/prismjs": "^1.26.0",
49
49
  "@types/rtlcss": "^3.1.2",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=14"
61
61
  },
62
- "gitHead": "b3b0a96db25fe575c5030ff5398cb11c10c871e3"
62
+ "gitHead": "3208d225c0366f7a46f6f9ecf622cf2e1f9a3018"
63
63
  }
@@ -15,7 +15,7 @@ import type {
15
15
  SimpleFooter,
16
16
  } from '@docusaurus/theme-common';
17
17
 
18
- import {keyBy, chain} from 'lodash';
18
+ import _ from 'lodash';
19
19
  import {mergeTranslations} from '@docusaurus/utils';
20
20
 
21
21
  function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent {
@@ -30,15 +30,17 @@ function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent {
30
30
 
31
31
  const allNavbarItems = flattenNavbarItems(navbar.items);
32
32
 
33
- const navbarItemsTranslations: TranslationFileContent = chain(
34
- allNavbarItems.filter((navbarItem) => !!navbarItem.label),
35
- )
36
- .keyBy((navbarItem) => `item.label.${navbarItem.label}`)
37
- .mapValues((navbarItem) => ({
38
- message: navbarItem.label!,
39
- description: `Navbar item with label ${navbarItem.label}`,
40
- }))
41
- .value();
33
+ const navbarItemsTranslations: TranslationFileContent = Object.fromEntries(
34
+ allNavbarItems
35
+ .filter((navbarItem) => navbarItem.label)
36
+ .map((navbarItem) => [
37
+ `item.label.${navbarItem.label}`,
38
+ {
39
+ message: navbarItem.label!,
40
+ description: `Navbar item with label ${navbarItem.label}`,
41
+ },
42
+ ]),
43
+ );
42
44
 
43
45
  const titleTranslations: TranslationFileContent = navbar.title
44
46
  ? {title: {message: navbar.title, description: 'The title in the navbar'}}
@@ -78,33 +80,33 @@ function isMultiColumnFooterLinks(
78
80
  }
79
81
 
80
82
  function getFooterTranslationFile(footer: Footer): TranslationFileContent {
81
- const footerLinkTitles: TranslationFileContent = chain(
82
- isMultiColumnFooterLinks(footer.links)
83
- ? footer.links.filter((link) => !!link.title)
84
- : [],
85
- )
86
- .keyBy((link) => `link.title.${link.title}`)
87
- .mapValues((link) => ({
88
- message: link.title!,
89
- description: `The title of the footer links column with title=${link.title} in the footer`,
90
- }))
91
- .value();
92
-
93
- const footerLinkLabels: TranslationFileContent = chain(
94
- isMultiColumnFooterLinks(footer.links)
95
- ? footer.links
96
- .flatMap((link) => link.items)
97
- .filter((link) => !!link.label)
98
- : footer.links.filter((link) => !!link.label),
99
- )
100
- .keyBy((linkItem) => `link.item.label.${linkItem.label}`)
101
- .mapValues((linkItem) => ({
102
- message: linkItem.label!,
103
- description: `The label of footer link with label=${
104
- linkItem.label
105
- } linking to ${linkItem.to ?? linkItem.href}`,
106
- }))
107
- .value();
83
+ const footerLinkTitles: TranslationFileContent = Object.fromEntries(
84
+ (isMultiColumnFooterLinks(footer.links)
85
+ ? footer.links.filter((link) => link.title)
86
+ : []
87
+ ).map((link) => [
88
+ `link.title.${link.title}`,
89
+ {
90
+ message: link.title!,
91
+ description: `The title of the footer links column with title=${link.title} in the footer`,
92
+ },
93
+ ]),
94
+ );
95
+
96
+ const footerLinkLabels: TranslationFileContent = Object.fromEntries(
97
+ (isMultiColumnFooterLinks(footer.links)
98
+ ? footer.links.flatMap((link) => link.items).filter((link) => link.label)
99
+ : footer.links.filter((link) => link.label)
100
+ ).map((link) => [
101
+ `link.item.label.${link.label}`,
102
+ {
103
+ message: link.label!,
104
+ description: `The label of footer link with label=${
105
+ link.label
106
+ } linking to ${link.to ?? link.href}`,
107
+ },
108
+ ]),
109
+ );
108
110
 
109
111
  const copyright: TranslationFileContent = footer.copyright
110
112
  ? {
@@ -176,7 +178,7 @@ export function translateThemeConfig({
176
178
  themeConfig: ThemeConfig;
177
179
  translationFiles: TranslationFile[];
178
180
  }): ThemeConfig {
179
- const translationFilesMap: Record<string, TranslationFile> = keyBy(
181
+ const translationFilesMap: Record<string, TranslationFile> = _.keyBy(
180
182
  translationFiles,
181
183
  (f) => f.path,
182
184
  );