@fluixi/compiler 1.0.0-alpha.83 → 1.0.0-alpha.84

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.
Files changed (163) hide show
  1. package/dist/analyze/expr-shape.cjs +62 -1
  2. package/dist/analyze/expr-shape.d.cts +14 -0
  3. package/dist/analyze/expr-shape.mjs +41 -1
  4. package/dist/analyze/intrinsics.cjs +80 -1
  5. package/dist/analyze/intrinsics.d.cts +66 -0
  6. package/dist/analyze/intrinsics.mjs +59 -1
  7. package/dist/analyze/paren.cjs +134 -0
  8. package/dist/analyze/paren.d.cts +23 -0
  9. package/dist/analyze/paren.d.ts +24 -0
  10. package/dist/analyze/paren.d.ts.map +1 -0
  11. package/dist/analyze/paren.js +168 -0
  12. package/dist/analyze/paren.mjs +113 -0
  13. package/dist/analyze/props-destructure.cjs +226 -1
  14. package/dist/analyze/props-destructure.d.cts +83 -0
  15. package/dist/analyze/props-destructure.mjs +205 -1
  16. package/dist/analyze/reactive-bindings.cjs +190 -1
  17. package/dist/analyze/reactive-bindings.d.cts +42 -0
  18. package/dist/analyze/reactive-bindings.mjs +167 -1
  19. package/dist/analyze/reactive-expr.cjs +38 -1
  20. package/dist/analyze/reactive-expr.d.cts +38 -0
  21. package/dist/analyze/reactive-expr.mjs +17 -1
  22. package/dist/analyze/static-graph.cjs +811 -1
  23. package/dist/analyze/static-graph.d.cts +102 -0
  24. package/dist/analyze/static-graph.mjs +793 -1
  25. package/dist/babel-NRW4EFTG.mjs +636 -0
  26. package/dist/chunk-3YKZ4GNH.mjs +11 -0
  27. package/dist/chunk-EZR7NZOY.mjs +1718 -0
  28. package/dist/chunk-FSSWUXUR.mjs +16 -0
  29. package/dist/chunk-MJV3UXIL.mjs +158 -0
  30. package/dist/chunk-R2VHAZAX.mjs +1078 -0
  31. package/dist/codegen/backend.cjs +18 -1
  32. package/dist/codegen/backend.d.cts +35 -0
  33. package/dist/codegen/backends/imperative.cjs +542 -1
  34. package/dist/codegen/backends/imperative.d.cts +11 -0
  35. package/dist/codegen/backends/imperative.d.ts.map +1 -1
  36. package/dist/codegen/backends/imperative.js +12 -8
  37. package/dist/codegen/backends/imperative.mjs +519 -1
  38. package/dist/codegen/contract.cjs +52 -1
  39. package/dist/codegen/contract.d.cts +24 -0
  40. package/dist/codegen/contract.mjs +31 -1
  41. package/dist/codegen/partial-template.cjs +176 -1
  42. package/dist/codegen/partial-template.d.cts +61 -0
  43. package/dist/codegen/partial-template.mjs +153 -1
  44. package/dist/codegen/serialize-static.cjs +125 -1
  45. package/dist/codegen/serialize-static.d.cts +38 -0
  46. package/dist/codegen/serialize-static.mjs +104 -1
  47. package/dist/frontend/babel/build-ir-lit.cjs +1509 -1
  48. package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
  49. package/dist/frontend/babel/build-ir-lit.mjs +1478 -1
  50. package/dist/frontend/babel/build-ir.cjs +1524 -1
  51. package/dist/frontend/babel/build-ir.d.cts +35 -0
  52. package/dist/frontend/babel/build-ir.mjs +1495 -1
  53. package/dist/frontend/babel/index.cjs +2186 -1
  54. package/dist/frontend/babel/index.d.cts +33 -0
  55. package/dist/frontend/babel/index.mjs +2156 -1
  56. package/dist/frontend/babel/lower-template.cjs +1507 -1
  57. package/dist/frontend/babel/lower-template.d.cts +23 -0
  58. package/dist/frontend/babel/lower-template.mjs +1478 -1
  59. package/dist/frontend/babel/plugin.cjs +2132 -1
  60. package/dist/frontend/babel/plugin.d.cts +95 -0
  61. package/dist/frontend/babel/plugin.mjs +2103 -1
  62. package/dist/frontend/babel/server-functions.cjs +110 -1
  63. package/dist/frontend/babel/server-functions.d.cts +10 -0
  64. package/dist/frontend/babel/server-functions.mjs +89 -1
  65. package/dist/frontend/babel/types.cjs +18 -1
  66. package/dist/frontend/babel/types.d.cts +33 -0
  67. package/dist/frontend/types.cjs +18 -1
  68. package/dist/frontend/types.d.cts +25 -0
  69. package/dist/frontend/vocabulary.cjs +98 -0
  70. package/dist/frontend/vocabulary.d.cts +79 -0
  71. package/dist/frontend/vocabulary.d.ts +80 -0
  72. package/dist/frontend/vocabulary.d.ts.map +1 -0
  73. package/dist/frontend/vocabulary.js +124 -0
  74. package/dist/frontend/vocabulary.mjs +77 -0
  75. package/dist/index.cjs +1594 -13
  76. package/dist/index.d.cts +27 -0
  77. package/dist/index.mjs +1574 -13
  78. package/dist/integrations.cjs +4307 -25
  79. package/dist/integrations.d.cts +215 -0
  80. package/dist/integrations.mjs +531 -17
  81. package/dist/ir/nodes.cjs +18 -1
  82. package/dist/ir/nodes.d.cts +168 -0
  83. package/dist/lower/compile-template.cjs +1356 -1
  84. package/dist/lower/compile-template.d.cts +69 -0
  85. package/dist/lower/compile-template.mjs +1336 -1
  86. package/dist/lower/jsx.cjs +529 -1
  87. package/dist/lower/jsx.d.cts +25 -0
  88. package/dist/lower/jsx.d.ts.map +1 -1
  89. package/dist/lower/jsx.js +2 -1
  90. package/dist/lower/jsx.mjs +506 -1
  91. package/dist/lower/template.cjs +1061 -1
  92. package/dist/lower/template.d.cts +53 -0
  93. package/dist/lower/template.d.ts.map +1 -1
  94. package/dist/lower/template.js +5 -4
  95. package/dist/lower/template.mjs +1042 -1
  96. package/dist/lower/text.cjs +42 -1
  97. package/dist/lower/text.d.cts +10 -0
  98. package/dist/lower/text.mjs +21 -1
  99. package/dist/optimize/analyze-static.cjs +112 -1
  100. package/dist/optimize/analyze-static.d.cts +39 -0
  101. package/dist/optimize/analyze-static.mjs +91 -1
  102. package/dist/optimize/collapse-strategies.cjs +90 -1
  103. package/dist/optimize/collapse-strategies.d.cts +30 -0
  104. package/dist/optimize/collapse-strategies.mjs +67 -1
  105. package/dist/options.cjs +33 -1
  106. package/dist/options.d.cts +39 -0
  107. package/dist/options.mjs +12 -1
  108. package/dist/resolve/builtins.cjs +73 -1
  109. package/dist/resolve/builtins.d.cts +68 -0
  110. package/dist/resolve/builtins.mjs +53 -1
  111. package/dist/resolve/component-globals.cjs +233 -13
  112. package/dist/resolve/component-globals.d.cts +80 -0
  113. package/dist/resolve/component-globals.mjs +210 -13
  114. package/dist/resolve/component-resolver.cjs +80 -1
  115. package/dist/resolve/component-resolver.d.cts +68 -0
  116. package/dist/resolve/component-resolver.mjs +59 -1
  117. package/dist/resolve/load-directive.cjs +93 -1
  118. package/dist/resolve/load-directive.d.cts +53 -0
  119. package/dist/resolve/load-directive.mjs +72 -1
  120. package/dist/resolve/resolve-ir.cjs +108 -1
  121. package/dist/resolve/resolve-ir.d.cts +53 -0
  122. package/dist/resolve/resolve-ir.mjs +85 -1
  123. package/dist/resolve/write-globals.cjs +318 -13
  124. package/dist/resolve/write-globals.d.cts +30 -0
  125. package/dist/resolve/write-globals.mjs +297 -13
  126. package/dist/server-fns-4ZXN6DYU.mjs +78 -0
  127. package/dist/server-functions-V6D6DRIA.mjs +82 -0
  128. package/dist/transform/bindings.cjs +71 -1
  129. package/dist/transform/bindings.d.cts +16 -0
  130. package/dist/transform/bindings.mjs +50 -1
  131. package/dist/transform/index.cjs +2732 -8
  132. package/dist/transform/index.d.cts +15 -0
  133. package/dist/transform/index.mjs +3773 -17
  134. package/dist/transform/intrinsics.cjs +216 -3
  135. package/dist/transform/intrinsics.d.cts +21 -0
  136. package/dist/transform/intrinsics.mjs +193 -3
  137. package/dist/transform/props.cjs +441 -3
  138. package/dist/transform/props.d.cts +45 -0
  139. package/dist/transform/props.mjs +1482 -12
  140. package/dist/transform/server-fn-id.cjs +35 -1
  141. package/dist/transform/server-fn-id.d.cts +9 -0
  142. package/dist/transform/server-fn-id.mjs +14 -1
  143. package/dist/transform/server-fns.cjs +114 -2
  144. package/dist/transform/server-fns.d.cts +12 -0
  145. package/dist/transform/server-fns.mjs +1155 -11
  146. package/dist/transform/source-locations.cjs +330 -1
  147. package/dist/transform/source-locations.d.cts +43 -0
  148. package/dist/transform/source-locations.mjs +307 -1
  149. package/dist/transform/templates.cjs +2701 -7
  150. package/dist/transform/templates.d.cts +69 -0
  151. package/dist/transform/templates.mjs +3743 -16
  152. package/dist/transform-BT4MMASR.mjs +893 -0
  153. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  154. package/package.json +6 -5
  155. package/dist/babel-VXKH6MRQ.mjs +0 -1
  156. package/dist/chunk-3SAEGOMQ.mjs +0 -1
  157. package/dist/chunk-5KMMN5QP.mjs +0 -1
  158. package/dist/chunk-IBRM4W7I.mjs +0 -10
  159. package/dist/chunk-OHHZCYIQ.mjs +0 -1
  160. package/dist/chunk-YKZ54NVE.mjs +0 -1
  161. package/dist/server-fns-6QM243HC.mjs +0 -2
  162. package/dist/server-functions-E3LKCZ4R.mjs +0 -1
  163. package/dist/transform-C4ZXRVGP.mjs +0 -8
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Normalized, host-agnostic IR. Both the babel and (future) swc front-ends
3
+ * produce this; codegen backends consume it. This is the stable contract
4
+ * between parsing and code generation — the layer your own improvements
5
+ * (hoisting, islands, resumability hints) transform.
6
+ */
7
+ import type { IRLoadStrategy } from '../resolve/load-directive.cjs';
8
+ export type { IRLoadStrategy };
9
+ export interface SourceSpan {
10
+ start: number;
11
+ end: number;
12
+ }
13
+ /**
14
+ * Where a hole was written. Carried as data because the source map cannot say: a template is
15
+ * emitted as one overwrite, so every hole in it traces back to the line the root opens at.
16
+ */
17
+ export interface HolePosition {
18
+ line: number;
19
+ column: number;
20
+ }
21
+ export type IRNode = IRElement | IRComponent | IRText | IRExpression | IRControl | IRFragment;
22
+ export type IRPropKind = 'attr' | 'prop' | 'event' | 'ref' | 'class' | 'style' | 'spread';
23
+ export interface IRProp {
24
+ /** prop/attribute name (already normalized, e.g. class -> className). Empty for spreads. */
25
+ name: string;
26
+ kind: IRPropKind;
27
+ /**
28
+ * A static literal value. Mutually exclusive with `expr`. Used for things like
29
+ * `id="x"` (string), `tabindex={3}` (number) or a valueless attr (boolean true).
30
+ */
31
+ literal?: string | number | boolean | null;
32
+ /** Raw JS expression code. Mutually exclusive with `literal`. */
33
+ expr?: string;
34
+ /** When true, `expr` must be wired reactively (emitted as a `() => expr` thunk). */
35
+ reactive?: boolean;
36
+ /** Where the expression was written. Only kept when the host asked for source locations. */
37
+ at?: HolePosition;
38
+ /**
39
+ * The directive this prop was written as, when it is not recoverable at runtime.
40
+ * `bind:value` becomes an ordinary value plus an input handler, and nothing downstream
41
+ * could tell it from the two written by hand.
42
+ */
43
+ directive?: string;
44
+ /**
45
+ * `expr` is an inline JSX element/fragment passed as a component prop (e.g.
46
+ * `<Suspense fallback={<div/>}>`). Emitted as a LAZY getter — like children — so the DOM is
47
+ * built only when the component reads the prop, not eagerly when the props object is
48
+ * constructed (which during hydration would walk the cursor and duplicate the tree).
49
+ */
50
+ jsxElement?: boolean;
51
+ /** For kind 'event': the DOM event name + whether it is delegated. */
52
+ event?: {
53
+ name: string;
54
+ delegated: boolean;
55
+ };
56
+ }
57
+ export interface IRElement {
58
+ kind: 'element';
59
+ tag: string;
60
+ svg: boolean;
61
+ props: IRProp[];
62
+ children: IRNode[];
63
+ /** analyze/statics: subtree has no dynamic parts → hoistable (template-clone) */
64
+ static: boolean;
65
+ /**
66
+ * Where the tag was written, when the transform was asked for source locations. A
67
+ * template is emitted as one string, so this is the only record of where each element in
68
+ * it came from.
69
+ */
70
+ at?: {
71
+ file: string;
72
+ line: number;
73
+ column: number;
74
+ };
75
+ loc?: SourceSpan;
76
+ }
77
+ /**
78
+ * Where a component reference comes from, attached to the reference itself.
79
+ *
80
+ * A capitalised tag with no binding in the file is supplied by the compiler — from a
81
+ * `resolve` rule, or from the built-in control-flow/router sets. That decision used to
82
+ * live only in the Babel plugin's state, which meant the IR could not see which
83
+ * components a template referenced: no pass could vary a decision per usage, group
84
+ * references into chunks, or drop a subtree it knows is server-only. Recording it on
85
+ * the node is what turns resolution from a convenience into something later passes can
86
+ * read.
87
+ *
88
+ * `origin` distinguishes the two suppliers because they behave differently: a `rule`
89
+ * is configuration and may be overridden or re-targeted, while a `builtin` control-flow
90
+ * name also selects codegen and cannot be re-pointed at another module.
91
+ */
92
+ export interface IRComponentSource {
93
+ module: string;
94
+ /** The export to import, or `default`. */
95
+ export: string;
96
+ origin: 'rule' | 'builtin';
97
+ /**
98
+ * When the module is fetched. Set from a `load:` directive at the usage site, and
99
+ * `eager` otherwise — resolution decides where a component comes from, this decides
100
+ * when, and the two vary independently.
101
+ */
102
+ loading: IRLoadStrategy;
103
+ /** Assigned by the optimizer once references are grouped. */
104
+ chunk?: string;
105
+ }
106
+ export interface IRComponent {
107
+ kind: 'component';
108
+ name: string;
109
+ props: IRProp[];
110
+ children: IRNode[];
111
+ /**
112
+ * Set by the resolve pass when the compiler supplies this reference. Absent when the
113
+ * name is bound in the file — an ordinary import the author wrote — or when nothing
114
+ * claims it, which is a diagnostic rather than a resolution.
115
+ */
116
+ source?: IRComponentSource;
117
+ /**
118
+ * Where the tag was written, when the transform was asked for source locations. Distinct
119
+ * from `source`, which says where the component reference was resolved from.
120
+ */
121
+ at?: {
122
+ file: string;
123
+ line: number;
124
+ column: number;
125
+ };
126
+ /**
127
+ * Where the `${…}` that drives this subtree was written — the condition of an `if=`,
128
+ * the list of an `each=`. The insert that adds and removes the subtree is a reactive
129
+ * binding, and this is the position it reports. Distinct from `at`, which marks the
130
+ * node itself rather than the binding that places it.
131
+ */
132
+ bindAt?: HolePosition;
133
+ /**
134
+ * A `load:` strategy read off the tag by the frontend. The resolve pass folds it into
135
+ * `source.loading`; it lives here first because the frontend knows the directive and
136
+ * the resolve pass knows whether the name is deferrable at all.
137
+ */
138
+ load?: IRLoadStrategy;
139
+ loc?: SourceSpan;
140
+ }
141
+ export interface IRText {
142
+ kind: 'text';
143
+ value: string;
144
+ loc?: SourceSpan;
145
+ }
146
+ export interface IRExpression {
147
+ kind: 'expr';
148
+ code: string;
149
+ reactive: boolean;
150
+ loc?: SourceSpan;
151
+ /** Where the expression was written. Only kept when the host asked for source locations. */
152
+ at?: HolePosition;
153
+ }
154
+ export interface IRFragment {
155
+ kind: 'fragment';
156
+ children: IRNode[];
157
+ loc?: SourceSpan;
158
+ }
159
+ export type ControlKind = 'show' | 'for' | 'index' | 'switch' | 'match' | 'dynamic' | 'errorBoundary' | 'suspense';
160
+ export interface IRControl {
161
+ kind: 'control';
162
+ control: ControlKind;
163
+ props: IRProp[];
164
+ children: IRNode[];
165
+ /** As on IRComponent: where the hole driving this subtree was written. */
166
+ bindAt?: HolePosition;
167
+ loc?: SourceSpan;
168
+ }