remote-components 0.0.21 → 0.0.23
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/html/host.cjs +115 -40
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +115 -40
- package/dist/html/host.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +72 -23
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.d.ts +2 -2
- package/dist/internal/next/host/app-router-client.js +73 -24
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/shared/client/remote-component.cjs +43 -16
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.d.ts +2 -0
- package/dist/internal/shared/client/remote-component.js +43 -16
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.cjs +9 -17
- package/dist/internal/shared/ssr/dom-flight.cjs.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.js +9 -17
- package/dist/internal/shared/ssr/dom-flight.js.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +3 -4
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +3 -4
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/webpack/next-client-pages-loader.cjs +43 -16
- package/dist/internal/webpack/next-client-pages-loader.cjs.map +1 -1
- package/dist/internal/webpack/next-client-pages-loader.js +43 -16
- package/dist/internal/webpack/next-client-pages-loader.js.map +1 -1
- package/dist/next/host/app-router-server.cjs +4 -0
- package/dist/next/host/app-router-server.cjs.map +1 -1
- package/dist/next/host/app-router-server.d.ts +5 -1
- package/dist/next/host/app-router-server.js +4 -0
- package/dist/next/host/app-router-server.js.map +1 -1
- package/dist/next/host/client/index.d.ts +1 -1
- package/dist/next/host/pages-router-server.cjs +11 -4
- package/dist/next/host/pages-router-server.cjs.map +1 -1
- package/dist/next/host/pages-router-server.d.ts +3 -0
- package/dist/next/host/pages-router-server.js +11 -4
- package/dist/next/host/pages-router-server.js.map +1 -1
- package/dist/next/middleware.cjs +1 -1
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +1 -1
- package/dist/next/middleware.js.map +1 -1
- package/dist/react/index.cjs +56 -19
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +56 -19
- package/dist/react/index.js.map +1 -1
- package/dist/{types-7425dfe1.d.ts → types-b8210fd3.d.ts} +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/next/host/app-router-client.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, useLayoutEffect } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n loadRemoteComponent,\n DEFAULT_ROUTE,\n RUNTIME_WEBPACK,\n} from '#internal/shared/client/remote-component';\nimport type { RemoteComponentProps } from '#internal/shared/client/remote-component';\n\n// patch react/jsx-runtime to support the shadowrootmode attribute on template elements\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n template: {\n shadowrootmode?: 'open' | 'closed';\n id?: string;\n ref?: React.Ref<HTMLTemplateElement>;\n dangerouslySetInnerHTML?: {\n __html: string;\n };\n children?: React.ReactNode;\n };\n }\n }\n}\n\n// import { shared } from '@remote-components/shared/host';\nasync function tryImportShared() {\n try {\n const { shared } = await import('@remote-components/shared/host/app');\n return shared;\n } catch {\n return {};\n }\n}\n\n/**\n * RemoteComponentClient - Main component for rendering remote components\n *\n * This component handles the loading and rendering of remote microfrontends.\n * It supports both RSC (React Server Components) and Next.js Pages Router based components.\n */\nexport function RemoteComponentClient({\n url,\n name,\n bundle,\n route = DEFAULT_ROUTE,\n runtime = RUNTIME_WEBPACK,\n data,\n nextData,\n scripts = [],\n links = [],\n remoteShared = {},\n isolate,\n children,\n}: RemoteComponentProps) {\n const [component, setComponent] = useState<React.ReactNode | Error>(null);\n\n // Handle errors by re-throwing them\n if (component instanceof Error) {\n throw component;\n }\n\n // determine whether to use children or loaded component\n const shouldUseChildren =\n (!component ||\n (component &&\n !nextData &&\n typeof (component as unknown as Promise<unknown>).then !==\n 'function')) &&\n // if the remote Next.js Pages Router application is in development mode\n // we don't use the provided static HTML\n // to mitigate layout shift when loading CSS using JavaScript on the client\n nextData?.buildId !== 'development';\n\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useLayoutEffect(() => {\n if (isolate !== false && typeof document !== 'undefined' && !shadowRoot) {\n let shadowRootElement: ShadowRoot | null = null;\n const element = document.getElementById(`shadowroot_${name}`);\n shadowRootElement = element?.shadowRoot ?? null;\n\n if (!shadowRootElement && element) {\n // create a shadow root if it doesn't exist\n // this is a fallback for browsers that don't support declarative shadow DOM\n element.attachShadow({ mode: 'open' });\n shadowRootElement = element.shadowRoot;\n }\n\n if (shadowRootElement) {\n // remove all nodes from the shadow root except links\n shadowRootElement.querySelectorAll('*:not(link)').forEach((node) => {\n node.remove();\n });\n setShadowRoot(shadowRootElement);\n }\n }\n }, [name, isolate, shadowRoot, links, url]);\n\n useEffect(() => {\n let mounted = true;\n\n // if we have a component, we don't need to load it again\n if (!component && (isolate === false || shadowRoot)) {\n loadRemoteComponent({\n url: new URL(url, location.origin),\n name,\n bundle,\n route,\n runtime,\n data,\n nextData,\n scripts,\n shared: tryImportShared(),\n remoteShared,\n container: shadowRoot,\n })\n .then((result) => {\n if (mounted) {\n if (result.error) {\n setComponent(result.error);\n } else {\n setComponent(result.component);\n }\n }\n })\n .catch((error: Error) => {\n if (mounted) {\n setComponent(error);\n }\n });\n }\n\n return () => {\n mounted = false;\n };\n }, [\n url,\n component,\n name,\n bundle,\n route,\n runtime,\n scripts,\n data,\n nextData,\n remoteShared,\n children,\n links,\n isolate,\n shadowRoot,\n ]);\n\n let componentToRender = (\n <>{shouldUseChildren ? children : (component as React.ReactNode)}</>\n );\n let linksToRender: React.ReactNode[] | null = links.map((link) => (\n <link\n as={link.as as string}\n href={new URL(link.href as string, url || location.origin).href}\n key={`${link.href as string}_${link.rel}`}\n rel={link.rel as string}\n />\n ));\n\n if (isolate !== false) {\n componentToRender = (\n <div id={`shadowroot_${name}`}>\n {typeof document === 'undefined' ? (\n // eslint-disable-next-line react/no-unknown-property\n <template shadowrootmode=\"open\">\n {linksToRender}\n {componentToRender}\n </template>\n ) : null}\n {shadowRoot\n ? createPortal(\n shadowRoot.querySelectorAll('link').length !== links.length ? (\n <>\n {linksToRender}\n {componentToRender}\n </>\n ) : (\n componentToRender\n ),\n shadowRoot,\n )\n : null}\n </div>\n );\n linksToRender = null;\n }\n\n return (\n <>\n <script data-remote-component type=\"application/json\">\n {JSON.stringify({\n name,\n bundle,\n route,\n runtime,\n })}\n </script>\n {linksToRender}\n {componentToRender}\n {nextData ? (\n <script\n id={`${bundle}_${route.replace(/\\//g, '_')}${name}_next_data`}\n type=\"application/json\"\n >\n {JSON.stringify(nextData)}\n </script>\n ) : null}\n {isolate === false ? <template id={`${name}_end`} /> : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8JI;AA5JJ,mBAAqD;AACrD,uBAA6B;AAC7B,8BAIO;AAsBP,eAAe,kBAAkB;AAC/B,MAAI;AACF,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oCAAoC;AACpE,WAAO;AAAA,EACT,QAAE;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AAAA,EACX,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC;AAAA,EAChB;AAAA,EACA;AACF,GAAyB;AACvB,QAAM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;AAAA;AAAA,IAC1B,IACE;AAAA,IACH,YAAY,QAAQ,4CAAC,cAAS,IAAI,GAAG,YAAY,IAAK;AAAA,KACzD;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/next/host/app-router-client.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, useLayoutEffect, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n loadRemoteComponent,\n DEFAULT_ROUTE,\n RUNTIME_WEBPACK,\n} from '#internal/shared/client/remote-component';\nimport type { RemoteComponentProps } from '#internal/shared/client/remote-component';\n\n// patch react/jsx-runtime to support the shadowrootmode attribute on template elements\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n template: {\n shadowrootmode?: 'open' | 'closed';\n id?: string;\n ref?: React.Ref<HTMLTemplateElement>;\n dangerouslySetInnerHTML?: {\n __html: string;\n };\n children?: React.ReactNode;\n };\n }\n }\n}\n\n// import { shared } from '@remote-components/shared/host';\nasync function tryImportShared() {\n try {\n const { shared } = await import('@remote-components/shared/host/app');\n return shared;\n } catch {\n return {};\n }\n}\n\n/**\n * RemoteComponentClient - Main component for rendering remote components\n *\n * This component handles the loading and rendering of remote microfrontends.\n * It supports both RSC (React Server Components) and Next.js Pages Router based components.\n */\nexport function RemoteComponentClient({\n url,\n name,\n bundle,\n route = DEFAULT_ROUTE,\n runtime = RUNTIME_WEBPACK,\n data,\n nextData,\n scripts = [],\n links = [],\n remoteShared = {},\n isolate,\n mode = 'open',\n reset,\n children,\n}: RemoteComponentProps) {\n const [component, setComponent] = useState<React.ReactNode | Error>(null);\n const metadataRef = useRef<{\n name: string;\n bundle: string;\n route: string;\n url: string;\n }>({\n name,\n bundle,\n route,\n url,\n });\n\n // Handle errors by re-throwing them\n if (component instanceof Error) {\n throw component;\n }\n\n // determine whether to use children or loaded component\n const shouldUseChildren =\n (!component ||\n (component &&\n !nextData &&\n typeof (component as unknown as Promise<unknown>).then !==\n 'function')) &&\n // if the remote Next.js Pages Router application is in development mode\n // we don't use the provided static HTML\n // to mitigate layout shift when loading CSS using JavaScript on the client\n nextData?.buildId !== 'development';\n\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useLayoutEffect(() => {\n if (isolate !== false && typeof document !== 'undefined' && !shadowRoot) {\n let shadowRootElement: ShadowRoot | null = null;\n const element = document.getElementById(\n `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}`,\n );\n const self = globalThis as Record<\n `__remote_components_shadowroot_${string}`,\n ShadowRoot | null\n >;\n const shadowRootKey =\n `__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}` as const;\n shadowRootElement = self[shadowRootKey] ?? element?.shadowRoot ?? null;\n self[shadowRootKey] = null;\n\n if (!shadowRootElement && element) {\n // create a shadow root if it doesn't exist\n // this is a fallback for browsers that don't support declarative shadow DOM\n try {\n shadowRootElement = element.attachShadow({ mode });\n } catch {\n // do nothing if attachShadow fails because of existing shadow root\n }\n }\n\n if (shadowRootElement) {\n // remove all nodes from the shadow root except links\n shadowRootElement.querySelectorAll('*:not(link)').forEach((node) => {\n node.remove();\n });\n setShadowRoot(shadowRootElement);\n }\n }\n }, [name, isolate, shadowRoot, links, url, mode]);\n\n useEffect(() => {\n let mounted = true;\n\n // if we have a component, we don't need to load it again\n if (\n (!component && (isolate === false || shadowRoot)) ||\n metadataRef.current.url !== url ||\n metadataRef.current.name !== name ||\n metadataRef.current.bundle !== bundle ||\n metadataRef.current.route !== route\n ) {\n metadataRef.current = {\n name,\n bundle,\n route,\n url,\n };\n loadRemoteComponent({\n url: new URL(url, location.origin),\n name,\n bundle,\n route,\n runtime,\n data,\n nextData,\n scripts,\n shared: tryImportShared(),\n remoteShared,\n container: shadowRoot,\n })\n .then((result) => {\n if (mounted) {\n if (result.error) {\n setComponent(result.error);\n } else {\n setComponent(result.component);\n }\n }\n })\n .catch((error: Error) => {\n if (mounted) {\n setComponent(error);\n }\n });\n }\n\n return () => {\n mounted = false;\n };\n }, [\n url,\n component,\n name,\n bundle,\n route,\n runtime,\n scripts,\n data,\n nextData,\n remoteShared,\n children,\n links,\n isolate,\n shadowRoot,\n ]);\n\n const resetStyle = reset ? (\n <style data-remote-components-reset>{`:host { all: initial; }`}</style>\n ) : null;\n let componentToRender = (\n <>{shouldUseChildren ? children : (component as React.ReactNode)}</>\n );\n let linksToRender: React.ReactNode[] | null = links.map((link) => (\n <link\n as={link.as as string}\n href={new URL(link.href as string, url || location.origin).href}\n key={`${link.href as string}_${link.rel}`}\n rel={link.rel as string}\n />\n ));\n\n if (isolate !== false) {\n componentToRender = (\n <div\n id={`shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}`}\n >\n {typeof document === 'undefined' ? (\n // eslint-disable-next-line react/no-unknown-property\n <template shadowrootmode={mode}>\n <div\n dangerouslySetInnerHTML={{\n __html: `<img\n alt=\"\" decoding=\"async\" style=\"display:none\"\n src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==\"\n onload=\"(function(el){\n const root = el.getRootNode();\n globalThis.__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')} = root;\n el.parentElement.remove();\n })(this)\"\n />`,\n }}\n />\n {resetStyle}\n {linksToRender}\n {componentToRender}\n </template>\n ) : null}\n {shadowRoot\n ? createPortal(\n shadowRoot.querySelectorAll('link').length !== links.length ? (\n <>\n {resetStyle}\n {linksToRender}\n {componentToRender}\n </>\n ) : (\n <>\n {resetStyle}\n {componentToRender}\n </>\n ),\n shadowRoot,\n )\n : null}\n </div>\n );\n linksToRender = null;\n }\n\n return (\n <>\n <script data-remote-component type=\"application/json\">\n {JSON.stringify({\n name,\n bundle,\n route,\n runtime,\n })}\n </script>\n {linksToRender}\n {componentToRender}\n {nextData ? (\n <script\n id={`${bundle}_${route.replace(/[^a-zA-Z0-9]+/g, '_')}${name}_next_data`}\n type=\"application/json\"\n >\n {JSON.stringify(nextData)}\n </script>\n ) : null}\n {isolate === false ? <template id={`${name}_end`} /> : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmMI;AAjMJ,mBAA6D;AAC7D,uBAA6B;AAC7B,8BAIO;AAsBP,eAAe,kBAAkB;AAC/B,MAAI;AACF,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oCAAoC;AACpE,WAAO;AAAA,EACT,QAAE;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AAAA,EACX,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAkC,IAAI;AACxE,QAAM,kBAAc,qBAKjB;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAGD,MAAI,qBAAqB,OAAO;AAC9B,UAAM;AAAA,EACR;AAGA,QAAM,qBACH,CAAC,aACC,aACC,CAAC,YACD,OAAQ,UAA0C,SAChD;AAAA;AAAA;AAAA,EAIN,UAAU,YAAY;AAExB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA4B,IAAI;AAEpE,oCAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,OAAO,aAAa,eAAe,CAAC,YAAY;AACvE,UAAI,oBAAuC;AAC3C,YAAM,UAAU,SAAS;AAAA,QACvB,cAAc,IAAI,IAAI,GAAG,EAAE,KAAK,QA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ACG;AAAA,YACE,WAAW,iBAAiB,MAAM,EAAE,WAAW,MAAM,SACnD,4EACG;AAAA;AAAA,cACA;AAAA,cACA;AAAA,eACH,IAEA,4EACG;AAAA;AAAA,cACA;AAAA,eACH;AAAA,YAEF;AAAA,UACF,IACA;AAAA;AAAA;AAAA,IACN;AAEF,oBAAgB;AAAA,EAClB;AAEA,SACE,4EACE;AAAA,gDAAC,YAAO,yBAAqB,MAAC,MAAK,oBAChC,eAAK,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACH;AAAA,IACC;AAAA,IACA;AAAA,IACA,WACC;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,GAAG,UAAU,MAAM,QAAQ,kBAAkB,GAAG,IAAI;AAAA,QACxD,MAAK;AAAA,QAEJ,eAAK,UAAU,QAAQ;AAAA;AAAA,IAC1B,IACE;AAAA,IACH,YAAY,QAAQ,4CAAC,cAAS,IAAI,GAAG,YAAY,IAAK;AAAA,KACzD;AAEJ;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RemoteComponentProps } from '../../../types-
|
|
2
|
+
import { R as RemoteComponentProps } from '../../../types-b8210fd3.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../../../types-280a3640.js';
|
|
5
5
|
|
|
@@ -24,6 +24,6 @@ declare module 'react/jsx-runtime' {
|
|
|
24
24
|
* This component handles the loading and rendering of remote microfrontends.
|
|
25
25
|
* It supports both RSC (React Server Components) and Next.js Pages Router based components.
|
|
26
26
|
*/
|
|
27
|
-
declare function RemoteComponentClient({ url, name, bundle, route, runtime, data, nextData, scripts, links, remoteShared, isolate, children, }: RemoteComponentProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare function RemoteComponentClient({ url, name, bundle, route, runtime, data, nextData, scripts, links, remoteShared, isolate, mode, reset, children, }: RemoteComponentProps): react_jsx_runtime.JSX.Element;
|
|
28
28
|
|
|
29
29
|
export { RemoteComponentClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState, useLayoutEffect } from "react";
|
|
3
|
+
import { useEffect, useState, useLayoutEffect, useRef } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import {
|
|
6
6
|
loadRemoteComponent,
|
|
@@ -27,9 +27,17 @@ function RemoteComponentClient({
|
|
|
27
27
|
links = [],
|
|
28
28
|
remoteShared = {},
|
|
29
29
|
isolate,
|
|
30
|
+
mode = "open",
|
|
31
|
+
reset,
|
|
30
32
|
children
|
|
31
33
|
}) {
|
|
32
34
|
const [component, setComponent] = useState(null);
|
|
35
|
+
const metadataRef = useRef({
|
|
36
|
+
name,
|
|
37
|
+
bundle,
|
|
38
|
+
route,
|
|
39
|
+
url
|
|
40
|
+
});
|
|
33
41
|
if (component instanceof Error) {
|
|
34
42
|
throw component;
|
|
35
43
|
}
|
|
@@ -41,11 +49,18 @@ function RemoteComponentClient({
|
|
|
41
49
|
useLayoutEffect(() => {
|
|
42
50
|
if (isolate !== false && typeof document !== "undefined" && !shadowRoot) {
|
|
43
51
|
let shadowRootElement = null;
|
|
44
|
-
const element = document.getElementById(
|
|
45
|
-
|
|
52
|
+
const element = document.getElementById(
|
|
53
|
+
`shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")}`
|
|
54
|
+
);
|
|
55
|
+
const self = globalThis;
|
|
56
|
+
const shadowRootKey = `__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")}`;
|
|
57
|
+
shadowRootElement = self[shadowRootKey] ?? element?.shadowRoot ?? null;
|
|
58
|
+
self[shadowRootKey] = null;
|
|
46
59
|
if (!shadowRootElement && element) {
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
try {
|
|
61
|
+
shadowRootElement = element.attachShadow({ mode });
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
49
64
|
}
|
|
50
65
|
if (shadowRootElement) {
|
|
51
66
|
shadowRootElement.querySelectorAll("*:not(link)").forEach((node) => {
|
|
@@ -54,10 +69,16 @@ function RemoteComponentClient({
|
|
|
54
69
|
setShadowRoot(shadowRootElement);
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
|
-
}, [name, isolate, shadowRoot, links, url]);
|
|
72
|
+
}, [name, isolate, shadowRoot, links, url, mode]);
|
|
58
73
|
useEffect(() => {
|
|
59
74
|
let mounted = true;
|
|
60
|
-
if (!component && (isolate === false || shadowRoot)) {
|
|
75
|
+
if (!component && (isolate === false || shadowRoot) || metadataRef.current.url !== url || metadataRef.current.name !== name || metadataRef.current.bundle !== bundle || metadataRef.current.route !== route) {
|
|
76
|
+
metadataRef.current = {
|
|
77
|
+
name,
|
|
78
|
+
bundle,
|
|
79
|
+
route,
|
|
80
|
+
url
|
|
81
|
+
};
|
|
61
82
|
loadRemoteComponent({
|
|
62
83
|
url: new URL(url, location.origin),
|
|
63
84
|
name,
|
|
@@ -103,6 +124,7 @@ function RemoteComponentClient({
|
|
|
103
124
|
isolate,
|
|
104
125
|
shadowRoot
|
|
105
126
|
]);
|
|
127
|
+
const resetStyle = reset ? /* @__PURE__ */ jsx("style", { "data-remote-components-reset": true, children: `:host { all: initial; }` }) : null;
|
|
106
128
|
let componentToRender = /* @__PURE__ */ jsx(Fragment, { children: shouldUseChildren ? children : component });
|
|
107
129
|
let linksToRender = links.map((link) => /* @__PURE__ */ jsx(
|
|
108
130
|
"link",
|
|
@@ -114,22 +136,49 @@ function RemoteComponentClient({
|
|
|
114
136
|
`${link.href}_${link.rel}`
|
|
115
137
|
));
|
|
116
138
|
if (isolate !== false) {
|
|
117
|
-
componentToRender = /* @__PURE__ */ jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
componentToRender = /* @__PURE__ */ jsxs(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
id: `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")}`,
|
|
143
|
+
children: [
|
|
144
|
+
typeof document === "undefined" ? (
|
|
145
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
146
|
+
/* @__PURE__ */ jsxs("template", { shadowrootmode: mode, children: [
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
dangerouslySetInnerHTML: {
|
|
151
|
+
__html: `<img
|
|
152
|
+
alt="" decoding="async" style="display:none"
|
|
153
|
+
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="
|
|
154
|
+
onload="(function(el){
|
|
155
|
+
const root = el.getRootNode();
|
|
156
|
+
globalThis.__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")} = root;
|
|
157
|
+
el.parentElement.remove();
|
|
158
|
+
})(this)"
|
|
159
|
+
/>`
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
resetStyle,
|
|
164
|
+
linksToRender,
|
|
165
|
+
componentToRender
|
|
166
|
+
] })
|
|
167
|
+
) : null,
|
|
168
|
+
shadowRoot ? createPortal(
|
|
169
|
+
shadowRoot.querySelectorAll("link").length !== links.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
170
|
+
resetStyle,
|
|
171
|
+
linksToRender,
|
|
172
|
+
componentToRender
|
|
173
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
174
|
+
resetStyle,
|
|
175
|
+
componentToRender
|
|
176
|
+
] }),
|
|
177
|
+
shadowRoot
|
|
178
|
+
) : null
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
133
182
|
linksToRender = null;
|
|
134
183
|
}
|
|
135
184
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -144,7 +193,7 @@ function RemoteComponentClient({
|
|
|
144
193
|
nextData ? /* @__PURE__ */ jsx(
|
|
145
194
|
"script",
|
|
146
195
|
{
|
|
147
|
-
id: `${bundle}_${route.replace(
|
|
196
|
+
id: `${bundle}_${route.replace(/[^a-zA-Z0-9]+/g, "_")}${name}_next_data`,
|
|
148
197
|
type: "application/json",
|
|
149
198
|
children: JSON.stringify(nextData)
|
|
150
199
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/next/host/app-router-client.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, useLayoutEffect } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n loadRemoteComponent,\n DEFAULT_ROUTE,\n RUNTIME_WEBPACK,\n} from '#internal/shared/client/remote-component';\nimport type { RemoteComponentProps } from '#internal/shared/client/remote-component';\n\n// patch react/jsx-runtime to support the shadowrootmode attribute on template elements\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n template: {\n shadowrootmode?: 'open' | 'closed';\n id?: string;\n ref?: React.Ref<HTMLTemplateElement>;\n dangerouslySetInnerHTML?: {\n __html: string;\n };\n children?: React.ReactNode;\n };\n }\n }\n}\n\n// import { shared } from '@remote-components/shared/host';\nasync function tryImportShared() {\n try {\n const { shared } = await import('@remote-components/shared/host/app');\n return shared;\n } catch {\n return {};\n }\n}\n\n/**\n * RemoteComponentClient - Main component for rendering remote components\n *\n * This component handles the loading and rendering of remote microfrontends.\n * It supports both RSC (React Server Components) and Next.js Pages Router based components.\n */\nexport function RemoteComponentClient({\n url,\n name,\n bundle,\n route = DEFAULT_ROUTE,\n runtime = RUNTIME_WEBPACK,\n data,\n nextData,\n scripts = [],\n links = [],\n remoteShared = {},\n isolate,\n children,\n}: RemoteComponentProps) {\n const [component, setComponent] = useState<React.ReactNode | Error>(null);\n\n // Handle errors by re-throwing them\n if (component instanceof Error) {\n throw component;\n }\n\n // determine whether to use children or loaded component\n const shouldUseChildren =\n (!component ||\n (component &&\n !nextData &&\n typeof (component as unknown as Promise<unknown>).then !==\n 'function')) &&\n // if the remote Next.js Pages Router application is in development mode\n // we don't use the provided static HTML\n // to mitigate layout shift when loading CSS using JavaScript on the client\n nextData?.buildId !== 'development';\n\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useLayoutEffect(() => {\n if (isolate !== false && typeof document !== 'undefined' && !shadowRoot) {\n let shadowRootElement: ShadowRoot | null = null;\n const element = document.getElementById(`shadowroot_${name}`);\n shadowRootElement = element?.shadowRoot ?? null;\n\n if (!shadowRootElement && element) {\n // create a shadow root if it doesn't exist\n // this is a fallback for browsers that don't support declarative shadow DOM\n element.attachShadow({ mode: 'open' });\n shadowRootElement = element.shadowRoot;\n }\n\n if (shadowRootElement) {\n // remove all nodes from the shadow root except links\n shadowRootElement.querySelectorAll('*:not(link)').forEach((node) => {\n node.remove();\n });\n setShadowRoot(shadowRootElement);\n }\n }\n }, [name, isolate, shadowRoot, links, url]);\n\n useEffect(() => {\n let mounted = true;\n\n // if we have a component, we don't need to load it again\n if (!component && (isolate === false || shadowRoot)) {\n loadRemoteComponent({\n url: new URL(url, location.origin),\n name,\n bundle,\n route,\n runtime,\n data,\n nextData,\n scripts,\n shared: tryImportShared(),\n remoteShared,\n container: shadowRoot,\n })\n .then((result) => {\n if (mounted) {\n if (result.error) {\n setComponent(result.error);\n } else {\n setComponent(result.component);\n }\n }\n })\n .catch((error: Error) => {\n if (mounted) {\n setComponent(error);\n }\n });\n }\n\n return () => {\n mounted = false;\n };\n }, [\n url,\n component,\n name,\n bundle,\n route,\n runtime,\n scripts,\n data,\n nextData,\n remoteShared,\n children,\n links,\n isolate,\n shadowRoot,\n ]);\n\n let componentToRender = (\n <>{shouldUseChildren ? children : (component as React.ReactNode)}</>\n );\n let linksToRender: React.ReactNode[] | null = links.map((link) => (\n <link\n as={link.as as string}\n href={new URL(link.href as string, url || location.origin).href}\n key={`${link.href as string}_${link.rel}`}\n rel={link.rel as string}\n />\n ));\n\n if (isolate !== false) {\n componentToRender = (\n <div id={`shadowroot_${name}`}>\n {typeof document === 'undefined' ? (\n // eslint-disable-next-line react/no-unknown-property\n <template shadowrootmode=\"open\">\n {linksToRender}\n {componentToRender}\n </template>\n ) : null}\n {shadowRoot\n ? createPortal(\n shadowRoot.querySelectorAll('link').length !== links.length ? (\n <>\n {linksToRender}\n {componentToRender}\n </>\n ) : (\n componentToRender\n ),\n shadowRoot,\n )\n : null}\n </div>\n );\n linksToRender = null;\n }\n\n return (\n <>\n <script data-remote-component type=\"application/json\">\n {JSON.stringify({\n name,\n bundle,\n route,\n runtime,\n })}\n </script>\n {linksToRender}\n {componentToRender}\n {nextData ? (\n <script\n id={`${bundle}_${route.replace(/\\//g, '_')}${name}_next_data`}\n type=\"application/json\"\n >\n {JSON.stringify(nextData)}\n </script>\n ) : null}\n {isolate === false ? <template id={`${name}_end`} /> : null}\n </>\n );\n}\n"],"mappings":";AA8JI,wBAgBM,YAhBN;AA5JJ,SAAS,WAAW,UAAU,uBAAuB;AACrD,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsBP,eAAe,kBAAkB;AAC/B,MAAI;AACF,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oCAAoC;AACpE,WAAO;AAAA,EACT,QAAE;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAA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I,GAAG,UAAU,MAAM,QAAQ,OAAO,GAAG,IAAI;AAAA,QAC7C,MAAK;AAAA,QAEJ,eAAK,UAAU,QAAQ;AAAA;AAAA,IAC1B,IACE;AAAA,IACH,YAAY,QAAQ,oBAAC,cAAS,IAAI,GAAG,YAAY,IAAK;AAAA,KACzD;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/next/host/app-router-client.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState, useLayoutEffect, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n loadRemoteComponent,\n DEFAULT_ROUTE,\n RUNTIME_WEBPACK,\n} from '#internal/shared/client/remote-component';\nimport type { RemoteComponentProps } from '#internal/shared/client/remote-component';\n\n// patch react/jsx-runtime to support the shadowrootmode attribute on template elements\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n template: {\n shadowrootmode?: 'open' | 'closed';\n id?: string;\n ref?: React.Ref<HTMLTemplateElement>;\n dangerouslySetInnerHTML?: {\n __html: string;\n };\n children?: React.ReactNode;\n };\n }\n }\n}\n\n// import { shared } from '@remote-components/shared/host';\nasync function tryImportShared() {\n try {\n const { shared } = await import('@remote-components/shared/host/app');\n return shared;\n } catch {\n return {};\n }\n}\n\n/**\n * RemoteComponentClient - Main component for rendering remote components\n *\n * This component handles the loading and rendering of remote microfrontends.\n * It supports both RSC (React Server Components) and Next.js Pages Router based components.\n */\nexport function RemoteComponentClient({\n url,\n name,\n bundle,\n route = DEFAULT_ROUTE,\n runtime = RUNTIME_WEBPACK,\n data,\n nextData,\n scripts = [],\n links = [],\n remoteShared = {},\n isolate,\n mode = 'open',\n reset,\n children,\n}: RemoteComponentProps) {\n const [component, setComponent] = useState<React.ReactNode | Error>(null);\n const metadataRef = useRef<{\n name: string;\n bundle: string;\n route: string;\n url: string;\n }>({\n name,\n bundle,\n route,\n url,\n });\n\n // Handle errors by re-throwing them\n if (component instanceof Error) {\n throw component;\n }\n\n // determine whether to use children or loaded component\n const shouldUseChildren =\n (!component ||\n (component &&\n !nextData &&\n typeof (component as unknown as Promise<unknown>).then !==\n 'function')) &&\n // if the remote Next.js Pages Router application is in development mode\n // we don't use the provided static HTML\n // to mitigate layout shift when loading CSS using JavaScript on the client\n nextData?.buildId !== 'development';\n\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useLayoutEffect(() => {\n if (isolate !== false && typeof document !== 'undefined' && !shadowRoot) {\n let shadowRootElement: ShadowRoot | null = null;\n const element = document.getElementById(\n `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}`,\n );\n const self = globalThis as Record<\n `__remote_components_shadowroot_${string}`,\n ShadowRoot | null\n >;\n const shadowRootKey =\n `__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}` as const;\n shadowRootElement = self[shadowRootKey] ?? element?.shadowRoot ?? null;\n self[shadowRootKey] = null;\n\n if (!shadowRootElement && element) {\n // create a shadow root if it doesn't exist\n // this is a fallback for browsers that don't support declarative shadow DOM\n try {\n shadowRootElement = element.attachShadow({ mode });\n } catch {\n // do nothing if attachShadow fails because of existing shadow root\n }\n }\n\n if (shadowRootElement) {\n // remove all nodes from the shadow root except links\n shadowRootElement.querySelectorAll('*:not(link)').forEach((node) => {\n node.remove();\n });\n setShadowRoot(shadowRootElement);\n }\n }\n }, [name, isolate, shadowRoot, links, url, mode]);\n\n useEffect(() => {\n let mounted = true;\n\n // if we have a component, we don't need to load it again\n if (\n (!component && (isolate === false || shadowRoot)) ||\n metadataRef.current.url !== url ||\n metadataRef.current.name !== name ||\n metadataRef.current.bundle !== bundle ||\n metadataRef.current.route !== route\n ) {\n metadataRef.current = {\n name,\n bundle,\n route,\n url,\n };\n loadRemoteComponent({\n url: new URL(url, location.origin),\n name,\n bundle,\n route,\n runtime,\n data,\n nextData,\n scripts,\n shared: tryImportShared(),\n remoteShared,\n container: shadowRoot,\n })\n .then((result) => {\n if (mounted) {\n if (result.error) {\n setComponent(result.error);\n } else {\n setComponent(result.component);\n }\n }\n })\n .catch((error: Error) => {\n if (mounted) {\n setComponent(error);\n }\n });\n }\n\n return () => {\n mounted = false;\n };\n }, [\n url,\n component,\n name,\n bundle,\n route,\n runtime,\n scripts,\n data,\n nextData,\n remoteShared,\n children,\n links,\n isolate,\n shadowRoot,\n ]);\n\n const resetStyle = reset ? (\n <style data-remote-components-reset>{`:host { all: initial; }`}</style>\n ) : null;\n let componentToRender = (\n <>{shouldUseChildren ? children : (component as React.ReactNode)}</>\n );\n let linksToRender: React.ReactNode[] | null = links.map((link) => (\n <link\n as={link.as as string}\n href={new URL(link.href as string, url || location.origin).href}\n key={`${link.href as string}_${link.rel}`}\n rel={link.rel as string}\n />\n ));\n\n if (isolate !== false) {\n componentToRender = (\n <div\n id={`shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')}`}\n >\n {typeof document === 'undefined' ? (\n // eslint-disable-next-line react/no-unknown-property\n <template shadowrootmode={mode}>\n <div\n dangerouslySetInnerHTML={{\n __html: `<img\n alt=\"\" decoding=\"async\" style=\"display:none\"\n src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==\"\n onload=\"(function(el){\n const root = el.getRootNode();\n globalThis.__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name.replace(/[^a-z0-9]/g, '_')} = root;\n el.parentElement.remove();\n })(this)\"\n />`,\n }}\n />\n {resetStyle}\n {linksToRender}\n {componentToRender}\n </template>\n ) : null}\n {shadowRoot\n ? createPortal(\n shadowRoot.querySelectorAll('link').length !== links.length ? (\n <>\n {resetStyle}\n {linksToRender}\n {componentToRender}\n </>\n ) : (\n <>\n {resetStyle}\n {componentToRender}\n </>\n ),\n shadowRoot,\n )\n : null}\n </div>\n );\n linksToRender = null;\n }\n\n return (\n <>\n <script data-remote-component type=\"application/json\">\n {JSON.stringify({\n name,\n bundle,\n route,\n runtime,\n })}\n </script>\n {linksToRender}\n {componentToRender}\n {nextData ? (\n <script\n id={`${bundle}_${route.replace(/[^a-zA-Z0-9]+/g, '_')}${name}_next_data`}\n type=\"application/json\"\n >\n {JSON.stringify(nextData)}\n </script>\n ) : null}\n {isolate === false ? <template id={`${name}_end`} /> : null}\n </>\n );\n}\n"],"mappings":";AAmMI,SAGA,UAHA,KAqBM,YArBN;AAjMJ,SAAS,WAAW,UAAU,iBAAiB,cAAc;AAC7D,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsBP,eAAe,kBAAkB;AAC/B,MAAI;AACF,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oCAAoC;AACpE,WAAO;AAAA,EACT,QAAE;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AAAA,EACX,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAkC,IAAI;AACxE,QAAM,cAAc,OAKjB;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAGD,MAAI,qBAAqB,OAAO;AAC9B,UAAM;AAAA,EACR;AAGA,QAAM,qBACH,CAAC,aACC,aACC,CAAC,YACD,OAAQ,UAA0C,SAChD;AAAA;AAAA;AAAA,EAIN,UAAU,YAAY;AAExB,QAAM,CAAC,YAAY,aAAa,IAAI,SAA4B,IAAI;AAEpE,kBAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,OAAO,a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;AAAA;AAAA;AAAA;AAAA,kBAIpH;AAAA;AAAA,cACF;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,eACH;AAAA,cACE;AAAA,UACH,aACG;AAAA,YACE,WAAW,iBAAiB,MAAM,EAAE,WAAW,MAAM,SACnD,iCACG;AAAA;AAAA,cACA;AAAA,cACA;AAAA,eACH,IAEA,iCACG;AAAA;AAAA,cACA;AAAA,eACH;AAAA,YAEF;AAAA,UACF,IACA;AAAA;AAAA;AAAA,IACN;AAEF,oBAAgB;AAAA,EAClB;AAEA,SACE,iCACE;AAAA,wBAAC,YAAO,yBAAqB,MAAC,MAAK,oBAChC,eAAK,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACH;AAAA,IACC;AAAA,IACA;AAAA,IACA,WACC;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,GAAG,UAAU,MAAM,QAAQ,kBAAkB,GAAG,IAAI;AAAA,QACxD,MAAK;AAAA,QAEJ,eAAK,UAAU,QAAQ;AAAA;AAAA,IAC1B,IACE;AAAA,IACH,YAAY,QAAQ,oBAAC,cAAS,IAAI,GAAG,YAAY,IAAK;AAAA,KACzD;AAEJ;","names":[]}
|
|
@@ -81,20 +81,28 @@ function applySharedModules(bundle, resolve) {
|
|
|
81
81
|
// src/shared/webpack/next-client-pages-loader.ts
|
|
82
82
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
83
83
|
const self = globalThis;
|
|
84
|
-
const nextCssOriginal = document.
|
|
84
|
+
const nextCssOriginal = document.querySelector(
|
|
85
|
+
`[id="__next_css__DO_NOT_USE__"]:not([data-bundle="${bundle}"][data-route="${route}"])`
|
|
86
|
+
);
|
|
85
87
|
if (nextCssOriginal) {
|
|
86
88
|
nextCssOriginal.parentNode?.removeChild(nextCssOriginal);
|
|
87
89
|
}
|
|
88
90
|
const nextCss = document.createElement("noscript");
|
|
89
91
|
nextCss.id = "__next_css__DO_NOT_USE__";
|
|
90
|
-
|
|
92
|
+
nextCss.setAttribute("data-bundle", bundle);
|
|
93
|
+
nextCss.setAttribute("data-route", route);
|
|
94
|
+
const nextCssEnd = document.createElement("noscript");
|
|
95
|
+
nextCssEnd.id = "__next_css__DO_NOT_USE_END__";
|
|
96
|
+
nextCssEnd.setAttribute("data-bundle", bundle);
|
|
97
|
+
nextCssEnd.setAttribute("data-route", route);
|
|
98
|
+
document.head.appendChild(nextCssEnd);
|
|
91
99
|
document.head.appendChild(nextCss);
|
|
92
100
|
const componentLoaderChunk = Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
93
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}
|
|
101
|
+
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}!`)
|
|
94
102
|
) ?? Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
95
103
|
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
96
104
|
) ?? self.__remote_webpack_module_map__?.[bundle]?.[Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
97
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}
|
|
105
|
+
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}!`)
|
|
98
106
|
) ?? Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
99
107
|
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
100
108
|
) ?? ""] ?? -1;
|
|
@@ -136,28 +144,47 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
136
144
|
];
|
|
137
145
|
const { default: Component } = componentLoader();
|
|
138
146
|
const { default: App } = appLoader();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (id) {
|
|
147
|
+
if (!self.__remote_next_css__) {
|
|
148
|
+
self.__remote_next_css__ = {};
|
|
149
|
+
}
|
|
150
|
+
if (!self.__remote_next_css__[bundle]) {
|
|
151
|
+
const cssRE = /\.s?css$/;
|
|
152
|
+
Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).filter((id) => cssRE.test(id)).forEach((id) => {
|
|
146
153
|
self.__remote_webpack_require__?.[bundle]?.(id);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
});
|
|
155
|
+
Object.keys(self.__remote_webpack_module_map__?.[bundle] ?? {}).filter((path) => cssRE.test(path)).forEach((path) => {
|
|
156
|
+
const id = self.__remote_webpack_module_map__?.[bundle]?.[path];
|
|
157
|
+
if (id) {
|
|
158
|
+
self.__remote_webpack_require__?.[bundle]?.(id);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
const elements = [];
|
|
150
162
|
let node = nextCss.previousSibling;
|
|
151
|
-
while (node && node !==
|
|
152
|
-
|
|
163
|
+
while (node && node !== nextCssEnd) {
|
|
164
|
+
elements.push(node);
|
|
165
|
+
node.remove();
|
|
153
166
|
node = nextCss.previousSibling;
|
|
154
167
|
}
|
|
168
|
+
self.__remote_next_css__[bundle] = elements;
|
|
169
|
+
}
|
|
170
|
+
if (styleContainer) {
|
|
171
|
+
const elements = self.__remote_next_css__[bundle];
|
|
172
|
+
elements.forEach((el) => {
|
|
173
|
+
styleContainer.appendChild(el.cloneNode(true));
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
const elements = self.__remote_next_css__[bundle];
|
|
177
|
+
elements.forEach((el) => {
|
|
178
|
+
document.head.appendChild(el);
|
|
179
|
+
});
|
|
155
180
|
}
|
|
156
181
|
delete self.__NEXT_P;
|
|
157
182
|
self.__NEXT_P = __NEXT_P_ORIGINAL;
|
|
158
183
|
if (nextCssOriginal) {
|
|
159
184
|
nextCssOriginal.parentNode?.appendChild(nextCssOriginal);
|
|
160
185
|
}
|
|
186
|
+
nextCss.remove();
|
|
187
|
+
nextCssEnd.remove();
|
|
161
188
|
return { Component, App };
|
|
162
189
|
}
|
|
163
190
|
return { Component: null, App: null };
|