@modern-js/module-tools-docs 2.27.0 → 2.29.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,20 @@
1
1
  # @modern-js/module-tools-docs
2
2
 
3
+ ## 2.29.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/doc-plugin-auto-sidebar@2.29.0
8
+ - @modern-js/doc-tools@2.29.0
9
+
10
+ ## 2.28.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [d3e52e4]
15
+ - @modern-js/doc-plugin-auto-sidebar@2.28.0
16
+ - @modern-js/doc-tools@2.28.0
17
+
3
18
  ## 2.27.0
4
19
 
5
20
  ### Patch Changes
@@ -217,7 +217,7 @@ Whether to require peerDep dependencies for external projects
217
217
  The build type, `bundle` will package your code, `bundleless` will only do the code conversion
218
218
 
219
219
  - **Type**: `'bundle' | 'bundleless'`
220
- - **Default**: `bundle`
220
+ - **Default**: `'bundle'`
221
221
 
222
222
  ## copy
223
223
 
@@ -346,15 +346,37 @@ When this configuration is disabled, there is no guarantee that the type files w
346
346
  The output path of the dts file, based on [outDir](/api/config/build-config#outDir)
347
347
 
348
348
  - **Type**: `string`
349
- - **Default**: `. /types`
349
+ - **Default**: `./`
350
+
351
+ For example, output to the `types` directory under the `outDir`:
352
+
353
+ ```js modern.config.ts
354
+ export default defineConfig({
355
+ buildConfig: {
356
+ dts: {
357
+ distPath: './types',
358
+ },
359
+ },
360
+ });
361
+ ```
350
362
 
351
363
  ## dts.only
352
364
 
353
- Generate only dts files, not js files
365
+ Whether to generate only type files during the build process without generating JavaScript output files.
354
366
 
355
367
  - **Type**: `boolean`
356
368
  - **Default**: `false`
357
369
 
370
+ ```js modern.config.ts
371
+ export default defineConfig({
372
+ buildConfig: {
373
+ dts: {
374
+ only: true,
375
+ },
376
+ },
377
+ });
378
+ ```
379
+
358
380
  ## dts.respectExternal
359
381
 
360
382
  When set to `false`, the type of third-party packages will be excluded from the bundle, when set to `true`, it will determine whether third-party types need to be bundled based on [externals](#externals).
@@ -365,6 +387,16 @@ So we can avoid it with this configuration.
365
387
  - **Type**: `boolean`
366
388
  - **Default**: `true`
367
389
 
390
+ ```js modern.config.ts
391
+ export default defineConfig({
392
+ buildConfig: {
393
+ dts: {
394
+ respectExternal: false,
395
+ },
396
+ },
397
+ });
398
+ ```
399
+
368
400
  ## dts.tsconfigPath
369
401
 
370
402
  Path to the tsconfig file
@@ -372,11 +404,22 @@ Path to the tsconfig file
372
404
  - **Type**: `string`
373
405
  - **Default**: `. /tsconfig.json`
374
406
 
407
+ ```js modern.config.ts
408
+ export default defineConfig({
409
+ buildConfig: {
410
+ dts: {
411
+ tsconfigPath: './other-tsconfig.json',
412
+ },
413
+ },
414
+ });
415
+ ```
416
+
375
417
  ## esbuildOptions
376
418
 
377
419
  Used to modify the [esbuild configuration](https://esbuild.github.io/api/).
378
420
 
379
421
  - **Type**: `Function`
422
+ - **Build Type**: `Only supported for buildType: 'bundle'`
380
423
  - **Default**: `c => c`
381
424
 
382
425
  For example, if we need to modify the file extension of the generated files:
@@ -645,17 +688,33 @@ export default {
645
688
 
646
689
  ## outDir
647
690
 
648
- Specifies the output directory of the build
691
+ Specifies the output directory of the build.
649
692
 
650
693
  - **Type**: `string`
651
- - **Default**: `dist`
694
+ - **Default**: `./dist`
695
+
696
+ ```js modern.config.ts
697
+ export default defineConfig({
698
+ buildConfig: {
699
+ outDir: './dist/esm',
700
+ },
701
+ });
702
+ ```
652
703
 
653
704
  ## platform
654
705
 
655
706
  Generates code for the node environment by default, you can also specify `browser` which will generate code for the browser environment
656
707
 
657
708
  - **Type**: `'browser' | 'node'`
658
- - **Default**: `node`
709
+ - **Default**: `'node'`
710
+
711
+ ```js modern.config.ts
712
+ export default defineConfig({
713
+ buildConfig: {
714
+ platform: 'browser',
715
+ },
716
+ });
717
+ ```
659
718
 
660
719
  ## redirect
661
720
 
@@ -100,6 +100,7 @@ export const buildConfig = [
100
100
  {
101
101
  format: 'umd',
102
102
  target: 'es6',
103
+ platform: 'browser',
103
104
  buildType: 'bundle',
104
105
  outDir: './dist/umd',
105
106
  },
@@ -183,6 +184,7 @@ export const buildConfig = [
183
184
  {
184
185
  format: 'umd',
185
186
  target: 'es6',
187
+ platform: 'browser',
186
188
  buildType: 'bundle',
187
189
  outDir: './dist/umd',
188
190
  },
@@ -218,7 +218,7 @@ export default defineConfig({
218
218
  构建类型,`bundle` 会打包你的代码,`bundleless` 只做代码的转换。
219
219
 
220
220
  - 类型: `'bundle' | 'bundleless'`
221
- - 默认值: `bundle`
221
+ - 默认值: `'bundle'`
222
222
 
223
223
  ## copy
224
224
 
@@ -345,16 +345,38 @@ export default defineConfig({
345
345
 
346
346
  类型文件的输出路径,基于 [outDir](/api/config/build-config#outDir) 进行输出。
347
347
 
348
- - 类型: `string`
349
- - 默认值: `./types`
348
+ - 类型: `string`
349
+ - 默认值: `./`
350
+
351
+ 比如输出到 `outDir` 下面的 `types` 目录:
352
+
353
+ ```js modern.config.ts
354
+ export default defineConfig({
355
+ buildConfig: {
356
+ dts: {
357
+ distPath: './types',
358
+ },
359
+ },
360
+ });
361
+ ```
350
362
 
351
363
  ## dts.only
352
364
 
353
- 只生成类型文件,不生成 js 文件。
365
+ 是否在构建时只生成类型文件,不生成 JavaScript 产物文件。
354
366
 
355
367
  - 类型: `boolean`
356
368
  - 默认值: `false`
357
369
 
370
+ ```js modern.config.ts
371
+ export default defineConfig({
372
+ buildConfig: {
373
+ dts: {
374
+ only: true,
375
+ },
376
+ },
377
+ });
378
+ ```
379
+
358
380
  ## dts.respectExternal
359
381
 
360
382
  当设为 `false` 时,不会打包任何三方包类型,设为 `true` 时,会根据 [externals](#externals) 来决定是否需要打包三方类型。
@@ -364,6 +386,16 @@ export default defineConfig({
364
386
  - 类型: `boolean`
365
387
  - 默认值: `true`
366
388
 
389
+ ```js modern.config.ts
390
+ export default defineConfig({
391
+ buildConfig: {
392
+ dts: {
393
+ respectExternal: false,
394
+ },
395
+ },
396
+ });
397
+ ```
398
+
367
399
  ## dts.tsconfigPath
368
400
 
369
401
  TypeScript 配置文件的路径。
@@ -371,12 +403,22 @@ TypeScript 配置文件的路径。
371
403
  - 类型: `string`
372
404
  - 默认值: `./tsconfig.json`
373
405
 
406
+ ```js modern.config.ts
407
+ export default defineConfig({
408
+ buildConfig: {
409
+ dts: {
410
+ tsconfigPath: './other-tsconfig.json',
411
+ },
412
+ },
413
+ });
414
+ ```
415
+
374
416
  ## esbuildOptions
375
417
 
376
418
  用于修改底层的 [esbuild 配置](https://esbuild.github.io/api/)。
377
419
 
378
- - 类型: `Function`
379
- - 默认值: `c => c`
420
+ - 类型: `Function`
421
+ - 默认值: `c => c`
380
422
 
381
423
  例如,我们需要修改生成文件的后缀:
382
424
 
@@ -645,17 +687,33 @@ export default defineConfig({
645
687
 
646
688
  ## outDir
647
689
 
648
- 指定构建的输出目录
690
+ 指定构建的输出目录。
691
+
692
+ - 类型: `string`
693
+ - 默认值: `./dist`
649
694
 
650
- - 类型: `string`
651
- - 默认值: `dist`
695
+ ```js modern.config.ts
696
+ export default defineConfig({
697
+ buildConfig: {
698
+ outDir: './dist/esm',
699
+ },
700
+ });
701
+ ```
652
702
 
653
703
  ## platform
654
704
 
655
705
  默认生成用于 Node.js 环境下的代码,你也可以指定为 `browser`,会生成用于浏览器环境的代码。
656
706
 
657
707
  - 类型: `'browser' | 'node'`
658
- - 默认值: `node`
708
+ - 默认值: `'node'`
709
+
710
+ ```js modern.config.ts
711
+ export default defineConfig({
712
+ buildConfig: {
713
+ platform: 'browser',
714
+ },
715
+ });
716
+ ```
659
717
 
660
718
  ## redirect
661
719
 
@@ -100,6 +100,7 @@ export const buildConfig = [
100
100
  {
101
101
  format: 'umd',
102
102
  target: 'es6',
103
+ platform: 'browser',
103
104
  buildType: 'bundle',
104
105
  outDir: './dist/umd',
105
106
  },
@@ -183,6 +184,7 @@ export const buildConfig = [
183
184
  {
184
185
  format: 'umd',
185
186
  target: 'es6',
187
+ platform: 'browser',
186
188
  buildType: 'bundle',
187
189
  outDir: './dist/umd',
188
190
  },
package/package.json CHANGED
@@ -9,15 +9,15 @@
9
9
  "directory": "packages/document/module-doc"
10
10
  },
11
11
  "license": "MIT",
12
- "version": "2.27.0",
12
+ "version": "2.29.0",
13
13
  "main": "index.js",
14
14
  "dependencies": {
15
15
  "@code-hike/mdx": "^0.7.4",
16
16
  "react": "^18.2.0",
17
17
  "react-dom": "^18.2.0",
18
18
  "shiki": "^0.11.1",
19
- "@modern-js/doc-tools": "2.27.0",
20
- "@modern-js/doc-plugin-auto-sidebar": "2.27.0"
19
+ "@modern-js/doc-plugin-auto-sidebar": "2.29.0",
20
+ "@modern-js/doc-tools": "2.29.0"
21
21
  },
22
22
  "scripts": {
23
23
  "dev": "modern dev",