remote-components 0.0.22 → 0.0.24

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.
Files changed (78) hide show
  1. package/dist/html/host.cjs +345 -80
  2. package/dist/html/host.cjs.map +1 -1
  3. package/dist/html/host.js +347 -79
  4. package/dist/html/host.js.map +1 -1
  5. package/dist/internal/next/host/app-router-client.cjs +205 -58
  6. package/dist/internal/next/host/app-router-client.cjs.map +1 -1
  7. package/dist/internal/next/host/app-router-client.d.ts +2 -2
  8. package/dist/internal/next/host/app-router-client.js +213 -59
  9. package/dist/internal/next/host/app-router-client.js.map +1 -1
  10. package/dist/internal/next/host/app-router-compat.cjs +114 -0
  11. package/dist/internal/next/host/app-router-compat.cjs.map +1 -0
  12. package/dist/internal/next/host/app-router-compat.d.ts +31 -0
  13. package/dist/internal/next/host/app-router-compat.js +79 -0
  14. package/dist/internal/next/host/app-router-compat.js.map +1 -0
  15. package/dist/internal/next/remote/render-client.cjs +10 -2
  16. package/dist/internal/next/remote/render-client.cjs.map +1 -1
  17. package/dist/internal/next/remote/render-client.js +10 -2
  18. package/dist/internal/next/remote/render-client.js.map +1 -1
  19. package/dist/internal/shared/client/apply-origin.cjs +61 -0
  20. package/dist/internal/shared/client/apply-origin.cjs.map +1 -0
  21. package/dist/internal/shared/client/apply-origin.d.ts +3 -0
  22. package/dist/internal/shared/client/apply-origin.js +37 -0
  23. package/dist/internal/shared/client/apply-origin.js.map +1 -0
  24. package/dist/internal/shared/client/polyfill.cjs +149 -0
  25. package/dist/internal/shared/client/polyfill.cjs.map +1 -0
  26. package/dist/internal/shared/client/polyfill.d.ts +6 -0
  27. package/dist/internal/shared/client/polyfill.js +124 -0
  28. package/dist/internal/shared/client/polyfill.js.map +1 -0
  29. package/dist/internal/shared/client/remote-component.cjs +3 -3
  30. package/dist/internal/shared/client/remote-component.cjs.map +1 -1
  31. package/dist/internal/shared/client/remote-component.d.ts +3 -1
  32. package/dist/internal/shared/client/remote-component.js +3 -3
  33. package/dist/internal/shared/client/remote-component.js.map +1 -1
  34. package/dist/internal/shared/ssr/dom-flight.cjs +49 -17
  35. package/dist/internal/shared/ssr/dom-flight.cjs.map +1 -1
  36. package/dist/internal/shared/ssr/dom-flight.js +49 -17
  37. package/dist/internal/shared/ssr/dom-flight.js.map +1 -1
  38. package/dist/internal/shared/ssr/fetch-remote-component.cjs +3 -2
  39. package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
  40. package/dist/internal/shared/ssr/fetch-remote-component.d.ts +6 -0
  41. package/dist/internal/shared/ssr/fetch-remote-component.js +3 -2
  42. package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
  43. package/dist/next/config.cjs +50 -28
  44. package/dist/next/config.cjs.map +1 -1
  45. package/dist/next/config.js +50 -28
  46. package/dist/next/config.js.map +1 -1
  47. package/dist/next/host/app-router-server.cjs +4 -0
  48. package/dist/next/host/app-router-server.cjs.map +1 -1
  49. package/dist/next/host/app-router-server.d.ts +5 -1
  50. package/dist/next/host/app-router-server.js +4 -0
  51. package/dist/next/host/app-router-server.js.map +1 -1
  52. package/dist/next/host/client/index.cjs +16 -1
  53. package/dist/next/host/client/index.cjs.map +1 -1
  54. package/dist/next/host/client/index.d.ts +1 -1
  55. package/dist/next/host/client/index.js +16 -1
  56. package/dist/next/host/client/index.js.map +1 -1
  57. package/dist/next/host/pages-router-server.cjs +37 -16
  58. package/dist/next/host/pages-router-server.cjs.map +1 -1
  59. package/dist/next/host/pages-router-server.d.ts +3 -0
  60. package/dist/next/host/pages-router-server.js +37 -16
  61. package/dist/next/host/pages-router-server.js.map +1 -1
  62. package/dist/next/middleware.cjs +5 -2
  63. package/dist/next/middleware.cjs.map +1 -1
  64. package/dist/next/middleware.d.ts +1 -0
  65. package/dist/next/middleware.js +5 -2
  66. package/dist/next/middleware.js.map +1 -1
  67. package/dist/next/remote/pages-router.cjs +3 -1
  68. package/dist/next/remote/pages-router.cjs.map +1 -1
  69. package/dist/next/remote/pages-router.d.ts +1 -0
  70. package/dist/next/remote/pages-router.js +3 -1
  71. package/dist/next/remote/pages-router.js.map +1 -1
  72. package/dist/react/index.cjs +235 -156
  73. package/dist/react/index.cjs.map +1 -1
  74. package/dist/react/index.d.ts +7 -3
  75. package/dist/react/index.js +225 -146
  76. package/dist/react/index.js.map +1 -1
  77. package/dist/{types-7425dfe1.d.ts → types-b8210fd3.d.ts} +2 -0
  78. package/package.json +1 -1
