brumate 0.0.1 → 0.1.0
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/README.md +43 -72
- package/dist/boot-DN1ZU8Hg.d.ts +37 -0
- package/dist/cli.js +2 -2
- package/dist/{client-DuDTDePF.d.ts → client-DwJInP_a.d.ts} +133 -44
- package/dist/client-routes-DakuM32C.js +94 -0
- package/dist/client-routes-DakuM32C.js.map +1 -0
- package/dist/{cookies-rgIAc8IE.js → cookies-Av5WFmcf.js} +18 -8
- package/dist/cookies-Av5WFmcf.js.map +1 -0
- package/dist/{devtools-Bm8cS7hX.js → devtools-BKjnHrnv.js} +10 -5
- package/dist/devtools-BKjnHrnv.js.map +1 -0
- package/dist/{devtools-panel-CTbDSBBA.js → devtools-panel-AWOn0VK2.js} +23 -26
- package/dist/devtools-panel-AWOn0VK2.js.map +1 -0
- package/dist/{files-D_JUcSU5.js → files-BBLPU9JR.js} +22 -3
- package/dist/{files-D_JUcSU5.js.map → files-BBLPU9JR.js.map} +1 -1
- package/dist/{html-CxWpXngy.js → html-DEeoepg3.js} +47 -10
- package/dist/html-DEeoepg3.js.map +1 -0
- package/dist/{html-DV-Tezgq.d.ts → html-Du8jY2Cc.d.ts} +14 -2
- package/dist/index.d.ts +63 -6
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/{inspect-CGCWfaEx.js → inspect-CRZlO11T.js} +743 -163
- package/dist/inspect-CRZlO11T.js.map +1 -0
- package/dist/loader-Dc9OwY5I.js +101 -0
- package/dist/loader-Dc9OwY5I.js.map +1 -0
- package/dist/{navigate-C5dP89YL.js → navigate-CzLjnoPH.js} +112 -59
- package/dist/navigate-CzLjnoPH.js.map +1 -0
- package/dist/{produce-BjQGMpqL.d.ts → produce-CtZ32UGG.d.ts} +13 -3
- package/dist/{rpc-B86KKjzx.js → rpc-9fSqL_YK.js} +57 -12
- package/dist/rpc-9fSqL_YK.js.map +1 -0
- package/dist/runtime/client.d.ts +4 -4
- package/dist/runtime/client.js +599 -306
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/devtools.d.ts +3 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/hot.js +9 -5
- package/dist/runtime/hot.js.map +1 -1
- package/dist/runtime/html.d.ts +2 -2
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +12 -2
- package/dist/runtime/loader.js +3 -1
- package/dist/runtime/server.d.ts +4 -4
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +2 -2
- package/dist/runtime/signals.js +5 -5
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +3 -0
- package/dist/runtime/static-loader.js +1 -0
- package/dist/runtime/testing.d.ts +21 -2
- package/dist/runtime/testing.js +83 -7
- package/dist/runtime/testing.js.map +1 -1
- package/dist/{server-sQCvduOz.d.ts → server-BxqjLUnV.d.ts} +211 -20
- package/dist/{server-CX3JnPCs.js → server-DZsgnPKS.js} +595 -185
- package/dist/server-DZsgnPKS.js.map +1 -0
- package/dist/shared-CWYOd0H3.js +40 -0
- package/dist/shared-CWYOd0H3.js.map +1 -0
- package/dist/static-loader-BcFh4ebX.d.ts +11 -0
- package/dist/static-loader-ClNkHZGn.js +185 -0
- package/dist/static-loader-ClNkHZGn.js.map +1 -0
- package/dist/stream-bgNCMcaA.js +280 -0
- package/dist/stream-bgNCMcaA.js.map +1 -0
- package/dist/vite.d.ts +30 -5
- package/dist/vite.js +501 -62
- package/dist/vite.js.map +1 -1
- package/package.json +7 -2
- package/types.d.ts +5 -0
- package/dist/cookies-rgIAc8IE.js.map +0 -1
- package/dist/devtools-Bm8cS7hX.js.map +0 -1
- package/dist/devtools-panel-CTbDSBBA.js.map +0 -1
- package/dist/html-CxWpXngy.js.map +0 -1
- package/dist/inspect-CGCWfaEx.js.map +0 -1
- package/dist/loader-BUhNqDHw.d.ts +0 -30
- package/dist/loader-py4qu6tQ.js +0 -215
- package/dist/loader-py4qu6tQ.js.map +0 -1
- package/dist/navigate-C5dP89YL.js.map +0 -1
- package/dist/rpc-B86KKjzx.js.map +0 -1
- package/dist/server-CX3JnPCs.js.map +0 -1
- package/dist/shared-BE_oBSDM.js +0 -176
- package/dist/shared-BE_oBSDM.js.map +0 -1
- package/dist/stream-cvhqOzfs.js +0 -145
- package/dist/stream-cvhqOzfs.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1498,7 +1498,16 @@ interface ClientBlock extends Range {
|
|
|
1498
1498
|
trigger: ClientTrigger;
|
|
1499
1499
|
body: Body;
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1501
|
+
/**
|
|
1502
|
+
* `#offscreen (visible) { … }`: a body that stays in the page while it is
|
|
1503
|
+
* hidden, with its markup and state, but does not run its effects.
|
|
1504
|
+
*/
|
|
1505
|
+
interface OffscreenBlock extends Range {
|
|
1506
|
+
kind: "offscreen";
|
|
1507
|
+
visible: Expression;
|
|
1508
|
+
body: Body;
|
|
1509
|
+
}
|
|
1510
|
+
type Block = IfBlock | ForBlock | RepeatBlock | SwitchBlock | KeyBlock | TryBlock | LoadingBlock | PortalBlock | HeadBlock | ClientBlock | OffscreenBlock;
|
|
1502
1511
|
interface TemplateDecl extends Range {
|
|
1503
1512
|
kind: "template";
|
|
1504
1513
|
name: string;
|
|
@@ -1605,7 +1614,7 @@ interface Site {
|
|
|
1605
1614
|
trigger?: "visible" | "idle" | "load";
|
|
1606
1615
|
/** True if the site awaits outside a nested function. */
|
|
1607
1616
|
awaits: boolean;
|
|
1608
|
-
/** More code of the site, such as the context of `$
|
|
1617
|
+
/** More code of the site, such as the context of `$setContext(context, value)`. */
|
|
1609
1618
|
extra?: Node[];
|
|
1610
1619
|
}
|
|
1611
1620
|
type Severity = "error" | "warning";
|
|
@@ -1769,6 +1778,19 @@ interface StyleOutput {
|
|
|
1769
1778
|
diagnostics: Diagnostic[];
|
|
1770
1779
|
/** Absolute paths of the files that SCSS or Less imported. */
|
|
1771
1780
|
dependencies: string[];
|
|
1781
|
+
/**
|
|
1782
|
+
* The compound selectors that got the scope attribute, by what an element
|
|
1783
|
+
* needs to match one. See `needsScope`.
|
|
1784
|
+
*/
|
|
1785
|
+
targets: ScopeTarget[];
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* What a scoped compound selector needs of an element: its tag, in lower
|
|
1789
|
+
* case, and its classes. A compound without either can match any element.
|
|
1790
|
+
*/
|
|
1791
|
+
interface ScopeTarget {
|
|
1792
|
+
tag?: string;
|
|
1793
|
+
classes: string[];
|
|
1772
1794
|
}
|
|
1773
1795
|
//#endregion
|
|
1774
1796
|
//#region src/plan.d.ts
|
|
@@ -1794,6 +1816,21 @@ interface Plan {
|
|
|
1794
1816
|
bodyScopes: Map<Body, Scope>;
|
|
1795
1817
|
/** The anchor index of a node within its scope. */
|
|
1796
1818
|
anchors: Map<AnchorTarget, number>;
|
|
1819
|
+
/**
|
|
1820
|
+
* Inserts that are the only content of their element. They share the
|
|
1821
|
+
* element's anchor and update its children, so they have no markers.
|
|
1822
|
+
*/
|
|
1823
|
+
contents: Set<Markup>;
|
|
1824
|
+
/**
|
|
1825
|
+
* The inserts of `contents` whose element holds text, such as a
|
|
1826
|
+
* `<textarea>` or a `<title>`. The client sets the element's text.
|
|
1827
|
+
*/
|
|
1828
|
+
textContents: Set<Markup>;
|
|
1829
|
+
/**
|
|
1830
|
+
* Lists whose item bodies are one element. The element's `b-b` marks
|
|
1831
|
+
* the item, in place of `<!--i…-->` and `<!--/i-->`.
|
|
1832
|
+
*/
|
|
1833
|
+
elementItems: Set<Block>;
|
|
1797
1834
|
/** The export name of each client root, such as `h3`. */
|
|
1798
1835
|
symbols: Map<Site, string>;
|
|
1799
1836
|
/** Sites whose code runs on the client, including update code for live nodes. */
|
|
@@ -1804,6 +1841,8 @@ interface Plan {
|
|
|
1804
1841
|
liveStyles: boolean;
|
|
1805
1842
|
/** True when server function IDs hash the names of the functions. */
|
|
1806
1843
|
hideNames: boolean;
|
|
1844
|
+
/** Errors in markup that the client could not update. */
|
|
1845
|
+
diagnostics: Diagnostic[];
|
|
1807
1846
|
}
|
|
1808
1847
|
/** Returns the component name for a file name, such as `TodoList` for `todo-list.brm`. */
|
|
1809
1848
|
export declare function getComponentName(filename: string): string;
|
|
@@ -1850,8 +1889,17 @@ interface CompileResult {
|
|
|
1850
1889
|
server: string;
|
|
1851
1890
|
/** The client entry module, as TypeScript. The loader imports it on the first event. */
|
|
1852
1891
|
client: string;
|
|
1853
|
-
/**
|
|
1892
|
+
/**
|
|
1893
|
+
* The parts of the client module, by name. The entry imports them when
|
|
1894
|
+
* they are needed. A small component has none: its entry holds the code.
|
|
1895
|
+
*/
|
|
1854
1896
|
parts: Record<string, string>;
|
|
1897
|
+
/** The parts that the entry loads for each part name, its own first. See `ClientOutput`. */
|
|
1898
|
+
loaders: Record<string, string[]>;
|
|
1899
|
+
/** The ID, the props map and the update tables of the client entry, without code. */
|
|
1900
|
+
table: string;
|
|
1901
|
+
/** False when nothing of the component runs in the browser, so it needs no client module. */
|
|
1902
|
+
clientCode: boolean;
|
|
1855
1903
|
/**
|
|
1856
1904
|
* The render module, as TypeScript. It renders the component on the
|
|
1857
1905
|
* client, inside a parent's block that changes.
|
|
@@ -1941,12 +1989,21 @@ interface ClientOutput {
|
|
|
1941
1989
|
* functions that more than one part calls.
|
|
1942
1990
|
*/
|
|
1943
1991
|
parts: Record<string, string>;
|
|
1992
|
+
/** The ID, the props map, the update table and the refresh table: what the page depends on. */
|
|
1993
|
+
table: string;
|
|
1994
|
+
/**
|
|
1995
|
+
* The parts that each export part loads, by name: its own first, then the
|
|
1996
|
+
* ones it starts loading with it. Empty when the entry holds the code.
|
|
1997
|
+
*/
|
|
1998
|
+
loaders: Record<string, string[]>;
|
|
1999
|
+
/** False when nothing of the component runs in the browser. */
|
|
2000
|
+
clientCode: boolean;
|
|
1944
2001
|
diagnostics: Diagnostic[];
|
|
1945
2002
|
}
|
|
1946
2003
|
/**
|
|
1947
2004
|
* Generates the client entry and its parts. When the parts are smaller than
|
|
1948
|
-
* `merge` bytes in all,
|
|
1949
|
-
* one module instead of several.
|
|
2005
|
+
* `merge` bytes in all, after minifying, the entry holds their code itself,
|
|
2006
|
+
* so the first event loads one module instead of several.
|
|
1950
2007
|
*/
|
|
1951
2008
|
declare function generateClient$1(file: SFCFile, plan: Plan, merge?: number, shared?: SharedContext): ClientOutput;
|
|
1952
2009
|
//#endregion
|
|
@@ -2027,5 +2084,5 @@ export declare function inspect(source: string, options?: InspectOptions): {
|
|
|
2027
2084
|
text: string;
|
|
2028
2085
|
};
|
|
2029
2086
|
//#endregion
|
|
2030
|
-
export type { AnchorTarget, Attribute, Block, Body, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, Diagnostic, DynamicTagNode, Edge, ElementNode, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, Modifier, ParseOptions, Plan, PortalBlock, PrefetchAttribute, PrefetchStrategy, ProjectProps, Range, ReactiveModule, RefAttribute, Reference, RepeatBlock, Resolve, ResolveModule, SFCFile, Scope, ScopeKind, ScopePlan, Script, SemanticModel, Severity, SharedSite, Site, SiteKind, SourceMap, SpreadAttribute, StaticAttribute, Style, SwitchBlock, TemplateDecl, TextNode, TryBlock, ValueAttribute, upstreamMemos };
|
|
2087
|
+
export type { AnchorTarget, Attribute, Block, Body, Branch, CheckMapping, CheckOutput, ClientBlock, ClientTrigger, CompileOptions, CompileResult, ComponentNode, ComponentUsage, ComputedAttribute, Declaration, DeclarationKind, Diagnostic, DynamicTagNode, Edge, ElementNode, EventAttribute, Expression, ForBlock, FragmentNode, GlobalListenerNode, Graph, GraphNode, GraphOptions, HeadBlock, IfBlock, InsertNode, InspectEntry, InspectOptions, InspectReport, KeyBlock, LoadingBlock, Location, Markup, Modifier, OffscreenBlock, ParseOptions, Plan, PortalBlock, PrefetchAttribute, PrefetchStrategy, ProjectProps, Range, ReactiveModule, RefAttribute, Reference, RepeatBlock, Resolve, ResolveModule, SFCFile, Scope, ScopeKind, ScopePlan, Script, SemanticModel, Severity, SharedSite, Site, SiteKind, SourceMap, SpreadAttribute, StaticAttribute, Style, SwitchBlock, TemplateDecl, TextNode, TryBlock, ValueAttribute, upstreamMemos };
|
|
2031
2088
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as summarize, D as analyzeProjectProps, E as analyzeProject, F as analyze, I as isWithin, L as lookup, M as buildGraph, N as BrumateError, P as getLocation, T as unmarked, _ as getComponentName, a as CompileError, b as generateShared, c as generateClient$1, h as createPlan, j as parse, k as resolveRelative, l as generateRender$1, m as clientState, n as inspect, o as compile, p as blockBodies, r as report, t as formatReport, u as generateServer$1, x as sharedSites, y as SHARED_QUERY } from "./inspect-CRZlO11T.js";
|
|
2
2
|
//#region src/print.ts
|
|
3
3
|
function at(source, range) {
|
|
4
4
|
const { line, column } = getLocation(source, range.start);
|
|
@@ -63,6 +63,10 @@ function printAST(file) {
|
|
|
63
63
|
write(depth, `key (${item.value.code})`);
|
|
64
64
|
body(item.body, depth + 1, "body");
|
|
65
65
|
break;
|
|
66
|
+
case "offscreen":
|
|
67
|
+
write(depth, `offscreen (${item.visible.code})`);
|
|
68
|
+
body(item.body, depth + 1, "body");
|
|
69
|
+
break;
|
|
66
70
|
case "try": {
|
|
67
71
|
write(depth, "try");
|
|
68
72
|
body(item.body, depth + 1, "body");
|
|
@@ -215,6 +219,11 @@ function generateClient(file, plan, merge) {
|
|
|
215
219
|
//#endregion
|
|
216
220
|
//#region src/check.ts
|
|
217
221
|
/**
|
|
222
|
+
* The name of the component function. A file can import the name that its
|
|
223
|
+
* file name gives the component, such as `SignIn` in `sign-in.brm`.
|
|
224
|
+
*/
|
|
225
|
+
const COMPONENT = "$$Component";
|
|
226
|
+
/**
|
|
218
227
|
* Declarations that the generated code calls to check the markup. They are
|
|
219
228
|
* local to each generated file.
|
|
220
229
|
*/
|
|
@@ -339,7 +348,7 @@ var Generator = class {
|
|
|
339
348
|
out.text("\n");
|
|
340
349
|
}
|
|
341
350
|
const type = propsType(file.instanceScript?.program);
|
|
342
|
-
out.text(`\nexport default
|
|
351
|
+
out.text(`\nexport default ${COMPONENT};\nasync function ${COMPONENT}`);
|
|
343
352
|
if (file.generics) out.text(`<${file.generics}>`);
|
|
344
353
|
out.text("($$props: ");
|
|
345
354
|
if (type) out.copy(type);
|
|
@@ -355,7 +364,7 @@ var Generator = class {
|
|
|
355
364
|
this.templates(file.templates);
|
|
356
365
|
this.nodes(file.children);
|
|
357
366
|
out.text("return '';\n}\n");
|
|
358
|
-
out.text(`${
|
|
367
|
+
out.text(`${COMPONENT}.brumateId = '';\n`);
|
|
359
368
|
}
|
|
360
369
|
collectBodyImports(nodes) {
|
|
361
370
|
for (const node of nodes) {
|
|
@@ -581,6 +590,13 @@ var Generator = class {
|
|
|
581
590
|
this.body(block.body);
|
|
582
591
|
out.text("}\n");
|
|
583
592
|
return;
|
|
593
|
+
case "offscreen":
|
|
594
|
+
out.text("$$use(");
|
|
595
|
+
out.expression(block.visible);
|
|
596
|
+
out.text(");\n{\n");
|
|
597
|
+
this.body(block.body);
|
|
598
|
+
out.text("}\n");
|
|
599
|
+
return;
|
|
584
600
|
case "try":
|
|
585
601
|
out.text("try {\n");
|
|
586
602
|
this.body(block.body);
|
|
@@ -672,7 +688,7 @@ function toTypeScript(source, filename = "Component.brm") {
|
|
|
672
688
|
out.copy(range);
|
|
673
689
|
out.text("\n");
|
|
674
690
|
}
|
|
675
|
-
out.text(`export default async function ${
|
|
691
|
+
out.text(`export default async function ${COMPONENT}(..._: any[]): Promise<string> {\n return '';\n}\n`);
|
|
676
692
|
return {
|
|
677
693
|
code: out.code,
|
|
678
694
|
mappings: out.mappings,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["server","render","client"],"sources":["../src/print.ts","../src/generate.ts","../src/check.ts"],"sourcesContent":["import type { Attribute, Block, Body, Markup, Range, SFCFile } from './ast.ts';\nimport { getLocation } from './error.ts';\nimport type { Graph, GraphNode } from './graph.ts';\nimport type { Diagnostic, Scope, SemanticModel, Site } from './model.ts';\n\nfunction at(source: string, range: Range): string {\n const { line, column } = getLocation(source, range.start);\n return `${line}:${column}`;\n}\n\nfunction quote(text: string): string {\n return JSON.stringify(text);\n}\n\nfunction printAttribute(item: Attribute): string {\n switch (item.kind) {\n case 'static':\n return item.value === true ? item.name : `${item.name}=${quote(item.value)}`;\n case 'value':\n return `${item.name}=(${item.value.code})`;\n case 'event':\n return `${item.name}${item.modifiers.map((modifier) => `:${modifier}`).join('')}=(${item.handler.code})`;\n case 'ref':\n return `ref=${item.target}`;\n case 'prefetch':\n return `prefetch=${quote(item.strategy)}`;\n case 'spread':\n return `{...${item.value.code}}`;\n case 'computed':\n return `[${item.name.code}]${item.value === true ? '' : `=(${item.value.code})`}`;\n }\n}\n\n/** Prints the syntax tree, one node per line. */\nexport function printAST(file: SFCFile): string {\n const lines: string[] = [];\n const write = (depth: number, text: string): void => {\n lines.push(`${' '.repeat(depth)}${text}`);\n };\n\n const body = (item: Body, depth: number, label: string): void => {\n write(depth, label);\n if (item.script) {\n write(depth + 1, 'script');\n }\n for (const template of item.templates) {\n write(depth + 1, `template ${template.name}`);\n body(template.body, depth + 2, 'body');\n }\n nodes(item.children, depth + 1);\n };\n\n const block = (item: Block, depth: number): void => {\n switch (item.kind) {\n case 'if':\n write(depth, 'if');\n for (const branch of item.branches) {\n body(branch.body, depth + 1, `branch (${branch.condition.code})`);\n }\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'for': {\n const key =\n item.key === undefined ? '' : ` by ${item.key === 'index' ? 'index' : item.key.code}`;\n const index = item.index ? `, ${item.index.name}` : '';\n const itemCode = file.source.slice(item.item.start, item.item.end);\n write(depth, `for (${itemCode}${index} of ${item.list.code.trim()}${key})`);\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n }\n case 'repeat':\n write(\n depth,\n `repeat (${item.index ? `${item.index.name} of ` : ''}${item.count.code.trim()})`,\n );\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'switch':\n write(depth, 'switch');\n for (const branch of item.cases) {\n body(branch.body, depth + 1, `case (${branch.condition.code})`);\n }\n if (item.fallback) {\n body(item.fallback, depth + 1, 'default');\n }\n break;\n case 'key':\n write(depth, `key (${item.value.code})`);\n body(item.body, depth + 1, 'body');\n break;\n case 'try': {\n write(depth, 'try');\n body(item.body, depth + 1, 'body');\n const names = [item.error?.name, item.reset?.name].filter(Boolean).join(', ');\n body(item.fallback, depth + 1, names ? `catch (${names})` : 'catch');\n break;\n }\n case 'loading':\n write(depth, item.on ? `loading (${item.on.code})` : 'loading');\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'head':\n write(depth, 'head');\n body(item.body, depth + 1, 'body');\n break;\n case 'portal':\n write(depth, item.target ? `portal (${item.target.code})` : 'portal');\n body(item.body, depth + 1, 'body');\n break;\n case 'client':\n write(depth, `client (${item.trigger})`);\n body(item.body, depth + 1, 'body');\n break;\n }\n };\n\n const node = (item: Markup, depth: number): void => {\n switch (item.kind) {\n case 'element':\n case 'component': {\n const name = item.kind === 'element' ? item.tag : item.name;\n const attributes = item.attributes.map((value) => ` ${printAttribute(value)}`).join('');\n write(depth, `${item.kind} <${name}${attributes}>`);\n nodes(item.children, depth + 1);\n break;\n }\n case 'dynamic':\n write(\n depth,\n `dynamic <{${item.tag.code}}${item.attributes.map((value) => ` ${printAttribute(value)}`).join('')}>`,\n );\n nodes(item.children, depth + 1);\n break;\n case 'fragment':\n write(depth, 'fragment');\n nodes(item.children, depth + 1);\n break;\n case 'listener':\n write(\n depth,\n `listener <${item.target}${item.attributes.map((value) => ` ${printAttribute(value)}`).join('')}>`,\n );\n break;\n case 'text':\n write(depth, `text ${quote(item.value)}`);\n break;\n case 'insert':\n write(depth, `insert {${item.expression.code}}`);\n break;\n default:\n block(item, depth);\n }\n };\n\n const nodes = (items: Markup[], depth: number): void => {\n for (const item of items) {\n node(item, depth);\n }\n };\n\n if (file.moduleScript) {\n write(0, 'script module');\n }\n if (file.instanceScript) {\n write(0, file.generics ? `script generics=${quote(file.generics)}` : 'script');\n }\n for (const style of file.styles) {\n write(0, `style ${style.lang}`);\n for (const variable of style.variables) {\n write(1, `variable (${variable.code})`);\n }\n }\n for (const template of file.templates) {\n write(0, `template ${template.name}`);\n body(template.body, 1, 'body');\n }\n nodes(file.children, 0);\n return lines.join('\\n');\n}\n\nfunction scopeLabel(source: string, scope: Scope): string {\n if (scope.kind === 'body' && scope.block) {\n return `${scope.id} body (${scope.block.kind} ${at(source, scope.block)})`;\n }\n if (scope.kind === 'template' && scope.template) {\n return `${scope.id} template ${scope.template.name}`;\n }\n return `${scope.id} ${scope.kind}`;\n}\n\nfunction siteLabel(source: string, site: Site): string {\n return `${site.label} (${at(source, site.range)})`;\n}\n\nfunction printDiagnostics(source: string, diagnostics: Diagnostic[], lines: string[]): void {\n if (diagnostics.length === 0) {\n return;\n }\n lines.push('diagnostics');\n for (const diagnostic of diagnostics) {\n lines.push(` ${diagnostic.severity} ${diagnostic.message} (${at(source, diagnostic.range)})`);\n }\n}\n\n/** Prints scopes, declarations, sites and diagnostics. */\nexport function printModel(source: string, model: SemanticModel): string {\n const lines: string[] = [];\n for (const scope of model.scopes) {\n lines.push(`scope ${scopeLabel(source, scope)}`);\n for (const declaration of scope.declarations.values()) {\n lines.push(` ${declaration.kind} ${declaration.name}`);\n }\n }\n lines.push('sites');\n for (const site of model.sites) {\n const parts = [siteLabel(source, site)];\n const reads = [\n ...new Set(site.reads.map((read) => (read.tracked ? '' : '~') + read.declaration.name)),\n ];\n const writes = [...new Set(site.writes.map((write) => write.declaration.name))];\n const calls = [...site.calls].map((declaration) => declaration.name);\n if (reads.length > 0) {\n parts.push(`reads ${reads.join(', ')}`);\n }\n if (writes.length > 0) {\n parts.push(`writes ${writes.join(', ')}`);\n }\n if (calls.length > 0) {\n parts.push(`calls ${calls.join(', ')}`);\n }\n lines.push(` ${parts.join(' ')}`);\n }\n printDiagnostics(source, model.diagnostics, lines);\n return lines.join('\\n');\n}\n\nfunction nodeLabel(source: string, node: GraphNode): string {\n switch (node.kind) {\n case 'source':\n return `${node.declaration.kind} ${node.declaration.name}`;\n case 'memo':\n return `${node.declaration.kind} ${node.declaration.name}`;\n default:\n return siteLabel(source, node.site);\n }\n}\n\n/** Prints the graph: nodes, what is live, what runs on the client and which scopes it creates. */\nexport function printGraph(source: string, graph: Graph): string {\n const lines: string[] = ['nodes'];\n for (const node of graph.nodes) {\n const from = graph.edges\n .filter((edge) => edge.to === node)\n .map((edge) => nodeLabel(source, edge.from));\n const state = graph.live.has(node) ? 'live' : 'static';\n lines.push(\n ` ${nodeLabel(source, node)} ${state}${from.length > 0 ? ` <- ${from.join(', ')}` : ''}`,\n );\n }\n lines.push('client');\n for (const site of graph.model.sites) {\n if (graph.reached.has(site)) {\n lines.push(` ${siteLabel(source, site)}${site.kind === 'server-function' ? ' (stub)' : ''}`);\n }\n }\n const created = graph.model.scopes.filter((scope) => graph.created.has(scope));\n if (created.length > 0) {\n lines.push('created');\n for (const scope of created) {\n lines.push(` ${scopeLabel(source, scope)}`);\n }\n }\n printDiagnostics(source, [...graph.model.diagnostics, ...graph.diagnostics], lines);\n return lines.join('\\n');\n}\n","// The code generators, for callers that compile without `compile`. Their\n// output carries the marks that `compile` turns into source maps, so these\n// remove them.\n\nimport type { SFCFile } from './ast.ts';\nimport { generateClient as client } from './codegen/client.ts';\nimport { generateRender as render } from './codegen/render.ts';\nimport { generateServer as server } from './codegen/server.ts';\nimport type { Plan } from './plan.ts';\nimport { unmarked } from './sourcemap.ts';\n\n/** Generates the server module. */\nexport function generateServer(file: SFCFile, plan: Plan): string {\n return unmarked(server(file, plan));\n}\n\n/** Generates the render module. */\nexport function generateRender(file: SFCFile, plan: Plan): string {\n return unmarked(render(file, plan));\n}\n\n/** Generates the client entry and its parts. */\nexport function generateClient(\n file: SFCFile,\n plan: Plan,\n merge?: number,\n): ReturnType<typeof client> {\n const result = client(file, plan, merge);\n return {\n ...result,\n code: unmarked(result.code),\n parts: Object.fromEntries(\n Object.entries(result.parts).map(([name, code]) => [name, unmarked(code)]),\n ),\n };\n}\n","// Turns a `.brm` file into TypeScript, so a type checker and an editor can\n// check it. The scripts and every expression of the markup are copied, with\n// mappings back to the file. The markup becomes statements in blocks that\n// match its control flow, so names are in scope where the markup reads them.\n\nimport type {\n Attribute,\n Block,\n Body,\n ComponentNode,\n Expression,\n Markup,\n Range,\n SFCFile,\n TemplateDecl,\n} from './ast.ts';\nimport { BrumateError } from './error.ts';\nimport type { oxc } from './oxc.ts';\nimport { parse } from './parser.ts';\nimport { analyze } from './analyze.ts';\nimport { buildGraph } from './graph.ts';\nimport type { Declaration } from './model.ts';\nimport { blockBodies, clientState, getComponentName } from './plan.ts';\n\n/** A range of the generated code that is copied from the file. */\nexport interface CheckMapping {\n /** Offset in the `.brm` file. */\n source: number;\n /** Offset in the generated code. */\n generated: number;\n length: number;\n}\n\nexport interface CheckOutput {\n code: string;\n mappings: CheckMapping[];\n /** The syntax error of the file. The code then holds only its scripts. */\n error?: BrumateError;\n}\n\n/**\n * Declarations that the generated code calls to check the markup. They are\n * local to each generated file.\n */\nconst HELPERS = `/// <reference types=\"brumate/types\" />\ntype $$Component<P> = (props: P, ...rest: any[]) => unknown;\ndeclare function $$component<P>(component: $$Component<P>, props: P): void;\ndeclare function $$dynamic(tag: string | $$Component<any>, props: Record<string, unknown>): void;\ntype $$Event<K, M> = K extends keyof M ? M[K] : Event;\ntype $$Element<T> = T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : T extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[T] : HTMLElement;\ndeclare function $$on<T extends string, K extends string>(tag: T, event: K, handler: (event: $$Event<K, HTMLElementEventMap> & { currentTarget: $$Element<T> }) => unknown): void;\ndeclare function $$onWindow<K extends string>(event: K, handler: (event: $$Event<K, WindowEventMap> & { currentTarget: Window }) => unknown): void;\ndeclare function $$onDocument<K extends string>(event: K, handler: (event: $$Event<K, DocumentEventMap> & { currentTarget: Document }) => unknown): void;\ndeclare function $$use(...values: unknown[]): void;\ntype $$Plain = string | number | boolean | bigint | null | undefined | Date | Error | URL | URLSearchParams | ArrayBuffer | ArrayBufferView | Blob | Headers | FormData | Request | Response;\ntype $$Sendable<T> = T extends $$Plain ? T : T extends { brumateId: string } ? T : T extends RegExp ? { 'A regular expression cannot be sent to the client. Send its source and flags': never } : T extends (...args: any[]) => any ? { 'A function cannot be sent to the client. Keep it out of the signal or memo': never } : T extends Promise<infer U> ? Promise<$$Sendable<U>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<$$Sendable<K>, $$Sendable<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<$$Sendable<V>> : T extends object ? { [K in keyof T]: $$Sendable<T[K]> } : T;\n/** Checks a value that the page state sends to the client. */\ndeclare function $$sendable<T>(value: T & $$Sendable<T>): void;\n`;\n\nclass Writer {\n code = '';\n readonly mappings: CheckMapping[] = [];\n private readonly source: string;\n\n constructor(source: string) {\n this.source = source;\n }\n\n text(value: string): void {\n this.code += value;\n }\n\n /** Copies a range of the file, and maps it. */\n copy(range: Range): void {\n if (range.end > range.start) {\n this.mappings.push({\n source: range.start,\n generated: this.code.length,\n length: range.end - range.start,\n });\n }\n this.code += this.source.slice(range.start, range.end);\n }\n\n /** Writes text in place of a range of the file of the same length, and maps it there. */\n stand(range: Range, text: string): void {\n this.mappings.push({ source: range.start, generated: this.code.length, length: text.length });\n this.code += text;\n }\n\n /** Copies an expression in parentheses. */\n expression(expression: Expression): void {\n this.text('(');\n this.copy(expression);\n this.text(')');\n }\n}\n\nfunction isTopLevel(statement: oxc.Node): boolean {\n return (\n statement.type === 'ImportDeclaration' ||\n statement.type === 'TSTypeAliasDeclaration' ||\n statement.type === 'TSInterfaceDeclaration' ||\n (statement.type === 'ExportNamedDeclaration' &&\n (statement.exportKind === 'type' ||\n statement.declaration?.type === 'TSTypeAliasDeclaration' ||\n statement.declaration?.type === 'TSInterfaceDeclaration'))\n );\n}\n\n/** Finds the type argument of `$props<T>()`, as a range of the file. */\nfunction propsType(program: oxc.Program | undefined): Range | undefined {\n let found: Range | undefined;\n const visit = (node: unknown): void => {\n if (found || typeof node !== 'object' || node === null) {\n return;\n }\n const value = node as oxc.Node & {\n callee?: oxc.Node & { name?: string };\n typeArguments?: { params: Range[] };\n };\n if (\n value.type === 'CallExpression' &&\n value.callee?.type === 'Identifier' &&\n value.callee.name === '$props' &&\n value.typeArguments?.params[0]\n ) {\n found = value.typeArguments.params[0];\n return;\n }\n for (const child of Object.values(value)) {\n if (Array.isArray(child)) {\n child.forEach(visit);\n } else if (typeof child === 'object') {\n visit(child);\n }\n }\n };\n visit(program);\n return found;\n}\n\n/**\n * Returns the signals and memos whose values the page state sends to the\n * client, because client code reads them. Element refs are sent as\n * references, so they are left out.\n */\nfunction sentDeclarations(file: SFCFile): Declaration[] {\n try {\n const { slots } = clientState(buildGraph(analyze(file)));\n return [...slots.values()]\n .flat()\n .filter(\n (declaration) =>\n (declaration.kind === 'signal' ||\n declaration.kind === 'memo' ||\n declaration.kind === 'async-memo') &&\n declaration.refs.length === 0,\n );\n } catch {\n // A file that the analyzer cannot read is still checked as TypeScript.\n return [];\n }\n}\n\nclass Generator {\n private readonly file: SFCFile;\n private readonly out: Writer;\n private readonly hoisted: oxc.Node[] = [];\n private readonly sent: Declaration[];\n\n constructor(file: SFCFile, out: Writer) {\n this.file = file;\n this.out = out;\n this.sent = sentDeclarations(file);\n }\n\n /** Copies a statement, and checks the values it declares that the client receives. */\n private statement(statement: oxc.Node): void {\n const { out } = this;\n out.copy(statement);\n out.text('\\n');\n for (const declaration of this.sent) {\n if (declaration.range.start >= statement.start && declaration.range.end <= statement.end) {\n out.text('$$sendable(');\n out.copy(declaration.range);\n out.text(');\\n');\n }\n }\n }\n\n generate(): void {\n const { file, out } = this;\n out.text(HELPERS);\n for (const statement of file.moduleScript?.program.body ?? []) {\n out.copy(statement);\n out.text('\\n');\n }\n const body = file.instanceScript?.program.body ?? [];\n for (const statement of body) {\n if (isTopLevel(statement)) {\n out.copy(statement);\n out.text('\\n');\n }\n }\n // Imports in the scripts of blocks are module imports too.\n this.collectBodyImports(file.children);\n for (const statement of this.hoisted) {\n out.copy(statement);\n out.text('\\n');\n }\n const type = propsType(file.instanceScript?.program);\n out.text(`\\nexport default async function ${getComponentName(file.filename)}`);\n if (file.generics) {\n out.text(`<${file.generics}>`);\n }\n out.text('($$props: ');\n if (type) {\n out.copy(type);\n } else {\n out.text('Record<string, any>');\n }\n out.text(\", $$ctx?: import('brumate/server').Context): Promise<string> {\\n\");\n out.text('$$use($$props, $$ctx);\\n');\n for (const statement of body) {\n if (!isTopLevel(statement)) {\n this.statement(statement);\n }\n }\n for (const style of file.styles) {\n for (const variable of style.variables) {\n out.text('$$use(');\n out.expression(variable);\n out.text(');\\n');\n }\n }\n this.templates(file.templates);\n this.nodes(file.children);\n out.text(\"return '';\\n}\\n\");\n // Components are sent to the client by their ID, as the compiled ones are.\n out.text(`${getComponentName(file.filename)}.brumateId = '';\\n`);\n }\n\n private collectBodyImports(nodes: Markup[]): void {\n for (const node of nodes) {\n if ('children' in node) {\n this.collectBodyImports(node.children);\n }\n if (isBlock(node)) {\n for (const body of blockBodies(node)) {\n for (const statement of body.script?.program.body ?? []) {\n if (statement.type === 'ImportDeclaration') {\n this.hoisted.push(statement);\n }\n }\n this.collectBodyImports(body.children);\n for (const template of body.templates) {\n this.collectBodyImports(template.body.children);\n }\n }\n }\n }\n for (const template of this.file.templates) {\n if (nodes === this.file.children) {\n this.collectBodyImports(template.body.children);\n }\n }\n }\n\n private templates(templates: TemplateDecl[]): void {\n const { out } = this;\n for (const template of templates) {\n out.text('function ');\n out.copy(template.nameRange);\n out.text('(');\n if (template.params.length > 0) {\n out.copy({ start: template.params[0]!.start, end: template.params.at(-1)!.end });\n }\n out.text(') {\\n');\n this.body(template.body);\n out.text('}\\n');\n }\n }\n\n private body(body: Body): void {\n for (const statement of body.script?.program.body ?? []) {\n if (statement.type !== 'ImportDeclaration') {\n this.statement(statement);\n }\n }\n this.templates(body.templates);\n this.nodes(body.children);\n }\n\n private nodes(nodes: Markup[]): void {\n for (const node of nodes) {\n this.node(node);\n }\n }\n\n private node(node: Markup): void {\n const { out } = this;\n switch (node.kind) {\n case 'text':\n return;\n case 'insert':\n out.text('$$use(');\n out.expression(node.expression);\n out.text(');\\n');\n return;\n case 'element':\n this.elementAttributes(node.tag, node.attributes);\n this.nodes(node.children);\n return;\n case 'component':\n this.component(node);\n this.nodes(node.children);\n return;\n case 'dynamic':\n out.text('$$dynamic(');\n out.expression(node.tag);\n out.text(', {');\n this.props(node.attributes);\n out.text('});\\n');\n this.nodes(node.children);\n return;\n case 'fragment':\n this.nodes(node.children);\n return;\n case 'listener': {\n const helper = node.target === 'window' ? '$$onWindow' : '$$onDocument';\n for (const attribute of node.attributes) {\n out.text(`${helper}(${JSON.stringify(attribute.event)}, `);\n out.expression(attribute.handler);\n out.text(');\\n');\n }\n return;\n }\n default:\n this.block(node);\n }\n }\n\n private elementAttributes(tag: string, attributes: Attribute[]): void {\n const { out } = this;\n for (const attribute of attributes) {\n switch (attribute.kind) {\n case 'value':\n case 'spread':\n out.text('$$use(');\n out.expression(attribute.value);\n out.text(');\\n');\n break;\n case 'event':\n out.text(`$$on(${JSON.stringify(tag)}, ${JSON.stringify(attribute.event)}, `);\n out.expression(attribute.handler);\n out.text(');\\n');\n break;\n case 'ref':\n out.text('$$use(');\n out.copy(attribute.targetRange);\n out.text(');\\n');\n break;\n case 'computed':\n out.text('$$use(');\n out.expression(attribute.name);\n if (attribute.value !== true) {\n out.text(', ');\n out.expression(attribute.value);\n }\n out.text(');\\n');\n break;\n default:\n break;\n }\n }\n }\n\n /** Writes a prop name, mapped to the attribute, so errors about the prop point at it. */\n private propName(attribute: Range & { name: string }): void {\n const { out } = this;\n out.text(' ');\n if (/^[A-Za-z_$][\\w$]*$/.test(attribute.name)) {\n out.copy({ start: attribute.start, end: attribute.start + attribute.name.length });\n } else {\n out.text(JSON.stringify(attribute.name));\n }\n out.text(': ');\n }\n\n /** Writes the attributes of a component or a dynamic tag as the properties of an object. */\n private props(attributes: Attribute[], children = false): void {\n const { out } = this;\n for (const attribute of attributes) {\n switch (attribute.kind) {\n case 'static':\n this.propName(attribute);\n out.text(`${attribute.value === true ? 'true' : JSON.stringify(attribute.value)},`);\n break;\n case 'value':\n this.propName(attribute);\n out.expression(attribute.value);\n out.text(',');\n break;\n case 'event':\n this.propName(attribute);\n out.expression(attribute.handler);\n out.text(',');\n break;\n case 'spread':\n out.text(' ...');\n out.expression(attribute.value);\n out.text(',');\n break;\n default:\n break;\n }\n }\n if (children) {\n out.text(' children: undefined as any,');\n }\n }\n\n private component(node: ComponentNode): void {\n const { out } = this;\n const nameStart = node.start + 1;\n out.text('$$component(');\n out.copy({ start: nameStart, end: nameStart + node.name.length });\n out.text(', ');\n // A missing prop is reported on the object, so its brace stands for the `<` of the tag.\n out.stand({ start: node.start, end: node.start + 1 }, '{');\n this.props(node.attributes, node.children.length > 0);\n // The closing brace stands for the end of the opening tag, so the error spans the tag.\n out.text(' ');\n out.stand({ start: this.openTagEnd(node) - 1, end: this.openTagEnd(node) }, '}');\n out.text(');\\n');\n }\n\n /** The offset after the `>` that ends the opening tag of a component. */\n private openTagEnd(node: ComponentNode): number {\n const last = node.attributes.at(-1)?.end ?? node.start + 1 + node.name.length;\n return this.file.source.indexOf('>', last) + 1;\n }\n\n private block(block: Block): void {\n const { out } = this;\n switch (block.kind) {\n case 'if':\n case 'switch': {\n const branches = block.kind === 'if' ? block.branches : block.cases;\n branches.forEach((branch, index) => {\n out.text(index === 0 ? 'if ' : ' else if ');\n out.expression(branch.condition);\n out.text(' {\\n');\n this.body(branch.body);\n out.text('}');\n });\n if (block.fallback) {\n out.text(' else {\\n');\n this.body(block.fallback);\n out.text('}');\n }\n out.text('\\n');\n return;\n }\n case 'for': {\n out.text('for (const ');\n out.copy(block.item);\n out.text(' of ');\n out.expression(block.list);\n out.text(') {\\n');\n if (block.index) {\n out.text('const ');\n out.copy(block.index);\n out.text(' = 0 as number;\\n');\n }\n if (block.key && block.key !== 'index') {\n out.text('$$use(');\n out.expression(block.key);\n out.text(');\\n');\n }\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n }\n case 'repeat': {\n out.text('for (let $$i = 0; $$i < ');\n out.expression(block.count);\n out.text('; $$i++) {\\n');\n if (block.index) {\n out.text('const ');\n out.copy(block.index);\n out.text(' = $$i;\\n');\n }\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n }\n case 'key':\n out.text('$$use(');\n out.expression(block.value);\n out.text(');\\n{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'try':\n out.text('try {\\n');\n this.body(block.body);\n out.text('} catch (');\n if (block.error) {\n out.copy(block.error);\n } else {\n out.text('$$error');\n }\n out.text(') {\\n');\n if (block.reset) {\n out.text('const ');\n out.copy(block.reset);\n out.text(' = (): void => {};\\n');\n }\n this.body(block.fallback);\n out.text('}\\n');\n return;\n case 'loading':\n if (block.on) {\n out.text('$$use(');\n out.expression(block.on);\n out.text(');\\n');\n }\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n case 'portal':\n if (block.target) {\n out.text('$$use(');\n out.expression(block.target);\n out.text(');\\n');\n }\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'head':\n case 'client':\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n }\n }\n\n private fallback(body: Body | undefined): void {\n if (body) {\n this.out.text('{\\n');\n this.body(body);\n this.out.text('}\\n');\n }\n }\n}\n\nfunction isBlock(node: Markup): node is Block {\n return !['element', 'component', 'dynamic', 'fragment', 'listener', 'text', 'insert'].includes(\n node.kind,\n );\n}\n\n/** Finds the `<script>` blocks at the top level, without parsing the markup. */\nfunction scriptRanges(source: string): Range[] {\n const ranges: Range[] = [];\n for (const match of source.matchAll(/^<script(\\s[^>]*)?>([\\s\\S]*?)<\\/script\\s*>/gm)) {\n const start = match.index + match[0].indexOf('>') + 1;\n ranges.push({ start, end: start + match[2]!.length });\n }\n return ranges;\n}\n\n/**\n * Generates TypeScript for a `.brm` file. With a syntax error, the code holds\n * the scripts only, so they still get type information.\n */\nexport function toTypeScript(source: string, filename = 'Component.brm'): CheckOutput {\n const out = new Writer(source);\n let file: SFCFile;\n try {\n file = parse(source, { filename });\n } catch (error) {\n if (!(error instanceof BrumateError)) {\n throw error;\n }\n out.text(HELPERS);\n for (const range of scriptRanges(source)) {\n out.copy(range);\n out.text('\\n');\n }\n out.text(\n `export default async function ${getComponentName(filename)}(..._: any[]): Promise<string> {\\n return '';\\n}\\n`,\n );\n return { code: out.code, mappings: out.mappings, error };\n }\n new Generator(file, out).generate();\n return { code: out.code, mappings: out.mappings };\n}\n"],"mappings":";;AAKA,SAAS,GAAG,QAAgB,OAAsB;CAChD,MAAM,EAAE,MAAM,WAAW,YAAY,QAAQ,MAAM,KAAK;CACxD,OAAO,GAAG,KAAK,GAAG;AACpB;AAEA,SAAS,MAAM,MAAsB;CACnC,OAAO,KAAK,UAAU,IAAI;AAC5B;AAEA,SAAS,eAAe,MAAyB;CAC/C,QAAQ,KAAK,MAAb;EACE,KAAK,UACH,OAAO,KAAK,UAAU,OAAO,KAAK,OAAO,GAAG,KAAK,KAAK,GAAG,MAAM,KAAK,KAAK;EAC3E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;IACd;EACJ;CACF;CAEA,SAAiB,MAA8B;EAC7C,IAAI,MAAM;GACR,KAAK,IAAI,KAAK,KAAK;GACnB,KAAK,KAAK,IAAI;GACd,KAAK,IAAI,KAAK,KAAK;EACrB;CACF;AACF;AAEA,SAAS,QAAQ,MAA6B;CAC5C,OAAO,CAAC;EAAC;EAAW;EAAa;EAAW;EAAY;EAAY;EAAQ;CAAQ,CAAC,CAAC,SACpF,KAAK,IACP;AACF;;AAGA,SAAS,aAAa,QAAyB;CAC7C,MAAM,SAAkB,CAAC;CACzB,KAAK,MAAM,SAAS,OAAO,SAAS,8CAA8C,GAAG;EACnF,MAAM,QAAQ,MAAM,QAAQ,MAAM,EAAE,CAAC,QAAQ,GAAG,IAAI;EACpD,OAAO,KAAK;GAAE;GAAO,KAAK,QAAQ,MAAM,EAAE,CAAE;EAAO,CAAC;CACtD;CACA,OAAO;AACT;;;;;AAMA,SAAgB,aAAa,QAAgB,WAAW,iBAA8B;CACpF,MAAM,MAAM,IAAI,OAAO,MAAM;CAC7B,IAAI;CACJ,IAAI;EACF,OAAO,MAAM,QAAQ,EAAE,SAAS,CAAC;CACnC,SAAS,OAAO;EACd,IAAI,EAAE,iBAAiB,eACrB,MAAM;EAER,IAAI,KAAK,OAAO;EAChB,KAAK,MAAM,SAAS,aAAa,MAAM,GAAG;GACxC,IAAI,KAAK,KAAK;GACd,IAAI,KAAK,IAAI;EACf;EACA,IAAI,KACF,iCAAiC,iBAAiB,QAAQ,EAAE,oDAC9D;EACA,OAAO;GAAE,MAAM,IAAI;GAAM,UAAU,IAAI;GAAU;EAAM;CACzD;CACA,IAAI,UAAU,MAAM,GAAG,CAAC,CAAC,SAAS;CAClC,OAAO;EAAE,MAAM,IAAI;EAAM,UAAU,IAAI;CAAS;AAClD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["server","render","client"],"sources":["../src/print.ts","../src/generate.ts","../src/check.ts"],"sourcesContent":["import type { Attribute, Block, Body, Markup, Range, SFCFile } from './ast.ts';\nimport { getLocation } from './error.ts';\nimport type { Graph, GraphNode } from './graph.ts';\nimport type { Diagnostic, Scope, SemanticModel, Site } from './model.ts';\n\nfunction at(source: string, range: Range): string {\n const { line, column } = getLocation(source, range.start);\n return `${line}:${column}`;\n}\n\nfunction quote(text: string): string {\n return JSON.stringify(text);\n}\n\nfunction printAttribute(item: Attribute): string {\n switch (item.kind) {\n case 'static':\n return item.value === true ? item.name : `${item.name}=${quote(item.value)}`;\n case 'value':\n return `${item.name}=(${item.value.code})`;\n case 'event':\n return `${item.name}${item.modifiers.map((modifier) => `:${modifier}`).join('')}=(${item.handler.code})`;\n case 'ref':\n return `ref=${item.target}`;\n case 'prefetch':\n return `prefetch=${quote(item.strategy)}`;\n case 'spread':\n return `{...${item.value.code}}`;\n case 'computed':\n return `[${item.name.code}]${item.value === true ? '' : `=(${item.value.code})`}`;\n }\n}\n\n/** Prints the syntax tree, one node per line. */\nexport function printAST(file: SFCFile): string {\n const lines: string[] = [];\n const write = (depth: number, text: string): void => {\n lines.push(`${' '.repeat(depth)}${text}`);\n };\n\n const body = (item: Body, depth: number, label: string): void => {\n write(depth, label);\n if (item.script) {\n write(depth + 1, 'script');\n }\n for (const template of item.templates) {\n write(depth + 1, `template ${template.name}`);\n body(template.body, depth + 2, 'body');\n }\n nodes(item.children, depth + 1);\n };\n\n const block = (item: Block, depth: number): void => {\n switch (item.kind) {\n case 'if':\n write(depth, 'if');\n for (const branch of item.branches) {\n body(branch.body, depth + 1, `branch (${branch.condition.code})`);\n }\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'for': {\n const key =\n item.key === undefined ? '' : ` by ${item.key === 'index' ? 'index' : item.key.code}`;\n const index = item.index ? `, ${item.index.name}` : '';\n const itemCode = file.source.slice(item.item.start, item.item.end);\n write(depth, `for (${itemCode}${index} of ${item.list.code.trim()}${key})`);\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n }\n case 'repeat':\n write(\n depth,\n `repeat (${item.index ? `${item.index.name} of ` : ''}${item.count.code.trim()})`,\n );\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'switch':\n write(depth, 'switch');\n for (const branch of item.cases) {\n body(branch.body, depth + 1, `case (${branch.condition.code})`);\n }\n if (item.fallback) {\n body(item.fallback, depth + 1, 'default');\n }\n break;\n case 'key':\n write(depth, `key (${item.value.code})`);\n body(item.body, depth + 1, 'body');\n break;\n case 'offscreen':\n write(depth, `offscreen (${item.visible.code})`);\n body(item.body, depth + 1, 'body');\n break;\n case 'try': {\n write(depth, 'try');\n body(item.body, depth + 1, 'body');\n const names = [item.error?.name, item.reset?.name].filter(Boolean).join(', ');\n body(item.fallback, depth + 1, names ? `catch (${names})` : 'catch');\n break;\n }\n case 'loading':\n write(depth, item.on ? `loading (${item.on.code})` : 'loading');\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\n break;\n case 'head':\n write(depth, 'head');\n body(item.body, depth + 1, 'body');\n break;\n case 'portal':\n write(depth, item.target ? `portal (${item.target.code})` : 'portal');\n body(item.body, depth + 1, 'body');\n break;\n case 'client':\n write(depth, `client (${item.trigger})`);\n body(item.body, depth + 1, 'body');\n break;\n }\n };\n\n const node = (item: Markup, depth: number): void => {\n switch (item.kind) {\n case 'element':\n case 'component': {\n const name = item.kind === 'element' ? item.tag : item.name;\n const attributes = item.attributes.map((value) => ` ${printAttribute(value)}`).join('');\n write(depth, `${item.kind} <${name}${attributes}>`);\n nodes(item.children, depth + 1);\n break;\n }\n case 'dynamic':\n write(\n depth,\n `dynamic <{${item.tag.code}}${item.attributes.map((value) => ` ${printAttribute(value)}`).join('')}>`,\n );\n nodes(item.children, depth + 1);\n break;\n case 'fragment':\n write(depth, 'fragment');\n nodes(item.children, depth + 1);\n break;\n case 'listener':\n write(\n depth,\n `listener <${item.target}${item.attributes.map((value) => ` ${printAttribute(value)}`).join('')}>`,\n );\n break;\n case 'text':\n write(depth, `text ${quote(item.value)}`);\n break;\n case 'insert':\n write(depth, `insert {${item.expression.code}}`);\n break;\n default:\n block(item, depth);\n }\n };\n\n const nodes = (items: Markup[], depth: number): void => {\n for (const item of items) {\n node(item, depth);\n }\n };\n\n if (file.moduleScript) {\n write(0, 'script module');\n }\n if (file.instanceScript) {\n write(0, file.generics ? `script generics=${quote(file.generics)}` : 'script');\n }\n for (const style of file.styles) {\n write(0, `style ${style.lang}`);\n for (const variable of style.variables) {\n write(1, `variable (${variable.code})`);\n }\n }\n for (const template of file.templates) {\n write(0, `template ${template.name}`);\n body(template.body, 1, 'body');\n }\n nodes(file.children, 0);\n return lines.join('\\n');\n}\n\nfunction scopeLabel(source: string, scope: Scope): string {\n if (scope.kind === 'body' && scope.block) {\n return `${scope.id} body (${scope.block.kind} ${at(source, scope.block)})`;\n }\n if (scope.kind === 'template' && scope.template) {\n return `${scope.id} template ${scope.template.name}`;\n }\n return `${scope.id} ${scope.kind}`;\n}\n\nfunction siteLabel(source: string, site: Site): string {\n return `${site.label} (${at(source, site.range)})`;\n}\n\nfunction printDiagnostics(source: string, diagnostics: Diagnostic[], lines: string[]): void {\n if (diagnostics.length === 0) {\n return;\n }\n lines.push('diagnostics');\n for (const diagnostic of diagnostics) {\n lines.push(` ${diagnostic.severity} ${diagnostic.message} (${at(source, diagnostic.range)})`);\n }\n}\n\n/** Prints scopes, declarations, sites and diagnostics. */\nexport function printModel(source: string, model: SemanticModel): string {\n const lines: string[] = [];\n for (const scope of model.scopes) {\n lines.push(`scope ${scopeLabel(source, scope)}`);\n for (const declaration of scope.declarations.values()) {\n lines.push(` ${declaration.kind} ${declaration.name}`);\n }\n }\n lines.push('sites');\n for (const site of model.sites) {\n const parts = [siteLabel(source, site)];\n const reads = [\n ...new Set(site.reads.map((read) => (read.tracked ? '' : '~') + read.declaration.name)),\n ];\n const writes = [...new Set(site.writes.map((write) => write.declaration.name))];\n const calls = [...site.calls].map((declaration) => declaration.name);\n if (reads.length > 0) {\n parts.push(`reads ${reads.join(', ')}`);\n }\n if (writes.length > 0) {\n parts.push(`writes ${writes.join(', ')}`);\n }\n if (calls.length > 0) {\n parts.push(`calls ${calls.join(', ')}`);\n }\n lines.push(` ${parts.join(' ')}`);\n }\n printDiagnostics(source, model.diagnostics, lines);\n return lines.join('\\n');\n}\n\nfunction nodeLabel(source: string, node: GraphNode): string {\n switch (node.kind) {\n case 'source':\n return `${node.declaration.kind} ${node.declaration.name}`;\n case 'memo':\n return `${node.declaration.kind} ${node.declaration.name}`;\n default:\n return siteLabel(source, node.site);\n }\n}\n\n/** Prints the graph: nodes, what is live, what runs on the client and which scopes it creates. */\nexport function printGraph(source: string, graph: Graph): string {\n const lines: string[] = ['nodes'];\n for (const node of graph.nodes) {\n const from = graph.edges\n .filter((edge) => edge.to === node)\n .map((edge) => nodeLabel(source, edge.from));\n const state = graph.live.has(node) ? 'live' : 'static';\n lines.push(\n ` ${nodeLabel(source, node)} ${state}${from.length > 0 ? ` <- ${from.join(', ')}` : ''}`,\n );\n }\n lines.push('client');\n for (const site of graph.model.sites) {\n if (graph.reached.has(site)) {\n lines.push(` ${siteLabel(source, site)}${site.kind === 'server-function' ? ' (stub)' : ''}`);\n }\n }\n const created = graph.model.scopes.filter((scope) => graph.created.has(scope));\n if (created.length > 0) {\n lines.push('created');\n for (const scope of created) {\n lines.push(` ${scopeLabel(source, scope)}`);\n }\n }\n printDiagnostics(source, [...graph.model.diagnostics, ...graph.diagnostics], lines);\n return lines.join('\\n');\n}\n","// The code generators, for callers that compile without `compile`. Their\n// output carries the marks that `compile` turns into source maps, so these\n// remove them.\n\nimport type { SFCFile } from './ast.ts';\nimport { generateClient as client } from './codegen/client.ts';\nimport { generateRender as render } from './codegen/render.ts';\nimport { generateServer as server } from './codegen/server.ts';\nimport type { Plan } from './plan.ts';\nimport { unmarked } from './sourcemap.ts';\n\n/** Generates the server module. */\nexport function generateServer(file: SFCFile, plan: Plan): string {\n return unmarked(server(file, plan));\n}\n\n/** Generates the render module. */\nexport function generateRender(file: SFCFile, plan: Plan): string {\n return unmarked(render(file, plan));\n}\n\n/** Generates the client entry and its parts. */\nexport function generateClient(\n file: SFCFile,\n plan: Plan,\n merge?: number,\n): ReturnType<typeof client> {\n const result = client(file, plan, merge);\n return {\n ...result,\n code: unmarked(result.code),\n parts: Object.fromEntries(\n Object.entries(result.parts).map(([name, code]) => [name, unmarked(code)]),\n ),\n };\n}\n","// Turns a `.brm` file into TypeScript, so a type checker and an editor can\n// check it. The scripts and every expression of the markup are copied, with\n// mappings back to the file. The markup becomes statements in blocks that\n// match its control flow, so names are in scope where the markup reads them.\n\nimport type {\n Attribute,\n Block,\n Body,\n ComponentNode,\n Expression,\n Markup,\n Range,\n SFCFile,\n TemplateDecl,\n} from './ast.ts';\nimport { BrumateError } from './error.ts';\nimport type { oxc } from './oxc.ts';\nimport { parse } from './parser.ts';\nimport { analyze } from './analyze.ts';\nimport { buildGraph } from './graph.ts';\nimport type { Declaration } from './model.ts';\nimport { blockBodies, clientState } from './plan.ts';\n\n/**\n * The name of the component function. A file can import the name that its\n * file name gives the component, such as `SignIn` in `sign-in.brm`.\n */\nconst COMPONENT = '$$Component';\n\n/** A range of the generated code that is copied from the file. */\nexport interface CheckMapping {\n /** Offset in the `.brm` file. */\n source: number;\n /** Offset in the generated code. */\n generated: number;\n length: number;\n}\n\nexport interface CheckOutput {\n code: string;\n mappings: CheckMapping[];\n /** The syntax error of the file. The code then holds only its scripts. */\n error?: BrumateError;\n}\n\n/**\n * Declarations that the generated code calls to check the markup. They are\n * local to each generated file.\n */\nconst HELPERS = `/// <reference types=\"brumate/types\" />\ntype $$Component<P> = (props: P, ...rest: any[]) => unknown;\ndeclare function $$component<P>(component: $$Component<P>, props: P): void;\ndeclare function $$dynamic(tag: string | $$Component<any>, props: Record<string, unknown>): void;\ntype $$Event<K, M> = K extends keyof M ? M[K] : Event;\ntype $$Element<T> = T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : T extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[T] : HTMLElement;\ndeclare function $$on<T extends string, K extends string>(tag: T, event: K, handler: (event: $$Event<K, HTMLElementEventMap> & { currentTarget: $$Element<T> }) => unknown): void;\ndeclare function $$onWindow<K extends string>(event: K, handler: (event: $$Event<K, WindowEventMap> & { currentTarget: Window }) => unknown): void;\ndeclare function $$onDocument<K extends string>(event: K, handler: (event: $$Event<K, DocumentEventMap> & { currentTarget: Document }) => unknown): void;\ndeclare function $$use(...values: unknown[]): void;\ntype $$Plain = string | number | boolean | bigint | null | undefined | Date | Error | URL | URLSearchParams | ArrayBuffer | ArrayBufferView | Blob | Headers | FormData | Request | Response;\ntype $$Sendable<T> = T extends $$Plain ? T : T extends { brumateId: string } ? T : T extends RegExp ? { 'A regular expression cannot be sent to the client. Send its source and flags': never } : T extends (...args: any[]) => any ? { 'A function cannot be sent to the client. Keep it out of the signal or memo': never } : T extends Promise<infer U> ? Promise<$$Sendable<U>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<$$Sendable<K>, $$Sendable<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<$$Sendable<V>> : T extends object ? { [K in keyof T]: $$Sendable<T[K]> } : T;\n/** Checks a value that the page state sends to the client. */\ndeclare function $$sendable<T>(value: T & $$Sendable<T>): void;\n`;\n\nclass Writer {\n code = '';\n readonly mappings: CheckMapping[] = [];\n private readonly source: string;\n\n constructor(source: string) {\n this.source = source;\n }\n\n text(value: string): void {\n this.code += value;\n }\n\n /** Copies a range of the file, and maps it. */\n copy(range: Range): void {\n if (range.end > range.start) {\n this.mappings.push({\n source: range.start,\n generated: this.code.length,\n length: range.end - range.start,\n });\n }\n this.code += this.source.slice(range.start, range.end);\n }\n\n /** Writes text in place of a range of the file of the same length, and maps it there. */\n stand(range: Range, text: string): void {\n this.mappings.push({ source: range.start, generated: this.code.length, length: text.length });\n this.code += text;\n }\n\n /** Copies an expression in parentheses. */\n expression(expression: Expression): void {\n this.text('(');\n this.copy(expression);\n this.text(')');\n }\n}\n\nfunction isTopLevel(statement: oxc.Node): boolean {\n return (\n statement.type === 'ImportDeclaration' ||\n statement.type === 'TSTypeAliasDeclaration' ||\n statement.type === 'TSInterfaceDeclaration' ||\n (statement.type === 'ExportNamedDeclaration' &&\n (statement.exportKind === 'type' ||\n statement.declaration?.type === 'TSTypeAliasDeclaration' ||\n statement.declaration?.type === 'TSInterfaceDeclaration'))\n );\n}\n\n/** Finds the type argument of `$props<T>()`, as a range of the file. */\nfunction propsType(program: oxc.Program | undefined): Range | undefined {\n let found: Range | undefined;\n const visit = (node: unknown): void => {\n if (found || typeof node !== 'object' || node === null) {\n return;\n }\n const value = node as oxc.Node & {\n callee?: oxc.Node & { name?: string };\n typeArguments?: { params: Range[] };\n };\n if (\n value.type === 'CallExpression' &&\n value.callee?.type === 'Identifier' &&\n value.callee.name === '$props' &&\n value.typeArguments?.params[0]\n ) {\n found = value.typeArguments.params[0];\n return;\n }\n for (const child of Object.values(value)) {\n if (Array.isArray(child)) {\n child.forEach(visit);\n } else if (typeof child === 'object') {\n visit(child);\n }\n }\n };\n visit(program);\n return found;\n}\n\n/**\n * Returns the signals and memos whose values the page state sends to the\n * client, because client code reads them. Element refs are sent as\n * references, so they are left out.\n */\nfunction sentDeclarations(file: SFCFile): Declaration[] {\n try {\n const { slots } = clientState(buildGraph(analyze(file)));\n return [...slots.values()]\n .flat()\n .filter(\n (declaration) =>\n (declaration.kind === 'signal' ||\n declaration.kind === 'memo' ||\n declaration.kind === 'async-memo') &&\n declaration.refs.length === 0,\n );\n } catch {\n // A file that the analyzer cannot read is still checked as TypeScript.\n return [];\n }\n}\n\nclass Generator {\n private readonly file: SFCFile;\n private readonly out: Writer;\n private readonly hoisted: oxc.Node[] = [];\n private readonly sent: Declaration[];\n\n constructor(file: SFCFile, out: Writer) {\n this.file = file;\n this.out = out;\n this.sent = sentDeclarations(file);\n }\n\n /** Copies a statement, and checks the values it declares that the client receives. */\n private statement(statement: oxc.Node): void {\n const { out } = this;\n out.copy(statement);\n out.text('\\n');\n for (const declaration of this.sent) {\n if (declaration.range.start >= statement.start && declaration.range.end <= statement.end) {\n out.text('$$sendable(');\n out.copy(declaration.range);\n out.text(');\\n');\n }\n }\n }\n\n generate(): void {\n const { file, out } = this;\n out.text(HELPERS);\n for (const statement of file.moduleScript?.program.body ?? []) {\n out.copy(statement);\n out.text('\\n');\n }\n const body = file.instanceScript?.program.body ?? [];\n for (const statement of body) {\n if (isTopLevel(statement)) {\n out.copy(statement);\n out.text('\\n');\n }\n }\n // Imports in the scripts of blocks are module imports too.\n this.collectBodyImports(file.children);\n for (const statement of this.hoisted) {\n out.copy(statement);\n out.text('\\n');\n }\n const type = propsType(file.instanceScript?.program);\n // The function has a name of its own, so the component name of the file can be imported.\n out.text(`\\nexport default ${COMPONENT};\\nasync function ${COMPONENT}`);\n if (file.generics) {\n out.text(`<${file.generics}>`);\n }\n out.text('($$props: ');\n if (type) {\n out.copy(type);\n } else {\n out.text('Record<string, any>');\n }\n out.text(\", $$ctx?: import('brumate/server').Context): Promise<string> {\\n\");\n out.text('$$use($$props, $$ctx);\\n');\n for (const statement of body) {\n if (!isTopLevel(statement)) {\n this.statement(statement);\n }\n }\n for (const style of file.styles) {\n for (const variable of style.variables) {\n out.text('$$use(');\n out.expression(variable);\n out.text(');\\n');\n }\n }\n this.templates(file.templates);\n this.nodes(file.children);\n out.text(\"return '';\\n}\\n\");\n // Components are sent to the client by their ID, as the compiled ones are.\n out.text(`${COMPONENT}.brumateId = '';\\n`);\n }\n\n private collectBodyImports(nodes: Markup[]): void {\n for (const node of nodes) {\n if ('children' in node) {\n this.collectBodyImports(node.children);\n }\n if (isBlock(node)) {\n for (const body of blockBodies(node)) {\n for (const statement of body.script?.program.body ?? []) {\n if (statement.type === 'ImportDeclaration') {\n this.hoisted.push(statement);\n }\n }\n this.collectBodyImports(body.children);\n for (const template of body.templates) {\n this.collectBodyImports(template.body.children);\n }\n }\n }\n }\n for (const template of this.file.templates) {\n if (nodes === this.file.children) {\n this.collectBodyImports(template.body.children);\n }\n }\n }\n\n private templates(templates: TemplateDecl[]): void {\n const { out } = this;\n for (const template of templates) {\n out.text('function ');\n out.copy(template.nameRange);\n out.text('(');\n if (template.params.length > 0) {\n out.copy({ start: template.params[0]!.start, end: template.params.at(-1)!.end });\n }\n out.text(') {\\n');\n this.body(template.body);\n out.text('}\\n');\n }\n }\n\n private body(body: Body): void {\n for (const statement of body.script?.program.body ?? []) {\n if (statement.type !== 'ImportDeclaration') {\n this.statement(statement);\n }\n }\n this.templates(body.templates);\n this.nodes(body.children);\n }\n\n private nodes(nodes: Markup[]): void {\n for (const node of nodes) {\n this.node(node);\n }\n }\n\n private node(node: Markup): void {\n const { out } = this;\n switch (node.kind) {\n case 'text':\n return;\n case 'insert':\n out.text('$$use(');\n out.expression(node.expression);\n out.text(');\\n');\n return;\n case 'element':\n this.elementAttributes(node.tag, node.attributes);\n this.nodes(node.children);\n return;\n case 'component':\n this.component(node);\n this.nodes(node.children);\n return;\n case 'dynamic':\n out.text('$$dynamic(');\n out.expression(node.tag);\n out.text(', {');\n this.props(node.attributes);\n out.text('});\\n');\n this.nodes(node.children);\n return;\n case 'fragment':\n this.nodes(node.children);\n return;\n case 'listener': {\n const helper = node.target === 'window' ? '$$onWindow' : '$$onDocument';\n for (const attribute of node.attributes) {\n out.text(`${helper}(${JSON.stringify(attribute.event)}, `);\n out.expression(attribute.handler);\n out.text(');\\n');\n }\n return;\n }\n default:\n this.block(node);\n }\n }\n\n private elementAttributes(tag: string, attributes: Attribute[]): void {\n const { out } = this;\n for (const attribute of attributes) {\n switch (attribute.kind) {\n case 'value':\n case 'spread':\n out.text('$$use(');\n out.expression(attribute.value);\n out.text(');\\n');\n break;\n case 'event':\n out.text(`$$on(${JSON.stringify(tag)}, ${JSON.stringify(attribute.event)}, `);\n out.expression(attribute.handler);\n out.text(');\\n');\n break;\n case 'ref':\n out.text('$$use(');\n out.copy(attribute.targetRange);\n out.text(');\\n');\n break;\n case 'computed':\n out.text('$$use(');\n out.expression(attribute.name);\n if (attribute.value !== true) {\n out.text(', ');\n out.expression(attribute.value);\n }\n out.text(');\\n');\n break;\n default:\n break;\n }\n }\n }\n\n /** Writes a prop name, mapped to the attribute, so errors about the prop point at it. */\n private propName(attribute: Range & { name: string }): void {\n const { out } = this;\n out.text(' ');\n if (/^[A-Za-z_$][\\w$]*$/.test(attribute.name)) {\n out.copy({ start: attribute.start, end: attribute.start + attribute.name.length });\n } else {\n out.text(JSON.stringify(attribute.name));\n }\n out.text(': ');\n }\n\n /** Writes the attributes of a component or a dynamic tag as the properties of an object. */\n private props(attributes: Attribute[], children = false): void {\n const { out } = this;\n for (const attribute of attributes) {\n switch (attribute.kind) {\n case 'static':\n this.propName(attribute);\n out.text(`${attribute.value === true ? 'true' : JSON.stringify(attribute.value)},`);\n break;\n case 'value':\n this.propName(attribute);\n out.expression(attribute.value);\n out.text(',');\n break;\n case 'event':\n this.propName(attribute);\n out.expression(attribute.handler);\n out.text(',');\n break;\n case 'spread':\n out.text(' ...');\n out.expression(attribute.value);\n out.text(',');\n break;\n default:\n break;\n }\n }\n if (children) {\n out.text(' children: undefined as any,');\n }\n }\n\n private component(node: ComponentNode): void {\n const { out } = this;\n const nameStart = node.start + 1;\n out.text('$$component(');\n out.copy({ start: nameStart, end: nameStart + node.name.length });\n out.text(', ');\n // A missing prop is reported on the object, so its brace stands for the `<` of the tag.\n out.stand({ start: node.start, end: node.start + 1 }, '{');\n this.props(node.attributes, node.children.length > 0);\n // The closing brace stands for the end of the opening tag, so the error spans the tag.\n out.text(' ');\n out.stand({ start: this.openTagEnd(node) - 1, end: this.openTagEnd(node) }, '}');\n out.text(');\\n');\n }\n\n /** The offset after the `>` that ends the opening tag of a component. */\n private openTagEnd(node: ComponentNode): number {\n const last = node.attributes.at(-1)?.end ?? node.start + 1 + node.name.length;\n return this.file.source.indexOf('>', last) + 1;\n }\n\n private block(block: Block): void {\n const { out } = this;\n switch (block.kind) {\n case 'if':\n case 'switch': {\n const branches = block.kind === 'if' ? block.branches : block.cases;\n branches.forEach((branch, index) => {\n out.text(index === 0 ? 'if ' : ' else if ');\n out.expression(branch.condition);\n out.text(' {\\n');\n this.body(branch.body);\n out.text('}');\n });\n if (block.fallback) {\n out.text(' else {\\n');\n this.body(block.fallback);\n out.text('}');\n }\n out.text('\\n');\n return;\n }\n case 'for': {\n out.text('for (const ');\n out.copy(block.item);\n out.text(' of ');\n out.expression(block.list);\n out.text(') {\\n');\n if (block.index) {\n out.text('const ');\n out.copy(block.index);\n out.text(' = 0 as number;\\n');\n }\n if (block.key && block.key !== 'index') {\n out.text('$$use(');\n out.expression(block.key);\n out.text(');\\n');\n }\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n }\n case 'repeat': {\n out.text('for (let $$i = 0; $$i < ');\n out.expression(block.count);\n out.text('; $$i++) {\\n');\n if (block.index) {\n out.text('const ');\n out.copy(block.index);\n out.text(' = $$i;\\n');\n }\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n }\n case 'key':\n out.text('$$use(');\n out.expression(block.value);\n out.text(');\\n{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'offscreen':\n out.text('$$use(');\n out.expression(block.visible);\n out.text(');\\n{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'try':\n out.text('try {\\n');\n this.body(block.body);\n out.text('} catch (');\n if (block.error) {\n out.copy(block.error);\n } else {\n out.text('$$error');\n }\n out.text(') {\\n');\n if (block.reset) {\n out.text('const ');\n out.copy(block.reset);\n out.text(' = (): void => {};\\n');\n }\n this.body(block.fallback);\n out.text('}\\n');\n return;\n case 'loading':\n if (block.on) {\n out.text('$$use(');\n out.expression(block.on);\n out.text(');\\n');\n }\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\n return;\n case 'portal':\n if (block.target) {\n out.text('$$use(');\n out.expression(block.target);\n out.text(');\\n');\n }\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'head':\n case 'client':\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n }\n }\n\n private fallback(body: Body | undefined): void {\n if (body) {\n this.out.text('{\\n');\n this.body(body);\n this.out.text('}\\n');\n }\n }\n}\n\nfunction isBlock(node: Markup): node is Block {\n return !['element', 'component', 'dynamic', 'fragment', 'listener', 'text', 'insert'].includes(\n node.kind,\n );\n}\n\n/** Finds the `<script>` blocks at the top level, without parsing the markup. */\nfunction scriptRanges(source: string): Range[] {\n const ranges: Range[] = [];\n for (const match of source.matchAll(/^<script(\\s[^>]*)?>([\\s\\S]*?)<\\/script\\s*>/gm)) {\n const start = match.index + match[0].indexOf('>') + 1;\n ranges.push({ start, end: start + match[2]!.length });\n }\n return ranges;\n}\n\n/**\n * Generates TypeScript for a `.brm` file. With a syntax error, the code holds\n * the scripts only, so they still get type information.\n */\nexport function toTypeScript(source: string, filename = 'Component.brm'): CheckOutput {\n const out = new Writer(source);\n let file: SFCFile;\n try {\n file = parse(source, { filename });\n } catch (error) {\n if (!(error instanceof BrumateError)) {\n throw error;\n }\n out.text(HELPERS);\n for (const range of scriptRanges(source)) {\n out.copy(range);\n out.text('\\n');\n }\n out.text(\n `export default async function ${COMPONENT}(..._: any[]): Promise<string> {\\n return '';\\n}\\n`,\n );\n return { code: out.code, mappings: out.mappings, error };\n }\n new Generator(file, out).generate();\n return { code: out.code, mappings: out.mappings };\n}\n"],"mappings":";;AAKA,SAAS,GAAG,QAAgB,OAAsB;CAChD,MAAM,EAAE,MAAM,WAAW,YAAY,QAAQ,MAAM,KAAK;CACxD,OAAO,GAAG,KAAK,GAAG;AACpB;AAEA,SAAS,MAAM,MAAsB;CACnC,OAAO,KAAK,UAAU,IAAI;AAC5B;AAEA,SAAS,eAAe,MAAyB;CAC/C,QAAQ,KAAK,MAAb;EACE,KAAK,UACH,OAAO,KAAK,UAAU,OAAO,KAAK,OAAO,GAAG,KAAK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