@modern-js/main-doc 2.70.2 → 2.70.3
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.
|
@@ -46,7 +46,7 @@ Gets the context information of the Modern.js application.
|
|
|
46
46
|
| `isProd` | `boolean` | Whether it is in production mode | - |
|
|
47
47
|
| `appDirectory` | `string` | The absolute path to the project root directory | - |
|
|
48
48
|
| `srcDirectory` | `string` | The absolute path to the project source code directory | - |
|
|
49
|
-
| `distDirectory` | `string` | The absolute path to the project output directory |
|
|
49
|
+
| `distDirectory` | `string` | The absolute path to the project output directory | In `onPrepare` (and later) |
|
|
50
50
|
| `sharedDirectory` | `string` | The absolute path to the shared modules directory | - |
|
|
51
51
|
| `nodeModulesDirectory` | `string` | The absolute path to the `node_modules` directory | - |
|
|
52
52
|
| `ip` | `string` | The IPv4 address of the current machine | - |
|
|
@@ -106,18 +106,13 @@ api.onPrepare(() => {
|
|
|
106
106
|
Gets the final configuration after internal processing by Modern.js and modifications by plugins (normalized configuration).
|
|
107
107
|
|
|
108
108
|
- **Returns:** The normalized configuration object.
|
|
109
|
-
- **When Available:** Must be used
|
|
109
|
+
- **When Available:** Must be used in `onPrepare` (and later hooks, such as `onBeforeBuild`).
|
|
110
110
|
- **Example:**
|
|
111
111
|
|
|
112
112
|
```typescript
|
|
113
|
-
api.
|
|
114
|
-
// ... Modify the configuration ...
|
|
115
|
-
return resolvedConfig;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
api.onBeforeBuild(() => {
|
|
113
|
+
api.onPrepare(() => {
|
|
119
114
|
const finalConfig = api.getNormalizedConfig();
|
|
120
|
-
console.log('Final
|
|
115
|
+
console.log('Final configuration:', finalConfig);
|
|
121
116
|
});
|
|
122
117
|
```
|
|
123
118
|
|
|
@@ -46,7 +46,7 @@ export default myCliPlugin;
|
|
|
46
46
|
| `isProd` | `boolean` | 是否为生产模式 | - |
|
|
47
47
|
| `appDirectory` | `string` | 项目根目录的绝对路径 | - |
|
|
48
48
|
| `srcDirectory` | `string` | 项目源码目录的绝对路径 | - |
|
|
49
|
-
| `distDirectory` | `string` | 项目产物输出目录的绝对路径 | `
|
|
49
|
+
| `distDirectory` | `string` | 项目产物输出目录的绝对路径 | `onPrepare`(及之后) |
|
|
50
50
|
| `sharedDirectory` | `string` | 公共模块目录的绝对路径 | - |
|
|
51
51
|
| `nodeModulesDirectory` | `string` | `node_modules` 目录的绝对路径 | - |
|
|
52
52
|
| `ip` | `string` | 当前机器的 IPv4 地址 | - |
|
|
@@ -102,18 +102,13 @@ api.onPrepare(() => {
|
|
|
102
102
|
获取经过 Modern.js 内部处理和插件修改后的最终配置(归一化配置)。
|
|
103
103
|
|
|
104
104
|
- **返回值:** 归一化后的配置对象。
|
|
105
|
-
- **何时可用:** 必须在 `
|
|
105
|
+
- **何时可用:** 必须在 `onPrepare`(及之后的 hook,例如 `onBeforeBuild`)中使用。
|
|
106
106
|
- **示例:**
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
|
-
api.
|
|
110
|
-
// ... 修改配置 ...
|
|
111
|
-
return resolvedConfig;
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
api.onBeforeBuild(() => {
|
|
109
|
+
api.onPrepare(() => {
|
|
115
110
|
const finalConfig = api.getNormalizedConfig();
|
|
116
|
-
console.log('
|
|
111
|
+
console.log('最终配置:', finalConfig);
|
|
117
112
|
});
|
|
118
113
|
```
|
|
119
114
|
|
package/package.json
CHANGED
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.70.
|
|
18
|
+
"version": "2.70.3",
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"mermaid": "^11.4.1",
|
|
25
|
-
"@modern-js/sandpack-react": "2.70.
|
|
25
|
+
"@modern-js/sandpack-react": "2.70.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@rsbuild/plugin-sass": "1.4.
|
|
28
|
+
"@rsbuild/plugin-sass": "1.4.1",
|
|
29
29
|
"@shikijs/transformers": "^3.4.2",
|
|
30
30
|
"@rspress/shared": "2.0.0-beta.16",
|
|
31
31
|
"@rspress/plugin-llms": "2.0.0-beta.16",
|