@modern-js/main-doc 0.0.0-next-1681905621669 → 0.0.0-next-1681913246323

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,21 +1,21 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-1681905621669
3
+ ## 0.0.0-next-1681913246323
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 60a81d05db: feat: add ssr.inlineScript for use inline json instead inline script when ssr
7
+ - 60a81d05d: feat: add ssr.inlineScript for use inline json instead inline script when ssr
8
8
  feat: 添加 ssr.inlineScript 用于在 ssr 模式下使用内联 json 而不是内联脚本
9
- - 432ac8b884: chore(cli): improve commands descriptions
9
+ - 432ac8b88: chore(cli): improve commands descriptions
10
10
 
11
11
  chore(cli): 优化命令的描述文案
12
12
 
13
- - de84d94942: feat: add optional dynamic routes docs
13
+ - de84d9494: feat: add optional dynamic routes docs
14
14
  feat: 添加可选动态路由文档
15
- - Updated dependencies [fefd1c5645]
16
- - Updated dependencies [1f34dbae90]
17
- - Updated dependencies [b965df261f]
18
- - @modern-js/builder-doc@0.0.0-next-1681905621669
15
+ - Updated dependencies [fefd1c564]
16
+ - Updated dependencies [1f34dbae9]
17
+ - Updated dependencies [b965df261]
18
+ - @modern-js/builder-doc@0.0.0-next-1681913246323
19
19
 
20
20
  ## 2.13.4
21
21
 
@@ -33,7 +33,7 @@ Then execute the `dev` or `build` command, and you can see Modern.js automatical
33
33
  node_modules
34
34
  └─ .modern-js
35
35
  └─ main
36
- ├─ bootstrap.jsx # real entry code
36
+ ├─ bootstrap.js # real entry code
37
37
  ├─ index.js # asynchronous entry file
38
38
  └─ index.html
39
39
  ```
@@ -41,7 +41,7 @@ node_modules
41
41
  The `index.js` reads as follows:
42
42
 
43
43
  ```js
44
- import('./bootstrap.jsx');
44
+ import('./bootstrap.js');
45
45
  ```
46
46
 
47
47
  At this point, you can consume any remote modules in the current page.
@@ -36,7 +36,7 @@ export default defineConfig({
36
36
  node_modules
37
37
  └─ .modern-js
38
38
  └─ main
39
- ├─ bootstrap.jsx # 真正的入口代码
39
+ ├─ bootstrap.js # 真正的入口代码
40
40
  ├─ index.js # 异步入口文件(asynchronous boundary)
41
41
  └─ index.html
42
42
  ```
@@ -44,7 +44,7 @@ node_modules
44
44
  其中 `index.js` 的内容如下:
45
45
 
46
46
  ```js
47
- import('./bootstrap.jsx');
47
+ import('./bootstrap.js');
48
48
  ```
49
49
 
50
50
  此时,就可以在当前页面中消费任意的远程模块了。
@@ -49,6 +49,8 @@ import { Html, Body, Root, Head, Scripts } from '@modern-js/runtime/document';
49
49
 
50
50
  - `Scripts`:构建产生的 script 内容,可用于调整构建产物的位置,默认放在 `<Head>` 组件中。
51
51
 
52
+ - `Comment`:将用户编写的 `<!-- gateway -->` 这种注释,保留输出到最新渲染的 html 中。
53
+
52
54
  ### 模板参数
53
55
 
54
56
  因为是 JSX 形式,`Document.[jt]sx` 里,可以比较自由的在组件内使用各种变量去赋值给各种自定义组件。
@@ -69,8 +71,8 @@ import {
69
71
  Root,
70
72
  Head,
71
73
  Body,
72
- Scripts,
73
74
  DocumentContext,
75
+ Comment,
74
76
  } from '@modern-js/runtime/document';
75
77
 
