@docusaurus/plugin-content-docs 0.0.0-4369 → 0.0.0-4378

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.
@@ -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 '../../types';
8
- import { type ActivePlugin, type ActiveDocContext, type DocVersionSuggestions, type GetActivePluginOptions } from '../../client/docsClientUtils';
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("../../client/docsClientUtils");
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,7 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export * from './globalDataHooks';
@@ -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-4369",
3
+ "version": "0.0.0-4378",
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-4369",
22
- "@docusaurus/logger": "0.0.0-4369",
23
- "@docusaurus/mdx-loader": "0.0.0-4369",
24
- "@docusaurus/utils": "0.0.0-4369",
25
- "@docusaurus/utils-validation": "0.0.0-4369",
25
+ "@docusaurus/core": "0.0.0-4378",
26
+ "@docusaurus/logger": "0.0.0-4378",
27
+ "@docusaurus/mdx-loader": "0.0.0-4378",
28
+ "@docusaurus/utils": "0.0.0-4378",
29
+ "@docusaurus/utils-validation": "0.0.0-4378",
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-4369",
42
- "@docusaurus/types": "0.0.0-4369",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4378",
46
+ "@docusaurus/types": "0.0.0-4378",
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": "7586ff3026a01f421b6bf99a5dc75f4a89734c27"
60
+ "gitHead": "bd7999376fa63feafe5b169296beb91dac362954"
57
61
  }
@@ -11,7 +11,7 @@ import useGlobalData, {
11
11
  usePluginData,
12
12
  } from '@docusaurus/useGlobalData';
13
13
 
14
- import type {GlobalPluginData, GlobalVersion} from '../../types';
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 '../../client/docsClientUtils';
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 => {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export * from './globalDataHooks';
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
- declare module '@theme/hooks/useDocs' {
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;