@firsthandjs/compiler 0.9.0 → 0.9.1
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.
|
@@ -920,7 +920,12 @@ function compileComponent(path, state) {
|
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
const
|
|
923
|
+
const throughRunCell = (value) => t.callExpression(throughCell(t.arrowFunctionExpression([], value)), []);
|
|
924
|
+
const children = compileChildren(node.children, state, {
|
|
925
|
+
depends: (value) => dependsOnRun(value, run, path),
|
|
926
|
+
cell: throughRunCell,
|
|
927
|
+
value: throughCell
|
|
928
|
+
});
|
|
924
929
|
if (children.length === 1) {
|
|
925
930
|
properties.push(
|
|
926
931
|
t.objectMethod(
|
|
@@ -1733,7 +1738,7 @@ function cleanText(value) {
|
|
|
1733
1738
|
}
|
|
1734
1739
|
return kept.join(" ");
|
|
1735
1740
|
}
|
|
1736
|
-
function compileChildren(children, state) {
|
|
1741
|
+
function compileChildren(children, state, kept) {
|
|
1737
1742
|
const result = [];
|
|
1738
1743
|
for (const entry of planChildren(children)) {
|
|
1739
1744
|
if (entry.kind === "text") {
|
|
@@ -1743,15 +1748,27 @@ function compileChildren(children, state) {
|
|
|
1743
1748
|
} else if (state.firsthand.ssr) {
|
|
1744
1749
|
result.push(entry.expression);
|
|
1745
1750
|
} else if (entry.kind === "list") {
|
|
1746
|
-
|
|
1751
|
+
const list = entry.expression;
|
|
1752
|
+
keepReading(list, kept);
|
|
1753
|
+
result.push(t.callExpression(runtime(state, "part"), [list]));
|
|
1747
1754
|
} else {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
);
|
|
1755
|
+
const value = entry.expression;
|
|
1756
|
+
const read = kept !== void 0 && kept.depends(value) ? kept.cell(value) : value;
|
|
1757
|
+
result.push(t.callExpression(runtime(state, "part"), [thunk(read)]));
|
|
1751
1758
|
}
|
|
1752
1759
|
}
|
|
1753
1760
|
return result;
|
|
1754
1761
|
}
|
|
1762
|
+
function keepReading(list, kept) {
|
|
1763
|
+
const each = list.arguments[0];
|
|
1764
|
+
if (kept === void 0 || !t.isArrowFunctionExpression(each) || !t.isExpression(each.body)) {
|
|
1765
|
+
return;
|
|
1766
|
+
}
|
|
1767
|
+
if (!kept.depends(each.body)) {
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1770
|
+
each.body = kept.value(each.body);
|
|
1771
|
+
}
|
|
1755
1772
|
function thunk(expression) {
|
|
1756
1773
|
const arrow = t.arrowFunctionExpression([], expression);
|
|
1757
1774
|
arrow[CHILD_THUNK] = true;
|
package/dist/index.js
CHANGED
package/dist/vite.js
CHANGED
package/package.json
CHANGED