76
78
  export default function Document(): React.ReactElement {
@@ -84,7 +86,8 @@ export default function Document(): React.ReactElement {
84
86
  return (
85
87
  <Html>
86
88
  <Head>
87
- <link href="https://modernjs.dev">Modern.js</link>
89
+ <link href="https://modernjs.dev" />
90
+ <Comment>{'<!-- Need a Comment -->'}</Comment>
88
91
  </Head>
89
92
  <Body>
90
93
  <Root rootId="root">
@@ -105,49 +108,43 @@ export default function Document(): React.ReactElement {
105
108
  ```html
106
109
  <!DOCTYPE html>
107
110
  <html>
108
- <head>
109
- <meta charset="utf-8" />
110
- <meta
111
- name="viewport"
112
- content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
113
- />
114
- <meta http-equiv="x-ua-compatible" content="ie=edge" />
115
- <meta name="renderer" content="webkit" />
116
- <meta name="layoutmode" content="standard" />
117
- <meta name="imagemode" content="force" />
118
- <meta name="wap-font-scale" content="no" />
119
- <meta name="format-detection" content="telephone=no" />
120
- <script>
121
- ...
122
- </script>
111
+
112
+ <head>
113
+ <meta charset="utf-8">
114
+ <meta name="viewport"
115
+ content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
116
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
117
+ <meta name="renderer" content="webkit">
118
+ <meta name="layoutmode" content="standard">
119
+ <meta name="imagemode" content="force">
120
+ <meta name="wap-font-scale" content="no">
121
+ <meta name="format-detection" content="telephone=no">
122
+ <link rel="icon" href="/a.icon">
123
+ <script defer src="/static/js/builder-runtime.js"></script>
123
124
  <script defer src="/static/js/lib-react.js"></script>
124
125
  <script defer src="/static/js/lib-polyfill.js"></script>
125
126
  <script defer src="/static/js/lib-router.js"></script>
126
- <script
127
- defer
128
- src="/static/js/vendors-node_modules_pnpm_loadable_component_5_15_2_react_18_2_0_node_modules_loadable_compon-3fb0cf.js"
129
- ></script>
130
- <script
131
- defer
132
- src="/static/js/packages_runtime_plugin-router-legacy_dist_js_treeshaking_runtime_index_js-packages_runtime_p-28f4c9.js"
133
- ></script>
127
+ <script xxx>
134
128
  <script defer src="/static/js/sub.js"></script>
135
- <link href="https://www.baidu.com" />
136
- </head>
129
+ <link href="https://modernjs.dev" />
130
+ <!-- Need a Comment -->
131
+ </head>
137
132
 
138
- <body>
133
+ <body>
139
134
  <div id="root">
140
- {/* <?- html ?> */}
141
- <h1 style="color:red">以下为构建时传过来的参数:</h1>
142
- <h2>entryName:sub</h2>
143
- <h2>title:</h2>
144
- <h2>rootId: root</h2>
135
+ <!--<?- html ?>-->
136
+ <h1 style="color:red">以下为构建时传过来的参数:</h1>
137
+ <h2> entryName:sub</h2>
138
+ <h2> title:</h2>
139
+ <h2> rootId: root</h2>
145
140
  </div>
146
141
  <h1>bottom</h1>
147
- {/* <?- chunksMap.js ?> */}
148
- {/* <?- SSRDataScript ?> */}
149
- </body>
142
+ <!--<?- chunksMap.js ?>-->
143
+ <!--<?- SSRDataScript ?>-->
144
+ </body>
145
+
150
146
  </html>
147
+
151
148
  ```
152
149
 
153
150
  ## Html 语法
package/package.json CHANGED
@@ -11,13 +11,13 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "0.0.0-next-1681905621669",
14
+ "version": "0.0.0-next-1681913246323",
15
15
  "publishConfig": {
16
16
  "registry": "https://registry.npmjs.org/",
17
17
  "access": "public"
18
18
  },
19
19
  "peerDependencies": {
20
- "@modern-js/builder-doc": "0.0.0-next-1681905621669"
20
+ "@modern-js/builder-doc": "0.0.0-next-1681913246323"
21
21
  },
22
22
  "devDependencies": {
23
23
  "classnames": "^2",
@@ -29,9 +29,9 @@
29
29
  "fs-extra": "^10",
30
30
  "@types/node": "^16",
31
31
  "@types/fs-extra": "^9",
32
- "@modern-js/builder-doc": "0.0.0-next-1681905621669",
33
- "@modern-js/doc-tools": "0.0.0-next-1681905621669",
34
- "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1681905621669"
32
+ "@modern-js/builder-doc": "0.0.0-next-1681913246323",
33
+ "@modern-js/doc-tools": "0.0.0-next-1681913246323",
34
+ "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1681913246323"
35
35
  },
36
36
  "scripts": {
37
37
  "dev": "modern dev",