@modern-js/module-tools-docs 2.32.2-alpha.1 → 2.33.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.
package/.eslintrc.js CHANGED
@@ -5,7 +5,7 @@ module.exports = {
5
5
  tsconfigRootDir: __dirname,
6
6
  project: ['./tsconfig.json'],
7
7
  },
8
- ignorePatterns: ['modern.config.ts'],
8
+ ignorePatterns: ['rspress.config.ts'],
9
9
  rules: {
10
10
  'babel/no-unused-expressions': 0,
11
11
  'react/jsx-filename-extension': 0,
package/CHANGELOG.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # @modern-js/module-tools-docs
2
2
 
3
- ## 2.32.2-alpha.0
3
+ ## 2.33.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - bc1f8daf0ff: feat(builder): support custom logger in dev server
7
+ - bc1f8da: feat(builder): support custom logger in dev server
8
8
 
9
9
  feat(builder): 支持自定义 logger
10
10
 
11
- - @modern-js/doc-plugin-auto-sidebar@2.32.2-alpha.0
12
- - @modern-js/doc-tools@2.32.2-alpha.0
11
+ - Updated dependencies [db9a700]
12
+ - @modern-js/doc-plugin-auto-sidebar@2.33.0
13
13
 
14
14
  ## 2.32.1
15
15
 
package/package.json CHANGED
@@ -9,17 +9,18 @@
9
9
  "directory": "packages/document/module-doc"
10
10
  },
11
11
  "license": "MIT",
12
- "version": "2.32.2-alpha.1",
12
+ "version": "2.33.0",
13
13
  "main": "index.js",
14
14
  "dependencies": {
15
15
  "react": "^18.2.0",
16
16
  "react-dom": "^18.2.0",
17
- "@modern-js/doc-plugin-auto-sidebar": "2.32.2-alpha.1",
18
- "@modern-js/doc-tools": "2.32.2-alpha.1"
17
+ "rspress": "0.0.6",
18
+ "@rspress/shared": "0.0.6",
19
+ "@modern-js/doc-plugin-auto-sidebar": "2.33.0"
19
20
  },
20
21
  "scripts": {
21
- "dev": "modern dev",
22
- "build:doc": "modern build",
23
- "preview": "modern preview"
22
+ "dev": "rspress dev",
23
+ "build:doc": "rspress build",
24
+ "preview": "rspress preview"
24
25
  }
25
26
  }
