@bleedingdev/modern-js-runtime 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21
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/cjs/cli/code.js +3 -1
- package/dist/cjs/cli/ssr/index.js +2 -74
- package/dist/cjs/cli/ssr/loadable-bundler-plugin.js +2 -0
- package/dist/cjs/cli/template.server.js +1 -2
- package/dist/cjs/core/browser/hydrate.js +9 -10
- package/dist/cjs/core/browser/index.js +4 -5
- package/dist/cjs/core/context/index.js +12 -45
- package/dist/cjs/core/context/public.js +4 -7
- package/dist/cjs/core/context/runtime.js +10 -4
- package/dist/cjs/core/index.js +3 -3
- package/dist/cjs/core/plugin/index.js +2 -2
- package/dist/cjs/core/react/index.js +3 -3
- package/dist/cjs/core/react/wrapper.js +23 -67
- package/dist/cjs/core/server/helmet.js +5 -4
- package/dist/cjs/core/server/requestHandler.js +6 -7
- package/dist/cjs/core/server/requestResponse.js +4 -4
- package/dist/cjs/core/server/routerCleanup.js +2 -2
- package/dist/cjs/core/server/shared.js +171 -4
- package/dist/cjs/core/server/stream/afterTemplate.js +21 -16
- package/dist/cjs/core/server/stream/beforeTemplate.js +37 -28
- package/dist/cjs/core/server/stream/beforeTemplate.worker.js +30 -23
- package/dist/cjs/core/server/stream/createReadableStream.js +222 -125
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +171 -90
- package/dist/cjs/core/server/stream/deferredScript.js +3 -3
- package/dist/cjs/core/server/stream/shared.js +6 -2
- package/dist/cjs/core/server/string/index.js +104 -66
- package/dist/cjs/core/server/string/loadable.js +38 -23
- package/dist/cjs/core/server/string/ssrData.js +5 -12
- package/dist/cjs/core/server/utils.js +1 -2
- package/dist/cjs/document/cli/index.js +14 -5
- package/dist/cjs/exports/head.js +7 -14
- package/dist/cjs/internal.js +2 -2
- package/dist/cjs/router/cli/code/nestedRoutes.js +1 -2
- package/dist/cjs/router/cli/code/templates.js +1 -1
- package/dist/cjs/router/cli/code/utils.js +2 -2
- package/dist/cjs/router/runtime/DeferredDataScripts.node.js +10 -9
- package/dist/cjs/router/runtime/PrefetchLink.js +69 -125
- package/dist/cjs/router/runtime/hooks.js +13 -2
- package/dist/cjs/router/runtime/internal.js +7 -45
- package/dist/cjs/router/runtime/plugin.js +19 -34
- package/dist/cjs/router/runtime/plugin.node.js +9 -37
- package/dist/cjs/router/runtime/redirect.js +1 -1
- package/dist/esm/cli/code.mjs +3 -1
- package/dist/esm/cli/ssr/index.mjs +3 -72
- package/dist/esm/cli/ssr/loadable-bundler-plugin.mjs +2 -0
- package/dist/esm/cli/template.server.mjs +1 -2
- package/dist/esm/core/browser/hydrate.mjs +10 -11
- package/dist/esm/core/browser/index.mjs +1 -2
- package/dist/esm/core/context/index.mjs +2 -5
- package/dist/esm/core/context/public.mjs +1 -5
- package/dist/esm/core/context/runtime.mjs +6 -3
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/core/plugin/index.mjs +1 -1
- package/dist/esm/core/react/index.mjs +1 -1
- package/dist/esm/core/react/wrapper.mjs +20 -67
- package/dist/esm/core/server/helmet.mjs +5 -4
- package/dist/esm/core/server/requestHandler.mjs +1 -2
- package/dist/esm/core/server/requestResponse.mjs +3 -3
- package/dist/esm/core/server/routerCleanup.mjs +1 -1
- package/dist/esm/core/server/shared.mjs +153 -1
- package/dist/esm/core/server/stream/afterTemplate.mjs +23 -18
- package/dist/esm/core/server/stream/beforeTemplate.mjs +40 -31
- package/dist/esm/core/server/stream/beforeTemplate.worker.mjs +33 -26
- package/dist/esm/core/server/stream/createReadableStream.mjs +220 -123
- package/dist/esm/core/server/stream/createReadableStream.worker.mjs +161 -90
- package/dist/esm/core/server/stream/deferredScript.mjs +3 -3
- package/dist/esm/core/server/stream/shared.mjs +4 -3
- package/dist/esm/core/server/string/index.mjs +106 -68
- package/dist/esm/core/server/string/loadable.mjs +38 -23
- package/dist/esm/core/server/string/ssrData.mjs +5 -12
- package/dist/esm/core/server/utils.mjs +1 -2
- package/dist/esm/document/cli/index.mjs +12 -6
- package/dist/esm/exports/head.mjs +7 -14
- package/dist/esm/internal.mjs +1 -1
- package/dist/esm/router/cli/code/nestedRoutes.mjs +1 -2
- package/dist/esm/router/cli/code/templates.mjs +1 -1
- package/dist/esm/router/cli/code/utils.mjs +2 -2
- package/dist/esm/router/runtime/DeferredDataScripts.node.mjs +10 -9
- package/dist/esm/router/runtime/PrefetchLink.mjs +68 -124
- package/dist/esm/router/runtime/hooks.mjs +9 -1
- package/dist/esm/router/runtime/internal.mjs +2 -33
- package/dist/esm/router/runtime/plugin.mjs +10 -25
- package/dist/esm/router/runtime/plugin.node.mjs +3 -31
- package/dist/esm/router/runtime/redirect.mjs +1 -1
- package/dist/esm-node/cli/code.mjs +3 -1
- package/dist/esm-node/cli/ssr/index.mjs +3 -72
- package/dist/esm-node/cli/ssr/loadable-bundler-plugin.mjs +2 -0
- package/dist/esm-node/cli/template.server.mjs +1 -2
- package/dist/esm-node/core/browser/hydrate.mjs +10 -11
- package/dist/esm-node/core/browser/index.mjs +1 -2
- package/dist/esm-node/core/context/index.mjs +2 -5
- package/dist/esm-node/core/context/public.mjs +1 -5
- package/dist/esm-node/core/context/runtime.mjs +6 -3
- package/dist/esm-node/core/index.mjs +1 -1
- package/dist/esm-node/core/plugin/index.mjs +1 -1
- package/dist/esm-node/core/react/index.mjs +1 -1
- package/dist/esm-node/core/react/wrapper.mjs +20 -67
- package/dist/esm-node/core/server/helmet.mjs +5 -4
- package/dist/esm-node/core/server/requestHandler.mjs +1 -2
- package/dist/esm-node/core/server/requestResponse.mjs +3 -3
- package/dist/esm-node/core/server/routerCleanup.mjs +1 -1
- package/dist/esm-node/core/server/shared.mjs +153 -1
- package/dist/esm-node/core/server/stream/afterTemplate.mjs +23 -18
- package/dist/esm-node/core/server/stream/beforeTemplate.mjs +40 -31
- package/dist/esm-node/core/server/stream/beforeTemplate.worker.mjs +33 -26
- package/dist/esm-node/core/server/stream/createReadableStream.mjs +220 -123
- package/dist/esm-node/core/server/stream/createReadableStream.worker.mjs +161 -90
- package/dist/esm-node/core/server/stream/deferredScript.mjs +3 -3
- package/dist/esm-node/core/server/stream/shared.mjs +4 -3
- package/dist/esm-node/core/server/string/index.mjs +106 -68
- package/dist/esm-node/core/server/string/loadable.mjs +38 -23
- package/dist/esm-node/core/server/string/ssrData.mjs +5 -12
- package/dist/esm-node/core/server/utils.mjs +1 -2
- package/dist/esm-node/document/cli/index.mjs +12 -6
- package/dist/esm-node/exports/head.mjs +7 -14
- package/dist/esm-node/internal.mjs +1 -1
- package/dist/esm-node/router/cli/code/nestedRoutes.mjs +1 -2
- package/dist/esm-node/router/cli/code/templates.mjs +1 -1
- package/dist/esm-node/router/cli/code/utils.mjs +2 -2
- package/dist/esm-node/router/runtime/DeferredDataScripts.node.mjs +10 -9
- package/dist/esm-node/router/runtime/PrefetchLink.mjs +68 -124
- package/dist/esm-node/router/runtime/hooks.mjs +9 -1
- package/dist/esm-node/router/runtime/internal.mjs +2 -33
- package/dist/esm-node/router/runtime/plugin.mjs +10 -25
- package/dist/esm-node/router/runtime/plugin.node.mjs +3 -31
- package/dist/esm-node/router/runtime/redirect.mjs +1 -1
- package/dist/types/cli/ssr/index.d.ts +0 -3
- package/dist/types/core/context/index.d.ts +4 -6
- package/dist/types/core/context/public.d.ts +1 -23
- package/dist/types/core/context/runtime.d.ts +26 -2
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/react/wrapper.d.ts +7 -1
- package/dist/types/core/server/helmet.d.ts +4 -5
- package/dist/types/core/server/requestHandler.d.ts +3 -3
- package/dist/types/core/server/requestResponse.d.ts +1 -1
- package/dist/types/core/server/routerCleanup.d.ts +1 -1
- package/dist/types/core/server/shared.d.ts +24 -1
- package/dist/types/core/server/stream/afterTemplate.d.ts +2 -1
- package/dist/types/core/server/stream/beforeTemplate.d.ts +4 -1
- package/dist/types/core/server/stream/beforeTemplate.worker.d.ts +4 -1
- package/dist/types/core/server/stream/shared.d.ts +16 -2
- package/dist/types/core/server/string/loadable.d.ts +6 -3
- package/dist/types/core/server/string/ssrData.d.ts +2 -1
- package/dist/types/core/server/string/types.d.ts +1 -5
- package/dist/types/core/server/tracer.d.ts +1 -1
- package/dist/types/core/server/utils.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -2
- package/dist/types/document/cli/index.d.ts +1 -0
- package/dist/types/exports/head.d.ts +2 -2
- package/dist/types/internal.d.ts +1 -1
- package/dist/types/router/runtime/PrefetchLink.d.ts +27 -2
- package/dist/types/router/runtime/hooks.d.ts +19 -2
- package/dist/types/router/runtime/internal.d.ts +4 -21
- package/dist/types/router/runtime/types.d.ts +2 -43
- package/package.json +18 -46
- package/rslib.config.mts +3 -0
- package/rstest.config.mts +28 -2
- package/dist/cjs/boundary-debugger/index.js +0 -317
- package/dist/cjs/core/context/extensions.js +0 -74
- package/dist/cjs/core/context/helmetContext.js +0 -54
- package/dist/cjs/core/server/federatedCss.js +0 -58
- package/dist/cjs/core/server/scriptOrder.js +0 -140
- package/dist/cjs/module-federation/consume-surface.js +0 -199
- package/dist/cjs/module-federation/distributed-ssr.js +0 -135
- package/dist/cjs/module-federation/index.js +0 -316
- package/dist/cjs/module-federation/last-known-good.js +0 -157
- package/dist/cjs/module-federation/manifest-recovery-runtime-plugin.js +0 -129
- package/dist/cjs/module-federation/surface-resolution-types.js +0 -61
- package/dist/cjs/router/runtime/lifecycle.js +0 -167
- package/dist/cjs/router/runtime/provider.js +0 -153
- package/dist/cjs/rsc/server.worker.js +0 -62
- package/dist/esm/boundary-debugger/index.mjs +0 -277
- package/dist/esm/core/context/extensions.mjs +0 -33
- package/dist/esm/core/context/helmetContext.mjs +0 -13
- package/dist/esm/core/server/federatedCss.mjs +0 -20
- package/dist/esm/core/server/scriptOrder.mjs +0 -90
- package/dist/esm/module-federation/consume-surface.mjs +0 -158
- package/dist/esm/module-federation/distributed-ssr.mjs +0 -82
- package/dist/esm/module-federation/index.mjs +0 -115
- package/dist/esm/module-federation/last-known-good.mjs +0 -113
- package/dist/esm/module-federation/manifest-recovery-runtime-plugin.mjs +0 -89
- package/dist/esm/module-federation/surface-resolution-types.mjs +0 -8
- package/dist/esm/router/runtime/lifecycle.mjs +0 -105
- package/dist/esm/router/runtime/provider.mjs +0 -100
- package/dist/esm/rsc/server.worker.mjs +0 -1
- package/dist/esm-node/boundary-debugger/index.mjs +0 -278
- package/dist/esm-node/core/context/extensions.mjs +0 -34
- package/dist/esm-node/core/context/helmetContext.mjs +0 -14
- package/dist/esm-node/core/server/federatedCss.mjs +0 -21
- package/dist/esm-node/core/server/scriptOrder.mjs +0 -91
- package/dist/esm-node/module-federation/consume-surface.mjs +0 -159
- package/dist/esm-node/module-federation/distributed-ssr.mjs +0 -83
- package/dist/esm-node/module-federation/index.mjs +0 -116
- package/dist/esm-node/module-federation/last-known-good.mjs +0 -114
- package/dist/esm-node/module-federation/manifest-recovery-runtime-plugin.mjs +0 -90
- package/dist/esm-node/module-federation/surface-resolution-types.mjs +0 -9
- package/dist/esm-node/router/runtime/lifecycle.mjs +0 -106
- package/dist/esm-node/router/runtime/provider.mjs +0 -101
- package/dist/esm-node/rsc/server.worker.mjs +0 -2
- package/dist/types/boundary-debugger/index.d.ts +0 -28
- package/dist/types/core/context/extensions.d.ts +0 -35
- package/dist/types/core/context/helmetContext.d.ts +0 -10
- package/dist/types/core/server/federatedCss.d.ts +0 -5
- package/dist/types/core/server/scriptOrder.d.ts +0 -25
- package/dist/types/module-federation/consume-surface.d.ts +0 -104
- package/dist/types/module-federation/distributed-ssr.d.ts +0 -61
- package/dist/types/module-federation/index.d.ts +0 -71
- package/dist/types/module-federation/last-known-good.d.ts +0 -52
- package/dist/types/module-federation/manifest-recovery-runtime-plugin.d.ts +0 -25
- package/dist/types/module-federation/surface-resolution-types.d.ts +0 -23
- package/dist/types/router/runtime/lifecycle.d.ts +0 -27
- package/dist/types/router/runtime/provider.d.ts +0 -78
- package/dist/types/rsc/server.worker.d.ts +0 -1
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const EXTENSIONS_SLOT = Symbol.for('@modern-js/runtime:context-extensions');
|
|
31
|
-
function getStore(context) {
|
|
32
|
-
return context[EXTENSIONS_SLOT];
|
|
33
|
-
}
|
|
34
|
-
function ensureStore(context) {
|
|
35
|
-
const target = context;
|
|
36
|
-
const store = target[EXTENSIONS_SLOT] ?? new Map();
|
|
37
|
-
Object.defineProperty(target, EXTENSIONS_SLOT, {
|
|
38
|
-
configurable: true,
|
|
39
|
-
enumerable: true,
|
|
40
|
-
value: store
|
|
41
|
-
});
|
|
42
|
-
return store;
|
|
43
|
-
}
|
|
44
|
-
function stripRuntimeContextExtensions(context) {
|
|
45
|
-
delete context[EXTENSIONS_SLOT];
|
|
46
|
-
}
|
|
47
|
-
function createRuntimeContextExtension(id) {
|
|
48
|
-
const key = Symbol.for(`@modern-js/runtime:context-extension:${id}`);
|
|
49
|
-
return {
|
|
50
|
-
key,
|
|
51
|
-
get (context) {
|
|
52
|
-
return getStore(context)?.get(key);
|
|
53
|
-
},
|
|
54
|
-
set (context, value) {
|
|
55
|
-
ensureStore(context).set(key, value);
|
|
56
|
-
},
|
|
57
|
-
remove (context) {
|
|
58
|
-
getStore(context)?.delete(key);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
63
|
-
createRuntimeContextExtension: ()=>createRuntimeContextExtension,
|
|
64
|
-
stripRuntimeContextExtensions: ()=>stripRuntimeContextExtensions
|
|
65
|
-
});
|
|
66
|
-
exports.createRuntimeContextExtension = __webpack_exports__.createRuntimeContextExtension;
|
|
67
|
-
exports.stripRuntimeContextExtensions = __webpack_exports__.stripRuntimeContextExtensions;
|
|
68
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
69
|
-
"createRuntimeContextExtension",
|
|
70
|
-
"stripRuntimeContextExtensions"
|
|
71
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
72
|
-
Object.defineProperty(exports, '__esModule', {
|
|
73
|
-
value: true
|
|
74
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
ensureHelmetContext: ()=>ensureHelmetContext,
|
|
32
|
-
getHelmetContext: ()=>getHelmetContext
|
|
33
|
-
});
|
|
34
|
-
const external_extensions_js_namespaceObject = require("./extensions.js");
|
|
35
|
-
const helmetContextExtension = (0, external_extensions_js_namespaceObject.createRuntimeContextExtension)('@modern-js/runtime:helmet-context');
|
|
36
|
-
function getHelmetContext(context) {
|
|
37
|
-
return helmetContextExtension.get(context);
|
|
38
|
-
}
|
|
39
|
-
function ensureHelmetContext(context) {
|
|
40
|
-
const existing = helmetContextExtension.get(context);
|
|
41
|
-
if (void 0 !== existing) return existing;
|
|
42
|
-
const created = {};
|
|
43
|
-
helmetContextExtension.set(context, created);
|
|
44
|
-
return created;
|
|
45
|
-
}
|
|
46
|
-
exports.ensureHelmetContext = __webpack_exports__.ensureHelmetContext;
|
|
47
|
-
exports.getHelmetContext = __webpack_exports__.getHelmetContext;
|
|
48
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
-
"ensureHelmetContext",
|
|
50
|
-
"getHelmetContext"
|
|
51
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
52
|
-
Object.defineProperty(exports, '__esModule', {
|
|
53
|
-
value: true
|
|
54
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createFederatedCssLinks: ()=>createFederatedCssLinks
|
|
32
|
-
});
|
|
33
|
-
const runtime_extensions_namespaceObject = require("@modern-js/runtime-extensions");
|
|
34
|
-
const external_utils_js_namespaceObject = require("./utils.js");
|
|
35
|
-
const createFederatedCssLinks = (assets, options)=>{
|
|
36
|
-
if (void 0 === assets || 0 === assets.length) return '';
|
|
37
|
-
const seen = new Set(options.existingAssets || []);
|
|
38
|
-
const attributes = (0, external_utils_js_namespaceObject.attributesToString)(Object.fromEntries(Object.entries(options.attributes || {}).filter(([name])=>![
|
|
39
|
-
'href',
|
|
40
|
-
'rel'
|
|
41
|
-
].includes(name.toLowerCase()))));
|
|
42
|
-
const links = [];
|
|
43
|
-
for (const asset of assets){
|
|
44
|
-
const href = (0, runtime_extensions_namespaceObject.escapeHtmlAttribute)(asset);
|
|
45
|
-
if (!('' === asset || seen.has(asset) || (0, external_utils_js_namespaceObject.hasStylesheetLink)(options.template, asset) || (0, external_utils_js_namespaceObject.hasStylesheetLink)(options.template, href))) {
|
|
46
|
-
seen.add(asset);
|
|
47
|
-
links.push(`<link${attributes} href="${href}" rel="stylesheet" />`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return links.join('');
|
|
51
|
-
};
|
|
52
|
-
exports.createFederatedCssLinks = __webpack_exports__.createFederatedCssLinks;
|
|
53
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
54
|
-
"createFederatedCssLinks"
|
|
55
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
56
|
-
Object.defineProperty(exports, '__esModule', {
|
|
57
|
-
value: true
|
|
58
|
-
});
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
createRouteHydrationScriptTags: ()=>createRouteHydrationScriptTags,
|
|
32
|
-
getMatchedRouteChunks: ()=>getMatchedRouteChunks,
|
|
33
|
-
injectBeforeHydrationEntryScript: ()=>injectBeforeHydrationEntryScript,
|
|
34
|
-
orderHydrationScriptChunks: ()=>orderHydrationScriptChunks,
|
|
35
|
-
replaceChunkJsPlaceholder: ()=>replaceChunkJsPlaceholder
|
|
36
|
-
});
|
|
37
|
-
const lifecycle_js_namespaceObject = require("../../router/runtime/lifecycle.js");
|
|
38
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
39
|
-
const external_utils_js_namespaceObject = require("./utils.js");
|
|
40
|
-
function getScriptTags(template) {
|
|
41
|
-
const scriptRegExp = /<script\b[^>]*\bsrc=(["'])(.*?)\1[^>]*><\/script>/g;
|
|
42
|
-
return Array.from(template.matchAll(scriptRegExp)).map((match)=>({
|
|
43
|
-
index: match.index ?? 0,
|
|
44
|
-
tag: match[0],
|
|
45
|
-
src: match[2]
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
function getAssetBasename(src) {
|
|
49
|
-
const withoutQuery = src.split(/[?#]/)[0];
|
|
50
|
-
return withoutQuery.split('/').pop() || withoutQuery;
|
|
51
|
-
}
|
|
52
|
-
function isEntryScript(src, entryName, asyncEntry) {
|
|
53
|
-
const basename = getAssetBasename(src);
|
|
54
|
-
const prefix = asyncEntry ? `async-${entryName}` : entryName;
|
|
55
|
-
return basename === `${prefix}.js` || basename.startsWith(`${prefix}.`) || basename.startsWith(`${prefix}-`);
|
|
56
|
-
}
|
|
57
|
-
const dedupeByUrl = (chunks)=>{
|
|
58
|
-
const seen = new Set();
|
|
59
|
-
return chunks.filter((chunk)=>{
|
|
60
|
-
if (void 0 === chunk.url || '' === chunk.url || seen.has(chunk.url)) return false;
|
|
61
|
-
seen.add(chunk.url);
|
|
62
|
-
return true;
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const isAsyncEntryScriptChunk = (chunk, entryName)=>{
|
|
66
|
-
if (void 0 === chunk.url || !chunk.url.endsWith('.js')) return false;
|
|
67
|
-
const asyncEntryName = `async-${entryName}`;
|
|
68
|
-
const filename = chunk.filename ?? chunk.url;
|
|
69
|
-
const basename = filename.split('/').pop() ?? filename;
|
|
70
|
-
return basename === `${asyncEntryName}.js` || basename.startsWith(`${asyncEntryName}.`) || basename.startsWith(`${asyncEntryName}-`);
|
|
71
|
-
};
|
|
72
|
-
function getRouteAssets(runtimeContext, routeManifest = runtimeContext.routeManifest) {
|
|
73
|
-
return routeManifest?.routeAssets;
|
|
74
|
-
}
|
|
75
|
-
function getMatchedRouteAssets(runtimeContext, routeManifest) {
|
|
76
|
-
const routeAssets = getRouteAssets(runtimeContext, routeManifest);
|
|
77
|
-
if (void 0 === routeAssets) return [];
|
|
78
|
-
const matchedRouteIds = (0, lifecycle_js_namespaceObject.getRouterMatchedRouteIds)(runtimeContext) ?? [];
|
|
79
|
-
return matchedRouteIds.flatMap((routeId)=>routeAssets[routeId]?.assets ?? []);
|
|
80
|
-
}
|
|
81
|
-
function getMatchedRouteChunks(runtimeContext, routeManifest, routeAssetToChunk) {
|
|
82
|
-
if (void 0 === routeManifest) return [];
|
|
83
|
-
return getMatchedRouteAssets(runtimeContext, routeManifest).map(routeAssetToChunk);
|
|
84
|
-
}
|
|
85
|
-
const orderHydrationScriptChunks = ({ asyncEntryChunks, collectedChunks, matchedRouteChunks, entryName })=>{
|
|
86
|
-
const asyncEntryScriptChunks = [];
|
|
87
|
-
const asyncEntryDependencyChunks = [];
|
|
88
|
-
for (const chunk of asyncEntryChunks)if (isAsyncEntryScriptChunk(chunk, entryName)) asyncEntryScriptChunks.push(chunk);
|
|
89
|
-
else asyncEntryDependencyChunks.push(chunk);
|
|
90
|
-
return dedupeByUrl([
|
|
91
|
-
...asyncEntryDependencyChunks,
|
|
92
|
-
...collectedChunks,
|
|
93
|
-
...matchedRouteChunks,
|
|
94
|
-
...asyncEntryScriptChunks
|
|
95
|
-
]);
|
|
96
|
-
};
|
|
97
|
-
function injectBeforeHydrationEntryScript(template, scripts, entryName = 'index') {
|
|
98
|
-
if ('' === scripts) return template;
|
|
99
|
-
const scriptTags = getScriptTags(template);
|
|
100
|
-
const target = scriptTags.find((match)=>isEntryScript(match.src, entryName, false)) ?? scriptTags.find((match)=>isEntryScript(match.src, entryName, true));
|
|
101
|
-
if (void 0 === target) return template;
|
|
102
|
-
return `${template.slice(0, target.index)}${scripts}${template.slice(target.index)}`;
|
|
103
|
-
}
|
|
104
|
-
function replaceChunkJsPlaceholder(template, scripts, entryName, placeholder = external_constants_js_namespaceObject.CHUNK_JS_PLACEHOLDER) {
|
|
105
|
-
if (!template.includes(placeholder)) return template;
|
|
106
|
-
if ('' === scripts) return (0, external_utils_js_namespaceObject.safeReplace)(template, placeholder, '');
|
|
107
|
-
const withoutPlaceholder = (0, external_utils_js_namespaceObject.safeReplace)(template, placeholder, '');
|
|
108
|
-
const withEarlyScripts = injectBeforeHydrationEntryScript(withoutPlaceholder, scripts, entryName);
|
|
109
|
-
if (withEarlyScripts !== withoutPlaceholder) return withEarlyScripts;
|
|
110
|
-
return (0, external_utils_js_namespaceObject.safeReplace)(template, placeholder, scripts);
|
|
111
|
-
}
|
|
112
|
-
function createRouteHydrationScriptTags(runtimeContext, entryName, options = {}) {
|
|
113
|
-
const { nonce, template } = options;
|
|
114
|
-
const routeAssets = getRouteAssets(runtimeContext);
|
|
115
|
-
if (void 0 === routeAssets) return '';
|
|
116
|
-
const existingScriptSrcs = void 0 === template ? new Set() : new Set(getScriptTags(template).map(({ src })=>src));
|
|
117
|
-
const jsAssets = Array.from(new Set([
|
|
118
|
-
...getMatchedRouteAssets(runtimeContext),
|
|
119
|
-
...routeAssets[`async-${entryName}`]?.assets ?? []
|
|
120
|
-
].filter((asset)=>asset.endsWith('.js'))));
|
|
121
|
-
return jsAssets.filter((asset)=>!existingScriptSrcs.has(asset)).map((asset)=>`<script${(0, external_utils_js_namespaceObject.attributesToString)({
|
|
122
|
-
src: asset,
|
|
123
|
-
nonce: nonce || void 0
|
|
124
|
-
})}></script>`).join(' ');
|
|
125
|
-
}
|
|
126
|
-
exports.createRouteHydrationScriptTags = __webpack_exports__.createRouteHydrationScriptTags;
|
|
127
|
-
exports.getMatchedRouteChunks = __webpack_exports__.getMatchedRouteChunks;
|
|
128
|
-
exports.injectBeforeHydrationEntryScript = __webpack_exports__.injectBeforeHydrationEntryScript;
|
|
129
|
-
exports.orderHydrationScriptChunks = __webpack_exports__.orderHydrationScriptChunks;
|
|
130
|
-
exports.replaceChunkJsPlaceholder = __webpack_exports__.replaceChunkJsPlaceholder;
|
|
131
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
132
|
-
"createRouteHydrationScriptTags",
|
|
133
|
-
"getMatchedRouteChunks",
|
|
134
|
-
"injectBeforeHydrationEntryScript",
|
|
135
|
-
"orderHydrationScriptChunks",
|
|
136
|
-
"replaceChunkJsPlaceholder"
|
|
137
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
138
|
-
Object.defineProperty(exports, '__esModule', {
|
|
139
|
-
value: true
|
|
140
|
-
});
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
consumeSurface: ()=>consumeSurface,
|
|
32
|
-
createSurfaceConsumer: ()=>createSurfaceConsumer
|
|
33
|
-
});
|
|
34
|
-
const external_index_js_namespaceObject = require("./index.js");
|
|
35
|
-
const external_surface_resolution_types_js_namespaceObject = require("./surface-resolution-types.js");
|
|
36
|
-
function classifyDiscoveryError(code) {
|
|
37
|
-
switch(code){
|
|
38
|
-
case 'major-not-published':
|
|
39
|
-
case 'stale-record':
|
|
40
|
-
return 'version-skew';
|
|
41
|
-
case 'identity-mismatch':
|
|
42
|
-
return 'contract';
|
|
43
|
-
case 'unknown-unit':
|
|
44
|
-
case 'unknown-surface':
|
|
45
|
-
case 'provider-unavailable':
|
|
46
|
-
return 'remote-unavailable';
|
|
47
|
-
default:
|
|
48
|
-
return 'remote-unavailable';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function toRemoteString(ref) {
|
|
52
|
-
return void 0 === (0, external_surface_resolution_types_js_namespaceObject.validateSurfaceRef)(ref) ? (0, external_surface_resolution_types_js_namespaceObject.formatSurfaceRef)(ref) : `${ref.unitId}#${ref.surfaceId}`;
|
|
53
|
-
}
|
|
54
|
-
async function reportFailure(options, ref, base) {
|
|
55
|
-
const remote = toRemoteString(ref);
|
|
56
|
-
const telemetry = (0, external_index_js_namespaceObject.createModuleFederationFallbackTelemetry)({
|
|
57
|
-
appName: options.appName,
|
|
58
|
-
classification: base.classification,
|
|
59
|
-
error: base.error ?? base.discoveryError,
|
|
60
|
-
metadata: {
|
|
61
|
-
env: options.env,
|
|
62
|
-
surfaceRef: remote,
|
|
63
|
-
...base.discoveryError ? {
|
|
64
|
-
discoveryErrorCode: base.discoveryError.code
|
|
65
|
-
} : {},
|
|
66
|
-
...base.resolved ? {
|
|
67
|
-
buildMarker: base.resolved.buildMarker
|
|
68
|
-
} : {}
|
|
69
|
-
},
|
|
70
|
-
phase: base.phase,
|
|
71
|
-
remote,
|
|
72
|
-
status: 'degraded'
|
|
73
|
-
});
|
|
74
|
-
try {
|
|
75
|
-
await (0, external_index_js_namespaceObject.emitModuleFederationFallbackTelemetry)({
|
|
76
|
-
appName: options.appName,
|
|
77
|
-
classification: base.classification,
|
|
78
|
-
error: base.error ?? base.discoveryError,
|
|
79
|
-
metadata: telemetry.metadata,
|
|
80
|
-
phase: base.phase,
|
|
81
|
-
remote,
|
|
82
|
-
status: 'degraded'
|
|
83
|
-
}, options.telemetry ?? {});
|
|
84
|
-
} catch {}
|
|
85
|
-
const failure = {
|
|
86
|
-
ref,
|
|
87
|
-
env: options.env,
|
|
88
|
-
phase: base.phase,
|
|
89
|
-
classification: base.classification,
|
|
90
|
-
telemetry
|
|
91
|
-
};
|
|
92
|
-
if (base.discoveryError) failure.discoveryError = base.discoveryError;
|
|
93
|
-
if (void 0 !== base.error) failure.error = base.error;
|
|
94
|
-
if (base.resolved) failure.resolved = base.resolved;
|
|
95
|
-
const critical = (options.classification ?? 'critical') === 'critical';
|
|
96
|
-
const reason = base.discoveryError ?? (void 0 !== base.error ? base.error : (0, external_surface_resolution_types_js_namespaceObject.createDiscoveryError)('identity-mismatch', remote, `resolved record for "${remote}" is incompatible`, {
|
|
97
|
-
env: options.env
|
|
98
|
-
}));
|
|
99
|
-
let degradedValue;
|
|
100
|
-
try {
|
|
101
|
-
degradedValue = await options.degraded(failure);
|
|
102
|
-
} catch (handlerError) {
|
|
103
|
-
try {
|
|
104
|
-
await (0, external_index_js_namespaceObject.emitModuleFederationFallbackTelemetry)({
|
|
105
|
-
appName: options.appName,
|
|
106
|
-
classification: base.classification,
|
|
107
|
-
error: handlerError,
|
|
108
|
-
metadata: {
|
|
109
|
-
...telemetry.metadata,
|
|
110
|
-
degradedHandlerFailed: true
|
|
111
|
-
},
|
|
112
|
-
phase: base.phase,
|
|
113
|
-
remote,
|
|
114
|
-
status: 'failed'
|
|
115
|
-
}, options.telemetry ?? {});
|
|
116
|
-
} catch {}
|
|
117
|
-
if (critical) throw reason;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (critical) throw reason;
|
|
121
|
-
return degradedValue;
|
|
122
|
-
}
|
|
123
|
-
async function consumeSurface(options) {
|
|
124
|
-
let ref;
|
|
125
|
-
if ('string' == typeof options.ref) {
|
|
126
|
-
const parsed = (0, external_surface_resolution_types_js_namespaceObject.parseSurfaceRef)(options.ref);
|
|
127
|
-
if (!parsed.ok) {
|
|
128
|
-
const hashIndex = options.ref.indexOf('#');
|
|
129
|
-
const echoed = -1 === hashIndex ? {
|
|
130
|
-
unitId: options.ref,
|
|
131
|
-
surfaceId: ''
|
|
132
|
-
} : {
|
|
133
|
-
unitId: options.ref.slice(0, hashIndex),
|
|
134
|
-
surfaceId: options.ref.slice(hashIndex + 1)
|
|
135
|
-
};
|
|
136
|
-
return reportFailure(options, echoed, {
|
|
137
|
-
phase: 'discovery',
|
|
138
|
-
classification: 'remote-unavailable',
|
|
139
|
-
discoveryError: (0, external_surface_resolution_types_js_namespaceObject.createDiscoveryError)('unknown-surface', options.ref, `SurfaceRef "${options.ref}" is not a valid canonical reference (${parsed.error.code}).`, {
|
|
140
|
-
parseError: parsed.error,
|
|
141
|
-
env: options.env
|
|
142
|
-
})
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
ref = parsed.ref;
|
|
146
|
-
} else ref = options.ref;
|
|
147
|
-
let resolution;
|
|
148
|
-
try {
|
|
149
|
-
resolution = await options.provider.resolve(ref, options.env);
|
|
150
|
-
} catch (error) {
|
|
151
|
-
return reportFailure(options, ref, {
|
|
152
|
-
phase: 'discovery',
|
|
153
|
-
classification: (0, external_index_js_namespaceObject.classifyModuleFederationFallback)(error),
|
|
154
|
-
error
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (!resolution.ok) return reportFailure(options, ref, {
|
|
158
|
-
phase: 'discovery',
|
|
159
|
-
classification: classifyDiscoveryError(resolution.error.code),
|
|
160
|
-
discoveryError: resolution.error
|
|
161
|
-
});
|
|
162
|
-
const resolved = resolution.unit;
|
|
163
|
-
if ('incompatible' === resolved.compatibility.status) return reportFailure(options, ref, {
|
|
164
|
-
phase: 'discovery',
|
|
165
|
-
classification: 'contract',
|
|
166
|
-
resolved
|
|
167
|
-
});
|
|
168
|
-
try {
|
|
169
|
-
return await options.load({
|
|
170
|
-
resolved,
|
|
171
|
-
ref,
|
|
172
|
-
env: options.env
|
|
173
|
-
});
|
|
174
|
-
} catch (error) {
|
|
175
|
-
return reportFailure(options, ref, {
|
|
176
|
-
phase: 'load',
|
|
177
|
-
classification: (0, external_index_js_namespaceObject.classifyModuleFederationFallback)(error),
|
|
178
|
-
error,
|
|
179
|
-
resolved
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function createSurfaceConsumer(base) {
|
|
184
|
-
return function(options) {
|
|
185
|
-
return consumeSurface({
|
|
186
|
-
...base,
|
|
187
|
-
...options
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
exports.consumeSurface = __webpack_exports__.consumeSurface;
|
|
192
|
-
exports.createSurfaceConsumer = __webpack_exports__.createSurfaceConsumer;
|
|
193
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
194
|
-
"consumeSurface",
|
|
195
|
-
"createSurfaceConsumer"
|
|
196
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
197
|
-
Object.defineProperty(exports, '__esModule', {
|
|
198
|
-
value: true
|
|
199
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY: ()=>DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY,
|
|
32
|
-
DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY: ()=>DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY,
|
|
33
|
-
DistributedSsrBoundary: ()=>DistributedSsrBoundary,
|
|
34
|
-
createDistributedSsrComponent: ()=>createDistributedSsrComponent,
|
|
35
|
-
distributedSsrFragmentKey: ()=>distributedSsrFragmentKey,
|
|
36
|
-
useDistributedSsrFragmentProps: ()=>useDistributedSsrFragmentProps
|
|
37
|
-
});
|
|
38
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
-
const runtime_js_namespaceObject = require("../core/context/runtime.js");
|
|
40
|
-
const DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY = '__modernDistributedSsrFragments';
|
|
41
|
-
const DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY = '__modernDistributedSsrFragmentRequest';
|
|
42
|
-
function distributedSsrFragmentKey(remote, expose) {
|
|
43
|
-
return `${remote}::${expose}`;
|
|
44
|
-
}
|
|
45
|
-
function getDistributedSsrFragmentContext(response) {
|
|
46
|
-
const locals = response?.locals;
|
|
47
|
-
if ('object' != typeof locals || null === locals) return;
|
|
48
|
-
const context = DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY in locals ? locals[DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY] : void 0;
|
|
49
|
-
if ('object' != typeof context || null === context) return;
|
|
50
|
-
return context;
|
|
51
|
-
}
|
|
52
|
-
function useDistributedSsrFragmentProps({ boundaryId, expose }) {
|
|
53
|
-
const runtimeContext = (0, runtime_js_namespaceObject.useRuntimeContext)();
|
|
54
|
-
const locals = runtimeContext.requestContext?.response?.locals;
|
|
55
|
-
const request = 'object' == typeof locals && null !== locals && DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY in locals ? locals[DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY] : void 0;
|
|
56
|
-
if ('object' != typeof request || null === request || !('boundaryId' in request) || request.boundaryId !== boundaryId || !('expose' in request) || request.expose !== expose) throw new Error(`Distributed SSR fragment request contract mismatch for ${boundaryId} ${expose}.`);
|
|
57
|
-
const props = 'props' in request ? request.props : void 0;
|
|
58
|
-
if ('object' != typeof props || null === props || Array.isArray(props)) throw new Error(`Distributed SSR fragment request props must be an object for ${boundaryId} ${expose}.`);
|
|
59
|
-
return props;
|
|
60
|
-
}
|
|
61
|
-
function isThenable(value) {
|
|
62
|
-
return void 0 !== value && 'then' in value && 'function' == typeof value.then;
|
|
63
|
-
}
|
|
64
|
-
function DistributedSsrBoundary({ children, expose, fallback, fragmentProps, remote }) {
|
|
65
|
-
const runtimeContext = (0, runtime_js_namespaceObject.useRuntimeContext)();
|
|
66
|
-
const key = distributedSsrFragmentKey(remote, expose);
|
|
67
|
-
const attributes = {
|
|
68
|
-
'data-modern-distributed-ssr-boundary': key
|
|
69
|
-
};
|
|
70
|
-
if (runtimeContext.isBrowser) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
71
|
-
...attributes,
|
|
72
|
-
children: children
|
|
73
|
-
});
|
|
74
|
-
const fragmentContext = getDistributedSsrFragmentContext(runtimeContext.requestContext?.response);
|
|
75
|
-
if (void 0 === fragmentContext) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
76
|
-
...attributes,
|
|
77
|
-
children: children
|
|
78
|
-
});
|
|
79
|
-
const resolverFragmentProps = void 0 === fragmentProps ? {} : Object.fromEntries(Object.entries(fragmentProps));
|
|
80
|
-
const fragmentOrPromise = fragmentContext.resolve?.(remote, expose, resolverFragmentProps) ?? fragmentContext.fragments?.[key];
|
|
81
|
-
if (isThenable(fragmentOrPromise)) throw fragmentOrPromise;
|
|
82
|
-
const fragment = fragmentOrPromise;
|
|
83
|
-
if (fragment?.status === 'ready') return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
84
|
-
...attributes,
|
|
85
|
-
"data-modern-distributed-ssr-build": fragment.buildMarker,
|
|
86
|
-
"data-modern-distributed-ssr-digest": fragment.digest,
|
|
87
|
-
"data-modern-distributed-ssr-status": "ready",
|
|
88
|
-
dangerouslySetInnerHTML: {
|
|
89
|
-
__html: fragment.html
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
93
|
-
...attributes,
|
|
94
|
-
"data-modern-distributed-ssr-reason": fragment?.reason ?? 'missing',
|
|
95
|
-
"data-modern-distributed-ssr-status": "degraded",
|
|
96
|
-
children: fallback
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function createDistributedSsrComponent({ createComponent, expose, fallback, remote }) {
|
|
100
|
-
let RemoteComponent;
|
|
101
|
-
function DeferredRemoteComponent(props) {
|
|
102
|
-
RemoteComponent ??= createComponent();
|
|
103
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RemoteComponent, {
|
|
104
|
-
...props
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return function(props) {
|
|
108
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DistributedSsrBoundary, {
|
|
109
|
-
expose: expose,
|
|
110
|
-
fallback: fallback,
|
|
111
|
-
fragmentProps: props,
|
|
112
|
-
remote: remote,
|
|
113
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DeferredRemoteComponent, {
|
|
114
|
-
...props
|
|
115
|
-
})
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
exports.DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY = __webpack_exports__.DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY;
|
|
120
|
-
exports.DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY = __webpack_exports__.DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY;
|
|
121
|
-
exports.DistributedSsrBoundary = __webpack_exports__.DistributedSsrBoundary;
|
|
122
|
-
exports.createDistributedSsrComponent = __webpack_exports__.createDistributedSsrComponent;
|
|
123
|
-
exports.distributedSsrFragmentKey = __webpack_exports__.distributedSsrFragmentKey;
|
|
124
|
-
exports.useDistributedSsrFragmentProps = __webpack_exports__.useDistributedSsrFragmentProps;
|
|
125
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
126
|
-
"DISTRIBUTED_SSR_FRAGMENTS_LOCALS_KEY",
|
|
127
|
-
"DISTRIBUTED_SSR_FRAGMENT_REQUEST_LOCALS_KEY",
|
|
128
|
-
"DistributedSsrBoundary",
|
|
129
|
-
"createDistributedSsrComponent",
|
|
130
|
-
"distributedSsrFragmentKey",
|
|
131
|
-
"useDistributedSsrFragmentProps"
|
|
132
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
133
|
-
Object.defineProperty(exports, '__esModule', {
|
|
134
|
-
value: true
|
|
135
|
-
});
|