@docusaurus/types 3.9.2-canary-6437 → 3.9.2-canary-6443

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/types",
3
- "version": "3.9.2-canary-6437",
3
+ "version": "3.9.2-canary-6443",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -28,5 +28,5 @@
28
28
  "react": "^18.0.0 || ^19.0.0",
29
29
  "react-dom": "^18.0.0 || ^19.0.0"
30
30
  },
31
- "gitHead": "c36f3ac2e06fc332b02fc2feaae5011d1a51ac87"
31
+ "gitHead": "a25dde30cfb44b2e621d62c4a58e371e3d9c96bf"
32
32
  }
package/src/config.d.ts CHANGED
@@ -33,6 +33,7 @@ export type FasterConfig = {
33
33
  rspackBundler: boolean;
34
34
  rspackPersistentCache: boolean;
35
35
  ssgWorkerThreads: boolean;
36
+ gitEagerVcs: boolean;
36
37
  };
37
38
 
38
39
  export type FutureV4Config = {
@@ -40,6 +41,53 @@ export type FutureV4Config = {
40
41
  useCssCascadeLayers: boolean;
41
42
  };
42
43
 
44
+ // VCS (Version Control System) info about a given change, e.g., a git commit.
45
+ // The agnostic term "VCS" is used instead of "git" to acknowledge the existence
46
+ // of other version control systems, and external systems like CMSs and i18n
47
+ // translation SaaS (e.g., Crowdin)
48
+ export type VcsChangeInfo = {timestamp: number; author: string};
49
+
50
+ export type VscInitializeParams = {
51
+ siteDir: string;
52
+ // TODO could it be useful to provide all plugins getPathsToWatch() here?
53
+ // this could give the opportunity to find out all VCS roots ahead of times
54
+ // this is mostly useful for multi-git-repo setups, can be added later
55
+ };
56
+
57
+ // VCS (Version Control System) config hooks to get file change info.
58
+ // This lets you override and customize the default Docusaurus behavior.
59
+ // This can be useful to optimize calls or when using something else than git
60
+ // See https://github.com/facebook/docusaurus/issues/11208
61
+ // See https://github.com/e18e/ecosystem-issues/issues/216
62
+ export type VcsConfig = {
63
+ /**
64
+ * Initialize the VCS system.
65
+ * This is notably useful to pre-read eagerly a full Git repository so that
66
+ * all the files first/last update info can be retrieved efficiently later
67
+ *
68
+ * Note: for now, this function is synchronous on purpose, it can be used to
69
+ * start warming up the VCS by reading eagerly, but we don't want to delay
70
+ * the rest of the Docusaurus start/build process. Instead of awaiting the
71
+ * init promise, you can create/store it and await it later during reads.
72
+ *
73
+ * @param params Initialization params that can be useful to warm up the VCS
74
+ */
75
+ initialize: (params: VscInitializeParams) => void;
76
+ getFileCreationInfo: (filePath: string) => Promise<VcsChangeInfo | null>;
77
+ getFileLastUpdateInfo: (filePath: string) => Promise<VcsChangeInfo | null>;
78
+ };
79
+
80
+ /**
81
+ * List of pre-built VcsConfig that Docusaurus provides.
82
+ */
83
+ export type VcsPreset =
84
+ | 'git-ad-hoc'
85
+ | 'git-eager'
86
+ | 'hardcoded'
87
+ | 'disabled'
88
+ | 'default-v1'
89
+ | 'default-v2';
90
+
43
91
  export type FutureConfig = {
44
92
  /**
45
93
  * Turns v4 future flags on
@@ -50,6 +98,8 @@ export type FutureConfig = {
50
98
 
51
99
  experimental_storage: StorageConfig;
52
100
 
101
+ experimental_vcs: VcsConfig;
102
+
53
103
  /**
54
104
  * Docusaurus can work with 2 router types.
55
105
  *
@@ -367,6 +417,7 @@ export type Config = Overwrite<
367
417
  {
368
418
  v4?: boolean | Partial<FutureV4Config>;
369
419
  experimental_faster?: boolean | Partial<FasterConfig>;
420
+ experimental_vcs?: VcsPreset | VcsConfig | boolean;
370
421
  }
371
422
  >;
372
423
  }
package/src/index.d.ts CHANGED
@@ -13,6 +13,10 @@ export {
13
13
  FutureV4Config,
14
14
  FasterConfig,
15
15
  StorageConfig,
16
+ VcsConfig,
17
+ VcsPreset,
18
+ VcsChangeInfo,
19
+ VscInitializeParams,
16
20
  Config,
17
21
  } from './config';
18
22