Merge branch 'main' into slorber/do-not-translate-default-locale

This commit is contained in:
sebastien 2025-07-04 15:16:37 +02:00
commit c79a3cbb05
2 changed files with 12 additions and 0 deletions

View file

@ -62,6 +62,12 @@ async function createMdxLoaderDependencyFile({
options: PluginOptions;
versionsMetadata: VersionMetadata[];
}): Promise<string | undefined> {
// Disabled for unit tests, the side effect produces infinite watch loops
// TODO find a better way :/
if (process.env.NODE_ENV === 'test') {
return undefined;
}
const filePath = path.join(dataDir, '__mdx-loader-dependency.json');
// the cache is invalidated whenever this file content changes
const fileContent = {

View file

@ -38,6 +38,12 @@ type LoadVersionParams = {
function ensureNoDuplicateDocId(docs: DocMetadataBase[]): void {
const duplicatesById = _.chain(docs)
.sort((d1, d2) => {
// Need to sort because Globby order is non-deterministic
// TODO maybe we should create a deterministic glob utils?
// see https://github.com/sindresorhus/globby/issues/131
return d1.source.localeCompare(d2.source);
})
.groupBy((d) => d.id)
.pickBy((group) => group.length > 1)
.value();