storyblok 4.0.4 → 4.0.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/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1568,9 +1568,16 @@ function buildDependencyGraph(context) {
|
|
|
1568
1568
|
const node = new ComponentNode(nodeId, component, targetComponent);
|
|
1569
1569
|
graph.nodes.set(nodeId, node);
|
|
1570
1570
|
});
|
|
1571
|
+
const componentMap = new Map(spaceState.local.components.map((c) => [c.id, c]));
|
|
1571
1572
|
spaceState.local.presets.forEach((preset) => {
|
|
1572
|
-
const nodeId = `preset:${preset.
|
|
1573
|
-
const
|
|
1573
|
+
const nodeId = `preset:${preset.id}`;
|
|
1574
|
+
const sourceComponent = componentMap.get(preset.component_id);
|
|
1575
|
+
if (!sourceComponent) {
|
|
1576
|
+
console.warn(`Warning: Preset "${preset.name}" (ID: ${preset.id}) references component ID ${preset.component_id} which is not available in local data. Skipping preset.`);
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
const compositeKey = `${sourceComponent.name}:${preset.name}`;
|
|
1580
|
+
const targetPreset = spaceState.target.presets.get(compositeKey);
|
|
1574
1581
|
const targetData = targetPreset ? {
|
|
1575
1582
|
resource: targetPreset,
|
|
1576
1583
|
id: targetPreset.id
|
|
@@ -1600,7 +1607,7 @@ function buildDependencyGraph(context) {
|
|
|
1600
1607
|
if (component.preset_id) {
|
|
1601
1608
|
const preset = spaceState.local.presets.find((p) => p.id === component.preset_id);
|
|
1602
1609
|
if (preset) {
|
|
1603
|
-
const presetId = `preset:${preset.
|
|
1610
|
+
const presetId = `preset:${preset.id}`;
|
|
1604
1611
|
addDependency(componentId, presetId);
|
|
1605
1612
|
}
|
|
1606
1613
|
}
|
|
@@ -1621,7 +1628,7 @@ function buildDependencyGraph(context) {
|
|
|
1621
1628
|
}
|
|
1622
1629
|
});
|
|
1623
1630
|
spaceState.local.presets.forEach((preset) => {
|
|
1624
|
-
const presetId = `preset:${preset.
|
|
1631
|
+
const presetId = `preset:${preset.id}`;
|
|
1625
1632
|
const component = spaceState.local.components.find((c) => c.id === preset.component_id);
|
|
1626
1633
|
if (component) {
|
|
1627
1634
|
const componentId = `component:${component.name}`;
|
|
@@ -1948,7 +1955,7 @@ class ComponentNode extends GraphNode {
|
|
|
1948
1955
|
if (this.sourceData.preset_id) {
|
|
1949
1956
|
const preset = this.findPresetById(this.sourceData.preset_id, graph);
|
|
1950
1957
|
if (preset) {
|
|
1951
|
-
const presetNodeId = `preset:${preset.
|
|
1958
|
+
const presetNodeId = `preset:${preset.id}`;
|
|
1952
1959
|
const presetNode = graph.nodes.get(presetNodeId);
|
|
1953
1960
|
if (presetNode?.targetData) {
|
|
1954
1961
|
updatedData.preset_id = presetNode.targetData.id;
|
|
@@ -2027,7 +2034,7 @@ class PresetNode {
|
|
|
2027
2034
|
constructor(preset, targetData) {
|
|
2028
2035
|
this.sourceData = preset;
|
|
2029
2036
|
this.targetData = targetData;
|
|
2030
|
-
this.id = `preset:${preset.
|
|
2037
|
+
this.id = `preset:${preset.id}`;
|
|
2031
2038
|
this.name = preset.name;
|
|
2032
2039
|
}
|
|
2033
2040
|
getName() {
|
|
@@ -2527,7 +2534,11 @@ componentsCommand.command("push [componentName]").description(`Push your space's
|
|
|
2527
2534
|
}
|
|
2528
2535
|
if (presets) {
|
|
2529
2536
|
presets.forEach((preset) => {
|
|
2530
|
-
|
|
2537
|
+
const targetComponent = components?.find((c) => c.id === preset.component_id);
|
|
2538
|
+
if (targetComponent) {
|
|
2539
|
+
const compositeKey = `${targetComponent.name}:${preset.name}`;
|
|
2540
|
+
spaceState.target.presets.set(compositeKey, preset);
|
|
2541
|
+
}
|
|
2531
2542
|
});
|
|
2532
2543
|
}
|
|
2533
2544
|
if (internalTags) {
|
|
@@ -4046,7 +4057,7 @@ typesCommand.command("generate").description("Generate types d.ts for your compo
|
|
|
4046
4057
|
}
|
|
4047
4058
|
});
|
|
4048
4059
|
|
|
4049
|
-
const version = "4.0.
|
|
4060
|
+
const version = "4.0.5";
|
|
4050
4061
|
const pkg = {
|
|
4051
4062
|
version: version};
|
|
4052
4063
|
|