@torpor/view 1.4.0 → 1.4.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.
- package/dist/compile.cjs +127 -32
- package/dist/compile.d.cts +10 -0
- package/dist/compile.d.cts.map +1 -1
- package/dist/compile.d.mts +10 -0
- package/dist/compile.d.mts.map +1 -1
- package/dist/compile.mjs +127 -32
- package/dist/compile.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compile.cjs
CHANGED
|
@@ -1085,6 +1085,7 @@ function forVarBindingsFor(status, names) {
|
|
|
1085
1085
|
return collectBindings$1(status, (forVar) => names.has(forVar.name));
|
|
1086
1086
|
}
|
|
1087
1087
|
function collectBindings$1(status, include) {
|
|
1088
|
+
if (status.options.check === true) return "";
|
|
1088
1089
|
const bound = /* @__PURE__ */ new Set();
|
|
1089
1090
|
let result = "";
|
|
1090
1091
|
for (let i = status.forVars.length - 1; i >= 0; i--) {
|
|
@@ -1202,7 +1203,8 @@ function buildAddFragment(node, status, b, parentName, anchorName) {
|
|
|
1202
1203
|
const fragment = node.fragment;
|
|
1203
1204
|
const fragmentName = `t_fragment_${fragment.number}`;
|
|
1204
1205
|
if (fragment.effects.length > 0) {
|
|
1205
|
-
status.
|
|
1206
|
+
const check = status.options.check === true;
|
|
1207
|
+
if (!check) status.imports.add("$run");
|
|
1206
1208
|
let forVarMask;
|
|
1207
1209
|
for (let effect of fragment.effects) if (effect.forVarMask !== void 0) {
|
|
1208
1210
|
if (forVarMask === void 0) forVarMask = 0;
|
|
@@ -1210,11 +1212,11 @@ function buildAddFragment(node, status, b, parentName, anchorName) {
|
|
|
1210
1212
|
}
|
|
1211
1213
|
let trailing = "";
|
|
1212
1214
|
if (forVarMask !== void 0) trailing = `, undefined, { forVarMask: ${forVarMask} }`;
|
|
1213
|
-
b.append("$run(() => {");
|
|
1215
|
+
b.append(check ? "(() => {" : "$run(() => {");
|
|
1214
1216
|
appendForVarBindings(b, status, fragment.effects.map((e) => e.functionBody).join("\n"));
|
|
1215
1217
|
if (status.options.mapped === true) for (let effect of fragment.effects) addMappedTextWithOffsets("", effect.functionBody, "", effect.spans, effect.offsets, effect.lengths, status, b);
|
|
1216
1218
|
else b.append(fragment.effects.map((e) => e.functionBody).join("\n"));
|
|
1217
|
-
b.append(`}${status.options.dev === true ? `, "setAttributes"${trailing}` : trailing});`);
|
|
1219
|
+
b.append(check ? "})();" : `}${status.options.dev === true ? `, "setAttributes"${trailing}` : trailing});`);
|
|
1218
1220
|
}
|
|
1219
1221
|
if (fragment.singleRootElement) {
|
|
1220
1222
|
status.imports.add("t_add_element");
|
|
@@ -1677,10 +1679,16 @@ function buildRun(functionName, functionBody, status, b) {
|
|
|
1677
1679
|
trailing = `, "${functionName}"`;
|
|
1678
1680
|
if (forVarMask !== void 0) trailing += `, { forVarMask: ${forVarMask} }`;
|
|
1679
1681
|
} else if (forVarMask !== void 0) trailing = `, undefined, { forVarMask: ${forVarMask} }`;
|
|
1680
|
-
status.
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1682
|
+
if (status.options.check === true) {
|
|
1683
|
+
b.append("(() => {");
|
|
1684
|
+
b.append(functionBody);
|
|
1685
|
+
b.append("})();");
|
|
1686
|
+
} else {
|
|
1687
|
+
status.imports.add("$run");
|
|
1688
|
+
b.append("$run(() => {");
|
|
1689
|
+
b.append(functionBody);
|
|
1690
|
+
b.append(`}${trailing});`);
|
|
1691
|
+
}
|
|
1684
1692
|
addPopDevBoundary(status, b);
|
|
1685
1693
|
}
|
|
1686
1694
|
//#endregion
|
|
@@ -1862,7 +1870,8 @@ function buildComponentNode(node, status, b, root = false) {
|
|
|
1862
1870
|
slot.hasSlotProps ? "$slot: Record<PropertyKey, any>" : "_$slot?: Record<PropertyKey, any>",
|
|
1863
1871
|
fillUsesContext(slot) ? "$context?: Record<PropertyKey, any>" : "_$context?: Record<PropertyKey, any>"
|
|
1864
1872
|
];
|
|
1865
|
-
|
|
1873
|
+
const check = status.options.check === true;
|
|
1874
|
+
b.append(check ? `((\n${slotParams.join(",\n")}\n) => {` : `${slot.hasSlotProps ? "// @ts-ignore\n" : ""}${slotsName}["${slotName}"] = (\n${slotParams.join(",\n")}\n) => {`);
|
|
1866
1875
|
buildFragment(slot, status, b, "$sparent", "$sanchor");
|
|
1867
1876
|
status.fragmentStack.push({
|
|
1868
1877
|
fragment: slot.fragment,
|
|
@@ -1871,7 +1880,7 @@ function buildComponentNode(node, status, b, root = false) {
|
|
|
1871
1880
|
for (let child of slot.children) buildNode(child, status, b, "$sparent", "$sanchor");
|
|
1872
1881
|
status.fragmentStack.pop();
|
|
1873
1882
|
buildAddFragment(slot, status, b, "$sparent", "$sanchor");
|
|
1874
|
-
b.append(`}`);
|
|
1883
|
+
b.append(check ? "})(null!, null, {}, undefined);" : `}`);
|
|
1875
1884
|
}
|
|
1876
1885
|
}
|
|
1877
1886
|
let renderParams = `${node.parentName}, ${node.varName}, ${propsName}, $context`;
|
|
@@ -1885,6 +1894,49 @@ function buildComponentNode(node, status, b, root = false) {
|
|
|
1885
1894
|
b.append("");
|
|
1886
1895
|
}
|
|
1887
1896
|
//#endregion
|
|
1897
|
+
//#region src/compile/build/client/checkCallbacks.ts
|
|
1898
|
+
/**
|
|
1899
|
+
* Helpers for the callbacks that control blocks (`@if`, `@switch`, `@await`,
|
|
1900
|
+
* …) pass to their runtime functions. A check build (`BuildOptions.check`)
|
|
1901
|
+
* calls each callback in place instead, as an immediately-invoked function,
|
|
1902
|
+
* because TypeScript carries narrowing into those but not into callbacks
|
|
1903
|
+
* passed elsewhere: `@if ($props.user) { {$props.user.name} }` then type
|
|
1904
|
+
* checks as it reads.
|
|
1905
|
+
*/
|
|
1906
|
+
/** The callback's parameters: the insertion point, except in the head. */
|
|
1907
|
+
function controlParams(status) {
|
|
1908
|
+
return status.inHead ? "" : "t_before";
|
|
1909
|
+
}
|
|
1910
|
+
/** The arguments a check build calls a callback with, matching its parameters. */
|
|
1911
|
+
function controlArgs(params) {
|
|
1912
|
+
return params.split(",").map((p) => p.trim()).filter((p) => p !== "").map((p) => p === "t_before" ? "null as Node | null" : "undefined as any").join(", ");
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Opens a control block's callback.
|
|
1916
|
+
*
|
|
1917
|
+
* @param call The runtime call up to the callback, e.g. `t_run_control(region, anchor, `
|
|
1918
|
+
* @param params The callback's parameters, by default `t_before` (or none in the head)
|
|
1919
|
+
*/
|
|
1920
|
+
function openControl(call, status, params = controlParams(status)) {
|
|
1921
|
+
return status.options.check === true ? `((${params}) => {` : `${call}(${params}) => {`;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Closes a control block's callback and opens the next one, for runtime
|
|
1925
|
+
* calls that take several (e.g. `@await`'s content and `@with` branches).
|
|
1926
|
+
*/
|
|
1927
|
+
function nextControl(status, params = controlParams(status), previousParams = controlParams(status)) {
|
|
1928
|
+
return status.options.check === true ? `})(${controlArgs(previousParams)});\n((${params}) => {` : `}, (${params}) => {`;
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Closes a control block's last callback, and the runtime call.
|
|
1932
|
+
*
|
|
1933
|
+
* @param trailing The runtime call's remaining arguments, e.g. `, "runIf"`
|
|
1934
|
+
* @param params The callback's parameters, to call it with in a check build
|
|
1935
|
+
*/
|
|
1936
|
+
function closeControl(trailing, status, params = controlParams(status)) {
|
|
1937
|
+
return status.options.check === true ? `})(${controlArgs(params)});` : `}${trailing});`;
|
|
1938
|
+
}
|
|
1939
|
+
//#endregion
|
|
1888
1940
|
//#region src/compile/build/client/buildAwaitNode.ts
|
|
1889
1941
|
function buildAwaitNode(node, status, b) {
|
|
1890
1942
|
const anchorName = node.varName ?? "null";
|
|
@@ -1900,7 +1952,7 @@ function buildAwaitNode(node, status, b) {
|
|
|
1900
1952
|
addPushDevBoundary("control", "@await", status, b);
|
|
1901
1953
|
b.append(`
|
|
1902
1954
|
const ${regionName} = t_region(${status.options.dev === true ? `"await"` : ""});
|
|
1903
|
-
t_run_await(${regionName}, ${anchorName},
|
|
1955
|
+
${openControl(`t_run_await(${regionName}, ${anchorName}, `, status)}`);
|
|
1904
1956
|
appendForVarBindings(b, status);
|
|
1905
1957
|
if (awaitBranch !== void 0 && awaitBranch.children.length > 0) {
|
|
1906
1958
|
buildFragment(awaitBranch, status, b, parentName, "t_before");
|
|
@@ -1913,7 +1965,7 @@ function buildAwaitNode(node, status, b) {
|
|
|
1913
1965
|
buildAddFragment(awaitBranch, status, b, parentName, "t_before");
|
|
1914
1966
|
}
|
|
1915
1967
|
if (withBranch !== void 0) {
|
|
1916
|
-
b.append(
|
|
1968
|
+
b.append(nextControl(status));
|
|
1917
1969
|
appendForVarBindings(b, status);
|
|
1918
1970
|
if (withBranch.children.length > 0) {
|
|
1919
1971
|
buildFragment(withBranch, status, b, parentName, "t_before");
|
|
@@ -1925,8 +1977,8 @@ function buildAwaitNode(node, status, b) {
|
|
|
1925
1977
|
status.fragmentStack.pop();
|
|
1926
1978
|
buildAddFragment(withBranch, status, b, parentName, "t_before");
|
|
1927
1979
|
}
|
|
1928
|
-
b.append(
|
|
1929
|
-
} else b.append(
|
|
1980
|
+
b.append(closeControl(status.options.dev === true ? `, "runAwait"` : "", status));
|
|
1981
|
+
} else b.append(closeControl(`, null${status.options.dev === true ? `, "runAwait"` : ""}`, status));
|
|
1930
1982
|
addPopDevBoundary(status, b);
|
|
1931
1983
|
b.append("");
|
|
1932
1984
|
}
|
|
@@ -2423,6 +2475,10 @@ function buildForNode(node, status, b) {
|
|
|
2423
2475
|
for (const name of reassignedForVars) addBuildError(status, `Cannot assign to loop variable "${name}": a @for loop variable is read-only. Assign to a property of the item (\`${name}.foo = …\`) instead, or mutate the source collection directly.`, node.span.start, node.span.end);
|
|
2424
2476
|
const singleVar = noWatch && forVarNames.length === 1;
|
|
2425
2477
|
const leafRow = isForBodyLeafSafe(node.children);
|
|
2478
|
+
if (status.options.check === true) {
|
|
2479
|
+
buildCheckForNode(node, status, b, parentName, forVarNames, keyStatement, key, itemName, beforeName, leafRow);
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2426
2482
|
status.imports.add("t_region");
|
|
2427
2483
|
status.imports.add("t_run_list");
|
|
2428
2484
|
status.imports.add("ListItemSpec");
|
|
@@ -2482,6 +2538,32 @@ ${status.options.dev === true ? "function updateListItem(t_old_item, t_new_item)
|
|
|
2482
2538
|
addPopDevBoundary(status, b);
|
|
2483
2539
|
b.append("");
|
|
2484
2540
|
}
|
|
2541
|
+
/**
|
|
2542
|
+
* Builds a `@for` for type checking only (see `BuildOptions.check`): the loop
|
|
2543
|
+
* runs in place, with each row's body called inside it, so loop variables
|
|
2544
|
+
* keep the types of the iterable's items and narrowing from around the loop
|
|
2545
|
+
* carries into it.
|
|
2546
|
+
*/
|
|
2547
|
+
function buildCheckForNode(node, status, b, parentName, forVarNames, keyStatement, key, itemName, beforeName, leafRow) {
|
|
2548
|
+
b.append("");
|
|
2549
|
+
b.append("/* @for */");
|
|
2550
|
+
b.append("(() => {");
|
|
2551
|
+
addMappedText("", `${node.statement}`, " {", node.span, status, b);
|
|
2552
|
+
if (key !== void 0 && keyStatement) addMappedText("void (", keyStatement, ");", key.span, status, b);
|
|
2553
|
+
b.append(`((${itemName}: any, ${beforeName}: Node | null) => {`);
|
|
2554
|
+
const oldForVars = status.forVars;
|
|
2555
|
+
status.forVars = [...oldForVars, ...forVarNames.map((v) => ({
|
|
2556
|
+
name: v,
|
|
2557
|
+
path: `${itemName}.data.${v}`,
|
|
2558
|
+
shadow: true
|
|
2559
|
+
}))];
|
|
2560
|
+
buildForItem(node, status, b, parentName, beforeName, itemName, leafRow);
|
|
2561
|
+
status.forVars = oldForVars;
|
|
2562
|
+
b.append("})(undefined, null);");
|
|
2563
|
+
b.append("}");
|
|
2564
|
+
b.append("})();");
|
|
2565
|
+
b.append("");
|
|
2566
|
+
}
|
|
2485
2567
|
function buildForItem(node, status, b, parentName, beforeName, itemName, leafRow) {
|
|
2486
2568
|
const oldRegionName = nextVarName("old_region", status);
|
|
2487
2569
|
if (!leafRow) {
|
|
@@ -2510,6 +2592,13 @@ function buildHtmlNode(node, status, b) {
|
|
|
2510
2592
|
const htmlAnchorName = node.varName;
|
|
2511
2593
|
const htmlParentName = node.parentName || htmlAnchorName + ".parentNode";
|
|
2512
2594
|
node = node.children[0];
|
|
2595
|
+
if (status.options.check === true) {
|
|
2596
|
+
b.append("");
|
|
2597
|
+
b.append(`/* @html */`);
|
|
2598
|
+
addMappedText("", node.statement, ";", node.span, status, b);
|
|
2599
|
+
b.append("");
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2513
2602
|
status.imports.add("t_region");
|
|
2514
2603
|
status.imports.add("t_run_control");
|
|
2515
2604
|
const firstNodeVar = nextVarName("html_first", status);
|
|
@@ -2589,11 +2678,11 @@ function buildIfNode(node, status, b) {
|
|
|
2589
2678
|
b.append(`
|
|
2590
2679
|
const ${regionName} = t_region(${status.options.dev === true ? `"if"` : ""});
|
|
2591
2680
|
let ${indexName} = -1;
|
|
2592
|
-
t_run_control(${regionName}, ${anchorName},
|
|
2681
|
+
${openControl(`t_run_control(${regionName}, ${anchorName}, `, status)}`);
|
|
2593
2682
|
appendForVarBindings(b, status);
|
|
2594
2683
|
let index = 0;
|
|
2595
2684
|
for (let branch of branches) buildIfBranch(branch, status, b, parentName, regionName, indexName, index++);
|
|
2596
|
-
b.append(
|
|
2685
|
+
b.append(closeControl(status.options.dev === true ? `, "runIf"` : "", status));
|
|
2597
2686
|
addPopDevBoundary(status, b);
|
|
2598
2687
|
b.append("");
|
|
2599
2688
|
}
|
|
@@ -2630,10 +2719,10 @@ function buildReplaceNode(node, status, b) {
|
|
|
2630
2719
|
b.append(`
|
|
2631
2720
|
/* @replace */
|
|
2632
2721
|
const ${replaceRegionName} = t_region(${status.options.dev === true ? `"replace"` : ""});
|
|
2633
|
-
t_run_control(${replaceRegionName}, ${replaceAnchorName},
|
|
2722
|
+
${openControl(`t_run_control(${replaceRegionName}, ${replaceAnchorName}, `, status, "t_before")}`);
|
|
2634
2723
|
appendForVarBindings(b, status);
|
|
2635
2724
|
buildReplaceBranch(node, status, b, replaceParentName, replaceRegionName);
|
|
2636
|
-
b.append(
|
|
2725
|
+
b.append(closeControl(status.options.dev === true ? ", \"replace\"" : "", status, "t_before"));
|
|
2637
2726
|
b.append("");
|
|
2638
2727
|
}
|
|
2639
2728
|
function buildReplaceBranch(node, status, b, parentName, regionName) {
|
|
@@ -2690,14 +2779,13 @@ function buildSwitchNode(node, status, b) {
|
|
|
2690
2779
|
b.append(`
|
|
2691
2780
|
const ${regionName} = t_region(${status.options.dev === true ? `"switch"` : ""});
|
|
2692
2781
|
let ${indexName} = -1;
|
|
2693
|
-
t_run_control(${regionName}, ${anchorName},
|
|
2782
|
+
${openControl(`t_run_control(${regionName}, ${anchorName}, `, status)}`);
|
|
2694
2783
|
appendForVarBindings(b, status);
|
|
2695
2784
|
addMappedText("", `${node.statement}`, " {", node.span, status, b);
|
|
2696
2785
|
let index = 0;
|
|
2697
2786
|
for (let branch of branches) buildSwitchBranch(branch, status, b, parentName, regionName, indexName, index++);
|
|
2698
|
-
b.append(
|
|
2699
|
-
|
|
2700
|
-
}${status.options.dev === true ? `, "runSwitch"` : ""});`);
|
|
2787
|
+
b.append("}");
|
|
2788
|
+
b.append(closeControl(status.options.dev === true ? `, "runSwitch"` : "", status));
|
|
2701
2789
|
addPopDevBoundary(status, b);
|
|
2702
2790
|
b.append("");
|
|
2703
2791
|
}
|
|
@@ -2755,16 +2843,20 @@ function buildTryNode(node, status, b) {
|
|
|
2755
2843
|
addPushDevBoundary("control", "@try", status, b);
|
|
2756
2844
|
b.append(`
|
|
2757
2845
|
const ${regionName} = t_region(${status.options.dev === true ? `"try"` : ""});
|
|
2758
|
-
t_run_try(${regionName}, ${anchorName},
|
|
2846
|
+
${openControl(`t_run_try(${regionName}, ${anchorName}, `, status)}`);
|
|
2759
2847
|
appendForVarBindings(b, status);
|
|
2760
2848
|
buildTryBranchBody(tryBranch, status, b, parentName);
|
|
2761
2849
|
const catchVar = catchBranch ? trimMatched(catchBranch.statement.substring(5).trim(), "(", ")") || "err" : null;
|
|
2762
2850
|
if (catchBranch && catchVar) {
|
|
2763
|
-
|
|
2851
|
+
const catchParams = `${status.inHead ? "" : "t_before"}, ${catchVar}`;
|
|
2852
|
+
if (status.options.check === true) {
|
|
2853
|
+
b.append(closeControl("", status));
|
|
2854
|
+
addMappedText("", `((${catchParams}) => {`, "", catchBranch.span, status, b);
|
|
2855
|
+
} else addMappedText("},", `(${catchParams}) => {`, "", catchBranch.span, status, b);
|
|
2764
2856
|
appendForVarBindings(b, status);
|
|
2765
2857
|
buildTryBranchBody(catchBranch, status, b, parentName);
|
|
2766
|
-
b.append(
|
|
2767
|
-
} else b.append(
|
|
2858
|
+
b.append(closeControl(status.options.dev === true ? `, "runTry"` : "", status, catchParams));
|
|
2859
|
+
} else b.append(closeControl(`, null${status.options.dev === true ? `, "runTry"` : ""}`, status));
|
|
2768
2860
|
addPopDevBoundary(status, b);
|
|
2769
2861
|
b.append("");
|
|
2770
2862
|
}
|
|
@@ -2932,10 +3024,13 @@ function buildDynamicElementNode(node, status, b) {
|
|
|
2932
3024
|
status.imports.add("t_dynamic");
|
|
2933
3025
|
let selfValue = selfAttribute.value;
|
|
2934
3026
|
if (selfAttribute.fullyReactive) {
|
|
2935
|
-
status.
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
3027
|
+
if (status.options.check === true) b.append(`${node.varName} = t_dynamic(${node.varName}, ${selfValue});`);
|
|
3028
|
+
else {
|
|
3029
|
+
status.imports.add("$run");
|
|
3030
|
+
b.append("$run(() => {");
|
|
3031
|
+
b.append(`${node.varName} = t_dynamic(${node.varName}, ${selfValue});`);
|
|
3032
|
+
b.append(`}${status.options.dev === true ? `, "setDynamic"` : ""});`);
|
|
3033
|
+
}
|
|
2939
3034
|
} else b.append(`${node.varName} = t_dynamic(${node.varName}, ${selfValue});`);
|
|
2940
3035
|
}
|
|
2941
3036
|
buildElementAttributes$1(node, node.varName, status, b);
|
|
@@ -3518,7 +3613,7 @@ function buildTemplate(template, map, imports, b, options, errors = [], warnings
|
|
|
3518
3613
|
status.imports.add("t_region");
|
|
3519
3614
|
status.imports.add("t_run_try");
|
|
3520
3615
|
b.append(`const t_error_region = t_region();`);
|
|
3521
|
-
b.append(`t_run_try(t_error_region, $anchor, () => {`);
|
|
3616
|
+
b.append(status.options.check === true ? "(() => {" : `t_run_try(t_error_region, $anchor, () => {`);
|
|
3522
3617
|
}
|
|
3523
3618
|
buildFragmentText(current.markup, status, b);
|
|
3524
3619
|
b.append("");
|
|
@@ -3526,13 +3621,13 @@ function buildTemplate(template, map, imports, b, options, errors = [], warnings
|
|
|
3526
3621
|
}
|
|
3527
3622
|
} else if (chunk.script === "/* @error */") {
|
|
3528
3623
|
if (current.markup && current.error) {
|
|
3529
|
-
b.append(`}, (_, ${current.errorVar ?? "err"}) => {`);
|
|
3624
|
+
b.append(status.options.check === true ? `})();\n((_: Node | null, ${current.errorVar ?? "err"}: any) => {` : `}, (_, ${current.errorVar ?? "err"}) => {`);
|
|
3530
3625
|
b.append("");
|
|
3531
3626
|
b.append("/* User interface error */");
|
|
3532
3627
|
buildFragmentText(current.error, status, b);
|
|
3533
3628
|
b.append("");
|
|
3534
3629
|
buildNode(current.error, status, b, "$parent", "$anchor", true);
|
|
3535
|
-
b.append(`}${status.options.dev === true ? ", \"runError\"" : ""});`);
|
|
3630
|
+
b.append(status.options.check === true ? "})(null, undefined);" : `}${status.options.dev === true ? ", \"runError\"" : ""});`);
|
|
3536
3631
|
}
|
|
3537
3632
|
} else if (chunk.script === "/* @head */") {
|
|
3538
3633
|
if (current.head) {
|
package/dist/compile.d.cts
CHANGED
|
@@ -148,6 +148,16 @@ interface BuildOptions {
|
|
|
148
148
|
* Whether to create source maps
|
|
149
149
|
*/
|
|
150
150
|
mapped?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether to build the client code for type checking only (e.g. by
|
|
153
|
+
* `@torpor/check`). The output isn't meant to run: the callbacks the
|
|
154
|
+
* runtime would call later (effects, control branches, list rows, slot
|
|
155
|
+
* fills) are called in place instead, and `@for` bodies are written
|
|
156
|
+
* inside the loop, so that TypeScript sees the same control flow as the
|
|
157
|
+
* template -- narrowing from an `@if` carries into its block, and loop
|
|
158
|
+
* variables keep their types.
|
|
159
|
+
*/
|
|
160
|
+
check?: boolean;
|
|
151
161
|
/**
|
|
152
162
|
* Whether to add debugging info etc for development mode
|
|
153
163
|
*/
|
package/dist/compile.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.cts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/types/ParseOptions.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ;;EAER;EACA,OAAO;EACP,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UC3BwB;EACxB,QAAQ;EACR,YAAY;;;;UCRY;;;;EAIxB;;;;EAIA;;;;EAIA;;;;;;;EAOA;;;;EAIA;;;;;;;;EAQA;;;;;;EAMA;;;;
|
|
1
|
+
{"version":3,"file":"compile.d.cts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/types/ParseOptions.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM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R;EAAgB;EAAc,OAAO;EAAuB,OAAO;;EAOrE;EACA;EACA,OAAO;EACP,UAAU;EACV;;UAGc;;EAEhB;EACA,UAAU;;;UAIM;;EAEhB;;EAEA;EACA,MAAM,eAAe;;UAGL;EAChB;EACA;EACA,QAAQ;;;;;;;EAOR,QAAQ;;UAGQ;EAChB;EACA,MAAM;;UAGU;;EAEhB,cAAc;EACd,YAAY;;UAGI;EAChB,SAAS;EACT;IACC;IACA;;EAED,QALSA;;UAQO;;EAEhB;;EAEA;;UAGgB;EAChB;EACA,MAAM;;EAEN;EACA;EACA;;KAGW,sCACX,MAAM,uBACN,SAAS,iBAAiB,eAAe,sBACzC,UAAU;;;UCvKM,+BAA+B;;;;;;;;;;;iBAiCxB,gBACvB,UAAU,UACV,UAAU,yBACR;;;;;;;;;;;iBCtDqB,UAAU,UAAU,UAAU,UAAU;;;UCTvC;EACxB;EACA,QAAQ;EACR,WAAW;;;;UCNa;;;;;;;;;EASxB;;;;;;;;;;;;;iBCIuB,MAAM,gBAAgB,UAAU,eAAe;;;;;;;;;iBCL/C,iBAAiB,UAAU;;;;;;;;;;;;;;;;;;;;;;qBCctC,8BAA8B;;EAE1C;;EAEA;EAEA,YAAY,iBAAiB,eAAe;;UAwP5B;EAChB,YAAY;;EAEZ;;UAGgB;;;;;;EAMhB;;;;;;;wBAuBe,sBACf,gBACA,iBACA,UAAU,yBACR"}
|
package/dist/compile.d.mts
CHANGED
|
@@ -148,6 +148,16 @@ interface BuildOptions {
|
|
|
148
148
|
* Whether to create source maps
|
|
149
149
|
*/
|
|
150
150
|
mapped?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether to build the client code for type checking only (e.g. by
|
|
153
|
+
* `@torpor/check`). The output isn't meant to run: the callbacks the
|
|
154
|
+
* runtime would call later (effects, control branches, list rows, slot
|
|
155
|
+
* fills) are called in place instead, and `@for` bodies are written
|
|
156
|
+
* inside the loop, so that TypeScript sees the same control flow as the
|
|
157
|
+
* template -- narrowing from an `@if` carries into its block, and loop
|
|
158
|
+
* variables keep their types.
|
|
159
|
+
*/
|
|
160
|
+
check?: boolean;
|
|
151
161
|
/**
|
|
152
162
|
* Whether to add debugging info etc for development mode
|
|
153
163
|
*/
|
package/dist/compile.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.mts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/types/ParseOptions.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ;;EAER;EACA,OAAO;EACP,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UC3BwB;EACxB,QAAQ;EACR,YAAY;;;;UCRY;;;;EAIxB;;;;EAIA;;;;EAIA;;;;;;;EAOA;;;;EAIA;;;;;;;;EAQA;;;;;;EAMA;;;;
|
|
1
|
+
{"version":3,"file":"compile.d.mts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/types/ParseOptions.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ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