remote-components 0.3.5 → 0.3.7

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 (142) hide show
  1. package/dist/app-63L5THIQ.js +12 -0
  2. package/dist/app-63L5THIQ.js.map +1 -0
  3. package/dist/app-A5QE7XRH.cjs +12 -0
  4. package/dist/app-A5QE7XRH.cjs.map +1 -0
  5. package/dist/chunk-52BJ7VFA.js +202 -0
  6. package/dist/chunk-52BJ7VFA.js.map +1 -0
  7. package/dist/chunk-AWWWK2ZY.cjs +670 -0
  8. package/dist/chunk-AWWWK2ZY.cjs.map +1 -0
  9. package/dist/chunk-CTUJSWCM.js +215 -0
  10. package/dist/chunk-CTUJSWCM.js.map +1 -0
  11. package/dist/chunk-D5GNZB6O.js +61 -0
  12. package/dist/chunk-D5GNZB6O.js.map +1 -0
  13. package/dist/chunk-ENYGL5CO.js +11 -0
  14. package/dist/chunk-ENYGL5CO.js.map +1 -0
  15. package/dist/chunk-GAXJTFBV.js +20 -0
  16. package/dist/chunk-GAXJTFBV.js.map +1 -0
  17. package/dist/chunk-GBFUPMMI.js +670 -0
  18. package/dist/chunk-GBFUPMMI.js.map +1 -0
  19. package/dist/chunk-I47KE3EC.cjs +703 -0
  20. package/dist/chunk-I47KE3EC.cjs.map +1 -0
  21. package/dist/chunk-KE7QPAQ4.cjs +21 -0
  22. package/dist/chunk-KE7QPAQ4.cjs.map +1 -0
  23. package/dist/chunk-LCXO7BUY.cjs +57 -0
  24. package/dist/chunk-LCXO7BUY.cjs.map +1 -0
  25. package/dist/chunk-LQ7VQ74E.js +155 -0
  26. package/dist/chunk-LQ7VQ74E.js.map +1 -0
  27. package/dist/chunk-N5VQR2PW.cjs +215 -0
  28. package/dist/chunk-N5VQR2PW.cjs.map +1 -0
  29. package/dist/chunk-NZAB7REE.js +703 -0
  30. package/dist/chunk-NZAB7REE.js.map +1 -0
  31. package/dist/chunk-QKB74MLO.js +709 -0
  32. package/dist/chunk-QKB74MLO.js.map +1 -0
  33. package/dist/chunk-RJW3EZJP.cjs +709 -0
  34. package/dist/chunk-RJW3EZJP.cjs.map +1 -0
  35. package/dist/chunk-RUWR74XQ.cjs +152 -0
  36. package/dist/chunk-RUWR74XQ.cjs.map +1 -0
  37. package/dist/chunk-S2A4TFLS.js +152 -0
  38. package/dist/chunk-S2A4TFLS.js.map +1 -0
  39. package/dist/chunk-SHFJ5OQA.cjs +11 -0
  40. package/dist/chunk-SHFJ5OQA.cjs.map +1 -0
  41. package/dist/chunk-SJM7AAGU.js +358 -0
  42. package/dist/chunk-SJM7AAGU.js.map +1 -0
  43. package/dist/chunk-SZFCBE54.js +57 -0
  44. package/dist/chunk-SZFCBE54.js.map +1 -0
  45. package/dist/chunk-T64P7BAG.cjs +202 -0
  46. package/dist/chunk-T64P7BAG.cjs.map +1 -0
  47. package/dist/chunk-TCFLEBQM.cjs +20 -0
  48. package/dist/chunk-TCFLEBQM.cjs.map +1 -0
  49. package/dist/chunk-TZT7DLO5.cjs +155 -0
  50. package/dist/chunk-TZT7DLO5.cjs.map +1 -0
  51. package/dist/chunk-X6W464D6.cjs +358 -0
  52. package/dist/chunk-X6W464D6.cjs.map +1 -0
  53. package/dist/chunk-X6YKUJKH.js +21 -0
  54. package/dist/chunk-X6YKUJKH.js.map +1 -0
  55. package/dist/chunk-Z2SLBFQL.cjs +61 -0
  56. package/dist/chunk-Z2SLBFQL.cjs.map +1 -0
  57. package/dist/config/nextjs.cjs +74 -355
  58. package/dist/config/nextjs.cjs.map +1 -1
  59. package/dist/config/nextjs.js +25 -271
  60. package/dist/config/nextjs.js.map +1 -1
  61. package/dist/config/webpack.cjs +12 -240
  62. package/dist/config/webpack.cjs.map +1 -1
  63. package/dist/config/webpack.js +6 -207
  64. package/dist/config/webpack.js.map +1 -1
  65. package/dist/host/html.cjs +128 -2494
  66. package/dist/host/html.cjs.map +1 -1
  67. package/dist/host/html.js +45 -2382
  68. package/dist/host/html.js.map +1 -1
  69. package/dist/host/nextjs/app/client-only.cjs +53 -2939
  70. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  71. package/dist/host/nextjs/app/client-only.js +31 -2894
  72. package/dist/host/nextjs/app/client-only.js.map +1 -1
  73. package/dist/host/proxy/client.cjs +8 -38
  74. package/dist/host/proxy/client.cjs.map +1 -1
  75. package/dist/host/proxy/client.js +4 -7
  76. package/dist/host/proxy/client.js.map +1 -1
  77. package/dist/host/proxy.cjs +19 -56
  78. package/dist/host/proxy.cjs.map +1 -1
  79. package/dist/host/proxy.js +8 -20
  80. package/dist/host/proxy.js.map +1 -1
  81. package/dist/host/react.cjs +17 -2870
  82. package/dist/host/react.cjs.map +1 -1
  83. package/dist/host/react.js +13 -2837
  84. package/dist/host/react.js.map +1 -1
  85. package/dist/internal/config/webpack/next-client-pages-loader.cjs +27 -15
  86. package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -1
  87. package/dist/internal/config/webpack/next-client-pages-loader.d.ts +3 -5
  88. package/dist/internal/config/webpack/next-client-pages-loader.js +27 -15
  89. package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -1
  90. package/dist/internal/host/nextjs/app-client.d.ts +1 -1
  91. package/dist/internal/host/react/context.d.ts +2 -2
  92. package/dist/internal/host/server/fetch-remote-component.cjs +1 -18
  93. package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -1
  94. package/dist/internal/host/server/fetch-remote-component.js +1 -18
  95. package/dist/internal/host/server/fetch-remote-component.js.map +1 -1
  96. package/dist/internal/host/shared/pipeline.d.ts +2 -2
  97. package/dist/internal/runtime/loaders/component-loader.cjs +5 -2
  98. package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
  99. package/dist/internal/runtime/loaders/component-loader.d.ts +2 -2
  100. package/dist/internal/runtime/loaders/component-loader.js +5 -2
  101. package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
  102. package/dist/internal/runtime/loaders/static-loader.d.ts +2 -1
  103. package/dist/internal/runtime/namespace.cjs +1 -0
  104. package/dist/internal/runtime/namespace.cjs.map +1 -1
  105. package/dist/internal/runtime/namespace.d.ts +2 -1
  106. package/dist/internal/runtime/namespace.js +1 -0
  107. package/dist/internal/runtime/namespace.js.map +1 -1
  108. package/dist/internal/runtime/turbopack/remote-scope.cjs +1 -5
  109. package/dist/internal/runtime/turbopack/remote-scope.cjs.map +1 -1
  110. package/dist/internal/runtime/turbopack/remote-scope.js +1 -5
  111. package/dist/internal/runtime/turbopack/remote-scope.js.map +1 -1
  112. package/dist/internal/runtime/types.d.ts +2 -1
  113. package/dist/internal/utils.cjs +1 -1
  114. package/dist/internal/utils.cjs.map +1 -1
  115. package/dist/internal/utils.d.ts +5 -5
  116. package/dist/internal/utils.js +1 -1
  117. package/dist/internal/utils.js.map +1 -1
  118. package/dist/remote/html.cjs +15 -314
  119. package/dist/remote/html.cjs.map +1 -1
  120. package/dist/remote/html.js +7 -305
  121. package/dist/remote/html.js.map +1 -1
  122. package/dist/remote/middleware.cjs +16 -41
  123. package/dist/remote/middleware.cjs.map +1 -1
  124. package/dist/script-D5AD7HLV.cjs +26 -0
  125. package/dist/script-D5AD7HLV.cjs.map +1 -0
  126. package/dist/script-VPOI7ARP.js +26 -0
  127. package/dist/script-VPOI7ARP.js.map +1 -0
  128. package/dist/{server-handoff-ce13bebc.d.ts → server-handoff-8c89b856.d.ts} +2 -2
  129. package/dist/static-loader-OHSAUD62.js +11 -0
  130. package/dist/static-loader-OHSAUD62.js.map +1 -0
  131. package/dist/static-loader-UDIXK5MV.cjs +11 -0
  132. package/dist/static-loader-UDIXK5MV.cjs.map +1 -0
  133. package/dist/turbopack-5LW6V6IT.js +55 -0
  134. package/dist/turbopack-5LW6V6IT.js.map +1 -0
  135. package/dist/turbopack-KRKECGY2.cjs +55 -0
  136. package/dist/turbopack-KRKECGY2.cjs.map +1 -0
  137. package/dist/{types-59251814.d.ts → types-8b0edd78.d.ts} +7 -0
  138. package/dist/webpack-NPZNXRNL.js +92 -0
  139. package/dist/webpack-NPZNXRNL.js.map +1 -0
  140. package/dist/webpack-TTZDARNY.cjs +92 -0
  141. package/dist/webpack-TTZDARNY.cjs.map +1 -0
  142. package/package.json +9 -2
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkTZT7DLO5cjs = require('./chunk-TZT7DLO5.cjs');
4
+ require('./chunk-Z2SLBFQL.cjs');
5
+ require('./chunk-RUWR74XQ.cjs');
6
+ require('./chunk-KE7QPAQ4.cjs');
7
+ require('./chunk-SHFJ5OQA.cjs');
8
+
9
+
10
+ exports.loadStaticRemoteComponent = _chunkTZT7DLO5cjs.loadStaticRemoteComponent;
11
+ //# sourceMappingURL=static-loader-UDIXK5MV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import {
2
+ initializeSharedModules,
3
+ setupRemoteScope
4
+ } from "./chunk-QKB74MLO.js";
5
+ import {
6
+ applySharedModules,
7
+ nextClientPagesLoader
8
+ } from "./chunk-52BJ7VFA.js";
9
+ import {
10
+ buildCoreShared,
11
+ buildHostShared
12
+ } from "./chunk-SJM7AAGU.js";
13
+ import "./chunk-D5GNZB6O.js";
14
+ import "./chunk-S2A4TFLS.js";
15
+ import "./chunk-X6YKUJKH.js";
16
+ import "./chunk-ENYGL5CO.js";
17
+
18
+ // src/host/html/runtime/turbopack.ts
19
+ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClientUrl) {
20
+ const self = globalThis;
21
+ const hostShared = buildHostShared(shared, resolveClientUrl, {
22
+ includeRemoteComponentShared: true
23
+ });
24
+ await setupRemoteScope("turbopack", [], url, bundle, resolveClientUrl);
25
+ const {
26
+ default: { createFromReadableStream }
27
+ } = await import("react-server-dom-webpack/client.browser");
28
+ async function preloadScripts(scripts, __) {
29
+ const scope = await setupRemoteScope(
30
+ "turbopack",
31
+ scripts.map((script) => ({
32
+ src: script.getAttribute("src") || script.getAttribute("data-src") || script.src
33
+ })),
34
+ url,
35
+ bundle,
36
+ resolveClientUrl
37
+ );
38
+ await initializeSharedModules(
39
+ scope,
40
+ buildCoreShared(hostShared),
41
+ remoteShared ?? {}
42
+ );
43
+ }
44
+ return {
45
+ self,
46
+ createFromReadableStream,
47
+ applySharedModules,
48
+ nextClientPagesLoader,
49
+ preloadScripts
50
+ };
51
+ }
52
+ export {
53
+ turbopackRuntime
54
+ };
55
+ //# sourceMappingURL=turbopack-5LW6V6IT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/html/runtime/turbopack.ts"],"sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildCoreShared,\n buildHostShared,\n} from '#internal/host/shared/shared-module-resolver';\nimport { setupRemoteScope } from '#internal/runtime/turbopack/remote-scope-setup';\nimport { initializeSharedModules } from '#internal/runtime/turbopack/shared-modules';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\n\n// initializer for the turbopack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function turbopackRuntime(\n url: URL,\n bundle?: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__: boolean;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n const hostShared = buildHostShared(shared, resolveClientUrl, {\n includeRemoteComponentShared: true,\n });\n\n // Phase 1: Set up globals (__webpack_require__, __webpack_chunk_load__).\n // Called with empty scripts because we need the globals to exist before\n // importing react-server-dom-webpack. Shared module initialization is\n // deferred to preloadScripts where turbopack chunks are actually loaded.\n await setupRemoteScope('turbopack', [], url, bundle, resolveClientUrl);\n\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(scripts: HTMLScriptElement[], __: URL) {\n // Phase 2: Load turbopack chunks (scope is reused from phase 1).\n const scope = await setupRemoteScope(\n 'turbopack',\n scripts.map((script) => ({\n src:\n script.getAttribute('src') ||\n script.getAttribute('data-src') ||\n script.src,\n })),\n url,\n bundle,\n resolveClientUrl,\n );\n\n // Phase 3: Initialize shared modules now that turbopackModules is\n // populated. This uses the primary bundle-introspection path which\n // maps shared modules by numeric turbopack ID — unlike the fallback\n // path that uses file-path keys which can't match at runtime.\n await initializeSharedModules(\n scope,\n buildCoreShared(hostShared),\n remoteShared ?? {},\n );\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,eAAsB,iBACpB,KACA,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAmBb,QAAM,aAAa,gBAAgB,QAAQ,kBAAkB;AAAA,IAC3D,8BAA8B;AAAA,EAChC,CAAC;AAMD,QAAM,iBAAiB,aAAa,CAAC,GAAG,KAAK,QAAQ,gBAAgB;AAGrE,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eAAe,SAA8B,IAAS;AAEnE,UAAM,QAAQ,MAAM;AAAA,MAClB;AAAA,MACA,QAAQ,IAAI,CAAC,YAAY;AAAA,QACvB,KACE,OAAO,aAAa,KAAK,KACzB,OAAO,aAAa,UAAU,KAC9B,OAAO;AAAA,MACX,EAAE;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAMA,UAAM;AAAA,MACJ;AAAA,MACA,gBAAgB,UAAU;AAAA,MAC1B,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+ var _chunkRJW3EZJPcjs = require('./chunk-RJW3EZJP.cjs');
5
+
6
+
7
+
8
+ var _chunkT64P7BAGcjs = require('./chunk-T64P7BAG.cjs');
9
+
10
+
11
+
12
+ var _chunkX6W464D6cjs = require('./chunk-X6W464D6.cjs');
13
+ require('./chunk-Z2SLBFQL.cjs');
14
+ require('./chunk-RUWR74XQ.cjs');
15
+ require('./chunk-KE7QPAQ4.cjs');
16
+ require('./chunk-SHFJ5OQA.cjs');
17
+
18
+ // src/host/html/runtime/turbopack.ts
19
+ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClientUrl) {
20
+ const self = globalThis;
21
+ const hostShared = _chunkX6W464D6cjs.buildHostShared.call(void 0, shared, resolveClientUrl, {
22
+ includeRemoteComponentShared: true
23
+ });
24
+ await _chunkRJW3EZJPcjs.setupRemoteScope.call(void 0, "turbopack", [], url, bundle, resolveClientUrl);
25
+ const {
26
+ default: { createFromReadableStream }
27
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("react-server-dom-webpack/client.browser")));
28
+ async function preloadScripts(scripts, __) {
29
+ const scope = await _chunkRJW3EZJPcjs.setupRemoteScope.call(void 0,
30
+ "turbopack",
31
+ scripts.map((script) => ({
32
+ src: script.getAttribute("src") || script.getAttribute("data-src") || script.src
33
+ })),
34
+ url,
35
+ bundle,
36
+ resolveClientUrl
37
+ );
38
+ await _chunkRJW3EZJPcjs.initializeSharedModules.call(void 0,
39
+ scope,
40
+ _chunkX6W464D6cjs.buildCoreShared.call(void 0, hostShared),
41
+ _nullishCoalesce(remoteShared, () => ( {}))
42
+ );
43
+ }
44
+ return {
45
+ self,
46
+ createFromReadableStream,
47
+ applySharedModules: _chunkT64P7BAGcjs.applySharedModules,
48
+ nextClientPagesLoader: _chunkT64P7BAGcjs.nextClientPagesLoader,
49
+ preloadScripts
50
+ };
51
+ }
52
+
53
+
54
+ exports.turbopackRuntime = turbopackRuntime;
55
+ //# sourceMappingURL=turbopack-KRKECGY2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/html/runtime/turbopack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAaA,eAAsB,iBACpB,KACA,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAmBb,QAAM,aAAa,gBAAgB,QAAQ,kBAAkB;AAAA,IAC3D,8BAA8B;AAAA,EAChC,CAAC;AAMD,QAAM,iBAAiB,aAAa,CAAC,GAAG,KAAK,QAAQ,gBAAgB;AAGrE,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eAAe,SAA8B,IAAS;AAEnE,UAAM,QAAQ,MAAM;AAAA,MAClB;AAAA,MACA,QAAQ,IAAI,CAAC,YAAY;AAAA,QACvB,KACE,OAAO,aAAa,KAAK,KACzB,OAAO,aAAa,UAAU,KAC9B,OAAO;AAAA,MACX,EAAE;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAMA,UAAM;AAAA,MACJ;AAAA,MACA,gBAAgB,UAAU;AAAA,MAC1B,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildCoreShared,\n buildHostShared,\n} from '#internal/host/shared/shared-module-resolver';\nimport { setupRemoteScope } from '#internal/runtime/turbopack/remote-scope-setup';\nimport { initializeSharedModules } from '#internal/runtime/turbopack/shared-modules';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\n\n// initializer for the turbopack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function turbopackRuntime(\n url: URL,\n bundle?: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__: boolean;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n const hostShared = buildHostShared(shared, resolveClientUrl, {\n includeRemoteComponentShared: true,\n });\n\n // Phase 1: Set up globals (__webpack_require__, __webpack_chunk_load__).\n // Called with empty scripts because we need the globals to exist before\n // importing react-server-dom-webpack. Shared module initialization is\n // deferred to preloadScripts where turbopack chunks are actually loaded.\n await setupRemoteScope('turbopack', [], url, bundle, resolveClientUrl);\n\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(scripts: HTMLScriptElement[], __: URL) {\n // Phase 2: Load turbopack chunks (scope is reused from phase 1).\n const scope = await setupRemoteScope(\n 'turbopack',\n scripts.map((script) => ({\n src:\n script.getAttribute('src') ||\n script.getAttribute('data-src') ||\n script.src,\n })),\n url,\n bundle,\n resolveClientUrl,\n );\n\n // Phase 3: Initialize shared modules now that turbopackModules is\n // populated. This uses the primary bundle-introspection path which\n // maps shared modules by numeric turbopack ID — unlike the fallback\n // path that uses file-path keys which can't match at runtime.\n await initializeSharedModules(\n scope,\n buildCoreShared(hostShared),\n remoteShared ?? {},\n );\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { RemoteComponentMetadata } from './internal/runtime/metadata.js';
2
+ import React__default from 'react';
2
3
  import { RemoteScope } from './internal/runtime/turbopack/remote-scope.js';
