@umijs/renderer-react 4.3.33 → 4.3.35
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.js +9 -32
- package/dist/html.js +2 -4
- package/dist/link.d.ts +1 -1
- package/dist/routes.js +1 -4
- package/dist/withRouter.d.ts +1 -1
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -146,38 +146,15 @@ var getBrowser = function getBrowser(opts, routesElement) {
|
|
|
146
146
|
})) || []).filter(Boolean);
|
|
147
147
|
matchedRouteIds.forEach(function (id) {
|
|
148
148
|
var _opts$routes$id, _opts$routes$id2;
|
|
149
|
-
// preload
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
keys.forEach(function (key) {
|
|
160
|
-
if (!/\.(js|css)$/.test(key)) {
|
|
161
|
-
throw Error("preload not support ".concat(key, " file"));
|
|
162
|
-
}
|
|
163
|
-
var file = manifest[key];
|
|
164
|
-
var link = document.createElement('link');
|
|
165
|
-
link.rel = 'preload';
|
|
166
|
-
link.as = 'style';
|
|
167
|
-
if (key.endsWith('.js')) {
|
|
168
|
-
link.as = 'script';
|
|
169
|
-
link.id = preloadId;
|
|
170
|
-
}
|
|
171
|
-
// publicPath already in the manifest,
|
|
172
|
-
// but if runtimePublicPath is true, we need to replace it
|
|
173
|
-
if (opts.runtimePublicPath) {
|
|
174
|
-
file = file.replace(new RegExp("^".concat(opts.publicPath)),
|
|
175
|
-
// @ts-ignore
|
|
176
|
-
window.publicPath);
|
|
177
|
-
}
|
|
178
|
-
link.href = file;
|
|
179
|
-
document.head.appendChild(link);
|
|
180
|
-
});
|
|
149
|
+
// preload lazy component
|
|
150
|
+
// window.__umi_manifest__ is available when routePrefetch and manifest config is enabled
|
|
151
|
+
// __umi_manifest__ is not needed for preload, keep this is for compatibility and minimal change
|
|
152
|
+
if (window.__umi_manifest__) {
|
|
153
|
+
var _opts$routeComponents;
|
|
154
|
+
// ref: https://github.com/facebook/react/blob/0940414/packages/react/src/ReactLazy.js#L135
|
|
155
|
+
var lazyCtor = (_opts$routeComponents = opts.routeComponents[id]) === null || _opts$routeComponents === void 0 || (_opts$routeComponents = _opts$routeComponents._payload) === null || _opts$routeComponents === void 0 ? void 0 : _opts$routeComponents._result;
|
|
156
|
+
if (typeof lazyCtor == 'function') {
|
|
157
|
+
lazyCtor();
|
|
181
158
|
}
|
|
182
159
|
}
|
|
183
160
|
var clientLoader = (_opts$routes$id = opts.routes[id]) === null || _opts$routes$id === void 0 ? void 0 : _opts$routes$id.clientLoader;
|
package/dist/html.js
CHANGED
|
@@ -101,8 +101,7 @@ var HydrateMetadata = function HydrateMetadata(props) {
|
|
|
101
101
|
dangerouslySetInnerHTML: {
|
|
102
102
|
__html: content
|
|
103
103
|
},
|
|
104
|
-
key: key
|
|
105
|
-
crossOrigin: "anonymous"
|
|
104
|
+
key: key
|
|
106
105
|
}, rest));
|
|
107
106
|
}));
|
|
108
107
|
};
|
|
@@ -160,8 +159,7 @@ export function Html(_ref) {
|
|
|
160
159
|
dangerouslySetInnerHTML: {
|
|
161
160
|
__html: content
|
|
162
161
|
},
|
|
163
|
-
key: key
|
|
164
|
-
crossOrigin: "anonymous"
|
|
162
|
+
key: key
|
|
165
163
|
}, rest));
|
|
166
164
|
})))
|
|
167
165
|
);
|
package/dist/link.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { LinkProps } from 'react-router-dom';
|
|
3
3
|
export declare function LinkWithPrefetch(props: PropsWithChildren<{
|
|
4
4
|
prefetch?: boolean;
|
|
5
|
-
} & LinkProps & React.RefAttributes<HTMLAnchorElement>>):
|
|
5
|
+
} & LinkProps & React.RefAttributes<HTMLAnchorElement>>): JSX.Element | null;
|
package/dist/routes.js
CHANGED
|
@@ -111,12 +111,9 @@ function RemoteComponentReactRouter5(props) {
|
|
|
111
111
|
route: route,
|
|
112
112
|
routes: clientRoutes
|
|
113
113
|
};
|
|
114
|
-
var Remote = function Remote() {
|
|
115
|
-
return /*#__PURE__*/React.createElement(Component, ComponentProps, props.hasChildren && /*#__PURE__*/React.createElement(Outlet, null));
|
|
116
|
-
};
|
|
117
114
|
return props.useStream ? /*#__PURE__*/React.createElement(React.Suspense, {
|
|
118
115
|
fallback: /*#__PURE__*/React.createElement(props.loadingComponent, null)
|
|
119
|
-
}, /*#__PURE__*/React.createElement(
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Component, ComponentProps, props.hasChildren && /*#__PURE__*/React.createElement(Outlet, null))) : /*#__PURE__*/React.createElement(Component, ComponentProps, props.hasChildren && /*#__PURE__*/React.createElement(Outlet, null));
|
|
120
117
|
}
|
|
121
118
|
function RemoteComponent(props) {
|
|
122
119
|
var Component = props.loader;
|
package/dist/withRouter.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export interface RouteComponentProps<T = ReturnType<typeof useParams>> {
|
|
|
14
14
|
params?: T;
|
|
15
15
|
navigate?: ReturnType<typeof useNavigate>;
|
|
16
16
|
}
|
|
17
|
-
export declare function withRouter<P extends RouteComponentProps<P>>(Component: React.ComponentType<P>): (props: P) =>
|
|
17
|
+
export declare function withRouter<P extends RouteComponentProps<P>>(Component: React.ComponentType<P>): (props: P) => JSX.Element;
|
package/package.json
CHANGED