mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
perf/fix(v2): more efficient hot reload & consistent filegen (#1950)
* perf(v2): efficient hot reload, consistent generated file * changelog * more
This commit is contained in:
parent
87f864e5ba
commit
e04c8f140f
7 changed files with 60 additions and 6 deletions
|
@ -18,9 +18,6 @@ import {posixPath} from '@docusaurus/utils';
|
|||
const createFakeActions = (routeConfigs: RouteConfig[], contentDir) => {
|
||||
return {
|
||||
addRoute: (config: RouteConfig) => {
|
||||
config.routes.sort((a, b) =>
|
||||
a.path > b.path ? 1 : b.path > a.path ? -1 : 0,
|
||||
);
|
||||
routeConfigs.push(config);
|
||||
},
|
||||
createData: async (name, _content) => {
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
import globby from 'globby';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {idx, normalizeUrl, docuHash} from '@docusaurus/utils';
|
||||
import {
|
||||
idx,
|
||||
normalizeUrl,
|
||||
docuHash,
|
||||
objectWithKeySorted,
|
||||
} from '@docusaurus/utils';
|
||||
import {LoadContext, Plugin} from '@docusaurus/types';
|
||||
|
||||
import createOrder from './order';
|
||||
|
@ -202,7 +207,7 @@ export default function pluginContentDocs(
|
|||
docsDir,
|
||||
docsSidebars,
|
||||
sourceToPermalink,
|
||||
permalinkToSidebar,
|
||||
permalinkToSidebar: objectWithKeySorted(permalinkToSidebar),
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -252,7 +257,9 @@ export default function pluginContentDocs(
|
|||
addRoute({
|
||||
path: docsBaseRoute,
|
||||
component: docLayoutComponent,
|
||||
routes,
|
||||
routes: routes.sort((a, b) =>
|
||||
a.path > b.path ? 1 : b.path > a.path ? -1 : 0,
|
||||
),
|
||||
modules: {
|
||||
docsMetadata: aliasedSource(docsBaseMetadataPath),
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue