@docusaurus/plugin-content-docs 0.0.0-4366 → 0.0.0-4377
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/lib/{theme/hooks/useDocs.d.ts → client/globalDataHooks.d.ts} +2 -2
- package/lib/{theme/hooks/useDocs.js → client/globalDataHooks.js} +2 -1
- package/lib/client/index.d.ts +7 -0
- package/lib/client/index.js +10 -0
- package/lib/index.js +0 -6
- package/package.json +13 -9
- package/src/{theme/hooks/useDocs.ts → client/globalDataHooks.ts} +3 -2
- package/src/client/index.ts +8 -0
- package/src/index.ts +0 -8
- package/src/plugin-content-docs.d.ts +2 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { GlobalPluginData, GlobalVersion } from '
|
|
8
|
-
import { type ActivePlugin, type ActiveDocContext, type DocVersionSuggestions, type GetActivePluginOptions } from '
|
|
7
|
+
import type { GlobalPluginData, GlobalVersion } from '../types';
|
|
8
|
+
import { type ActivePlugin, type ActiveDocContext, type DocVersionSuggestions, type GetActivePluginOptions } from './docsClientUtils';
|
|
9
9
|
export declare const useAllDocsData: () => Record<string, GlobalPluginData>;
|
|
10
10
|
export declare const useDocsData: (pluginId: string | undefined) => GlobalPluginData;
|
|
11
11
|
export declare const useActivePlugin: (options?: GetActivePluginOptions) => ActivePlugin | undefined;
|
|
@@ -10,7 +10,7 @@ exports.useDocVersionSuggestions = exports.useActiveDocContext = exports.useActi
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const router_1 = require("@docusaurus/router");
|
|
12
12
|
const useGlobalData_1 = (0, tslib_1.__importStar)(require("@docusaurus/useGlobalData"));
|
|
13
|
-
const docsClientUtils_1 = require("
|
|
13
|
+
const docsClientUtils_1 = require("./docsClientUtils");
|
|
14
14
|
// Important to use a constant object to avoid React useEffect executions etc...,
|
|
15
15
|
// see https://github.com/facebook/docusaurus/issues/5089
|
|
16
16
|
const StableEmptyObject = {};
|
|
@@ -22,6 +22,7 @@ return (_a = (0, useGlobalData_1.default)()['docusaurus-plugin-content-docs']) !
|
|
|
22
22
|
exports.useAllDocsData = useAllDocsData;
|
|
23
23
|
const useDocsData = (pluginId) => (0, useGlobalData_1.usePluginData)('docusaurus-plugin-content-docs', pluginId);
|
|
24
24
|
exports.useDocsData = useDocsData;
|
|
25
|
+
// TODO this feature should be provided by docusaurus core
|
|
25
26
|
const useActivePlugin = (options = {}) => {
|
|
26
27
|
const data = (0, exports.useAllDocsData)();
|
|
27
28
|
const { pathname } = (0, router_1.useLocation)();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./globalDataHooks"), exports);
|
package/lib/index.js
CHANGED
|
@@ -35,12 +35,6 @@ async function pluginContentDocs(context, options) {
|
|
|
35
35
|
const aliasedSource = (source) => `~docs/${(0, utils_1.posixPath)(path_1.default.relative(pluginDataDirRoot, source))}`;
|
|
36
36
|
return {
|
|
37
37
|
name: 'docusaurus-plugin-content-docs',
|
|
38
|
-
getThemePath() {
|
|
39
|
-
return path_1.default.resolve(__dirname, './theme');
|
|
40
|
-
},
|
|
41
|
-
getTypeScriptThemePath() {
|
|
42
|
-
return path_1.default.resolve(__dirname, '..', 'src', 'theme');
|
|
43
|
-
},
|
|
44
38
|
extendCli(cli) {
|
|
45
39
|
const isDefaultPluginId = pluginId === utils_1.DEFAULT_PLUGIN_ID;
|
|
46
40
|
// Need to create one distinct command per plugin instance
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4377",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./client": "./lib/client/index.js",
|
|
8
|
+
".": "./lib/index.js"
|
|
9
|
+
},
|
|
6
10
|
"types": "src/plugin-content-docs.d.ts",
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc",
|
|
@@ -18,11 +22,11 @@
|
|
|
18
22
|
},
|
|
19
23
|
"license": "MIT",
|
|
20
24
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
25
|
+
"@docusaurus/core": "0.0.0-4377",
|
|
26
|
+
"@docusaurus/logger": "0.0.0-4377",
|
|
27
|
+
"@docusaurus/mdx-loader": "0.0.0-4377",
|
|
28
|
+
"@docusaurus/utils": "0.0.0-4377",
|
|
29
|
+
"@docusaurus/utils-validation": "0.0.0-4377",
|
|
26
30
|
"combine-promises": "^1.1.0",
|
|
27
31
|
"escape-string-regexp": "^4.0.0",
|
|
28
32
|
"fs-extra": "^10.0.0",
|
|
@@ -38,8 +42,8 @@
|
|
|
38
42
|
"webpack": "^5.61.0"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
42
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4377",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4377",
|
|
43
47
|
"@types/js-yaml": "^4.0.0",
|
|
44
48
|
"@types/picomatch": "^2.2.1",
|
|
45
49
|
"commander": "^5.1.0",
|
|
@@ -53,5 +57,5 @@
|
|
|
53
57
|
"engines": {
|
|
54
58
|
"node": ">=14"
|
|
55
59
|
},
|
|
56
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "5dea134d7853ad86c969384e51bc51c1e7b9fc8a"
|
|
57
61
|
}
|
|
@@ -11,7 +11,7 @@ import useGlobalData, {
|
|
|
11
11
|
usePluginData,
|
|
12
12
|
} from '@docusaurus/useGlobalData';
|
|
13
13
|
|
|
14
|
-
import type {GlobalPluginData, GlobalVersion} from '
|
|
14
|
+
import type {GlobalPluginData, GlobalVersion} from '../types';
|
|
15
15
|
import {
|
|
16
16
|
getActivePlugin,
|
|
17
17
|
getLatestVersion,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
type ActiveDocContext,
|
|
23
23
|
type DocVersionSuggestions,
|
|
24
24
|
type GetActivePluginOptions,
|
|
25
|
-
} from '
|
|
25
|
+
} from './docsClientUtils';
|
|
26
26
|
|
|
27
27
|
// Important to use a constant object to avoid React useEffect executions etc...,
|
|
28
28
|
// see https://github.com/facebook/docusaurus/issues/5089
|
|
@@ -37,6 +37,7 @@ export const useAllDocsData = (): Record<string, GlobalPluginData> =>
|
|
|
37
37
|
export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
|
|
38
38
|
usePluginData('docusaurus-plugin-content-docs', pluginId) as GlobalPluginData;
|
|
39
39
|
|
|
40
|
+
// TODO this feature should be provided by docusaurus core
|
|
40
41
|
export const useActivePlugin = (
|
|
41
42
|
options: GetActivePluginOptions = {},
|
|
42
43
|
): ActivePlugin | undefined => {
|
package/src/index.ts
CHANGED
|
@@ -79,14 +79,6 @@ export default async function pluginContentDocs(
|
|
|
79
79
|
return {
|
|
80
80
|
name: 'docusaurus-plugin-content-docs',
|
|
81
81
|
|
|
82
|
-
getThemePath() {
|
|
83
|
-
return path.resolve(__dirname, './theme');
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
getTypeScriptThemePath() {
|
|
87
|
-
return path.resolve(__dirname, '..', 'src', 'theme');
|
|
88
|
-
},
|
|
89
|
-
|
|
90
82
|
extendCli(cli) {
|
|
91
83
|
const isDefaultPluginId = pluginId === DEFAULT_PLUGIN_ID;
|
|
92
84
|
|
|
@@ -241,7 +241,8 @@ declare module '@theme/Seo' {
|
|
|
241
241
|
export default Seo;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
// TODO can't we infer types directly from code?
|
|
245
|
+
declare module '@docusaurus/plugin-content-docs/client' {
|
|
245
246
|
type GlobalPluginData = import('./types').GlobalPluginData;
|
|
246
247
|
type GlobalVersion = import('./types').GlobalVersion;
|
|
247
248
|
type ActivePlugin = import('./client/docsClientUtils').ActivePlugin;
|