You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/api/docusaurus.config.js.mdx
+91-1Lines changed: 91 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,10 +266,100 @@ export default {
266
266
-[`rspackPersistentCache`](https://github.com/facebook/docusaurus/pull/10931): Use [Rspack Persistent Cache](https://rspack.dev/config/cache) to re-build your app faster on subsequent builds. Requires `rspackBundler: true`. Requires persisting `./node_modules/.cache` across rebuilds.
267
267
-[`mdxCrossCompilerCache`](https://github.com/facebook/docusaurus/pull/10479): Compile MDX files only once for both browser/Node.js environments instead of twice.
268
268
-[`ssgWorkerThreads`](https://github.com/facebook/docusaurus/pull/10826): Using a Node.js worker thread pool to execute the static site generation phase faster. Requires `future.v4.removeLegacyPostBuildHeadAttribute` to be turned on.
269
+
-[`gitEagerVcs`](https://github.com/facebook/docusaurus/pull/11512): Upgrades the default [VCS strategy](#vcs) to `default-v2`, that reads your whole Git repository at once instead of per-file, making Git operations faster on large repositories.
269
270
-`experimental_storage`: Site-wide browser storage options that theme authors should strive to respect.
270
271
-`type`: The browser storage theme authors should use. Possible values are `localStorage` and `sessionStorage`. Defaults to `localStorage`.
271
272
-`namespace`: Whether to namespace the browser storage keys to avoid storage key conflicts when Docusaurus sites are hosted under the same domain, or on localhost. Possible values are `string | boolean`. The namespace is appended at the end of the storage keys `key-namespace`. Use `true` to automatically generate a random namespace from your site `url + baseUrl`. Defaults to `false` (no namespace, historical behavior).
272
273
-`experimental_router`: The router type to use. Possible values are `browser` and `hash`. Defaults to `browser`. The `hash` router is only useful for rare cases where you want to opt-out of static site generation, have a fully client-side app with a single `index.html` entrypoint file. This can be useful to distribute a Docusaurus site as a `.zip` archive that you can [browse locally without running a web server](https://github.com/facebook/docusaurus/issues/3825).
274
+
-[`experimental_vcs`](#vcs): The Version Control System (VCS) implementation to use to read file info (creation/last update date/author). Read the [dedicated section](#vcs) below for details.
275
+
276
+
#### `experimental_vcs`{#vcs}
277
+
278
+
This exposes an API that lets you provide your own Version Control System (VCS) implementation to read file info (creation/last update date/author).
279
+
280
+
```ts
281
+
exportdefault {
282
+
future: {
283
+
experimental_vcs: {
284
+
initialize: ({siteDir}) => {
285
+
// Initialize your VCS client here.
286
+
// If you want to read your VCS eagerly/incrementally on startup,
287
+
// this is the place to do it.
288
+
// This function is synchronous on purpose and not awaited
289
+
// It should not delay Docusaurus startup, but be run in parallel.
290
+
},
291
+
getFileCreationInfo: async (filePath:string) => {
292
+
// Provide your own implementation to read file creation info.
// Provide your own implementation to read file creation info.
297
+
returngetFileLastUpdateInfo(filePath);
298
+
},
299
+
},
300
+
},
301
+
};
302
+
```
303
+
304
+
##### VCS Presets {#vcs-presets}
305
+
306
+
It is possible to pass a boolean VCS value:
307
+
308
+
-`true`: enables the default VCS preset (`default-v1` or `default-v2`, depending on the Docusaurus Faster `gitEagerVcs` flag value)
309
+
-`false`: disables the VCS, always returns `null` for all files
310
+
311
+
```ts
312
+
exportdefault {
313
+
future: {
314
+
experimental_vcs: true, // Enables the default VCS preset
315
+
},
316
+
};
317
+
```
318
+
319
+
It is also possible to choose VCS preset we provide out of the box by its name.
320
+
321
+
```ts
322
+
exportdefault {
323
+
future: {
324
+
experimental_vcs: 'presetName',
325
+
},
326
+
};
327
+
```
328
+
329
+
The available preset names are:
330
+
331
+
-`git-ad-hoc`: the historical `git log <filename>` based strategy.
332
+
-`git-eager`: the new Git strategy that reads your whole repository upfront.
333
+
-`hardcoded`: returns hardcoded value, useful in dev/tests to speed up developer experience.
334
+
-`disabled`: returns `null` for all files, considering them untracked.
335
+
-`default-v1`: the historical default (`git-ad-hoc` in prod, `hardcoded` in dev)
336
+
-`default-v2`: the upcoming default (`git-eager` in prod, `hardcoded` in dev)
337
+
338
+
Unless you have specific needs, we recommend using the default presets (`default-v1` or `default-v2`), that skip reading file info in development mode for better performance.
0 commit comments