brumate 0.1.1 → 0.3.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/dist/{boot-DN1ZU8Hg.d.ts → boot-C25Sa6vq.d.ts} +27 -2
- package/dist/cli.js +2 -2
- package/dist/client-BD6XT-s5.js +1968 -0
- package/dist/client-BD6XT-s5.js.map +1 -0
- package/dist/{client-DwJInP_a.d.ts → client-D0CqSxoO.d.ts} +211 -30
- package/dist/{client-routes-DakuM32C.js → client-routes-JTbGtukf.js} +28 -15
- package/dist/client-routes-JTbGtukf.js.map +1 -0
- package/dist/context-CTiSzQRc.js +27 -0
- package/dist/context-CTiSzQRc.js.map +1 -0
- package/dist/context-btHuB01Z.d.ts +42 -0
- package/dist/{cookies-Av5WFmcf.js → cookies-BzllthiF.js} +2 -1
- package/dist/cookies-BzllthiF.js.map +1 -0
- package/dist/defer-BbD7JQhj.js +56 -0
- package/dist/defer-BbD7JQhj.js.map +1 -0
- package/dist/devtools-CQgD7NPB.js +623 -0
- package/dist/devtools-CQgD7NPB.js.map +1 -0
- package/dist/devtools-panel-BVB-W5q4.js +1930 -0
- package/dist/devtools-panel-BVB-W5q4.js.map +1 -0
- package/dist/events-CSs7OwIC.js +85 -0
- package/dist/events-CSs7OwIC.js.map +1 -0
- package/dist/{files-DdT84mPy.js → files-BXSSrQgc.js} +34 -6
- package/dist/files-BXSSrQgc.js.map +1 -0
- package/dist/forms-Bg-CwGqX.js +406 -0
- package/dist/forms-Bg-CwGqX.js.map +1 -0
- package/dist/forms-Cl21hkHt.d.ts +281 -0
- package/dist/highlight.d.ts +17 -0
- package/dist/highlight.js +269 -0
- package/dist/highlight.js.map +1 -0
- package/dist/html-Bq1rFxX_.d.ts +92 -0
- package/dist/html-mNTKzaDD.js +241 -0
- package/dist/html-mNTKzaDD.js.map +1 -0
- package/dist/index.d.ts +123 -30
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BPchdWbU.js → inspect-BHpOw1LF.js} +1400 -121
- package/dist/inspect-BHpOw1LF.js.map +1 -0
- package/dist/{loader-Dc9OwY5I.js → loader-Dos_3NP0.js} +47 -11
- package/dist/loader-Dos_3NP0.js.map +1 -0
- package/dist/{navigate-CzLjnoPH.js → navigate-O78d_zGN.js} +115 -13
- package/dist/navigate-O78d_zGN.js.map +1 -0
- package/dist/produce-D0V0ICkz.d.ts +114 -0
- package/dist/produce-Doc91GkX.js +274 -0
- package/dist/produce-Doc91GkX.js.map +1 -0
- package/dist/routes-BZNt7DSZ.d.ts +38 -0
- package/dist/{rpc-9fSqL_YK.js → rpc-ygMRPmN4.js} +39 -23
- package/dist/rpc-ygMRPmN4.js.map +1 -0
- package/dist/runtime/batch.d.ts +23 -0
- package/dist/runtime/batch.js +69 -0
- package/dist/runtime/batch.js.map +1 -0
- package/dist/runtime/client.d.ts +5 -5
- package/dist/runtime/client.js +5 -1345
- package/dist/runtime/context.d.ts +2 -2
- package/dist/runtime/context.js +1 -1
- package/dist/runtime/devtools.d.ts +191 -5
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/env.d.ts +44 -0
- package/dist/runtime/env.js +61 -0
- package/dist/runtime/env.js.map +1 -0
- package/dist/runtime/events.d.ts +42 -0
- package/dist/runtime/events.js +1 -0
- package/dist/runtime/forms.d.ts +2 -0
- package/dist/runtime/forms.js +1 -0
- package/dist/runtime/gather.d.ts +25 -0
- package/dist/runtime/gather.js +33 -0
- package/dist/runtime/gather.js.map +1 -0
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.d.ts +2 -2
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/routes.d.ts +2 -21
- package/dist/runtime/routes.js +31 -1
- package/dist/runtime/routes.js.map +1 -1
- package/dist/runtime/server.d.ts +7 -5
- package/dist/runtime/server.js +6 -7
- package/dist/runtime/signals.d.ts +60 -3
- package/dist/runtime/signals.js +40 -2
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +46 -5
- package/dist/runtime/testing.js +240 -33
- package/dist/runtime/testing.js.map +1 -1
- package/dist/runtime/values.d.ts +2 -0
- package/dist/runtime/values.js +24 -0
- package/dist/runtime/values.js.map +1 -0
- package/dist/secrets-BxagsJxJ.js +23 -0
- package/dist/secrets-BxagsJxJ.js.map +1 -0
- package/dist/server-CxVDYE_V.js +3417 -0
- package/dist/server-CxVDYE_V.js.map +1 -0
- package/dist/server-DuFYRXrd.d.ts +1460 -0
- package/dist/skew-FRmAy9iy.js +49 -0
- package/dist/skew-FRmAy9iy.js.map +1 -0
- package/dist/standard-schema-BNY82yX3.d.ts +63 -0
- package/dist/{static-loader-BcFh4ebX.d.ts → static-loader-Drpr0AzI.d.ts} +2 -2
- package/dist/static-loader-nZssh66R.js +333 -0
- package/dist/static-loader-nZssh66R.js.map +1 -0
- package/dist/stream-DCYZO4IF.js +424 -0
- package/dist/stream-DCYZO4IF.js.map +1 -0
- package/dist/values-B8C7CLvG.d.ts +63 -0
- package/dist/vite.d.ts +49 -1
- package/dist/vite.js +598 -68
- package/dist/vite.js.map +1 -1
- package/forms/forms.brm.ts +141 -0
- package/package.json +45 -3
- package/types.d.ts +9 -1
- package/dist/client-routes-DakuM32C.js.map +0 -1
- package/dist/context-BG8KCF3v.js +0 -15
- package/dist/context-BG8KCF3v.js.map +0 -1
- package/dist/context-aeo9esY9.d.ts +0 -16
- package/dist/cookies-Av5WFmcf.js.map +0 -1
- package/dist/devtools-BKjnHrnv.js +0 -113
- package/dist/devtools-BKjnHrnv.js.map +0 -1
- package/dist/devtools-panel-AWOn0VK2.js +0 -434
- package/dist/devtools-panel-AWOn0VK2.js.map +0 -1
- package/dist/files-DdT84mPy.js.map +0 -1
- package/dist/html-DEeoepg3.js +0 -152
- package/dist/html-DEeoepg3.js.map +0 -1
- package/dist/html-Du8jY2Cc.d.ts +0 -53
- package/dist/inspect-BPchdWbU.js.map +0 -1
- package/dist/loader-Dc9OwY5I.js.map +0 -1
- package/dist/navigate-CzLjnoPH.js.map +0 -1
- package/dist/produce-BRGHP7e0.js +0 -126
- package/dist/produce-BRGHP7e0.js.map +0 -1
- package/dist/produce-CtZ32UGG.d.ts +0 -60
- package/dist/rpc-9fSqL_YK.js.map +0 -1
- package/dist/runtime/client.js.map +0 -1
- package/dist/server-BxqjLUnV.d.ts +0 -753
- package/dist/server-DZsgnPKS.js +0 -1615
- package/dist/server-DZsgnPKS.js.map +0 -1
- package/dist/shared-CWYOd0H3.js +0 -40
- package/dist/shared-CWYOd0H3.js.map +0 -1
- package/dist/static-loader-ClNkHZGn.js +0 -185
- package/dist/static-loader-ClNkHZGn.js.map +0 -1
- package/dist/stream-bgNCMcaA.js +0 -280
- package/dist/stream-bgNCMcaA.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as analyzeProject, B as isWithin, D as unmarked, F as parse, I as buildGraph, L as BrumateError, N as resolveRelative, P as summarize, R as getLocation, S as sharedSites, V as lookup, b as SHARED_QUERY, d as generateServer$1, g as createPlan, h as clientState, i as report, j as analyzeProjectProps, l as generateClient$1, m as blockBodies, n as formatReport, o as CompileError, r as inspect, s as compile, u as generateRender$1, v as getComponentName, x as generateShared, z as analyze } from "./inspect-BHpOw1LF.js";
|
|
2
2
|
//#region src/print.ts
|
|
3
3
|
function at(source, range) {
|
|
4
4
|
const { line, column } = getLocation(source, range.start);
|
|
@@ -88,8 +88,10 @@ function printAST(file) {
|
|
|
88
88
|
body(item.body, depth + 1, "body");
|
|
89
89
|
break;
|
|
90
90
|
case "client":
|
|
91
|
-
|
|
91
|
+
case "defer":
|
|
92
|
+
write(depth, `${item.kind} (${item.trigger})`);
|
|
92
93
|
body(item.body, depth + 1, "body");
|
|
94
|
+
if (item.fallback) body(item.fallback, depth + 1, "else");
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
const node = (item, depth) => {
|
|
@@ -107,7 +109,7 @@ function printAST(file) {
|
|
|
107
109
|
nodes(item.children, depth + 1);
|
|
108
110
|
break;
|
|
109
111
|
case "fragment":
|
|
110
|
-
write(depth, "fragment");
|
|
112
|
+
write(depth, item.reveal ? `reveal ('${item.reveal.order}'${item.reveal.collapsed ? ", collapsed" : ""})` : "fragment");
|
|
111
113
|
nodes(item.children, depth + 1);
|
|
112
114
|
break;
|
|
113
115
|
case "listener":
|
|
@@ -237,8 +239,8 @@ declare function $$on<T extends string, K extends string>(tag: T, event: K, hand
|
|
|
237
239
|
declare function $$onWindow<K extends string>(event: K, handler: (event: $$Event<K, WindowEventMap> & { currentTarget: Window }) => unknown): void;
|
|
238
240
|
declare function $$onDocument<K extends string>(event: K, handler: (event: $$Event<K, DocumentEventMap> & { currentTarget: Document }) => unknown): void;
|
|
239
241
|
declare function $$use(...values: unknown[]): void;
|
|
240
|
-
type $$Plain = string | number | boolean | bigint | null | undefined | Date | Error | URL | URLSearchParams | ArrayBuffer | ArrayBufferView |
|
|
241
|
-
type $$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;
|
|
242
|
+
type $$Plain = string | number | boolean | bigint | null | undefined | Date | Error | URL | URLSearchParams | ArrayBuffer | ArrayBufferView | Headers | FormData | Request | Response | ReadableStream<any> | AbortSignal | Event | DOMException | ImageData;
|
|
243
|
+
type $$Sendable<T> = T extends $$Plain | import('brumate/serial').AppValue ? 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;
|
|
242
244
|
/** Checks a value that the page state sends to the client. */
|
|
243
245
|
declare function $$sendable<T>(value: T & $$Sendable<T>): void;
|
|
244
246
|
`;
|
|
@@ -380,7 +382,7 @@ var Generator = class {
|
|
|
380
382
|
templates(templates) {
|
|
381
383
|
const { out } = this;
|
|
382
384
|
for (const template of templates) {
|
|
383
|
-
out.text("function ");
|
|
385
|
+
out.text("async function ");
|
|
384
386
|
out.copy(template.nameRange);
|
|
385
387
|
out.text("(");
|
|
386
388
|
if (template.params.length > 0) out.copy({
|
|
@@ -634,10 +636,16 @@ var Generator = class {
|
|
|
634
636
|
out.text("}\n");
|
|
635
637
|
return;
|
|
636
638
|
case "head":
|
|
639
|
+
out.text("{\n");
|
|
640
|
+
this.body(block.body);
|
|
641
|
+
out.text("}\n");
|
|
642
|
+
return;
|
|
637
643
|
case "client":
|
|
644
|
+
case "defer":
|
|
638
645
|
out.text("{\n");
|
|
639
646
|
this.body(block.body);
|
|
640
647
|
out.text("}\n");
|
|
648
|
+
this.fallback(block.fallback);
|
|
641
649
|
return;
|
|
642
650
|
}
|
|
643
651
|
}
|
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 '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,KAAK,GAAG,MAAM,KAAK,KAAK;EAC3E,KAAK,SACH,OAAO,GAAG,KAAK,KAAK,IAAI,KAAK,M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AClC,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 case 'defer':\n write(depth, `${item.kind} (${item.trigger})`);\n body(item.body, depth + 1, 'body');\n if (item.fallback) {\n body(item.fallback, depth + 1, 'else');\n }\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(\n depth,\n item.reveal\n ? `reveal ('${item.reveal.order}'${item.reveal.collapsed ? ', collapsed' : ''})`\n : 'fragment',\n );\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 | Headers | FormData | Request | Response | ReadableStream<any> | AbortSignal | Event | DOMException | ImageData;\ntype $$Sendable<T> = T extends $$Plain | import('brumate/serial').AppValue ? 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 // Templates can await memos, as the component function can.\n out.text('async 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 out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n return;\n case 'client':\n case 'defer':\n out.text('{\\n');\n this.body(block.body);\n out.text('}\\n');\n this.fallback(block.fallback);\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,KAAK,GAAG,MAAM,KAAK,KAAK;EAC3E,KAAK,SACH,OAAO,GAAG,KAAK,KAAK,IAAI,KAAK,MAAM,KAAK;EAC1C,KAAK,SACH,OAAO,GAAG,KAAK,OAAO,KAAK,UAAU,KAAK,aAAa,IAAI,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,KAAK,QAAQ,KAAK;EACxG,KAAK,OACH,OAAO,OAAO,KAAK;EACrB,KAAK,YACH,OAAO,YAAY,MAAM,KAAK,QAAQ;EACxC,KAAK,UACH,OAAO,OAAO,KAAK,MAAM,KAAK;EAChC,KAAK,YACH,OAAO,IAAI,KAAK,KAAK,KAAK,GAAG,KAAK,UAAU,OAAO,KAAK,KAAK,KAAK,MAAM,KAAK;CACjF;AACF;;AAGA,SAAgB,SAAS,MAAuB;CAC9C,MAAM,QAAkB,CAAC;CACzB,MAAM,SAAS,OAAe,SAAuB;EACnD,MAAM,KAAK,GAAG,KAAK,OAAO,KAAK,IAAI,MAAM;CAC3C;CAEA,MAAM,QAAQ,MAAY,OAAe,UAAwB;EAC/D,MAAM,OAAO,KAAK;EAClB,IAAI,KAAK,QACP,MAAM,QAAQ,GAAG,QAAQ;EAE3B,KAAK,MAAM,YAAY,KAAK,WAAW;GAC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