chayns-api 2.6.0-beta.10 → 2.6.0-beta.12
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.
|
@@ -17,13 +17,14 @@ const System = ({
|
|
|
17
17
|
}) => {
|
|
18
18
|
const Component = (0, _react.useMemo)(() => (0, _loadComponent.default)(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
19
19
|
if (!globalThis.window) {
|
|
20
|
-
var
|
|
20
|
+
var _moduleContext$system;
|
|
21
21
|
const moduleContext = (0, _react.useContext)(_moduleContext.ModuleContext);
|
|
22
|
-
(_moduleContext$
|
|
22
|
+
const info = (_moduleContext$system = moduleContext[system.scope]) !== null && _moduleContext$system !== void 0 ? _moduleContext$system : {
|
|
23
23
|
url: system.url,
|
|
24
24
|
modules: new Set()
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
info.modules.add(system.module);
|
|
27
|
+
moduleContext[system.scope] = info;
|
|
27
28
|
}
|
|
28
29
|
return _react.default.createElement(_react.default.Suspense, {
|
|
29
30
|
fallback: fallback || ''
|
|
@@ -35,10 +35,14 @@ const collectCssChunks = async modules => {
|
|
|
35
35
|
sync = [],
|
|
36
36
|
async = []
|
|
37
37
|
} = (_exposes$assets$css = (_exposes$assets = exposes.assets) === null || _exposes$assets === void 0 ? void 0 : _exposes$assets.css) !== null && _exposes$assets$css !== void 0 ? _exposes$assets$css : {};
|
|
38
|
-
|
|
38
|
+
sync.forEach(chunk => {
|
|
39
39
|
const url = new URL(chunk, module.url);
|
|
40
40
|
chunks.push(`<link rel="stylesheet" href="${url}">`);
|
|
41
41
|
});
|
|
42
|
+
async.forEach(chunk => {
|
|
43
|
+
const url = new URL(chunk, module.url);
|
|
44
|
+
chunks.push(`<link rel="preload" href="${url}" as="style" onload="this.rel='stylesheet'">`);
|
|
45
|
+
});
|
|
42
46
|
}
|
|
43
47
|
});
|
|
44
48
|
return chunks;
|
|
@@ -9,13 +9,14 @@ const System = ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
11
11
|
if (!globalThis.window) {
|
|
12
|
-
var
|
|
12
|
+
var _moduleContext$system;
|
|
13
13
|
const moduleContext = useContext(ModuleContext);
|
|
14
|
-
(_moduleContext$
|
|
14
|
+
const info = (_moduleContext$system = moduleContext[system.scope]) !== null && _moduleContext$system !== void 0 ? _moduleContext$system : {
|
|
15
15
|
url: system.url,
|
|
16
16
|
modules: new Set()
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
info.modules.add(system.module);
|
|
19
|
+
moduleContext[system.scope] = info;
|
|
19
20
|
}
|
|
20
21
|
return React.createElement(React.Suspense, {
|
|
21
22
|
fallback: fallback || ''
|
|
@@ -29,10 +29,14 @@ export const collectCssChunks = async modules => {
|
|
|
29
29
|
sync = [],
|
|
30
30
|
async = []
|
|
31
31
|
} = (_exposes$assets$css = (_exposes$assets = exposes.assets) === null || _exposes$assets === void 0 ? void 0 : _exposes$assets.css) !== null && _exposes$assets$css !== void 0 ? _exposes$assets$css : {};
|
|
32
|
-
|
|
32
|
+
sync.forEach(chunk => {
|
|
33
33
|
const url = new URL(chunk, module.url);
|
|
34
34
|
chunks.push(`<link rel="stylesheet" href="${url}">`);
|
|
35
35
|
});
|
|
36
|
+
async.forEach(chunk => {
|
|
37
|
+
const url = new URL(chunk, module.url);
|
|
38
|
+
chunks.push(`<link rel="preload" href="${url}" as="style" onload="this.rel='stylesheet'">`);
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
return chunks;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ModuleContextValueType } from '../constants';
|
|
2
|
+
/**
|
|
3
|
+
* Collects the css chunks from all modules rendered during SSR
|
|
4
|
+
* @experimental Handling for async chunks is not final and subject to change.
|
|
5
|
+
* Eventually a parameter for the rendered html might be added to analyze the async chunks
|
|
6
|
+
* @param modules
|
|
7
|
+
*/
|
|
2
8
|
export declare const collectCssChunks: (modules: ModuleContextValueType) => Promise<string>;
|