@@ -35,7 +35,9 @@ module.exports = __toCommonJS(app_router_client_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_react_dom = require("react-dom");
38
+ var Image = __toESM(require("next/image"), 1);
38
39
  var import_remote_component = require("#internal/shared/client/remote-component");
40
+ var import_app_router_compat = require("#internal/next/host/app-router-compat");
39
41
  async function tryImportShared() {
40
42
  try {
41
43
  const { shared } = await import("@remote-components/shared/host/app");
@@ -56,9 +58,19 @@ function RemoteComponentClient({
56
58
  links = [],
57
59
  remoteShared = {},
58
60
  isolate,
61
+ mode = "open",
62
+ reset,
59
63
  children
60
64
  }) {
65
+ const remoteComponentId = (0, import_react.useId)();
61
66
  const [component, setComponent] = (0, import_react.useState)(null);
67
+ const metadataRef = (0, import_react.useRef)({
68
+ name,
69
+ bundle,
70
+ route,
71
+ url,
72
+ loading: false
73
+ });
62
74
  if (component instanceof Error) {
63
75
  throw component;
64
76
  }
@@ -66,58 +78,131 @@ function RemoteComponentClient({
66
78
  // we don't use the provided static HTML
67
79
  // to mitigate layout shift when loading CSS using JavaScript on the client
68
80
  nextData?.buildId !== "development";
69
- const [shadowRoot, setShadowRoot] = (0, import_react.useState)(null);
81
+ const self = globalThis;
82
+ const shadowRootKey = `__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")}`;
83
+ const shadowContainerRef = (0, import_react.useRef)(
84
+ typeof document === "undefined" ? null : document.querySelector(
85
+ `[data-remote-component-id="shadowroot_${remoteComponentId}"]`
86
+ )
87
+ );
88
+ const shadowRootRef = (0, import_react.useRef)(
89
+ self[shadowRootKey] ?? shadowContainerRef.current?.shadowRoot ?? null
90
+ );
91
+ const ssrShadowRootContentRef = (0, import_react.useRef)(
92
+ shadowRootRef.current?.querySelectorAll("*") ?? null
93
+ );
94
+ const ssrLinksStylesRef = (0, import_react.useRef)([]);
95
+ if (self[shadowRootKey] && shadowRootRef.current) {
96
+ self[shadowRootKey] = null;
97
+ }
70
98
  (0, import_react.useLayoutEffect)(() => {
71
- if (isolate !== false && typeof document !== "undefined" && !shadowRoot) {
99
+ if (!shadowContainerRef.current || shadowContainerRef.current !== shadowRootRef.current?.host) {
100
+ shadowRootRef.current = null;
101
+ }
102
+ if (isolate !== false && typeof document !== "undefined" && !shadowRootRef.current) {
72
103
  let shadowRootElement = null;
73
- const element = document.getElementById(
74
- `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name}`
75
- );
76
- shadowRootElement = element?.shadowRoot ?? null;
104
+ const element = shadowContainerRef.current;
105
+ shadowRootElement = self[shadowRootKey] ?? element?.shadowRoot ?? null;
106
+ self[shadowRootKey] = null;
77
107
  if (!shadowRootElement && element) {
78
- element.attachShadow({ mode: "open" });
79
- shadowRootElement = element.shadowRoot;
108
+ try {
109
+ shadowRootElement = element.attachShadow({ mode });
110
+ } catch {
111
+ }
80
112
  }
81
113
  if (shadowRootElement) {
82
- shadowRootElement.querySelectorAll("*:not(link)").forEach((node) => {
83
- node.remove();
114
+ shadowRootRef.current = shadowRootElement;
115
+ }
116
+ }
117
+ if (shadowRootRef.current && ssrShadowRootContentRef.current && !shouldUseChildren) {
118
+ ssrShadowRootContentRef.current.forEach((node) => {
119
+ if (node.nodeName !== "LINK" && node.nodeName !== "STYLE") {
120
+ node.parentNode?.removeChild(node);
121
+ } else {
122
+ ssrLinksStylesRef.current.push(
123
+ node
124
+ );
125
+ }
126
+ });
127
+ ssrShadowRootContentRef.current = null;
128
+ }
129
+ if (ssrLinksStylesRef.current.length > 0 && shadowRootRef.current) {
130
+ const waitForLoad = shadowRootRef.current.querySelectorAll("link[data-wait]");
131
+ if (waitForLoad.length > 0) {
132
+ Promise.all(
133
+ Array.from(waitForLoad).map(
134
+ (link) => new Promise((resolve) => {
135
+ link.addEventListener("load", () => resolve());
136
+ link.addEventListener("error", () => resolve());
137
+ })
138
+ )
139
+ ).then(() => {
140
+ waitForLoad.forEach((el) => {
141
+ el.removeAttribute("data-wait");
142
+ });
143
+ ssrLinksStylesRef.current.forEach((el) => {
144
+ el.parentNode?.removeChild(el);
145
+ });
146
+ ssrLinksStylesRef.current = [];
147
+ }).catch((e) => {
148
+ console.error(e);
84
149
  });
85
- setShadowRoot(shadowRootElement);
86
150
  }
87
151
  }
88
- }, [name, isolate, shadowRoot, links, url]);
152
+ }, [
153
+ name,
154
+ isolate,
155
+ links,
156
+ url,
157
+ mode,
158
+ self,
159
+ shadowRootKey,
160
+ shouldUseChildren,
161
+ remoteComponentId
162
+ ]);
89
163
  (0, import_react.useEffect)(() => {
90
- let mounted = true;
91
- if (!component && (isolate === false || shadowRoot)) {
92
- (0, import_remote_component.loadRemoteComponent)({
93
- url: new URL(url, location.origin),
94
- name,
95
- bundle,
96
- route,
97
- runtime,
98
- data,
99
- nextData,
100
- scripts,
101
- shared: tryImportShared(),
102
- remoteShared,
103
- container: shadowRoot
104
- }).then((result) => {
105
- if (mounted) {
164
+ (0, import_react.startTransition)(async () => {
165
+ try {
166
+ if (!metadataRef.current.loading && !component && (isolate === false || shadowRootRef.current) || metadataRef.current.url !== url || metadataRef.current.name !== name || metadataRef.current.bundle !== bundle || metadataRef.current.route !== route) {
167
+ metadataRef.current = {
168
+ name,
169
+ bundle,
170
+ route,
171
+ url,
172
+ loading: true
173
+ };
174
+ const result = await (0, import_remote_component.loadRemoteComponent)({
175
+ url: new URL(url, location.origin),
176
+ name,
177
+ bundle,
178
+ route,
179
+ runtime,
180
+ data,
181
+ nextData,
182
+ scripts,
183
+ shared: (async () => {
184
+ return {
185
+ "next/router": import_app_router_compat.routerImpl,
186
+ ...await tryImportShared(),
187
+ "next/image": () => Promise.resolve((0, import_app_router_compat.imageImpl)(Image.default, bundle)),
188
+ "next/dist/client/image-component": () => Promise.resolve({ Image: (0, import_app_router_compat.imageImpl)(Image.default, bundle) })
189
+ };
190
+ })(),
191
+ remoteShared,
192
+ container: shadowRootRef.current
193
+ });
194
+ metadataRef.current.loading = false;
106
195
  if (result.error) {
107
196
  setComponent(result.error);
108
197
  } else {
109
198
  setComponent(result.component);
110
199
  }
111
200
  }
112
- }).catch((error) => {
113
- if (mounted) {
114
- setComponent(error);
115
- }
116
- });
117
- }
118
- return () => {
119
- mounted = false;
120
- };
201
+ } catch (error) {
202
+ metadataRef.current.loading = false;
203
+ setComponent(error);
204
+ }
205
+ });
121
206
  }, [
122
207
  url,
123
208
  component,
@@ -131,52 +216,114 @@ function RemoteComponentClient({
131
216
  remoteShared,
132
217
  children,
133
218
  links,
134
- isolate,
135
- shadowRoot
219
+ isolate
136
220
  ]);
137
- let componentToRender = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: shouldUseChildren ? children : component });
138
- let linksToRender = links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
- "link",
140
- {
141
- as: link.as,
142
- href: new URL(link.href, url || location.origin).href,
143
- rel: link.rel
144
- },
145
- `${link.href}_${link.rel}`
146
- ));
221
+ if (nextData?.buildId === "development" && shadowRootRef.current && isolate !== false && reset && !shadowRootRef.current.querySelector("[data-remote-components-reset]")) {
222
+ const style = document.createElement("style");
223
+ style.setAttribute("data-remote-components-reset", "");
224
+ style.textContent = `:host { all: initial; }`;
225
+ shadowRootRef.current.insertBefore(style, shadowRootRef.current.firstChild);
226
+ } else if (shadowRootRef.current && isolate !== false && !reset && shadowRootRef.current.querySelector("[data-remote-components-reset]")) {
227
+ const style = shadowRootRef.current.querySelector(
228
+ "[data-remote-components-reset]"
229
+ );
230
+ if (style && shadowRootRef.current.firstChild !== style) {
231
+ shadowRootRef.current.removeChild(style);
232
+ }
233
+ }
234
+ const linksToRender = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
235
+ (!nextData || nextData.buildId !== "development") && isolate !== false && reset ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { "data-remote-components-reset": "", children: `:host { all: initial; }` }) : null,
236
+ links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
237
+ "link",
238
+ {
239
+ ...Object.entries(link).reduce(
240
+ (acc, [key, value]) => {
241
+ if (key !== "href" && key !== "precedence" && typeof value === "string") {
242
+ acc[key] = value;
243
+ }
244
+ return acc;
245
+ },
246
+ {}
247
+ ),
248
+ "data-wait": link.rel === "stylesheet" && link.href ? "" : void 0,
249
+ href: new URL(link.href, url).href
250
+ },
251
+ JSON.stringify(link)
252
+ )),
253
+ links.filter((link) => link.rel === "stylesheet").map((link) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
254
+ "link",
255
+ {
256
+ ...Object.entries(link).reduce(
257
+ (acc, [key, value]) => {
258
+ if (key !== "href" && key !== "precedence" && typeof value === "string") {
259
+ acc[key] = value;
260
+ }
261
+ return acc;
262
+ },
263
+ {}
264
+ ),
265
+ as: "style",
266
+ fetchPriority: "high",
267
+ href: new URL(link.href, url).href,
268
+ precedence: bundle,
269
+ rel: "preload"
270
+ },
271
+ JSON.stringify(link)
272
+ ))
273
+ ] });
274
+ let componentToRender = shouldUseChildren ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : component;
147
275
  if (isolate !== false) {
148
276
  componentToRender = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
149
277
  "div",
150
278
  {
151
- id: `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name}`,
279
+ "data-remote-component-id": `shadowroot_${remoteComponentId}`,
280
+ "data-remote-component-isolation-root": "",
281
+ id: `shadowroot_${name}`,
282
+ ref: shadowContainerRef,
152
283
  children: [
153
284
  typeof document === "undefined" ? (
154
285
  // eslint-disable-next-line react/no-unknown-property
155
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("template", { shadowrootmode: "open", children: [
286
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("template", { shadowrootmode: mode, children: [
287
+ mode === "closed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
288
+ "div",
289
+ {
290
+ dangerouslySetInnerHTML: {
291
+ __html: `<img
292
+ alt="" decoding="async" style="display:none"
293
+ src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="
294
+ onload="(function(el){
295
+ const root = el.getRootNode();
296
+ globalThis.__remote_components_shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, "_")}_${name.replace(/[^a-z0-9]/g, "_")} = root;
297
+ el.parentElement.remove();
298
+ })(this)"
299
+ />`
300
+ }
301
+ }
302
+ ) : null,
156
303
  linksToRender,
157
- componentToRender
304
+ shouldUseChildren ? children : null
158
305
  ] })
159
306
  ) : null,
160
- shadowRoot ? (0, import_react_dom.createPortal)(
161
- shadowRoot.querySelectorAll("link").length !== links.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
307
+ typeof document !== "undefined" && shadowRootRef.current && !shouldUseChildren ? (0, import_react_dom.createPortal)(
308
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
162
309
  linksToRender,
163
310
  componentToRender
164
- ] }) : componentToRender,
165
- shadowRoot
311
+ ] }),
312
+ shadowRootRef.current
166
313
  ) : null
