Skip to content

Commit 9da4e89

Browse files
authored
docs: add detailed JSDoc to manifest data types (#6632)
1 parent 7b0b083 commit 9da4e89

File tree

3 files changed

+70
-15
lines changed

3 files changed

+70
-15
lines changed

packages/core/src/types/config.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,26 +1140,45 @@ export type InlineChunkConfig =
11401140
| { enable?: boolean | 'auto'; test: InlineChunkTest };
11411141

11421142
export type ManifestByEntry = {
1143+
/**
1144+
* Files that are required during the initial load of the entry.
1145+
*/
11431146
initial?: {
1147+
/** Initial JavaScript files for this entry. */
11441148
js?: string[];
1149+
/** Initial CSS files for this entry. */
11451150
css?: string[];
11461151
};
1152+
/**
1153+
* Files that may be loaded asynchronously.
1154+
* Usually code-split chunks or lazily loaded chunks.
1155+
*/
11471156
async?: {
1157+
/** Async JavaScript files for this entry. */
11481158
js?: string[];
1159+
/** Async CSS files for this entry. */
11491160
css?: string[];
11501161
};
1151-
/** other assets (e.g. png、svg、source map) related to the current entry */
1152-
assets?: string[];
1162+
/** HTML files generated for this entry, if any. */
11531163
html?: string[];
1164+
/**
1165+
* Additional assets associated with this entry.
1166+
* For example images、fonts、source maps and other non JS or CSS files.
1167+
*/
1168+
assets?: string[];
11541169
};
11551170

11561171
export type ManifestData = {
1172+
/**
1173+
* A flat list of all emitted asset files.
1174+
*/
1175+
allFiles: string[];
1176+
/**
1177+
* Maps each entry name to its associated output files.
1178+
*/
11571179
entries: {
1158-
/** relate to Rsbuild's source.entry config */
11591180
[entryName: string]: ManifestByEntry;
11601181
};
1161-
/** Flatten all assets */
1162-
allFiles: string[];
11631182
};
11641183

11651184
export type ManifestObjectConfig = {

website/docs/en/config/output/manifest.mdx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,43 @@ The manifest file will be output with the following structure by default:
5555
type FilePath = string;
5656

5757
type ManifestList = {
58+
/**
59+
* A flat list of all emitted asset files.
60+
*/
61+
allFiles: FilePath[];
62+
/**
63+
* Maps each entry name to its associated output files.
64+
*/
5865
entries: {
59-
/** The key is the entry name, from Rsbuild's source.entry config. */
6066
[entryName: string]: {
67+
/**
68+
* Files that are required during the initial load of the entry.
69+
*/
6170
initial?: {
71+
/** Initial JavaScript files for this entry. */
6272
js?: FilePath[];
73+
/** Initial CSS files for this entry. */
6374
css?: FilePath[];
6475
};
76+
/**
77+
* Files that may be loaded asynchronously.
78+
* Usually code-split chunks or lazily loaded chunks.
79+
*/
6580
async?: {
81+
/** Async JavaScript files for this entry. */
6682
js?: FilePath[];
83+
/** Async CSS files for this entry. */
6784
css?: FilePath[];
6885
};
69-
/** HTML files related to the current entry */
86+
/** HTML files generated for this entry, if any. */
7087
html?: FilePath[];
71-
/** other assets (e.g., png, svg, source map) related to the current entry */
88+
/**
89+
* Additional assets associated with this entry.
90+
* For example images、fonts、source maps and other non JS or CSS files.
91+
*/
7292
assets?: FilePath[];
7393
};
7494
};
75-
/** Flatten all assets */
76-
allFiles: FilePath[];
7795
};
7896
```
7997

website/docs/zh/config/output/manifest.mdx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,43 @@ manifest 文件默认输出的结构为:
5555
type FilePath = string;
5656

5757
type ManifestList = {
58+
/**
59+
* 所有构建产物文件的扁平列表
60+
*/
61+
allFiles: FilePath[];
62+
/**
63+
* 将每个入口名称映射到其关联的输出文件
64+
*/
5865
entries: {
59-
/** key 为 entry 名称,对应 Rsbuild 的 source.entry 配置 */
6066
[entryName: string]: {
67+
/**
68+
* 入口在初始加载阶段所需的文件
69+
*/
6170
initial?: {
71+
/** 当前入口的初始 JavaScript 文件 */
6272
js?: FilePath[];
73+
/** 当前入口的初始 CSS 文件 */
6374
css?: FilePath[];
6475
};
76+
/**
77+
* 异步加载的文件
78+
* 通常是代码分割的 chunk 或懒加载的资源
79+
*/
6580
async?: {
81+
/** 当前入口的异步 JavaScript 文件 */
6682
js?: FilePath[];
83+
/** 当前入口的异步 CSS 文件 */
6784
css?: FilePath[];
6885
};
69-
/** 当前 entry 关联的 HTML 页面 */
86+
/** 当前入口生成的 HTML 文件(如果有) */
7087
html?: FilePath[];
71-
/** 和当前 entry 相关的其他资源(如 png、svg、source map 等) */
88+
/**
89+
* 与当前入口关联的其他资源
90+
* 例如图片、字体、source map 以及其他非 JS 或 CSS 文件
91+
*/
7292
assets?: FilePath[];
7393
};
7494
};
75-
/** 铺平的所有 assets */
76-
allFiles: FilePath[];
7795
};
7896
```
7997

0 commit comments

Comments
 (0)