3
4
 
4
5
  /**
@@ -30,6 +31,12 @@ interface RemoteComponentsNamespace {
30
31
  hostSharedModules: Record<string, () => Promise<unknown>>;
31
32
  /** @see `__remote_next_css__` */
32
33
  cssCache: Record<string, ChildNode[]>;
34
+ pageComponentCache?: Record<string, {
35
+ Component: React__default.ComponentType<Record<string, unknown>> | null;
36
+ App: React__default.ComponentType<{
37
+ Component: React__default.ComponentType<Record<string, unknown>>;
38
+ } & Record<string, unknown>> | null;
39
+ }>;
33
40
  /** @see `__remote_components_shadowroot_*` */
34
41
  shadowRoots: Record<string, ShadowRoot | null>;
35
42
  }
@@ -0,0 +1,92 @@
1
+ import {
2
+ loadScripts
3
+ } from "./chunk-SZFCBE54.js";
4
+ import {
5
+ applySharedModules,
6
+ nextClientPagesLoader
7
+ } from "./chunk-52BJ7VFA.js";
8
+ import {
9
+ NEXT_BUNDLE_PATH_RE,
10
+ buildHostShared,
11
+ buildWebpackResolve
12
+ } from "./chunk-SJM7AAGU.js";
13
+ import "./chunk-D5GNZB6O.js";
14
+ import {
15
+ RemoteComponentsError
16
+ } from "./chunk-S2A4TFLS.js";
17
+ import "./chunk-X6YKUJKH.js";
18
+ import "./chunk-ENYGL5CO.js";
19
+
20
+ // src/host/html/runtime/webpack.ts
21
+ async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
22
+ const self = globalThis;
23
+ if (!self.__DISABLE_WEBPACK_EXEC__) {
24
+ self.__DISABLE_WEBPACK_EXEC__ = {};
25
+ }
26
+ self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
27
+ if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
28
+ self.__webpack_require__ = (remoteId) => {
29
+ const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
30
+ const match = re.exec(remoteId);
31
+ const remoteBundle = match?.groups?.bundle;
32
+ const id = match?.groups?.id;
33
+ if (!(id && remoteBundle)) {
34
+ throw new RemoteComponentsError(
35
+ `Remote Component module "${remoteId}" not found. Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
36
+ );
37
+ }
38
+ if (typeof self.__remote_webpack_require__?.[remoteBundle] !== "function") {
39
+ throw new RemoteComponentsError(
40
+ `Remote Components are not available in "${remoteBundle}". Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
41
+ );
42
+ }
43
+ return self.__remote_webpack_require__[remoteBundle](id);
44
+ };
45
+ self.__webpack_chunk_load__ = () => {
46
+ return Promise.resolve([]);
47
+ };
48
+ }
49
+ const {
50
+ default: { createFromReadableStream }
51
+ } = await import("react-server-dom-webpack/client.browser");
52
+ async function preloadScripts(scripts, url, remoteBundle, _) {
53
+ const scriptSrcs = scripts.flatMap((script) => {
54
+ const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
55
+ script.parentElement?.removeChild(script);
56
+ if (!scriptSrc)
57
+ return [];
58
+ return [
59
+ {
60
+ src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
61
+ }
62
+ ];
63
+ });
64
+ await loadScripts(scriptSrcs, resolveClientUrl);
65
+ const hostShared = buildHostShared(shared, resolveClientUrl);
66
+ const resolve = await buildWebpackResolve(
67
+ hostShared,
68
+ remoteShared ?? {},
69
+ remoteBundle,
70
+ {
71
+ "/react/index.js": (await import("react")).default,
72
+ "/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
73
+ "/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
74
+ "/react-dom/index.js": (await import("react-dom")).default,
75
+ "/react-dom/client.js": (await import("react-dom/client")).default
76
+ },
77
+ "WebpackRuntime"
78
+ );
79
+ applySharedModules(remoteBundle, resolve);
80
+ }
81
+ return {
82
+ self,
83
+ createFromReadableStream,
84
+ applySharedModules,
85
+ nextClientPagesLoader,
86
+ preloadScripts
87
+ };
88
+ }
89
+ export {
90
+ webpackRuntime
91
+ };
92
+ //# sourceMappingURL=webpack-NPZNXRNL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/html/runtime/webpack.ts"],"sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildHostShared,\n buildWebpackResolve,\n} from '#internal/host/shared/shared-module-resolver';\nimport { loadScripts } from '#internal/runtime/loaders/script-loader';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\nimport { RemoteComponentsError } from '#internal/utils/error';\n\n// initializer for the webpack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function webpackRuntime(\n bundle: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string | number>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__?: Record<string, boolean>;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n __webpack_require_type__: 'webpack' | 'turbopack';\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n // disable webpack exec to prevent automatically executing the entry module\n if (!self.__DISABLE_WEBPACK_EXEC__) {\n self.__DISABLE_WEBPACK_EXEC__ = {};\n }\n self.__DISABLE_WEBPACK_EXEC__[bundle] = true;\n // add a custom webpack require function to load remote components from multiple bundles / zones\n if (\n typeof self.__webpack_require__ !== 'function' &&\n self.__webpack_require_type__ !== 'turbopack'\n ) {\n self.__webpack_require__ = (remoteId: string) => {\n const re = /\\[(?<bundle>[^\\]]+)\\] (?<id>.*)/;\n const match = re.exec(remoteId);\n const remoteBundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && remoteBundle)) {\n throw new RemoteComponentsError(\n `Remote Component module \"${remoteId}\" not found. Did you forget to wrap the Next.js config with \\`withRemoteComponentsConfig\\` on both host and remote?`,\n );\n }\n if (\n typeof self.__remote_webpack_require__?.[remoteBundle] !== 'function'\n ) {\n throw new RemoteComponentsError(\n `Remote Components are not available in \"${remoteBundle}\". Did you forget to wrap the Next.js config with \\`withRemoteComponentsConfig\\` on both host and remote?`,\n );\n }\n return self.__remote_webpack_require__[remoteBundle](id);\n };\n // not used but required by react-server-dom-webpack\n self.__webpack_chunk_load__ = () => {\n return Promise.resolve([]);\n };\n }\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(\n scripts: HTMLScriptElement[],\n url: URL,\n remoteBundle: string,\n _: string,\n ) {\n // Build absolute src URLs for each script and remove originals from the\n // parsed doc to prevent re-execution when the doc is later inserted into\n // the shadow DOM.\n const scriptSrcs = scripts.flatMap((script) => {\n const scriptSrc =\n script.getAttribute('src') || script.getAttribute('data-src');\n script.parentElement?.removeChild(script);\n if (!scriptSrc) return [];\n return [\n {\n src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, '/_next/'), url)\n .href,\n },\n ];\n });\n\n await loadScripts(scriptSrcs, resolveClientUrl);\n\n const hostShared = buildHostShared(shared, resolveClientUrl);\n const resolve = await buildWebpackResolve(\n hostShared,\n remoteShared ?? {},\n remoteBundle,\n {\n '/react/index.js': (await import('react')).default,\n '/react/jsx-dev-runtime.js': (await import('react/jsx-dev-runtime'))\n .default,\n '/react/jsx-runtime.js': (await import('react/jsx-runtime')).default,\n '/react-dom/index.js': (await import('react-dom')).default,\n '/react-dom/client.js': (await import('react-dom/client')).default,\n },\n 'WebpackRuntime',\n );\n\n // apply shared modules to the bundle\n applySharedModules(remoteBundle, resolve);\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,eAAsB,eACpB,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAqBb,MAAI,CAAC,KAAK,0BAA0B;AAClC,SAAK,2BAA2B,CAAC;AAAA,EACnC;AACA,OAAK,yBAAyB,MAAM,IAAI;AAExC,MACE,OAAO,KAAK,wBAAwB,cACpC,KAAK,6BAA6B,aAClC;AACA,SAAK,sBAAsB,CAAC,aAAqB;AAC/C,YAAM,KAAK;AACX,YAAM,QAAQ,GAAG,KAAK,QAAQ;AAC9B,YAAM,eAAe,OAAO,QAAQ;AACpC,YAAM,KAAK,OAAO,QAAQ;AAC1B,UAAI,EAAE,MAAM,eAAe;AACzB,cAAM,IAAI;AAAA,UACR,4BAA4B;AAAA,QAC9B;AAAA,MACF;AACA,UACE,OAAO,KAAK,6BAA6B,YAAY,MAAM,YAC3D;AACA,cAAM,IAAI;AAAA,UACR,2CAA2C;AAAA,QAC7C;AAAA,MACF;AACA,aAAO,KAAK,2BAA2B,YAAY,EAAE,EAAE;AAAA,IACzD;AAEA,SAAK,yBAAyB,MAAM;AAClC,aAAO,QAAQ,QAAQ,CAAC,CAAC;AAAA,IAC3B;AAAA,EACF;AAEA,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eACb,SACA,KACA,cACA,GACA;AAIA,UAAM,aAAa,QAAQ,QAAQ,CAAC,WAAW;AAC7C,YAAM,YACJ,OAAO,aAAa,KAAK,KAAK,OAAO,aAAa,UAAU;AAC9D,aAAO,eAAe,YAAY,MAAM;AACxC,UAAI,CAAC;AAAW,eAAO,CAAC;AACxB,aAAO;AAAA,QACL;AAAA,UACE,KAAK,IAAI,IAAI,UAAU,QAAQ,qBAAqB,SAAS,GAAG,GAAG,EAChE;AAAA,QACL;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,YAAY,YAAY,gBAAgB;AAE9C,UAAM,aAAa,gBAAgB,QAAQ,gBAAgB;AAC3D,UAAM,UAAU,MAAM;AAAA,MACpB;AAAA,MACA,gBAAgB,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,QACE,oBAAoB,MAAM,OAAO,OAAO,GAAG;AAAA,QAC3C,8BAA8B,MAAM,OAAO,uBAAuB,GAC/D;AAAA,QACH,0BAA0B,MAAM,OAAO,mBAAmB,GAAG;AAAA,QAC7D,wBAAwB,MAAM,OAAO,WAAW,GAAG;AAAA,QACnD,yBAAyB,MAAM,OAAO,kBAAkB,GAAG;AAAA,MAC7D;AAAA,MACA;AAAA,IACF;AAGA,uBAAmB,cAAc,OAAO;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkLCXO7BUYcjs = require('./chunk-LCXO7BUY.cjs');
4
+
5
+
6
+
7
+ var _chunkT64P7BAGcjs = require('./chunk-T64P7BAG.cjs');
8
+
9
+
10
+
11
+
12
+ var _chunkX6W464D6cjs = require('./chunk-X6W464D6.cjs');
13
+ require('./chunk-Z2SLBFQL.cjs');
14
+
15
+
16
+ var _chunkRUWR74XQcjs = require('./chunk-RUWR74XQ.cjs');
17
+ require('./chunk-KE7QPAQ4.cjs');
18
+ require('./chunk-SHFJ5OQA.cjs');
19
+
20
+ // src/host/html/runtime/webpack.ts
21
+ async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
22
+ const self = globalThis;
23
+ if (!self.__DISABLE_WEBPACK_EXEC__) {
24
+ self.__DISABLE_WEBPACK_EXEC__ = {};
25
+ }
26
+ self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
27
+ if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
28
+ self.__webpack_require__ = (remoteId) => {
29
+ const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
30
+ const match = re.exec(remoteId);
31
+ const remoteBundle = _optionalChain([match, 'optionalAccess', _2 => _2.groups, 'optionalAccess', _3 => _3.bundle]);
32
+ const id = _optionalChain([match, 'optionalAccess', _4 => _4.groups, 'optionalAccess', _5 => _5.id]);
33
+ if (!(id && remoteBundle)) {
34
+ throw new (0, _chunkRUWR74XQcjs.RemoteComponentsError)(
35
+ `Remote Component module "${remoteId}" not found. Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
36
+ );
37
+ }
38
+ if (typeof _optionalChain([self, 'access', _6 => _6.__remote_webpack_require__, 'optionalAccess', _7 => _7[remoteBundle]]) !== "function") {
39
+ throw new (0, _chunkRUWR74XQcjs.RemoteComponentsError)(
40
+ `Remote Components are not available in "${remoteBundle}". Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
41
+ );
42
+ }
43
+ return self.__remote_webpack_require__[remoteBundle](id);
44
+ };
45
+ self.__webpack_chunk_load__ = () => {
46
+ return Promise.resolve([]);
47
+ };
48
+ }
49
+ const {
50
+ default: { createFromReadableStream }
51
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("react-server-dom-webpack/client.browser")));
52
+ async function preloadScripts(scripts, url, remoteBundle, _) {
53
+ const scriptSrcs = scripts.flatMap((script) => {
54
+ const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
55
+ _optionalChain([script, 'access', _8 => _8.parentElement, 'optionalAccess', _9 => _9.removeChild, 'call', _10 => _10(script)]);
56
+ if (!scriptSrc)
57
+ return [];
58
+ return [
59
+ {
60
+ src: new URL(scriptSrc.replace(_chunkX6W464D6cjs.NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
61
+ }
62
+ ];
63
+ });
64
+ await _chunkLCXO7BUYcjs.loadScripts.call(void 0, scriptSrcs, resolveClientUrl);
65
+ const hostShared = _chunkX6W464D6cjs.buildHostShared.call(void 0, shared, resolveClientUrl);
66
+ const resolve = await _chunkX6W464D6cjs.buildWebpackResolve.call(void 0,
67
+ hostShared,
68
+ _nullishCoalesce(remoteShared, () => ( {})),
69
+ remoteBundle,
70
+ {
71
+ "/react/index.js": (await Promise.resolve().then(() => _interopRequireWildcard(require("react")))).default,
72
+ "/react/jsx-dev-runtime.js": (await Promise.resolve().then(() => _interopRequireWildcard(require("react/jsx-dev-runtime")))).default,
73
+ "/react/jsx-runtime.js": (await Promise.resolve().then(() => _interopRequireWildcard(require("react/jsx-runtime")))).default,
74
+ "/react-dom/index.js": (await Promise.resolve().then(() => _interopRequireWildcard(require("react-dom")))).default,
75
+ "/react-dom/client.js": (await Promise.resolve().then(() => _interopRequireWildcard(require("react-dom/client")))).default
76
+ },
77
+ "WebpackRuntime"
78
+ );
79
+ _chunkT64P7BAGcjs.applySharedModules.call(void 0, remoteBundle, resolve);
80
+ }
81
+ return {
82
+ self,
83
+ createFromReadableStream,
84
+ applySharedModules: _chunkT64P7BAGcjs.applySharedModules,
85
+ nextClientPagesLoader: _chunkT64P7BAGcjs.nextClientPagesLoader,
86
+ preloadScripts
87
+ };
88
+ }
89
+
90
+
91
+ exports.webpackRuntime = webpackRuntime;
92
+ //# sourceMappingURL=webpack-TTZDARNY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/html/runtime/webpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,eAAsB,eACpB,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAqBb,MAAI,CAAC,KAAK,0BAA0B;AAClC,SAAK,2BAA2B,CAAC;AAAA,EACnC;AACA,OAAK,yBAAyB,MAAM,IAAI;AAExC,MACE,OAAO,KAAK,wBAAwB,cACpC,KAAK,6BAA6B,aAClC;AACA,SAAK,sBAAsB,CAAC,aAAqB;AAC/C,YAAM,KAAK;AACX,YAAM,QAAQ,GAAG,KAAK,QAAQ;AAC9B,YAAM,eAAe,OAAO,QAAQ;AACpC,YAAM,KAAK,OAAO,QAAQ;AAC1B,UAAI,EAAE,MAAM,eAAe;AACzB,cAAM,IAAI;AAAA,UACR,4BAA4B;AAAA,QAC9B;AAAA,MACF;AACA,UACE,OAAO,KAAK,6BAA6B,YAAY,MAAM,YAC3D;AACA,cAAM,IAAI;AAAA,UACR,2CAA2C;AAAA,QAC7C;AAAA,MACF;AACA,aAAO,KAAK,2BAA2B,YAAY,EAAE,EAAE;AAAA,IACzD;AAEA,SAAK,yBAAyB,MAAM;AAClC,aAAO,QAAQ,QAAQ,CAAC,CAAC;AAAA,IAC3B;AAAA,EACF;AAEA,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eACb,SACA,KACA,cACA,GACA;AAIA,UAAM,aAAa,QAAQ,QAAQ,CAAC,WAAW;AAC7C,YAAM,YACJ,OAAO,aAAa,KAAK,KAAK,OAAO,aAAa,UAAU;AAC9D,aAAO,eAAe,YAAY,MAAM;AACxC,UAAI,CAAC;AAAW,eAAO,CAAC;AACxB,aAAO;AAAA,QACL;AAAA,UACE,KAAK,IAAI,IAAI,UAAU,QAAQ,qBAAqB,SAAS,GAAG,GAAG,EAChE;AAAA,QACL;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,YAAY,YAAY,gBAAgB;AAE9C,UAAM,aAAa,gBAAgB,QAAQ,gBAAgB;AAC3D,UAAM,UAAU,MAAM;AAAA,MACpB;AAAA,MACA,gBAAgB,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,QACE,oBAAoB,MAAM,OAAO,OAAO,GAAG;AAAA,QAC3C,8BAA8B,MAAM,OAAO,uBAAuB,GAC/D;AAAA,QACH,0BAA0B,MAAM,OAAO,mBAAmB,GAAG;AAAA,QAC7D,wBAAwB,MAAM,OAAO,WAAW,GAAG;AAAA,QACnD,yBAAyB,MAAM,OAAO,kBAAkB,GAAG;AAAA,MAC7D;AAAA,MACA;AAAA,IACF;AAGA,uBAAmB,cAAc,OAAO;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildHostShared,\n buildWebpackResolve,\n} from '#internal/host/shared/shared-module-resolver';\nimport { loadScripts } from '#internal/runtime/loaders/script-loader';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\nimport { RemoteComponentsError } from '#internal/utils/error';\n\n// initializer for the webpack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function webpackRuntime(\n bundle: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string | number>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__?: Record<string, boolean>;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n __webpack_require_type__: 'webpack' | 'turbopack';\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n // disable webpack exec to prevent automatically executing the entry module\n if (!self.__DISABLE_WEBPACK_EXEC__) {\n self.__DISABLE_WEBPACK_EXEC__ = {};\n }\n self.__DISABLE_WEBPACK_EXEC__[bundle] = true;\n // add a custom webpack require function to load remote components from multiple bundles / zones\n if (\n typeof self.__webpack_require__ !== 'function' &&\n self.__webpack_require_type__ !== 'turbopack'\n ) {\n self.__webpack_require__ = (remoteId: string) => {\n const re = /\\[(?<bundle>[^\\]]+)\\] (?<id>.*)/;\n const match = re.exec(remoteId);\n const remoteBundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && remoteBundle)) {\n throw new RemoteComponentsError(\n `Remote Component module \"${remoteId}\" not found. Did you forget to wrap the Next.js config with \\`withRemoteComponentsConfig\\` on both host and remote?`,\n );\n }\n if (\n typeof self.__remote_webpack_require__?.[remoteBundle] !== 'function'\n ) {\n throw new RemoteComponentsError(\n `Remote Components are not available in \"${remoteBundle}\". Did you forget to wrap the Next.js config with \\`withRemoteComponentsConfig\\` on both host and remote?`,\n );\n }\n return self.__remote_webpack_require__[remoteBundle](id);\n };\n // not used but required by react-server-dom-webpack\n self.__webpack_chunk_load__ = () => {\n return Promise.resolve([]);\n };\n }\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(\n scripts: HTMLScriptElement[],\n url: URL,\n remoteBundle: string,\n _: string,\n ) {\n // Build absolute src URLs for each script and remove originals from the\n // parsed doc to prevent re-execution when the doc is later inserted into\n // the shadow DOM.\n const scriptSrcs = scripts.flatMap((script) => {\n const scriptSrc =\n script.getAttribute('src') || script.getAttribute('data-src');\n script.parentElement?.removeChild(script);\n if (!scriptSrc) return [];\n return [\n {\n src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, '/_next/'), url)\n .href,\n },\n ];\n });\n\n await loadScripts(scriptSrcs, resolveClientUrl);\n\n const hostShared = buildHostShared(shared, resolveClientUrl);\n const resolve = await buildWebpackResolve(\n hostShared,\n remoteShared ?? {},\n remoteBundle,\n {\n '/react/index.js': (await import('react')).default,\n '/react/jsx-dev-runtime.js': (await import('react/jsx-dev-runtime'))\n .default,\n '/react/jsx-runtime.js': (await import('react/jsx-runtime')).default,\n '/react-dom/index.js': (await import('react-dom')).default,\n '/react-dom/client.js': (await import('react-dom/client')).default,\n },\n 'WebpackRuntime',\n );\n\n // apply shared modules to the bundle\n applySharedModules(remoteBundle, resolve);\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-components",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "private": false,
5
5
  "description": "Compose remote components at runtime between microfrontends applications.",
6
6
  "keywords": [
@@ -14,7 +14,14 @@
14
14
  "url": "https://github.com/vercel/microfrontends.git",
15
15
  "directory": "packages/remote-components"
16
16
  },
17
- "sideEffects": true,
17
+ "sideEffects": [
18
+ "./dist/host/html.js",
19
+ "./dist/host/html.cjs",
20
+ "./dist/remote/html.js",
21
+ "./dist/remote/html.cjs",
22
+ "./dist/remote/defaults/wrapper.js",
23
+ "./dist/remote/defaults/wrapper.cjs"
24
+ ],
18
25
  "type": "module",
19
26
  "imports": {
20
27
  "#internal/*": {