rooklang 0.0.0-stage → 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.
Files changed (314) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +177 -2
  3. package/README.ru.md +178 -0
  4. package/dist/ast/declarations.d.ts +185 -0
  5. package/dist/ast/declarations.js +1 -0
  6. package/dist/ast/expressions.d.ts +201 -0
  7. package/dist/ast/expressions.js +1 -0
  8. package/dist/ast/markup.d.ts +141 -0
  9. package/dist/ast/markup.js +1 -0
  10. package/dist/ast/statements.d.ts +173 -0
  11. package/dist/ast/statements.js +1 -0
  12. package/dist/ast.d.ts +18 -0
  13. package/dist/ast.js +18 -0
  14. package/dist/attrs.d.ts +8 -0
  15. package/dist/attrs.js +23 -0
  16. package/dist/browser.d.ts +30 -0
  17. package/dist/browser.js +36 -0
  18. package/dist/build.d.ts +48 -0
  19. package/dist/build.js +112 -0
  20. package/dist/checker/assignments.d.ts +14 -0
  21. package/dist/checker/assignments.js +197 -0
  22. package/dist/checker/base.d.ts +124 -0
  23. package/dist/checker/base.js +180 -0
  24. package/dist/checker/bigint.d.ts +15 -0
  25. package/dist/checker/bigint.js +85 -0
  26. package/dist/checker/builtins.d.ts +9 -0
  27. package/dist/checker/builtins.js +307 -0
  28. package/dist/checker/bytes.d.ts +11 -0
  29. package/dist/checker/bytes.js +72 -0
  30. package/dist/checker/calls.d.ts +23 -0
  31. package/dist/checker/calls.js +210 -0
  32. package/dist/checker/channel.d.ts +14 -0
  33. package/dist/checker/channel.js +44 -0
  34. package/dist/checker/channels.d.ts +9 -0
  35. package/dist/checker/channels.js +95 -0
  36. package/dist/checker/checker.d.ts +4 -0
  37. package/dist/checker/checker.js +22 -0
  38. package/dist/checker/classes.d.ts +24 -0
  39. package/dist/checker/classes.js +223 -0
  40. package/dist/checker/completion-names.d.ts +11 -0
  41. package/dist/checker/completion-names.js +100 -0
  42. package/dist/checker/completion.d.ts +25 -0
  43. package/dist/checker/completion.js +222 -0
  44. package/dist/checker/component-values.d.ts +11 -0
  45. package/dist/checker/component-values.js +88 -0
  46. package/dist/checker/components.d.ts +37 -0
  47. package/dist/checker/components.js +287 -0
  48. package/dist/checker/context.d.ts +196 -0
  49. package/dist/checker/context.js +35 -0
  50. package/dist/checker/control-flow.d.ts +24 -0
  51. package/dist/checker/control-flow.js +237 -0
  52. package/dist/checker/declarations.d.ts +26 -0
  53. package/dist/checker/declarations.js +259 -0
  54. package/dist/checker/decorator-exports.d.ts +5 -0
  55. package/dist/checker/decorator-exports.js +40 -0
  56. package/dist/checker/decorator-members.d.ts +28 -0
  57. package/dist/checker/decorator-members.js +140 -0
  58. package/dist/checker/decorator-wrappers.d.ts +20 -0
  59. package/dist/checker/decorator-wrappers.js +132 -0
  60. package/dist/checker/decorators.d.ts +28 -0
  61. package/dist/checker/decorators.js +265 -0
  62. package/dist/checker/dom-svg.d.ts +7 -0
  63. package/dist/checker/dom-svg.js +19 -0
  64. package/dist/checker/dom.d.ts +22 -0
  65. package/dist/checker/dom.js +361 -0
  66. package/dist/checker/expressions.d.ts +32 -0
  67. package/dist/checker/expressions.js +244 -0
  68. package/dist/checker/flow.d.ts +18 -0
  69. package/dist/checker/flow.js +134 -0
  70. package/dist/checker/forwarding.d.ts +15 -0
  71. package/dist/checker/forwarding.js +78 -0
  72. package/dist/checker/functions.d.ts +24 -0
  73. package/dist/checker/functions.js +154 -0
  74. package/dist/checker/go-for.d.ts +12 -0
  75. package/dist/checker/go-for.js +93 -0
  76. package/dist/checker/goroutines.d.ts +19 -0
  77. package/dist/checker/goroutines.js +110 -0
  78. package/dist/checker/helpers.d.ts +35 -0
  79. package/dist/checker/helpers.js +162 -0
  80. package/dist/checker/imports.d.ts +7 -0
  81. package/dist/checker/imports.js +83 -0
  82. package/dist/checker/initializers.d.ts +22 -0
  83. package/dist/checker/initializers.js +104 -0
  84. package/dist/checker/iterables.d.ts +5 -0
  85. package/dist/checker/iterables.js +17 -0
  86. package/dist/checker/iterators.d.ts +13 -0
  87. package/dist/checker/iterators.js +95 -0
  88. package/dist/checker/loops.d.ts +10 -0
  89. package/dist/checker/loops.js +82 -0
  90. package/dist/checker/markup.d.ts +28 -0
  91. package/dist/checker/markup.js +220 -0
  92. package/dist/checker/members.d.ts +29 -0
  93. package/dist/checker/members.js +233 -0
  94. package/dist/checker/operators.d.ts +13 -0
  95. package/dist/checker/operators.js +177 -0
  96. package/dist/checker/promise.d.ts +17 -0
  97. package/dist/checker/promise.js +49 -0
  98. package/dist/checker/refs.d.ts +26 -0
  99. package/dist/checker/refs.js +136 -0
  100. package/dist/checker/resolution.d.ts +23 -0
  101. package/dist/checker/resolution.js +173 -0
  102. package/dist/checker/statements.d.ts +28 -0
  103. package/dist/checker/statements.js +212 -0
  104. package/dist/checker/styles.d.ts +14 -0
  105. package/dist/checker/styles.js +49 -0
  106. package/dist/checker/transfer.d.ts +5 -0
  107. package/dist/checker/transfer.js +83 -0
  108. package/dist/checker/types/bytes.d.ts +4 -0
  109. package/dist/checker/types/bytes.js +51 -0
  110. package/dist/checker/types/classes.d.ts +22 -0
  111. package/dist/checker/types/classes.js +93 -0
  112. package/dist/checker/types/constructors.d.ts +27 -0
  113. package/dist/checker/types/constructors.js +129 -0
  114. package/dist/checker/types/generics.d.ts +20 -0
  115. package/dist/checker/types/generics.js +75 -0
  116. package/dist/checker/types/lazy.d.ts +30 -0
  117. package/dist/checker/types/lazy.js +92 -0
  118. package/dist/checker/types/model.d.ts +149 -0
  119. package/dist/checker/types/model.js +15 -0
  120. package/dist/checker/types/params.d.ts +7 -0
  121. package/dist/checker/types/params.js +220 -0
  122. package/dist/checker/types/printing.d.ts +6 -0
  123. package/dist/checker/types/printing.js +109 -0
  124. package/dist/checker/types/relations.d.ts +16 -0
  125. package/dist/checker/types/relations.js +294 -0
  126. package/dist/checker/types.d.ts +9 -0
  127. package/dist/checker/types.js +10 -0
  128. package/dist/cli.d.ts +2 -0
  129. package/dist/cli.js +193 -0
  130. package/dist/codegen/analysis.d.ts +18 -0
  131. package/dist/codegen/analysis.js +144 -0
  132. package/dist/codegen/attributes.d.ts +40 -0
  133. package/dist/codegen/attributes.js +227 -0
  134. package/dist/codegen/calls.d.ts +22 -0
  135. package/dist/codegen/calls.js +106 -0
  136. package/dist/codegen/chan-helpers.d.ts +2 -0
  137. package/dist/codegen/chan-helpers.js +253 -0
  138. package/dist/codegen/component-helpers.d.ts +33 -0
  139. package/dist/codegen/component-helpers.js +18 -0
  140. package/dist/codegen/component-props.d.ts +42 -0
  141. package/dist/codegen/component-props.js +173 -0
  142. package/dist/codegen/component-values.d.ts +27 -0
  143. package/dist/codegen/component-values.js +146 -0
  144. package/dist/codegen/components.d.ts +53 -0
  145. package/dist/codegen/components.js +268 -0
  146. package/dist/codegen/control-flow.d.ts +25 -0
  147. package/dist/codegen/control-flow.js +152 -0
  148. package/dist/codegen/control-statements.d.ts +28 -0
  149. package/dist/codegen/control-statements.js +226 -0
  150. package/dist/codegen/creation.d.ts +31 -0
  151. package/dist/codegen/creation.js +113 -0
  152. package/dist/codegen/early-returns.d.ts +59 -0
  153. package/dist/codegen/early-returns.js +244 -0
  154. package/dist/codegen/element-helpers.d.ts +12 -0
  155. package/dist/codegen/element-helpers.js +54 -0
  156. package/dist/codegen/elements.d.ts +71 -0
  157. package/dist/codegen/elements.js +293 -0
  158. package/dist/codegen/emitter.d.ts +135 -0
  159. package/dist/codegen/emitter.js +296 -0
  160. package/dist/codegen/expressions.d.ts +49 -0
  161. package/dist/codegen/expressions.js +262 -0
  162. package/dist/codegen/functions.d.ts +28 -0
  163. package/dist/codegen/functions.js +170 -0
  164. package/dist/codegen/go-helpers.d.ts +9 -0
  165. package/dist/codegen/go-helpers.js +307 -0
  166. package/dist/codegen/helpers.d.ts +10 -0
  167. package/dist/codegen/helpers.js +356 -0
  168. package/dist/codegen/imported.d.ts +38 -0
  169. package/dist/codegen/imported.js +71 -0
  170. package/dist/codegen/js.d.ts +20 -0
  171. package/dist/codegen/js.js +113 -0
  172. package/dist/codegen/mutations.d.ts +10 -0
  173. package/dist/codegen/mutations.js +102 -0
  174. package/dist/codegen/parallel.d.ts +7 -0
  175. package/dist/codegen/parallel.js +63 -0
  176. package/dist/codegen/reactive.d.ts +95 -0
  177. package/dist/codegen/reactive.js +280 -0
  178. package/dist/codegen/refs.d.ts +62 -0
  179. package/dist/codegen/refs.js +160 -0
  180. package/dist/codegen/select-helpers.d.ts +2 -0
  181. package/dist/codegen/select-helpers.js +135 -0
  182. package/dist/codegen/simple-statements.d.ts +42 -0
  183. package/dist/codegen/simple-statements.js +253 -0
  184. package/dist/codegen/statements.d.ts +22 -0
  185. package/dist/codegen/statements.js +142 -0
  186. package/dist/codegen/styles.d.ts +54 -0
  187. package/dist/codegen/styles.js +157 -0
  188. package/dist/codegen/syntax.d.ts +18 -0
  189. package/dist/codegen/syntax.js +70 -0
  190. package/dist/codegen/thread-helpers.d.ts +2 -0
  191. package/dist/codegen/thread-helpers.js +198 -0
  192. package/dist/codegen/updates.d.ts +51 -0
  193. package/dist/codegen/updates.js +201 -0
  194. package/dist/codegen/web-components.d.ts +20 -0
  195. package/dist/codegen/web-components.js +149 -0
  196. package/dist/compile-file.d.ts +11 -0
  197. package/dist/compile-file.js +24 -0
  198. package/dist/compile.d.ts +53 -0
  199. package/dist/compile.js +187 -0
  200. package/dist/completion.d.ts +10 -0
  201. package/dist/completion.js +134 -0
  202. package/dist/config.d.ts +2 -0
  203. package/dist/config.js +44 -0
  204. package/dist/css/hash.d.ts +1 -0
  205. package/dist/css/hash.js +10 -0
  206. package/dist/css/parse.d.ts +42 -0
  207. package/dist/css/parse.js +138 -0
  208. package/dist/css/print.d.ts +9 -0
  209. package/dist/css/print.js +35 -0
  210. package/dist/css/selectors.d.ts +29 -0
  211. package/dist/css/selectors.js +168 -0
  212. package/dist/declarations.d.ts +3 -0
  213. package/dist/declarations.js +207 -0
  214. package/dist/decorator-copy.d.ts +18 -0
  215. package/dist/decorator-copy.js +158 -0
  216. package/dist/decorators.d.ts +61 -0
  217. package/dist/decorators.js +241 -0
  218. package/dist/diagnostics.d.ts +17 -0
  219. package/dist/diagnostics.js +22 -0
  220. package/dist/go-for.d.ts +26 -0
  221. package/dist/go-for.js +155 -0
  222. package/dist/goroutines.d.ts +37 -0
  223. package/dist/goroutines.js +253 -0
  224. package/dist/html-tag.d.ts +21 -0
  225. package/dist/html-tag.js +103 -0
  226. package/dist/index.d.ts +33 -0
  227. package/dist/index.js +55 -0
  228. package/dist/inline-packages.d.ts +32 -0
  229. package/dist/inline-packages.js +129 -0
  230. package/dist/iterators.d.ts +10 -0
  231. package/dist/iterators.js +33 -0
  232. package/dist/lexer/base.d.ts +24 -0
  233. package/dist/lexer/base.js +87 -0
  234. package/dist/lexer/lexer.d.ts +8 -0
  235. package/dist/lexer/lexer.js +134 -0
  236. package/dist/lexer/literals.d.ts +18 -0
  237. package/dist/lexer/literals.js +203 -0
  238. package/dist/lexer/markup.d.ts +10 -0
  239. package/dist/lexer/markup.js +93 -0
  240. package/dist/lexer/style.d.ts +17 -0
  241. package/dist/lexer/style.js +97 -0
  242. package/dist/lexer/tables.d.ts +53 -0
  243. package/dist/lexer/tables.js +101 -0
  244. package/dist/lexer/token.d.ts +42 -0
  245. package/dist/lexer/token.js +108 -0
  246. package/dist/loader.d.ts +1 -0
  247. package/dist/loader.js +50 -0
  248. package/dist/methods.d.ts +5 -0
  249. package/dist/methods.js +81 -0
  250. package/dist/modules.d.ts +3 -0
  251. package/dist/modules.js +49 -0
  252. package/dist/names.d.ts +23 -0
  253. package/dist/names.js +267 -0
  254. package/dist/parser/base.d.ts +96 -0
  255. package/dist/parser/base.js +202 -0
  256. package/dist/parser/classes.d.ts +8 -0
  257. package/dist/parser/classes.js +164 -0
  258. package/dist/parser/control-flow.d.ts +29 -0
  259. package/dist/parser/control-flow.js +232 -0
  260. package/dist/parser/declarations.d.ts +27 -0
  261. package/dist/parser/declarations.js +238 -0
  262. package/dist/parser/decorators.d.ts +30 -0
  263. package/dist/parser/decorators.js +176 -0
  264. package/dist/parser/expressions.d.ts +15 -0
  265. package/dist/parser/expressions.js +255 -0
  266. package/dist/parser/literals.d.ts +27 -0
  267. package/dist/parser/literals.js +206 -0
  268. package/dist/parser/markup.d.ts +22 -0
  269. package/dist/parser/markup.js +193 -0
  270. package/dist/parser/parser.d.ts +14 -0
  271. package/dist/parser/parser.js +22 -0
  272. package/dist/parser/simple-statements.d.ts +22 -0
  273. package/dist/parser/simple-statements.js +156 -0
  274. package/dist/parser/statements.d.ts +37 -0
  275. package/dist/parser/statements.js +267 -0
  276. package/dist/parser/syntax.d.ts +51 -0
  277. package/dist/parser/syntax.js +173 -0
  278. package/dist/parser/types.d.ts +23 -0
  279. package/dist/parser/types.js +218 -0
  280. package/dist/recursion.d.ts +25 -0
  281. package/dist/recursion.js +170 -0
  282. package/dist/refs.d.ts +49 -0
  283. package/dist/refs.js +210 -0
  284. package/dist/run.d.ts +1 -0
  285. package/dist/run.js +21 -0
  286. package/dist/source.d.ts +15 -0
  287. package/dist/source.js +34 -0
  288. package/dist/style-modules.d.ts +17 -0
  289. package/dist/style-modules.js +49 -0
  290. package/dist/styles.d.ts +36 -0
  291. package/dist/styles.js +160 -0
  292. package/dist/svg.d.ts +8 -0
  293. package/dist/svg.js +77 -0
  294. package/dist/ts-types.d.ts +11 -0
  295. package/dist/ts-types.js +133 -0
  296. package/dist/typed-arrays.d.ts +8 -0
  297. package/dist/typed-arrays.js +43 -0
  298. package/dist/typescript/convert-base.d.ts +42 -0
  299. package/dist/typescript/convert-base.js +135 -0
  300. package/dist/typescript/convert-objects.d.ts +28 -0
  301. package/dist/typescript/convert-objects.js +245 -0
  302. package/dist/typescript/convert.d.ts +14 -0
  303. package/dist/typescript/convert.js +67 -0
  304. package/dist/typescript/importer.d.ts +37 -0
  305. package/dist/typescript/importer.js +152 -0
  306. package/dist/typescript/library.d.ts +23 -0
  307. package/dist/typescript/library.js +81 -0
  308. package/dist/vite.d.ts +11 -0
  309. package/dist/vite.js +86 -0
  310. package/dist/walk-types.d.ts +4 -0
  311. package/dist/walk-types.js +56 -0
  312. package/dist/walk.d.ts +5 -0
  313. package/dist/walk.js +315 -0
  314. package/package.json +104 -4
