fix tinyglobby integration

This commit is contained in:
sebastien 2025-04-08 14:37:09 +02:00
parent 784b443cfe
commit b1ddd48006
4 changed files with 11 additions and 7 deletions

View File

@ -10,11 +10,15 @@
import path from 'path';
import Micromatch from 'micromatch'; // Note: Micromatch is used by Globby
import {addSuffix} from '@docusaurus/utils-common';
import Globby from 'tinyglobby';
import * as Tinyglobby from 'tinyglobby';
import {posixPath} from './pathUtils';
type GlobOptions = Tinyglobby.GlobOptions;
// TODO Docusaurus v4 refactor, hide lib behind home-made abstraction
// See https://github.com/facebook/docusaurus/pull/11042
/** A re-export of the globby instance. */
export {Globby};
export const Globby = Tinyglobby.glob;
/**
* The default glob patterns we ignore when sourcing content.
@ -93,7 +97,7 @@ export function createAbsoluteFilePathMatcher(
// See https://github.com/facebook/docusaurus/pull/4222#issuecomment-795517329
export async function safeGlobby(
patterns: string[],
options?: Globby.GlobOptions,
options?: GlobOptions,
): Promise<string[]> {
// Required for Windows support, as paths using \ should not be used by globby
// (also using the windows hard drive prefix like c: is not a good idea)
@ -101,7 +105,7 @@ export async function safeGlobby(
posixPath(path.relative(process.cwd(), dirPath)),
);
return Globby.glob(globPaths, options);
return Globby(globPaths, options);
}
// A bit weird to put this here, but it's used by core + theme-translations

View File

@ -61,7 +61,7 @@ export async function eject({
const globPatternPosix = posixPath(globPattern);
const filesToCopy = await Globby.glob(globPatternPosix, {
const filesToCopy = await Globby(globPatternPosix, {
ignore: _.compact([
'**/*.{story,stories,test,tests}.{js,jsx,ts,tsx}',
// When ejecting JS components, we want to avoid emitting TS files

View File

@ -51,7 +51,7 @@ export async function createAliasesForTheme(
return {};
}
const themeComponentFiles = await Globby.glob(['**/*.{js,jsx,ts,tsx}'], {
const themeComponentFiles = await Globby(['**/*.{js,jsx,ts,tsx}'], {
cwd: themePath,
});

View File

@ -8556,7 +8556,7 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"
fdir@^6.4.0, fdir@^6.4.3:
fdir@^6.4.3:
version "6.4.3"
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.3.tgz#011cdacf837eca9b811c89dbb902df714273db72"
integrity sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==