clarusjs 0.1.0 → 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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/forinda/clarusjs/main/docs/assets/logo.svg" width="96" height="96" alt="clarusjs logo: a clear cut crystal with one bright facet">
3
+ </p>
4
+
5
+ <h1 align="center">clarusjs</h1>
6
+
7
+ <p align="center"><strong>Clear, compiled views.</strong></p>
8
+
9
+ Write components in a familiar template language. clarusjs compiles them to plain server HTML and ships JavaScript
10
+ only for the parts that are interactive. Static sites, server rendering and client apps share one component model,
11
+ and you can always see where each line runs.
12
+
13
+ > Status: early (`0.x`). The API will change between minor versions.
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ pnpm add clarusjs
19
+ pnpm add -D vite
20
+ ```
21
+
22
+ ## Use
23
+
24
+ ```ts
25
+ // vite.config.ts
26
+ import { defineConfig } from 'vite'
27
+ import clarusjs from 'clarusjs/vite'
28
+
29
+ export default defineConfig({ plugins: [clarusjs()] })
30
+ ```
31
+
32
+ ```clarus
33
+ {{-- src/components/counter.clarus --}}
34
+ @input start: number = 0
35
+
36
+ <script>
37
+ let count = state(start)
38
+ function add() { count++ }
39
+ </script>
40
+
41
+ <button (click)="add()">Clicked {{ count }} times</button>
42
+ ```
43
+
44
+ ```clarus
45
+ {{-- src/pages/index.clarus --}}
46
+ @import counter from '../components/counter.clarus'
47
+
48
+ <h1>Hello</h1>
49
+ <counter [start]="1" />
50
+ ```
51
+
52
+ - `vite` serves `src/pages/**/*.clarus` as routes, rendered on the server.
53
+ - `vite build` writes a static site to `dist/client/`: one HTML file per page, plus JavaScript only for components
54
+ with a `<script>` (the counter above). The `<h1>` ships no JavaScript at all.
55
+
56
+ ## Links
57
+
58
+ - Repository and design: [github.com/forinda/clarusjs](https://github.com/forinda/clarusjs)
59
+ - Contributing: [CONTRIBUTING.md](https://github.com/forinda/clarusjs/blob/main/CONTRIBUTING.md)
60
+ - Security: [SECURITY.md](https://github.com/forinda/clarusjs/blob/main/SECURITY.md)
61
+ - License: MIT
@@ -1,34 +1,105 @@
1
+ import { attrValueExpr, componentCall, htmlExpr, tagArg, walk, whichExpr } from './html-expr.js';
1
2
  import { rewriteClient, rewriteClientExpr, wrapExpr } from './script.js';
2
- import { indentScript, inputsLine } from './shared.js';
3
+ import { indentScript, inputsLine, renderName } from './shared.js';
3
4
  export function emitClient(ir) {
4
5
  if (!ir.stateful)
5
6
  return 'export {}\n';
6
7
  const kinds = new Set(ir.signals.values());
7
- const reactive = ir.nodes.filter((n) => n.kind === 'hole' && n.reactive);
8
+ const all = walk(ir.nodes);
9
+ const hasHoles = all.some((n) => n.kind === 'hole' && n.reactive);
10
+ const hasBlocks = all.some((n) => n.kind === 'if' && n.block >= 0);
11
+ const hasFors = all.some((n) => n.kind === 'for' && n.block >= 0);
12
+ const hasRegions = all.some((n) => n.kind === 'component' && n.region >= 0);
13
+ const rendersHtml = hasBlocks || hasFors || hasRegions;
8
14
  const used = [
9
15
  kinds.has('state') && 'state',
10
16
  kinds.has('derived') && 'derived',
11
- reactive.length > 0 && 'holes as __cl_holes',
12
- reactive.length > 0 && 'text as __cl_text',
17
+ kinds.has('shared') && 'shared',
18
+ hasHoles && 'holes as __cl_holes',
19
+ hasHoles && 'text as __cl_text',
13
20
  ir.events.length > 0 && 'on as __cl_on',
21
+ all.some((n) => n.kind === 'attr' && n.reactive) && 'attr as __cl_attr',
22
+ hasBlocks && 'block as __cl_block',
23
+ hasFors && 'forBlock as __cl_for',
24
+ hasRegions && 'region as __cl_region',
25
+ // Branch and row HTML is rendered in the browser with the same helpers as on the server.
26
+ rendersHtml && 'escape as __cl_escape',
27
+ rendersHtml && all.some((n) => n.kind === 'attr') && 'attrHtml as __cl_attrHtml',
28
+ rendersHtml && hasBlocks && 'blockHtml as __cl_blockHtml',
29
+ rendersHtml && hasFors && 'forHtml as __cl_forHtml',
30
+ hasRegions && 'regionHtml as __cl_regionHtml',
14
31
  ].filter(Boolean);
15
32
  let out = used.length ? `import { ${used.join(', ')} } from 'clarusjs/runtime'\n` : '';
16
- out += `\nexport function attach(__cl_root, __cl_props = {}) {\n`;
33
+ // Child components render in the browser too (in branches, rows and regions): import their server render
34
+ // functions through the plugin's ?render query.
35
+ const usedComponents = new Set(all.flatMap((n) => (n.kind === 'component' ? [n.name] : [])));
36
+ for (const imp of ir.imports) {
37
+ if (usedComponents.has(imp.name))
38
+ out += `import { render as ${renderName(imp.name)} } from '${imp.from}?render'\n`;
39
+ }
40
+ for (const line of ir.scriptImports)
41
+ out += `${line}\n`;
42
+ out += `\nexport function attach(__cl_root, __cl_props = {}, __cl_state) {\n`;
17
43
  out += inputsLine(ir);
18
44
  if (ir.script)
19
- out += indentScript(rewriteClient(ir.script, ir.signals));
20
- const wiring = [];
21
- if (reactive.length)
22
- wiring.push('const __cl_h = __cl_holes(__cl_root)');
23
- for (const h of [...reactive].sort((a, b) => a.index - b.index)) {
24
- wiring.push(`__cl_text(__cl_h[${h.index}], () => ${wrapExpr(rewriteClientExpr(h.expr, ir.signals))})`);
45
+ out += indentScript(rewriteClient(ir.script, ir.signals, { stateFromServer: true }));
46
+ const lines = wiring(ir, ir.nodes, undefined, '__cl_root', ir.signals, 0);
47
+ if (lines.length)
48
+ out += '\n' + lines.map((l) => ` ${l}\n`).join('');
49
+ return out + '}\n';
50
+ }
51
+ /** Rewrites expressions for the browser: reads of `signals` become `.get()`. */
52
+ function rewriter(signals) {
53
+ return {
54
+ expr: (e) => rewriteClientExpr(e, signals),
55
+ without: (names) => rewriter(new Map([...signals].filter(([name]) => !names.includes(name)))),
56
+ };
57
+ }
58
+ /**
59
+ * Code that wires one scope: the top level, an @if branch, a @for row or @empty content. Holes, attributes and
60
+ * events directly in `nodes` are wired here; nested blocks and lists get their own calls, whose branches and rows
61
+ * wire themselves. `ctx` names the island (top level) or the row range the scope's markers are looked up in.
62
+ */
63
+ function wiring(ir, nodes, scope, ctx, signals, depth) {
64
+ const rw = rewriter(signals);
65
+ const lines = [];
66
+ const holes = nodes.filter((n) => n.kind === 'hole' && n.reactive);
67
+ if (holes.length)
68
+ lines.push(`const __cl_h = __cl_holes(${ctx})`);
69
+ for (const h of [...holes].sort((a, b) => a.index - b.index))
70
+ lines.push(`__cl_text(__cl_h[${h.index}], () => ${wrapExpr(rw.expr(h.expr))})`);
71
+ for (const a of nodes) {
72
+ if (a.kind === 'attr' && a.reactive)
73
+ lines.push(`__cl_attr(${ctx}, ${a.index}, ${JSON.stringify(a.name)}, () => ${attrValueExpr(a.value, rw.expr)}${tagArg(a)})`);
25
74
  }
26
- for (const e of ir.events) {
27
- const body = rewriteClient(e.handler, ir.signals).trim();
75
+ for (const e of ir.events.filter((ev) => ev.scope === scope)) {
76
+ const body = rewriteClient(e.handler, signals).trim();
28
77
  const end = body.includes('//') ? '\n ' : ' '; // a trailing line comment must not swallow the closing `})`
29
- wiring.push(`__cl_on(__cl_root, ${e.index}, ${JSON.stringify(e.type)}, ($event) => { ${body}${end}})`);
78
+ lines.push(`__cl_on(${ctx}, ${e.index}, ${JSON.stringify(e.type)}, ($event) => { ${body}${end}})`);
30
79
  }
31
- if (wiring.length)
32
- out += '\n' + wiring.map((l) => ` ${l}\n`).join('');
33
- return out + '}\n';
80
+ const fn = (args, inner) => inner.length ? `(${args}) => {\n${inner.map((l) => ` ${l}`).join('\n')}\n }` : `(${args}) => {}`;
81
+ for (const n of nodes) {
82
+ if (n.kind === 'component' && n.region >= 0) {
83
+ const content = [...n.children, ...n.fills.flatMap((f) => f.nodes)];
84
+ lines.push(`__cl_region(${ctx}, ${n.region}, () => ${componentCall(n, rw)}, ${fn('', wiring(ir, content, `c${n.region}`, ctx, signals, depth))})`);
85
+ }
86
+ if (n.kind === 'if' && n.block >= 0) {
87
+ const branches = n.branches.map((b, i) => ` { html: () => ${htmlExpr(b.nodes, rw)}, wire: ${fn('', wiring(ir, b.nodes, `${n.block}.${i}`, ctx, signals, depth))} },`);
88
+ lines.push(`__cl_block(${ctx}, ${n.block}, () => ${whichExpr(n, rw)}, [\n${branches.join('\n')}\n ])`);
89
+ }
90
+ if (n.kind === 'for' && n.block >= 0) {
91
+ // In row HTML `item` and `$index` are plain values; while wiring a row they are that row's signals.
92
+ const rowCtx = `__cl_c${depth + 1}`;
93
+ const loop = [n.item, '$index'];
94
+ const rowSignals = new Map([...signals, ...loop.map((name) => [name, 'state'])]);
95
+ const plain = rw.without(loop);
96
+ const key = n.track === null ? '$index' : wrapExpr(plain.expr(n.track));
97
+ const row = `{\n html: (${n.item}, $index) => ${htmlExpr(n.nodes, plain)},\n wire: ${fn(`${rowCtx}, ${n.item}, $index`, wiring(ir, n.nodes, `f${n.block}`, rowCtx, rowSignals, depth + 1))},\n }`;
98
+ const empty = n.empty
99
+ ? `{\n html: () => ${htmlExpr(n.empty, rw)},\n wire: ${fn(rowCtx, wiring(ir, n.empty, `f${n.block}e`, rowCtx, signals, depth + 1))},\n }`
100
+ : 'null';
101
+ lines.push(`__cl_for(${ctx}, ${n.block}, () => ${wrapExpr(rw.expr(n.list))}, (${n.item}, $index) => ${key}, ${row}, ${empty})`);
102
+ }
103
+ }
104
+ return lines;
34
105
  }
@@ -1,28 +1,47 @@
1
- import { rewriteServer, wrapExpr } from './script.js';
1
+ import { htmlExpr, walk } from './html-expr.js';
2
+ import { rewriteServer } from './script.js';
2
3
  import { indentScript, inputsLine, renderName } from './shared.js';
3
4
  export function emitServer(ir, clientUrl) {
4
- const runtime = ir.stateful ? 'escape as __cl_escape, island as __cl_island' : 'escape as __cl_escape';
5
+ const all = walk(ir.nodes);
6
+ const runtime = [
7
+ 'escape as __cl_escape',
8
+ ir.stateful && 'island as __cl_island',
9
+ all.some((n) => n.kind === 'attr') && 'attr as __cl_attrHtml',
10
+ all.some((n) => n.kind === 'if' && n.block >= 0) && 'blockHtml as __cl_blockHtml',
11
+ all.some((n) => n.kind === 'for' && n.block >= 0) && 'forHtml as __cl_forHtml',
12
+ all.some((n) => n.kind === 'component' && n.region >= 0) && 'regionHtml as __cl_regionHtml',
13
+ ].filter(Boolean).join(', ');
5
14
  let out = `import { ${runtime} } from 'clarusjs/runtime/server'\n`;
6
15
  for (const imp of ir.imports)
7
16
  out += `import { render as ${renderName(imp.name)} } from '${imp.from}'\n`;
8
- const parts = ir.nodes.map((n) => {
9
- if (n.kind === 'static')
10
- return JSON.stringify(n.html);
11
- if (n.kind === 'component') {
12
- const props = n.props.map((p) => `${p.name}: ${wrapExpr(p.expr)}`).join(', ');
13
- return `${renderName(n.name)}({ ${props} })`;
14
- }
15
- const value = `__cl_escape(${wrapExpr(n.expr)})`;
16
- return n.reactive ? `"<!--[${n.index}-->" + ${value} + "<!--]-->"` : value;
17
- });
18
- const html = parts.length ? parts.join(' + ') : '""';
17
+ for (const line of ir.scriptImports)
18
+ out += `${line}\n`;
19
+ const html = htmlExpr(ir.nodes);
19
20
  const props = `{ ${ir.inputs.map((i) => i.name).join(', ')} }`.replace('{ }', '{}');
20
- out += `\nexport function render(__cl_props = {}) {\n`;
21
+ out += `\nexport function render(__cl_props = {}, __cl_slots, __cl_opts) {\n`;
22
+ if (ir.stateful)
23
+ out += ` if (__cl_slots !== undefined) throw new Error(${JSON.stringify(`[clarusjs] <${ir.name}> does not accept children yet`)})\n`;
24
+ else {
25
+ out += unknownSlotCheck(ir);
26
+ out += ` if (__cl_opts?.attach) throw new Error(${JSON.stringify(`[clarusjs] <${ir.name}> has no <script>, so attach="`)} + __cl_opts.attach + '" does nothing')\n`;
27
+ }
21
28
  out += inputsLine(ir);
22
29
  if (ir.script)
23
30
  out += indentScript(rewriteServer(ir.script));
24
31
  out += ir.stateful
25
- ? ` return __cl_island(${JSON.stringify(ir.name)}, ${JSON.stringify(clientUrl)}, ${props}, ${html})\n`
32
+ ? ` return __cl_island(${JSON.stringify(ir.name)}, ${JSON.stringify(clientUrl)}, ${props}, ${html}, ${stateArg(ir)}, __cl_opts?.attach)\n`
26
33
  : ` return ${html}\n`;
27
34
  return out + '}\n';
28
35
  }
36
+ /** Content for a slot this component doesn't have is an error (at render, so a build fails naming it). */
37
+ function unknownSlotCheck(ir) {
38
+ const known = [...new Set(walk(ir.nodes).flatMap((n) => (n.kind === 'slot' ? [n.name] : [])))];
39
+ const noDefault = JSON.stringify(`[clarusjs] <${ir.name}> has no <slot /> for the content passed to it`);
40
+ const noNamed = JSON.stringify(`[clarusjs] <${ir.name}> has no slot "`);
41
+ return ` for (const __cl_k in __cl_slots) if (!${JSON.stringify(known)}.includes(__cl_k)) throw new Error(__cl_k === "default" ? ${noDefault} : ${noNamed} + __cl_k + '"')\n`;
42
+ }
43
+ /** The component's state() values after its script ran: the island's starting point in the browser. */
44
+ function stateArg(ir) {
45
+ const names = [...ir.signals].filter(([, kind]) => kind === 'state').map(([name]) => name);
46
+ return names.length ? `{ ${names.join(', ')} }` : 'undefined';
47
+ }
@@ -0,0 +1,29 @@
1
+ import type { IRNode } from './ir.ts';
2
+ /**
3
+ * How a template expression becomes code. On the server it is used as written; in the browser signal reads become
4
+ * `.get()`. Inside a @for row's HTML, the row's `item` and `$index` are plain parameters, hence `without()`.
5
+ */
6
+ export type Rewriter = {
7
+ expr(e: string): string;
8
+ without(names: string[]): Rewriter;
9
+ };
10
+ export declare const asWritten: Rewriter;
11
+ export declare function htmlExpr(nodes: IRNode[], rw?: Rewriter): string;
12
+ /** `render_child({ props }, { slots })` for a component node. */
13
+ export declare function componentCall(n: Extract<IRNode, {
14
+ kind: 'component';
15
+ }>, rw: Rewriter): string;
16
+ /** Index of the branch an @if picks: `(a ? 0 : b ? 1 : 2)`, or -1 when nothing matches and there is no @else. */
17
+ export declare function whichExpr(n: Extract<IRNode, {
18
+ kind: 'if';
19
+ }>, rw: Rewriter): string;
20
+ /** JS expression for an attribute's value: the bound expression, or the parts joined (null/undefined join as ''). */
21
+ export declare function attrValueExpr(value: Extract<IRNode, {
22
+ kind: 'attr';
23
+ }>['value'], rewrite: (e: string) => string): string;
24
+ /** The element's tag, passed only for attributes whose meaning depends on it (SVG animation values). */
25
+ export declare function tagArg(n: Extract<IRNode, {
26
+ kind: 'attr';
27
+ }>): string;
28
+ /** Every node, including those inside @if branches, @for bodies and component children. */
29
+ export declare function walk(nodes: IRNode[]): IRNode[];
@@ -0,0 +1,85 @@
1
+ import { renderName } from './shared.js';
2
+ import { wrapExpr } from './script.js';
3
+ export const asWritten = { expr: (e) => e, without: () => asWritten };
4
+ export function htmlExpr(nodes, rw = asWritten) {
5
+ const parts = nodes.map((n) => {
6
+ if (n.kind === 'static')
7
+ return JSON.stringify(n.html);
8
+ if (n.kind === 'slot')
9
+ return `(__cl_slots?.[${JSON.stringify(n.name)}] ?? ${n.fallback.length ? `(${htmlExpr(n.fallback, rw)})` : '""'})`;
10
+ if (n.kind === 'attr')
11
+ return `__cl_attrHtml(${JSON.stringify(n.name)}, ${attrValueExpr(n.value, rw.expr)}${tagArg(n)})`;
12
+ if (n.kind === 'if') {
13
+ if (n.block === -1) {
14
+ // Outside islands: a plain choice, no markers.
15
+ const last = n.branches[n.branches.length - 1];
16
+ let expr = last.cond === null ? `(${htmlExpr(last.nodes, rw)})` : '""';
17
+ const conditional = last.cond === null ? n.branches.slice(0, -1) : n.branches;
18
+ for (const b of [...conditional].reverse())
19
+ expr = `(${wrapExpr(rw.expr(b.cond))} ? (${htmlExpr(b.nodes, rw)}) : ${expr})`;
20
+ return expr;
21
+ }
22
+ const branches = n.branches.map((b) => `() => ${htmlExpr(b.nodes, rw)}`).join(', ');
23
+ return `__cl_blockHtml(${n.block}, ${whichExpr(n, rw)}, [${branches}])`;
24
+ }
25
+ if (n.kind === 'for') {
26
+ const list = wrapExpr(rw.expr(n.list));
27
+ const row = `(${n.item}, $index) => ${htmlExpr(n.nodes, rw.without([n.item, '$index']))}`;
28
+ const empty = n.empty ? `() => ${htmlExpr(n.empty, rw)}` : 'null';
29
+ if (n.block >= 0)
30
+ return `__cl_forHtml(${n.block}, ${list}, ${row}, ${empty})`;
31
+ // Outside islands: a plain loop, no markers.
32
+ return `((__cl_l) => __cl_l.length ? __cl_l.map(${row}).join("") : ${n.empty ? `(${htmlExpr(n.empty, rw)})` : '""'})([...(${list} ?? [])])`;
33
+ }
34
+ if (n.kind === 'component') {
35
+ const call = componentCall(n, rw);
36
+ return n.region >= 0 ? `__cl_regionHtml(${n.region}, () => ${call})` : call;
37
+ }
38
+ const value = `__cl_escape(${wrapExpr(rw.expr(n.expr))})`;
39
+ return n.reactive ? `"<!--[${n.index}-->" + ${value} + "<!--]-->"` : value;
40
+ });
41
+ return parts.length ? parts.join(' + ') : '""';
42
+ }
43
+ /** `render_child({ props }, { slots })` for a component node. */
44
+ export function componentCall(n, rw) {
45
+ const props = n.props.map((p) => `${p.name}: ${wrapExpr(rw.expr(p.expr))}`).join(', ');
46
+ const slots = [
47
+ ...(n.children.length ? [`"default": ${htmlExpr(n.children, rw)}`] : []),
48
+ ...n.fills.map((f) => `${JSON.stringify(f.name)}: ${htmlExpr(f.nodes, rw)}`),
49
+ ];
50
+ const slotsArg = slots.length ? `{ ${slots.join(', ')} }` : undefined;
51
+ if (n.attach)
52
+ return `${renderName(n.name)}({ ${props} }, ${slotsArg ?? 'undefined'}, { attach: ${JSON.stringify(n.attach)} })`;
53
+ return slotsArg ? `${renderName(n.name)}({ ${props} }, ${slotsArg})` : `${renderName(n.name)}({ ${props} })`;
54
+ }
55
+ /** Index of the branch an @if picks: `(a ? 0 : b ? 1 : 2)`, or -1 when nothing matches and there is no @else. */
56
+ export function whichExpr(n, rw) {
57
+ let expr = n.branches[n.branches.length - 1].cond === null ? String(n.branches.length - 1) : '-1';
58
+ for (let i = n.branches.length - 1; i >= 0; i--) {
59
+ const cond = n.branches[i].cond;
60
+ if (cond !== null)
61
+ expr = `${wrapExpr(rw.expr(cond))} ? ${i} : ${expr}`;
62
+ }
63
+ return `(${expr})`;
64
+ }
65
+ /** JS expression for an attribute's value: the bound expression, or the parts joined (null/undefined join as ''). */
66
+ export function attrValueExpr(value, rewrite) {
67
+ if ('expr' in value)
68
+ return `(${rewrite(value.expr)})`;
69
+ return `[${value.parts.map((p) => (typeof p === 'string' ? JSON.stringify(p) : `(${rewrite(p.expr)})`)).join(', ')}].join("")`;
70
+ }
71
+ /** The element's tag, passed only for attributes whose meaning depends on it (SVG animation values). */
72
+ export function tagArg(n) {
73
+ return ['to', 'from', 'values', 'by'].includes(n.name.toLowerCase()) ? `, ${JSON.stringify(n.tag)}` : '';
74
+ }
75
+ /** Every node, including those inside @if branches, @for bodies and component children. */
76
+ export function walk(nodes) {
77
+ return nodes.flatMap((n) => [
78
+ n,
79
+ ...(n.kind === 'if' ? n.branches.flatMap((b) => walk(b.nodes))
80
+ : n.kind === 'for' ? [...walk(n.nodes), ...walk(n.empty ?? [])]
81
+ : n.kind === 'component' ? [...walk(n.children), ...n.fills.flatMap((f) => walk(f.nodes))]
82
+ : n.kind === 'slot' ? walk(n.fallback)
83
+ : []),
84
+ ]);
85
+ }
@@ -15,11 +15,51 @@ export type IRNode = {
15
15
  name: string;
16
16
  expr: string;
17
17
  }[];
18
+ children: IRNode[];
19
+ fills: {
20
+ name: string;
21
+ nodes: IRNode[];
22
+ }[];
23
+ region: number;
24
+ attach?: string;
25
+ } | {
26
+ kind: 'slot';
27
+ name: string;
28
+ fallback: IRNode[];
29
+ } | {
30
+ kind: 'attr';
31
+ name: string;
32
+ value: {
33
+ expr: string;
34
+ } | {
35
+ parts: (string | {
36
+ expr: string;
37
+ })[];
38
+ };
39
+ reactive: boolean;
40
+ index: number;
41
+ tag: string;
42
+ } | {
43
+ kind: 'if';
44
+ branches: {
45
+ cond: string | null;
46
+ nodes: IRNode[];
47
+ }[];
48
+ block: number;
49
+ } | {
50
+ kind: 'for';
51
+ item: string;
52
+ list: string;
53
+ track: string | null;
54
+ nodes: IRNode[];
55
+ empty: IRNode[] | null;
56
+ block: number;
18
57
  };
19
58
  export type IREvent = {
20
59
  index: number;
21
60
  type: string;
22
61
  handler: string;
62
+ scope?: string;
23
63
  };
24
64
  export type ComponentIR = {
25
65
  file: string;
@@ -27,6 +67,7 @@ export type ComponentIR = {
27
67
  inputs: InputDecl[];
28
68
  imports: ImportDecl[];
29
69
  script?: string;
70
+ scriptImports: string[];
30
71
  signals: Signals;
31
72
  stateful: boolean;
32
73
  nodes: IRNode[];