167
314
  ]
168
315
  }
169
316
  );
170
- linksToRender = null;
171
317
  }
172
318
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
319
+ isolate === false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("template", { id: `${name}_start` }) : null,
173
320
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", { "data-remote-component": true, type: "application/json", children: JSON.stringify({
174
321
  name,
175
322
  bundle,
176
323
  route,
177
324
  runtime
178
325
  }) }),
179
- linksToRender,
326
+ isolate === false ? linksToRender : null,
180
327
  componentToRender,
181
328
  nextData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
182
329
  "script",
@@ -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(\n `shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name}`,\n );\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\n id={`shadowroot_${new URL(url).href.replace(/[^a-z0-9]/g, '_')}_${name}`}\n >\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(/[^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;AAgKI;AA9JJ,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,CAAC,WAAW,YAAY,QAAI,uBAAkC,IAAI;AAGxE,MAAI,qBAAqB,OAAO;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,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
+ {"version":3,"sources":["../../../../src/next/host/app-router-client.tsx"],"sourcesContent":["'use client';\n\nimport {\n useId,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n startTransition,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport * as Image from 'next/image';\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';\nimport { imageImpl, routerImpl } from '#internal/next/host/app-router-compat';\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 remoteComponentId = useId();\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 loading: boolean;\n }>({\n name,\n bundle,\n route,\n url,\n loading: false,\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 self = globalThis as Record<\n `__remote_components_shadowroot_${string}`,\n ShadowRoot | null\n > &\n Record<`__remote_components_container_${string}`, HTMLDivElement | null>;\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 const shadowContainerRef = useRef<HTMLDivElement | null>(\n typeof document === 'undefined'\n ? null\n : document.querySelector(\n `[data-remote-component-id=\"shadowroot_${remoteComponentId}\"]`,\n ),\n );\n const shadowRootRef = useRef<ShadowRoot | null>(\n self[shadowRootKey] ?? shadowContainerRef.current?.shadowRoot ?? null,\n );\n const ssrShadowRootContentRef = useRef<NodeListOf<ChildNode> | null>(\n shadowRootRef.current?.querySelectorAll('*') ?? null,\n );\n const ssrLinksStylesRef = useRef<(HTMLLinkElement | HTMLStyleElement)[]>([]);\n\n if (self[shadowRootKey] && shadowRootRef.current) {\n self[shadowRootKey] = null;\n }\n\n useLayoutEffect(() => {\n if (\n !shadowContainerRef.current ||\n shadowContainerRef.current !== shadowRootRef.current?.host\n ) {\n shadowRootRef.current = null;\n }\n\n if (\n isolate !== false &&\n typeof document !== 'undefined' &&\n !shadowRootRef.current\n ) {\n let shadowRootElement: ShadowRoot | null = null;\n const element = shadowContainerRef.current;\n\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 shadowRootRef.current = shadowRootElement;\n }\n }\n\n if (\n shadowRootRef.current &&\n ssrShadowRootContentRef.current &&\n !shouldUseChildren\n ) {\n // remove all nodes from the shadow root except links\n ssrShadowRootContentRef.current.forEach((node) => {\n if (node.nodeName !== 'LINK' && node.nodeName !== 'STYLE') {\n node.parentNode?.removeChild(node);\n } else {\n ssrLinksStylesRef.current.push(\n node as HTMLLinkElement | HTMLStyleElement,\n );\n }\n });\n ssrShadowRootContentRef.current = null;\n }\n\n if (ssrLinksStylesRef.current.length > 0 && shadowRootRef.current) {\n const waitForLoad =\n shadowRootRef.current.querySelectorAll('link[data-wait]');\n if (waitForLoad.length > 0) {\n Promise.all(\n Array.from(waitForLoad).map(\n (link) =>\n new Promise<void>((resolve) => {\n link.addEventListener('load', () => resolve());\n link.addEventListener('error', () => resolve());\n }),\n ),\n )\n .then(() => {\n waitForLoad.forEach((el) => {\n el.removeAttribute('data-wait');\n });\n\n // remove SSR injected styles and links\n ssrLinksStylesRef.current.forEach((el) => {\n el.parentNode?.removeChild(el);\n });\n ssrLinksStylesRef.current = [];\n })\n .catch((e) => {\n // eslint-disable-next-line no-console\n console.error(e);\n });\n }\n }\n }, [\n name,\n isolate,\n links,\n url,\n mode,\n self,\n shadowRootKey,\n shouldUseChildren,\n remoteComponentId,\n ]);\n\n useEffect(() => {\n startTransition(async () => {\n try {\n // if we have a component, we don't need to load it again\n if (\n (!metadataRef.current.loading &&\n !component &&\n (isolate === false || shadowRootRef.current)) ||\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 loading: true,\n };\n const result = await loadRemoteComponent({\n url: new URL(url, location.origin),\n name,\n bundle,\n route,\n runtime,\n data,\n nextData,\n scripts,\n shared: (async () => {\n return {\n 'next/router': routerImpl,\n ...(await tryImportShared()),\n 'next/image': () =>\n Promise.resolve(imageImpl(Image.default, bundle)),\n 'next/dist/client/image-component': () =>\n Promise.resolve({ Image: imageImpl(Image.default, bundle) }),\n };\n })(),\n remoteShared,\n container: shadowRootRef.current,\n });\n metadataRef.current.loading = false;\n if (result.error) {\n setComponent(result.error);\n } else {\n setComponent(result.component);\n }\n }\n } catch (error: unknown) {\n metadataRef.current.loading = false;\n setComponent(error as Error);\n }\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 ]);\n\n if (\n nextData?.buildId === 'development' &&\n shadowRootRef.current &&\n isolate !== false &&\n reset &&\n !shadowRootRef.current.querySelector('[data-remote-components-reset]')\n ) {\n // inject reset styles into the shadow root\n const style = document.createElement('style');\n style.setAttribute('data-remote-components-reset', '');\n style.textContent = `:host { all: initial; }`;\n shadowRootRef.current.insertBefore(style, shadowRootRef.current.firstChild);\n } else if (\n shadowRootRef.current &&\n isolate !== false &&\n !reset &&\n shadowRootRef.current.querySelector('[data-remote-components-reset]')\n ) {\n // ensure reset styles are the first child in the shadow root\n const style = shadowRootRef.current.querySelector(\n '[data-remote-components-reset]',\n );\n if (style && shadowRootRef.current.firstChild !== style) {\n shadowRootRef.current.removeChild(style);\n }\n }\n\n const linksToRender = (\n <>\n {(!nextData || nextData.buildId !== 'development') &&\n isolate !== false &&\n reset ? (\n <style data-remote-components-reset=\"\">{`:host { all: initial; }`}</style>\n ) : null}\n {links.map((link) => (\n <link\n key={JSON.stringify(link)}\n {...Object.entries(link).reduce<Record<string, string>>(\n (acc, [key, value]) => {\n if (\n key !== 'href' &&\n key !== 'precedence' &&\n typeof value === 'string'\n ) {\n acc[key] = value;\n }\n return acc;\n },\n {},\n )}\n data-wait={link.rel === 'stylesheet' && link.href ? '' : undefined}\n href={new URL(link.href as string, url).href}\n />\n ))}\n {links\n .filter((link) => link.rel === 'stylesheet')\n .map((link) => (\n <link\n key={JSON.stringify(link)}\n {...Object.entries(link).reduce<Record<string, string>>(\n (acc, [key, value]) => {\n if (\n key !== 'href' &&\n key !== 'precedence' &&\n typeof value === 'string'\n ) {\n acc[key] = value;\n }\n return acc;\n },\n {},\n )}\n as=\"style\"\n fetchPriority=\"high\"\n href={new URL(link.href as string, url).href}\n precedence={bundle}\n rel=\"preload\"\n />\n ))}\n </>\n );\n\n let componentToRender = shouldUseChildren ? (\n <>{children}</>\n ) : (\n (component as React.ReactNode)\n );\n\n if (isolate !== false) {\n componentToRender = (\n <div\n data-remote-component-id={`shadowroot_${remoteComponentId}`}\n data-remote-component-isolation-root=\"\"\n id={`shadowroot_${name}`}\n ref={shadowContainerRef}\n >\n {typeof document === 'undefined' ? (\n // eslint-disable-next-line react/no-unknown-property\n <template shadowrootmode={mode}>\n {mode === 'closed' ? (\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 ) : null}\n {linksToRender}\n {shouldUseChildren ? children : null}\n </template>\n ) : null}\n {typeof document !== 'undefined' &&\n shadowRootRef.current &&\n !shouldUseChildren\n ? createPortal(\n <>\n {linksToRender}\n {componentToRender}\n </>,\n shadowRootRef.current,\n )\n : null}\n </div>\n );\n }\n\n return (\n <>\n {isolate === false ? <template id={`${name}_start`} /> : null}\n <script data-remote-component type=\"application/json\">\n {JSON.stringify({\n name,\n bundle,\n route,\n runtime,\n })}\n </script>\n {isolate === false ? linksToRender : null}\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;AAiUI;AA/TJ,mBAOO;AACP,uBAA6B;AAC7B,YAAuB;AACvB,8BAIO;AAEP,+BAAsC;AAqBtC,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,wBAAoB,oBAAM;AAChC,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAkC,IAAI;AACxE,QAAM,kBAAc,qBAMjB;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACX,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,OAAO;AAKb,QAAM,gBACJ,kCAAkC,IAAI,IAAI,GAAG,EAAE,KAAK,QAAQ,cAAc,GAAG,KAAK,KAAK,QAAQ,cAAc,GAAG;AAClH,QAAM,yBAAqB;AAAA,IACzB,OAAO,aAAa,cAChB,OACA,SAAS;AAAA,MACP,yCAAyC;AAAA,IAC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S,gBAAgB,MACvB;AAAA,uBAAS,WACR;AAAA,gBAAC;AAAA;AAAA,kBACC,yBAAyB;AAAA,oBACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,oDAK0B,IAAI,IAAI,GAAG,EAAE,KAAK,QAAQ,cAAc,GAAG,KAAK,KAAK,QAAQ,cAAc,GAAG;AAAA;AAAA;AAAA;AAAA,kBAIlH;AAAA;AAAA,cACF,IACE;AAAA,cACH;AAAA,cACA,oBAAoB,WAAW;AAAA,eAClC;AAAA,cACE;AAAA,UACH,OAAO,aAAa,eACrB,cAAc,WACd,CAAC,wBACG;AAAA,YACE,4EACG;AAAA;AAAA,cACA;AAAA,eACH;AAAA,YACA,cAAc;AAAA,UAChB,IACA;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AAEA,SACE,4EACG;AAAA,gBAAY,QAAQ,4CAAC,cAAS,IAAI,GAAG,cAAc,IAAK;AAAA,IACzD,4CAAC,YAAO,yBAAqB,MAAC,MAAK,oBAChC,eAAK,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACH;AAAA,IACC,YAAY,QAAQ,gBAAgB;AAAA,IACpC;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-7425dfe1.js';
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 };