@modern-js/module-tools-docs 2.13.4 → 2.15.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @modern-js/module-tools-docs
|
|
2
2
|
|
|
3
|
+
## 2.15.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @modern-js/doc-tools@2.15.0
|
|
8
|
+
- @modern-js/doc-plugin-auto-sidebar@2.15.0
|
|
9
|
+
|
|
10
|
+
## 2.14.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 432ac8b: chore(cli): improve commands descriptions
|
|
15
|
+
|
|
16
|
+
chore(cli): 优化命令的描述文案
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [432ac8b]
|
|
19
|
+
- @modern-js/doc-tools@2.14.0
|
|
20
|
+
- @modern-js/doc-plugin-auto-sidebar@2.14.0
|
|
21
|
+
|
|
3
22
|
## 2.13.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -282,6 +282,37 @@ Path to the tsconfig file
|
|
|
282
282
|
- type: `string`
|
|
283
283
|
- default: `. /tsconfig.json`
|
|
284
284
|
|
|
285
|
+
## esbuildOptions
|
|
286
|
+
|
|
287
|
+
Directly modify [esbuild configuration](https://esbuild.github.io/api/)
|
|
288
|
+
|
|
289
|
+
- Type: `Function`
|
|
290
|
+
- Default: `c => c`
|
|
291
|
+
|
|
292
|
+
For example, if we need to modify the file extension of the generated files:
|
|
293
|
+
|
|
294
|
+
```ts modern.config.ts
|
|
295
|
+
import { defineConfig } from '@modern-js/module-tools';
|
|
296
|
+
|
|
297
|
+
export default defineConfig({
|
|
298
|
+
buildConfig: {
|
|
299
|
+
esbuildOptions: options => {
|
|
300
|
+
options.outExtension = { '.js': '.mjs' };
|
|
301
|
+
return options;
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
:::tip
|
|
308
|
+
We have done many extensions based on the original esbuild build. Therefore, when using this configuration, pay attention to the following:
|
|
309
|
+
|
|
310
|
+
1. Prefer to use the configuration we provide. For example, esbuild does not support target: 'es5', but we support this scenario internally using swc. Setting target: 'es5' through esbuildOptions will result in an error.
|
|
311
|
+
2. Currently, we use enhanced-resolve internally to replace esbuild's resolve algorithm, so modifying esbuild resolve-related configurations is invalid. We plan to switch back in the future.
|
|
312
|
+
3. When using esbuild plugins, you need to add the plugins to the beginning of the plugins array because we also intervene in the entire build process through an esbuild plugin internally. Therefore, custom plugins need to be registered first.
|
|
313
|
+
|
|
314
|
+
:::
|
|
315
|
+
|
|
285
316
|
## externals
|
|
286
317
|
|
|
287
318
|
Configure external dependencies that will not be packaged into the final bundle
|
|
@@ -323,6 +323,37 @@ TypeScript 配置文件的路径。
|
|
|
323
323
|
- 类型: `string`
|
|
324
324
|
- 默认值: `./tsconfig.json`
|
|
325
325
|
|
|
326
|
+
## esbuildOptions
|
|
327
|
+
|
|
328
|
+
直接修改[esbuild 配置](https://esbuild.github.io/api/)
|
|
329
|
+
|
|
330
|
+
- 类型: `Function`
|
|
331
|
+
- 默认值: `c => c`
|
|
332
|
+
|
|
333
|
+
例如我们需要修改生成文件的后缀:
|
|
334
|
+
|
|
335
|
+
```js modern.config.ts
|
|
336
|
+
import { defineConfig } from '@modern-js/module-tools';
|
|
337
|
+
|
|
338
|
+
export default defineConfig({
|
|
339
|
+
buildConfig: {
|
|
340
|
+
esbuildOptions: options => {
|
|
341
|
+
options.outExtension = { '.js': '.mjs' };
|
|
342
|
+
return option;
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
:::tip
|
|
349
|
+
我们在原本 esbuild 构建的基础上做了许多扩展,因此使用此配置需要注意以下几点:
|
|
350
|
+
|
|
351
|
+
1. 优先使用我们提供的配置,例如 esbuild 并不支持`target: 'es5'`,但我们内部使用 swc 支持了此场景,此时通过`esbuildOptions`设置`target: 'es5'`会报错。
|
|
352
|
+
2. 目前我们内部使用`enhanced-resolve`替代了 esbuild 的 resolve 解析算法,所以修改 esbuild resolve 相关配置无效,计划在未来会切换回来。
|
|
353
|
+
3. 使用 esbuild 插件时需要将插件加在 plugins 数组的头部,因为我们内部也是通过一个 esbuild 插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。
|
|
354
|
+
|
|
355
|
+
:::
|
|
356
|
+
|
|
326
357
|
## externals
|
|
327
358
|
|
|
328
359
|
配置外部依赖,不会被打包到最终的 bundle 中。
|
|
@@ -11,7 +11,7 @@ sidebar_position: 2
|
|
|
11
11
|
```bash
|
|
12
12
|
Usage: modern build [options]
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
构建生产环境产物
|
|
15
15
|
|
|
16
16
|
Options:
|
|
17
17
|
-w, --watch 使用监听模式构建代码
|
|
@@ -41,7 +41,7 @@ Options:
|
|
|
41
41
|
```bash
|
|
42
42
|
Usage: modern new [options]
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
启用可选功能
|
|
45
45
|
|
|
46
46
|
Options:
|
|
47
47
|
-d, --debug 开启 Debug 模式,打印调试日志信息 (default: false)
|
|
@@ -67,7 +67,7 @@ Options:
|
|
|
67
67
|
```bash
|
|
68
68
|
Usage: modern dev [options]
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
运行和调试模块
|
|
71
71
|
|
|
72
72
|
Options:
|
|
73
73
|
-h, --help display help for command
|
package/package.json
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/modern.js/issues",
|
|
6
6
|
"repository": "web-infra-dev/modern.js",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.15.0",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@code-hike/mdx": "^0.7.4",
|
|
12
12
|
"react": "^18.2.0",
|
|
13
13
|
"react-dom": "^18.2.0",
|
|
14
14
|
"shiki": "^0.11.1",
|
|
15
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.
|
|
16
|
-
"@modern-js/doc-tools": "2.
|
|
15
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.15.0",
|
|
16
|
+
"@modern-js/doc-tools": "2.15.0"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "modern dev",
|