@rspress/plugin-api-docgen 1.37.4 → 1.39.0

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -24
  2. package/package.json +8 -9
package/dist/index.js CHANGED
@@ -4,25 +4,17 @@ var __webpack_modules__ = {
4
4
  module.exports = import("documentation");
5
5
  }
6
6
  };
7
- /************************************************************************/ // The module cache
8
7
  var __webpack_module_cache__ = {};
9
- // The require function
10
8
  function __webpack_require__(moduleId) {
11
- // Check if module is in cache
12
9
  var cachedModule = __webpack_module_cache__[moduleId];
13
10
  if (void 0 !== cachedModule) return cachedModule.exports;
14
- // Create a new module (and put it into the cache)
15
11
  var module = __webpack_module_cache__[moduleId] = {
16
12
  exports: {}
17
13
  };
18
- // Execute the module function
19
14
  __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
20
- // Return the exports of the module
21
15
  return module.exports;
22
16
  }
23
- /************************************************************************/ // webpack/runtime/compat_get_default_export
24
17
  (()=>{
25
- // getDefaultExport function for compatibility with non-ESM modules
26
18
  __webpack_require__.n = function(module) {
27
19
  var getter = module && module.__esModule ? function() {
28
20
  return module['default'];
@@ -35,7 +27,6 @@ function __webpack_require__(moduleId) {
35
27
  return getter;
36
28
  };
37
29
  })();
38
- // webpack/runtime/define_property_getters
39
30
  (()=>{
40
31
  __webpack_require__.d = function(exports1, definition) {
41
32
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -44,15 +35,12 @@ function __webpack_require__(moduleId) {
44
35
  });
45
36
  };
46
37
  })();
47
- // webpack/runtime/has_own_property
48
38
  (()=>{
49
39
  __webpack_require__.o = function(obj, prop) {
50
40
  return Object.prototype.hasOwnProperty.call(obj, prop);
51
41
  };
52
42
  })();
53
- // webpack/runtime/make_namespace_object
54
43
  (()=>{
55
- // define __esModule on exports
56
44
  __webpack_require__.r = function(exports1) {
57
45
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
58
46
  value: 'Module'
@@ -62,12 +50,10 @@ function __webpack_require__(moduleId) {
62
50
  });
63
51
  };
64
52
  })();
65
- /************************************************************************/ var __webpack_exports__ = {};
66
- // ESM COMPAT FLAG
53
+ var __webpack_exports__ = {};
67
54
  __webpack_require__.r(__webpack_exports__);
68
- // EXPORTS
69
55
  __webpack_require__.d(__webpack_exports__, {
70
- pluginApiDocgen: ()=>/* binding */ pluginApiDocgen
56
+ pluginApiDocgen: ()=>pluginApiDocgen
71
57
  });
72
58
  const external_node_path_namespaceObject = require("node:path");
