@gyral/core 0.2.0 → 0.3.1

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 (517) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/NOTICE +19 -0
  3. package/README.md +35 -8
  4. package/dist/call.d.ts +32 -0
  5. package/dist/call.js +63 -0
  6. package/dist/call.js.map +1 -0
  7. package/dist/children.d.ts +30 -5
  8. package/dist/children.js +26 -4
  9. package/dist/children.js.map +1 -1
  10. package/dist/cli/gyral-types.d.ts +2 -0
  11. package/dist/cli/gyral-types.js +23 -0
  12. package/dist/cli/gyral-types.js.map +1 -0
  13. package/dist/command.d.ts +54 -12
  14. package/dist/command.js +31 -11
  15. package/dist/command.js.map +1 -1
  16. package/dist/compiler/ast.d.ts +23 -0
  17. package/dist/compiler/ast.js +149 -0
  18. package/dist/compiler/ast.js.map +1 -0
  19. package/dist/compiler/compile.d.ts +41 -0
  20. package/dist/compiler/compile.js +148 -0
  21. package/dist/compiler/compile.js.map +1 -0
  22. package/dist/compiler/component-entries.d.ts +7 -0
  23. package/dist/compiler/component-entries.js +42 -0
  24. package/dist/compiler/component-entries.js.map +1 -0
  25. package/dist/compiler/components.d.ts +4 -0
  26. package/dist/compiler/components.js +182 -0
  27. package/dist/compiler/components.js.map +1 -0
  28. package/dist/compiler/facts.d.ts +31 -0
  29. package/dist/compiler/facts.js +285 -0
  30. package/dist/compiler/facts.js.map +1 -0
  31. package/dist/compiler/features.d.ts +34 -0
  32. package/dist/compiler/features.js +158 -0
  33. package/dist/compiler/features.js.map +1 -0
  34. package/dist/compiler/hooks.d.ts +22 -0
  35. package/dist/compiler/hooks.js +241 -0
  36. package/dist/compiler/hooks.js.map +1 -0
  37. package/dist/compiler/loader-source.d.ts +14 -0
  38. package/dist/compiler/loader-source.js +86 -0
  39. package/dist/compiler/loader-source.js.map +1 -0
  40. package/dist/compiler/locate.d.ts +14 -0
  41. package/dist/compiler/locate.js +78 -0
  42. package/dist/compiler/locate.js.map +1 -0
  43. package/dist/compiler/parse5-check.d.ts +21 -0
  44. package/dist/compiler/parse5-check.js +60 -0
  45. package/dist/compiler/parse5-check.js.map +1 -0
  46. package/dist/compiler/prop-schemas.d.ts +4 -0
  47. package/dist/compiler/prop-schemas.js +108 -0
  48. package/dist/compiler/prop-schemas.js.map +1 -0
  49. package/dist/compiler/scan.d.ts +41 -0
  50. package/dist/compiler/scan.js +160 -0
  51. package/dist/compiler/scan.js.map +1 -0
  52. package/dist/compiler/scope.d.ts +8 -0
  53. package/dist/compiler/scope.js +116 -0
  54. package/dist/compiler/scope.js.map +1 -0
  55. package/dist/compiler/source.d.ts +34 -0
  56. package/dist/compiler/source.js +114 -0
  57. package/dist/compiler/source.js.map +1 -0
  58. package/dist/compiler/tag-map.d.ts +41 -0
  59. package/dist/compiler/tag-map.js +126 -0
  60. package/dist/compiler/tag-map.js.map +1 -0
  61. package/dist/components-ready.d.ts +7 -0
  62. package/dist/components-ready.js +19 -0
  63. package/dist/components-ready.js.map +1 -0
  64. package/dist/define.d.ts +13 -4
  65. package/dist/define.js +35 -331
  66. package/dist/define.js.map +1 -1
  67. package/dist/devtools-events.d.ts +13 -0
  68. package/dist/devtools-events.js.map +1 -1
  69. package/dist/devtools-off.d.ts +2 -0
  70. package/dist/devtools-off.js +2 -0
  71. package/dist/devtools-off.js.map +1 -1
  72. package/dist/devtools.d.ts +4 -0
  73. package/dist/devtools.js +17 -2
  74. package/dist/devtools.js.map +1 -1
  75. package/dist/drivers-scope.d.ts +1 -1
  76. package/dist/drivers-scope.js +1 -8
  77. package/dist/drivers-scope.js.map +1 -1
  78. package/dist/element-internals.d.ts +1 -0
  79. package/dist/element-internals.js +11 -0
  80. package/dist/element-internals.js.map +1 -0
  81. package/dist/element-types.d.ts +11 -5
  82. package/dist/element-types.js.map +1 -1
  83. package/dist/element.d.ts +3 -0
  84. package/dist/element.js +322 -0
  85. package/dist/element.js.map +1 -0
  86. package/dist/error-view.d.ts +10 -0
  87. package/dist/error-view.js +30 -0
  88. package/dist/error-view.js.map +1 -0
  89. package/dist/errors.d.ts +21 -0
  90. package/dist/errors.js +47 -0
  91. package/dist/errors.js.map +1 -0
  92. package/dist/errors.json +289 -0
  93. package/dist/eslint/imports.d.ts +26 -0
  94. package/dist/eslint/imports.js +78 -0
  95. package/dist/eslint/imports.js.map +1 -0
  96. package/dist/eslint/index.d.ts +16 -0
  97. package/dist/eslint/index.js +23 -0
  98. package/dist/eslint/index.js.map +1 -0
  99. package/dist/eslint/locate.d.ts +33 -0
  100. package/dist/eslint/locate.js +132 -0
  101. package/dist/eslint/locate.js.map +1 -0
  102. package/dist/eslint/row-purity-rule.d.ts +2 -0
  103. package/dist/eslint/row-purity-rule.js +103 -0
  104. package/dist/eslint/row-purity-rule.js.map +1 -0
  105. package/dist/eslint/template-rule.d.ts +6 -0
  106. package/dist/eslint/template-rule.js +76 -0
  107. package/dist/eslint/template-rule.js.map +1 -0
  108. package/dist/eslint/unused-intent-rule.d.ts +2 -0
  109. package/dist/eslint/unused-intent-rule.js +186 -0
  110. package/dist/eslint/unused-intent-rule.js.map +1 -0
  111. package/dist/features.d.ts +39 -0
  112. package/dist/features.js +2 -0
  113. package/dist/features.js.map +1 -0
  114. package/dist/focus.d.ts +13 -12
  115. package/dist/focus.js +44 -11
  116. package/dist/focus.js.map +1 -1
  117. package/dist/form-associated.d.ts +46 -0
  118. package/dist/form-associated.js +77 -0
  119. package/dist/form-associated.js.map +1 -0
  120. package/dist/forms.d.ts +42 -30
  121. package/dist/forms.js +85 -41
  122. package/dist/forms.js.map +1 -1
  123. package/dist/frame-lane.d.ts +11 -0
  124. package/dist/frame-lane.js +28 -0
  125. package/dist/frame-lane.js.map +1 -0
  126. package/dist/head.d.ts +61 -0
  127. package/dist/head.js +85 -0
  128. package/dist/head.js.map +1 -0
  129. package/dist/hooks/invalid.d.ts +14 -0
  130. package/dist/hooks/invalid.js +72 -0
  131. package/dist/hooks/invalid.js.map +1 -0
  132. package/dist/host-model.d.ts +77 -0
  133. package/dist/host-model.js +278 -0
  134. package/dist/host-model.js.map +1 -0
  135. package/dist/hydration-client.d.ts +9 -0
  136. package/dist/hydration-client.js +35 -0
  137. package/dist/hydration-client.js.map +1 -0
  138. package/dist/hydration-loader.d.ts +13 -0
  139. package/dist/hydration-loader.js +58 -0
  140. package/dist/hydration-loader.js.map +1 -0
  141. package/dist/hydration-off.d.ts +8 -0
  142. package/dist/hydration-off.js +25 -0
  143. package/dist/hydration-off.js.map +1 -0
  144. package/dist/hydration.d.ts +3 -21
  145. package/dist/hydration.js +14 -63
  146. package/dist/hydration.js.map +1 -1
  147. package/dist/index.d.ts +24 -36
  148. package/dist/index.js +14 -32
  149. package/dist/index.js.map +1 -1
  150. package/dist/indexeddb-types.d.ts +97 -0
  151. package/dist/indexeddb-types.js +2 -0
  152. package/dist/indexeddb-types.js.map +1 -0
  153. package/dist/indexeddb.d.ts +5 -0
  154. package/dist/indexeddb.js +118 -0
  155. package/dist/indexeddb.js.map +1 -0
  156. package/dist/intent.d.ts +62 -17
  157. package/dist/intent.js +193 -100
  158. package/dist/intent.js.map +1 -1
  159. package/dist/internal/indexeddb-open.d.ts +8 -0
  160. package/dist/internal/indexeddb-open.js +96 -0
  161. package/dist/internal/indexeddb-open.js.map +1 -0
  162. package/dist/internal/indexeddb-transaction.d.ts +4 -0
  163. package/dist/internal/indexeddb-transaction.js +134 -0
  164. package/dist/internal/indexeddb-transaction.js.map +1 -0
  165. package/dist/internal/interpreter.d.ts +15 -1
  166. package/dist/internal/interpreter.js +42 -47
  167. package/dist/internal/interpreter.js.map +1 -1
  168. package/dist/internal/token.d.ts +1 -0
  169. package/dist/internal/token.js +7 -0
  170. package/dist/internal/token.js.map +1 -0
  171. package/dist/internal.d.ts +20 -0
  172. package/dist/internal.js +22 -0
  173. package/dist/internal.js.map +1 -0
  174. package/dist/invoker-fallback-used.d.ts +4 -0
  175. package/dist/invoker-fallback-used.js +10 -0
  176. package/dist/invoker-fallback-used.js.map +1 -0
  177. package/dist/invoker-fallback.d.ts +4 -0
  178. package/dist/invoker-fallback.js +15 -0
  179. package/dist/invoker-fallback.js.map +1 -0
  180. package/dist/invokers-shim.d.ts +6 -0
  181. package/dist/invokers-shim.js +32 -0
  182. package/dist/invokers-shim.js.map +1 -0
  183. package/dist/invokers.d.ts +3 -5
  184. package/dist/invokers.js +11 -51
  185. package/dist/invokers.js.map +1 -1
  186. package/dist/islands.d.ts +0 -2
  187. package/dist/islands.js +4 -11
  188. package/dist/islands.js.map +1 -1
  189. package/dist/light-dom.d.ts +4 -53
  190. package/dist/light-dom.js +5 -100
  191. package/dist/light-dom.js.map +1 -1
  192. package/dist/prop.d.ts +89 -0
  193. package/dist/prop.js +41 -0
  194. package/dist/prop.js.map +1 -0
  195. package/dist/props.d.ts +57 -21
  196. package/dist/props.js +157 -34
  197. package/dist/props.js.map +1 -1
  198. package/dist/retry.d.ts +15 -0
  199. package/dist/retry.js +48 -0
  200. package/dist/retry.js.map +1 -0
  201. package/dist/scheduler.d.ts +43 -0
  202. package/dist/scheduler.js +212 -0
  203. package/dist/scheduler.js.map +1 -0
  204. package/dist/script-json.d.ts +2 -0
  205. package/dist/script-json.js +13 -0
  206. package/dist/script-json.js.map +1 -0
  207. package/dist/server-component.d.ts +10 -0
  208. package/dist/server-component.js +133 -0
  209. package/dist/server-component.js.map +1 -0
  210. package/dist/server-specs.d.ts +6 -0
  211. package/dist/server-specs.js +13 -0
  212. package/dist/server-specs.js.map +1 -0
  213. package/dist/server.d.ts +34 -0
  214. package/dist/server.js +59 -0
  215. package/dist/server.js.map +1 -0
  216. package/dist/settled.d.ts +11 -0
  217. package/dist/settled.js +62 -0
  218. package/dist/settled.js.map +1 -0
  219. package/dist/spec-features-used.d.ts +21 -0
  220. package/dist/spec-features-used.js +50 -0
  221. package/dist/spec-features-used.js.map +1 -0
  222. package/dist/spec-features.d.ts +28 -0
  223. package/dist/spec-features.js +42 -0
  224. package/dist/spec-features.js.map +1 -0
  225. package/dist/states.d.ts +3 -5
  226. package/dist/states.js +22 -11
  227. package/dist/states.js.map +1 -1
  228. package/dist/storage.d.ts +69 -0
  229. package/dist/storage.js +158 -0
  230. package/dist/storage.js.map +1 -0
  231. package/dist/store-binding.d.ts +6 -3
  232. package/dist/store-binding.js +7 -8
  233. package/dist/store-binding.js.map +1 -1
  234. package/dist/store-scope.d.ts +8 -11
  235. package/dist/store-scope.js +15 -40
  236. package/dist/store-scope.js.map +1 -1
  237. package/dist/store.d.ts +3 -0
  238. package/dist/store.js +45 -10
  239. package/dist/store.js.map +1 -1
  240. package/dist/stores-provider.d.ts +2 -6
  241. package/dist/stores-provider.js +21 -55
  242. package/dist/stores-provider.js.map +1 -1
  243. package/dist/subscription.d.ts +35 -0
  244. package/dist/subscription.js +74 -0
  245. package/dist/subscription.js.map +1 -0
  246. package/dist/subscriptions.d.ts +26 -0
  247. package/dist/subscriptions.js +98 -0
  248. package/dist/subscriptions.js.map +1 -0
  249. package/dist/transitions.d.ts +5 -7
  250. package/dist/transitions.js +17 -20
  251. package/dist/transitions.js.map +1 -1
  252. package/dist/types.d.ts +142 -49
  253. package/dist/types.js.map +1 -1
  254. package/dist/use-dialogs.d.ts +2 -0
  255. package/dist/use-dialogs.js +9 -0
  256. package/dist/use-dialogs.js.map +1 -0
  257. package/dist/use-disposal.d.ts +2 -0
  258. package/dist/use-disposal.js +9 -0
  259. package/dist/use-disposal.js.map +1 -0
  260. package/dist/use-error-view.d.ts +2 -0
  261. package/dist/use-error-view.js +9 -0
  262. package/dist/use-error-view.js.map +1 -0
  263. package/dist/use-errored.d.ts +2 -0
  264. package/dist/use-errored.js +9 -0
  265. package/dist/use-errored.js.map +1 -0
  266. package/dist/use-form-associated.d.ts +2 -0
  267. package/dist/use-form-associated.js +7 -0
  268. package/dist/use-form-associated.js.map +1 -0
  269. package/dist/use-frame-lane.d.ts +2 -0
  270. package/dist/use-frame-lane.js +10 -0
  271. package/dist/use-frame-lane.js.map +1 -0
  272. package/dist/use-invokers.d.ts +2 -0
  273. package/dist/use-invokers.js +10 -0
  274. package/dist/use-invokers.js.map +1 -0
  275. package/dist/use-states.d.ts +2 -0
  276. package/dist/use-states.js +10 -0
  277. package/dist/use-states.js.map +1 -0
  278. package/dist/use-subscriptions.d.ts +2 -0
  279. package/dist/use-subscriptions.js +10 -0
  280. package/dist/use-subscriptions.js.map +1 -0
  281. package/dist/use-transitions.d.ts +2 -0
  282. package/dist/use-transitions.js +10 -0
  283. package/dist/use-transitions.js.map +1 -0
  284. package/dist/view/attributes.d.ts +11 -0
  285. package/dist/view/attributes.js +15 -0
  286. package/dist/view/attributes.js.map +1 -0
  287. package/dist/view/compiled.d.ts +1 -0
  288. package/dist/view/compiled.js +6 -0
  289. package/dist/view/compiled.js.map +1 -0
  290. package/dist/view/dev-off.d.ts +1 -0
  291. package/dist/view/dev-off.js +4 -0
  292. package/dist/view/dev-off.js.map +1 -0
  293. package/dist/view/dev.d.ts +1 -0
  294. package/dist/view/dev.js +5 -0
  295. package/dist/view/dev.js.map +1 -0
  296. package/dist/view/flags.d.ts +1 -0
  297. package/dist/view/flags.js +4 -0
  298. package/dist/view/flags.js.map +1 -0
  299. package/dist/view/index.d.ts +26 -0
  300. package/dist/view/index.js +27 -0
  301. package/dist/view/index.js.map +1 -0
  302. package/dist/view/loc.d.ts +9 -0
  303. package/dist/view/loc.js +50 -0
  304. package/dist/view/loc.js.map +1 -0
  305. package/dist/view/message.d.ts +17 -0
  306. package/dist/view/message.js +40 -0
  307. package/dist/view/message.js.map +1 -0
  308. package/dist/view/messages.d.ts +43 -0
  309. package/dist/view/messages.js +84 -0
  310. package/dist/view/messages.js.map +1 -0
  311. package/dist/view/normalize/check.d.ts +23 -0
  312. package/dist/view/normalize/check.js +81 -0
  313. package/dist/view/normalize/check.js.map +1 -0
  314. package/dist/view/normalize/emit.d.ts +15 -0
  315. package/dist/view/normalize/emit.js +165 -0
  316. package/dist/view/normalize/emit.js.map +1 -0
  317. package/dist/view/normalize/entities.d.ts +4 -0
  318. package/dist/view/normalize/entities.js +38 -0
  319. package/dist/view/normalize/entities.js.map +1 -0
  320. package/dist/view/normalize/errors.d.ts +9 -0
  321. package/dist/view/normalize/errors.js +19 -0
  322. package/dist/view/normalize/errors.js.map +1 -0
  323. package/dist/view/normalize/id.d.ts +10 -0
  324. package/dist/view/normalize/id.js +55 -0
  325. package/dist/view/normalize/id.js.map +1 -0
  326. package/dist/view/normalize/normalize.d.ts +18 -0
  327. package/dist/view/normalize/normalize.js +42 -0
  328. package/dist/view/normalize/normalize.js.map +1 -0
  329. package/dist/view/normalize/repairs.d.ts +24 -0
  330. package/dist/view/normalize/repairs.js +166 -0
  331. package/dist/view/normalize/repairs.js.map +1 -0
  332. package/dist/view/normalize/rules.d.ts +39 -0
  333. package/dist/view/normalize/rules.js +120 -0
  334. package/dist/view/normalize/rules.js.map +1 -0
  335. package/dist/view/normalize/shape.d.ts +5 -0
  336. package/dist/view/normalize/shape.js +38 -0
  337. package/dist/view/normalize/shape.js.map +1 -0
  338. package/dist/view/normalize/source.d.ts +13 -0
  339. package/dist/view/normalize/source.js +34 -0
  340. package/dist/view/normalize/source.js.map +1 -0
  341. package/dist/view/normalize/svg.d.ts +14 -0
  342. package/dist/view/normalize/svg.js +40 -0
  343. package/dist/view/normalize/svg.js.map +1 -0
  344. package/dist/view/normalize/tag-states.d.ts +23 -0
  345. package/dist/view/normalize/tag-states.js +192 -0
  346. package/dist/view/normalize/tag-states.js.map +1 -0
  347. package/dist/view/normalize/tokenizer.d.ts +5 -0
  348. package/dist/view/normalize/tokenizer.js +233 -0
  349. package/dist/view/normalize/tokenizer.js.map +1 -0
  350. package/dist/view/normalize/tokens.d.ts +55 -0
  351. package/dist/view/normalize/tokens.js +24 -0
  352. package/dist/view/normalize/tokens.js.map +1 -0
  353. package/dist/view/normalize/tree.d.ts +65 -0
  354. package/dist/view/normalize/tree.js +235 -0
  355. package/dist/view/normalize/tree.js.map +1 -0
  356. package/dist/view/normalize/types.d.ts +146 -0
  357. package/dist/view/normalize/types.js +29 -0
  358. package/dist/view/normalize/types.js.map +1 -0
  359. package/dist/view/normalize/whitespace.d.ts +2 -0
  360. package/dist/{template-whitespace.js → view/normalize/whitespace.js} +27 -36
  361. package/dist/view/normalize/whitespace.js.map +1 -0
  362. package/dist/view/prepare-stub.d.ts +3 -0
  363. package/dist/view/prepare-stub.js +7 -0
  364. package/dist/view/prepare-stub.js.map +1 -0
  365. package/dist/view/prepare.d.ts +11 -0
  366. package/dist/view/prepare.js +63 -0
  367. package/dist/view/prepare.js.map +1 -0
  368. package/dist/view/registry.d.ts +78 -0
  369. package/dist/view/registry.js +27 -0
  370. package/dist/view/registry.js.map +1 -0
  371. package/dist/view/render/adopt-attr.d.ts +14 -0
  372. package/dist/view/render/adopt-attr.js +83 -0
  373. package/dist/view/render/adopt-attr.js.map +1 -0
  374. package/dist/view/render/adopt-plan.d.ts +10 -0
  375. package/dist/view/render/adopt-plan.js +26 -0
  376. package/dist/view/render/adopt-plan.js.map +1 -0
  377. package/dist/view/render/adopt.d.ts +3 -0
  378. package/dist/view/render/adopt.js +286 -0
  379. package/dist/view/render/adopt.js.map +1 -0
  380. package/dist/view/render/attr-parts.d.ts +72 -0
  381. package/dist/view/render/attr-parts.js +262 -0
  382. package/dist/view/render/attr-parts.js.map +1 -0
  383. package/dist/view/render/child-part.d.ts +51 -0
  384. package/dist/view/render/child-part.js +173 -0
  385. package/dist/view/render/child-part.js.map +1 -0
  386. package/dist/view/render/dev-check.d.ts +12 -0
  387. package/dist/view/render/dev-check.js +122 -0
  388. package/dist/view/render/dev-check.js.map +1 -0
  389. package/dist/view/render/dispose.d.ts +3 -0
  390. package/dist/view/render/dispose.js +76 -0
  391. package/dist/view/render/dispose.js.map +1 -0
  392. package/dist/view/render/hook-part.d.ts +5 -0
  393. package/dist/view/render/hook-part.js +36 -0
  394. package/dist/view/render/hook-part.js.map +1 -0
  395. package/dist/view/render/hook-run.d.ts +2 -0
  396. package/dist/view/render/hook-run.js +72 -0
  397. package/dist/view/render/hook-run.js.map +1 -0
  398. package/dist/view/render/hooks.d.ts +108 -0
  399. package/dist/view/render/hooks.js +108 -0
  400. package/dist/view/render/hooks.js.map +1 -0
  401. package/dist/view/render/hydrate.d.ts +10 -0
  402. package/dist/view/render/hydrate.js +33 -0
  403. package/dist/view/render/hydrate.js.map +1 -0
  404. package/dist/view/render/instance.d.ts +33 -0
  405. package/dist/view/render/instance.js +107 -0
  406. package/dist/view/render/instance.js.map +1 -0
  407. package/dist/view/render/keyed.d.ts +6 -0
  408. package/dist/view/render/keyed.js +15 -0
  409. package/dist/view/render/keyed.js.map +1 -0
  410. package/dist/view/render/list.d.ts +20 -0
  411. package/dist/view/render/list.js +156 -0
  412. package/dist/view/render/list.js.map +1 -0
  413. package/dist/view/render/mismatch.d.ts +10 -0
  414. package/dist/view/render/mismatch.js +55 -0
  415. package/dist/view/render/mismatch.js.map +1 -0
  416. package/dist/view/render/modal.d.ts +3 -0
  417. package/dist/view/render/modal.js +39 -0
  418. package/dist/view/render/modal.js.map +1 -0
  419. package/dist/view/render/nodes.d.ts +10 -0
  420. package/dist/view/render/nodes.js +37 -0
  421. package/dist/view/render/nodes.js.map +1 -0
  422. package/dist/view/render/place.d.ts +18 -0
  423. package/dist/view/render/place.js +69 -0
  424. package/dist/view/render/place.js.map +1 -0
  425. package/dist/view/render/plan.d.ts +26 -0
  426. package/dist/view/render/plan.js +124 -0
  427. package/dist/view/render/plan.js.map +1 -0
  428. package/dist/view/render/raw.d.ts +21 -0
  429. package/dist/view/render/raw.js +72 -0
  430. package/dist/view/render/raw.js.map +1 -0
  431. package/dist/view/render/render.d.ts +15 -0
  432. package/dist/view/render/render.js +65 -0
  433. package/dist/view/render/render.js.map +1 -0
  434. package/dist/view/render/reorder.d.ts +4 -0
  435. package/dist/view/render/reorder.js +101 -0
  436. package/dist/view/render/reorder.js.map +1 -0
  437. package/dist/view/render/rows.d.ts +23 -0
  438. package/dist/view/render/rows.js +95 -0
  439. package/dist/view/render/rows.js.map +1 -0
  440. package/dist/view/render/seen.d.ts +11 -0
  441. package/dist/view/render/seen.js +17 -0
  442. package/dist/view/render/seen.js.map +1 -0
  443. package/dist/view/render/toggles.d.ts +6 -0
  444. package/dist/view/render/toggles.js +6 -0
  445. package/dist/view/render/toggles.js.map +1 -0
  446. package/dist/view/render/values.d.ts +29 -0
  447. package/dist/view/render/values.js +13 -0
  448. package/dist/view/render/values.js.map +1 -0
  449. package/dist/view/render/warn.d.ts +28 -0
  450. package/dist/view/render/warn.js +114 -0
  451. package/dist/view/render/warn.js.map +1 -0
  452. package/dist/view/server/component.d.ts +12 -0
  453. package/dist/view/server/component.js +64 -0
  454. package/dist/view/server/component.js.map +1 -0
  455. package/dist/view/server/escape.d.ts +10 -0
  456. package/dist/view/server/escape.js +34 -0
  457. package/dist/view/server/escape.js.map +1 -0
  458. package/dist/view/server/index.d.ts +48 -0
  459. package/dist/view/server/index.js +80 -0
  460. package/dist/view/server/index.js.map +1 -0
  461. package/dist/view/server/sha256.d.ts +2 -0
  462. package/dist/view/server/sha256.js +75 -0
  463. package/dist/view/server/sha256.js.map +1 -0
  464. package/dist/view/server/tags.d.ts +68 -0
  465. package/dist/view/server/tags.js +132 -0
  466. package/dist/view/server/tags.js.map +1 -0
  467. package/dist/view/server/values.d.ts +18 -0
  468. package/dist/view/server/values.js +94 -0
  469. package/dist/view/server/values.js.map +1 -0
  470. package/dist/view/server/writer.d.ts +21 -0
  471. package/dist/view/server/writer.js +170 -0
  472. package/dist/view/server/writer.js.map +1 -0
  473. package/dist/view/styles.d.ts +25 -0
  474. package/dist/view/styles.js +58 -0
  475. package/dist/view/styles.js.map +1 -0
  476. package/dist/view/template-element.d.ts +10 -0
  477. package/dist/view/template-element.js +45 -0
  478. package/dist/view/template-element.js.map +1 -0
  479. package/dist/view/template.d.ts +29 -0
  480. package/dist/view/template.js +84 -0
  481. package/dist/view/template.js.map +1 -0
  482. package/dist/view/trusted-html.d.ts +6 -0
  483. package/dist/view/trusted-html.js +34 -0
  484. package/dist/view/trusted-html.js.map +1 -0
  485. package/dist/vite.d.ts +57 -11
  486. package/dist/vite.js +319 -27
  487. package/dist/vite.js.map +1 -1
  488. package/package.json +70 -4
  489. package/dist/accessible-name.d.ts +0 -19
  490. package/dist/accessible-name.js +0 -56
  491. package/dist/accessible-name.js.map +0 -1
  492. package/dist/element-directive.d.ts +0 -20
  493. package/dist/element-directive.js +0 -31
  494. package/dist/element-directive.js.map +0 -1
  495. package/dist/invalid.d.ts +0 -21
  496. package/dist/invalid.js +0 -70
  497. package/dist/invalid.js.map +0 -1
  498. package/dist/lit-html-check.d.ts +0 -6
  499. package/dist/lit-html-check.js +0 -48
  500. package/dist/lit-html-check.js.map +0 -1
  501. package/dist/live-boolean.d.ts +0 -22
  502. package/dist/live-boolean.js +0 -34
  503. package/dist/live-boolean.js.map +0 -1
  504. package/dist/random.d.ts +0 -13
  505. package/dist/random.js +0 -19
  506. package/dist/random.js.map +0 -1
  507. package/dist/styles.d.ts +0 -12
  508. package/dist/styles.js +0 -11
  509. package/dist/styles.js.map +0 -1
  510. package/dist/template-whitespace.d.ts +0 -7
  511. package/dist/template-whitespace.js.map +0 -1
  512. package/dist/templates.d.ts +0 -5
  513. package/dist/templates.js +0 -15
  514. package/dist/templates.js.map +0 -1
  515. package/dist/textarea.d.ts +0 -26
  516. package/dist/textarea.js +0 -85
  517. package/dist/textarea.js.map +0 -1
