mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
fix(v2): use lodash instead of array-map-polyfill (#2490)
This commit is contained in:
parent
1577ab98e9
commit
686c8ae27d
5 changed files with 5 additions and 12 deletions
|
@ -27,5 +27,5 @@ module.exports = {
|
|||
transform: {
|
||||
'^.+\\.[jt]sx?$': 'babel-jest',
|
||||
},
|
||||
setupFiles: ['./jest/stylelint-rule-test.js', 'array-flat-polyfill'],
|
||||
setupFiles: ['./jest/stylelint-rule-test.js'],
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import fs from 'fs-extra';
|
||||
import importFresh from 'import-fresh';
|
||||
import {
|
||||
|
@ -105,12 +106,12 @@ function normalizeItem(item: SidebarItemRaw): SidebarItem[] {
|
|||
];
|
||||
}
|
||||
if (isCategoryShorthand(item)) {
|
||||
return normalizeCategoryShorthand(item).flatMap(normalizeItem);
|
||||
return _.flatMap(normalizeCategoryShorthand(item), normalizeItem);
|
||||
}
|
||||
switch (item.type) {
|
||||
case 'category':
|
||||
assertIsCategory(item);
|
||||
return [{...item, items: item.items.flatMap(normalizeItem)}];
|
||||
return [{...item, items: _.flatMap(item.items, normalizeItem)}];
|
||||
case 'link':
|
||||
assertIsLink(item);
|
||||
return [item];
|
||||
|
@ -133,7 +134,7 @@ function normalizeSidebar(sidebars: SidebarRaw): Sidebar {
|
|||
? sidebar
|
||||
: normalizeCategoryShorthand(sidebar);
|
||||
|
||||
acc[sidebarId] = normalizedSidebar.flatMap(normalizeItem);
|
||||
acc[sidebarId] = _.flatMap(normalizedSidebar, normalizeItem);
|
||||
|
||||
return acc;
|
||||
},
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
"@babel/runtime": "^7.7.4",
|
||||
"@docusaurus/utils": "^2.0.0-alpha.49",
|
||||
"@endiliey/static-site-generator-webpack-plugin": "^4.0.0",
|
||||
"array-flat-polyfill": "^1.0.1",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.0",
|
||||
"cache-loader": "^4.1.0",
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import 'array-flat-polyfill';
|
||||
|
||||
export {build} from './commands/build';
|
||||
export {start} from './commands/start';
|
||||
export {swizzle} from './commands/swizzle';
|
||||
|
|
|
@ -3196,11 +3196,6 @@ array-find-index@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1"
|
||||
integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=
|
||||
|
||||
array-flat-polyfill@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz#1e3a4255be619dfbffbfd1d635c1cf357cd034e7"
|
||||
integrity sha512-hfJmKupmQN0lwi0xG6FQ5U8Rd97RnIERplymOv/qpq8AoNKPPAnxJadjFA23FNWm88wykh9HmpLJUUwUtNU/iw==
|
||||
|
||||
array-flatten@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
||||
|
|
Loading…
Add table
Reference in a new issue