feat(core): simplify plugin API, support route.props (#10042)

This commit is contained in:
Sébastien Lorber 2024-04-16 13:57:11 +02:00 committed by GitHub
parent d1590e37ac
commit 5c1d6464d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 2858 additions and 2240 deletions

View file

@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {normalizeUrl} from '@docusaurus/utils';
import path from 'path';
import {normalizeUrl, posixPath} from '@docusaurus/utils';
/**
* @param {import('@docusaurus/types').LoadContext} context
@ -20,12 +21,21 @@ export default function FeatureRequestsPlugin(context) {
'paths.json',
JSON.stringify(basePath),
);
// TODO Docusaurus v4 breaking change
// module aliasing should be automatic
// we should never find local absolute FS paths in the codegen registry
const aliasedSource = (source) =>
`@generated/${posixPath(
path.relative(context.generatedFilesDir, source),
)}`;
actions.addRoute({
path: basePath,
exact: false,
component: '@site/src/plugins/featureRequests/FeatureRequestsPage',
modules: {
basePath: paths,
basePath: aliasedSource(paths),
},
});
},