@modern-js/main-doc 2.19.0 → 2.19.2-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/builder-doc@2.19.1
8
+
3
9
  ## 2.19.0
4
10
 
5
11
  ### Patch Changes
@@ -4,7 +4,72 @@ sidebar_position: 1
4
4
 
5
5
  # Overview
6
6
 
7
- Welcome to the Modern.js blog!
7
+ Welcome to Modern.js blog!
8
8
 
9
- You can find the latest news about Modern.js here.
9
+ You can find the latest update of Modern.js and our thought processes here. Occasionally we explain the infrastructure behind it.
10
10
 
11
+ ---
12
+
13
+ ## Announcing Modern.js v2: support Rspack
14
+
15
+ > Published on 16.03.2023
16
+
17
+ We are excited to announce the release of Modern.js v2!
18
+
19
+ Modern.js is a suite of infrastructure tools we built for web development inside Bytedance (we call ourself Web Infra). Since we open sourced this project a little more than a year ago, there were dozens of contributors helped us on development; we aggregated more than 2,000 pull requests and Modern.js started to support build tool like Rspack, features like nested routes, Streaming SSR and there are more to come!
20
+
21
+ We are extremely proud of what we have achieved so far, you can also refer to [this article(English version under construction)](/community/blog/v2-release-note)👈🏻 to see what has changed over the last year in Modern.js.
22
+
23
+ ---
24
+
25
+ ## What is Streaming SSR in React 18
26
+
27
+ > Published on 16.12.2022
28
+
29
+ Since React 18, React supports a new type of SSR (streaming SSR) and it brought two advantages over the React tool chain:
30
+
31
+ - Streaming HTML: Server will be able to transmit HTML to browser parts by parts, rather than waiting until the whole page being rendered. Client side will render the page faster thus dramatically increase performance benchmark scores like TTFB(Time to First Byte), FCP(First Contentful Paint) and more.
32
+
33
+ - Selective Hydration: On the client side, browser can hydrate only the HTML elements that has already been rendered, without needing to wait until the whole page finish rendering and all the javascript bundle being loaded.
34
+
35
+ To understand its design further, check out this [Github Discussion](https://github.com/reactwg/react-18/discussions/37) by Dan Abramov or watch this [talk](https://www.youtube.com/watch?v=pj5N-Khihgc).
36
+
37
+ Or read more from us at [here(Further content in English under construction)](https://mp.weixin.qq.com/s/w4FS5sBcHqRl-Saqi19Y6g).
38
+
39
+ ---
40
+
41
+ ## Introducing React Server Component in Modern.js
42
+
43
+ > Published on 01.12.2022
44
+
45
+ To explain the experimental React Server Component, the one-liner given by the React Team was: **zero-bundle-size React Server Components**.
46
+
47
+ We agreed with the React team that this is where the whole direction will move forward in React. Open source maintainers and contributors inside the React community are also actively building an eco-system around it.
48
+
49
+ Read more from React team at [here](https://react.dev/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023#react-server-components) or more from us at [here](https://mp.weixin.qq.com/s/B-XLvW00vl5RE1Ur3EW4ow)
50
+
51
+ ## Updates during Sept - Oct in 2022
52
+
53
+ > Published on 01.11.2022
54
+
55
+ We updated Modern.js to v1.21.0 during Sept - Oct. Major upgrade includes:
56
+
57
+ - **support pnpm v7**
58
+ - **added typescript compiler option on server side**
59
+
60
+ [Read more (English version under construction)](/community/blog/2022-0910-updates)
61
+
62
+ ---
63
+
64
+ ## Updates during July - August in 2022
65
+
66
+ > Published on 2022.09.05
67
+
68
+ Modern.js upgraded to v1.17.0 during July to August in 2022. Major updates include:
69
+
70
+ - **Support React 18**
71
+ - **Unifying packages**: All the Modern.js package version numbers are unified, and added version update command line in CLI.
72
+ - **Support npm module bundle building**: We support bundling npm module output.
73
+ - **Reduck v1.1**: We released [Reduck v1.1](https://github.com/web-infra-dev/reduck) and updated all our documentations.
74
+
75
+ [Read more (English version under construction)](/community/blog/2022-0708-updates)
@@ -130,7 +130,7 @@ export const post = async () => {
130
130
  };
131
131
  ```
132
132
 
133
- - Modern.js supports 9 definitions for HTTP Method: `GET`、`POST`、`PUT`、`DELETE`、`CONNECT`、`TRACE`、`PATCH`、`OPTION`、`HEAD`, can be exported using these methods as functions.
133
+ - Modern.js supports 9 definitions for HTTP Method: `GET`、`POST`、`PUT`、`DELETE`、`CONNECT`、`TRACE`、`PATCH`、`OPTIONS`、`HEAD`, can be exported using these methods as functions.
134
134
 
135
135
  - The name is size insensitive, if `GET`, can write `get`、`Get`、`GEt`、`GET`, can be accurately identified. But default export as `export default xxx` will be map to `Get`.
136
136
 
@@ -343,9 +343,9 @@ export default async (): Promise<ProfileData> => {
343
343
 
344
344
  ### FAQ
345
345
 
346
- 1. Relationship between loader and bff functions
346
+ 1. Relationship between loader and BFF functions
347
347
 
348
- In a CSR project, the loader is executed on the client side and the bff function can be called directly from the loader to make a request.
348
+ In a CSR project, the loader is executed on the client side and the bff function can be called directly in the loader to make a request.
349
349
 
350
350
  In an SSR project, each loader is also a server-side API, and we recommend using loader instead of the BFF function which http method is `get` to avoid one more layer of forwarding and execution.
351
351
 
@@ -375,7 +375,7 @@ To further improve the user experience and reduce time of loading, Modern.js sup
375
375
  - With `render`, static resources are loaded only when they are idle and do not hog the network with first-screen static resources.
376
376
  - When using server side rendering, data is also prefetched.
377
377
 
378
- import Motivation from '@site-docs-en/components/convention-routing-movitation'
378
+ import Motivation from '@site-docs-en/components/convention-routing-motivation'
379
379
 
380
380
  <Motivation/>
381
381
 
@@ -16,7 +16,7 @@ From the perspective of building, Modern.js is divided into three layers, from t
16
16
  - Universal build engine: Modern.js Builder.
17
17
  - Low-level bundlers: webpack and rspack.
18
18
 
19
- <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ maxWidth: '540px' }} />
19
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## Builder Documentation
22
22
 
@@ -71,6 +71,6 @@ Modern.js 7 ~ 8 月的最新版本为 v1.17.0,本双月的主要更新有:
71
71
  - **支持 React 18**:完成框架和插件对 React 18 的适配。
72
72
  - **包版本统一**:Modern.js 所有组成包的版本号进行统一,提供升级命令。
73
73
  - **模块工程支持 bundle 构建**:模块工程类型的项目,支持对产物做 bundle 构建。
74
- - **Reduck v1.1**:发布 Reduck v1.1,使用文档全面更新。
74
+ - **Reduck v1.1**:发布 [Reduck v1.1](https://github.com/web-infra-dev/reduck),使用文档全面更新。
75
75
 
76
76
  [了解更多 →](/community/blog/2022-0708-updates)
@@ -234,11 +234,10 @@ Modern.js 中的部分代码实现参考了社区中的开源项目,我们对
234
234
 
235
235
  - `@modern-js/bundle-require`: 修改自 [bundle-require](https://github.com/egoist/bundle-require)。
236
236
  - `@modern-js/plugin`: hook API 的实现参考了 [farrow-pipeline](https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline)。
237
- - `@modern-js/builder`: moduleScope 和 fileSize 插件参考了 [create-react-app](https://github.com/facebook/create-react-app),TsConfigPathsPlugin 参考了 [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin)。
237
+ - `@modern-js/builder`: moduleScope 和 fileSize 插件参考了 [create-react-app](https://github.com/facebook/create-react-app),TsConfigPathsPlugin 参考了 [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin),generateMetaTags 函数参考了 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin)
238
238
  - `@modern-js/plugin-testing`: jest runner 参考了 [jest-cli](https://github.com/facebook/jest/blob/fdc74af37235354e077edeeee8aa2d1a4a863032/packages/jest-cli/src/cli/index.ts#L21)。
239
239
  - `@modern-js/doc-tools`: 部分样式参考了 [vitepress](https://github.com/vuejs/vitepress)。
240
240
  - `@modern-js/plugin-data-loader`: 部分实现参考了 [remix](https://github.com/remix-run/remix)。
241
- - `@modern-js/utils`: generateMetaTags 函数参考了 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin)。
242
241
 
243
242
  ## 最后
244
243
 
@@ -135,7 +135,7 @@ export const post = async () => {
135
135
  };
136
136
  ```
137
137
 
138
- - 对应 HTTP Method,Modern.js 也支持了 9 种定义,即:`GET`、`POST`、`PUT`、`DELETE`、`CONNECT`、`TRACE`、`PATCH`、`OPTION`、`HEAD`,即可以用这些 Method 作为函数导出的名字。
138
+ - 对应 HTTP Method,Modern.js 也支持了 9 种定义,即:`GET`、`POST`、`PUT`、`DELETE`、`CONNECT`、`TRACE`、`PATCH`、`OPTIONS`、`HEAD`,即可以用这些 Method 作为函数导出的名字。
139
139
 
140
140
  - 名字是大小不敏感的,如果是 `GET`,写成 `get`、`Get`、`GEt`、`GET`,都可以准确识别。而默认导出,即 `export default xxx` 则会被映射为 `Get`。
141
141
 
@@ -341,9 +341,9 @@ export default async (): Promise<ProfileData> => {
341
341
 
342
342
  ### 常见问题
343
343
 
344
- 1. loader 和 bff 函数的关系
344
+ 1. loader 和 BFF 函数的关系
345
345
 
346
- 在 CSR 项目中,loader 在客户端执行,在 loader 可以直接调用 bff 函数进行接口请求。
346
+ 在 CSR 项目中,loader 在客户端执行,在 loader 可以直接调用 BFF 函数进行接口请求。
347
347
 
348
348
  在 SSR 项目中,每个 loader 也是一个服务端接口,我们推荐使用 loader 替代 http method 为 `get` 的 BFF 函数,作为接口层,避免多一层转发和执行。
349
349
 
@@ -473,7 +473,7 @@ export const init = (context: RuntimeContext) => {
473
473
  - 使用 `render`,仅在空闲时对静态资源进行加载,不会与首屏静态资源抢占网络。
474
474
  - 在 SSR 场景下,也会对数据进行预取。
475
475
 
476
- import Motivation from '@site-docs/components/convention-routing-movitation'
476
+ import Motivation from '@site-docs/components/convention-routing-motivation'
477
477
 
478
478
  <Motivation/>
479
479
 
@@ -16,7 +16,7 @@ Modern.js Builder 是 Modern.js 体系的核心组件之一,它是一个面向
16
16
  - 通用构建引擎:Modern.js Builder。
17
17
  - 底层打包工具:webpack 和 rspack。
18
18
 
19
- <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ maxWidth: '540px' }} />
19
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## 构建文档
22
22
 
package/package.json CHANGED
@@ -15,13 +15,13 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.19.0",
18
+ "version": "2.19.2-alpha.0",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
22
22
  },
23
23
  "peerDependencies": {
24
- "@modern-js/builder-doc": "^2.19.0"
24
+ "@modern-js/builder-doc": "^2.19.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "classnames": "^2",
@@ -33,9 +33,9 @@
33
33
  "fs-extra": "^10",
34
34
  "@types/node": "^16",
35
35
  "@types/fs-extra": "^9",
36
- "@modern-js/builder-doc": "2.19.0",
37
- "@modern-js/doc-tools": "2.19.0",
38
- "@modern-js/doc-plugin-auto-sidebar": "2.19.0"
36
+ "@modern-js/doc-plugin-auto-sidebar": "2.19.1",
37
+ "@modern-js/doc-tools": "2.19.1",
38
+ "@modern-js/builder-doc": "2.19.1"
39
39
  },
40
40
  "scripts": {
41
41
  "dev": "modern dev",
@@ -42,6 +42,13 @@
42
42
  }
43
43
  }
44
44
 
45
+ @media (max-width: 480px) {
46
+ .card {
47
+ flex: 0 1 100%;
48
+ margin-bottom: 16px;
49
+ }
50
+ }
51
+
45
52
  .title {
46
53
  font-size: 16px;
47
54
  font-weight: 600;
@@ -153,7 +153,7 @@
153
153
 
154
154
  @media screen and (max-width: 540px) {
155
155
  .title {
156
- font-size: 9vw;
156
+ font-size: 8vw;
157
157
  }
158
158
  }
159
159