@modern-js/module-tools-docs 2.47.1 → 2.48.1

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,9 @@
1
1
  # @modern-js/module-tools-docs
2
2
 
3
+ ## 2.48.1
4
+
5
+ ## 2.48.0
6
+
3
7
  ## 2.47.1
4
8
 
5
9
  ## 2.47.0
@@ -67,12 +67,29 @@ export default {
67
67
 
68
68
  Contains configuration related to static assets.
69
69
 
70
- ## asset.path
70
+ ## asset.name
71
71
 
72
- Static resource output path, will be based on [outDir](/api/config/build-config#outDir)
72
+ Static resource output file name.
73
73
 
74
- - **Type**: `string`
75
- - **Default**: `assets`
74
+ - **Type**: `string | ((assetPath) => name)`
75
+ - **Default**: `[name].[hash].[ext]`
76
+
77
+ When asset.name is a string, it will automatically replace [name], [ext], and [hash], respectively replaced by the file name, extension, and file hash.
78
+
79
+ Also you can use asset.name as a function, and the return is output asset name. At this time, this function receives a parameter assetPath, which corresponds to the resource path.
80
+
81
+ ```js title="modern.config.ts"
82
+ export default defineConfig({
83
+ buildConfig: {
84
+ asset: {
85
+ // no hash
86
+ name: [name].[ext],
87
+ // any logic
88
+ // name: (assetPath) => 'any.png',
89
+ },
90
+ },
91
+ });
92
+ ```
76
93
 
77
94
  ## asset.limit
78
95
 
@@ -97,6 +114,13 @@ export default defineConfig({
97
114
  });
98
115
  ```
99
116
 
117
+ ## asset.path
118
+
119
+ Static resource output path, will be based on [outDir](/api/config/build-config#outDir)
120
+
121
+ - **Type**: `string`
122
+ - **Default**: `assets`
123
+
100
124
  ## asset.publicPath
101
125
 
102
126
  The CDN prefix given to unlinked assets when bundling.
@@ -510,7 +534,7 @@ export default defineConfig({
510
534
 
511
535
  ## dts.tsconfigPath
512
536
 
513
- **deprecated**,use [tsconfig](#tsconfig) instead.
537
+ **deprecated**,use [tsconfig](#tsconfig) instead.
514
538
 
515
539
  Specifies the path to the tsconfig file used to generate the type file.
516
540
 
@@ -1083,7 +1107,7 @@ Sets the format of the source code. By default, the source code will be treated
1083
1107
  ## splitting
1084
1108
 
1085
1109
  Whether to enable code splitting.
1086
- Only support [format: 'esm'](#format-esm) and [format: 'cjs'](#format-cjs)see [esbuild.splitting](https://esbuild.github.io/api/#splitting) learn more.
1110
+ Only support [format: 'esm'](#format-esm) and [format: 'cjs'](#format-cjs),see [esbuild.splitting](https://esbuild.github.io/api/#splitting) learn more.
1087
1111
 
1088
1112
  - **Type**: `boolean`
1089
1113
  - **Default**: `false`
@@ -67,12 +67,28 @@ export default defineConfig({
67
67
 
68
68
  包含静态资源相关的配置。
69
69
 
70
- ## asset.path
70
+ ## asset.name
71
71
 
72
- 静态资源输出路径,会基于 [outDir](/api/config/build-config#outDir) 进行输出。
72
+ 静态资源输出文件名。
73
73
 
74
- - 类型: `string`
75
- - 默认值: `assets`
74
+ - 类型: `string | ((assetPath) => name)`
75
+ - 默认值: `[name].[hash].[ext]`
76
+
77
+ 当 asset.name 为 string 类型时,会自动对 [name]、[ext]、[hash] 进行替换,分别替换为文件名、拓展名、文件 hash。
78
+ 如果想要更高的自由度,可以把 asset.name 作为方法使用,返回值即为文件名。此时,该方法接收一个参数 assetPath,对应资源路径。
79
+
80
+ ```js title="modern.config.ts"
81
+ export default defineConfig({
82
+ buildConfig: {
83
+ asset: {
84
+ // no hash
85
+ name: [name].[ext],
86
+ // any logic
87
+ // name: (assetPath) => 'any.png',
88
+ },
89
+ },
90
+ });
91
+ ```
76
92
 
77
93
  ## asset.limit
78
94
 
@@ -97,6 +113,13 @@ export default defineConfig({
97
113
  });
98
114
  ```
99
115
 
116
+ ## asset.path
117
+
118
+ 静态资源输出路径,会基于 [outDir](/api/config/build-config#outDir) 进行输出。
119
+
120
+ - 类型: `string`
121
+ - 默认值: `assets`
122
+
100
123
  ## asset.publicPath
101
124
 
102
125
  打包时给未内联资源的 CDN 前缀。
package/package.json CHANGED
@@ -9,14 +9,14 @@
9
9
  "directory": "packages/document/module-doc"
10
10
  },
11
11
  "license": "MIT",
12
- "version": "2.47.1",
12
+ "version": "2.48.1",
13
13
  "main": "index.js",
14
14
  "devDependencies": {
15
15
  "react": "^18.2.0",
16
16
  "react-dom": "^18.2.0",
17
- "rspress": "1.12.3",
18
- "@rspress/shared": "1.12.3",
19
- "@modern-js/doc-plugin-auto-sidebar": "2.47.1"
17
+ "rspress": "1.14.0",
18
+ "@rspress/shared": "1.14.0",
19
+ "@modern-js/doc-plugin-auto-sidebar": "2.48.1"
20
20
  },
21
21
  "scripts": {
22
22
  "dev": "rspress dev",