remote-components 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-63L5THIQ.js +12 -0
- package/dist/app-63L5THIQ.js.map +1 -0
- package/dist/app-A5QE7XRH.cjs +12 -0
- package/dist/app-A5QE7XRH.cjs.map +1 -0
- package/dist/chunk-2VQGCACH.js +190 -0
- package/dist/chunk-2VQGCACH.js.map +1 -0
- package/dist/chunk-42N2ZLE2.js +703 -0
- package/dist/chunk-42N2ZLE2.js.map +1 -0
- package/dist/chunk-6IUP26UK.cjs +57 -0
- package/dist/chunk-6IUP26UK.cjs.map +1 -0
- package/dist/chunk-7MVFHOIP.cjs +60 -0
- package/dist/chunk-7MVFHOIP.cjs.map +1 -0
- package/dist/chunk-CREXMFMF.cjs +155 -0
- package/dist/chunk-CREXMFMF.cjs.map +1 -0
- package/dist/chunk-CTUJSWCM.js +215 -0
- package/dist/chunk-CTUJSWCM.js.map +1 -0
- package/dist/chunk-ENYGL5CO.js +11 -0
- package/dist/chunk-ENYGL5CO.js.map +1 -0
- package/dist/chunk-ER73O65F.cjs +703 -0
- package/dist/chunk-ER73O65F.cjs.map +1 -0
- package/dist/chunk-F44NODUS.cjs +709 -0
- package/dist/chunk-F44NODUS.cjs.map +1 -0
- package/dist/chunk-GAXJTFBV.js +20 -0
- package/dist/chunk-GAXJTFBV.js.map +1 -0
- package/dist/chunk-HNZVEIKN.js +358 -0
- package/dist/chunk-HNZVEIKN.js.map +1 -0
- package/dist/chunk-KE7QPAQ4.cjs +21 -0
- package/dist/chunk-KE7QPAQ4.cjs.map +1 -0
- package/dist/chunk-KEPHL25S.js +60 -0
- package/dist/chunk-KEPHL25S.js.map +1 -0
- package/dist/chunk-KKBEMQU7.cjs +670 -0
- package/dist/chunk-KKBEMQU7.cjs.map +1 -0
- package/dist/chunk-KYJWRZ2B.js +709 -0
- package/dist/chunk-KYJWRZ2B.js.map +1 -0
- package/dist/chunk-N5VQR2PW.cjs +215 -0
- package/dist/chunk-N5VQR2PW.cjs.map +1 -0
- package/dist/chunk-OO4AMJWO.js +155 -0
- package/dist/chunk-OO4AMJWO.js.map +1 -0
- package/dist/chunk-R4QFK5TN.cjs +358 -0
- package/dist/chunk-R4QFK5TN.cjs.map +1 -0
- package/dist/chunk-RUWR74XQ.cjs +152 -0
- package/dist/chunk-RUWR74XQ.cjs.map +1 -0
- package/dist/chunk-S2A4TFLS.js +152 -0
- package/dist/chunk-S2A4TFLS.js.map +1 -0
- package/dist/chunk-SHFJ5OQA.cjs +11 -0
- package/dist/chunk-SHFJ5OQA.cjs.map +1 -0
- package/dist/chunk-TCFLEBQM.cjs +20 -0
- package/dist/chunk-TCFLEBQM.cjs.map +1 -0
- package/dist/chunk-W5ESPGHH.js +670 -0
- package/dist/chunk-W5ESPGHH.js.map +1 -0
- package/dist/chunk-X6YKUJKH.js +21 -0
- package/dist/chunk-X6YKUJKH.js.map +1 -0
- package/dist/chunk-XCFYWSLD.cjs +190 -0
- package/dist/chunk-XCFYWSLD.cjs.map +1 -0
- package/dist/chunk-ZPMTZ3KJ.js +57 -0
- package/dist/chunk-ZPMTZ3KJ.js.map +1 -0
- package/dist/config/nextjs.cjs +76 -351
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +26 -266
- package/dist/config/nextjs.js.map +1 -1
- package/dist/config/webpack.cjs +12 -240
- package/dist/config/webpack.cjs.map +1 -1
- package/dist/config/webpack.js +6 -207
- package/dist/config/webpack.js.map +1 -1
- package/dist/host/html.cjs +128 -2494
- package/dist/host/html.cjs.map +1 -1
- package/dist/host/html.js +45 -2382
- package/dist/host/html.js.map +1 -1
- package/dist/host/nextjs/app/client-only.cjs +53 -2939
- package/dist/host/nextjs/app/client-only.cjs.map +1 -1
- package/dist/host/nextjs/app/client-only.js +31 -2894
- package/dist/host/nextjs/app/client-only.js.map +1 -1
- package/dist/host/proxy/client.cjs +8 -38
- package/dist/host/proxy/client.cjs.map +1 -1
- package/dist/host/proxy/client.js +4 -7
- package/dist/host/proxy/client.js.map +1 -1
- package/dist/host/proxy.cjs +19 -56
- package/dist/host/proxy.cjs.map +1 -1
- package/dist/host/proxy.js +8 -20
- package/dist/host/proxy.js.map +1 -1
- package/dist/host/react.cjs +17 -2870
- package/dist/host/react.cjs.map +1 -1
- package/dist/host/react.js +13 -2837
- package/dist/host/react.js.map +1 -1
- package/dist/internal/host/server/fetch-remote-component.cjs +1 -18
- package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/host/server/fetch-remote-component.js +1 -18
- package/dist/internal/host/server/fetch-remote-component.js.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.cjs +5 -2
- package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.js +5 -2
- package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope.cjs +1 -5
- package/dist/internal/runtime/turbopack/remote-scope.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/remote-scope.js +1 -5
- package/dist/internal/runtime/turbopack/remote-scope.js.map +1 -1
- package/dist/internal/utils.cjs +1 -1
- package/dist/internal/utils.cjs.map +1 -1
- package/dist/internal/utils.d.ts +5 -5
- package/dist/internal/utils.js +1 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/remote/html.cjs +15 -314
- package/dist/remote/html.cjs.map +1 -1
- package/dist/remote/html.js +7 -305
- package/dist/remote/html.js.map +1 -1
- package/dist/remote/middleware.cjs +16 -41
- package/dist/remote/middleware.cjs.map +1 -1
- package/dist/script-6W5JRBZK.cjs +26 -0
- package/dist/script-6W5JRBZK.cjs.map +1 -0
- package/dist/script-IFEBOLIA.js +26 -0
- package/dist/script-IFEBOLIA.js.map +1 -0
- package/dist/static-loader-X4TSF5KW.js +11 -0
- package/dist/static-loader-X4TSF5KW.js.map +1 -0
- package/dist/static-loader-ZYD5BO4D.cjs +11 -0
- package/dist/static-loader-ZYD5BO4D.cjs.map +1 -0
- package/dist/turbopack-NPGO3MWS.js +55 -0
- package/dist/turbopack-NPGO3MWS.js.map +1 -0
- package/dist/turbopack-WRMKPNN4.cjs +55 -0
- package/dist/turbopack-WRMKPNN4.cjs.map +1 -0
- package/dist/webpack-DUBHPYD6.js +92 -0
- package/dist/webpack-DUBHPYD6.js.map +1 -0
- package/dist/webpack-KSCMCL7M.cjs +92 -0
- package/dist/webpack-KSCMCL7M.cjs.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
initializeSharedModules,
|
|
3
|
+
setupRemoteScope
|
|
4
|
+
} from "./chunk-KYJWRZ2B.js";
|
|
5
|
+
import {
|
|
6
|
+
applySharedModules,
|
|
7
|
+
nextClientPagesLoader
|
|
8
|
+
} from "./chunk-2VQGCACH.js";
|
|
9
|
+
import {
|
|
10
|
+
buildCoreShared,
|
|
11
|
+
buildHostShared
|
|
12
|
+
} from "./chunk-HNZVEIKN.js";
|
|
13
|
+
import "./chunk-KEPHL25S.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-NPGO3MWS.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 _chunkF44NODUScjs = require('./chunk-F44NODUS.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkXCFYWSLDcjs = require('./chunk-XCFYWSLD.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkR4QFK5TNcjs = require('./chunk-R4QFK5TN.cjs');
|
|
13
|
+
require('./chunk-7MVFHOIP.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 = _chunkR4QFK5TNcjs.buildHostShared.call(void 0, shared, resolveClientUrl, {
|
|
22
|
+
includeRemoteComponentShared: true
|
|
23
|
+
});
|
|
24
|
+
await _chunkF44NODUScjs.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 _chunkF44NODUScjs.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 _chunkF44NODUScjs.initializeSharedModules.call(void 0,
|
|
39
|
+
scope,
|
|
40
|
+
_chunkR4QFK5TNcjs.buildCoreShared.call(void 0, hostShared),
|
|
41
|
+
_nullishCoalesce(remoteShared, () => ( {}))
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
self,
|
|
46
|
+
createFromReadableStream,
|
|
47
|
+
applySharedModules: _chunkXCFYWSLDcjs.applySharedModules,
|
|
48
|
+
nextClientPagesLoader: _chunkXCFYWSLDcjs.nextClientPagesLoader,
|
|
49
|
+
preloadScripts
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
exports.turbopackRuntime = turbopackRuntime;
|
|
55
|
+
//# sourceMappingURL=turbopack-WRMKPNN4.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"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadScripts
|
|
3
|
+
} from "./chunk-ZPMTZ3KJ.js";
|
|
4
|
+
import {
|
|
5
|
+
applySharedModules,
|
|
6
|
+
nextClientPagesLoader
|
|
7
|
+
} from "./chunk-2VQGCACH.js";
|
|
8
|
+
import {
|
|
9
|
+
NEXT_BUNDLE_PATH_RE,
|
|
10
|
+
buildHostShared,
|
|
11
|
+
buildWebpackResolve
|
|
12
|
+
} from "./chunk-HNZVEIKN.js";
|
|
13
|
+
import "./chunk-KEPHL25S.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-DUBHPYD6.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 _chunk6IUP26UKcjs = require('./chunk-6IUP26UK.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkXCFYWSLDcjs = require('./chunk-XCFYWSLD.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkR4QFK5TNcjs = require('./chunk-R4QFK5TN.cjs');
|
|
13
|
+
require('./chunk-7MVFHOIP.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(_chunkR4QFK5TNcjs.NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
});
|
|
64
|
+
await _chunk6IUP26UKcjs.loadScripts.call(void 0, scriptSrcs, resolveClientUrl);
|
|
65
|
+
const hostShared = _chunkR4QFK5TNcjs.buildHostShared.call(void 0, shared, resolveClientUrl);
|
|
66
|
+
const resolve = await _chunkR4QFK5TNcjs.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
|
+
_chunkXCFYWSLDcjs.applySharedModules.call(void 0, remoteBundle, resolve);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
self,
|
|
83
|
+
createFromReadableStream,
|
|
84
|
+
applySharedModules: _chunkXCFYWSLDcjs.applySharedModules,
|
|
85
|
+
nextClientPagesLoader: _chunkXCFYWSLDcjs.nextClientPagesLoader,
|
|
86
|
+
preloadScripts
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
exports.webpackRuntime = webpackRuntime;
|
|
92
|
+
//# sourceMappingURL=webpack-KSCMCL7M.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.
|
|
3
|
+
"version": "0.3.6",
|
|
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":
|
|
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/*": {
|