diff --git a/jest.config.js b/jest.config.js index 66bbe01be9..8bb2ddeeff 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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'], }; diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars.ts b/packages/docusaurus-plugin-content-docs/src/sidebars.ts index 81018e50eb..005c095458 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars.ts @@ -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; }, diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index e0008b4212..b66f4e55c9 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -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", diff --git a/packages/docusaurus/src/index.ts b/packages/docusaurus/src/index.ts index 4f79a8a343..543b405a3b 100644 --- a/packages/docusaurus/src/index.ts +++ b/packages/docusaurus/src/index.ts @@ -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'; diff --git a/yarn.lock b/yarn.lock index 6f0f33fe72..942b385625 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"