Skip to content
Draft
2 changes: 1 addition & 1 deletion packages/docusaurus-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"file-loader": "^6.2.0",
"fs-extra": "^11.1.1",
"github-slugger": "^1.5.0",
"globby": "^11.1.0",
"gray-matter": "^4.0.3",
"jiti": "^1.20.0",
"js-yaml": "^4.1.0",
Expand All @@ -35,6 +34,7 @@
"prompts": "^2.4.2",
"p-queue": "^6.6.2",
"resolve-pathname": "^3.0.0",
"tinyglobby": "^0.2.14",
"tslib": "^2.6.0",
"url-loader": "^4.1.1",
"utility-types": "^3.10.0",
Expand Down
10 changes: 7 additions & 3 deletions packages/docusaurus-utils/src/globUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 'globby';
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.
Expand Down Expand Up @@ -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.GlobbyOptions,
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)
Expand Down
11 changes: 5 additions & 6 deletions packages/docusaurus/src/commands/writeHeadingIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ export async function writeHeadingIds(
): Promise<void> {
const siteDir = await fs.realpath(siteDirParam);

const markdownFiles = await safeGlobby(
files ?? (await getPathsToWatch(siteDir)),
{
expandDirectories: ['**/*.{md,mdx}'],
},
);
const markdownFiles = (
await safeGlobby(files ?? (await getPathsToWatch(siteDir)), {
expandDirectories: true,
})
).filter((file) => file.endsWith('.md') || file.endsWith('.mdx'));

const result = await Promise.all(
markdownFiles.map((p) => transformMarkdownFile(p, options)),
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8813,10 +8813,10 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"

fdir@^6.4.3:
version "6.4.3"
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.3.tgz#011cdacf837eca9b811c89dbb902df714273db72"
integrity sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==
fdir@^6.4.4:
version "6.4.4"
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.4.tgz#1cfcf86f875a883e19a8fab53622cfe992e8d2f9"
integrity sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==

feed@^4.2.2:
version "4.2.2"
Expand Down Expand Up @@ -17477,12 +17477,12 @@ tinyexec@^0.3.2:
resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.2.tgz#941794e657a85e496577995c6eef66f53f42b3d2"
integrity sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==

tinyglobby@^0.2.12:
version "0.2.12"
resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.12.tgz#ac941a42e0c5773bd0b5d08f32de82e74a1a61b5"
integrity sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==
tinyglobby@^0.2.12, tinyglobby@^0.2.14:
version "0.2.14"
resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d"
integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==
dependencies:
fdir "^6.4.3"
fdir "^6.4.4"
picomatch "^4.0.2"

tinypool@^1.0.2:
Expand Down
Loading