fix: make Docusaurus PnP strict mode compatible (#6047)

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
This commit is contained in:
Joshua Chen 2021-12-08 21:26:24 +08:00 committed by GitHub
parent 68b75bf855
commit e07ebadf6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 304 additions and 269 deletions

View file

@ -23,7 +23,9 @@ import resolvePathnameUnsafe from 'resolve-pathname';
import {posixPath as posixPathImport} from './posixPath';
import {simpleHash, docuHash} from './hashUtils';
import {normalizeUrl} from './normalizeUrl';
import {DEFAULT_PLUGIN_ID} from './constants';
export * from './constants';
export * from './mdxUtils';
export * from './normalizeUrl';
export * from './tags';
@ -41,6 +43,7 @@ export {
createMatcher,
createAbsoluteFilePathMatcher,
} from './globUtils';
export * from './webpackUtils';
const fileHash = new Map();
export async function generate(
@ -282,7 +285,7 @@ export function getPluginI18nPath({
siteDir,
locale,
pluginName,
pluginId = 'default', // TODO duplicated constant
pluginId = DEFAULT_PLUGIN_ID,
subPaths = [],
}: {
siteDir: string;
@ -298,10 +301,7 @@ export function getPluginI18nPath({
locale,
// Make it convenient to use for single-instance
// ie: return "docs", not "docs-default" nor "docs/default"
`${pluginName}${
// TODO duplicate constant :(
pluginId === 'default' ? '' : `-${pluginId}`
}`,
`${pluginName}${pluginId === DEFAULT_PLUGIN_ID ? '' : `-${pluginId}`}`,
...subPaths,
);
}