coralite 0.38.4 → 0.38.5
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/lib/index.js +40 -40
- package/dist/lib/index.js.map +2 -2
- package/dist/lib/renderer.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/lib/index.js
CHANGED
|
@@ -5830,6 +5830,44 @@ function createRenderer({
|
|
|
5830
5830
|
mappedSessionObject,
|
|
5831
5831
|
pageContext
|
|
5832
5832
|
});
|
|
5833
|
+
const componentsToInclude = /* @__PURE__ */ new Set();
|
|
5834
|
+
const addComponentAndDependencies2 = (id) => {
|
|
5835
|
+
if (componentsToInclude.has(id)) {
|
|
5836
|
+
return;
|
|
5837
|
+
}
|
|
5838
|
+
componentsToInclude.add(id);
|
|
5839
|
+
const sharedFn = scriptManager.sharedFunctions[id];
|
|
5840
|
+
if (sharedFn && sharedFn.components) {
|
|
5841
|
+
const components = sharedFn.components;
|
|
5842
|
+
for (let i = 0; i < components.length; i++) {
|
|
5843
|
+
addComponentAndDependencies2(components[i]);
|
|
5844
|
+
}
|
|
5845
|
+
}
|
|
5846
|
+
};
|
|
5847
|
+
for (const tag of mappedSessionObject.componentTags) {
|
|
5848
|
+
addComponentAndDependencies2(tag);
|
|
5849
|
+
}
|
|
5850
|
+
if (mappedSessionObject.scripts.content[mappedComponent.path.pathname]) {
|
|
5851
|
+
const scripts = mappedSessionObject.scripts.content[mappedComponent.path.pathname];
|
|
5852
|
+
for (const instanceId in scripts) {
|
|
5853
|
+
const script = scripts[instanceId];
|
|
5854
|
+
addComponentAndDependencies2(script.componentId);
|
|
5855
|
+
if (script.components) {
|
|
5856
|
+
const components = script.components;
|
|
5857
|
+
for (let i = 0; i < components.length; i++) {
|
|
5858
|
+
addComponentAndDependencies2(components[i]);
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5863
|
+
for (const module of scriptManager.scriptModules) {
|
|
5864
|
+
const extractedComponents = module.client?._extractedComponents || module._extractedComponents;
|
|
5865
|
+
if (extractedComponents) {
|
|
5866
|
+
for (const tag of extractedComponents) {
|
|
5867
|
+
addComponentAndDependencies2(tag);
|
|
5868
|
+
}
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5833
5871
|
const { head: headElement, body: bodyElement } = findHeadAndBody(mappedComponent.root);
|
|
5834
5872
|
if (normalizedOptions.externalStyles && normalizedOptions.externalStyles.length > 0) {
|
|
5835
5873
|
injectExternalStyles(mappedComponent.root, headElement, normalizedOptions.externalStyles);
|
|
@@ -5857,7 +5895,7 @@ function createRenderer({
|
|
|
5857
5895
|
injectStyles(mappedComponent.root, headElement, mappedSessionObject.styles);
|
|
5858
5896
|
}
|
|
5859
5897
|
}
|
|
5860
|
-
if (
|
|
5898
|
+
if (componentsToInclude.size > 0) {
|
|
5861
5899
|
const targetElement = headElement || bodyElement || mappedComponent.root;
|
|
5862
5900
|
const layoutStyleElement = createCoraliteElement({
|
|
5863
5901
|
type: "tag",
|
|
@@ -5866,7 +5904,7 @@ function createRenderer({
|
|
|
5866
5904
|
attribs: { id: "coralite-components" },
|
|
5867
5905
|
children: []
|
|
5868
5906
|
});
|
|
5869
|
-
const selectors = Array.from(
|
|
5907
|
+
const selectors = Array.from(componentsToInclude);
|
|
5870
5908
|
selectors.push("c-token");
|
|
5871
5909
|
layoutStyleElement.children.push(createCoraliteTextNode({
|
|
5872
5910
|
type: "text",
|
|
@@ -5902,44 +5940,6 @@ function createRenderer({
|
|
|
5902
5940
|
});
|
|
5903
5941
|
}
|
|
5904
5942
|
const chunkManifest = {};
|
|
5905
|
-
const componentsToInclude = /* @__PURE__ */ new Set();
|
|
5906
|
-
const addComponentAndDependencies2 = (id) => {
|
|
5907
|
-
if (componentsToInclude.has(id)) {
|
|
5908
|
-
return;
|
|
5909
|
-
}
|
|
5910
|
-
componentsToInclude.add(id);
|
|
5911
|
-
const sharedFn = scriptManager.sharedFunctions[id];
|
|
5912
|
-
if (sharedFn && sharedFn.components) {
|
|
5913
|
-
const components = sharedFn.components;
|
|
5914
|
-
for (let i = 0; i < components.length; i++) {
|
|
5915
|
-
addComponentAndDependencies2(components[i]);
|
|
5916
|
-
}
|
|
5917
|
-
}
|
|
5918
|
-
};
|
|
5919
|
-
for (const instanceId in scripts) {
|
|
5920
|
-
const script = scripts[instanceId];
|
|
5921
|
-
addComponentAndDependencies2(script.componentId);
|
|
5922
|
-
if (script.components) {
|
|
5923
|
-
const components = script.components;
|
|
5924
|
-
for (let i = 0; i < components.length; i++) {
|
|
5925
|
-
addComponentAndDependencies2(components[i]);
|
|
5926
|
-
}
|
|
5927
|
-
}
|
|
5928
|
-
}
|
|
5929
|
-
for (const tag of declarativeTags) {
|
|
5930
|
-
addComponentAndDependencies2(tag);
|
|
5931
|
-
}
|
|
5932
|
-
for (const module of scriptManager.scriptModules) {
|
|
5933
|
-
if (module.client?._extractedComponents) {
|
|
5934
|
-
for (const tag of module.client._extractedComponents) {
|
|
5935
|
-
addComponentAndDependencies2(tag);
|
|
5936
|
-
}
|
|
5937
|
-
} else if (module._extractedComponents) {
|
|
5938
|
-
for (const tag of module._extractedComponents) {
|
|
5939
|
-
addComponentAndDependencies2(tag);
|
|
5940
|
-
}
|
|
5941
|
-
}
|
|
5942
|
-
}
|
|
5943
5943
|
for (const tag of componentsToInclude) {
|
|
5944
5944
|
if (scriptResult.manifest[tag]) {
|
|
5945
5945
|
chunkManifest[tag] = scriptResult.manifest[tag];
|