@rspress/plugin-api-docgen 1.39.2 → 1.39.4

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/dist/index.js CHANGED
@@ -55,17 +55,17 @@ __webpack_require__.r(__webpack_exports__);
55
55
  __webpack_require__.d(__webpack_exports__, {
56
56
  pluginApiDocgen: ()=>pluginApiDocgen
57
57
  });
58
- const external_node_path_namespaceObject = require("node:path");
59
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
60
58
  const external_node_fs_namespaceObject = require("node:fs");
61
59
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
60
+ const external_node_path_namespaceObject = require("node:path");
61
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
62
+ external_node_path_default().join(__dirname, '..');
63
+ const apiDocMap = {};
64
+ const shared_namespaceObject = require("@rspress/shared");
62
65
  const logger_namespaceObject = require("@rspress/shared/logger");
63
66
  const external_chokidar_namespaceObject = require("chokidar");
64
67
  var external_chokidar_default = /*#__PURE__*/ __webpack_require__.n(external_chokidar_namespaceObject);
65
68
  const external_react_docgen_typescript_namespaceObject = require("react-docgen-typescript");
66
- const shared_namespaceObject = require("@rspress/shared");
67
- external_node_path_default().join(__dirname, '..');
68
- const apiDocMap = {};
69
69
  const locales = {
70
70
  zh: {
71
71
  copy: '复制',
@@ -275,8 +275,9 @@ function pluginApiDocgen(options) {
275
275
  let matchResult = new RegExp(apiCompRegExp).exec(content);
276
276
  if (!matchResult) return;
277
277
  while(null !== matchResult){
278
- const [matchContent, moduleName] = matchResult;
279
- const apiDoc = apiDocMap[moduleName] || apiDocMap[`${moduleName}-${lang}`];
278
+ const matchContent = matchResult[0];
279
+ const moduleName = matchResult[2] ?? matchResult[5] ?? '';
280
+ const apiDoc = apiDocMap[moduleName] ?? apiDocMap[`${moduleName}-${lang}`] ?? '';
280
281
  content = content.replace(matchContent, apiDoc);
281
282
  matchResult = new RegExp(apiCompRegExp).exec(content);
282
283
  }
@@ -6,12 +6,12 @@ module.exports = async function () {
6
6
  try {
7
7
  const result = `
8
8
  ${demos
9
- .map(item => {
9
+ .map((item) => {
10
10
  return `import Demo_${item.id} from '${item.virtualModulePath}';`;
11
11
  })
12
12
  .join('\n')}
13
13
  export default [${demos
14
- .map(item => {
14
+ .map((item) => {
15
15
  return `{
16
16
  "id": "${item.id}",
17
17
  "component": Demo_${item.id}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-api-docgen",
3
- "version": "1.39.2",
3
+ "version": "1.39.4",
4
4
  "description": "A plugin for rspress to generate api doc.",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -9,23 +9,24 @@
9
9
  "directory": "packages/plugin-api-docgen"
10
10
  },
11
11
  "license": "MIT",
12
- "jsnext:source": "./src/index.ts",
13
- "types": "./dist/index.d.ts",
14
12
  "main": "./dist/index.js",
15
- "engines": {
16
- "node": ">=14.17.6"
17
- },
13
+ "types": "./dist/index.d.ts",
14
+ "files": [
15
+ "dist",
16
+ "static",
17
+ "mdx-meta-loader.cjs"
18
+ ],
18
19
  "dependencies": {
19
20
  "chokidar": "^3.6.0",
20
21
  "documentation": "14.0.3",
21
22
  "react-docgen-typescript": "2.2.2",
22
23
  "react-markdown": "8.0.7",
23
24
  "remark-gfm": "3.0.1",
24
- "@rspress/shared": "1.39.2"
25
+ "@rspress/shared": "1.39.4"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@microsoft/api-extractor": "^7.48.1",
28
- "@rslib/core": "0.1.5",
29
+ "@rslib/core": "0.2.2",
29
30
  "@types/mdast": "^4.0.4",
30
31
  "@types/node": "^18.11.17",
31
32
  "@types/react": "^18.3.18",
@@ -38,9 +39,9 @@
38
39
  "unist-util-visit": "^4.1.2"
39
40
  },
40
41
  "peerDependencies": {
42
+ "@rspress/core": "^1.39.4",
41
43
  "react": ">=17.0.0",
42
44
  "react-router-dom": "^6.8.1",
43
- "@rspress/core": "^1.39.2",
44
45
  "typescript": "^5.5.3"
45
46
  },
46
47
  "peerDependenciesMeta": {
@@ -48,19 +49,18 @@
48
49
  "optional": true
49
50
  }
50
51
  },
51
- "files": [
52
- "dist",
53
- "static",
54
- "mdx-meta-loader.cjs"
55
- ],
52
+ "engines": {
53
+ "node": ">=14.17.6"
54
+ },
56
55
  "publishConfig": {
57
56
  "access": "public",
58
57
  "provenance": true,
59
58
  "registry": "https://registry.npmjs.org/"
60
59
  },
60
+ "jsnext:source": "./src/index.ts",
61
61
  "scripts": {
62
- "dev": "rslib build -w",
63
62
  "build": "rslib build",
63
+ "dev": "rslib build -w",
64
64
  "reset": "rimraf ./**/node_modules",
65
65
  "test": "vitest run --passWithNoTests"
66
66
  }
@@ -1,7 +1,7 @@
1
+ import { useLang, usePageData } from '@rspress/core/runtime';
2
+ import { getCustomMDXComponent } from '@rspress/core/theme';
1
3
  import ReactMarkdown from 'react-markdown';
2
4
  import remarkGfm from 'remark-gfm';
3
- import { getCustomMDXComponent } from '@rspress/core/theme';
4
- import { usePageData, useLang } from '@rspress/core/runtime';
5
5
  import './API.scss';
6
6
 
7
7
  export default (props: { moduleName: string }) => {