remote-components 0.0.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.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/html/host.cjs +758 -0
  4. package/dist/html/host.cjs.map +1 -0
  5. package/dist/html/host.d.ts +2 -0
  6. package/dist/html/host.js +737 -0
  7. package/dist/html/host.js.map +1 -0
  8. package/dist/next/config.cjs +347 -0
  9. package/dist/next/config.cjs.map +1 -0
  10. package/dist/next/config.d.ts +8 -0
  11. package/dist/next/config.js +325 -0
  12. package/dist/next/config.js.map +1 -0
  13. package/dist/next/host/app-client.cjs +124 -0
  14. package/dist/next/host/app-client.cjs.map +1 -0
  15. package/dist/next/host/app-client.d.ts +33 -0
  16. package/dist/next/host/app-client.js +104 -0
  17. package/dist/next/host/app-client.js.map +1 -0
  18. package/dist/next/host/app-server.cjs +61 -0
  19. package/dist/next/host/app-server.cjs.map +1 -0
  20. package/dist/next/host/app-server.d.ts +7 -0
  21. package/dist/next/host/app-server.js +37 -0
  22. package/dist/next/host/app-server.js.map +1 -0
  23. package/dist/next/host/pages-client.cjs +52 -0
  24. package/dist/next/host/pages-client.cjs.map +1 -0
  25. package/dist/next/host/pages-client.d.ts +17 -0
  26. package/dist/next/host/pages-client.js +18 -0
  27. package/dist/next/host/pages-client.js.map +1 -0
  28. package/dist/next/host/pages-server.cjs +134 -0
  29. package/dist/next/host/pages-server.cjs.map +1 -0
  30. package/dist/next/host/pages-server.d.ts +25 -0
  31. package/dist/next/host/pages-server.js +99 -0
  32. package/dist/next/host/pages-server.js.map +1 -0
  33. package/dist/next/remote/pages.cjs +37 -0
  34. package/dist/next/remote/pages.cjs.map +1 -0
  35. package/dist/next/remote/pages.d.ts +9 -0
  36. package/dist/next/remote/pages.js +13 -0
  37. package/dist/next/remote/pages.js.map +1 -0
  38. package/dist/next/remote/render-client-turbopack.cjs +51 -0
  39. package/dist/next/remote/render-client-turbopack.cjs.map +1 -0
  40. package/dist/next/remote/render-client-turbopack.d.ts +11 -0
  41. package/dist/next/remote/render-client-turbopack.js +27 -0
  42. package/dist/next/remote/render-client-turbopack.js.map +1 -0
  43. package/dist/next/remote/render-client-webpack.cjs +51 -0
  44. package/dist/next/remote/render-client-webpack.cjs.map +1 -0
  45. package/dist/next/remote/render-client-webpack.d.ts +11 -0
  46. package/dist/next/remote/render-client-webpack.js +27 -0
  47. package/dist/next/remote/render-client-webpack.js.map +1 -0
  48. package/dist/next/remote/render-client.cjs +106 -0
  49. package/dist/next/remote/render-client.cjs.map +1 -0
  50. package/dist/next/remote/render-client.d.ts +15 -0
  51. package/dist/next/remote/render-client.js +82 -0
  52. package/dist/next/remote/render-client.js.map +1 -0
  53. package/dist/next/remote/render-server.cjs +133 -0
  54. package/dist/next/remote/render-server.cjs.map +1 -0
  55. package/dist/next/remote/render-server.d.ts +9 -0
  56. package/dist/next/remote/render-server.js +99 -0
  57. package/dist/next/remote/render-server.js.map +1 -0
  58. package/dist/next/remote/server.cjs +29 -0
  59. package/dist/next/remote/server.cjs.map +1 -0
  60. package/dist/next/remote/server.d.ts +3 -0
  61. package/dist/next/remote/server.js +5 -0
  62. package/dist/next/remote/server.js.map +1 -0
  63. package/dist/shared/client/remote-component.cjs +558 -0
  64. package/dist/shared/client/remote-component.cjs.map +1 -0
  65. package/dist/shared/client/remote-component.d.ts +93 -0
  66. package/dist/shared/client/remote-component.js +511 -0
  67. package/dist/shared/client/remote-component.js.map +1 -0
  68. package/dist/shared/ssr/dom-flight.cjs +185 -0
  69. package/dist/shared/ssr/dom-flight.cjs.map +1 -0
  70. package/dist/shared/ssr/dom-flight.d.ts +30 -0
  71. package/dist/shared/ssr/dom-flight.js +151 -0
  72. package/dist/shared/ssr/dom-flight.js.map +1 -0
  73. package/dist/shared/ssr/fetch-remote-component.cjs +162 -0
  74. package/dist/shared/ssr/fetch-remote-component.cjs.map +1 -0
  75. package/dist/shared/ssr/fetch-remote-component.d.ts +31 -0
  76. package/dist/shared/ssr/fetch-remote-component.js +137 -0
  77. package/dist/shared/ssr/fetch-remote-component.js.map +1 -0
  78. package/dist/shared/webpack/next-client-pages-loader.cjs +107 -0
  79. package/dist/shared/webpack/next-client-pages-loader.cjs.map +1 -0
  80. package/dist/shared/webpack/next-client-pages-loader.d.ts +10 -0
  81. package/dist/shared/webpack/next-client-pages-loader.js +83 -0
  82. package/dist/shared/webpack/next-client-pages-loader.js.map +1 -0
  83. package/dist/shared/webpack/shared-modules.cjs +50 -0
  84. package/dist/shared/webpack/shared-modules.cjs.map +1 -0
  85. package/dist/shared/webpack/shared-modules.d.ts +3 -0
  86. package/dist/shared/webpack/shared-modules.js +26 -0
  87. package/dist/shared/webpack/shared-modules.js.map +1 -0
  88. package/dist/types-280a3640.d.ts +8 -0
  89. package/dist/types-a1bd5b56.d.ts +6 -0
  90. package/package.json +151 -0
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var app_server_exports = {};
20
+ __export(app_server_exports, {
21
+ RemoteComponent: () => RemoteComponent
22
+ });
23
+ module.exports = __toCommonJS(app_server_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_headers = require("next/headers");
26
+ var import_fetch_remote_component = require("../../shared/ssr/fetch-remote-component");
27
+ var import_app_client = require("./app-client");
28
+ const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;
29
+ async function RemoteComponent({ src }) {
30
+ const headerList = await (0, import_headers.headers)();
31
+ const {
32
+ metadata,
33
+ scripts,
34
+ links,
35
+ hydrationData,
36
+ nextData,
37
+ component,
38
+ remoteShared
39
+ } = await (0, import_fetch_remote_component.fetchRemoteComponent)(src, headerList, true);
40
+ const name = metadata.id.replace(/_ssr$/, "");
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ import_app_client.RemoteComponentClient,
43
+ {
44
+ bundle: metadata.bundle || (CURRENT_ZONE ?? name),
45
+ data: hydrationData,
46
+ links,
47
+ name,
48
+ nextData,
49
+ remoteShared,
50
+ route: metadata.route,
51
+ runtime: metadata.runtime,
52
+ scripts,
53
+ children: component
54
+ }
55
+ );
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ RemoteComponent
60
+ });
61
+ //# sourceMappingURL=app-server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/app-server.tsx"],"sourcesContent":["import { headers } from 'next/headers';\nimport { fetchRemoteComponent } from '../../shared/ssr/fetch-remote-component';\nimport { RemoteComponentClient } from './app-client';\n\nconst CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\nexport async function RemoteComponent({ src }: { src: string | URL }) {\n // get the headers from the request\n const headerList = await headers();\n\n const {\n metadata,\n scripts,\n links,\n hydrationData,\n nextData,\n component,\n remoteShared,\n } = await fetchRemoteComponent(src, headerList, true);\n\n // pass all remote component data to the SSR/client layer\n // render remote component static HTML as children\n // remote _ssr suffix from remote component id\n const name = metadata.id.replace(/_ssr$/, '');\n return (\n <RemoteComponentClient\n bundle={metadata.bundle || (CURRENT_ZONE ?? name)}\n data={hydrationData}\n links={links}\n name={name}\n nextData={nextData}\n remoteShared={remoteShared}\n route={metadata.route}\n runtime={metadata.runtime}\n scripts={scripts}\n >\n {component}\n </RemoteComponentClient>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAzBJ,qBAAwB;AACxB,oCAAqC;AACrC,wBAAsC;AAEtC,MAAM,eAAe,QAAQ,IAAI;AAEjC,eAAsB,gBAAgB,EAAE,IAAI,GAA0B;AAEpE,QAAM,aAAa,UAAM,wBAAQ;AAEjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,UAAM,oDAAqB,KAAK,YAAY,IAAI;AAKpD,QAAM,OAAO,SAAS,GAAG,QAAQ,SAAS,EAAE;AAC5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ,SAAS,WAAW,gBAAgB;AAAA,MAC5C,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS,SAAS;AAAA,MAClB;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function RemoteComponent({ src }: {
4
+ src: string | URL;
5
+ }): Promise<react_jsx_runtime.JSX.Element>;
6
+
7
+ export { RemoteComponent };
@@ -0,0 +1,37 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { headers } from "next/headers";
3
+ import { fetchRemoteComponent } from "../../shared/ssr/fetch-remote-component";
4
+ import { RemoteComponentClient } from "./app-client";
5
+ const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;
6
+ async function RemoteComponent({ src }) {
7
+ const headerList = await headers();
8
+ const {
9
+ metadata,
10
+ scripts,
11
+ links,
12
+ hydrationData,
13
+ nextData,
14
+ component,
15
+ remoteShared
16
+ } = await fetchRemoteComponent(src, headerList, true);
17
+ const name = metadata.id.replace(/_ssr$/, "");
18
+ return /* @__PURE__ */ jsx(
19
+ RemoteComponentClient,
20
+ {
21
+ bundle: metadata.bundle || (CURRENT_ZONE ?? name),
22
+ data: hydrationData,
23
+ links,
24
+ name,
25
+ nextData,
26
+ remoteShared,
27
+ route: metadata.route,
28
+ runtime: metadata.runtime,
29
+ scripts,
30
+ children: component
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ RemoteComponent
36
+ };
37
+ //# sourceMappingURL=app-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/app-server.tsx"],"sourcesContent":["import { headers } from 'next/headers';\nimport { fetchRemoteComponent } from '../../shared/ssr/fetch-remote-component';\nimport { RemoteComponentClient } from './app-client';\n\nconst CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\nexport async function RemoteComponent({ src }: { src: string | URL }) {\n // get the headers from the request\n const headerList = await headers();\n\n const {\n metadata,\n scripts,\n links,\n hydrationData,\n nextData,\n component,\n remoteShared,\n } = await fetchRemoteComponent(src, headerList, true);\n\n // pass all remote component data to the SSR/client layer\n // render remote component static HTML as children\n // remote _ssr suffix from remote component id\n const name = metadata.id.replace(/_ssr$/, '');\n return (\n <RemoteComponentClient\n bundle={metadata.bundle || (CURRENT_ZONE ?? name)}\n data={hydrationData}\n links={links}\n name={name}\n nextData={nextData}\n remoteShared={remoteShared}\n route={metadata.route}\n runtime={metadata.runtime}\n scripts={scripts}\n >\n {component}\n </RemoteComponentClient>\n );\n}\n"],"mappings":"AAyBI;AAzBJ,SAAS,eAAe;AACxB,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AAEtC,MAAM,eAAe,QAAQ,IAAI;AAEjC,eAAsB,gBAAgB,EAAE,IAAI,GAA0B;AAEpE,QAAM,aAAa,MAAM,QAAQ;AAEjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,MAAM,qBAAqB,KAAK,YAAY,IAAI;AAKpD,QAAM,OAAO,SAAS,GAAG,QAAQ,SAAS,EAAE;AAC5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ,SAAS,WAAW,gBAAgB;AAAA,MAC5C,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS,SAAS;AAAA,MAClB;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var pages_client_exports = {};
30
+ __export(pages_client_exports, {
31
+ RemoteComponent: () => RemoteComponent
32
+ });
33
+ module.exports = __toCommonJS(pages_client_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_react = require("react");
36
+ var import_host = require("@remote-component/shared/host");
37
+ function RemoteComponent({
38
+ src,
39
+ children
40
+ }) {
41
+ (0, import_react.useEffect)(() => {
42
+ const self = globalThis;
43
+ self.__remote_component_shared__ = import_host.shared;
44
+ import("remote-components/html");
45
+ }, []);
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("remote-component", { src, children });
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ RemoteComponent
51
+ });
52
+ //# sourceMappingURL=pages-client.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/pages-client.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { shared } from '@remote-component/shared/host';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n children: React.ReactNode;\n };\n }\n }\n}\n\nexport interface RemoteComponentProps {\n src: string;\n children?: React.ReactNode;\n}\n\nexport function RemoteComponent({\n src,\n children,\n}: RemoteComponentProps): JSX.Element {\n useEffect(() => {\n const self = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n self.__remote_component_shared__ = shared;\n import('remote-components/html');\n }, []);\n\n return <remote-component src={src}>{children}</remote-component>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCS;AAlCT,mBAA0B;AAC1B,kBAAuB;AAoBhB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AACF,GAAsC;AACpC,8BAAU,MAAM;AACd,UAAM,OAAO;AAIb,SAAK,8BAA8B;AACnC,WAAO,wBAAwB;AAAA,EACjC,GAAG,CAAC,CAAC;AAEL,SAAO,4CAAC,sBAAiB,KAAW,UAAS;AAC/C;","names":[]}
@@ -0,0 +1,17 @@
1
+ declare module 'react/jsx-runtime' {
2
+ namespace JSX {
3
+ interface IntrinsicElements {
4
+ 'remote-component': {
5
+ src?: string;
6
+ children: React.ReactNode;
7
+ };
8
+ }
9
+ }
10
+ }
11
+ interface RemoteComponentProps {
12
+ src: string;
13
+ children?: React.ReactNode;
14
+ }
15
+ declare function RemoteComponent({ src, children, }: RemoteComponentProps): JSX.Element;
16
+
17
+ export { RemoteComponent, RemoteComponentProps };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { shared } from "@remote-component/shared/host";
4
+ function RemoteComponent({
5
+ src,
6
+ children
7
+ }) {
8
+ useEffect(() => {
9
+ const self = globalThis;
10
+ self.__remote_component_shared__ = shared;
11
+ import("remote-components/html");
12
+ }, []);
13
+ return /* @__PURE__ */ jsx("remote-component", { src, children });
14
+ }
15
+ export {
16
+ RemoteComponent
17
+ };
18
+ //# sourceMappingURL=pages-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/pages-client.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { shared } from '@remote-component/shared/host';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n children: React.ReactNode;\n };\n }\n }\n}\n\nexport interface RemoteComponentProps {\n src: string;\n children?: React.ReactNode;\n}\n\nexport function RemoteComponent({\n src,\n children,\n}: RemoteComponentProps): JSX.Element {\n useEffect(() => {\n const self = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n self.__remote_component_shared__ = shared;\n import('remote-components/html');\n }, []);\n\n return <remote-component src={src}>{children}</remote-component>;\n}\n"],"mappings":"AAkCS;AAlCT,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAoBhB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AACF,GAAsC;AACpC,YAAU,MAAM;AACd,UAAM,OAAO;AAIb,SAAK,8BAA8B;AACnC,WAAO,wBAAwB;AAAA,EACjC,GAAG,CAAC,CAAC;AAEL,SAAO,oBAAC,sBAAiB,KAAW,UAAS;AAC/C;","names":[]}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var pages_server_exports = {};
30
+ __export(pages_server_exports, {
31
+ RemoteComponent: () => RemoteComponent,
32
+ getRemoteComponentProps: () => getRemoteComponentProps
33
+ });
34
+ module.exports = __toCommonJS(pages_server_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_host = require("@remote-component/shared/host");
38
+ var import_fetch_remote_component = require("../../shared/ssr/fetch-remote-component");
39
+ const REMOTE_COMPONENT_STORE = Symbol("REMOTE_COMPONENT_STORE");
40
+ const REMOTE_COMPONENT_KEY = "__REMOTE_COMPONENT_KEY__";
41
+ const self = globalThis;
42
+ function getKey({
43
+ bundle,
44
+ route,
45
+ name
46
+ }) {
47
+ return `${bundle ?? "__next"}:${route ?? "/"}:${name ?? "__vercel_remote_component"}__${crypto.randomUUID()}`;
48
+ }
49
+ function setComponent(key, html) {
50
+ if (!self[REMOTE_COMPONENT_STORE]) {
51
+ self[REMOTE_COMPONENT_STORE] = /* @__PURE__ */ new Map();
52
+ }
53
+ self[REMOTE_COMPONENT_STORE].set(key, html);
54
+ }
55
+ function getComponent(key) {
56
+ const component = self[REMOTE_COMPONENT_STORE]?.get(key);
57
+ self[REMOTE_COMPONENT_STORE]?.delete(key);
58
+ return component;
59
+ }
60
+ function RemoteComponent(props) {
61
+ const remoteComponent = typeof document !== "undefined" ? null : (
62
+ // retrieve the HTML from the global store
63
+ getComponent(
64
+ props[REMOTE_COMPONENT_KEY] ?? "__vercel_remote_component"
65
+ )
66
+ );
67
+ (0, import_react.useEffect)(() => {
68
+ const clientSelf = globalThis;
69
+ clientSelf.__remote_component_shared__ = import_host.shared;
70
+ import("remote-components/html");
71
+ }, []);
72
+ if (!props[REMOTE_COMPONENT_KEY]) {
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("remote-component", { src: props.src, children: props.children });
74
+ }
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("remote-component", { src: props.src, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
+ "div",
77
+ {
78
+ dangerouslySetInnerHTML: { __html: remoteComponent ?? "" },
79
+ id: "__REMOTE_COMPONENT__",
80
+ suppressHydrationWarning: true
81
+ }
82
+ ) });
83
+ }
84
+ async function getRemoteComponentProps(src, headers) {
85
+ if (typeof document !== "undefined") {
86
+ throw new Error(
87
+ "getRemoteComponentProps can only be used on the server side."
88
+ );
89
+ }
90
+ const {
91
+ metadata: { bundle, route, runtime },
92
+ name,
93
+ html,
94
+ nextData
95
+ } = await (0, import_fetch_remote_component.fetchRemoteComponent)(
96
+ src,
97
+ headers instanceof Headers ? headers : (
98
+ // convert IncomingHttpHeaders to web standard Headers
99
+ Object.entries(headers).reduce((acc, [key2, value]) => {
100
+ if (value) {
101
+ if (Array.isArray(value)) {
102
+ value.forEach((v) => acc.append(key2, v));
103
+ } else {
104
+ acc.append(key2, value);
105
+ }
106
+ }
107
+ return acc;
108
+ }, new Headers())
109
+ )
110
+ );
111
+ const props = {
112
+ src,
113
+ bundle,
114
+ name,
115
+ route,
116
+ runtime
117
+ };
118
+ if (nextData?.buildId === "development") {
119
+ return props;
120
+ }
121
+ const key = getKey(props);
122
+ setComponent(key, html);
123
+ return {
124
+ ...props,
125
+ // add remote component key to the props
126
+ [REMOTE_COMPONENT_KEY]: key
127
+ };
128
+ }
129
+ // Annotate the CommonJS export names for ESM import in node:
130
+ 0 && (module.exports = {
131
+ RemoteComponent,
132
+ getRemoteComponentProps
133
+ });
134
+ //# sourceMappingURL=pages-server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/pages-server.tsx"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\nimport { useEffect } from 'react';\nimport { shared } from '@remote-component/shared/host';\nimport { fetchRemoteComponent } from '../../shared/ssr/fetch-remote-component';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n children: React.ReactNode;\n };\n }\n }\n}\n\n// internal symbols to access global store\nconst REMOTE_COMPONENT_STORE = Symbol('REMOTE_COMPONENT_STORE');\nconst REMOTE_COMPONENT_KEY = '__REMOTE_COMPONENT_KEY__';\n\n// temporary global store for remote component HTML\n// the store is used to save the HTML of remote components for SSR without sending the content to the client\nconst self = globalThis as typeof globalThis & {\n [REMOTE_COMPONENT_STORE]?: Map<string, string>;\n};\n\nfunction getKey({\n bundle,\n route,\n name,\n}: {\n bundle?: string;\n route?: string;\n name?: string;\n}): string {\n return `${bundle ?? '__next'}:${route ?? '/'}:${name ?? '__vercel_remote_component'}__${crypto.randomUUID()}`;\n}\n\nfunction setComponent(key: string, html: string): void {\n if (!self[REMOTE_COMPONENT_STORE]) {\n self[REMOTE_COMPONENT_STORE] = new Map();\n }\n self[REMOTE_COMPONENT_STORE].set(key, html);\n}\n\nfunction getComponent(key: string): string | undefined {\n const component = self[REMOTE_COMPONENT_STORE]?.get(key);\n // remove the component from the store after retrieving it to prevent memory leaks\n // storing the HTML in the global store is only needed for SSR and it's temporary only used for a single render\n self[REMOTE_COMPONENT_STORE]?.delete(key);\n return component;\n}\n\nexport interface RemoteComponentProps {\n src: string;\n bundle?: string;\n route?: string;\n name?: string;\n [REMOTE_COMPONENT_KEY]?: string;\n children?: React.ReactNode;\n}\n\nexport function RemoteComponent(props: RemoteComponentProps): JSX.Element {\n const remoteComponent =\n typeof document !== 'undefined'\n ? null\n : // retrieve the HTML from the global store\n getComponent(\n props[REMOTE_COMPONENT_KEY] ?? '__vercel_remote_component',\n );\n\n useEffect(() => {\n const clientSelf = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n clientSelf.__remote_component_shared__ = shared;\n import('remote-components/html');\n }, []);\n\n if (!props[REMOTE_COMPONENT_KEY]) {\n return (\n <remote-component src={props.src}>{props.children}</remote-component>\n );\n }\n\n return (\n <remote-component src={props.src}>\n <div\n dangerouslySetInnerHTML={{ __html: remoteComponent ?? '' }}\n id=\"__REMOTE_COMPONENT__\"\n suppressHydrationWarning\n />\n </remote-component>\n );\n}\n\nexport async function getRemoteComponentProps(\n src: string,\n headers: IncomingHttpHeaders,\n): Promise<RemoteComponentProps> {\n if (typeof document !== 'undefined') {\n throw new Error(\n 'getRemoteComponentProps can only be used on the server side.',\n );\n }\n\n const {\n metadata: { bundle, route, runtime },\n name,\n html,\n nextData,\n } = await fetchRemoteComponent(\n src,\n headers instanceof Headers\n ? headers\n : // convert IncomingHttpHeaders to web standard Headers\n Object.entries(headers).reduce((acc, [key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n value.forEach((v) => acc.append(key, v));\n } else {\n acc.append(key, value);\n }\n }\n return acc;\n }, new Headers()),\n );\n\n const props = {\n src,\n bundle,\n name,\n route,\n runtime,\n };\n\n // do not render the HTML in development mode when remote is using Next.js Pages Router\n // this behavior is emulating the Next.js Pages Router FOUC as the styles are only applied on the client when running in development mode\n if (nextData?.buildId === 'development') {\n return props;\n }\n\n const key = getKey(props);\n // store the HTML in a global store\n setComponent(key, html);\n\n return {\n ...props,\n // add remote component key to the props\n [REMOTE_COMPONENT_KEY]: key,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFM;AAnFN,mBAA0B;AAC1B,kBAAuB;AACvB,oCAAqC;AAgBrC,MAAM,yBAAyB,OAAO,wBAAwB;AAC9D,MAAM,uBAAuB;AAI7B,MAAM,OAAO;AAIb,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACF,GAIW;AACT,SAAO,GAAG,UAAU,YAAY,SAAS,OAAO,QAAQ,gCAAgC,OAAO,WAAW;AAC5G;AAEA,SAAS,aAAa,KAAa,MAAoB;AACrD,MAAI,CAAC,KAAK,sBAAsB,GAAG;AACjC,SAAK,sBAAsB,IAAI,oBAAI,IAAI;AAAA,EACzC;AACA,OAAK,sBAAsB,EAAE,IAAI,KAAK,IAAI;AAC5C;AAEA,SAAS,aAAa,KAAiC;AACrD,QAAM,YAAY,KAAK,sBAAsB,GAAG,IAAI,GAAG;AAGvD,OAAK,sBAAsB,GAAG,OAAO,GAAG;AACxC,SAAO;AACT;AAWO,SAAS,gBAAgB,OAA0C;AACxE,QAAM,kBACJ,OAAO,aAAa,cAChB;AAAA;AAAA,IAEA;AAAA,MACE,MAAM,oBAAoB,KAAK;AAAA,IACjC;AAAA;AAEN,8BAAU,MAAM;AACd,UAAM,aAAa;AAInB,eAAW,8BAA8B;AACzC,WAAO,wBAAwB;AAAA,EACjC,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,MAAM,oBAAoB,GAAG;AAChC,WACE,4CAAC,sBAAiB,KAAK,MAAM,KAAM,gBAAM,UAAS;AAAA,EAEtD;AAEA,SACE,4CAAC,sBAAiB,KAAK,MAAM,KAC3B;AAAA,IAAC;AAAA;AAAA,MACC,yBAAyB,EAAE,QAAQ,mBAAmB,GAAG;AAAA,MACzD,IAAG;AAAA,MACH,0BAAwB;AAAA;AAAA,EAC1B,GACF;AAEJ;AAEA,eAAsB,wBACpB,KACA,SAC+B;AAC/B,MAAI,OAAO,aAAa,aAAa;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM;AAAA,IACJ,UAAU,EAAE,QAAQ,OAAO,QAAQ;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,UAAM;AAAA,IACR;AAAA,IACA,mBAAmB,UACf;AAAA;AAAA,MAEA,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,CAACA,MAAK,KAAK,MAAM;AACpD,YAAI,OAAO;AACT,cAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,kBAAM,QAAQ,CAAC,MAAM,IAAI,OAAOA,MAAK,CAAC,CAAC;AAAA,UACzC,OAAO;AACL,gBAAI,OAAOA,MAAK,KAAK;AAAA,UACvB;AAAA,QACF;AACA,eAAO;AAAA,MACT,GAAG,IAAI,QAAQ,CAAC;AAAA;AAAA,EACtB;AAEA,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAIA,MAAI,UAAU,YAAY,eAAe;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,OAAO,KAAK;AAExB,eAAa,KAAK,IAAI;AAEtB,SAAO;AAAA,IACL,GAAG;AAAA;AAAA,IAEH,CAAC,oBAAoB,GAAG;AAAA,EAC1B;AACF;","names":["key"]}
@@ -0,0 +1,25 @@
1
+ import { IncomingHttpHeaders } from 'node:http';
2
+
3
+ declare module 'react/jsx-runtime' {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ 'remote-component': {
7
+ src?: string;
8
+ children: React.ReactNode;
9
+ };
10
+ }
11
+ }
12
+ }
13
+ declare const REMOTE_COMPONENT_KEY = "__REMOTE_COMPONENT_KEY__";
14
+ interface RemoteComponentProps {
15
+ src: string;
16
+ bundle?: string;
17
+ route?: string;
18
+ name?: string;
19
+ [REMOTE_COMPONENT_KEY]?: string;
20
+ children?: React.ReactNode;
21
+ }
22
+ declare function RemoteComponent(props: RemoteComponentProps): JSX.Element;
23
+ declare function getRemoteComponentProps(src: string, headers: IncomingHttpHeaders): Promise<RemoteComponentProps>;
24
+
25
+ export { RemoteComponent, RemoteComponentProps, getRemoteComponentProps };
@@ -0,0 +1,99 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { shared } from "@remote-component/shared/host";
4
+ import { fetchRemoteComponent } from "../../shared/ssr/fetch-remote-component";
5
+ const REMOTE_COMPONENT_STORE = Symbol("REMOTE_COMPONENT_STORE");
6
+ const REMOTE_COMPONENT_KEY = "__REMOTE_COMPONENT_KEY__";
7
+ const self = globalThis;
8
+ function getKey({
9
+ bundle,
10
+ route,
11
+ name
12
+ }) {
13
+ return `${bundle ?? "__next"}:${route ?? "/"}:${name ?? "__vercel_remote_component"}__${crypto.randomUUID()}`;
14
+ }
15
+ function setComponent(key, html) {
16
+ if (!self[REMOTE_COMPONENT_STORE]) {
17
+ self[REMOTE_COMPONENT_STORE] = /* @__PURE__ */ new Map();
18
+ }
19
+ self[REMOTE_COMPONENT_STORE].set(key, html);
20
+ }
21
+ function getComponent(key) {
22
+ const component = self[REMOTE_COMPONENT_STORE]?.get(key);
23
+ self[REMOTE_COMPONENT_STORE]?.delete(key);
24
+ return component;
25
+ }
26
+ function RemoteComponent(props) {
27
+ const remoteComponent = typeof document !== "undefined" ? null : (
28
+ // retrieve the HTML from the global store
29
+ getComponent(
30
+ props[REMOTE_COMPONENT_KEY] ?? "__vercel_remote_component"
31
+ )
32
+ );
33
+ useEffect(() => {
34
+ const clientSelf = globalThis;
35
+ clientSelf.__remote_component_shared__ = shared;
36
+ import("remote-components/html");
37
+ }, []);
38
+ if (!props[REMOTE_COMPONENT_KEY]) {
39
+ return /* @__PURE__ */ jsx("remote-component", { src: props.src, children: props.children });
40
+ }
41
+ return /* @__PURE__ */ jsx("remote-component", { src: props.src, children: /* @__PURE__ */ jsx(
42
+ "div",
43
+ {
44
+ dangerouslySetInnerHTML: { __html: remoteComponent ?? "" },
45
+ id: "__REMOTE_COMPONENT__",
46
+ suppressHydrationWarning: true
47
+ }
48
+ ) });
49
+ }
50
+ async function getRemoteComponentProps(src, headers) {
51
+ if (typeof document !== "undefined") {
52
+ throw new Error(
53
+ "getRemoteComponentProps can only be used on the server side."
54
+ );
55
+ }
56
+ const {
57
+ metadata: { bundle, route, runtime },
58
+ name,
59
+ html,
60
+ nextData
61
+ } = await fetchRemoteComponent(
62
+ src,
63
+ headers instanceof Headers ? headers : (
64
+ // convert IncomingHttpHeaders to web standard Headers
65
+ Object.entries(headers).reduce((acc, [key2, value]) => {
66
+ if (value) {
67
+ if (Array.isArray(value)) {
68
+ value.forEach((v) => acc.append(key2, v));
69
+ } else {
70
+ acc.append(key2, value);
71
+ }
72
+ }
73
+ return acc;
74
+ }, new Headers())
75
+ )
76
+ );
77
+ const props = {
78
+ src,
79
+ bundle,
80
+ name,
81
+ route,
82
+ runtime
83
+ };
84
+ if (nextData?.buildId === "development") {
85
+ return props;
86
+ }
87
+ const key = getKey(props);
88
+ setComponent(key, html);
89
+ return {
90
+ ...props,
91
+ // add remote component key to the props
92
+ [REMOTE_COMPONENT_KEY]: key
93
+ };
94
+ }
95
+ export {
96
+ RemoteComponent,
97
+ getRemoteComponentProps
98
+ };
99
+ //# sourceMappingURL=pages-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/host/pages-server.tsx"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\nimport { useEffect } from 'react';\nimport { shared } from '@remote-component/shared/host';\nimport { fetchRemoteComponent } from '../../shared/ssr/fetch-remote-component';\n\n// patch react/jsx-runtime to support the remote-component custom element\ndeclare module 'react/jsx-runtime' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace JSX {\n interface IntrinsicElements {\n 'remote-component': {\n src?: string;\n children: React.ReactNode;\n };\n }\n }\n}\n\n// internal symbols to access global store\nconst REMOTE_COMPONENT_STORE = Symbol('REMOTE_COMPONENT_STORE');\nconst REMOTE_COMPONENT_KEY = '__REMOTE_COMPONENT_KEY__';\n\n// temporary global store for remote component HTML\n// the store is used to save the HTML of remote components for SSR without sending the content to the client\nconst self = globalThis as typeof globalThis & {\n [REMOTE_COMPONENT_STORE]?: Map<string, string>;\n};\n\nfunction getKey({\n bundle,\n route,\n name,\n}: {\n bundle?: string;\n route?: string;\n name?: string;\n}): string {\n return `${bundle ?? '__next'}:${route ?? '/'}:${name ?? '__vercel_remote_component'}__${crypto.randomUUID()}`;\n}\n\nfunction setComponent(key: string, html: string): void {\n if (!self[REMOTE_COMPONENT_STORE]) {\n self[REMOTE_COMPONENT_STORE] = new Map();\n }\n self[REMOTE_COMPONENT_STORE].set(key, html);\n}\n\nfunction getComponent(key: string): string | undefined {\n const component = self[REMOTE_COMPONENT_STORE]?.get(key);\n // remove the component from the store after retrieving it to prevent memory leaks\n // storing the HTML in the global store is only needed for SSR and it's temporary only used for a single render\n self[REMOTE_COMPONENT_STORE]?.delete(key);\n return component;\n}\n\nexport interface RemoteComponentProps {\n src: string;\n bundle?: string;\n route?: string;\n name?: string;\n [REMOTE_COMPONENT_KEY]?: string;\n children?: React.ReactNode;\n}\n\nexport function RemoteComponent(props: RemoteComponentProps): JSX.Element {\n const remoteComponent =\n typeof document !== 'undefined'\n ? null\n : // retrieve the HTML from the global store\n getComponent(\n props[REMOTE_COMPONENT_KEY] ?? '__vercel_remote_component',\n );\n\n useEffect(() => {\n const clientSelf = globalThis as typeof globalThis & {\n __remote_component_shared__?: Record<string, () => Promise<unknown>>;\n };\n // eslint-disable-next-line camelcase\n clientSelf.__remote_component_shared__ = shared;\n import('remote-components/html');\n }, []);\n\n if (!props[REMOTE_COMPONENT_KEY]) {\n return (\n <remote-component src={props.src}>{props.children}</remote-component>\n );\n }\n\n return (\n <remote-component src={props.src}>\n <div\n dangerouslySetInnerHTML={{ __html: remoteComponent ?? '' }}\n id=\"__REMOTE_COMPONENT__\"\n suppressHydrationWarning\n />\n </remote-component>\n );\n}\n\nexport async function getRemoteComponentProps(\n src: string,\n headers: IncomingHttpHeaders,\n): Promise<RemoteComponentProps> {\n if (typeof document !== 'undefined') {\n throw new Error(\n 'getRemoteComponentProps can only be used on the server side.',\n );\n }\n\n const {\n metadata: { bundle, route, runtime },\n name,\n html,\n nextData,\n } = await fetchRemoteComponent(\n src,\n headers instanceof Headers\n ? headers\n : // convert IncomingHttpHeaders to web standard Headers\n Object.entries(headers).reduce((acc, [key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n value.forEach((v) => acc.append(key, v));\n } else {\n acc.append(key, value);\n }\n }\n return acc;\n }, new Headers()),\n );\n\n const props = {\n src,\n bundle,\n name,\n route,\n runtime,\n };\n\n // do not render the HTML in development mode when remote is using Next.js Pages Router\n // this behavior is emulating the Next.js Pages Router FOUC as the styles are only applied on the client when running in development mode\n if (nextData?.buildId === 'development') {\n return props;\n }\n\n const key = getKey(props);\n // store the HTML in a global store\n setComponent(key, html);\n\n return {\n ...props,\n // add remote component key to the props\n [REMOTE_COMPONENT_KEY]: key,\n };\n}\n"],"mappings":"AAoFM;AAnFN,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,4BAA4B;AAgBrC,MAAM,yBAAyB,OAAO,wBAAwB;AAC9D,MAAM,uBAAuB;AAI7B,MAAM,OAAO;AAIb,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACF,GAIW;AACT,SAAO,GAAG,UAAU,YAAY,SAAS,OAAO,QAAQ,gCAAgC,OAAO,WAAW;AAC5G;AAEA,SAAS,aAAa,KAAa,MAAoB;AACrD,MAAI,CAAC,KAAK,sBAAsB,GAAG;AACjC,SAAK,sBAAsB,IAAI,oBAAI,IAAI;AAAA,EACzC;AACA,OAAK,sBAAsB,EAAE,IAAI,KAAK,IAAI;AAC5C;AAEA,SAAS,aAAa,KAAiC;AACrD,QAAM,YAAY,KAAK,sBAAsB,GAAG,IAAI,GAAG;AAGvD,OAAK,sBAAsB,GAAG,OAAO,GAAG;AACxC,SAAO;AACT;AAWO,SAAS,gBAAgB,OAA0C;AACxE,QAAM,kBACJ,OAAO,aAAa,cAChB;AAAA;AAAA,IAEA;AAAA,MACE,MAAM,oBAAoB,KAAK;AAAA,IACjC;AAAA;AAEN,YAAU,MAAM;AACd,UAAM,aAAa;AAInB,eAAW,8BAA8B;AACzC,WAAO,wBAAwB;AAAA,EACjC,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC,MAAM,oBAAoB,GAAG;AAChC,WACE,oBAAC,sBAAiB,KAAK,MAAM,KAAM,gBAAM,UAAS;AAAA,EAEtD;AAEA,SACE,oBAAC,sBAAiB,KAAK,MAAM,KAC3B;AAAA,IAAC;AAAA;AAAA,MACC,yBAAyB,EAAE,QAAQ,mBAAmB,GAAG;AAAA,MACzD,IAAG;AAAA,MACH,0BAAwB;AAAA;AAAA,EAC1B,GACF;AAEJ;AAEA,eAAsB,wBACpB,KACA,SAC+B;AAC/B,MAAI,OAAO,aAAa,aAAa;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM;AAAA,IACJ,UAAU,EAAE,QAAQ,OAAO,QAAQ;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,MAAM;AAAA,IACR;AAAA,IACA,mBAAmB,UACf;AAAA;AAAA,MAEA,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,CAACA,MAAK,KAAK,MAAM;AACpD,YAAI,OAAO;AACT,cAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,kBAAM,QAAQ,CAAC,MAAM,IAAI,OAAOA,MAAK,CAAC,CAAC;AAAA,UACzC,OAAO;AACL,gBAAI,OAAOA,MAAK,KAAK;AAAA,UACvB;AAAA,QACF;AACA,eAAO;AAAA,MACT,GAAG,IAAI,QAAQ,CAAC;AAAA;AAAA,EACtB;AAEA,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAIA,MAAI,UAAU,YAAY,eAAe;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,OAAO,KAAK;AAExB,eAAa,KAAK,IAAI;AAEtB,SAAO;AAAA,IACL,GAAG;AAAA;AAAA,IAEH,CAAC,oBAAoB,GAAG;AAAA,EAC1B;AACF;","names":["key"]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pages_exports = {};
20
+ __export(pages_exports, {
21
+ getRemoteComponentMetadata: () => getRemoteComponentMetadata
22
+ });
23
+ module.exports = __toCommonJS(pages_exports);
24
+ const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;
25
+ function getRemoteComponentMetadata() {
26
+ return {
27
+ __REMOTE_COMPONENT__: {
28
+ bundle: CURRENT_ZONE,
29
+ runtime: process.env.TURBOPACK ? "turbopack" : "webpack"
30
+ }
31
+ };
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ getRemoteComponentMetadata
36
+ });
37
+ //# sourceMappingURL=pages.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/remote/pages.ts"],"sourcesContent":["const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\n// get the metadata for the remote application\nexport function getRemoteComponentMetadata() {\n return {\n __REMOTE_COMPONENT__: {\n bundle: CURRENT_ZONE,\n runtime: process.env.TURBOPACK ? 'turbopack' : 'webpack',\n },\n };\n}\n\nexport type RemoteComponentMetadata = ReturnType<\n typeof getRemoteComponentMetadata\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,eAAe,QAAQ,IAAI;AAG1B,SAAS,6BAA6B;AAC3C,SAAO;AAAA,IACL,sBAAsB;AAAA,MACpB,QAAQ;AAAA,MACR,SAAS,QAAQ,IAAI,YAAY,cAAc;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,9 @@
1
+ declare function getRemoteComponentMetadata(): {
2
+ __REMOTE_COMPONENT__: {
3
+ bundle: string | undefined;
4
+ runtime: string;
5
+ };
6
+ };
7
+ type RemoteComponentMetadata = ReturnType<typeof getRemoteComponentMetadata>;
8
+
9
+ export { RemoteComponentMetadata, getRemoteComponentMetadata };
@@ -0,0 +1,13 @@
1
+ const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;
2
+ function getRemoteComponentMetadata() {
3
+ return {
4
+ __REMOTE_COMPONENT__: {
5
+ bundle: CURRENT_ZONE,
6
+ runtime: process.env.TURBOPACK ? "turbopack" : "webpack"
7
+ }
8
+ };
9
+ }
10
+ export {
11
+ getRemoteComponentMetadata
12
+ };
13
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/remote/pages.ts"],"sourcesContent":["const CURRENT_ZONE = process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION;\n\n// get the metadata for the remote application\nexport function getRemoteComponentMetadata() {\n return {\n __REMOTE_COMPONENT__: {\n bundle: CURRENT_ZONE,\n runtime: process.env.TURBOPACK ? 'turbopack' : 'webpack',\n },\n };\n}\n\nexport type RemoteComponentMetadata = ReturnType<\n typeof getRemoteComponentMetadata\n>;\n"],"mappings":"AAAA,MAAM,eAAe,QAAQ,IAAI;AAG1B,SAAS,6BAA6B;AAC3C,SAAO;AAAA,IACL,sBAAsB;AAAA,MACpB,QAAQ;AAAA,MACR,SAAS,QAAQ,IAAI,YAAY,cAAc;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var render_client_turbopack_exports = {};
21
+ __export(render_client_turbopack_exports, {
22
+ RemoteComponentSSR: () => RemoteComponentSSR
23
+ });
24
+ module.exports = __toCommonJS(render_client_turbopack_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_client = require("react-server-dom-turbopack/client.edge");
27
+ var import_client2 = require("react-server-dom-turbopack/client.browser");
28
+ var import_render_client = require("./render-client");
29
+ function RemoteComponentSSR({
30
+ name,
31
+ data,
32
+ moduleLoading,
33
+ moduleMap
34
+ }) {
35
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
36
+ import_render_client.RemoteComponentSSR,
37
+ {
38
+ createFromReadableStream: import_client2.createFromReadableStream,
39
+ data,
40
+ moduleLoading,
41
+ moduleMap,
42
+ name,
43
+ ssrCreateFromReadableStream: import_client.createFromReadableStream
44
+ }
45
+ );
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ RemoteComponentSSR
50
+ });
51
+ //# sourceMappingURL=render-client-turbopack.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/next/remote/render-client-turbopack.tsx"],"sourcesContent":["'use client';\n\n// these components are in a client component file to use these in the SSR and client layers\n\nimport { createFromReadableStream as ssrCreateFromReadableStream } from 'react-server-dom-turbopack/client.edge';\nimport { createFromReadableStream } from 'react-server-dom-turbopack/client.browser';\nimport { RemoteComponentSSR as GenericRemoteComponentSSR } from './render-client';\nimport type { ModuleLoading } from './types';\n\n// server-side component to render the remote component into HTML (SSR layer)\nexport function RemoteComponentSSR({\n name,\n data,\n moduleLoading,\n moduleMap,\n}: {\n name: string;\n data: string[];\n moduleLoading: ModuleLoading;\n moduleMap: Record<string, unknown>;\n}) {\n // use the client-side component to load the RSC payload into a React component in the browser\n // <RemoteComponentClient> will only have a reference to the component as children on the server-side\n return (\n <GenericRemoteComponentSSR\n createFromReadableStream={createFromReadableStream}\n data={data}\n moduleLoading={moduleLoading}\n moduleMap={moduleMap}\n name={name}\n ssrCreateFromReadableStream={ssrCreateFromReadableStream}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBI;AApBJ,oBAAwE;AACxE,IAAAA,iBAAyC;AACzC,2BAAgE;AAIzD,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AAGD,SACE;AAAA,IAAC,qBAAAC;AAAA,IAAA;AAAA,MACC,0BAA0B;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,6BAA6B,cAAAC;AAAA;AAAA,EAC/B;AAEJ;","names":["import_client","GenericRemoteComponentSSR","ssrCreateFromReadableStream"]}
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { M as ModuleLoading } from '../../types-a1bd5b56.js';
3
+
4
+ declare function RemoteComponentSSR({ name, data, moduleLoading, moduleMap, }: {
5
+ name: string;
6
+ data: string[];
7
+ moduleLoading: ModuleLoading;
8
+ moduleMap: Record<string, unknown>;
9
+ }): react_jsx_runtime.JSX.Element;
10
+
11
+ export { RemoteComponentSSR };