@modern-js/module-tools-docs 2.57.1 → 2.58.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,14 @@
1
1
  # @modern-js/module-tools-docs
2
2
 
3
+ ## 2.58.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3824a0e: refactor(website): refactor modern.js docs to latest usage of rspress
8
+ refactor(website): 重构 modern.js 文档,使用最新 rspress 的用法
9
+
10
+ ## 2.58.0
11
+
3
12
  ## 2.57.1
4
13
 
5
14
  ## 2.57.0
@@ -753,7 +753,8 @@ Build lifecycle hooks that allow custom logic to be injected at specific stages
753
753
  ```ts
754
754
  type HookList = {
755
755
  name: string;
756
- apply: (compiler: ICompiler) => void.
756
+ apply: (compiler: ICompiler) => void;
757
+ applyAfterBuiltIn?: boolean;
757
758
  }
758
759
 
759
760
  ```
@@ -881,6 +882,24 @@ For more information about JSX Transform, you can refer to the following links:
881
882
 
882
883
  :::
883
884
 
885
+
886
+ ## loader
887
+
888
+ **Experimental**
889
+
890
+ This option is used to change the interpretation method of the given input file.
891
+ For example, you need to handle the js file as jsx.
892
+
893
+ ```js title="modern.config.ts"
894
+ export default defineConfig({
895
+ buildConfig: {
896
+ loader: {
897
+ '.js': 'jsx',
898
+ }
899
+ },
900
+ });
901
+ ```
902
+
884
903
  ## metafile
885
904
 
886
905
  This option is used for build analysis. When enabled, esbuild will generate metadata about the build in JSON format.
@@ -95,6 +95,10 @@ Serial hooks that stop the execution of other tapped functions if a tapped funct
95
95
 
96
96
  Serial hooks whose results are passed to the next tapped function.
97
97
 
98
+ ### Hook Order
99
+
100
+ The execution order of hooks follows the registration order. You can control whether a hook is registered before or after the built-in hooks using `applyAfterBuiltIn`.
101
+
98
102
  ### Hook API
99
103
 
100
104
  #### load
@@ -9,5 +9,5 @@ Modern.js Module uses esbuild to build toolkits and component libraries, and Rsb
9
9
  Modern.js Module is based on esbuild for building and cannot use tools from the webpack-related ecosystem.
10
10
  You can find more community plugins for esbuild [here](https://github.com/esbuild/community-plugins)
11
11
 
12
- If the UMD product produced by Modern.js Module does not meet your requirements, you can use Rsbuild and add [UMD Plugin](https://rsbuild.dev/plugins/list/plugin-umd) to build UMD products.
12
+ If the UMD product produced by Modern.js Module does not meet your requirements, you can use Rsbuild and add [UMD Plugin](https://github.com/rspack-contrib/rsbuild-plugin-umd) to build UMD products.
13
13
 
@@ -744,6 +744,8 @@ export default defineConfig({
744
744
  type HookList = {
745
745
  name: string;
746
746
  apply: (compiler: ICompiler) => void;
747
+ // 是否在 buildIn 钩子之后执行
748
+ applyAfterBuiltIn?: boolean;
747
749
  };
748
750
  ```
749
751
 
@@ -870,6 +872,22 @@ export default defineConfig({
870
872
 
871
873
  :::
872
874
 
875
+ ## loader
876
+
877
+ **试验性功能**
878
+
879
+ 此选项用来更改给定输入文件的解释方式。例如你需要将 js 文件当做 jsx 处理
880
+
881
+ ```js title="modern.config.ts"
882
+ export default defineConfig({
883
+ buildConfig: {
884
+ loader: {
885
+ '.js': 'jsx',
886
+ }
887
+ },
888
+ });
889
+ ```
890
+
873
891
  ## metafile
874
892
 
875
893
  这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。
@@ -95,6 +95,10 @@ Modern.js Module Hook 使用了 [tapable](https://github.com/webpack/tapable)
95
95
 
96
96
  串行执行的 hooks,其结果会传递给下一个 tapped function
97
97
 
98
+ ### Hook 顺序
99
+
100
+ Hook 的执行顺序和注册顺序保持一致,可以通过 `applyAfterBuiltIn` 来控制在 BuiltIn Hook 前或后注册。
101
+
98
102
  ### Hook API
99
103
 
100
104
  #### load
@@ -9,4 +9,4 @@ Modern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于
9
9
  Modern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。
10
10
  [这里](https://github.com/esbuild/community-plugins)可以发现更多 esbuild 社区插件
11
11
 
12
- 如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 [UMD Plugin](https://rsbuild.dev/zh/plugins/list/plugin-umd) 构建 UMD 产物。
12
+ 如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 [UMD Plugin](https://github.com/rspack-contrib/rsbuild-plugin-umd) 构建 UMD 产物。
package/package.json CHANGED
@@ -9,14 +9,14 @@
9
9
  "directory": "packages/document/module-doc"
10
10
  },
11
11
  "license": "MIT",
12
- "version": "2.57.1",
12
+ "version": "2.58.1",
13
13
  "main": "index.js",
14
14
  "devDependencies": {
15
+ "@rspress/shared": "1.27.0",
15
16
  "react": "^18.2.0",
16
17
  "react-dom": "^18.2.0",
17
- "rspress": "1.26.1",
18
- "@rspress/shared": "1.26.1",
19
- "@modern-js/doc-plugin-auto-sidebar": "2.57.1"
18
+ "rspress": "1.27.0",
19
+ "@modern-js/doc-plugin-auto-sidebar": "2.58.1"
20
20
  },
21
21
  "scripts": {
22
22
  "dev": "rspress dev",