@umijs/renderer-react 4.0.0-canary.20240514.2 → 4.0.0-canary.20240515.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/dist/browser.d.ts +4 -0
- package/dist/browser.js +1 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +19 -10
- package/dist/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/browser.d.ts
CHANGED
package/dist/browser.js
CHANGED
|
@@ -280,7 +280,7 @@ export function renderClient(opts) {
|
|
|
280
280
|
loaderData: loaderData,
|
|
281
281
|
mountElementId: opts.mountElementId
|
|
282
282
|
};
|
|
283
|
-
ReactDOM.hydrateRoot(opts.
|
|
283
|
+
ReactDOM.hydrateRoot(opts.renderFromRoot ? rootElement : document, /*#__PURE__*/React.createElement(Html, hydtateHtmloptions, /*#__PURE__*/React.createElement(Browser, null)));
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
if (ReactDOM.createRoot) {
|
package/dist/html.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IHtmlProps } from './types';
|
|
3
|
-
export declare function Html({ children, loaderData, manifest, htmlPageOpts, __SPECIAL_HTML_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, mountElementId, }: React.PropsWithChildren<IHtmlProps>): JSX.Element;
|
|
3
|
+
export declare function Html({ children, loaderData, manifest, htmlPageOpts, renderFromRoot, __SPECIAL_HTML_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, mountElementId, }: React.PropsWithChildren<IHtmlProps>): JSX.Element;
|
package/dist/html.js
CHANGED
|
@@ -9,6 +9,13 @@ var RE_URL = /^(http:|https:)?\/\//;
|
|
|
9
9
|
function isUrl(str) {
|
|
10
10
|
return RE_URL.test(str) || str.startsWith('/') && !str.startsWith('/*') || str.startsWith('./') || str.startsWith('../');
|
|
11
11
|
}
|
|
12
|
+
var EnableJsScript = function EnableJsScript() {
|
|
13
|
+
return /*#__PURE__*/React.createElement("noscript", {
|
|
14
|
+
dangerouslySetInnerHTML: {
|
|
15
|
+
__html: "<b>Enable JavaScript to run this app.</b>"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
12
19
|
var GlobalDataScript = function GlobalDataScript(props) {
|
|
13
20
|
var loaderData = props.loaderData,
|
|
14
21
|
htmlPageOpts = props.htmlPageOpts,
|
|
@@ -102,16 +109,13 @@ export function Html(_ref) {
|
|
|
102
109
|
loaderData = _ref.loaderData,
|
|
103
110
|
manifest = _ref.manifest,
|
|
104
111
|
htmlPageOpts = _ref.htmlPageOpts,
|
|
112
|
+
renderFromRoot = _ref.renderFromRoot,
|
|
105
113
|
__SPECIAL_HTML_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = _ref.__SPECIAL_HTML_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
106
114
|
mountElementId = _ref.mountElementId;
|
|
107
115
|
// TODO: 处理 head 标签,比如 favicon.ico 的一致性
|
|
108
116
|
// TODO: root 支持配置
|
|
109
117
|
if (__SPECIAL_HTML_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) {
|
|
110
|
-
return /*#__PURE__*/React.createElement("html", null, /*#__PURE__*/React.createElement("head", null), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement("
|
|
111
|
-
dangerouslySetInnerHTML: {
|
|
112
|
-
__html: "<b>Enable JavaScript to run this app.</b>"
|
|
113
|
-
}
|
|
114
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
return /*#__PURE__*/React.createElement("html", null, /*#__PURE__*/React.createElement("head", null), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(EnableJsScript, null), /*#__PURE__*/React.createElement("div", {
|
|
115
119
|
id: mountElementId
|
|
116
120
|
}, children), /*#__PURE__*/React.createElement(GlobalDataScript, {
|
|
117
121
|
manifest: manifest,
|
|
@@ -119,6 +123,15 @@ export function Html(_ref) {
|
|
|
119
123
|
htmlPageOpts: htmlPageOpts
|
|
120
124
|
})));
|
|
121
125
|
}
|
|
126
|
+
if (renderFromRoot) {
|
|
127
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EnableJsScript, null), /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
id: mountElementId
|
|
129
|
+
}, children), /*#__PURE__*/React.createElement(GlobalDataScript, {
|
|
130
|
+
manifest: manifest,
|
|
131
|
+
loaderData: loaderData,
|
|
132
|
+
htmlPageOpts: htmlPageOpts
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
122
135
|
var serverBuildManifest = typeof window === 'undefined' ? manifest : window.__UMI_BUILD_MANIFEST_DATA__;
|
|
123
136
|
return (
|
|
124
137
|
/*#__PURE__*/
|
|
@@ -137,11 +150,7 @@ export function Html(_ref) {
|
|
|
137
150
|
href: manifest === null || manifest === void 0 ? void 0 : manifest.assets['umi.css']
|
|
138
151
|
}), /*#__PURE__*/React.createElement(HydrateMetadata, {
|
|
139
152
|
htmlPageOpts: htmlPageOpts
|
|
140
|
-
})), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement("
|
|
141
|
-
dangerouslySetInnerHTML: {
|
|
142
|
-
__html: "<b>Enable JavaScript to run this app.</b>"
|
|
143
|
-
}
|
|
144
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
})), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(EnableJsScript, null), /*#__PURE__*/React.createElement("div", {
|
|
145
154
|
id: mountElementId
|
|
146
155
|
}, children), /*#__PURE__*/React.createElement(GlobalDataScript, {
|
|
147
156
|
manifest: manifest,
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/renderer-react",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20240515.1",
|
|
4
4
|
"description": "@umijs/renderer-react",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-react#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"react-router-dom": "6.3.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"react": "18.1
|
|
27
|
-
"react-dom": "18.1
|
|
26
|
+
"react": "18.3.1",
|
|
27
|
+
"react-dom": "18.3.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.8",
|