@@ -0,0 +1,130 @@
1
+ import path from 'path';
2
+ import { NavItem } from '@rspress/shared';
3
+ import { defineConfig } from 'rspress/config';
4
+ import { pluginAutoSidebar } from '@modern-js/doc-plugin-auto-sidebar';
5
+
6
+ const { version } = require('./package.json');
7
+
8
+ function getI18nHelper(lang: 'zh' | 'en') {
9
+ const cn = lang === 'zh';
10
+ const prefix = cn ? '' : '/en';
11
+ const getLink = (str: string) => `${prefix}${str}`;
12
+ const getText = (cnText: string, enText: string) => (cn ? cnText : enText);
13
+ return { getText, getLink };
14
+ }
15
+
16
+ function getNavbar(lang: 'zh' | 'en'): NavItem[] {
17
+ const { getLink, getText } = getI18nHelper(lang);
18
+
19
+ return [
20
+ {
21
+ text: getText('指南', 'Guide'),
22
+ link: getLink('/guide/intro/welcome'),
23
+ activeMatch: '^/guide/',
24
+ },
25
+ {
26
+ text: getText('API', 'API'),
27
+ link: getLink('/api/'),
28
+ activeMatch: '^/api/',
29
+ },
30
+ {
31
+ text: getText('插件', 'Plugins'),
32
+ link: getLink('/plugins/guide/getting-started'),
33
+ activeMatch: '^/plugins/',
34
+ },
35
+ {
36
+ text: `v${version}`,
37
+ items: [
38
+ {
39
+ text: getText('更新日志', 'Changelog'),
40
+ link: 'https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md',
41
+ },
42
+ {
43
+ text: getText('贡献指南', 'Contributing'),
44
+ link: 'https://modernjs.dev/en/community/contributing-guide.html',
45
+ },
46
+ ],
47
+ },
48
+ ];
49
+ }
50
+
51
+ export default defineConfig({
52
+ root: path.join(__dirname, 'docs'),
53
+ lang: 'zh',
54
+ base: '/module-tools/',
55
+ title: 'Module Tools',
56
+ icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png',
57
+ // The plugins for doc tools.
58
+ plugins: [
59
+ pluginAutoSidebar({
60
+ root: path.join(__dirname, 'docs'),
61
+ categories: ['zh', 'en']
62
+ .map(lang =>
63
+ ['guide', 'api', 'plugins'].map(category => `${lang}/${category}`),
64
+ )
65
+ .flat(),
66
+ collapsed: false,
67
+ }),
68
+ ],
69
+ markdown: {
70
+ checkDeadLinks: true,
71
+ experimentalMdxRs: true,
72
+ },
73
+ themeConfig: {
74
+ footer: {
75
+ message: 'Copyright © 2023 ByteDance.',
76
+ },
77
+ socialLinks: [
78
+ {
79
+ icon: 'github',
80
+ mode: 'link',
81
+ content:
82
+ 'https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools',
83
+ },
84
+ ],
85
+ locales: [
86
+ {
87
+ lang: 'zh',
88
+ label: '简体中文',
89
+ nav: getNavbar('zh'),
90
+ title: 'Module Tools',
91
+ outlineTitle: '目录',
92
+ prevPageText: '上一页',
93
+ nextPageText: '下一页',
94
+ description: '模块工程解决方案',
95
+ },
96
+ {
97
+ lang: 'en',
98
+ label: 'English',
99
+ nav: getNavbar('en'),
100
+ title: 'Module Tools',
101
+ description: 'Module Engineering Solutions',
102
+ },
103
+ ],
104
+ editLink: {
105
+ docRepoBaseUrl:
106
+ 'https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs',
107
+ text: 'Edit this page on GitHub',
108
+ },
109
+ },
110
+ replaceRules: [
111
+ {
112
+ // The major version is different inside the ByteDance,
113
+ // so we use a flag to define it.
114
+ search: /MAJOR_VERSION/g,
115
+ replace: '2',
116
+ },
117
+ ],
118
+ builderConfig: {
119
+ dev: {
120
+ startUrl: 'http://localhost:<port>/module-tools/',
121
+ },
122
+ source: {
123
+ alias: {
124
+ '@site-docs': path.join(__dirname, './docs/zh'),
125
+ '@site-docs-en': path.join(__dirname, './docs/en'),
126
+ '@site': require('path').resolve(__dirname),
127
+ },
128
+ },
129
+ },
130
+ });
package/theme/index.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from '@modern-js/doc-tools/theme';
2
- export { default } from '@modern-js/doc-tools/theme';
1
+ // eslint-disable-next-line import/export
2
+ export * from 'rspress/theme';
3
+ export { default } from 'rspress/theme';
package/tsconfig.json CHANGED
@@ -3,5 +3,5 @@
3
3
  "compilerOptions": {
4
4
  "jsx": "preserve"
5
5
  },
6
- "include": ["./theme", "./modern.config.ts"]
6
+ "include": ["./theme", "./rspress.config.ts"]
7
7
  }