@@ -0,0 +1,201 @@
1
+ import type { NodeBase, Parameter } from './declarations.ts';
2
+ import type { ElementExpression, TypeNode } from './markup.ts';
3
+ import type { BlockStatement } from './statements.ts';
4
+ export type Expression = Identifier | NumberLiteral | BigIntLiteral | StringLiteral | TemplateLiteral | BooleanLiteral | NullLiteral | ThisExpression | SuperExpression | ArrayLiteral | ObjectLiteral | FuncExpression | ArrowFunction | UnaryExpression | BinaryExpression | ConditionalExpression | CallExpression | NewExpression | MemberExpression | IndexExpression | ElementExpression | DecoratorMember | DecoratorGet | AsExpression | GoExpression | ChanExpression | ConversionExpression | MakeExpression;
5
+ /**
6
+ * `[]byte("rook")`: the UTF-8 bytes of a string. `string(data)`, the way back, is a call, since
7
+ * `string` may be the name of a value.
8
+ */
9
+ export interface ConversionExpression extends NodeBase {
10
+ kind: 'ConversionExpression';
11
+ type: TypeNode;
12
+ argument: Expression;
13
+ }
14
+ /**
15
+ * `make([]float64, n)`: a new typed array of `n` zeros; with `shared`, `make([]float64, n,
16
+ * shared)`, on a SharedArrayBuffer, which the workers of `go for` write into without copies.
17
+ */
18
+ export interface MakeExpression extends NodeBase {
19
+ kind: 'MakeExpression';
20
+ type: TypeNode;
21
+ length: Expression;
22
+ shared: boolean;
23
+ }
24
+ /** `chan<number>(10)`: a new channel with room for 10 values; `chan<number>()` has none. */
25
+ export interface ChanExpression extends NodeBase {
26
+ kind: 'ChanExpression';
27
+ element: TypeNode;
28
+ size: Expression | null;
29
+ }
30
+ /**
31
+ * `go work(x)`: calls a function of the module in a worker, with copies of the arguments. As an
32
+ * expression it is a Promise of what the function returns; as a statement nothing waits for it.
33
+ */
34
+ export interface GoExpression extends NodeBase {
35
+ kind: 'GoExpression';
36
+ call: CallExpression;
37
+ }
38
+ /**
39
+ * `value as Type`: the value seen as another type, as in TypeScript. The types must be related:
40
+ * one assignable to the other. Nothing is left of it in JS.
41
+ */
42
+ export interface AsExpression extends NodeBase {
43
+ kind: 'AsExpression';
44
+ expression: Expression;
45
+ type: TypeNode;
46
+ }
47
+ export interface Identifier extends NodeBase {
48
+ kind: 'Identifier';
49
+ name: string;
50
+ }
51
+ export interface NumberLiteral extends NodeBase {
52
+ kind: 'NumberLiteral';
53
+ value: number;
54
+ /** Source text, e.g. `0xff` or `1_000`, so code generation can keep it as written. */
55
+ raw: string;
56
+ }
57
+ /** `10n`: a bigint. Its value is in `raw` only, so that the tree stays plain data for JSON. */
58
+ export interface BigIntLiteral extends NodeBase {
59
+ kind: 'BigIntLiteral';
60
+ /** Source text with the `n`, e.g. `0xffn` or `1_000n`; JS writes it the same way. */
61
+ raw: string;
62
+ }
63
+ export interface StringLiteral extends NodeBase {
64
+ kind: 'StringLiteral';
65
+ /** Contents with escapes resolved. */
66
+ value: string;
67
+ /** Source text including quotes. */
68
+ raw: string;
69
+ }
70
+ /** `` `Hello, ${name}!` ``: `quasis` always has one element more than `expressions`. */
71
+ export interface TemplateLiteral extends NodeBase {
72
+ kind: 'TemplateLiteral';
73
+ quasis: TemplateElement[];
74
+ expressions: Expression[];
75
+ }
76
+ /** A text part of a template literal, without the backticks and `${` / `}` around it. */
77
+ export interface TemplateElement extends NodeBase {
78
+ kind: 'TemplateElement';
79
+ /** Contents with escapes resolved. */
80
+ value: string;
81
+ /** Contents as written in the source. */
82
+ raw: string;
83
+ }
84
+ export interface BooleanLiteral extends NodeBase {
85
+ kind: 'BooleanLiteral';
86
+ value: boolean;
87
+ }
88
+ export interface NullLiteral extends NodeBase {
89
+ kind: 'NullLiteral';
90
+ }
91
+ export interface ThisExpression extends NodeBase {
92
+ kind: 'ThisExpression';
93
+ }
94
+ /** `super` in `super(name)` and `super.greet()`. */
95
+ export interface SuperExpression extends NodeBase {
96
+ kind: 'SuperExpression';
97
+ }
98
+ /** `[1, 2, ...rest]` */
99
+ export interface ArrayLiteral extends NodeBase {
100
+ kind: 'ArrayLiteral';
101
+ elements: (Expression | SpreadElement)[];
102
+ }
103
+ /** `{ name: "Ann", age, ...defaults }` */
104
+ export interface ObjectLiteral extends NodeBase {
105
+ kind: 'ObjectLiteral';
106
+ properties: (Property | SpreadElement)[];
107
+ }
108
+ /** `name: value`, `"content-type": value`, or shorthand `name` (then `value` is an Identifier). */
109
+ export interface Property extends NodeBase {
110
+ kind: 'Property';
111
+ key: Identifier | StringLiteral;
112
+ value: Expression;
113
+ shorthand: boolean;
114
+ }
115
+ /** `...xs` in array literals, object literals and call arguments. */
116
+ export interface SpreadElement extends NodeBase {
117
+ kind: 'SpreadElement';
118
+ argument: Expression;
119
+ }
120
+ /** `func(x number) number { return x * x }` */
121
+ export interface FuncExpression extends NodeBase {
122
+ kind: 'FuncExpression';
123
+ /** `async func(...)`: its results are those of the Promise it returns. */
124
+ async?: true;
125
+ params: Parameter[];
126
+ results: TypeNode[];
127
+ body: BlockStatement;
128
+ }
129
+ /** `x => x * 2`, `(a, b number) => a + b`, `() => { ... }`. The result type is inferred. */
130
+ export interface ArrowFunction extends NodeBase {
131
+ kind: 'ArrowFunction';
132
+ /** `async x => ...`. */
133
+ async?: true;
134
+ params: Parameter[];
135
+ body: BlockStatement | Expression;
136
+ }
137
+ /**
138
+ * `await` and `<-ch`, the receive from a channel, are allowed only in async functions and at the
139
+ * top level of a module.
140
+ */
141
+ export type UnaryOperator = '!' | '-' | '+' | '~' | 'typeof' | 'await' | '<-';
142
+ export interface UnaryExpression extends NodeBase {
143
+ kind: 'UnaryExpression';
144
+ operator: UnaryOperator;
145
+ argument: Expression;
146
+ }
147
+ export type BinaryOperator = '+' | '-' | '*' | '/' | '%' | '**' | '==' | '!=' | '<' | '>' | '<=' | '>=' | '&&' | '||' | '??' | '&' | '|' | '^' | '<<' | '>>' | '>>>' | 'instanceof';
148
+ export interface BinaryExpression extends NodeBase {
149
+ kind: 'BinaryExpression';
150
+ operator: BinaryOperator;
151
+ left: Expression;
152
+ right: Expression;
153
+ }
154
+ /** `cond ? a : b` */
155
+ export interface ConditionalExpression extends NodeBase {
156
+ kind: 'ConditionalExpression';
157
+ test: Expression;
158
+ consequent: Expression;
159
+ alternate: Expression;
160
+ }
161
+ /** `f(x)`, or `f?.(x)` when `optional`. */
162
+ export interface CallExpression extends NodeBase {
163
+ kind: 'CallExpression';
164
+ callee: Expression;
165
+ arguments: (Expression | SpreadElement)[];
166
+ optional: boolean;
167
+ }
168
+ /** `new User("Ann", 30)` */
169
+ export interface NewExpression extends NodeBase {
170
+ kind: 'NewExpression';
171
+ callee: Expression;
172
+ arguments: (Expression | SpreadElement)[];
173
+ }
174
+ /** `a.b`, or `a?.b` when `optional`. The property may be a keyword, e.g. `xs.map`. */
175
+ export interface MemberExpression extends NodeBase {
176
+ kind: 'MemberExpression';
177
+ object: Expression;
178
+ property: Identifier;
179
+ optional: boolean;
180
+ }
181
+ /** `a[i]`, or `a?.[i]` when `optional`. */
182
+ export interface IndexExpression extends NodeBase {
183
+ kind: 'IndexExpression';
184
+ object: Expression;
185
+ index: Expression;
186
+ optional: boolean;
187
+ }
188
+ /**
189
+ * `@visible.shown`: a public member of a decorator applied to the component. The names belong to
190
+ * the decorator, not to any scope, so walkers do not visit them as identifiers.
191
+ */
192
+ export interface DecoratorMember extends NodeBase {
193
+ kind: 'DecoratorMember';
194
+ decorator: Identifier;
195
+ member: Identifier;
196
+ }
197
+ /** `get(@visible.shown)`: reads public state or a constant of a decorator. */
198
+ export interface DecoratorGet extends NodeBase {
199
+ kind: 'DecoratorGet';
200
+ target: DecoratorMember;
201
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,141 @@
1
+ import type { ClassMember, DecoratorUse, ImportSpecifier, NodeBase, Parameter, Program, TypeParameter } from './declarations.ts';
2
+ import type { BooleanLiteral, Expression, Identifier, NumberLiteral, Property, SpreadElement, StringLiteral, TemplateElement } from './expressions.ts';
3
+ import type { CatchClause, CssText, ForInStatement, ForStatement, IfStatement, SimpleStatement, Statement, SelectCase, SwitchCase, SwitchStatement } from './statements.ts';
4
+ /** `<a href="/">Link {name}</a>`: creates a DOM element. `tag` is `null` for a fragment `<>...</>`. */
5
+ export interface ElementExpression extends NodeBase {
6
+ kind: 'ElementExpression';
7
+ /** The tag name as written: `div`, `my-widget`, `section.content`. */
8
+ tag: Identifier | null;
9
+ /**
10
+ * A tag with a dot takes its component from a value: `section.content` in
11
+ * `<section.content />`. A capitalized tag, `<Page />`, does so when `Page` is a variable rather
12
+ * than a component; that depends on the scope, so this is `null` for it unless the code was
13
+ * copied from another module and the variable renamed.
14
+ */
15
+ value: Expression | null;
16
+ attributes: (JsxAttribute | JsxSpreadAttribute)[];
17
+ children: JsxChild[];
18
+ }
19
+ export type JsxChild = JsxText | JsxExpressionContainer | JsxStatementContainer | ElementExpression;
20
+ /** Text between tags, with whitespace already cleaned up as in JSX. */
21
+ export interface JsxText extends NodeBase {
22
+ kind: 'JsxText';
23
+ value: string;
24
+ }
25
+ /** `{expression}` among the children. Empty ones (`{/* comment *\/}`) are left out. */
26
+ export interface JsxExpressionContainer extends NodeBase {
27
+ kind: 'JsxExpressionContainer';
28
+ expression: Expression;
29
+ }
30
+ /**
31
+ * `{for todo in todos { <li>{todo.title}</li> }}`: control flow among the children. Its blocks
32
+ * hold markup statements: elements, nested if/for/switch and `const` declarations.
33
+ */
34
+ export interface JsxStatementContainer extends NodeBase {
35
+ kind: 'JsxStatementContainer';
36
+ statement: IfStatement | ForStatement | ForInStatement | SwitchStatement;
37
+ }
38
+ /** An element written as a statement inside markup control flow: it becomes content. */
39
+ export interface JsxElementStatement extends NodeBase {
40
+ kind: 'JsxElementStatement';
41
+ element: ElementExpression;
42
+ }
43
+ /**
44
+ * `href="/"`, `href={url}` or just `disabled` (then `value` is `null`). Attributes `on*` hold an
45
+ * EventHandler, unless they are given a function (a name, `obj.method` or a function literal).
46
+ */
47
+ export interface JsxAttribute extends NodeBase {
48
+ kind: 'JsxAttribute';
49
+ /** The attribute name as written: `class`, `data-id`, `onClick`. */
50
+ name: Identifier;
51
+ value: StringLiteral | Expression | EventHandler | null;
52
+ }
53
+ /** `{...attrs}` */
54
+ export interface JsxSpreadAttribute extends NodeBase {
55
+ kind: 'JsxSpreadAttribute';
56
+ argument: Expression;
57
+ }
58
+ /** `onClick={count++}`: statements that run when the event happens, with `event` available. */
59
+ export interface EventHandler extends NodeBase {
60
+ kind: 'EventHandler';
61
+ body: SimpleStatement[];
62
+ }
63
+ export type TypeNode = TypeReference | ArrayType | NullableType | FuncType | ComponentType | ObjectType | UnionType | LiteralType | ChanType;
64
+ /**
65
+ * `chan number`: a channel of numbers, made by `chan<number>(size)`; `chan<- number` only sends
66
+ * and `<-chan number` only receives.
67
+ */
68
+ export interface ChanType extends NodeBase {
69
+ kind: 'ChanType';
70
+ element: TypeNode;
71
+ direction: 'both' | 'send' | 'receive';
72
+ }
73
+ /** A named type: `number`, `User`, `Point`, `Box<number>`. */
74
+ export interface TypeReference extends NodeBase {
75
+ kind: 'TypeReference';
76
+ name: Identifier;
77
+ /** Type arguments of a generic type: `<number>` in `Box<number>`. */
78
+ typeArgs: TypeNode[];
79
+ }
80
+ /** `[]T` */
81
+ export interface ArrayType extends NodeBase {
82
+ kind: 'ArrayType';
83
+ element: TypeNode;
84
+ }
85
+ /** `?T` */
86
+ export interface NullableType extends NodeBase {
87
+ kind: 'NullableType';
88
+ type: TypeNode;
89
+ }
90
+ /** `func(number, number) bool` */
91
+ export interface FuncType extends NodeBase {
92
+ kind: 'FuncType';
93
+ params: TypeNode[];
94
+ results: TypeNode[];
95
+ /** `func(yield func(T) bool)`: its one parameter is named `yield`, so it is an iterator. */
96
+ iterator?: boolean;
97
+ }
98
+ /** `comp(title string, kind ?Kind)`: a component as a value, used as a tag: `<section.content />`. */
99
+ export interface ComponentType extends NodeBase {
100
+ kind: 'ComponentType';
101
+ params: Parameter[];
102
+ }
103
+ /** `string | number`; a member may be in parentheses: `[](string | number)`. */
104
+ export interface UnionType extends NodeBase {
105
+ kind: 'UnionType';
106
+ types: TypeNode[];
107
+ }
108
+ /** `"all"`, `42` or `true` as a type: the only value of the type. */
109
+ export interface LiteralType extends NodeBase {
110
+ kind: 'LiteralType';
111
+ value: StringLiteral | NumberLiteral | BooleanLiteral;
112
+ }
113
+ /** `{ x, y number }` — an anonymous object type. */
114
+ export interface ObjectType extends NodeBase {
115
+ kind: 'ObjectType';
116
+ members: TypeMember[];
117
+ }
118
+ /** Members of interfaces and object types. */
119
+ export type TypeMember = PropertySignature | MethodSignature | IndexSignature;
120
+ /** `[string]: Shape`: the type of the fields an object has besides the ones listed. */
121
+ export interface IndexSignature extends NodeBase {
122
+ kind: 'IndexSignature';
123
+ /** `string` or `number`. */
124
+ key: TypeNode;
125
+ type: TypeNode;
126
+ }
127
+ /** `label ?string`. A field with a nullable type may be omitted in object literals. */
128
+ export interface PropertySignature extends NodeBase {
129
+ kind: 'PropertySignature';
130
+ name: Identifier;
131
+ type: TypeNode;
132
+ }
133
+ /** `area() number` */
134
+ export interface MethodSignature extends NodeBase {
135
+ kind: 'MethodSignature';
136
+ name: Identifier;
137
+ params: Parameter[];
138
+ results: TypeNode[];
139
+ }
140
+ export type Node = Program | Statement | Expression | TypeNode | ImportSpecifier | Parameter | DecoratorUse | TypeParameter | ClassMember | TypeMember | SwitchCase | SelectCase | CatchClause | Property | SpreadElement | TemplateElement | CssText | JsxText | JsxExpressionContainer | JsxStatementContainer | JsxAttribute | JsxSpreadAttribute | EventHandler;
141
+ export type NodeKind = Node['kind'];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,173 @@
1
+ import type { ClassDeclaration, ComponentDeclaration, DecoratorDeclaration, FuncDeclaration, ImportDeclaration, InterfaceDeclaration, NodeBase, TypeAliasDeclaration, VariableDeclaration } from './declarations.ts';
2
+ import type { CallExpression, Expression, Identifier, UnaryExpression } from './expressions.ts';
3
+ import type { JsxElementStatement } from './markup.ts';
4
+ export type Statement = ImportDeclaration | FuncDeclaration | ComponentDeclaration | DecoratorDeclaration | VariableDeclaration | ClassDeclaration | InterfaceDeclaration | TypeAliasDeclaration | BlockStatement | ExpressionStatement | AssignmentStatement | IncDecStatement | ReturnStatement | IfStatement | ForStatement | ForInStatement | SwitchStatement | BreakStatement | ContinueStatement | ThrowStatement | TryStatement | DeferStatement | MountStatement | EffectStatement | StyleStatement | DeleteStatement | JsxElementStatement | SendStatement | SelectStatement;
5
+ /** Statements allowed in the `init` and `update` parts of a `for` header. */
6
+ export type SimpleStatement = VariableDeclaration | ExpressionStatement | AssignmentStatement | IncDecStatement | DeleteStatement | SendStatement;
7
+ /** `ch <- value`: waits until the channel takes the value, so only in async functions. */
8
+ export interface SendStatement extends NodeBase {
9
+ kind: 'SendStatement';
10
+ channel: Expression;
11
+ value: Expression;
12
+ }
13
+ export interface BlockStatement extends NodeBase {
14
+ kind: 'BlockStatement';
15
+ body: Statement[];
16
+ }
17
+ export interface ExpressionStatement extends NodeBase {
18
+ kind: 'ExpressionStatement';
19
+ expression: Expression;
20
+ }
21
+ export type AssignmentOperator = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '**=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '>>>=' | '&&=' | '||=' | '??=';
22
+ /**
23
+ * `x = 1`, `a, b = b, a`, `total += v`. Assignment is a statement, as in Go, so `f(a = 1)` and
24
+ * `a = b = c` are not valid. Compound operators take exactly one target.
25
+ */
26
+ export interface AssignmentStatement extends NodeBase {
27
+ kind: 'AssignmentStatement';
28
+ operator: AssignmentOperator;
29
+ /** Identifiers, member or index expressions. */
30
+ targets: Expression[];
31
+ /** One value per target, or a single call that returns several values. */
32
+ values: Expression[];
33
+ }
34
+ /** `i++` and `i--`, statements only (as in Go). */
35
+ export interface IncDecStatement extends NodeBase {
36
+ kind: 'IncDecStatement';
37
+ operator: '++' | '--';
38
+ target: Expression;
39
+ }
40
+ /** `return`, `return x`, `return q, null`. */
41
+ export interface ReturnStatement extends NodeBase {
42
+ kind: 'ReturnStatement';
43
+ values: Expression[];
44
+ }
45
+ export interface IfStatement extends NodeBase {
46
+ kind: 'IfStatement';
47
+ condition: Expression;
48
+ consequent: BlockStatement;
49
+ /** `else { ... }` or `else if ...`. */
50
+ alternate: BlockStatement | IfStatement | null;
51
+ }
52
+ /**
53
+ * Every `for` loop except `for ... in`:
54
+ *
55
+ * for let i = 0; i < n; i++ { } init, condition, update
56
+ * for cond { } condition only
57
+ * for { } nothing
58
+ */
59
+ export interface ForStatement extends NodeBase {
60
+ kind: 'ForStatement';
61
+ init: SimpleStatement | null;
62
+ condition: Expression | null;
63
+ update: SimpleStatement | null;
64
+ body: BlockStatement;
65
+ }
66
+ /**
67
+ * `for x in items { }` (key is `null`) and `for i, x in items { }`; with `go`, `go for i, x in
68
+ * items { }`, the parts of the array run as goroutines and the loop waits for them (go-for.ts).
69
+ */
70
+ export interface ForInStatement extends NodeBase {
71
+ kind: 'ForInStatement';
72
+ key: Identifier | null;
73
+ value: Identifier;
74
+ iterable: Expression;
75
+ body: BlockStatement;
76
+ go?: boolean;
77
+ }
78
+ /** `switch cmd { ... }`, or `switch { ... }` without a discriminant as an if/else chain. */
79
+ export interface SwitchStatement extends NodeBase {
80
+ kind: 'SwitchStatement';
81
+ discriminant: Expression | null;
82
+ cases: SwitchCase[];
83
+ }
84
+ /** `case "start", "run": ...`, or `default: ...` when `tests` is empty. */
85
+ export interface SwitchCase extends NodeBase {
86
+ kind: 'SwitchCase';
87
+ tests: Expression[];
88
+ body: Statement[];
89
+ }
90
+ /**
91
+ * `select { case v = <-ch: ... case out <- v: ... default: ... }`: waits until one of the
92
+ * operations on channels can go on, does it and runs its case; `default` runs when none can at
93
+ * once.
94
+ */
95
+ export interface SelectStatement extends NodeBase {
96
+ kind: 'SelectStatement';
97
+ cases: SelectCase[];
98
+ }
99
+ /** A case of `select`: a receive, `<-ch`, a send, `ch <- v`, or `default` when it is null. */
100
+ export interface SelectCase extends NodeBase {
101
+ kind: 'SelectCase';
102
+ /** `v` or `v, ok` in `case v, ok = <-ch:`: new variables of the case. */
103
+ names: Identifier[];
104
+ operation: UnaryExpression | SendStatement | null;
105
+ body: Statement[];
106
+ }
107
+ export interface BreakStatement extends NodeBase {
108
+ kind: 'BreakStatement';
109
+ }
110
+ export interface ContinueStatement extends NodeBase {
111
+ kind: 'ContinueStatement';
112
+ }
113
+ export interface ThrowStatement extends NodeBase {
114
+ kind: 'ThrowStatement';
115
+ argument: Expression;
116
+ }
117
+ export interface TryStatement extends NodeBase {
118
+ kind: 'TryStatement';
119
+ block: BlockStatement;
120
+ handler: CatchClause | null;
121
+ finalizer: BlockStatement | null;
122
+ }
123
+ /** `catch e { ... }`, or `catch { ... }` without a parameter. */
124
+ export interface CatchClause extends NodeBase {
125
+ kind: 'CatchClause';
126
+ param: Identifier | null;
127
+ body: BlockStatement;
128
+ }
129
+ /** `defer f.close()` or `defer { ... }`. */
130
+ export interface DeferStatement extends NodeBase {
131
+ kind: 'DeferStatement';
132
+ body: CallExpression | BlockStatement;
133
+ }
134
+ /**
135
+ * `mount() { ... }` at the top level of a component: runs once the component's markup is in the
136
+ * document. It may return a function, which runs when `{if}`, `{switch}` or `{for}` removes the
137
+ * markup.
138
+ */
139
+ export interface MountStatement extends NodeBase {
140
+ kind: 'MountStatement';
141
+ body: BlockStatement;
142
+ }
143
+ /**
144
+ * `effect { ... }` at the top level of a component: runs once the markup is created, and again
145
+ * whenever what it reads changes. Its `defer` runs before it runs again and when the component is
146
+ * removed.
147
+ */
148
+ export interface EffectStatement extends NodeBase {
149
+ kind: 'EffectStatement';
150
+ body: BlockStatement;
151
+ }
152
+ /**
153
+ * `style { .card { padding: 8px; color: {accent} } }` at the top level of a component or a
154
+ * decorator: CSS for its own markup. `parts` are the raw CSS text around the values from code,
155
+ * which appear only in the values of declarations.
156
+ */
157
+ export interface StyleStatement extends NodeBase {
158
+ kind: 'StyleStatement';
159
+ parts: (CssText | Expression)[];
160
+ }
161
+ /**
162
+ * `delete scores[name]`: removes a key of an object used as a map (`{ [string]: T }`), or a field
163
+ * of type `?T`.
164
+ */
165
+ export interface DeleteStatement extends NodeBase {
166
+ kind: 'DeleteStatement';
167
+ target: Expression;
168
+ }
169
+ /** Raw CSS text of a `style` block, as written. */
170
+ export interface CssText extends NodeBase {
171
+ kind: 'CssText';
172
+ value: string;
173
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/ast.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Syntax tree produced by the parser. Every node has a `kind` that discriminates the unions below
3
+ * and the `start`/`end` offsets of its source text.
4
+ *
5
+ * For example, `const q, err = divide(10, 2)` becomes:
6
+ *
7
+ * VariableDeclaration {
8
+ * keyword: 'const', names: [Identifier q, Identifier err], type: null,
9
+ * values: [CallExpression { callee: Identifier divide, arguments: [NumberLiteral 10, NumberLiteral 2] }],
10
+ * }
11
+ *
12
+ * Grouped names such as `a, b number` in parameters, fields and interface members are expanded into
13
+ * separate nodes that share the same type node.
14
+ */
15
+ export * from './ast/declarations.ts';
16
+ export * from './ast/statements.ts';
17
+ export * from './ast/expressions.ts';
18
+ export * from './ast/markup.ts';
package/dist/ast.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Syntax tree produced by the parser. Every node has a `kind` that discriminates the unions below
3
+ * and the `start`/`end` offsets of its source text.
4
+ *
5
+ * For example, `const q, err = divide(10, 2)` becomes:
6
+ *
7
+ * VariableDeclaration {
8
+ * keyword: 'const', names: [Identifier q, Identifier err], type: null,
9
+ * values: [CallExpression { callee: Identifier divide, arguments: [NumberLiteral 10, NumberLiteral 2] }],
10
+ * }
11
+ *
12
+ * Grouped names such as `a, b number` in parameters, fields and interface members are expanded into
13
+ * separate nodes that share the same type node.
14
+ */
15
+ export * from "./ast/declarations.js";
16
+ export * from "./ast/statements.js";
17
+ export * from "./ast/expressions.js";
18
+ export * from "./ast/markup.js";
@@ -0,0 +1,8 @@
1
+ import type * as ast from './ast.ts';
2
+ import { type MarkupBinding } from './refs.ts';
3
+ /** `...attrs` of a component, its last parameter, or null. */
4
+ export declare function attrsParam(component: ast.ComponentDeclaration): ast.Parameter | null;
5
+ /** Where a component spreads its `...attrs`, with whether that markup is created once. */
6
+ export declare function attrsSpreads(component: ast.ComponentDeclaration): MarkupBinding<ast.JsxSpreadAttribute>[];
7
+ /** The element that gets the attributes: the first one `{...attrs}` is spread on. */
8
+ export declare function attrsTarget(component: ast.ComponentDeclaration): ast.ElementExpression | null;
package/dist/attrs.js ADDED
@@ -0,0 +1,23 @@
1
+ import { isComponentUse, markupBindings } from "./refs.js";
2
+ // Attributes passed on: `comp Button(kind Kind, ...attrs)` takes the attributes of a use that are
3
+ // not its properties, and `<button {...attrs}>` puts them on one of its elements. The use is
4
+ // checked against that element, and its code sets them there, on whichever element the component
5
+ // creates. The checker and the generator share these questions about the syntax tree.
6
+ /** `...attrs` of a component, its last parameter, or null. */
7
+ export function attrsParam(component) {
8
+ return component.params.at(-1)?.rest ? component.params.at(-1) : null;
9
+ }
10
+ /** Where a component spreads its `...attrs`, with whether that markup is created once. */
11
+ export function attrsSpreads(component) {
12
+ const param = attrsParam(component);
13
+ if (!param)
14
+ return [];
15
+ return markupBindings(component.body, (attribute) => attribute.kind === 'JsxSpreadAttribute' &&
16
+ attribute.argument.kind === 'Identifier' &&
17
+ attribute.argument.name === param.name.name);
18
+ }
19
+ /** The element that gets the attributes: the first one `{...attrs}` is spread on. */
20
+ export function attrsTarget(component) {
21
+ const [spread] = attrsSpreads(component);
22
+ return spread && !isComponentUse(spread.element) && spread.element.tag ? spread.element : null;
23
+ }
@@ -0,0 +1,30 @@
1
+ import { type CompletionList } from './completion.ts';
2
+ export { tokenize } from './lexer/lexer.ts';
3
+ export { KEYWORDS } from './lexer/token.ts';
4
+ export type { Completion, CompletionList } from './completion.ts';
5
+ export interface BrowserDiagnostic {
6
+ message: string;
7
+ /** 1-based position of the start of the problem. */
8
+ line: number;
9
+ column: number;
10
+ /** 1-based position just after its end. */
11
+ endLine: number;
12
+ endColumn: number;
13
+ }
14
+ export interface BrowserCompileResult {
15
+ /** The generated ES module; empty when there are diagnostics. */
16
+ code: string;
17
+ diagnostics: BrowserDiagnostic[];
18
+ /** Problems that do not stop compilation. */
19
+ warnings: BrowserDiagnostic[];
20
+ /** The worker module of `go`, when the program has `go`. */
21
+ worker?: string;
22
+ }
23
+ export interface BrowserOptions {
24
+ /** Markup and components; off by default, as in a package without them. */
25
+ markup?: boolean;
26
+ }
27
+ /** Compiles a program; `workerUrl` is where its worker module of `go` will be, if not next to it. */
28
+ export declare function compile(source: string, workerUrl?: string | null, options?: BrowserOptions): BrowserCompileResult;
29
+ /** What can be written at `offset` of a program: names, properties, tags and attributes. */
30
+ export declare function complete(source: string, offset: number, options?: BrowserOptions): CompletionList;
@@ -0,0 +1,36 @@
1
+ import { compileModule } from "./compile.js";
2
+ import { completeModule } from "./completion.js";
3
+ import { SourceFile } from "./source.js";
4
+ // The compiler for the browser, used by the documentation site: everything but reading imported
5
+ // modules from disk, so imports are not type checked. Completion is the one of the language server.
6
+ // There is no package.json here: markup and components are on only with `{ markup: true }`.
7
+ export { tokenize } from "./lexer/lexer.js";
8
+ export { KEYWORDS } from "./lexer/token.js";
9
+ /** Compiles a program; `workerUrl` is where its worker module of `go` will be, if not next to it. */
10
+ export function compile(source, workerUrl, options = {}) {
11
+ const result = compileModule(source, {
12
+ rewriteImports: false,
13
+ workerUrl: workerUrl ?? undefined,
14
+ markup: options.markup ?? false,
15
+ });
16
+ const file = new SourceFile('', source);
17
+ const located = (diagnostic) => {
18
+ const end = file.position(diagnostic.end);
19
+ return {
20
+ message: diagnostic.message,
21
+ ...file.position(diagnostic.start),
22
+ endLine: end.line,
23
+ endColumn: end.column,
24
+ };
25
+ };
26
+ return {
27
+ code: result.code,
28
+ diagnostics: result.diagnostics.map(located),
29
+ warnings: result.warnings.map(located),
30
+ ...(result.worker === undefined ? {} : { worker: result.worker }),
31
+ };
32
+ }
33
+ /** What can be written at `offset` of a program: names, properties, tags and attributes. */
34
+ export function complete(source, offset, options = {}) {
35
+ return completeModule(source, offset, { markup: options.markup ?? false });
36
+ }