@modern-js/plugin-docsite 1.0.0-rc.2 → 1.0.0-rc.23
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/CHANGELOG.md +301 -0
- package/README.md +22 -21
- package/dist/js/modern/build-task.js +0 -2
- package/dist/js/modern/features/constant.js +1 -1
- package/dist/js/modern/features/dev.js +1 -2
- package/dist/js/modern/features/index.js +1 -2
- package/dist/js/modern/features/utils/chokidar.js +1 -2
- package/dist/js/modern/features/utils/generate-files.js +2 -3
- package/dist/js/modern/features/utils/webpack.js +2 -3
- package/dist/js/modern/index.js +4 -4
- package/dist/js/node/build-task.js +0 -3
- package/dist/js/node/features/constant.js +3 -5
- package/dist/js/node/features/dev.js +2 -4
- package/dist/js/node/features/index.js +2 -6
- package/dist/js/node/features/utils/chokidar.js +2 -4
- package/dist/js/node/features/utils/generate-files.js +17 -19
- package/dist/js/node/features/utils/webpack.js +13 -15
- package/dist/js/node/index.js +3 -3
- package/dist/{static → js/static}/DocsNav.jsx.tpl +0 -0
- package/dist/{static → js/static}/DocsRoutes.jsx.tpl +0 -0
- package/dist/{static → js/static}/DocsToc.jsx.tpl +0 -0
- package/dist/{static → js/static}/docs-entry.jsx.tpl +0 -0
- package/dist/{static → js/static}/docs-page.jsx.tpl +0 -0
- package/dist/{static → js/static}/docs.css +0 -0
- package/dist/{static → js/static}/index.html.ejs +0 -0
- package/dist/{static → js/static}/stories-entry.ts.tpl +0 -0
- package/dist/{static → js/static}/storybook-config.js.tpl +0 -0
- package/dist/{static → js/static}/tsconfig.json +0 -0
- package/dist/types/index.d.ts +9 -9
- package/package.json +25 -8
- package/src/build-task.ts +0 -5
- package/src/features/constant.ts +1 -1
- package/src/features/dev.ts +1 -2
- package/src/features/index.ts +1 -2
- package/src/features/utils/chokidar.ts +1 -2
- package/src/features/utils/generate-files.ts +2 -6
- package/src/features/utils/webpack.ts +2 -3
- package/src/index.ts +4 -4
package/CHANGELOG.md
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
# @modern-js/plugin-docsite
|
2
|
+
|
3
|
+
## 1.0.0-rc.23
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 224f7fe: fix server route match
|
8
|
+
- 30ac27c: feat: add generator package description
|
9
|
+
- 0fd196e: feat: fix bugs
|
10
|
+
- 204c626: feat: initial
|
11
|
+
- 63be0a5: fix: #118 #104
|
12
|
+
- Updated dependencies [224f7fe]
|
13
|
+
- Updated dependencies [30ac27c]
|
14
|
+
- Updated dependencies [0fd196e]
|
15
|
+
- Updated dependencies [204c626]
|
16
|
+
- Updated dependencies [63be0a5]
|
17
|
+
- @modern-js/core@1.0.0-rc.23
|
18
|
+
- @modern-js/webpack@1.0.0-rc.23
|
19
|
+
- @modern-js/utils@1.0.0-rc.23
|
20
|
+
|
21
|
+
## 1.0.0-rc.22
|
22
|
+
|
23
|
+
### Patch Changes
|
24
|
+
|
25
|
+
- 224f7fe: fix server route match
|
26
|
+
- 30ac27c: feat: add generator package description
|
27
|
+
- 0fd196e: feat: fix bugs
|
28
|
+
- 204c626: feat: initial
|
29
|
+
- 63be0a5: fix: #118 #104
|
30
|
+
- Updated dependencies [224f7fe]
|
31
|
+
- Updated dependencies [30ac27c]
|
32
|
+
- Updated dependencies [0fd196e]
|
33
|
+
- Updated dependencies [204c626]
|
34
|
+
- Updated dependencies [63be0a5]
|
35
|
+
- @modern-js/core@1.0.0-rc.22
|
36
|
+
- @modern-js/webpack@1.0.0-rc.22
|
37
|
+
- @modern-js/utils@1.0.0-rc.22
|
38
|
+
|
39
|
+
## 1.0.0-rc.21
|
40
|
+
|
41
|
+
### Patch Changes
|
42
|
+
|
43
|
+
- 224f7fe: fix server route match
|
44
|
+
- 30ac27c: feat: add generator package description
|
45
|
+
- 0fd196e: feat: fix bugs
|
46
|
+
- 204c626: feat: initial
|
47
|
+
- 63be0a5: fix: #118 #104
|
48
|
+
- Updated dependencies [224f7fe]
|
49
|
+
- Updated dependencies [30ac27c]
|
50
|
+
- Updated dependencies [0fd196e]
|
51
|
+
- Updated dependencies [204c626]
|
52
|
+
- Updated dependencies [63be0a5]
|
53
|
+
- @modern-js/core@1.0.0-rc.21
|
54
|
+
- @modern-js/webpack@1.0.0-rc.21
|
55
|
+
- @modern-js/utils@1.0.0-rc.21
|
56
|
+
|
57
|
+
## 1.0.0-rc.20
|
58
|
+
|
59
|
+
### Patch Changes
|
60
|
+
|
61
|
+
- 224f7fe: fix server route match
|
62
|
+
- 30ac27c: feat: add generator package description
|
63
|
+
- feat: fix bugs
|
64
|
+
- 204c626: feat: initial
|
65
|
+
- 63be0a5: fix: #118 #104
|
66
|
+
- Updated dependencies [224f7fe]
|
67
|
+
- Updated dependencies [30ac27c]
|
68
|
+
- Updated dependencies [undefined]
|
69
|
+
- Updated dependencies [204c626]
|
70
|
+
- Updated dependencies [63be0a5]
|
71
|
+
- @modern-js/core@1.0.0-rc.20
|
72
|
+
- @modern-js/webpack@1.0.0-rc.20
|
73
|
+
- @modern-js/utils@1.0.0-rc.20
|
74
|
+
|
75
|
+
## 1.0.0-rc.19
|
76
|
+
|
77
|
+
### Patch Changes
|
78
|
+
|
79
|
+
- 224f7fe: fix server route match
|
80
|
+
- 30ac27c: feat: add generator package description
|
81
|
+
- 204c626: feat: initial
|
82
|
+
- 63be0a5: fix: #118 #104
|
83
|
+
- Updated dependencies [224f7fe]
|
84
|
+
- Updated dependencies [30ac27c]
|
85
|
+
- Updated dependencies [204c626]
|
86
|
+
- Updated dependencies [63be0a5]
|
87
|
+
- @modern-js/core@1.0.0-rc.19
|
88
|
+
- @modern-js/webpack@1.0.0-rc.19
|
89
|
+
- @modern-js/utils@1.0.0-rc.19
|
90
|
+
|
91
|
+
## 1.0.0-rc.18
|
92
|
+
|
93
|
+
### Patch Changes
|
94
|
+
|
95
|
+
- 224f7fe: fix server route match
|
96
|
+
- 30ac27c: feat: add generator package description
|
97
|
+
- 204c626: feat: initial
|
98
|
+
- 63be0a5: fix: #118 #104
|
99
|
+
- Updated dependencies [224f7fe]
|
100
|
+
- Updated dependencies [30ac27c]
|
101
|
+
- Updated dependencies [204c626]
|
102
|
+
- Updated dependencies [63be0a5]
|
103
|
+
- @modern-js/core@1.0.0-rc.18
|
104
|
+
- @modern-js/webpack@1.0.0-rc.18
|
105
|
+
- @modern-js/utils@1.0.0-rc.18
|
106
|
+
|
107
|
+
## 1.0.0-rc.17
|
108
|
+
|
109
|
+
### Patch Changes
|
110
|
+
|
111
|
+
- 224f7fe: fix server route match
|
112
|
+
- 30ac27c: feat: add generator package description
|
113
|
+
- 204c626: feat: initial
|
114
|
+
- fix: #118 #104
|
115
|
+
- Updated dependencies [224f7fe]
|
116
|
+
- Updated dependencies [30ac27c]
|
117
|
+
- Updated dependencies [204c626]
|
118
|
+
- Updated dependencies [undefined]
|
119
|
+
- @modern-js/core@1.0.0-rc.17
|
120
|
+
- @modern-js/webpack@1.0.0-rc.17
|
121
|
+
- @modern-js/utils@1.0.0-rc.17
|
122
|
+
|
123
|
+
## 1.0.0-rc.16
|
124
|
+
|
125
|
+
### Patch Changes
|
126
|
+
|
127
|
+
- 224f7fe: fix server route match
|
128
|
+
- 30ac27c: feat: add generator package description
|
129
|
+
- 204c626: feat: initial
|
130
|
+
- Updated dependencies [224f7fe]
|
131
|
+
- Updated dependencies [30ac27c]
|
132
|
+
- Updated dependencies [204c626]
|
133
|
+
- @modern-js/core@1.0.0-rc.16
|
134
|
+
- @modern-js/webpack@1.0.0-rc.16
|
135
|
+
- @modern-js/utils@1.0.0-rc.16
|
136
|
+
|
137
|
+
## 1.0.0-rc.15
|
138
|
+
|
139
|
+
### Patch Changes
|
140
|
+
|
141
|
+
- 224f7fe: fix server route match
|
142
|
+
- 30ac27c: feat: add generator package description
|
143
|
+
- 204c626: feat: initial
|
144
|
+
- Updated dependencies [224f7fe]
|
145
|
+
- Updated dependencies [30ac27c]
|
146
|
+
- Updated dependencies [204c626]
|
147
|
+
- @modern-js/core@1.0.0-rc.15
|
148
|
+
- @modern-js/webpack@1.0.0-rc.15
|
149
|
+
- @modern-js/utils@1.0.0-rc.15
|
150
|
+
|
151
|
+
## 1.0.0-rc.14
|
152
|
+
|
153
|
+
### Patch Changes
|
154
|
+
|
155
|
+
- 224f7fe: fix server route match
|
156
|
+
- 204c626: feat: initial
|
157
|
+
- Updated dependencies [224f7fe]
|
158
|
+
- Updated dependencies [204c626]
|
159
|
+
- @modern-js/core@1.0.0-rc.14
|
160
|
+
- @modern-js/webpack@1.0.0-rc.14
|
161
|
+
- @modern-js/utils@1.0.0-rc.14
|
162
|
+
|
163
|
+
## 1.0.0-rc.13
|
164
|
+
|
165
|
+
### Patch Changes
|
166
|
+
|
167
|
+
- 224f7fe: fix server route match
|
168
|
+
- 204c626: feat: initial
|
169
|
+
- Updated dependencies [224f7fe]
|
170
|
+
- Updated dependencies [204c626]
|
171
|
+
- @modern-js/core@1.0.0-rc.13
|
172
|
+
- @modern-js/webpack@1.0.0-rc.13
|
173
|
+
- @modern-js/utils@1.0.0-rc.13
|
174
|
+
|
175
|
+
## 1.0.0-rc.12
|
176
|
+
|
177
|
+
### Patch Changes
|
178
|
+
|
179
|
+
- 224f7fe: fix server route match
|
180
|
+
- 204c626: feat: initial
|
181
|
+
- Updated dependencies [224f7fe]
|
182
|
+
- Updated dependencies [204c626]
|
183
|
+
- @modern-js/core@1.0.0-rc.12
|
184
|
+
- @modern-js/webpack@1.0.0-rc.12
|
185
|
+
- @modern-js/plugin@1.0.0-rc.12
|
186
|
+
- @modern-js/utils@1.0.0-rc.12
|
187
|
+
|
188
|
+
## 1.0.0-rc.11
|
189
|
+
|
190
|
+
### Patch Changes
|
191
|
+
|
192
|
+
- 224f7fe: fix server route match
|
193
|
+
- 204c626: feat: initial
|
194
|
+
- Updated dependencies [224f7fe]
|
195
|
+
- Updated dependencies [204c626]
|
196
|
+
- @modern-js/core@1.0.0-rc.11
|
197
|
+
- @modern-js/webpack@1.0.0-rc.11
|
198
|
+
- @modern-js/plugin@1.0.0-rc.11
|
199
|
+
- @modern-js/utils@1.0.0-rc.11
|
200
|
+
|
201
|
+
## 1.0.0-rc.10
|
202
|
+
|
203
|
+
### Patch Changes
|
204
|
+
|
205
|
+
- 224f7fe: fix server route match
|
206
|
+
- 204c626: feat: initial
|
207
|
+
- Updated dependencies [224f7fe]
|
208
|
+
- Updated dependencies [204c626]
|
209
|
+
- @modern-js/core@1.0.0-rc.10
|
210
|
+
- @modern-js/webpack@1.0.0-rc.10
|
211
|
+
- @modern-js/plugin@1.0.0-rc.10
|
212
|
+
- @modern-js/utils@1.0.0-rc.10
|
213
|
+
|
214
|
+
## 1.0.0-rc.9
|
215
|
+
|
216
|
+
### Patch Changes
|
217
|
+
|
218
|
+
- 224f7fe: fix server route match
|
219
|
+
- 204c626: feat: initial
|
220
|
+
- Updated dependencies [224f7fe]
|
221
|
+
- Updated dependencies [204c626]
|
222
|
+
- @modern-js/core@1.0.0-rc.9
|
223
|
+
- @modern-js/webpack@1.0.0-rc.9
|
224
|
+
- @modern-js/plugin@1.0.0-rc.9
|
225
|
+
- @modern-js/utils@1.0.0-rc.9
|
226
|
+
|
227
|
+
## 1.0.0-rc.8
|
228
|
+
|
229
|
+
### Patch Changes
|
230
|
+
|
231
|
+
- 224f7fe: fix server route match
|
232
|
+
- 204c626: feat: initial
|
233
|
+
- Updated dependencies [224f7fe]
|
234
|
+
- Updated dependencies [204c626]
|
235
|
+
- @modern-js/core@1.0.0-rc.8
|
236
|
+
- @modern-js/webpack@1.0.0-rc.8
|
237
|
+
- @modern-js/plugin@1.0.0-rc.8
|
238
|
+
- @modern-js/utils@1.0.0-rc.8
|
239
|
+
|
240
|
+
## 1.0.0-rc.7
|
241
|
+
|
242
|
+
### Patch Changes
|
243
|
+
|
244
|
+
- 224f7fe: fix server route match
|
245
|
+
- 204c626: feat: initial
|
246
|
+
- Updated dependencies [224f7fe]
|
247
|
+
- Updated dependencies [204c626]
|
248
|
+
- @modern-js/core@1.0.0-rc.7
|
249
|
+
- @modern-js/webpack@1.0.0-rc.7
|
250
|
+
- @modern-js/plugin@1.0.0-rc.7
|
251
|
+
- @modern-js/utils@1.0.0-rc.7
|
252
|
+
|
253
|
+
## 1.0.0-rc.6
|
254
|
+
|
255
|
+
### Patch Changes
|
256
|
+
|
257
|
+
- 224f7fe: fix server route match
|
258
|
+
- 204c626: feat: initial
|
259
|
+
- Updated dependencies [224f7fe]
|
260
|
+
- Updated dependencies [204c626]
|
261
|
+
- @modern-js/core@1.0.0-rc.6
|
262
|
+
- @modern-js/webpack@1.0.0-rc.6
|
263
|
+
- @modern-js/plugin@1.0.0-rc.6
|
264
|
+
- @modern-js/utils@1.0.0-rc.6
|
265
|
+
|
266
|
+
## 1.0.0-rc.5
|
267
|
+
|
268
|
+
### Patch Changes
|
269
|
+
|
270
|
+
- 224f7fe: fix server route match
|
271
|
+
- 204c626: feat: initial
|
272
|
+
- Updated dependencies [224f7fe]
|
273
|
+
- Updated dependencies [204c626]
|
274
|
+
- @modern-js/core@1.0.0-rc.5
|
275
|
+
- @modern-js/webpack@1.0.0-rc.5
|
276
|
+
- @modern-js/plugin@1.0.0-rc.5
|
277
|
+
- @modern-js/utils@1.0.0-rc.5
|
278
|
+
|
279
|
+
## 1.0.0-rc.4
|
280
|
+
|
281
|
+
### Patch Changes
|
282
|
+
|
283
|
+
- fix server route match
|
284
|
+
- 204c626: feat: initial
|
285
|
+
- Updated dependencies [undefined]
|
286
|
+
- Updated dependencies [204c626]
|
287
|
+
- @modern-js/core@1.0.0-rc.4
|
288
|
+
- @modern-js/webpack@1.0.0-rc.4
|
289
|
+
- @modern-js/plugin@1.0.0-rc.4
|
290
|
+
- @modern-js/utils@1.0.0-rc.4
|
291
|
+
|
292
|
+
## 1.0.0-rc.3
|
293
|
+
|
294
|
+
### Patch Changes
|
295
|
+
|
296
|
+
- feat: initial
|
297
|
+
- Updated dependencies [undefined]
|
298
|
+
- @modern-js/core@1.0.0-rc.3
|
299
|
+
- @modern-js/webpack@1.0.0-rc.3
|
300
|
+
- @modern-js/plugin@1.0.0-rc.3
|
301
|
+
- @modern-js/utils@1.0.0-rc.3
|
package/README.md
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
|
2
2
|
<p align="center">
|
3
|
-
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs.png" width="300" alt="Modern.js Logo" /></a>
|
3
|
+
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
4
4
|
</p>
|
5
|
+
<p align="center">
|
6
|
+
现代 Web 工程体系
|
7
|
+
<br/>
|
8
|
+
<a href="https://modernjs.dev" target="blank">
|
9
|
+
modernjs.dev
|
10
|
+
</a>
|
11
|
+
</p>
|
12
|
+
<p align="center">
|
13
|
+
The meta-framework suite designed from scratch for frontend-focused modern web development
|
14
|
+
</p>
|
15
|
+
|
16
|
+
# Introduction
|
5
17
|
|
6
|
-
|
18
|
+
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
7
19
|
|
8
|
-
|
20
|
+
- 介绍 Modern.js (即将上线)
|
9
21
|
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
10
22
|
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
23
|
+
- [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
|
11
24
|
|
12
|
-
##
|
13
|
-
|
14
|
-
Modern.js 的 1.0.0.rc 版已经发到 npm,目前在做测试改进,README 文档之后统一提供(现阶段加入测试和开发,可以发 [issue](https://github.com/modern-js-dev/modern.js/issues) 留微信联系),完整的文档站计划在10月14日上线
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
## Getting Started
|
30
26
|
|
27
|
+
- [Quick Start](https://modernjs.dev/docs/start)
|
28
|
+
- [Guides](https://modernjs.dev/docs/guides)
|
29
|
+
- [API References](https://modernjs.dev/docs/apis)
|
31
30
|
|
31
|
+
## Contributing
|
32
32
|
|
33
|
+
- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Import } from '@modern-js/utils';
|
2
2
|
const core = Import.lazy('@modern-js/core', require);
|
3
|
-
const pluginNode = Import.lazy('@modern-js/plugin/node', require);
|
4
3
|
const features = Import.lazy('./features', require);
|
5
4
|
|
6
5
|
const taskMain = async ({
|
@@ -15,7 +14,6 @@ const taskMain = async ({
|
|
15
14
|
};
|
16
15
|
|
17
16
|
(async () => {
|
18
|
-
pluginNode.enable();
|
19
17
|
const {
|
20
18
|
appContext
|
21
19
|
} = await core.cli.init();
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import path from '
|
1
|
+
import { path, logger } from '@modern-js/utils';
|
2
2
|
import webpack from 'webpack';
|
3
3
|
import WebpackDevServer from 'webpack-dev-server';
|
4
|
-
import { logger } from '@modern-js/utils';
|
5
4
|
import { chokidarFile } from "./utils/chokidar";
|
6
5
|
import { generateFiles } from "./utils/generate-files"; // eslint-disable-next-line max-params
|
7
6
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import path from '
|
2
|
-
import { fs, Import, logger } from '@modern-js/utils';
|
1
|
+
import { path, fs, Import, logger } from '@modern-js/utils';
|
3
2
|
import { valid } from "./utils/valid";
|
4
3
|
const buildFeat = Import.lazy('./build', require);
|
5
4
|
const devFeat = Import.lazy('./dev', require);
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import path from '
|
1
|
+
import { path, logger } from '@modern-js/utils';
|
2
2
|
import chokidar from 'chokidar';
|
3
3
|
import glob from 'glob';
|
4
|
-
import { logger } from '@modern-js/utils';
|
5
4
|
import { generateFiles } from "./generate-files";
|
6
5
|
export function chokidarFile(appDirectory, tmpDir, isDev) {
|
7
6
|
let dirty = false;
|
@@ -10,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
10
10
|
|
11
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
12
12
|
|
13
|
-
import path from '
|
13
|
+
import { path, logger, fs } from '@modern-js/utils';
|
14
14
|
import matter from 'gray-matter';
|
15
15
|
import GithubSlugger from 'github-slugger';
|
16
16
|
import sortPaths from 'sort-paths';
|
@@ -19,7 +19,6 @@ import toString from 'mdast-util-to-string';
|
|
19
19
|
import u from 'unist-builder';
|
20
20
|
import mdx from '@mdx-js/mdx';
|
21
21
|
import babelParser from '@babel/parser';
|
22
|
-
import { logger, fs } from '@modern-js/utils';
|
23
22
|
import { DOCS_RENDER_PATH, MDX_DEFAULT_RENDERER, UTILS_STATIC } from "../constant";
|
24
23
|
|
25
24
|
const loadTemplate = async (file, customPath = false) => {
|
@@ -28,7 +27,7 @@ const loadTemplate = async (file, customPath = false) => {
|
|
28
27
|
if (customPath) {
|
29
28
|
result = await fs.readFile(file, 'utf-8');
|
30
29
|
} else {
|
31
|
-
result = await fs.readFile(path.
|
30
|
+
result = await fs.readFile(path.join(UTILS_STATIC, file), 'utf-8');
|
32
31
|
}
|
33
32
|
|
34
33
|
return _template(result, {
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import path from '
|
2
|
-
import { fs } from '@modern-js/utils';
|
1
|
+
import { path, fs, upath } from '@modern-js/utils';
|
3
2
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
4
3
|
import webpack from 'webpack';
|
5
4
|
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
@@ -44,7 +43,7 @@ export function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
44
43
|
}
|
45
44
|
|
46
45
|
config.resolve.fallback = {
|
47
|
-
path: require.resolve('path-browserify')
|
46
|
+
path: upath.normalizeSafe(require.resolve('path-browserify'))
|
48
47
|
};
|
49
48
|
return config;
|
50
49
|
}
|
package/dist/js/modern/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Import } from '@modern-js/utils';
|
1
|
+
import { Import, upath } from '@modern-js/utils';
|
2
2
|
const core = Import.lazy('@modern-js/core', require);
|
3
3
|
const features = Import.lazy('./features', require);
|
4
4
|
export default core.createPlugin(() => ({
|
@@ -7,7 +7,7 @@ export default core.createPlugin(() => ({
|
|
7
7
|
}) {
|
8
8
|
const {
|
9
9
|
appDirectory
|
10
|
-
} = core.useAppContext()
|
10
|
+
} = core.useAppContext();
|
11
11
|
const devCommand = program.commandsMap.get('dev');
|
12
12
|
|
13
13
|
if (devCommand) {
|
@@ -24,7 +24,7 @@ export default core.createPlugin(() => ({
|
|
24
24
|
moduleToolsMenu() {
|
25
25
|
const {
|
26
26
|
appDirectory
|
27
|
-
} = core.useAppContext()
|
27
|
+
} = core.useAppContext();
|
28
28
|
return {
|
29
29
|
name: 'Docsite 调试',
|
30
30
|
value: 'docsite',
|
@@ -39,7 +39,7 @@ export default core.createPlugin(() => ({
|
|
39
39
|
return {
|
40
40
|
name: 'docsite',
|
41
41
|
title: 'Run Docsite log',
|
42
|
-
taskPath: require.resolve("./build-task"),
|
42
|
+
taskPath: upath.normalizeSafe(require.resolve("./build-task")),
|
43
43
|
params: []
|
44
44
|
};
|
45
45
|
}
|
@@ -4,8 +4,6 @@ var _utils = require("@modern-js/utils");
|
|
4
4
|
|
5
5
|
const core = _utils.Import.lazy('@modern-js/core', require);
|
6
6
|
|
7
|
-
const pluginNode = _utils.Import.lazy('@modern-js/plugin/node', require);
|
8
|
-
|
9
7
|
const features = _utils.Import.lazy('./features', require);
|
10
8
|
|
11
9
|
const taskMain = async ({
|
@@ -20,7 +18,6 @@ const taskMain = async ({
|
|
20
18
|
};
|
21
19
|
|
22
20
|
(async () => {
|
23
|
-
pluginNode.enable();
|
24
21
|
const {
|
25
22
|
appContext
|
26
23
|
} = await core.cli.init();
|
@@ -3,13 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.UTILS_STATIC = exports.MDX_DEFAULT_RENDERER = exports.DOCS_RENDER_PATH = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _utils = require("@modern-js/utils");
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
const UTILS_STATIC = _path.default.join(__dirname, '../../static');
|
10
|
+
const UTILS_STATIC = _utils.path.join(__dirname, '../../static');
|
13
11
|
|
14
12
|
exports.UTILS_STATIC = UTILS_STATIC;
|
15
13
|
const DOCS_RENDER_PATH = '/api/v1/docs/render';
|
@@ -5,14 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.dev = dev;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _utils = require("@modern-js/utils");
|
9
9
|
|
10
10
|
var _webpack = _interopRequireDefault(require("webpack"));
|
11
11
|
|
12
12
|
var _webpackDevServer = _interopRequireDefault(require("webpack-dev-server"));
|
13
13
|
|
14
|
-
var _utils = require("@modern-js/utils");
|
15
|
-
|
16
14
|
var _chokidar = require("./utils/chokidar");
|
17
15
|
|
18
16
|
var _generateFiles = require("./utils/generate-files");
|
@@ -28,7 +26,7 @@ async function dev(appDirectory, tmpDir, files, webpackConfig, isDev, port) {
|
|
28
26
|
port,
|
29
27
|
historyApiFallback: true,
|
30
28
|
static: {
|
31
|
-
directory:
|
29
|
+
directory: _utils.path.resolve(appDirectory, 'assets'),
|
32
30
|
publicPath: '/assets'
|
33
31
|
}
|
34
32
|
}, compiler);
|
@@ -5,14 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.buildDocs = buildDocs;
|
7
7
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _utils = require("@modern-js/utils");
|
11
9
|
|
12
10
|
var _valid = require("./utils/valid");
|
13
11
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
12
|
const buildFeat = _utils.Import.lazy('./build', require);
|
17
13
|
|
18
14
|
const devFeat = _utils.Import.lazy('./dev', require);
|
@@ -35,7 +31,7 @@ async function buildDocs({
|
|
35
31
|
return;
|
36
32
|
}
|
37
33
|
|
38
|
-
const docsDir =
|
34
|
+
const docsDir = _utils.path.resolve(appDirectory, 'docs');
|
39
35
|
|
40
36
|
if (!_utils.fs.pathExistsSync(docsDir)) {
|
41
37
|
return;
|
@@ -52,7 +48,7 @@ async function buildDocs({
|
|
52
48
|
return;
|
53
49
|
}
|
54
50
|
|
55
|
-
const tmpDir =
|
51
|
+
const tmpDir = _utils.path.join(appDirectory, './node_modules/.modern-js/docs');
|
56
52
|
|
57
53
|
_utils.fs.ensureDirSync(tmpDir);
|
58
54
|
|
@@ -5,14 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.chokidarFile = chokidarFile;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _utils = require("@modern-js/utils");
|
9
9
|
|
10
10
|
var _chokidar = _interopRequireDefault(require("chokidar"));
|
11
11
|
|
12
12
|
var _glob = _interopRequireDefault(require("glob"));
|
13
13
|
|
14
|
-
var _utils = require("@modern-js/utils");
|
15
|
-
|
16
14
|
var _generateFiles = require("./generate-files");
|
17
15
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -34,7 +32,7 @@ function chokidarFile(appDirectory, tmpDir, isDev) {
|
|
34
32
|
_utils.logger.info('changed, collect and rebuild docs');
|
35
33
|
|
36
34
|
const files = _glob.default.sync('**/*.{md,mdx}', {
|
37
|
-
cwd:
|
35
|
+
cwd: _utils.path.resolve(appDirectory, 'docs'),
|
38
36
|
ignore: '**/_*'
|
39
37
|
});
|
40
38
|
|
@@ -15,7 +15,7 @@ var _camelCase2 = _interopRequireDefault(require("lodash/camelCase"));
|
|
15
15
|
|
16
16
|
var _startCase2 = _interopRequireDefault(require("lodash/startCase"));
|
17
17
|
|
18
|
-
var
|
18
|
+
var _utils = require("@modern-js/utils");
|
19
19
|
|
20
20
|
var _grayMatter = _interopRequireDefault(require("gray-matter"));
|
21
21
|
|
@@ -33,8 +33,6 @@ var _mdx = _interopRequireDefault(require("@mdx-js/mdx"));
|
|
33
33
|
|
34
34
|
var _parser = _interopRequireDefault(require("@babel/parser"));
|
35
35
|
|
36
|
-
var _utils = require("@modern-js/utils");
|
37
|
-
|
38
36
|
var _constant = require("../constant");
|
39
37
|
|
40
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -51,7 +49,7 @@ const loadTemplate = async (file, customPath = false) => {
|
|
51
49
|
if (customPath) {
|
52
50
|
result = await _utils.fs.readFile(file, 'utf-8');
|
53
51
|
} else {
|
54
|
-
result = await _utils.fs.readFile(
|
52
|
+
result = await _utils.fs.readFile(_utils.path.join(_constant.UTILS_STATIC, file), 'utf-8');
|
55
53
|
}
|
56
54
|
|
57
55
|
return (0, _template2.default)(result, {
|
@@ -62,11 +60,11 @@ const loadTemplate = async (file, customPath = false) => {
|
|
62
60
|
// eslint-disable-next-line max-statements
|
63
61
|
async function handleFile(appDirectory, tmpDir, file, images) {
|
64
62
|
const moduleName = file.replace(/\.(md|mdx)$/, '');
|
65
|
-
const content = await _utils.fs.readFile(
|
63
|
+
const content = await _utils.fs.readFile(_utils.path.resolve(appDirectory, 'docs', file));
|
66
64
|
const parsed = (0, _grayMatter.default)(content);
|
67
65
|
|
68
66
|
if (!parsed.data.title) {
|
69
|
-
parsed.data.title = (0, _startCase2.default)((0, _camelCase2.default)(
|
67
|
+
parsed.data.title = (0, _startCase2.default)((0, _camelCase2.default)(_utils.path.basename(moduleName)));
|
70
68
|
}
|
71
69
|
|
72
70
|
const slugger = new _githubSlugger.default();
|
@@ -148,15 +146,15 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
148
146
|
} = node;
|
149
147
|
|
150
148
|
if (!url.startsWith('http')) {
|
151
|
-
const fullPath =
|
149
|
+
const fullPath = _utils.path.resolve(_utils.path.dirname(_utils.path.resolve(appDirectory, 'docs', file)), url);
|
152
150
|
|
153
|
-
const relativePath =
|
151
|
+
const relativePath = _utils.path.relative(_utils.path.resolve(appDirectory, 'assets'), fullPath);
|
154
152
|
|
155
153
|
if (relativePath.startsWith('..')) {
|
156
154
|
_utils.logger.warn(`${url} referenced in ${file} is not under the "assets" folder`);
|
157
155
|
} else {
|
158
156
|
images.push(relativePath);
|
159
|
-
node.url = `/${
|
157
|
+
node.url = `/${_utils.path.relative(_utils.path.dirname(_utils.path.resolve(appDirectory, 'docs', file)), _utils.path.resolve(appDirectory, 'docs/assets', relativePath))}`;
|
160
158
|
}
|
161
159
|
}
|
162
160
|
});
|
@@ -167,19 +165,19 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
167
165
|
});
|
168
166
|
const totalExported = (0, _union2.default)(imported.map(n => n.id), exported.map(n => n.id));
|
169
167
|
|
170
|
-
const outputFile =
|
168
|
+
const outputFile = _utils.path.resolve(tmpDir, `${moduleName}/mdx.jsx`);
|
171
169
|
|
172
170
|
await _utils.fs.outputFile(outputFile, _constant.MDX_DEFAULT_RENDERER + transpiled, {
|
173
171
|
encoding: 'utf8'
|
174
172
|
});
|
175
173
|
|
176
|
-
const pageFile =
|
174
|
+
const pageFile = _utils.path.resolve(tmpDir, `${moduleName}/index.jsx`);
|
177
175
|
|
178
176
|
const pageTemplate = await loadTemplate('docs-page.jsx.tpl');
|
179
177
|
const pageContent = pageTemplate({
|
180
178
|
moduleName,
|
181
179
|
toc: JSON.stringify(toc),
|
182
|
-
relRoot:
|
180
|
+
relRoot: _utils.path.relative(_utils.path.dirname(outputFile), tmpDir),
|
183
181
|
imports: totalExported.length ? `import { ${totalExported.join(', ')} } from './mdx';` : '',
|
184
182
|
imported: totalExported.join(',')
|
185
183
|
});
|
@@ -199,16 +197,16 @@ async function generateFiles(appDirectory, tmpDir, files, isDev) {
|
|
199
197
|
const meta = await Promise.all(files.map(file => handleFile(appDirectory, tmpDir, file, images)));
|
200
198
|
const sorted = (0, _sortPaths.default)(meta, e => e.moduleName.endsWith('index') ? e.moduleName.replace(/index$/, '') : `${e.moduleName}/`, '/');
|
201
199
|
const routesTemplate = await loadTemplate('DocsRoutes.jsx.tpl');
|
202
|
-
await _utils.fs.outputFile(
|
200
|
+
await _utils.fs.outputFile(_utils.path.resolve(tmpDir, 'DocsRoutes.jsx'), routesTemplate({
|
203
201
|
meta: sorted
|
204
202
|
}));
|
205
|
-
const pkgInfo = await _utils.fs.readJson(
|
203
|
+
const pkgInfo = await _utils.fs.readJson(_utils.path.resolve(appDirectory, 'package.json'));
|
206
204
|
const entryTemplate = await loadTemplate('docs-entry.jsx.tpl');
|
207
|
-
await _utils.fs.outputFile(
|
205
|
+
await _utils.fs.outputFile(_utils.path.resolve(tmpDir, 'docs-entry.jsx'), entryTemplate({
|
208
206
|
basename: isDev ? '/' : `${_constant.DOCS_RENDER_PATH}/${pkgInfo.name}/${pkgInfo.version}`
|
209
207
|
}));
|
210
|
-
await Promise.all(['DocsNav.jsx.tpl', 'DocsToc.jsx.tpl', 'docs.css'].map(async file => _utils.fs.copyFile(
|
211
|
-
await _utils.fs.outputJson(
|
208
|
+
await Promise.all(['DocsNav.jsx.tpl', 'DocsToc.jsx.tpl', 'docs.css'].map(async file => _utils.fs.copyFile(_utils.path.resolve(_constant.UTILS_STATIC, file), _utils.path.resolve(tmpDir, file.replace('.tpl', '')))));
|
209
|
+
await _utils.fs.outputJson(_utils.path.resolve(tmpDir, 'meta.json'), sorted.map(({
|
212
210
|
title,
|
213
211
|
moduleName
|
214
212
|
}) => ({
|
@@ -217,7 +215,7 @@ async function generateFiles(appDirectory, tmpDir, files, isDev) {
|
|
217
215
|
})), {
|
218
216
|
spaces: 2
|
219
217
|
});
|
220
|
-
await _utils.fs.ensureDir(
|
221
|
-
await Promise.all(Array.from(new Set(images)).map(file => _utils.fs.copyFile(
|
218
|
+
await _utils.fs.ensureDir(_utils.path.resolve(appDirectory, 'dist/docs/assets'));
|
219
|
+
await Promise.all(Array.from(new Set(images)).map(file => _utils.fs.copyFile(_utils.path.resolve(appDirectory, 'assets', file), _utils.path.resolve(appDirectory, 'dist/docs/assets', file))));
|
222
220
|
return sorted;
|
223
221
|
}
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.generatorWebpackConfig = generatorWebpackConfig;
|
7
7
|
exports.runWebpack = runWebpack;
|
8
8
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
10
|
-
|
11
9
|
var _utils = require("@modern-js/utils");
|
12
10
|
|
13
11
|
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
@@ -27,40 +25,40 @@ function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
27
25
|
mode: isDev ? 'development' : 'production',
|
28
26
|
context: tmpDir,
|
29
27
|
entry: {
|
30
|
-
index:
|
28
|
+
index: _utils.path.resolve(tmpDir, 'docs-entry.jsx')
|
31
29
|
},
|
32
30
|
output: {
|
33
|
-
path:
|
31
|
+
path: _utils.path.resolve(appDirectory, 'dist/docs')
|
34
32
|
},
|
35
33
|
resolve: originConfig.resolve || {
|
36
34
|
alias: {}
|
37
35
|
},
|
38
36
|
module: originConfig.module,
|
39
37
|
plugins: [...plugins, new _htmlWebpackPlugin.default({
|
40
|
-
templateContent: _utils.fs.readFileSync(
|
38
|
+
templateContent: _utils.fs.readFileSync(_utils.path.resolve(_constant.UTILS_STATIC, 'index.html.ejs'), 'utf8')
|
41
39
|
})]
|
42
40
|
};
|
43
|
-
config.resolve.modules = [...(config.resolve.modules || []),
|
44
|
-
config.resolve.alias['@assets'] =
|
45
|
-
config.resolve.alias['@styles'] =
|
41
|
+
config.resolve.modules = [...(config.resolve.modules || []), _utils.path.join(__dirname, '../../../../../', 'node_modules')];
|
42
|
+
config.resolve.alias['@assets'] = _utils.path.resolve(appDirectory, 'assets');
|
43
|
+
config.resolve.alias['@styles'] = _utils.path.resolve(appDirectory, 'styles'); // fix this since react-live relies on core-js@2
|
46
44
|
|
47
|
-
config.resolve.alias[`${
|
48
|
-
const pkgJSON = JSON.parse(_utils.fs.readFileSync(
|
45
|
+
config.resolve.alias[`${_utils.path.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es';
|
46
|
+
const pkgJSON = JSON.parse(_utils.fs.readFileSync(_utils.path.join(appDirectory, 'package.json'), 'utf-8'));
|
49
47
|
|
50
48
|
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
51
|
-
config.resolve.alias.react =
|
49
|
+
config.resolve.alias.react = _utils.path.resolve('node_modules/react');
|
52
50
|
} else {
|
53
|
-
config.resolve.alias.react =
|
51
|
+
config.resolve.alias.react = _utils.path.resolve(__dirname, '../../../../../', 'node_modules', 'react');
|
54
52
|
}
|
55
53
|
|
56
54
|
if (pkgJSON.dependencies['react-dom'] || pkgJSON.devDependencies['react-dom']) {
|
57
|
-
config.resolve.alias['react-dom'] =
|
55
|
+
config.resolve.alias['react-dom'] = _utils.path.resolve('node_modules/react-dom');
|
58
56
|
} else {
|
59
|
-
config.resolve.alias['react-dom'] =
|
57
|
+
config.resolve.alias['react-dom'] = _utils.path.resolve(__dirname, '../../../../../', 'node_modules', 'react-dom');
|
60
58
|
}
|
61
59
|
|
62
60
|
config.resolve.fallback = {
|
63
|
-
path: require.resolve('path-browserify')
|
61
|
+
path: _utils.upath.normalizeSafe(require.resolve('path-browserify'))
|
64
62
|
};
|
65
63
|
return config;
|
66
64
|
}
|
package/dist/js/node/index.js
CHANGED
@@ -17,7 +17,7 @@ var _default = core.createPlugin(() => ({
|
|
17
17
|
}) {
|
18
18
|
const {
|
19
19
|
appDirectory
|
20
|
-
} = core.useAppContext()
|
20
|
+
} = core.useAppContext();
|
21
21
|
const devCommand = program.commandsMap.get('dev');
|
22
22
|
|
23
23
|
if (devCommand) {
|
@@ -34,7 +34,7 @@ var _default = core.createPlugin(() => ({
|
|
34
34
|
moduleToolsMenu() {
|
35
35
|
const {
|
36
36
|
appDirectory
|
37
|
-
} = core.useAppContext()
|
37
|
+
} = core.useAppContext();
|
38
38
|
return {
|
39
39
|
name: 'Docsite 调试',
|
40
40
|
value: 'docsite',
|
@@ -49,7 +49,7 @@ var _default = core.createPlugin(() => ({
|
|
49
49
|
return {
|
50
50
|
name: 'docsite',
|
51
51
|
title: 'Run Docsite log',
|
52
|
-
taskPath: require.resolve("./build-task"),
|
52
|
+
taskPath: _utils.upath.normalizeSafe(require.resolve("./build-task")),
|
53
53
|
params: []
|
54
54
|
};
|
55
55
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
declare const _default: import("@modern-js/
|
2
|
-
config: import("@modern-js/
|
3
|
-
validateSchema: import("@modern-js/
|
4
|
-
prepare: import("@modern-js/
|
5
|
-
commands: import("@modern-js/
|
1
|
+
declare const _default: import("@modern-js/core").AsyncPlugin<Partial<import("@modern-js/core").Progresses2Threads<{
|
2
|
+
config: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
3
|
+
validateSchema: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
4
|
+
prepare: import("@modern-js/core").AsyncWorkflow<void, void>;
|
5
|
+
commands: import("@modern-js/core").AsyncWorkflow<{
|
6
6
|
program: import("commander").Command;
|
7
7
|
}, void>;
|
8
|
-
watchFiles: import("@modern-js/
|
9
|
-
fileChange: import("@modern-js/
|
8
|
+
watchFiles: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
9
|
+
fileChange: import("@modern-js/core").AsyncWorkflow<{
|
10
10
|
filename: string;
|
11
11
|
}, void>;
|
12
|
-
beforeExit: import("@modern-js/
|
13
|
-
} & import("@modern-js/
|
12
|
+
beforeExit: import("@modern-js/core").AsyncWorkflow<void, void>;
|
13
|
+
} & import("@modern-js/core").ClearDraftProgress<import("@modern-js/core").Hooks>>>>;
|
14
14
|
|
15
15
|
export default _default;
|
package/package.json
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/plugin-docsite",
|
3
|
-
"
|
3
|
+
"description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
|
4
|
+
"homepage": "https://modernjs.dev",
|
5
|
+
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
6
|
+
"repository": "modern-js-dev/modern.js",
|
7
|
+
"license": "MIT",
|
8
|
+
"keywords": [
|
9
|
+
"react",
|
10
|
+
"framework",
|
11
|
+
"modern",
|
12
|
+
"modern.js"
|
13
|
+
],
|
14
|
+
"version": "1.0.0-rc.23",
|
4
15
|
"jsnext:source": "./src/index.ts",
|
5
16
|
"types": "./dist/types/index.d.ts",
|
6
17
|
"main": "./dist/js/node/index.js",
|
@@ -21,10 +32,8 @@
|
|
21
32
|
"@babel/runtime": "^7",
|
22
33
|
"@mdx-js/mdx": "^1.6.22",
|
23
34
|
"@mdx-js/react": "^1.6.22",
|
24
|
-
"@modern-js/
|
25
|
-
"@modern-js/
|
26
|
-
"@modern-js/utils": "^1.0.0-rc.2",
|
27
|
-
"@modern-js/webpack": "^1.0.0-rc.2",
|
35
|
+
"@modern-js/utils": "^1.0.0-rc.23",
|
36
|
+
"@modern-js/webpack": "^1.0.0-rc.23",
|
28
37
|
"antd": "^4.16.13",
|
29
38
|
"chokidar": "^3.5.2",
|
30
39
|
"core-js": "^3.17.2",
|
@@ -48,7 +57,7 @@
|
|
48
57
|
"webpack-dev-server": "^4.1.1"
|
49
58
|
},
|
50
59
|
"devDependencies": {
|
51
|
-
"@modern-js/module-tools-hooks": "^1.0.0-rc.
|
60
|
+
"@modern-js/module-tools-hooks": "^1.0.0-rc.23",
|
52
61
|
"@types/core-js": "^2.5.5",
|
53
62
|
"@types/github-slugger": "^1.3.0",
|
54
63
|
"@types/glob": "^7.1.4",
|
@@ -59,8 +68,12 @@
|
|
59
68
|
"@types/react-dom": "^17",
|
60
69
|
"@types/webpack-dev-server": "^4.1.0",
|
61
70
|
"typescript": "^4",
|
62
|
-
"@modern-js/
|
63
|
-
"@modern-js/
|
71
|
+
"@modern-js/core": "^1.0.0-rc.23",
|
72
|
+
"@modern-js/plugin-testing": "^1.0.0-rc.23",
|
73
|
+
"@modern-js/module-tools": "^1.0.0-rc.23"
|
74
|
+
},
|
75
|
+
"peerDependencies": {
|
76
|
+
"@modern-js/core": "^1.0.0-rc.23"
|
64
77
|
},
|
65
78
|
"sideEffects": false,
|
66
79
|
"modernConfig": {
|
@@ -74,6 +87,10 @@
|
|
74
87
|
]
|
75
88
|
}
|
76
89
|
},
|
90
|
+
"publishConfig": {
|
91
|
+
"registry": "https://registry.npmjs.org/",
|
92
|
+
"access": "public"
|
93
|
+
},
|
77
94
|
"scripts": {
|
78
95
|
"new": "modern new",
|
79
96
|
"build": "modern build",
|
package/src/build-task.ts
CHANGED
@@ -5,10 +5,6 @@ const core: typeof import('@modern-js/core') = Import.lazy(
|
|
5
5
|
'@modern-js/core',
|
6
6
|
require,
|
7
7
|
);
|
8
|
-
const pluginNode: typeof import('@modern-js/plugin/node') = Import.lazy(
|
9
|
-
'@modern-js/plugin/node',
|
10
|
-
require,
|
11
|
-
);
|
12
8
|
const features: typeof import('./features') = Import.lazy(
|
13
9
|
'./features',
|
14
10
|
require,
|
@@ -24,7 +20,6 @@ const taskMain = async ({ appContext }: IBuildTaskOption) => {
|
|
24
20
|
};
|
25
21
|
|
26
22
|
(async () => {
|
27
|
-
pluginNode.enable();
|
28
23
|
const { appContext } = await core.cli.init();
|
29
24
|
await core.manager.run(async () => {
|
30
25
|
try {
|
package/src/features/constant.ts
CHANGED
package/src/features/dev.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
import path from '
|
1
|
+
import { path, logger } from '@modern-js/utils';
|
2
2
|
import webpack, { Configuration } from 'webpack';
|
3
3
|
import WebpackDevServer from 'webpack-dev-server';
|
4
|
-
import { logger } from '@modern-js/utils';
|
5
4
|
import { chokidarFile } from './utils/chokidar';
|
6
5
|
import { generateFiles } from './utils/generate-files';
|
7
6
|
|
package/src/features/index.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
import path from '
|
1
|
+
import { path, logger } from '@modern-js/utils';
|
2
2
|
import chokidar from 'chokidar';
|
3
3
|
import glob from 'glob';
|
4
|
-
import { logger } from '@modern-js/utils';
|
5
4
|
import { generateFiles } from './generate-files';
|
6
5
|
|
7
6
|
export function chokidarFile(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import path from '
|
1
|
+
import { path, logger, fs } from '@modern-js/utils';
|
2
2
|
import matter from 'gray-matter';
|
3
3
|
import { startCase, camelCase, union, template, difference } from 'lodash';
|
4
4
|
import GithubSlugger from 'github-slugger';
|
@@ -8,7 +8,6 @@ import toString from 'mdast-util-to-string';
|
|
8
8
|
import u from 'unist-builder';
|
9
9
|
import mdx from '@mdx-js/mdx';
|
10
10
|
import babelParser, { ParserOptions } from '@babel/parser';
|
11
|
-
import { logger, fs } from '@modern-js/utils';
|
12
11
|
import {
|
13
12
|
DOCS_RENDER_PATH,
|
14
13
|
MDX_DEFAULT_RENDERER,
|
@@ -20,10 +19,7 @@ const loadTemplate = async (file: string, customPath = false) => {
|
|
20
19
|
if (customPath) {
|
21
20
|
result = await fs.readFile(file, 'utf-8');
|
22
21
|
} else {
|
23
|
-
result = await fs.readFile(
|
24
|
-
path.resolve(__dirname, '../../..', 'static', file),
|
25
|
-
'utf-8',
|
26
|
-
);
|
22
|
+
result = await fs.readFile(path.join(UTILS_STATIC, file), 'utf-8');
|
27
23
|
}
|
28
24
|
|
29
25
|
return template(result, { interpolate: /<%=([\s\S]+?)%>/g });
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import path from '
|
2
|
-
import { fs } from '@modern-js/utils';
|
1
|
+
import { path, fs, upath } from '@modern-js/utils';
|
3
2
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
4
3
|
import webpack, { Configuration, WebpackPluginInstance } from 'webpack';
|
5
4
|
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
@@ -83,7 +82,7 @@ export function generatorWebpackConfig(
|
|
83
82
|
);
|
84
83
|
}
|
85
84
|
|
86
|
-
config.resolve!.fallback = { path: require.resolve('path-browserify') };
|
85
|
+
config.resolve!.fallback = { path: upath.normalizeSafe(require.resolve('path-browserify')) };
|
87
86
|
return config;
|
88
87
|
}
|
89
88
|
|
package/src/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Import } from '@modern-js/utils';
|
1
|
+
import { Import, upath } from '@modern-js/utils';
|
2
2
|
|
3
3
|
const core: typeof import('@modern-js/core') = Import.lazy(
|
4
4
|
'@modern-js/core',
|
@@ -12,7 +12,7 @@ const features: typeof import('./features') = Import.lazy(
|
|
12
12
|
export default core.createPlugin(
|
13
13
|
() => ({
|
14
14
|
commands({ program }: any) {
|
15
|
-
const { appDirectory } = core.useAppContext()
|
15
|
+
const { appDirectory } = core.useAppContext();
|
16
16
|
const devCommand = program.commandsMap.get('dev');
|
17
17
|
if (devCommand) {
|
18
18
|
devCommand.command('docs').action(async () => {
|
@@ -22,7 +22,7 @@ export default core.createPlugin(
|
|
22
22
|
},
|
23
23
|
// module-tools menu mode
|
24
24
|
moduleToolsMenu() {
|
25
|
-
const { appDirectory } = core.useAppContext()
|
25
|
+
const { appDirectory } = core.useAppContext();
|
26
26
|
return {
|
27
27
|
name: 'Docsite 调试',
|
28
28
|
value: 'docsite',
|
@@ -33,7 +33,7 @@ export default core.createPlugin(
|
|
33
33
|
return {
|
34
34
|
name: 'docsite',
|
35
35
|
title: 'Run Docsite log',
|
36
|
-
taskPath: require.resolve('./build-task'),
|
36
|
+
taskPath: upath.normalizeSafe(require.resolve('./build-task')),
|
37
37
|
params: [],
|
38
38
|
};
|
39
39
|
},
|