73
59
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
@@ -141,7 +127,6 @@ const docgen = async ({ entries, languages, apiParseTool, appDir, parseToolOptio
141
127
  } else {
142
128
  const { tsconfigPath, compilerOptions, ...restOptions } = (null == parseToolOptions ? void 0 : parseToolOptions['react-docgen-typescript']) ?? {};
143
129
  const parserOpts = {
144
- // https://github.com/styleguidist/react-docgen-typescript/blob/master/README.md?plain=1#L111
145
130
  propFilter: (prop)=>{
146
131
  if (void 0 !== prop.declarations && prop.declarations.length > 0) {
147
132
  const hasPropAdditionalDescription = prop.declarations.find((declaration)=>!declaration.fileName.includes('node_modules'));
@@ -243,8 +228,7 @@ function generateTable(componentDoc, language) {
243
228
  return description;
244
229
  }
245
230
  };
246
- const formattedDescription = getDescription() // allow newline
247
- .replace(/\n/g, '
');
231
+ const formattedDescription = getDescription().replace(/\n/g, '
');
248
232
  return `|${[
249
233
  name,
250
234
  formattedDescription,
@@ -260,9 +244,7 @@ function generateTable(componentDoc, language) {
260
244
  `;
261
245
  }).join('\n');
262
246
  }
263
- /**
264
- * The plugin is used to generate api doc for files.
265
- */ function pluginApiDocgen(options) {
247
+ function pluginApiDocgen(options) {
266
248
  const { entries = {}, apiParseTool = 'react-docgen-typescript', appDir = process.cwd(), parseToolOptions = {} } = options || {};
267
249
  return {
268
250
  name: '@modern-js/doc-plugin-api-docgen',
@@ -273,7 +255,6 @@ function generateTable(componentDoc, language) {
273
255
  },
274
256
  async beforeBuild (config, isProd) {
275
257
  var _config_themeConfig_locales, _config_themeConfig, _config_locales;
276
- // only support zh and en
277
258
  const languages = ((null === (_config_themeConfig = config.themeConfig) || void 0 === _config_themeConfig ? void 0 : null === (_config_themeConfig_locales = _config_themeConfig.locales) || void 0 === _config_themeConfig_locales ? void 0 : _config_themeConfig_locales.map((locale)=>locale.lang)) || (null === (_config_locales = config.locales) || void 0 === _config_locales ? void 0 : _config_locales.map((locale)=>locale.lang)) || [
278
259
  config.lang
279
260
  ]).filter((lang)=>'zh' === lang || 'en' === lang);
@@ -287,7 +268,6 @@ function generateTable(componentDoc, language) {
287
268
  });
288
269
  },
289
270
  async modifySearchIndexData (pages) {
290
- // Update the search index of module doc which includes `<API moduleName="foo" />` and `<API moduleName="foo" ></API>
291
271
  const apiCompRegExp = /(<API\s+moduleName=['"](\S+)['"]\s*(.*)?\/>)|(<API\s+moduleName=['"](\S+)['"]\s*(.*)?>(.*)?<\/API>)/;
292
272
  await Promise.all(pages.map(async (page)=>{
293
273
  const { _filepath, lang } = page;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-api-docgen",
3
- "version": "1.37.4",
3
+ "version": "1.39.0",
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": {
@@ -21,19 +21,18 @@
21
21
  "react-docgen-typescript": "2.2.2",
22
22
  "react-markdown": "8.0.7",
23
23
  "remark-gfm": "3.0.1",
24
- "@rspress/shared": "1.37.4"
24
+ "@rspress/shared": "1.39.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@microsoft/api-extractor": "^7.48.0",
28
- "@rslib/core": "0.1.2",
27
+ "@microsoft/api-extractor": "^7.48.1",
28
+ "@rslib/core": "0.1.5",
29
29
  "@types/mdast": "^4.0.4",
30
30
  "@types/node": "^18.11.17",
31
- "@types/react": "^18.3.12",
32
- "@types/react-dom": "^18.3.1",
33
- "mdast-util-mdxjs-esm": "^1.3.1",
31
+ "@types/react": "^18.3.18",
32
+ "@types/react-dom": "^18.3.5",
34
33
  "react": "^18.3.1",
35
34
  "react-dom": "^18.3.1",
36
- "react-router-dom": "^6.28.0",
35
+ "react-router-dom": "^6.28.1",
37
36
  "typescript": "^5.5.3",
38
37
  "unified": "^10.1.2",
39
38
  "unist-util-visit": "^4.1.2"
@@ -41,7 +40,7 @@
41
40
  "peerDependencies": {
42
41
  "react": ">=17.0.0",
43
42
  "react-router-dom": "^6.8.1",
44
- "@rspress/core": "^1.37.4",
43
+ "@rspress/core": "^1.39.0",
45
44
  "typescript": "^5.5.3"
46
45
  },
47
46
  "peerDependenciesMeta": {