package/modern.config.ts DELETED
@@ -1,132 +0,0 @@
1
- import path from 'path';
2
- import { docTools, defineConfig, NavItem } from '@modern-js/doc-tools';
3
- import { pluginAutoSidebar } from '@modern-js/doc-plugin-auto-sidebar';
4
-
5
- const { version } = require('./package.json');
6
-
7
- function getI18nHelper(lang: 'zh' | 'en') {
8
- const cn = lang === 'zh';
9
- const prefix = cn ? '' : '/en';
10
- const getLink = (str: string) => `${prefix}${str}`;
11
- const getText = (cnText: string, enText: string) => (cn ? cnText : enText);
12
- return { getText, getLink };
13
- }
14
-
15
- function getNavbar(lang: 'zh' | 'en'): NavItem[] {
16
- const { getLink, getText } = getI18nHelper(lang);
17
-
18
- return [
19
- {
20
- text: getText('指南', 'Guide'),
21
- link: getLink('/guide/intro/welcome'),
22
- activeMatch: '^/guide/',
23
- },
24
- {
25
- text: getText('API', 'API'),
26
- link: getLink('/api/'),
27
- activeMatch: '^/api/',
28
- },
29
- {
30
- text: getText('插件', 'Plugins'),
31
- link: getLink('/plugins/guide/getting-started'),
32
- activeMatch: '^/plugins/',
33
- },
34
- {
35
- text: `v${version}`,
36
- items: [
37
- {
38
- text: getText('更新日志', 'Changelog'),
39
- link: 'https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md',
40
- },
41
- {
42
- text: getText('贡献指南', 'Contributing'),
43
- link: 'https://modernjs.dev/en/community/contributing-guide.html',
44
- },
45
- ],
46
- },
47
- ];
48
- }
49
-
50
- export default defineConfig({
51
- plugins: [docTools()],
52
- doc: {
53
- root: path.join(__dirname, 'docs'),
54
- lang: 'zh',
55
- base: '/module-tools/',
56
- title: 'Module Tools',
57
- icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png',
58
- // The plugins for doc tools.
59
- plugins: [
60
- pluginAutoSidebar({
61
- root: path.join(__dirname, 'docs'),
62
- categories: ['zh', 'en']
63
- .map(lang =>
64
- ['guide', 'api', 'plugins'].map(category => `${lang}/${category}`),
65
- )
66
- .flat(),
67
- collapsed: false,
68
- }),
69
- ],
70
- markdown: {
71
- checkDeadLinks: true,
72
- experimentalMdxRs: true,
73
- },
74
- themeConfig: {
75
- footer: {
76
- message: 'Copyright © 2023 ByteDance.',
77
- },
78
- socialLinks: [
79
- {
80
- icon: 'github',
81
- mode: 'link',
82
- content:
83
- 'https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools',
84
- },
85
- ],
86
- locales: [
87
- {
88
- lang: 'zh',
89
- label: '简体中文',
90
- nav: getNavbar('zh'),
91
- title: 'Module Tools',
92
- outlineTitle: '目录',
93
- prevPageText: '上一页',
94
- nextPageText: '下一页',
95
- description: '模块工程解决方案',
96
- },
97
- {
98
- lang: 'en',
99
- label: 'English',
100
- nav: getNavbar('en'),
101
- title: 'Module Tools',
102
- description: 'Module Engineering Solutions',
103
- },
104
- ],
105
- editLink: {
106
- docRepoBaseUrl:
107
- 'https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs',
108
- text: 'Edit this page on GitHub',
109
- },
110
- },
111
- replaceRules: [
112
- {
113
- // The major version is different inside the ByteDance,
114
- // so we use a flag to define it.
115
- search: /MAJOR_VERSION/g,
116
- replace: '2',
117
- },
118
- ],
119
- builderConfig: {
120
- dev: {
121
- startUrl: 'http://localhost:<port>/module-tools/',
122
- },
123
- source: {
124
- alias: {
125
- '@site-docs': path.join(__dirname, './docs/zh'),
126
- '@site-docs-en': path.join(__dirname, './docs/en'),
127
- '@site': require('path').resolve(__dirname),
128
- },
129
- }
130
- },
131
- },
132
- });