@umijs/renderer-react
Advanced tools
+1
-0
| import React from 'react'; | ||
| import { IHtmlProps } from './types'; | ||
| export declare function getClientCssPaths(manifest: any): string[]; | ||
| export declare function Html({ children, loaderData, manifest, htmlPageOpts, __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, mountElementId, }: React.PropsWithChildren<IHtmlProps>): React.JSX.Element; |
+32
-8
@@ -19,12 +19,33 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
| }; | ||
| function normalizeClientCssPaths(css) { | ||
| if (Array.isArray(css)) { | ||
| return css.filter(Boolean); | ||
| } | ||
| return css ? [css] : []; | ||
| } | ||
| function isCssAsset(asset) { | ||
| return /\.css(?:[?#].*)?$/.test(asset) && !/\.css\.map(?:[?#].*)?$/.test(asset); | ||
| } | ||
| function isUtoopackSingleCss(asset) { | ||
| return /\.single\.css(?:[?#].*)?$/.test(asset); | ||
| } | ||
| export function getClientCssPaths(manifest) { | ||
| var assets = (manifest === null || manifest === void 0 ? void 0 : manifest.assets) || {}; | ||
| var umiCss = normalizeClientCssPaths(assets['umi.css']); | ||
| if (umiCss.length) { | ||
| return umiCss; | ||
| } | ||
| return Object.values(assets).filter(function (asset) { | ||
| return typeof asset === 'string' && isCssAsset(asset) && !isUtoopackSingleCss(asset); | ||
| }); | ||
| } | ||
| var GlobalDataScript = function GlobalDataScript(props) { | ||
| var _manifest$assets; | ||
| var loaderData = props.loaderData, | ||
| htmlPageOpts = props.htmlPageOpts, | ||
| manifest = props.manifest; | ||
| var clientCssPath = (manifest === null || manifest === void 0 || (_manifest$assets = manifest.assets) === null || _manifest$assets === void 0 ? void 0 : _manifest$assets['umi.css']) || ''; | ||
| var clientCssPaths = getClientCssPaths(manifest); | ||
| return /*#__PURE__*/React.createElement("script", { | ||
| suppressHydrationWarning: true, | ||
| dangerouslySetInnerHTML: { | ||
| __html: "window.__UMI_LOADER_DATA__ = ".concat(JSON.stringify(loaderData || {}), "; window.__UMI_METADATA_LOADER_DATA__ = ").concat(JSON.stringify(htmlPageOpts || {}), "; window.__UMI_BUILD_ClIENT_CSS__ = '").concat(clientCssPath, "'") | ||
| __html: "window.__UMI_LOADER_DATA__ = ".concat(JSON.stringify(loaderData || {}), "; window.__UMI_METADATA_LOADER_DATA__ = ").concat(JSON.stringify(htmlPageOpts || {}), "; window.__UMI_BUILD_ClIENT_CSS__ = ").concat(JSON.stringify(clientCssPaths.length <= 1 ? clientCssPaths[0] || '' : clientCssPaths)) | ||
| } | ||
@@ -134,3 +155,3 @@ }); | ||
| } | ||
| var clientCss = typeof window === 'undefined' ? manifest === null || manifest === void 0 ? void 0 : manifest.assets['umi.css'] : window.__UMI_BUILD_ClIENT_CSS__; | ||
| var clientCssPaths = typeof window === 'undefined' ? getClientCssPaths(manifest) : normalizeClientCssPaths(window.__UMI_BUILD_ClIENT_CSS__); | ||
| return ( | ||
@@ -147,6 +168,9 @@ /*#__PURE__*/ | ||
| content: "width=device-width, initial-scale=1" | ||
| }), clientCss && /*#__PURE__*/React.createElement("link", { | ||
| suppressHydrationWarning: true, | ||
| rel: "stylesheet", | ||
| href: clientCss | ||
| }), clientCssPaths.map(function (clientCss) { | ||
| return /*#__PURE__*/React.createElement("link", { | ||
| key: clientCss, | ||
| suppressHydrationWarning: true, | ||
| rel: "stylesheet", | ||
| href: clientCss | ||
| }); | ||
| }), /*#__PURE__*/React.createElement(HydrateMetadata, { | ||
@@ -153,0 +177,0 @@ htmlPageOpts: htmlPageOpts |
+1
-1
| { | ||
| "name": "@umijs/renderer-react", | ||
| "version": "4.6.54", | ||
| "version": "4.6.55", | ||
| "description": "@umijs/renderer-react", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-react#readme", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
50872
1.53%1204
2.21%