@@ -0,0 +1,289 @@
1
+ [
2
+ {
3
+ "code": "G0001",
4
+ "group": "Components",
5
+ "message": "<{tag}> is a browser element (render it on the server with @gyral/ssr).",
6
+ "arguments": ["tag"],
7
+ "url": "https://gyral.dev/errors/#G0001"
8
+ },
9
+ {
10
+ "code": "G0010",
11
+ "group": "Components",
12
+ "message": "<{tag}> has no update for message \"{message}\".",
13
+ "arguments": ["tag", "message"],
14
+ "url": "https://gyral.dev/errors/#G0010"
15
+ },
16
+ {
17
+ "code": "G0011",
18
+ "group": "Components",
19
+ "message": "<{tag}> has no intent parser for data-intent=\"{intent}\".",
20
+ "arguments": ["tag", "intent"],
21
+ "url": "https://gyral.dev/errors/#G0011"
22
+ },
23
+ {
24
+ "code": "G0012",
25
+ "group": "Components",
26
+ "message": "<{tag}> intent parser for \"{intent}\" failed",
27
+ "arguments": ["tag", "intent"],
28
+ "url": "https://gyral.dev/errors/#G0012"
29
+ },
30
+ {
31
+ "code": "G0013",
32
+ "group": "Components",
33
+ "message": "<{tag}> focus(\"{selector}\") matched no focusable element.",
34
+ "arguments": ["tag", "selector"],
35
+ "url": "https://gyral.dev/errors/#G0013"
36
+ },
37
+ {
38
+ "code": "G0020",
39
+ "group": "Props",
40
+ "message": "<{tag}> prop \"{prop}\" has an asynchronous schema; it must be synchronous.",
41
+ "arguments": ["tag", "prop"],
42
+ "url": "https://gyral.dev/errors/#G0020"
43
+ },
44
+ {
45
+ "code": "G0021",
46
+ "group": "Props",
47
+ "message": "<{tag}> prop \"{prop}\" got an invalid value from {source}, so it is treated as missing: {issues}",
48
+ "arguments": ["tag", "prop", "source", "issues"],
49
+ "url": "https://gyral.dev/errors/#G0021"
50
+ },
51
+ {
52
+ "code": "G0022",
53
+ "group": "Props",
54
+ "message": "<{tag}> is missing required prop(s): {props}.",
55
+ "arguments": ["tag", "props"],
56
+ "url": "https://gyral.dev/errors/#G0022"
57
+ },
58
+ {
59
+ "code": "G0023",
60
+ "group": "Props",
61
+ "message": "<{tag}> declares prop(s) that shadow built-in element properties: {props}. Setting them changes platform behaviour (a prop named \"hidden\" hides the element). Rename them (view/05-element.md).",
62
+ "arguments": ["tag", "props"],
63
+ "url": "https://gyral.dev/errors/#G0023"
64
+ },
65
+ {
66
+ "code": "G0030",
67
+ "group": "Scheduling",
68
+ "message": "gyral: a deferred callback failed",
69
+ "arguments": [],
70
+ "url": "https://gyral.dev/errors/#G0030"
71
+ },
72
+ {
73
+ "code": "G0031",
74
+ "group": "Scheduling",
75
+ "message": "<{tag}> view failed; it shows its error view, or its previous DOM stays.",
76
+ "arguments": ["tag"],
77
+ "url": "https://gyral.dev/errors/#G0031"
78
+ },
79
+ {
80
+ "code": "G0032",
81
+ "group": "Scheduling",
82
+ "message": "gyral: post-render work failed",
83
+ "arguments": [],
84
+ "url": "https://gyral.dev/errors/#G0032"
85
+ },
86
+ {
87
+ "code": "G0033",
88
+ "group": "Scheduling",
89
+ "message": "gyral: rendering did not settle in one flush (a cycle between {tags}). Components are probably feeding each other props or messages; break the cycle with a condition in update (docs/design-docs/view/04-scheduler.md \"Loop guard\").",
90
+ "arguments": ["tags"],
91
+ "url": "https://gyral.dev/errors/#G0033"
92
+ },
93
+ {
94
+ "code": "G0034",
95
+ "group": "Scheduling",
96
+ "message": "settled(): the page did not settle after {rounds} flushes or busy turns. A stream is emitting without pause, or components (or drivers) are feeding each other messages in a cycle.",
97
+ "arguments": ["rounds"],
98
+ "url": "https://gyral.dev/errors/#G0034"
99
+ },
100
+ {
101
+ "code": "G0040",
102
+ "group": "Commands",
103
+ "message": "{owner}: the onSuccess or onFailure mapper for driver \"{driver}\" threw; no message was sent.",
104
+ "arguments": ["owner", "driver"],
105
+ "url": "https://gyral.dev/errors/#G0040"
106
+ },
107
+ {
108
+ "code": "G0041",
109
+ "group": "Commands",
110
+ "message": "{owner}: driver \"{driver}\" failed and the command has no onFailure.",
111
+ "arguments": ["owner", "driver"],
112
+ "url": "https://gyral.dev/errors/#G0041"
113
+ },
114
+ {
115
+ "code": "G0042",
116
+ "group": "Commands",
117
+ "message": "gyral: subscription \"{name}\" failed to unsubscribe",
118
+ "arguments": ["name"],
119
+ "url": "https://gyral.dev/errors/#G0042"
120
+ },
121
+ {
122
+ "code": "G0043",
123
+ "group": "Commands",
124
+ "message": "{owner}: no driver provides \"{driver}\". It is a driver token: provide an implementation by name with provideDrivers(root, { {driver}: … }) or el.drivers (ADR 0006 \"Driver tokens\").",
125
+ "arguments": ["owner", "driver"],
126
+ "url": "https://gyral.dev/errors/#G0043"
127
+ },
128
+ {
129
+ "code": "G0050",
130
+ "group": "Stores",
131
+ "message": "<{tag}> uses store \"{store}\" without declaring it. Add it to the spec: stores: [{store}] (ADR 0013), so the component subscribes to its changes.",
132
+ "arguments": ["tag", "store"],
133
+ "url": "https://gyral.dev/errors/#G0050"
134
+ },
135
+ {
136
+ "code": "G0051",
137
+ "group": "Stores",
138
+ "message": "store \"{store}\": the server's seed failed its schema, so it starts from init. Issues: {issues}",
139
+ "arguments": ["store", "issues"],
140
+ "url": "https://gyral.dev/errors/#G0051"
141
+ },
142
+ {
143
+ "code": "G0052",
144
+ "group": "Stores",
145
+ "message": "unreadable {attribute} seed on {where}",
146
+ "arguments": ["attribute", "where"],
147
+ "url": "https://gyral.dev/errors/#G0052"
148
+ },
149
+ {
150
+ "code": "G0053",
151
+ "group": "Stores",
152
+ "message": "<{tag}> reads store \"{store}\" during a server render without a store scope. Pass the request's store instances to renderPage({ stores }) or renderToString(value, { stores }).",
153
+ "arguments": ["tag", "store"],
154
+ "url": "https://gyral.dev/errors/#G0053"
155
+ },
156
+ {
157
+ "code": "G0054",
158
+ "group": "Stores",
159
+ "message": "store \"{store}\" sends to \"{target}\" but is not held by a store scope (a registry, <gyral-stores> or the page default), so the message is dropped.",
160
+ "arguments": ["store", "target"],
161
+ "url": "https://gyral.dev/errors/#G0054"
162
+ },
163
+ {
164
+ "code": "G0055",
165
+ "group": "Stores",
166
+ "message": "store \"{store}\" has no update for message \"{message}\".",
167
+ "arguments": ["store", "message"],
168
+ "url": "https://gyral.dev/errors/#G0055"
169
+ },
170
+ {
171
+ "code": "G0060",
172
+ "group": "Hydration",
173
+ "message": "<{tag}> has an unreadable {attribute}",
174
+ "arguments": ["tag", "attribute"],
175
+ "url": "https://gyral.dev/errors/#G0060"
176
+ },
177
+ {
178
+ "code": "G0061",
179
+ "group": "Hydration",
180
+ "message": "gyral: hydration code failed to load; rendering fresh",
181
+ "arguments": [],
182
+ "url": "https://gyral.dev/errors/#G0061"
183
+ },
184
+ {
185
+ "code": "G0062",
186
+ "group": "Hydration",
187
+ "message": "gyral: hydration mismatch in {host} at {path}: expected {expected}, found {found}. The server's HTML differs from the first client render: a view that isn't deterministic (Date.now(), locale), a third party that changed the DOM before scripts ran, or a stale cached page (docs/design-docs/view/07-hydration.md \"Mismatches\").",
188
+ "arguments": ["host", "path", "expected", "found"],
189
+ "url": "https://gyral.dev/errors/#G0062"
190
+ },
191
+ {
192
+ "code": "G0063",
193
+ "group": "Hydration",
194
+ "message": "<{tag}> was rendered fresh after a hydration mismatch:",
195
+ "arguments": ["tag"],
196
+ "url": "https://gyral.dev/errors/#G0063"
197
+ },
198
+ {
199
+ "code": "G0070",
200
+ "group": "Templates",
201
+ "message": "gyral: an html template was not compiled: `{start}`. Under the gyral-compiled condition every html`…` must be compiled by the Gyral Vite preset (view/01-templates.md).",
202
+ "arguments": ["start"],
203
+ "url": "https://gyral.dev/errors/#G0070"
204
+ },
205
+ {
206
+ "code": "G0071",
207
+ "group": "Templates",
208
+ "message": "gyral: template rule 11: a page shell rendered in the browser.",
209
+ "arguments": [],
210
+ "url": "https://gyral.dev/errors/#G0071"
211
+ },
212
+ {
213
+ "code": "G0072",
214
+ "group": "Templates",
215
+ "message": "gyral: this page's Trusted Types policy list does not allow the policy \"gyral\", so templates are parsed from plain strings, which works only while Trusted Types are not enforced. Add `trusted-types gyral` to the Content-Security-Policy.",
216
+ "arguments": [],
217
+ "url": "https://gyral.dev/errors/#G0072"
218
+ },
219
+ {
220
+ "code": "G0073",
221
+ "group": "Errors (ADR 0024)",
222
+ "message": "<{tag}> update for \"{message}\" failed; the state is unchanged.",
223
+ "arguments": ["tag", "message"],
224
+ "url": "https://gyral.dev/errors/#G0073"
225
+ },
226
+ {
227
+ "code": "G0074",
228
+ "group": "Errors (ADR 0024)",
229
+ "message": "<{tag}> init failed; it shows its error view, or stays empty.",
230
+ "arguments": ["tag"],
231
+ "url": "https://gyral.dev/errors/#G0074"
232
+ },
233
+ {
234
+ "code": "G0075",
235
+ "group": "Errors (ADR 0024)",
236
+ "message": "<{tag}> element hook failed; the other hooks still ran.",
237
+ "arguments": ["tag"],
238
+ "url": "https://gyral.dev/errors/#G0075"
239
+ },
240
+ {
241
+ "code": "G0076",
242
+ "group": "Errors (ADR 0024)",
243
+ "message": "store \"{store}\": update for \"{message}\" failed; the state is unchanged.",
244
+ "arguments": ["store", "message"],
245
+ "url": "https://gyral.dev/errors/#G0076"
246
+ },
247
+ {
248
+ "code": "G0077",
249
+ "group": "Errors (ADR 0024)",
250
+ "message": "store \"{store}\": a subscriber failed; the other subscribers were still notified.",
251
+ "arguments": ["store"],
252
+ "url": "https://gyral.dev/errors/#G0077"
253
+ },
254
+ {
255
+ "code": "G0078",
256
+ "group": "Errors (ADR 0024)",
257
+ "message": "<{tag}> failed to render on the server; it renders its error view (or nothing) and starts fresh in the browser.",
258
+ "arguments": ["tag"],
259
+ "url": "https://gyral.dev/errors/#G0078"
260
+ },
261
+ {
262
+ "code": "G0079",
263
+ "group": "Subscriptions (ADR 0025)",
264
+ "message": "<{tag}> subscriptions returned two commands for lane \"{lane}\"; only the first runs. Give each its own `key`.",
265
+ "arguments": ["tag", "lane"],
266
+ "url": "https://gyral.dev/errors/#G0079"
267
+ },
268
+ {
269
+ "code": "G0080",
270
+ "group": "Subscriptions (ADR 0025)",
271
+ "message": "<{tag}> subscriptions kept restarting: a subscription's input data changes with every message it sends (for example a timestamp or a counter in the input). Keep inputs to what should restart it; functions are ignored, so to restart on a new selector, change the key.",
272
+ "arguments": ["tag"],
273
+ "url": "https://gyral.dev/errors/#G0080"
274
+ },
275
+ {
276
+ "code": "G0085",
277
+ "group": "Element calls (gyral-1zd.27)",
278
+ "message": "<{tag}> call(\"{selector}\", \"{method}\") failed",
279
+ "arguments": ["tag", "selector", "method"],
280
+ "url": "https://gyral.dev/errors/#G0085"
281
+ },
282
+ {
283
+ "code": "G0086",
284
+ "group": "Element calls (gyral-1zd.27)",
285
+ "message": "call(\"{selector}\", \"{method}\"): arguments must be plain data.",
286
+ "arguments": ["selector", "method"],
287
+ "url": "https://gyral.dev/errors/#G0086"
288
+ }
289
+ ]
@@ -0,0 +1,26 @@
1
+ import type { Rule, Scope } from 'eslint';
2
+ export type Node = Rule.Node;
3
+ export type NodeOf<T extends Node['type']> = Extract<Node, {
4
+ type: T;
5
+ }>;
6
+ /** The default template sources, as in the Vite preset's `sources` option. */
7
+ export declare const DEFAULT_SOURCES: readonly string[];
8
+ /** The options both rules take. */
9
+ export declare const OPTIONS_SCHEMA: {
10
+ type: string;
11
+ properties: {
12
+ sources: {
13
+ type: string;
14
+ items: {
15
+ type: string;
16
+ };
17
+ };
18
+ };
19
+ additionalProperties: boolean;
20
+ }[];
21
+ export declare function sourcesOf(context: Rule.RuleContext): readonly string[];
22
+ export declare function findVariable(scope: Scope.Scope | null, name: string): Scope.Variable | undefined;
23
+ /** How `id` was imported from a template source: the export's name, or `*`. */
24
+ export declare function importedAs(context: Rule.RuleContext, id: NodeOf<'Identifier'>): string | undefined;
25
+ /** Whether `node` (a tag or callee) is the template sources' `name` export. */
26
+ export declare function isGyral(context: Rule.RuleContext, node: Node, name: string): boolean;
@@ -0,0 +1,78 @@
1
+ // Which identifiers are Gyral's `html`, `svg` and `each` (@gyral/core/eslint). Like the template
2
+ // compiler (compiler/scan.ts), a binding counts only when it is imported from a template
3
+ // source: `import { html } from '@gyral/core'` (any local name) or `import * as g` used as
4
+ // `g.html`. ESLint's scope analysis resolves the name, so shadowing is handled. Core's own code
5
+ // and tests import from core's modules by relative path; those count too.
6
+ import { dirname, resolve } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ /** The default template sources, as in the Vite preset's `sources` option. */
9
+ export const DEFAULT_SOURCES = ['@gyral/core'];
10
+ /** The options both rules take. */
11
+ export const OPTIONS_SCHEMA = [
12
+ {
13
+ type: 'object',
14
+ properties: { sources: { type: 'array', items: { type: 'string' } } },
15
+ additionalProperties: false,
16
+ },
17
+ ];
18
+ /** Core's modules that export `html` and `each` (this file is src/eslint/ or dist/eslint/). */
19
+ const CORE_MODULES = ['../index', '../view/index', '../view/template', '../view/render/values']
20
+ .flatMap((name) => ['.ts', '.js'].map((ext) => new URL(`${name}${ext}`, import.meta.url)))
21
+ .map((url) => fileURLToPath(url));
22
+ export function sourcesOf(context) {
23
+ const options = context.options[0];
24
+ const sources = typeof options === 'object' && options !== null && 'sources' in options
25
+ ? options.sources
26
+ : undefined;
27
+ return Array.isArray(sources)
28
+ ? sources.filter((s) => typeof s === 'string')
29
+ : DEFAULT_SOURCES;
30
+ }
31
+ function isSource(context, specifier) {
32
+ if (sourcesOf(context).includes(specifier))
33
+ return true;
34
+ if (!specifier.startsWith('.'))
35
+ return false;
36
+ return CORE_MODULES.includes(resolve(dirname(context.filename), specifier));
37
+ }
38
+ /** typescript-eslint's `import type` marker (not in ESTree). */
39
+ const typeOnly = (node) => 'importKind' in node && node.importKind === 'type';
40
+ export function findVariable(scope, name) {
41
+ for (let s = scope; s !== null; s = s.upper) {
42
+ const v = s.set.get(name);
43
+ if (v !== undefined)
44
+ return v;
45
+ }
46
+ return undefined;
47
+ }
48
+ /** How `id` was imported from a template source: the export's name, or `*`. */
49
+ export function importedAs(context, id) {
50
+ const variable = findVariable(context.sourceCode.getScope(id), id.name);
51
+ const def = variable?.defs[0];
52
+ if (def?.type !== 'ImportBinding')
53
+ return undefined;
54
+ const declaration = def.parent;
55
+ if (typeOnly(declaration) || !isSource(context, String(declaration.source.value))) {
56
+ return undefined;
57
+ }
58
+ const spec = def.node;
59
+ if (spec.type === 'ImportNamespaceSpecifier')
60
+ return '*';
61
+ if (spec.type !== 'ImportSpecifier' || typeOnly(spec))
62
+ return undefined;
63
+ const { imported } = spec;
64
+ return imported.type === 'Identifier' ? imported.name : String(imported.value);
65
+ }
66
+ /** Whether `node` (a tag or callee) is the template sources' `name` export. */
67
+ export function isGyral(context, node, name) {
68
+ if (node.type === 'Identifier')
69
+ return importedAs(context, node) === name;
70
+ if (node.type !== 'MemberExpression' || node.computed || node.object.type !== 'Identifier') {
71
+ return false;
72
+ }
73
+ const { property } = node;
74
+ return (property.type === 'Identifier' &&
75
+ property.name === name &&
76
+ importedAs(context, node.object) === '*');
77
+ }
78
+ //# sourceMappingURL=imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/eslint/imports.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,yFAAyF;AACzF,2FAA2F;AAC3F,gGAAgG;AAChG,0EAA0E;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAsB,CAAC,aAAa,CAAC,CAAC;AAElE,mCAAmC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;QACE,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrE,oBAAoB,EAAE,KAAK;KAC5B;CACF,CAAC;AAEF,+FAA+F;AAC/F,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,uBAAuB,CAAC;KAC5F,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,GAAG,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACzF,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpC,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,MAAM,OAAO,GAAY,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,OAAO,GAC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ACf,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC1B,OAAO,CACL,QAAQ,CAAC,IAAI,KAAK,YAAY;QAC9B,QAAQ,CAAC,IAAI,KAAK,IAAI;QACtB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,MAA8B,CAAC,KAAK,GAAG,CACjE,CAAC;AACJ,CAAC","sourcesContent":["// Which identifiers are Gyral's `html`, `svg` and `each` (@gyral/core/eslint). Like the template\n// compiler (compiler/scan.ts), a binding counts only when it is imported from a template\n// source: `import { html } from '@gyral/core'` (any local name) or `import * as g` used as\n// `g.html`. ESLint's scope analysis resolves the name, so shadowing is handled. Core's own code\n// and tests import from core's modules by relative path; those count too.\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Rule, Scope } from 'eslint';\n\nexport type Node = Rule.Node;\nexport type NodeOf<T extends Node['type']> = Extract<Node, { type: T }>;\n\n/** The default template sources, as in the Vite preset's `sources` option. */\nexport const DEFAULT_SOURCES: readonly string[] = ['@gyral/core'];\n\n/** The options both rules take. */\nexport const OPTIONS_SCHEMA = [\n {\n type: 'object',\n properties: { sources: { type: 'array', items: { type: 'string' } } },\n additionalProperties: false,\n },\n];\n\n/** Core's modules that export `html` and `each` (this file is src/eslint/ or dist/eslint/). */\nconst CORE_MODULES = ['../index', '../view/index', '../view/template', '../view/render/values']\n .flatMap((name) => ['.ts', '.js'].map((ext) => new URL(`${name}${ext}`, import.meta.url)))\n .map((url) => fileURLToPath(url));\n\nexport function sourcesOf(context: Rule.RuleContext): readonly string[] {\n const options: unknown = context.options[0];\n const sources =\n typeof options === 'object' && options !== null && 'sources' in options\n ? options.sources\n : undefined;\n return Array.isArray(sources)\n ? sources.filter((s): s is string => typeof s === 'string')\n : DEFAULT_SOURCES;\n}\n\nfunction isSource(context: Rule.RuleContext, specifier: string): boolean {\n if (sourcesOf(context).includes(specifier)) return true;\n if (!specifier.startsWith('.')) return false;\n return CORE_MODULES.includes(resolve(dirname(context.filename), specifier));\n}\n\n/** typescript-eslint's `import type` marker (not in ESTree). */\nconst typeOnly = (node: object): boolean => 'importKind' in node && node.importKind === 'type';\n\nexport function findVariable(scope: Scope.Scope | null, name: string): Scope.Variable | undefined {\n for (let s = scope; s !== null; s = s.upper) {\n const v = s.set.get(name);\n if (v !== undefined) return v;\n }\n return undefined;\n}\n\n/** How `id` was imported from a template source: the export's name, or `*`. */\nexport function importedAs(\n context: Rule.RuleContext,\n id: NodeOf<'Identifier'>,\n): string | undefined {\n const variable = findVariable(context.sourceCode.getScope(id), id.name);\n const def = variable?.defs[0];\n if (def?.type !== 'ImportBinding') return undefined;\n const declaration = def.parent;\n if (typeOnly(declaration) || !isSource(context, String(declaration.source.value))) {\n return undefined;\n }\n const spec = def.node;\n if (spec.type === 'ImportNamespaceSpecifier') return '*';\n if (spec.type !== 'ImportSpecifier' || typeOnly(spec)) return undefined;\n const { imported } = spec;\n return imported.type === 'Identifier' ? imported.name : String(imported.value);\n}\n\n/** Whether `node` (a tag or callee) is the template sources' `name` export. */\nexport function isGyral(context: Rule.RuleContext, node: Node, name: string): boolean {\n if (node.type === 'Identifier') return importedAs(context, node) === name;\n if (node.type !== 'MemberExpression' || node.computed || node.object.type !== 'Identifier') {\n return false;\n }\n const { property } = node;\n return (\n property.type === 'Identifier' &&\n property.name === name &&\n importedAs(context, node.object as NodeOf<'Identifier'>) === '*'\n );\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { ESLint, Linter } from 'eslint';
2
+ import { rowPurityRule } from './row-purity-rule.js';
3
+ import { templateRule } from './template-rule.js';
4
+ import { unusedIntentRule } from './unused-intent-rule.js';
5
+ export interface GyralPlugin extends ESLint.Plugin {
6
+ readonly rules: {
7
+ readonly template: typeof templateRule;
8
+ readonly 'each-row-purity': typeof rowPurityRule;
9
+ readonly 'unused-intent': typeof unusedIntentRule;
10
+ };
11
+ readonly configs: {
12
+ readonly recommended: Linter.Config;
13
+ };
14
+ }
15
+ declare const plugin: GyralPlugin;
16
+ export default plugin;
@@ -0,0 +1,23 @@
1
+ import { rowPurityRule } from './row-purity-rule.js';
2
+ import { templateRule } from './template-rule.js';
3
+ import { unusedIntentRule } from './unused-intent-rule.js';
4
+ const rules = {
5
+ template: templateRule,
6
+ 'each-row-purity': rowPurityRule,
7
+ 'unused-intent': unusedIntentRule,
8
+ };
9
+ const configs = { recommended: {} };
10
+ const plugin = { meta: { name: '@gyral/core/eslint' }, rules, configs };
11
+ // The config names the plugin object itself, so it can be combined with configs that register
12
+ // `gyral` too (ESLint rejects two different objects under one plugin name).
13
+ configs.recommended = {
14
+ name: 'gyral/recommended',
15
+ plugins: { gyral: plugin },
16
+ rules: {
17
+ 'gyral/template': 'error',
18
+ 'gyral/each-row-purity': 'error',
19
+ 'gyral/unused-intent': 'warn',
20
+ },
21
+ };
22
+ export default plugin;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAW3D,MAAM,KAAK,GAAG;IACZ,QAAQ,EAAE,YAAY;IACtB,iBAAiB,EAAE,aAAa;IAChC,eAAe,EAAE,gBAAgB;CAClC,CAAC;AACF,MAAM,OAAO,GAAmC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAEpE,MAAM,MAAM,GAAgB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAErF,8FAA8F;AAC9F,4EAA4E;AAC5E,OAAO,CAAC,WAAW,GAAG;IACpB,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;IAC1B,KAAK,EAAE;QACL,gBAAgB,EAAE,OAAO;QACzB,uBAAuB,EAAE,OAAO;QAChC,qBAAqB,EAAE,MAAM;KAC9B;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["// @gyral/core/eslint: the template rules (view/09-template-rules.md) in the editor, as an\n// ESLint flat-config plugin. ESLint is an optional peer dependency; nothing here reaches a\n// browser or server bundle.\n//\n// import gyral from '@gyral/core/eslint';\n// export default [gyral.configs.recommended];\nimport type { ESLint, Linter } from 'eslint';\nimport { rowPurityRule } from './row-purity-rule.js';\nimport { templateRule } from './template-rule.js';\nimport { unusedIntentRule } from './unused-intent-rule.js';\n\nexport interface GyralPlugin extends ESLint.Plugin {\n readonly rules: {\n readonly template: typeof templateRule;\n readonly 'each-row-purity': typeof rowPurityRule;\n readonly 'unused-intent': typeof unusedIntentRule;\n };\n readonly configs: { readonly recommended: Linter.Config };\n}\n\nconst rules = {\n template: templateRule,\n 'each-row-purity': rowPurityRule,\n 'unused-intent': unusedIntentRule,\n};\nconst configs: { recommended: Linter.Config } = { recommended: {} };\n\nconst plugin: GyralPlugin = { meta: { name: '@gyral/core/eslint' }, rules, configs };\n\n// The config names the plugin object itself, so it can be combined with configs that register\n// `gyral` too (ESLint rejects two different objects under one plugin name).\nconfigs.recommended = {\n name: 'gyral/recommended',\n plugins: { gyral: plugin },\n rules: {\n 'gyral/template': 'error',\n 'gyral/each-row-purity': 'error',\n 'gyral/unused-intent': 'warn',\n },\n};\n\nexport default plugin;\n"]}
@@ -0,0 +1,33 @@
1
+ /** One quasi of a template literal: where its text starts in the file, and its offset map. */
2
+ export interface Quasi {
3
+ /** File offset of the quasi's first character (after the backtick or `}`). */
4
+ readonly start: number;
5
+ /** File offset where the quasi's text ends (at the closing backtick or `${`). */
6
+ readonly end: number;
7
+ /** For each cooked offset (and one past the end), the offset in the source text. */
8
+ readonly map: readonly number[];
9
+ }
10
+ /**
11
+ * Maps each offset of the cooked string to the source text it came from. Returns undefined when
12
+ * decoding `text` doesn't give `cooked` (the caller then points at the quasi's start).
13
+ */
14
+ export declare function cookedMap(text: string, cooked: string): number[] | undefined;
15
+ /**
16
+ * Maps each offset of `minified` (and one past its end) to `original`. The minifier only
17
+ * collapses a whitespace run to one space or drops it, and copies everything else.
18
+ */
19
+ export declare function minifiedMap(original: string, minified: string): number[];
20
+ /** A source range, as file offsets. */
21
+ export interface Span {
22
+ readonly start: number;
23
+ readonly end: number;
24
+ }
25
+ /** A position in the normalizer's minified strings: string index, offset (view/normalize/check.ts). */
26
+ type At = readonly [index: number, offset: number];
27
+ /**
28
+ * The range to report for a template's first error: the token the tree builder was handling
29
+ * (a tag, an end tag, text) when it has one; the whole `${…}` when the error is at a hole
30
+ * (including `<${…}>`, where the tag name would be); else the character the tokenizer stopped at.
31
+ */
32
+ export declare function errorSpan(quasis: readonly Quasi[], originals: readonly string[], minified: readonly string[], at: At, from: At | undefined): Span;
33
+ export {};
@@ -0,0 +1,132 @@
1
+ // Where a template rule error is in the source (@gyral/core/eslint, view/09-template-rules.md).
2
+ // The normalizer reports the string and offset it stopped at, in the whitespace-minified cooked
3
+ // strings. Three maps lead back to the file: minified → cooked (whitespace runs the minifier
4
+ // collapsed or dropped), cooked → source text (escapes, line continuations and CRLF, which the
5
+ // cooked string spells differently), and the quasi's place in the file.
6
+ const SIMPLE = {
7
+ n: '\n',
8
+ t: '\t',
9
+ r: '\r',
10
+ b: '\b',
11
+ f: '\f',
12
+ v: '\v',
13
+ };
14
+ const LINE_END = /[\n\r\u2028\u2029]/;
15
+ /** The length of the escape sequence at `k` (after its backslash) and the text it cooks to. */
16
+ function escape(text, k) {
17
+ const c = text.charAt(k);
18
+ const simple = SIMPLE[c];
19
+ if (simple !== undefined)
20
+ return { length: 1, value: simple };
21
+ if (c === '\r')
22
+ return { length: text.charAt(k + 1) === '\n' ? 2 : 1, value: '' };
23
+ if (LINE_END.test(c))
24
+ return { length: 1, value: '' };
25
+ if (c === '0' && !/[0-9]/.test(text.charAt(k + 1)))
26
+ return { length: 1, value: '\0' };
27
+ const hex = c === 'x'
28
+ ? /^x([0-9a-fA-F]{2})/.exec(text.slice(k))
29
+ : c === 'u'
30
+ ? /^u(?:([0-9a-fA-F]{4})|\{([0-9a-fA-F]+)\})/.exec(text.slice(k))
31
+ : null;
32
+ if (hex !== null) {
33
+ const code = Number.parseInt(hex[1] ?? hex[2] ?? '0', 16);
34
+ return { length: hex[0].length, value: String.fromCodePoint(code) };
35
+ }
36
+ return { length: c.length, value: c };
37
+ }
38
+ /**
39
+ * Maps each offset of the cooked string to the source text it came from. Returns undefined when
40
+ * decoding `text` doesn't give `cooked` (the caller then points at the quasi's start).
41
+ */
42
+ export function cookedMap(text, cooked) {
43
+ const map = [];
44
+ let out = '';
45
+ let k = 0;
46
+ while (k < text.length) {
47
+ const c = text.charAt(k);
48
+ let length = 1;
49
+ let value = c;
50
+ if (c === '\\') {
51
+ const e = escape(text, k + 1);
52
+ length = 1 + e.length;
53
+ value = e.value;
54
+ }
55
+ else if (c === '\r') {
56
+ length = text.charAt(k + 1) === '\n' ? 2 : 1;
57
+ value = '\n';
58
+ }
59
+ for (let n = 0; n < value.length; n++)
60
+ map.push(k);
61
+ out += value;
62
+ k += length;
63
+ }
64
+ map.push(text.length);
65
+ return out === cooked ? map : undefined;
66
+ }
67
+ const isWs = (c) => c === ' ' || c === '\t' || c === '\n' || c === '\r' || c === '\f';
68
+ /**
69
+ * Maps each offset of `minified` (and one past its end) to `original`. The minifier only
70
+ * collapses a whitespace run to one space or drops it, and copies everything else.
71
+ */
72
+ export function minifiedMap(original, minified) {
73
+ const map = [];
74
+ let a = 0;
75
+ for (let b = 0; b < minified.length; b++) {
76
+ const c = minified.charAt(b);
77
+ // A dropped run: skip it.
78
+ while (c !== ' ' && isWs(original.charAt(a)) && original.charAt(a) !== c)
79
+ a++;
80
+ map.push(a);
81
+ // A run collapsed to this space (one that starts with a space is copied char by char,
82
+ // and its rest skipped as dropped before the next character).
83
+ if (c === ' ' && original.charAt(a) !== ' ' && isWs(original.charAt(a))) {
84
+ while (isWs(original.charAt(a)))
85
+ a++;
86
+ }
87
+ else if (a < original.length)
88
+ a++;
89
+ }
90
+ map.push(original.length);
91
+ return map;
92
+ }
93
+ /**
94
+ * The range to report for a template's first error: the token the tree builder was handling
95
+ * (a tag, an end tag, text) when it has one; the whole `${…}` when the error is at a hole
96
+ * (including `<${…}>`, where the tag name would be); else the character the tokenizer stopped at.
97
+ */
98
+ export function errorSpan(quasis, originals, minified, at, from) {
99
+ const maps = minified.map((m, i) => minifiedMap(originals[i] ?? '', m));
100
+ /** File offset where minified character `off` of string `i` starts. */
101
+ const startOf = (i, off) => {
102
+ const q = quasis[i];
103
+ return q === undefined ? 0 : q.start + (q.map[maps[i]?.[off] ?? 0] ?? 0);
104
+ };
105
+ /** File offset just after minified character `off - 1` of string `i`. */
106
+ const endOf = (i, off) => {
107
+ const q = quasis[i];
108
+ if (q === undefined)
109
+ return 0;
110
+ if (off <= 0)
111
+ return q.start;
112
+ return q.start + (q.map[(maps[i]?.[off - 1] ?? 0) + 1] ?? 0);
113
+ };
114
+ const [index, offset] = at;
115
+ const s = minified[index] ?? '';
116
+ const quasi = quasis[index];
117
+ const next = quasis[index + 1];
118
+ if (quasi === undefined)
119
+ return { start: 0, end: 0 };
120
+ if (from !== undefined && (from[0] < index || from[1] < offset)) {
121
+ return { start: startOf(from[0], from[1]), end: endOf(index, offset) };
122
+ }
123
+ if (next !== undefined && /^(<\/?)?$/.test(s.slice(offset))) {
124
+ return { start: offset < s.length ? startOf(index, offset) : quasi.end, end: next.start };
125
+ }
126
+ if (offset < s.length)
127
+ return { start: startOf(index, offset), end: endOf(index, offset + 1) };
128
+ return s.length > 0
129
+ ? { start: startOf(index, s.length - 1), end: endOf(index, s.length) }
130
+ : { start: quasi.end, end: quasi.end + 1 };
131
+ }
132
+ //# sourceMappingURL=locate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locate.js","sourceRoot":"","sources":["../../src/eslint/locate.ts"],"names":[],"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AAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC5F,CAAC;IACD,IAAI,MAAM,GAAG,CAAC,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;IAC/F,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE;QACtE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["// Where a template rule error is in the source (@gyral/core/eslint, view/09-template-rules.md).\n// The normalizer reports the string and offset it stopped at, in the whitespace-minified cooked\n// strings. Three maps lead back to the file: minified → cooked (whitespace runs the minifier\n// collapsed or dropped), cooked → source text (escapes, line continuations and CRLF, which the\n// cooked string spells differently), and the quasi's place in the file.\n\n/** One quasi of a template literal: where its text starts in the file, and its offset map. */\nexport interface Quasi {\n /** File offset of the quasi's first character (after the backtick or `}`). */\n readonly start: number;\n /** File offset where the quasi's text ends (at the closing backtick or `${`). */\n readonly end: number;\n /** For each cooked offset (and one past the end), the offset in the source text. */\n readonly map: readonly number[];\n}\n\nconst SIMPLE: Readonly<Record<string, string>> = {\n n: '\\n',\n t: '\\t',\n r: '\\r',\n b: '\\b',\n f: '\\f',\n v: '\\v',\n};\nconst LINE_END = /[\\n\\r\\u2028\\u2029]/;\n\n/** The length of the escape sequence at `k` (after its backslash) and the text it cooks to. */\nfunction escape(text: string, k: number): { length: number; value: string } {\n const c = text.charAt(k);\n const simple = SIMPLE[c];\n if (simple !== undefined) return { length: 1, value: simple };\n if (c === '\\r') return { length: text.charAt(k + 1) === '\\n' ? 2 : 1, value: '' };\n if (LINE_END.test(c)) return { length: 1, value: '' };\n if (c === '0' && !/[0-9]/.test(text.charAt(k + 1))) return { length: 1, value: '\\0' };\n const hex =\n c === 'x'\n ? /^x([0-9a-fA-F]{2})/.exec(text.slice(k))\n : c === 'u'\n ? /^u(?:([0-9a-fA-F]{4})|\\{([0-9a-fA-F]+)\\})/.exec(text.slice(k))\n : null;\n if (hex !== null) {\n const code = Number.parseInt(hex[1] ?? hex[2] ?? '0', 16);\n return { length: hex[0].length, value: String.fromCodePoint(code) };\n }\n return { length: c.length, value: c };\n}\n\n/**\n * Maps each offset of the cooked string to the source text it came from. Returns undefined when\n * decoding `text` doesn't give `cooked` (the caller then points at the quasi's start).\n */\nexport function cookedMap(text: string, cooked: string): number[] | undefined {\n const map: number[] = [];\n let out = '';\n let k = 0;\n while (k < text.length) {\n const c = text.charAt(k);\n let length = 1;\n let value = c;\n if (c === '\\\\') {\n const e = escape(text, k + 1);\n length = 1 + e.length;\n value = e.value;\n } else if (c === '\\r') {\n length = text.charAt(k + 1) === '\\n' ? 2 : 1;\n value = '\\n';\n }\n for (let n = 0; n < value.length; n++) map.push(k);\n out += value;\n k += length;\n }\n map.push(text.length);\n return out === cooked ? map : undefined;\n}\n\nconst isWs = (c: string): boolean =>\n c === ' ' || c === '\\t' || c === '\\n' || c === '\\r' || c === '\\f';\n\n/**\n * Maps each offset of `minified` (and one past its end) to `original`. The minifier only\n * collapses a whitespace run to one space or drops it, and copies everything else.\n */\nexport function minifiedMap(original: string, minified: string): number[] {\n const map: number[] = [];\n let a = 0;\n for (let b = 0; b < minified.length; b++) {\n const c = minified.charAt(b);\n // A dropped run: skip it.\n while (c !== ' ' && isWs(original.charAt(a)) && original.charAt(a) !== c) a++;\n map.push(a);\n // A run collapsed to this space (one that starts with a space is copied char by char,\n // and its rest skipped as dropped before the next character).\n if (c === ' ' && original.charAt(a) !== ' ' && isWs(original.charAt(a))) {\n while (isWs(original.charAt(a))) a++;\n } else if (a < original.length) a++;\n }\n map.push(original.length);\n return map;\n}\n\n/** A source range, as file offsets. */\nexport interface Span {\n readonly start: number;\n readonly end: number;\n}\n\n/** A position in the normalizer's minified strings: string index, offset (view/normalize/check.ts). */\ntype At = readonly [index: number, offset: number];\n\n/**\n * The range to report for a template's first error: the token the tree builder was handling\n * (a tag, an end tag, text) when it has one; the whole `${…}` when the error is at a hole\n * (including `<${…}>`, where the tag name would be); else the character the tokenizer stopped at.\n */\nexport function errorSpan(\n quasis: readonly Quasi[],\n originals: readonly string[],\n minified: readonly string[],\n at: At,\n from: At | undefined,\n): Span {\n const maps = minified.map((m, i) => minifiedMap(originals[i] ?? '', m));\n /** File offset where minified character `off` of string `i` starts. */\n const startOf = (i: number, off: number): number => {\n const q = quasis[i];\n return q === undefined ? 0 : q.start + (q.map[maps[i]?.[off] ?? 0] ?? 0);\n };\n /** File offset just after minified character `off - 1` of string `i`. */\n const endOf = (i: number, off: number): number => {\n const q = quasis[i];\n if (q === undefined) return 0;\n if (off <= 0) return q.start;\n return q.start + (q.map[(maps[i]?.[off - 1] ?? 0) + 1] ?? 0);\n };\n const [index, offset] = at;\n const s = minified[index] ?? '';\n const quasi = quasis[index];\n const next = quasis[index + 1];\n if (quasi === undefined) return { start: 0, end: 0 };\n if (from !== undefined && (from[0] < index || from[1] < offset)) {\n return { start: startOf(from[0], from[1]), end: endOf(index, offset) };\n }\n if (next !== undefined && /^(<\\/?)?$/.test(s.slice(offset))) {\n return { start: offset < s.length ? startOf(index, offset) : quasi.end, end: next.start };\n }\n if (offset < s.length) return { start: startOf(index, offset), end: endOf(index, offset + 1) };\n return s.length > 0\n ? { start: startOf(index, s.length - 1), end: endOf(index, s.length) }\n : { start: quasi.end, end: quasi.end + 1 };\n}\n"]}