@vesk/compiler 0.2.94 → 0.2.96
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/client-codegen.d.ts.map +1 -1
- package/dist/client-codegen.js +196 -34
- package/dist/ir.d.ts +6 -0
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +15 -0
- package/dist/router.d.ts +1 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +17 -2
- package/dist/server-jsgen.d.ts.map +1 -1
- package/dist/server-jsgen.js +14 -2
- package/dist/typecheck.d.ts +1 -1
- package/dist/typecheck.d.ts.map +1 -1
- package/dist/typecheck.js +5 -9
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-codegen.d.ts","sourceRoot":"","sources":["../src/client-codegen.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAGL,cAAc,EAQd,gBAAgB,
|
|
1
|
+
{"version":3,"file":"client-codegen.d.ts","sourceRoot":"","sources":["../src/client-codegen.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAGL,cAAc,EAQd,gBAAgB,EAWjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAkGxD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1D;AAiDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAgJlI;AAID,wBAAg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I,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAyC5J;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/E;AAED,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/client-codegen.js
CHANGED
|
@@ -2,7 +2,7 @@ import { walk } from 'zimmerframe';
|
|
|
2
2
|
import { print } from 'esrap';
|
|
3
3
|
import ts from 'esrap/languages/ts';
|
|
4
4
|
import tsx from 'esrap/languages/tsx';
|
|
5
|
-
import { StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, WhileLoop, SwitchBlock, TryCatch, ForLoop, TrackDecl, RuntimeStatement, BreakSignal, ComponentRef, ComponentCall, ServerBlock, ClientBlock, HeadBlock, SlotNode, PropSlot, PropSlotRender, } from '@vesk/compiler/src/ir';
|
|
5
|
+
import { StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, WhileLoop, SwitchBlock, TryCatch, ForLoop, TrackDecl, RuntimeStatement, BreakSignal, ComponentRef, ComponentCall, regionMarkerId, ServerBlock, ClientBlock, HeadBlock, SlotNode, PropSlot, PropSlotRender, } from '@vesk/compiler/src/ir';
|
|
6
6
|
import { parse } from '@vesk/compiler/src/parser';
|
|
7
7
|
import { generateIR } from '@vesk/compiler/src/ir-generator';
|
|
8
8
|
import { transformTopLevelForActions } from '@vesk/compiler/src/actions';
|
|
@@ -535,6 +535,10 @@ class Ctx {
|
|
|
535
535
|
markerless = true;
|
|
536
536
|
inTryBody = false;
|
|
537
537
|
claimStatic = false;
|
|
538
|
+
// Markerless only: the next real claim carries a compiler-generated static
|
|
539
|
+
// class descriptor so a same-tag but structurally different SSR slot is
|
|
540
|
+
// substituted instead of adopted (e.g. an empty-state <div> vs a list <div>).
|
|
541
|
+
descriptorClaim = false;
|
|
538
542
|
// While set, the next StaticNode claimed in hydrate mode uses `__root` (the
|
|
539
543
|
// item element already claimed by key) instead of walking for a new element.
|
|
540
544
|
rootClaim = false;
|
|
@@ -739,6 +743,24 @@ const PROPERTY_ATTRS = {
|
|
|
739
743
|
option: new Set(['selected']),
|
|
740
744
|
progress: new Set(['value']),
|
|
741
745
|
};
|
|
746
|
+
/**
|
|
747
|
+
* Build the markerless structural descriptor for a claimed element. Only a
|
|
748
|
+
* source-authored static class is included: dynamic classes are runtime values
|
|
749
|
+
* and must never be validated (SSR/client first paint may legitimately differ).
|
|
750
|
+
* The descriptor is a JS-only argument to the walker; it never reaches SSR HTML.
|
|
751
|
+
*/
|
|
752
|
+
function staticClassDescriptor(node) {
|
|
753
|
+
const hasDynamicClass = node.children.some((child) => child instanceof DynamicBinding && child.kind === 'attribute' && child.target === 'class');
|
|
754
|
+
if (hasDynamicClass)
|
|
755
|
+
return null;
|
|
756
|
+
const attr = node.attributes.find((a) => a.name === 'class');
|
|
757
|
+
if (!attr)
|
|
758
|
+
return null;
|
|
759
|
+
const value = attr.value.trim();
|
|
760
|
+
if (!value)
|
|
761
|
+
return null;
|
|
762
|
+
return JSON.stringify({ class: value });
|
|
763
|
+
}
|
|
742
764
|
function emitStatic(ctx, node, tracked, effectsVar, skipK = 0, regionBudget) {
|
|
743
765
|
const el = ctx.n();
|
|
744
766
|
if (ctx.hydrate) {
|
|
@@ -762,13 +784,21 @@ function emitStatic(ctx, node, tracked, effectsVar, skipK = 0, regionBudget) {
|
|
|
762
784
|
// are claimed on their own sub-walker and carry their own residue math.
|
|
763
785
|
const skipExpr = regionBudget && ctx.markerless ? markerlessSkipExpr(regionBudget, skipK) : skipK;
|
|
764
786
|
const skipArg = ctx.markerless ? `, ${skipExpr}` : '';
|
|
787
|
+
// A component root or region branch root may be the slot where the client's
|
|
788
|
+
// initial branch differs from SSR. Validate its static class so a same-tag
|
|
789
|
+
// wrong branch is substituted, not adopted. One-shot: only the first real
|
|
790
|
+
// claim in that root/branch carries the descriptor.
|
|
791
|
+
const wantsDescriptor = ctx.markerless && ctx.descriptorClaim;
|
|
792
|
+
ctx.descriptorClaim = false;
|
|
793
|
+
const descriptor = wantsDescriptor && !rootClaim ? staticClassDescriptor(node) : null;
|
|
794
|
+
const descriptorArg = descriptor ? `, ${descriptor}` : '';
|
|
765
795
|
// `rootClaim` marks the keyed renderItem root: claimed items supply the
|
|
766
796
|
// SSR element as `__root`, fresh items must CREATE one. The walker is never
|
|
767
797
|
// valid here as a fallback — its cursor doesn't advance past claimByKey, so
|
|
768
798
|
// `nextElement` would steal a neighboring SSR node to render the new item.
|
|
769
799
|
const claimedExpr = rootClaim
|
|
770
800
|
? `__root || document.createElement(${JSON.stringify(node.tag)})`
|
|
771
|
-
: `${ctx.walker}.nextElement(${JSON.stringify(node.tag)}${skipArg})`;
|
|
801
|
+
: `${ctx.walker}.nextElement(${JSON.stringify(node.tag)}${skipArg}${descriptorArg})`;
|
|
772
802
|
ctx.push(`const ${el} = ${claimedExpr};`);
|
|
773
803
|
if (regionBudget && ctx.markerless)
|
|
774
804
|
ctx.push(`${regionBudget} = 0;`);
|
|
@@ -1388,6 +1418,11 @@ function emitComponentCall(ctx, node, tracked, effectsVar, parentVar, compPrefix
|
|
|
1388
1418
|
? `reactiveProps({ ${propsEntries.join(', ')} })`
|
|
1389
1419
|
: `{ ${propsEntries.join(', ')} }`);
|
|
1390
1420
|
if (ctx.hydrate) {
|
|
1421
|
+
// A component call is itself the root claim site. A compiled child carries
|
|
1422
|
+
// its own root descriptor; a plain target has no IR root to describe. In
|
|
1423
|
+
// either case the caller's pending branch descriptor must not leak to a
|
|
1424
|
+
// following sibling.
|
|
1425
|
+
ctx.descriptorClaim = false;
|
|
1391
1426
|
const access = calleeExpr
|
|
1392
1427
|
?? (ctx.importedNames.has(node.componentName)
|
|
1393
1428
|
? node.componentName
|
|
@@ -1771,13 +1806,14 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1771
1806
|
const hyd = ctx.hydrate;
|
|
1772
1807
|
const parent = parentVar || '$root';
|
|
1773
1808
|
const budget = hyd ? regionBudgetVar(ctx, skipK, regionBudget) : null;
|
|
1809
|
+
const rid = regionMarkerId(node);
|
|
1774
1810
|
const isOpaque = (n) => !!n && typeof n.condition !== 'undefined';
|
|
1775
1811
|
if (hyd && node.alternateNodes.length === 1 && isOpaque(node.alternateNodes[0])) {
|
|
1776
1812
|
const chain = [];
|
|
1777
1813
|
let cur = node;
|
|
1778
1814
|
let finalElse = null;
|
|
1779
1815
|
while (cur) {
|
|
1780
|
-
chain.push({ cond: transformTracked(cur.condition, tracked), nodes: cur.consequentNodes });
|
|
1816
|
+
chain.push({ cond: transformTracked(cur.condition, tracked), nodes: cur.consequentNodes, id: regionMarkerId(cur) });
|
|
1781
1817
|
if (cur.alternateNodes.length === 1 && isOpaque(cur.alternateNodes[0])) {
|
|
1782
1818
|
cur = cur.alternateNodes[0];
|
|
1783
1819
|
}
|
|
@@ -1802,6 +1838,9 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1802
1838
|
ctx.push(`const ${rn} = ${fnOpen}`);
|
|
1803
1839
|
const cl = ctx.n();
|
|
1804
1840
|
ctx.push(indent(`const ${cl} = [];`));
|
|
1841
|
+
const savedDescriptor = ctx.descriptorClaim;
|
|
1842
|
+
if (hyd && ctx.markerless)
|
|
1843
|
+
ctx.descriptorClaim = true;
|
|
1805
1844
|
for (const n of chain[i].nodes) {
|
|
1806
1845
|
const savedClaim = ctx.claimStatic;
|
|
1807
1846
|
if (hyd)
|
|
@@ -1811,6 +1850,7 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1811
1850
|
if (v)
|
|
1812
1851
|
ctx.push(indent(`${cl}.push(${v});`));
|
|
1813
1852
|
}
|
|
1853
|
+
ctx.descriptorClaim = savedDescriptor;
|
|
1814
1854
|
ctx.push(indent(`__place(${anchor}, ${endAnchor}, ${cl}, ${parent});`));
|
|
1815
1855
|
ctx.push(`};`);
|
|
1816
1856
|
}
|
|
@@ -1820,6 +1860,9 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1820
1860
|
ctx.push(`const ${finalRender} = ${fnOpen}`);
|
|
1821
1861
|
const cl2 = ctx.n();
|
|
1822
1862
|
ctx.push(indent(`const ${cl2} = [];`));
|
|
1863
|
+
const savedDescriptor = ctx.descriptorClaim;
|
|
1864
|
+
if (hyd && ctx.markerless)
|
|
1865
|
+
ctx.descriptorClaim = true;
|
|
1823
1866
|
for (const n of finalElse) {
|
|
1824
1867
|
const savedClaim = ctx.claimStatic;
|
|
1825
1868
|
if (hyd)
|
|
@@ -1829,15 +1872,10 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1829
1872
|
if (v)
|
|
1830
1873
|
ctx.push(indent(`${cl2}.push(${v});`));
|
|
1831
1874
|
}
|
|
1875
|
+
ctx.descriptorClaim = savedDescriptor;
|
|
1832
1876
|
ctx.push(indent(`__place(${anchor}, ${endAnchor}, ${cl2}, ${parent});`));
|
|
1833
1877
|
ctx.push(`};`);
|
|
1834
1878
|
}
|
|
1835
|
-
let init = `if (${chain[0].cond}) { ${asyncKw}${renderNames[0]}(); }`;
|
|
1836
|
-
for (let i = 1; i < chain.length; i++)
|
|
1837
|
-
init += ` else if (${chain[i].cond}) { ${asyncKw}${renderNames[i]}(); }`;
|
|
1838
|
-
if (finalRender)
|
|
1839
|
-
init += ` else { ${asyncKw}${finalRender}(); }`;
|
|
1840
|
-
ctx.push(init);
|
|
1841
1879
|
// Resolve which branch index the chain is in, for any chain depth. The last
|
|
1842
1880
|
// fallback is `chain.length` when a final `else` exists, otherwise -1 (no
|
|
1843
1881
|
// branch renders). Build the nested ternary from the innermost condition
|
|
@@ -1847,13 +1885,37 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1847
1885
|
branchInitFallback = `(${chain[i].cond} ? ${i} : ${branchInitFallback})`;
|
|
1848
1886
|
}
|
|
1849
1887
|
const branchInit = `(${branchInitFallback})`;
|
|
1888
|
+
// Snapshot the branch chosen by the INITIAL render before claiming it. The
|
|
1889
|
+
// effect flush runs after the component body, so a tracked cell can change
|
|
1890
|
+
// in between (bootstrap hydration, a child island's body, an inline
|
|
1891
|
+
// statement). Initializing `__iv` at flush time would silently adopt the
|
|
1892
|
+
// new branch while the DOM still held the old one; the first effect run
|
|
1893
|
+
// must compare against the branch that actually rendered.
|
|
1894
|
+
const branchSnapshot = ctx.n();
|
|
1895
|
+
ctx.push(`const ${branchSnapshot} = ${branchInit};`);
|
|
1896
|
+
if (!ctx.markerless) {
|
|
1897
|
+
for (let i = 0; i < chain.length; i++) {
|
|
1898
|
+
ctx.push(`if (__hydrate) __reconcileRegion(${parent}, '${chain[i].id}', ${branchSnapshot} === ${i} ? 0 : 1, ${ctx.walker});`);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
const chainBranches = chain.map((c) => c.nodes);
|
|
1903
|
+
if (finalElse)
|
|
1904
|
+
chainBranches.push(finalElse);
|
|
1905
|
+
emitStructuralRegionDiscard(ctx, chainBranches, branchSnapshot, budget);
|
|
1906
|
+
}
|
|
1907
|
+
let init = `if (${branchSnapshot} === 0) { ${asyncKw}${renderNames[0]}(); }`;
|
|
1908
|
+
for (let i = 1; i < chain.length; i++)
|
|
1909
|
+
init += ` else if (${branchSnapshot} === ${i}) { ${asyncKw}${renderNames[i]}(); }`;
|
|
1910
|
+
if (finalRender)
|
|
1911
|
+
init += ` else { ${asyncKw}${finalRender}(); }`;
|
|
1912
|
+
ctx.push(init);
|
|
1850
1913
|
let effInner = `if (__new === 0) { ${asyncKw}${renderNames[0]}(); }`;
|
|
1851
1914
|
for (let i = 1; i < chain.length; i++)
|
|
1852
1915
|
effInner += ` else if (__new === ${i}) { ${asyncKw}${renderNames[i]}(); }`;
|
|
1853
1916
|
if (finalRender)
|
|
1854
1917
|
effInner += ` else { ${asyncKw}${finalRender}(); }`;
|
|
1855
1918
|
const effBody = `effect(${ctx.isAsyncScope ? 'async () => {' : '() => {'}
|
|
1856
|
-
if (__first) { __first = false; __iv = ${branchInit}; return; }
|
|
1857
1919
|
const __new = ${branchInit};
|
|
1858
1920
|
if (__new !== __iv) {
|
|
1859
1921
|
for (const e of ${effectsVar}) destroy_block(e);
|
|
@@ -1865,15 +1927,13 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1865
1927
|
}, true);`;
|
|
1866
1928
|
if (effTarget) {
|
|
1867
1929
|
ctx.push(`${effTarget}.push((() => {
|
|
1868
|
-
let __iv = ${
|
|
1869
|
-
let __first = true;
|
|
1930
|
+
let __iv = ${branchSnapshot};
|
|
1870
1931
|
return ${effBody}
|
|
1871
1932
|
})());`);
|
|
1872
1933
|
}
|
|
1873
1934
|
else {
|
|
1874
1935
|
ctx.effects.push(`{
|
|
1875
|
-
let __iv = ${
|
|
1876
|
-
let __first = true;
|
|
1936
|
+
let __iv = ${branchSnapshot};
|
|
1877
1937
|
${effBody}
|
|
1878
1938
|
}`);
|
|
1879
1939
|
}
|
|
@@ -1901,6 +1961,9 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1901
1961
|
ctx.push(indent(`const ${conFrag} = document.createDocumentFragment();`));
|
|
1902
1962
|
if (hyd)
|
|
1903
1963
|
ctx.push(indent(`const __cl = [];`));
|
|
1964
|
+
const savedConDescriptor = ctx.descriptorClaim;
|
|
1965
|
+
if (hyd && ctx.markerless)
|
|
1966
|
+
ctx.descriptorClaim = true;
|
|
1904
1967
|
for (const n of node.consequentNodes) {
|
|
1905
1968
|
const savedClaim = ctx.claimStatic;
|
|
1906
1969
|
if (hyd)
|
|
@@ -1914,6 +1977,7 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1914
1977
|
ctx.push(indent(`${conFrag}.appendChild(${v});`));
|
|
1915
1978
|
}
|
|
1916
1979
|
}
|
|
1980
|
+
ctx.descriptorClaim = savedConDescriptor;
|
|
1917
1981
|
if (hyd)
|
|
1918
1982
|
ctx.push(indent(`__place(${anchor}, ${endAnchor}, __cl, ${parent});`));
|
|
1919
1983
|
else
|
|
@@ -1930,6 +1994,9 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1930
1994
|
ctx.push(indent(`const ${altFrag} = document.createDocumentFragment();`));
|
|
1931
1995
|
if (hyd)
|
|
1932
1996
|
ctx.push(indent(`const __cl = [];`));
|
|
1997
|
+
const savedAltDescriptor = ctx.descriptorClaim;
|
|
1998
|
+
if (hyd && ctx.markerless)
|
|
1999
|
+
ctx.descriptorClaim = true;
|
|
1933
2000
|
for (const n of node.alternateNodes) {
|
|
1934
2001
|
const savedAltClaim = ctx.claimStatic;
|
|
1935
2002
|
if (hyd)
|
|
@@ -1943,6 +2010,7 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1943
2010
|
ctx.push(indent(`${altFrag}.appendChild(${v});`));
|
|
1944
2011
|
}
|
|
1945
2012
|
}
|
|
2013
|
+
ctx.descriptorClaim = savedAltDescriptor;
|
|
1946
2014
|
if (hyd)
|
|
1947
2015
|
ctx.push(indent(`__place(${anchor}, ${endAnchor}, __cl, ${parent});`));
|
|
1948
2016
|
else
|
|
@@ -1951,10 +2019,19 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1951
2019
|
}
|
|
1952
2020
|
if (!hyd)
|
|
1953
2021
|
ctx.push(`${parent}.appendChild(${endAnchor});`);
|
|
1954
|
-
|
|
2022
|
+
// Snapshot the condition used by the INITIAL render. Effect flush runs after
|
|
2023
|
+
// the body, so tracked data can arrive in between; comparing the first effect
|
|
2024
|
+
// run against a value read at flush time would adopt the new branch without
|
|
2025
|
+
// replacing the DOM that the old branch already claimed.
|
|
2026
|
+
const condSnapshot = ctx.n();
|
|
2027
|
+
ctx.push(`const ${condSnapshot} = ${condExpr};`);
|
|
2028
|
+
if (hyd && !ctx.markerless)
|
|
2029
|
+
ctx.push(`if (__hydrate) __reconcileRegion(${parent}, '${rid}', ${condSnapshot} ? 0 : 1, ${ctx.walker});`);
|
|
2030
|
+
if (hyd && ctx.markerless)
|
|
2031
|
+
emitStructuralRegionDiscard(ctx, [node.consequentNodes, node.alternateNodes], hasElse ? `(${condSnapshot} ? 0 : 1)` : `(${condSnapshot} ? 0 : -1)`, budget);
|
|
2032
|
+
ctx.push(`if (${condSnapshot}) { ${asyncKw}${conRenderName}(); }` + (hasElse ? ` else { ${asyncKw}${altRenderName}(); }` : ''));
|
|
1955
2033
|
const renderBranch = `if (__nv) { ${asyncKw}${conRenderName}(); }` + (hasElse ? ` else { ${asyncKw}${altRenderName}(); }` : '');
|
|
1956
2034
|
const effectBody = `effect(${ctx.isAsyncScope ? 'async () => {' : '() => {'}
|
|
1957
|
-
if (__first) { __first = false; __iv = ${condExpr}; return; }
|
|
1958
2035
|
const __nv = ${condExpr};
|
|
1959
2036
|
if (__nv !== __iv) {
|
|
1960
2037
|
for (const e of ${effectsVar}) destroy_block(e);
|
|
@@ -1971,15 +2048,13 @@ function emitOpaque(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionB
|
|
|
1971
2048
|
return null;
|
|
1972
2049
|
if (effTarget) {
|
|
1973
2050
|
ctx.push(`${effTarget}.push((() => {
|
|
1974
|
-
let __iv = ${
|
|
1975
|
-
let __first = true;
|
|
2051
|
+
let __iv = ${condSnapshot};
|
|
1976
2052
|
return ${effectBody}
|
|
1977
2053
|
})());`);
|
|
1978
2054
|
}
|
|
1979
2055
|
else {
|
|
1980
2056
|
ctx.effects.push(`{
|
|
1981
|
-
let __iv = ${
|
|
1982
|
-
let __first = true;
|
|
2057
|
+
let __iv = ${condSnapshot};
|
|
1983
2058
|
${effectBody}
|
|
1984
2059
|
}`);
|
|
1985
2060
|
}
|
|
@@ -2476,34 +2551,34 @@ function emitMap(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionBudg
|
|
|
2476
2551
|
let emptyRenderName = null;
|
|
2477
2552
|
if (node.alternateNodes.length > 0) {
|
|
2478
2553
|
emptyRenderName = ctx.n();
|
|
2479
|
-
|
|
2554
|
+
// Hydrated maps (keyed AND non-keyed) claim their #empty fallback
|
|
2555
|
+
// positionally with descriptor checks: an SSR slot that rendered the same
|
|
2556
|
+
// fallback is adopted in place (no duplicate), while an SSR item ghost in
|
|
2557
|
+
// that slot is detached by the walker's mismatch recovery and the fallback
|
|
2558
|
+
// renders fresh. Fresh (SPA) renders keep the fragment + direct-insert
|
|
2559
|
+
// shape — there is no SSR DOM to claim.
|
|
2560
|
+
const emptyClaims = ctx.hydrate;
|
|
2561
|
+
const emptySig = !emptyClaims
|
|
2480
2562
|
? (ctx.isAsyncScope ? 'async () => {' : '() => {')
|
|
2481
2563
|
: (ctx.isAsyncScope ? 'async (__cl) => {' : '(__cl) => {');
|
|
2482
2564
|
ctx.push(`const ${emptyRenderName} = ${emptySig}`);
|
|
2483
2565
|
ctx.push(indent(`const __p = ${anchor}.parentNode;`));
|
|
2484
2566
|
const frag = ctx.n();
|
|
2485
|
-
if (!
|
|
2567
|
+
if (!emptyClaims)
|
|
2486
2568
|
ctx.push(indent(`const ${frag} = document.createDocumentFragment();`));
|
|
2487
2569
|
const savedClaim = ctx.claimStatic;
|
|
2488
|
-
const savedHydrate = ctx.hydrate;
|
|
2489
|
-
// A keyed map hydrating with no matching SSR items renders its empty
|
|
2490
|
-
// fallback fresh — the SSR item ghosts get reported by the canary instead
|
|
2491
|
-
// of being adopted positionally as the fallback (which would be wrong DOM).
|
|
2492
|
-
if (hydKeyed)
|
|
2493
|
-
ctx.hydrate = false;
|
|
2494
2570
|
for (const n of node.alternateNodes) {
|
|
2495
2571
|
ctx.claimStatic = true;
|
|
2496
|
-
const v = emitNode(ctx, n, tracked, effectsVar,
|
|
2572
|
+
const v = emitNode(ctx, n, tracked, effectsVar, emptyClaims ? undefined : frag, '__components', 0, budget || undefined);
|
|
2497
2573
|
if (v) {
|
|
2498
|
-
if (
|
|
2574
|
+
if (emptyClaims)
|
|
2499
2575
|
ctx.push(indent(`if (__cl) __cl.push(${v}); else __p.insertBefore(${v}, ${endAnchor});`));
|
|
2500
2576
|
else
|
|
2501
2577
|
ctx.push(indent(`${frag}.appendChild(${v});`));
|
|
2502
2578
|
}
|
|
2503
2579
|
}
|
|
2504
2580
|
ctx.claimStatic = savedClaim;
|
|
2505
|
-
|
|
2506
|
-
if (!hyd)
|
|
2581
|
+
if (!emptyClaims)
|
|
2507
2582
|
ctx.push(indent(`if (${frag}.childNodes.length > 0) __p.insertBefore(${frag}, ${endAnchor});`));
|
|
2508
2583
|
ctx.push(`};`);
|
|
2509
2584
|
}
|
|
@@ -2536,8 +2611,19 @@ function emitMap(ctx, node, tracked, effTarget, parentVar, skipK = 0, regionBudg
|
|
|
2536
2611
|
}
|
|
2537
2612
|
if (emptyRenderName) {
|
|
2538
2613
|
const isEmptyVar = ctx.n();
|
|
2614
|
+
// A hydrated keyed map attaches its region anchors through
|
|
2615
|
+
// `reconcileHydrated` (items branch) or `__place` (empty branch) — the
|
|
2616
|
+
// anchors are created detached and the empty-fallback builder reads
|
|
2617
|
+
// `anchor.parentNode`, so the empty branch must place them too or the
|
|
2618
|
+
// whole hydrator crashes ("insertBefore on null") and every later
|
|
2619
|
+
// reactive update on the page is lost.
|
|
2620
|
+
const collectVar = hydKeyed ? ctx.n() : null;
|
|
2539
2621
|
ctx.push(`let ${isEmptyVar} = !${hasItems}();`);
|
|
2540
|
-
|
|
2622
|
+
if (collectVar)
|
|
2623
|
+
ctx.push(`const ${collectVar} = [];`);
|
|
2624
|
+
ctx.push(`if (!${isEmptyVar}) { ${initList}(); } else { ${aw}${emptyRenderName}(${collectVar || ''}); }`);
|
|
2625
|
+
if (collectVar)
|
|
2626
|
+
ctx.push(`__place(${anchor}, ${endAnchor}, ${collectVar}, ${parent});`);
|
|
2541
2627
|
if (!reactiveSource)
|
|
2542
2628
|
return null;
|
|
2543
2629
|
pushEffect(`let __first = true;`, `effect(${effOpen}
|
|
@@ -2619,7 +2705,7 @@ ${renderAllItems(' ', null)}
|
|
|
2619
2705
|
__cleanup(${anchor}, ${endAnchor});
|
|
2620
2706
|
if (__new) {
|
|
2621
2707
|
${renderAllItems(' ', null)}
|
|
2622
|
-
} else { ${aw}${emptyRenderName}(
|
|
2708
|
+
} else { ${aw}${emptyRenderName}(); }
|
|
2623
2709
|
}, true)`);
|
|
2624
2710
|
}
|
|
2625
2711
|
else {
|
|
@@ -2760,6 +2846,11 @@ function generateComponent(comp, importedNames = new Set(), hydrate = false, asy
|
|
|
2760
2846
|
}
|
|
2761
2847
|
}
|
|
2762
2848
|
}
|
|
2849
|
+
// The first real claim is this component's root: let it validate the static
|
|
2850
|
+
// class shape against the SSR slot. The flag is consumed by the first claim
|
|
2851
|
+
// and never leaks to nested children.
|
|
2852
|
+
if (ctx.hydrate && ctx.markerless)
|
|
2853
|
+
ctx.descriptorClaim = true;
|
|
2763
2854
|
for (const node of comp.body) {
|
|
2764
2855
|
// A TrackDecl that could not be hoisted (its init reads an earlier body
|
|
2765
2856
|
// binding) is emitted here, in source order, so the binding it reads is
|
|
@@ -2900,6 +2991,33 @@ function buildComponentMap(irRoot, hydrate = false, alloc, markerless = true) {
|
|
|
2900
2991
|
const code = generateComponent(comp, directNames, hydrate, asyncComps, linkNames, selfClaimNames, alloc, markerless);
|
|
2901
2992
|
mapLines.push(`${registry}[${JSON.stringify(comp.name)}] = ${code};`);
|
|
2902
2993
|
}
|
|
2994
|
+
if (hydrate && !markerless) {
|
|
2995
|
+
mapLines.push(`function __reconcileRegion(parent, id, branch, walker) {`);
|
|
2996
|
+
mapLines.push(`\tif (!parent) return;`);
|
|
2997
|
+
mapLines.push(`\tlet start = null;`);
|
|
2998
|
+
mapLines.push(`\tlet end = null;`);
|
|
2999
|
+
mapLines.push(`\tfor (let n = parent.firstChild; n; n = n.nextSibling) {`);
|
|
3000
|
+
mapLines.push(`\t\tif (n.nodeType !== 8) continue;`);
|
|
3001
|
+
mapLines.push(`\t\tconst text = n.textContent || '';`);
|
|
3002
|
+
mapLines.push(`\t\tif (text === 'vesk-r:' + id + ':0' || text === 'vesk-r:' + id + ':1') start = n;`);
|
|
3003
|
+
mapLines.push(`\t\telse if (text === 'vesk-r-end:' + id) end = n;`);
|
|
3004
|
+
mapLines.push(`\t\tif (start && end) break;`);
|
|
3005
|
+
mapLines.push(`\t}`);
|
|
3006
|
+
mapLines.push(`\tif (!start || !end) return;`);
|
|
3007
|
+
mapLines.push(`\tconst ssrBranch = (start.textContent || '').slice(-2) === ':1' ? 1 : 0;`);
|
|
3008
|
+
mapLines.push(`\tif (ssrBranch !== branch) {`);
|
|
3009
|
+
mapLines.push(`\t\tlet n = start.nextSibling;`);
|
|
3010
|
+
mapLines.push(`\t\twhile (n && n !== end) {`);
|
|
3011
|
+
mapLines.push(`\t\t\tconst next = n.nextSibling;`);
|
|
3012
|
+
mapLines.push(`\t\t\tn.remove();`);
|
|
3013
|
+
mapLines.push(`\t\t\tn = next;`);
|
|
3014
|
+
mapLines.push(`\t\t}`);
|
|
3015
|
+
mapLines.push(`\t\tif (walker && walker.retireDetached) walker.retireDetached();`);
|
|
3016
|
+
mapLines.push(`\t}`);
|
|
3017
|
+
mapLines.push(`\tstart.remove();`);
|
|
3018
|
+
mapLines.push(`\tend.remove();`);
|
|
3019
|
+
mapLines.push(`}`);
|
|
3020
|
+
}
|
|
2903
3021
|
mapLines.push(`function __cleanup(start, end) {`);
|
|
2904
3022
|
mapLines.push(`\tlet n = start.nextSibling;`);
|
|
2905
3023
|
mapLines.push(`\twhile (n && n !== end) {`);
|
|
@@ -2966,6 +3084,50 @@ function ssrResidueEstimate(node) {
|
|
|
2966
3084
|
// ServerBlock, ClientBlock, HeadBlock emit no SSR element residue.
|
|
2967
3085
|
return 0;
|
|
2968
3086
|
}
|
|
3087
|
+
function firstBranchRoot(nodes) {
|
|
3088
|
+
for (const n of nodes) {
|
|
3089
|
+
if (n instanceof StaticNode)
|
|
3090
|
+
return { tag: n.tag, descriptor: staticClassDescriptor(n) };
|
|
3091
|
+
if (n instanceof ComponentCall || n instanceof ComponentRef)
|
|
3092
|
+
return null;
|
|
3093
|
+
if (n instanceof OpaqueDynamicRegion)
|
|
3094
|
+
return null;
|
|
3095
|
+
if (n instanceof MapRegion || n instanceof ForLoop || n instanceof WhileLoop) {
|
|
3096
|
+
const child = firstBranchRoot(n.bodyTemplate);
|
|
3097
|
+
if (child)
|
|
3098
|
+
return child;
|
|
3099
|
+
}
|
|
3100
|
+
if (n instanceof SwitchBlock) {
|
|
3101
|
+
for (const c of n.cases) {
|
|
3102
|
+
const child = firstBranchRoot(c.body);
|
|
3103
|
+
if (child)
|
|
3104
|
+
return child;
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
if (n instanceof TryCatch) {
|
|
3108
|
+
const child = firstBranchRoot(n.bodyTemplate) || firstBranchRoot(n.catchBody);
|
|
3109
|
+
if (child)
|
|
3110
|
+
return child;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
return null;
|
|
3114
|
+
}
|
|
3115
|
+
function structuralRegionMetadata(branches) {
|
|
3116
|
+
const parts = branches.map((nodes) => {
|
|
3117
|
+
const first = firstBranchRoot(nodes);
|
|
3118
|
+
const tag = first ? JSON.stringify(first.tag) : 'undefined';
|
|
3119
|
+
const descriptor = first && first.descriptor ? first.descriptor : 'null';
|
|
3120
|
+
return `{ tag: ${tag}, descriptor: ${descriptor}, count: ${ssrResidueEstimate(nodes)} }`;
|
|
3121
|
+
});
|
|
3122
|
+
return `[${parts.join(', ')}]`;
|
|
3123
|
+
}
|
|
3124
|
+
function emitStructuralRegionDiscard(ctx, branches, selectedExpr, budget) {
|
|
3125
|
+
if (!ctx.hydrate || !ctx.markerless)
|
|
3126
|
+
return;
|
|
3127
|
+
const offset = budget ? `, ${budget}` : '';
|
|
3128
|
+
const consume = budget ? ` ${budget} = 0;` : '';
|
|
3129
|
+
ctx.push(`if (${ctx.walker} && typeof ${ctx.walker}.discardStructuralRegion === 'function' && ${ctx.walker}.discardStructuralRegion(${structuralRegionMetadata(branches)}, ${selectedExpr}${offset})) {${consume}}`);
|
|
3130
|
+
}
|
|
2969
3131
|
function isStaticIR(body) {
|
|
2970
3132
|
for (const node of body) {
|
|
2971
3133
|
if (node instanceof StaticNode) {
|
package/dist/ir.d.ts
CHANGED
|
@@ -104,6 +104,12 @@ export declare class OpaqueDynamicRegion {
|
|
|
104
104
|
alternateNodes: IRNode[];
|
|
105
105
|
constructor(condition: Expression, consequentNodes: IRNode[], alternateNodes?: IRNode[]);
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Stable identity for a conditional region across the SSR and client codegen
|
|
109
|
+
* passes. Both passes see the same source offsets, so the SSR region marker
|
|
110
|
+
* and the client's hydration reconciliation agree without sharing state.
|
|
111
|
+
*/
|
|
112
|
+
export declare function regionMarkerId(node: OpaqueDynamicRegion): string;
|
|
107
113
|
export declare class MapRegion {
|
|
108
114
|
expression: Expression;
|
|
109
115
|
itemVariable: string;
|
package/dist/ir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,I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HANGED
|
@@ -125,6 +125,21 @@ export class OpaqueDynamicRegion {
|
|
|
125
125
|
this.alternateNodes = alternateNodes;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Stable identity for a conditional region across the SSR and client codegen
|
|
130
|
+
* passes. Both passes see the same source offsets, so the SSR region marker
|
|
131
|
+
* and the client's hydration reconciliation agree without sharing state.
|
|
132
|
+
*/
|
|
133
|
+
export function regionMarkerId(node) {
|
|
134
|
+
const ast = node.condition.ast;
|
|
135
|
+
if (ast && typeof ast.start === 'number')
|
|
136
|
+
return `s${ast.start}`;
|
|
137
|
+
const raw = node.condition.raw;
|
|
138
|
+
let hash = 5381;
|
|
139
|
+
for (let i = 0; i < raw.length; i++)
|
|
140
|
+
hash = ((hash << 5) + hash + raw.charCodeAt(i)) | 0;
|
|
141
|
+
return `h${(hash >>> 0).toString(36)}`;
|
|
142
|
+
}
|
|
128
143
|
export class MapRegion {
|
|
129
144
|
expression;
|
|
130
145
|
itemVariable;
|
package/dist/router.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function collapseSlashes(p: string): string;
|
|
|
20
20
|
export declare function extractMiddlewareParts(src: string): {
|
|
21
21
|
params: string;
|
|
22
22
|
body: string;
|
|
23
|
+
imports: string[];
|
|
23
24
|
} | null;
|
|
24
25
|
export declare function extractMiddleware(sourcePath: string): string | null;
|
|
25
26
|
export declare function scanRoutes(appDir: string, options?: ScanOptions): RouteNode[];
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAM1D,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MA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G,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BzE;AA6HD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBrE;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAoCnG;AA2CD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CA0HhF"}
|
package/dist/router.js
CHANGED
|
@@ -61,10 +61,25 @@ export function extractMiddlewareParts(src) {
|
|
|
61
61
|
decls.push(src.slice(stmt.declaration.start, stmt.declaration.end).trim());
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
const imports = [];
|
|
65
|
+
for (const stmt of ast.body) {
|
|
66
|
+
if (stmt.type !== 'ImportDeclaration')
|
|
67
|
+
continue;
|
|
68
|
+
if (stmt.importKind === 'type')
|
|
69
|
+
continue;
|
|
70
|
+
const source = stmt.source?.value;
|
|
71
|
+
if (typeof source !== 'string')
|
|
72
|
+
continue;
|
|
73
|
+
if (source.startsWith('.') || source.startsWith('/'))
|
|
74
|
+
continue;
|
|
75
|
+
const line = src.slice(stmt.start, stmt.end).trim();
|
|
76
|
+
if (line && !imports.includes(line))
|
|
77
|
+
imports.push(line);
|
|
78
|
+
}
|
|
64
79
|
const bodyWithDecls = decls.length > 0
|
|
65
80
|
? decls.join('\n') + '\n' + body.trim()
|
|
66
81
|
: body.trim();
|
|
67
|
-
return { params, body: bodyWithDecls };
|
|
82
|
+
return { params, body: bodyWithDecls, imports };
|
|
68
83
|
}
|
|
69
84
|
catch {
|
|
70
85
|
return fallbackExtractMiddleware(src);
|
|
@@ -124,7 +139,7 @@ function fallbackExtractMiddleware(src) {
|
|
|
124
139
|
m++;
|
|
125
140
|
}
|
|
126
141
|
const body = src.slice(b + 1, m - 1);
|
|
127
|
-
return { params, body: body.trim() };
|
|
142
|
+
return { params, body: body.trim(), imports: [] };
|
|
128
143
|
}
|
|
129
144
|
return null;
|
|
130
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASzE,OAAO,EAAkG,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AA6DrK,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CA+EjJ;AA8bD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAwD1F;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAuFD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CA4CzE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAYhG"}
|
package/dist/server-jsgen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Expression, StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, WhileLoop, SwitchBlock, TryCatch, ForLoop, TrackDecl, RuntimeStatement, ComponentRef, ComponentCall, BreakSignal, ServerBlock, ClientBlock, HeadBlock, SlotNode, PropSlot, PropSlotRender, } from '@vesk/compiler/src/ir';
|
|
1
|
+
import { Expression, StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, WhileLoop, SwitchBlock, TryCatch, ForLoop, TrackDecl, RuntimeStatement, ComponentRef, ComponentCall, BreakSignal, ServerBlock, ClientBlock, HeadBlock, SlotNode, PropSlot, PropSlotRender, regionMarkerId, } from '@vesk/compiler/src/ir';
|
|
2
2
|
import { isStaticIR, collectTrackedNames, transformTracked, transformTrackedInit, semicolonizeStatement } from '@vesk/compiler/src/client-codegen';
|
|
3
3
|
import { unwrapTrackCall, stripTrackGeneric, hasTopLevelComma, skipWhitespace, findBalancedEnd, startsWithIdentifier, callsIdentifier } from '@vesk/compiler/src/scan';
|
|
4
4
|
import { escapeHtml, indent, exprJS, extractTopLevelNames, extractRuntimeNames, buildParamInit, VOID_ELEMENTS, __vskHydrate, __vskMarkerless, __vskImportedNames, setVskImportedNames, setVskForceClaim, takeVskForceClaim, nextVskId, } from '@vesk/compiler/src/server-utils';
|
|
@@ -295,7 +295,15 @@ function dynamicBindingToJS(node, tracked) {
|
|
|
295
295
|
function opaqueRegionToJS(node, isAsync = false, tracked) {
|
|
296
296
|
const lines = [];
|
|
297
297
|
const cond = exprJSX(node.condition, tracked);
|
|
298
|
+
const rid = regionMarkerId(node);
|
|
299
|
+
// Marker-mode SSR records which branch the server actually rendered. Strict
|
|
300
|
+
// markerless SSR must remain ordinary HTML: no comments, no annotations. In
|
|
301
|
+
// markerless mode the client recovers a differing initial branch through the
|
|
302
|
+
// structural walker's descriptor validation instead.
|
|
303
|
+
const mark = __vskHydrate && !__vskMarkerless;
|
|
298
304
|
lines.push(`if (${cond}) {`);
|
|
305
|
+
if (mark)
|
|
306
|
+
lines.push(indent(`__out.push('<!--vesk-r:${rid}:0-->');`));
|
|
299
307
|
// Static branch content still needs server claim markers: the client
|
|
300
308
|
// re-branches an if/else-if region on every tracked change (OpaqueDynamicRegion
|
|
301
309
|
// claimStatic codegen), so opposed to plain component bodies it must be able
|
|
@@ -308,8 +316,10 @@ function opaqueRegionToJS(node, isAsync = false, tracked) {
|
|
|
308
316
|
lines.push(indent(code));
|
|
309
317
|
}
|
|
310
318
|
setVskForceClaim(false);
|
|
319
|
+
lines.push(`} else {`);
|
|
320
|
+
if (mark)
|
|
321
|
+
lines.push(indent(`__out.push('<!--vesk-r:${rid}:1-->');`));
|
|
311
322
|
if (node.alternateNodes.length > 0) {
|
|
312
|
-
lines.push(`} else {`);
|
|
313
323
|
setVskForceClaim(true);
|
|
314
324
|
for (const n of node.alternateNodes) {
|
|
315
325
|
const code = irNodeToJS(n, null, isAsync, tracked);
|
|
@@ -319,6 +329,8 @@ function opaqueRegionToJS(node, isAsync = false, tracked) {
|
|
|
319
329
|
setVskForceClaim(false);
|
|
320
330
|
}
|
|
321
331
|
lines.push(`}`);
|
|
332
|
+
if (mark)
|
|
333
|
+
lines.push(`__out.push('<!--vesk-r-end:${rid}-->');`);
|
|
322
334
|
return lines.join('\n');
|
|
323
335
|
}
|
|
324
336
|
function mapRegionToJS(node, isAsync = false, tracked) {
|
package/dist/typecheck.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface TypecheckError {
|
|
|
9
9
|
code: string;
|
|
10
10
|
message: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const AMBIENT = "\ndeclare namespace JSX {\n type VeskEventHandler<E extends Event = Event> = (event: E) => void;\n interface VeskCommonAttributes {\n key?: string | number;\n class?: string;\n id?: string;\n style?: string;\n title?: string;\n hidden?: boolean | string;\n lang?: string;\n dir?: 'ltr' | 'rtl' | 'auto';\n tabIndex?: number;\n role?: string;\n }\n interface VeskEventAttributes {\n onClick?: VeskEventHandler<MouseEvent>;\n onDblClick?: VeskEventHandler<MouseEvent>;\n onMouseDown?: VeskEventHandler<MouseEvent>;\n onMouseUp?: VeskEventHandler<MouseEvent>;\n onMouseEnter?: VeskEventHandler<MouseEvent>;\n onMouseLeave?: VeskEventHandler<MouseEvent>;\n onMouseMove?: VeskEventHandler<MouseEvent>;\n onKeyDown?: VeskEventHandler<KeyboardEvent>;\n onKeyUp?: VeskEventHandler<KeyboardEvent>;\n onFocus?: VeskEventHandler<FocusEvent>;\n onBlur?: VeskEventHandler<FocusEvent>;\n onInput?: VeskEventHandler<InputEvent>;\n onChange?: VeskEventHandler<Event>;\n onSubmit?: VeskEventHandler<SubmitEvent>;\n onScroll?: VeskEventHandler<UIEvent>;\n onWheel?: VeskEventHandler<WheelEvent>;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and real\n // code writes onclick=/oninput=. Keep in sync with the camelCase members.\n onclick?: VeskEventHandler<MouseEvent>;\n ondblclick?: VeskEventHandler<MouseEvent>;\n onmousedown?: VeskEventHandler<MouseEvent>;\n onmouseup?: VeskEventHandler<MouseEvent>;\n onmouseenter?: VeskEventHandler<MouseEvent>;\n onmouseleave?: VeskEventHandler<MouseEvent>;\n onmousemove?: VeskEventHandler<MouseEvent>;\n onkeydown?: VeskEventHandler<KeyboardEvent>;\n onkeyup?: VeskEventHandler<KeyboardEvent>;\n onfocus?: VeskEventHandler<FocusEvent>;\n onblur?: VeskEventHandler<FocusEvent>;\n oninput?: VeskEventHandler<InputEvent>;\n onchange?: VeskEventHandler<Event>;\n onsubmit?: VeskEventHandler<SubmitEvent>;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n interface VeskGlobalAttributes extends VeskCommonAttributes, VeskEventAttributes {\n children?: Component;\n }\n interface VeskAnchorAttributes extends VeskGlobalAttributes {\n href?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n type?: string;\n hreflang?: string;\n }\n interface VeskMediaAttributes extends VeskGlobalAttributes {\n src?: string;\n width?: string | number;\n height?: string | number;\n }\n interface VeskInputAttributes extends VeskGlobalAttributes {\n type?: string;\n name?: string;\n value?: string | number | readonly string[];\n placeholder?: string;\n checked?: boolean | string;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n min?: string | number;\n max?: string | number;\n step?: string | number;\n pattern?: string;\n autoComplete?: string;\n autoFocus?: boolean | string;\n multiple?: boolean | string;\n accept?: string;\n size?: number;\n list?: string;\n }\n interface IntrinsicElements {\n html?: VeskGlobalAttributes & { manifest?: string };\n head?: VeskGlobalAttributes;\n body?: VeskGlobalAttributes;\n div?: VeskGlobalAttributes;\n span?: VeskGlobalAttributes;\n p?: VeskGlobalAttributes;\n h1?: VeskGlobalAttributes;\n h2?: VeskGlobalAttributes;\n h3?: VeskGlobalAttributes;\n h4?: VeskGlobalAttributes;\n h5?: VeskGlobalAttributes;\n h6?: VeskGlobalAttributes;\n a?: VeskAnchorAttributes;\n nav?: VeskGlobalAttributes;\n header?: VeskGlobalAttributes;\n footer?: VeskGlobalAttributes;\n main?: VeskGlobalAttributes;\n section?: VeskGlobalAttributes;\n article?: VeskGlobalAttributes;\n aside?: VeskGlobalAttributes;\n button?: VeskGlobalAttributes & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean | string;\n name?: string;\n value?: string | number;\n };\n form?: VeskGlobalAttributes & {\n action?: string;\n method?: 'get' | 'post';\n target?: string;\n encType?: string;\n noValidate?: boolean | string;\n name?: string;\n autoComplete?: string;\n };\n input?: VeskInputAttributes;\n textarea?: VeskGlobalAttributes & {\n rows?: number;\n cols?: number;\n placeholder?: string;\n value?: string | number;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n name?: string;\n };\n select?: VeskGlobalAttributes & {\n name?: string;\n value?: string | number | readonly string[];\n disabled?: boolean | string;\n required?: boolean | string;\n multiple?: boolean | string;\n size?: number;\n autoComplete?: string;\n };\n option?: VeskGlobalAttributes & {\n value?: string | number;\n selected?: boolean | string;\n disabled?: boolean | string;\n label?: string;\n };\n optgroup?: VeskGlobalAttributes & { label?: string; disabled?: boolean | string };\n label?: VeskGlobalAttributes & { htmlFor?: string };\n fieldset?: VeskGlobalAttributes & { disabled?: boolean | string; name?: string; form?: string };\n legend?: VeskGlobalAttributes;\n datalist?: VeskGlobalAttributes;\n img?: VeskGlobalAttributes & {\n src?: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n srcSet?: string;\n sizes?: string;\n loading?: 'eager' | 'lazy';\n decoding?: 'sync' | 'async' | 'auto';\n };\n picture?: VeskGlobalAttributes;\n source?: VeskGlobalAttributes & { src?: string; srcSet?: string; sizes?: string; media?: string; type?: string };\n video?: VeskMediaAttributes & {\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n poster?: string;\n playsInline?: boolean | string;\n };\n audio?: VeskGlobalAttributes & {\n src?: string;\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n };\n track?: VeskGlobalAttributes & {\n src?: string;\n kind?: string;\n srclang?: string;\n label?: string;\n default?: boolean | string;\n };\n canvas?: VeskGlobalAttributes & { width?: number; height?: number };\n iframe?: VeskGlobalAttributes & {\n src?: string;\n srcDoc?: string;\n width?: string | number;\n height?: string | number;\n allow?: string;\n loading?: 'eager' | 'lazy';\n sandbox?: string;\n allowFullScreen?: boolean | string;\n referrerPolicy?: string;\n };\n embed?: VeskGlobalAttributes & { src?: string; type?: string; width?: string | number; height?: string | number };\n object?: VeskGlobalAttributes & { data?: string; type?: string; name?: string; width?: string | number; height?: string | number };\n table?: VeskGlobalAttributes;\n caption?: VeskGlobalAttributes;\n thead?: VeskGlobalAttributes;\n tbody?: VeskGlobalAttributes;\n tfoot?: VeskGlobalAttributes;\n tr?: VeskGlobalAttributes;\n th?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; scope?: string; headers?: string };\n td?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; headers?: string };\n col?: VeskGlobalAttributes & { span?: number };\n colgroup?: VeskGlobalAttributes & { span?: number };\n ul?: VeskGlobalAttributes;\n ol?: VeskGlobalAttributes & { start?: number; reversed?: boolean | string; type?: string };\n li?: VeskGlobalAttributes & { value?: number };\n dl?: VeskGlobalAttributes;\n dt?: VeskGlobalAttributes;\n dd?: VeskGlobalAttributes;\n br?: VeskGlobalAttributes;\n hr?: VeskGlobalAttributes;\n pre?: VeskGlobalAttributes;\n code?: VeskGlobalAttributes;\n blockquote?: VeskGlobalAttributes & { cite?: string };\n q?: VeskGlobalAttributes & { cite?: string };\n strong?: VeskGlobalAttributes;\n em?: VeskGlobalAttributes;\n small?: VeskGlobalAttributes;\n s?: VeskGlobalAttributes;\n cite?: VeskGlobalAttributes;\n dfn?: VeskGlobalAttributes;\n abbr?: VeskGlobalAttributes & { title?: string };\n time?: VeskGlobalAttributes & { dateTime?: string };\n data?: VeskGlobalAttributes & { value?: string | number };\n mark?: VeskGlobalAttributes;\n del?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n ins?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n sub?: VeskGlobalAttributes;\n sup?: VeskGlobalAttributes;\n u?: VeskGlobalAttributes;\n kbd?: VeskGlobalAttributes;\n samp?: VeskGlobalAttributes;\n var?: VeskGlobalAttributes;\n figure?: VeskGlobalAttributes;\n figcaption?: VeskGlobalAttributes;\n details?: VeskGlobalAttributes & { open?: boolean | string };\n summary?: VeskGlobalAttributes;\n dialog?: VeskGlobalAttributes & { open?: boolean | string };\n menu?: VeskGlobalAttributes;\n address?: VeskGlobalAttributes;\n b?: VeskGlobalAttributes;\n i?: VeskGlobalAttributes;\n ruby?: VeskGlobalAttributes;\n rt?: VeskGlobalAttributes;\n rp?: VeskGlobalAttributes;\n bdi?: VeskGlobalAttributes;\n bdo?: VeskGlobalAttributes;\n wbr?: VeskGlobalAttributes;\n area?: VeskGlobalAttributes & {\n coords?: string;\n shape?: string;\n href?: string;\n target?: string;\n alt?: string;\n };\n map?: VeskGlobalAttributes & { name?: string };\n noscript?: VeskGlobalAttributes;\n template?: VeskGlobalAttributes;\n slot?: VeskGlobalAttributes & { name?: string };\n meta?: VeskGlobalAttributes & {\n name?: string;\n content?: string;\n charSet?: string;\n httpEquiv?: string;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and\n // real code (and SSR output) writes charset. Keep in sync with the\n // camelCase members.\n charset?: string;\n };\n title?: VeskGlobalAttributes;\n base?: VeskGlobalAttributes & { href?: string; target?: string };\n link?: VeskGlobalAttributes & {\n rel?: string;\n href?: string;\n sizes?: string;\n media?: string;\n as?: string;\n crossOrigin?: string;\n integrity?: string;\n type?: string;\n // Lowercase alias \u2014 see the meta note above.\n crossorigin?: string | boolean;\n };\n style?: VeskGlobalAttributes & { media?: string };\n script?: VeskGlobalAttributes & {\n src?: string;\n async?: boolean | string;\n defer?: boolean | string;\n type?: string;\n crossOrigin?: string;\n integrity?: string;\n nonce?: string;\n noModule?: boolean | string;\n // Lowercase aliases \u2014 see the meta note above.\n crossorigin?: boolean | string;\n };\n svg?: VeskGlobalAttributes & {\n viewBox?: string;\n xmlns?: string;\n width?: string | number;\n height?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n g?: VeskGlobalAttributes & { transform?: string; fill?: string; stroke?: string; strokeWidth?: string | number };\n path?: VeskGlobalAttributes & {\n d?: string;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n fillRule?: string;\n clipRule?: string;\n };\n circle?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n r?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n ellipse?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n rect?: VeskGlobalAttributes & {\n x?: string | number;\n y?: string | number;\n width?: string | number;\n height?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n line?: VeskGlobalAttributes & {\n x1?: string | number;\n y1?: string | number;\n x2?: string | number;\n y2?: string | number;\n stroke?: string;\n strokeWidth?: string | number;\n };\n polyline?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n polygon?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n text?: VeskGlobalAttributes & { x?: string | number; y?: string | number; fill?: string; fontSize?: string | number };\n defs?: VeskGlobalAttributes;\n linearGradient?: VeskGlobalAttributes;\n radialGradient?: VeskGlobalAttributes;\n stop?: VeskGlobalAttributes & { offset?: string | number; stopColor?: string; stopOpacity?: string | number };\n\n // Unknown/custom tags stay permissive \u2014 components and web components\n // resolve through the index signature, known tags get the typed members.\n [elemName: string]: unknown;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n}\ndeclare type Component = string | number | boolean | null | undefined | Component[];\ndeclare const Head: (props: { children?: Component }) => Component;\n// Server-side .vsk code reads process.env (NODE_ENV, feature flags, secrets).\n// @types/node is not installed for browser targets, so declare the slice the\n// framework documents rather than failing every project that branches on env.\ndeclare const process: {\n env: Record<string, string | undefined>;\n argv: string[];\n platform: string;\n cwd(): string;\n exit(code?: number): never;\n};\ninterface Tracked<T> {\n get(): T;\n set(value: T): void;\n}\ninterface Derived<T> {\n get(): T;\n set(value: T): void;\n}\ndeclare function track<T>(initialValue: T): Tracked<T>;\ndeclare function track<T>(fn: () => T): Derived<T>;\ndeclare function derived<T>(fn: () => T): Derived<T>;\ndeclare function effect(fn: () => void): unknown;\ndeclare function untrack<T>(fn: () => T): T;\ndeclare function peek<T>(fn: () => T): T;\ndeclare function tick(): Promise<void>;\ndeclare function flushSync(fn: () => void): void;\ndeclare function on_destroy(fn: () => void): void;\n/**\n * A context created by createContext. The value type flows from the default\n * (or an explicit type argument) through set() and every get().\n */\ninterface VeskContext<T> {\n readonly id: symbol;\n get(): T;\n set(value: T): void;\n}\ndeclare function createContext<const T>(defaultValue: T): VeskContext<T>;\n// Typed request-scoped store (middleware locals, event payloads). Declare the\n// shape once and every set/get is checked against it.\ninterface VeskLocals<T extends object> {\n set<K extends keyof T>(key: K, value: T[K]): void;\n get<K extends keyof T>(key: K): T[K];\n has<K extends keyof T>(key: K): boolean;\n delete<K extends keyof T>(key: K): void;\n all(): T;\n}\ndeclare function createLocals<T extends object = Record<string, unknown>>(): VeskLocals<T>;\n// useFetch returns a THENABLE resource, not the data itself. In async\n// components you must `await` it before reading/iterating the payload;\n// passing `into: <tracked cell>` writes the payload into the cell and makes\n// awaiting unnecessary (the return value can be ignored).\ninterface VeskResource<T> {\n loading: boolean;\n error: unknown;\n data: T | undefined;\n refresh(): void;\n abort(): void;\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): PromiseLike<TResult1 | TResult2>;\n}\ninterface VeskUseFetchOptions<T> {\n /** Cache/SSR key \u2014 defaults to the URL string. */\n key?: string;\n /** Target tracked cell (from track<T>()) \u2014 the payload is written into it, so awaiting is unnecessary. */\n into?: Tracked<T>;\n staleTime?: number;\n keepPreviousData?: boolean;\n retry?: number;\n retryDelay?: number;\n timeout?: number;\n enabled?: boolean;\n dedupe?: boolean;\n method?: string;\n headers?: Record<string, string>;\n body?: unknown;\n credentials?: 'omit' | 'same-origin' | 'include';\n signal?: { readonly aborted: boolean };\n}\ndeclare function useFetch<T = unknown>(\n urlOrFn: string | (() => Promise<T>),\n options?: VeskUseFetchOptions<T>,\n): VeskResource<T>;\ndeclare namespace useFetch {\n function text<T = string>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function json<T = unknown>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function arrayBuffer<T = ArrayBuffer>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n}\ndeclare function useRouter(): unknown;\ndeclare function useParams(): Record<string, string>;\ndeclare function usePathname(): string;\ndeclare function useSearchParams(): URLSearchParams;\ndeclare function useNavigate(): (to: string) => void;\ndeclare function defineAction(...args: unknown[]): unknown;\ndeclare const Form: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Field: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function required(...args: unknown[]): unknown;\ndeclare function email(...args: unknown[]): unknown;\ndeclare function minLength(...args: unknown[]): unknown;\ndeclare function maxLength(...args: unknown[]): unknown;\ndeclare function pattern(...args: unknown[]): unknown;\ndeclare function custom(...args: unknown[]): unknown;\ndeclare const Link: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const NavLink: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Outlet: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Image: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Portal: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Experiment: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function useLoadingIndicator(options?: {\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n}): {\n progress: Tracked<number>;\n isLoading: Tracked<boolean>;\n error: Tracked<boolean>;\n start(opts?: { force?: boolean }): void;\n set(value: number, opts?: { force?: boolean }): void;\n finish(opts?: { force?: boolean; error?: boolean }): void;\n clear(): void;\n};\ndeclare const LoadingIndicator: (props: {\n color?: string | false;\n errorColor?: string;\n height?: number | string;\n position?: 'top' | 'bottom';\n zIndex?: number;\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n class?: string;\n className?: string;\n style?: string;\n children?: Component;\n [k: string]: unknown;\n}) => Component;\ndeclare const JsonLd: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ArticleSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ProductSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const FAQPageSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const BreadcrumbListSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const OrganizationSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const LocalBusinessSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const VideoSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function redirect(...args: unknown[]): unknown;\ndeclare function permanentRedirect(...args: unknown[]): unknown;\ndeclare function notFound(...args: unknown[]): never;\ndeclare class NotFoundError extends Error {}\ndeclare function createResource(...args: unknown[]): unknown;\ndeclare function getAction(...args: unknown[]): unknown;\ndeclare function validateActionInput(...args: unknown[]): unknown;\ndeclare function issuesToFieldMap(...args: unknown[]): unknown;\ndeclare function isFormAction(...args: unknown[]): unknown;\n";
|
|
12
|
+
export declare const AMBIENT = "\ndeclare namespace JSX {\n type VeskEventHandler<E extends Event = Event> = (event: E) => void;\n interface VeskCommonAttributes {\n key?: string | number;\n class?: string;\n id?: string;\n style?: string;\n title?: string;\n hidden?: boolean | string;\n lang?: string;\n dir?: 'ltr' | 'rtl' | 'auto';\n tabIndex?: number;\n role?: string;\n }\n interface VeskEventAttributes {\n onClick?: VeskEventHandler<MouseEvent>;\n onDblClick?: VeskEventHandler<MouseEvent>;\n onMouseDown?: VeskEventHandler<MouseEvent>;\n onMouseUp?: VeskEventHandler<MouseEvent>;\n onMouseEnter?: VeskEventHandler<MouseEvent>;\n onMouseLeave?: VeskEventHandler<MouseEvent>;\n onMouseMove?: VeskEventHandler<MouseEvent>;\n onKeyDown?: VeskEventHandler<KeyboardEvent>;\n onKeyUp?: VeskEventHandler<KeyboardEvent>;\n onFocus?: VeskEventHandler<FocusEvent>;\n onBlur?: VeskEventHandler<FocusEvent>;\n onInput?: VeskEventHandler<InputEvent>;\n onChange?: VeskEventHandler<Event>;\n onSubmit?: VeskEventHandler<SubmitEvent>;\n onScroll?: VeskEventHandler<UIEvent>;\n onWheel?: VeskEventHandler<WheelEvent>;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and real\n // code writes onclick=/oninput=. Keep in sync with the camelCase members.\n onclick?: VeskEventHandler<MouseEvent>;\n ondblclick?: VeskEventHandler<MouseEvent>;\n onmousedown?: VeskEventHandler<MouseEvent>;\n onmouseup?: VeskEventHandler<MouseEvent>;\n onmouseenter?: VeskEventHandler<MouseEvent>;\n onmouseleave?: VeskEventHandler<MouseEvent>;\n onmousemove?: VeskEventHandler<MouseEvent>;\n onkeydown?: VeskEventHandler<KeyboardEvent>;\n onkeyup?: VeskEventHandler<KeyboardEvent>;\n onfocus?: VeskEventHandler<FocusEvent>;\n onblur?: VeskEventHandler<FocusEvent>;\n oninput?: VeskEventHandler<InputEvent>;\n onchange?: VeskEventHandler<Event>;\n onsubmit?: VeskEventHandler<SubmitEvent>;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n interface VeskGlobalAttributes extends VeskCommonAttributes, VeskEventAttributes {\n children?: Component;\n }\n interface VeskAnchorAttributes extends VeskGlobalAttributes {\n href?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n type?: string;\n hreflang?: string;\n }\n interface VeskMediaAttributes extends VeskGlobalAttributes {\n src?: string;\n width?: string | number;\n height?: string | number;\n }\n interface VeskInputAttributes extends VeskGlobalAttributes {\n type?: string;\n name?: string;\n value?: string | number | readonly string[];\n placeholder?: string;\n checked?: boolean | string;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n min?: string | number;\n max?: string | number;\n step?: string | number;\n pattern?: string;\n autoComplete?: string;\n autoFocus?: boolean | string;\n multiple?: boolean | string;\n accept?: string;\n size?: number;\n list?: string;\n }\n interface IntrinsicElements {\n html?: VeskGlobalAttributes & { manifest?: string };\n head?: VeskGlobalAttributes;\n body?: VeskGlobalAttributes;\n div?: VeskGlobalAttributes;\n span?: VeskGlobalAttributes;\n p?: VeskGlobalAttributes;\n h1?: VeskGlobalAttributes;\n h2?: VeskGlobalAttributes;\n h3?: VeskGlobalAttributes;\n h4?: VeskGlobalAttributes;\n h5?: VeskGlobalAttributes;\n h6?: VeskGlobalAttributes;\n a?: VeskAnchorAttributes;\n nav?: VeskGlobalAttributes;\n header?: VeskGlobalAttributes;\n footer?: VeskGlobalAttributes;\n main?: VeskGlobalAttributes;\n section?: VeskGlobalAttributes;\n article?: VeskGlobalAttributes;\n aside?: VeskGlobalAttributes;\n button?: VeskGlobalAttributes & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean | string;\n name?: string;\n value?: string | number;\n };\n form?: VeskGlobalAttributes & {\n action?: string;\n method?: 'get' | 'post';\n target?: string;\n encType?: string;\n noValidate?: boolean | string;\n name?: string;\n autoComplete?: string;\n };\n input?: VeskInputAttributes;\n textarea?: VeskGlobalAttributes & {\n rows?: number;\n cols?: number;\n placeholder?: string;\n value?: string | number;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n name?: string;\n };\n select?: VeskGlobalAttributes & {\n name?: string;\n value?: string | number | readonly string[];\n disabled?: boolean | string;\n required?: boolean | string;\n multiple?: boolean | string;\n size?: number;\n autoComplete?: string;\n };\n option?: VeskGlobalAttributes & {\n value?: string | number;\n selected?: boolean | string;\n disabled?: boolean | string;\n label?: string;\n };\n optgroup?: VeskGlobalAttributes & { label?: string; disabled?: boolean | string };\n label?: VeskGlobalAttributes & { htmlFor?: string };\n fieldset?: VeskGlobalAttributes & { disabled?: boolean | string; name?: string; form?: string };\n legend?: VeskGlobalAttributes;\n datalist?: VeskGlobalAttributes;\n img?: VeskGlobalAttributes & {\n src?: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n srcSet?: string;\n sizes?: string;\n loading?: 'eager' | 'lazy';\n decoding?: 'sync' | 'async' | 'auto';\n };\n picture?: VeskGlobalAttributes;\n source?: VeskGlobalAttributes & { src?: string; srcSet?: string; sizes?: string; media?: string; type?: string };\n video?: VeskMediaAttributes & {\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n poster?: string;\n playsInline?: boolean | string;\n };\n audio?: VeskGlobalAttributes & {\n src?: string;\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n };\n track?: VeskGlobalAttributes & {\n src?: string;\n kind?: string;\n srclang?: string;\n label?: string;\n default?: boolean | string;\n };\n canvas?: VeskGlobalAttributes & { width?: number; height?: number };\n iframe?: VeskGlobalAttributes & {\n src?: string;\n srcDoc?: string;\n width?: string | number;\n height?: string | number;\n allow?: string;\n loading?: 'eager' | 'lazy';\n sandbox?: string;\n allowFullScreen?: boolean | string;\n referrerPolicy?: string;\n };\n embed?: VeskGlobalAttributes & { src?: string; type?: string; width?: string | number; height?: string | number };\n object?: VeskGlobalAttributes & { data?: string; type?: string; name?: string; width?: string | number; height?: string | number };\n table?: VeskGlobalAttributes;\n caption?: VeskGlobalAttributes;\n thead?: VeskGlobalAttributes;\n tbody?: VeskGlobalAttributes;\n tfoot?: VeskGlobalAttributes;\n tr?: VeskGlobalAttributes;\n th?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; scope?: string; headers?: string };\n td?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; headers?: string };\n col?: VeskGlobalAttributes & { span?: number };\n colgroup?: VeskGlobalAttributes & { span?: number };\n ul?: VeskGlobalAttributes;\n ol?: VeskGlobalAttributes & { start?: number; reversed?: boolean | string; type?: string };\n li?: VeskGlobalAttributes & { value?: number };\n dl?: VeskGlobalAttributes;\n dt?: VeskGlobalAttributes;\n dd?: VeskGlobalAttributes;\n br?: VeskGlobalAttributes;\n hr?: VeskGlobalAttributes;\n pre?: VeskGlobalAttributes;\n code?: VeskGlobalAttributes;\n blockquote?: VeskGlobalAttributes & { cite?: string };\n q?: VeskGlobalAttributes & { cite?: string };\n strong?: VeskGlobalAttributes;\n em?: VeskGlobalAttributes;\n small?: VeskGlobalAttributes;\n s?: VeskGlobalAttributes;\n cite?: VeskGlobalAttributes;\n dfn?: VeskGlobalAttributes;\n abbr?: VeskGlobalAttributes & { title?: string };\n time?: VeskGlobalAttributes & { dateTime?: string };\n data?: VeskGlobalAttributes & { value?: string | number };\n mark?: VeskGlobalAttributes;\n del?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n ins?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n sub?: VeskGlobalAttributes;\n sup?: VeskGlobalAttributes;\n u?: VeskGlobalAttributes;\n kbd?: VeskGlobalAttributes;\n samp?: VeskGlobalAttributes;\n var?: VeskGlobalAttributes;\n figure?: VeskGlobalAttributes;\n figcaption?: VeskGlobalAttributes;\n details?: VeskGlobalAttributes & { open?: boolean | string };\n summary?: VeskGlobalAttributes;\n dialog?: VeskGlobalAttributes & { open?: boolean | string };\n menu?: VeskGlobalAttributes;\n address?: VeskGlobalAttributes;\n b?: VeskGlobalAttributes;\n i?: VeskGlobalAttributes;\n ruby?: VeskGlobalAttributes;\n rt?: VeskGlobalAttributes;\n rp?: VeskGlobalAttributes;\n bdi?: VeskGlobalAttributes;\n bdo?: VeskGlobalAttributes;\n wbr?: VeskGlobalAttributes;\n area?: VeskGlobalAttributes & {\n coords?: string;\n shape?: string;\n href?: string;\n target?: string;\n alt?: string;\n };\n map?: VeskGlobalAttributes & { name?: string };\n noscript?: VeskGlobalAttributes;\n template?: VeskGlobalAttributes;\n slot?: VeskGlobalAttributes & { name?: string };\n meta?: VeskGlobalAttributes & {\n name?: string;\n content?: string;\n charSet?: string;\n httpEquiv?: string;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and\n // real code (and SSR output) writes charset. Keep in sync with the\n // camelCase members.\n charset?: string;\n };\n title?: VeskGlobalAttributes;\n base?: VeskGlobalAttributes & { href?: string; target?: string };\n link?: VeskGlobalAttributes & {\n rel?: string;\n href?: string;\n sizes?: string;\n media?: string;\n as?: string;\n crossOrigin?: string;\n integrity?: string;\n type?: string;\n // Lowercase alias \u2014 see the meta note above.\n crossorigin?: string | boolean;\n };\n style?: VeskGlobalAttributes & { media?: string };\n script?: VeskGlobalAttributes & {\n src?: string;\n async?: boolean | string;\n defer?: boolean | string;\n type?: string;\n crossOrigin?: string;\n integrity?: string;\n nonce?: string;\n noModule?: boolean | string;\n // Lowercase aliases \u2014 see the meta note above.\n crossorigin?: boolean | string;\n };\n svg?: VeskGlobalAttributes & {\n viewBox?: string;\n xmlns?: string;\n width?: string | number;\n height?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n g?: VeskGlobalAttributes & { transform?: string; fill?: string; stroke?: string; strokeWidth?: string | number };\n path?: VeskGlobalAttributes & {\n d?: string;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n fillRule?: string;\n clipRule?: string;\n };\n circle?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n r?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n ellipse?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n rect?: VeskGlobalAttributes & {\n x?: string | number;\n y?: string | number;\n width?: string | number;\n height?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n line?: VeskGlobalAttributes & {\n x1?: string | number;\n y1?: string | number;\n x2?: string | number;\n y2?: string | number;\n stroke?: string;\n strokeWidth?: string | number;\n };\n polyline?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n polygon?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n text?: VeskGlobalAttributes & { x?: string | number; y?: string | number; fill?: string; fontSize?: string | number };\n defs?: VeskGlobalAttributes;\n linearGradient?: VeskGlobalAttributes;\n radialGradient?: VeskGlobalAttributes;\n stop?: VeskGlobalAttributes & { offset?: string | number; stopColor?: string; stopOpacity?: string | number };\n\n // Unknown/custom tags stay permissive \u2014 components and web components\n // resolve through the index signature, known tags get the typed members.\n [elemName: string]: unknown;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n}\ndeclare type Component = string | number | boolean | null | undefined | Component[];\ndeclare const Head: (props: { children?: Component }) => Component;\n// Server-side .vsk code reads process.env (NODE_ENV, feature flags, secrets).\n// @types/node is not installed for browser targets, so declare the slice the\n// framework documents rather than failing every project that branches on env.\ndeclare const process: {\n env: Record<string, string | undefined>;\n argv: string[];\n platform: string;\n cwd(): string;\n exit(code?: number): never;\n};\ninterface Tracked<T> {\n get(): T;\n set(value: T): void;\n}\ninterface Derived<T> {\n get(): T;\n set(value: T): void;\n}\ndeclare function track<T>(initialValue: T): Tracked<T>;\ndeclare function track<T>(fn: () => T): Derived<T>;\ndeclare function derived<T>(fn: () => T): Derived<T>;\ndeclare function effect(fn: () => void): unknown;\ndeclare function untrack<T>(fn: () => T): T;\ndeclare function peek<T>(fn: () => T): T;\ndeclare function tick(): Promise<void>;\ndeclare function flushSync(fn: () => void): void;\ndeclare function on_destroy(fn: () => void): void;\n/**\n * A context created by createContext. The value type flows from the default\n * (or an explicit type argument) through set() and every get().\n */\ninterface VeskContext<T> {\n readonly id: symbol;\n get(): T;\n set(value: T): void;\n}\ndeclare function createContext<const T>(defaultValue: T): VeskContext<T>;\n// Typed request-scoped store (middleware locals, event payloads). Declare the\n// shape once and every set/get is checked against it.\ninterface VeskLocals<T extends object> {\n set<K extends keyof T>(key: K, value: T[K]): void;\n get<K extends keyof T>(key: K): T[K];\n has<K extends keyof T>(key: K): boolean;\n delete<K extends keyof T>(key: K): void;\n all(): T;\n}\ndeclare function createLocals<T extends object = Record<string, unknown>>(): VeskLocals<T>;\n// useFetch returns a real Promise carrying resource state. In async components\n// you must `await` it before reading/iterating the payload; passing\n// `into: <tracked cell>` writes the payload into the cell and makes awaiting\n// unnecessary (the return value can be ignored).\ninterface VeskResource<T> extends Promise<T> {\n loading: boolean;\n error: unknown;\n data: T | undefined;\n refresh(): void;\n abort(): void;\n}\ninterface VeskUseFetchOptions<T> {\n /** Cache/SSR key \u2014 defaults to the URL string. */\n key?: string;\n /** Target tracked cell (from track<T>()) \u2014 the payload is written into it, so awaiting is unnecessary. */\n into?: Tracked<T>;\n staleTime?: number;\n keepPreviousData?: boolean;\n retry?: number;\n retryDelay?: number;\n timeout?: number;\n enabled?: boolean;\n dedupe?: boolean;\n method?: string;\n headers?: Record<string, string>;\n body?: unknown;\n credentials?: 'omit' | 'same-origin' | 'include';\n signal?: { readonly aborted: boolean };\n}\ndeclare function useFetch<T = unknown>(\n urlOrFn: string | (() => Promise<T>),\n options?: VeskUseFetchOptions<T>,\n): VeskResource<T>;\ndeclare namespace useFetch {\n function text<T = string>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function json<T = unknown>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function arrayBuffer<T = ArrayBuffer>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n}\ndeclare function useRouter(): unknown;\ndeclare function useParams(): Record<string, string>;\ndeclare function usePathname(): string;\ndeclare function useSearchParams(): URLSearchParams;\ndeclare function useNavigate(): (to: string) => void;\ndeclare function defineAction(...args: unknown[]): unknown;\ndeclare const Form: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Field: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function required(...args: unknown[]): unknown;\ndeclare function email(...args: unknown[]): unknown;\ndeclare function minLength(...args: unknown[]): unknown;\ndeclare function maxLength(...args: unknown[]): unknown;\ndeclare function pattern(...args: unknown[]): unknown;\ndeclare function custom(...args: unknown[]): unknown;\ndeclare const Link: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const NavLink: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Outlet: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Image: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Portal: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Experiment: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function useLoadingIndicator(options?: {\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n}): {\n progress: Tracked<number>;\n isLoading: Tracked<boolean>;\n error: Tracked<boolean>;\n start(opts?: { force?: boolean }): void;\n set(value: number, opts?: { force?: boolean }): void;\n finish(opts?: { force?: boolean; error?: boolean }): void;\n clear(): void;\n};\ndeclare const LoadingIndicator: (props: {\n color?: string | false;\n errorColor?: string;\n height?: number | string;\n position?: 'top' | 'bottom';\n zIndex?: number;\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n class?: string;\n className?: string;\n style?: string;\n children?: Component;\n [k: string]: unknown;\n}) => Component;\ndeclare const JsonLd: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ArticleSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ProductSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const FAQPageSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const BreadcrumbListSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const OrganizationSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const LocalBusinessSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const VideoSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function redirect(...args: unknown[]): unknown;\ndeclare function permanentRedirect(...args: unknown[]): unknown;\ndeclare function notFound(...args: unknown[]): never;\ndeclare class NotFoundError extends Error {}\ndeclare function createResource(...args: unknown[]): unknown;\ndeclare function getAction(...args: unknown[]): unknown;\ndeclare function validateActionInput(...args: unknown[]): unknown;\ndeclare function issuesToFieldMap(...args: unknown[]): unknown;\ndeclare function isFormAction(...args: unknown[]): unknown;\n";
|
|
13
13
|
export declare const RUNTIME_OVERRIDE = "\nimport '@vesk/runtime';\ndeclare module '@vesk/runtime' {\n export function track<T>(initialValue: T): Tracked<T>;\n export function track<T>(fn: () => T): Derived<T>;\n export function derived<T>(fn: () => T): Derived<T>;\n export function createContext<const T>(defaultValue: T): VeskContext<T>;\n export function createLocals<T extends object = Record<string, unknown>>(): VeskLocals<T>;\n}\n";
|
|
14
14
|
export interface TypecheckResult {
|
|
15
15
|
errors: TypecheckError[];
|
package/dist/typecheck.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../src/typecheck.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../src/typecheck.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,eAAO,MAAM,OAAO,uioBA8gBnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,uZAS5B,CAAC;AA6LF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAuCD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,eAAe,CA2GlG;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAItE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAI1E"}
|
package/dist/typecheck.js
CHANGED
|
@@ -425,20 +425,16 @@ interface VeskLocals<T extends object> {
|
|
|
425
425
|
all(): T;
|
|
426
426
|
}
|
|
427
427
|
declare function createLocals<T extends object = Record<string, unknown>>(): VeskLocals<T>;
|
|
428
|
-
// useFetch returns a
|
|
429
|
-
//
|
|
430
|
-
//
|
|
431
|
-
//
|
|
432
|
-
interface VeskResource<T> {
|
|
428
|
+
// useFetch returns a real Promise carrying resource state. In async components
|
|
429
|
+
// you must \`await\` it before reading/iterating the payload; passing
|
|
430
|
+
// \`into: <tracked cell>\` writes the payload into the cell and makes awaiting
|
|
431
|
+
// unnecessary (the return value can be ignored).
|
|
432
|
+
interface VeskResource<T> extends Promise<T> {
|
|
433
433
|
loading: boolean;
|
|
434
434
|
error: unknown;
|
|
435
435
|
data: T | undefined;
|
|
436
436
|
refresh(): void;
|
|
437
437
|
abort(): void;
|
|
438
|
-
then<TResult1 = T, TResult2 = never>(
|
|
439
|
-
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
|
440
|
-
onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,
|
|
441
|
-
): PromiseLike<TResult1 | TResult2>;
|
|
442
438
|
}
|
|
443
439
|
interface VeskUseFetchOptions<T> {
|
|
444
440
|
/** Cache/SSR key — defaults to the URL string. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.96",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk compiler — lexer, parser, semantic analysis, IR, codegen",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@sveltejs/acorn-typescript": "^1.0.0",
|
|
23
|
-
"@vesk/types": "^0.2.
|
|
23
|
+
"@vesk/types": "^0.2.96",
|
|
24
24
|
"acorn": "^8.15.0",
|
|
25
25
|
"esrap": "^2.3.0",
|
|
26
26
|
"is-reference": "^3.0.0",
|