@vigla/svelte 0.0.0-stage → 5.57.4

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 (373) hide show
  1. package/action.d.ts +2 -0
  2. package/animate.d.ts +2 -0
  3. package/compiler/index.js +43266 -0
  4. package/compiler/index.js.map +1 -0
  5. package/compiler/package.json +3 -0
  6. package/compiler.d.ts +2 -0
  7. package/dist/compiler/diagnostics.d.ts +70 -0
  8. package/dist/compiler/diagnostics.d.ts.map +1 -0
  9. package/dist/compiler/diagnostics.js +166 -0
  10. package/dist/compiler/diagnostics.js.map +1 -0
  11. package/dist/compiler/index.d.ts +72 -0
  12. package/dist/compiler/index.d.ts.map +1 -0
  13. package/dist/compiler/index.js +178 -0
  14. package/dist/compiler/index.js.map +1 -0
  15. package/dist/compiler/options.d.ts +7 -0
  16. package/dist/compiler/options.d.ts.map +1 -0
  17. package/dist/compiler/options.js +126 -0
  18. package/dist/compiler/options.js.map +1 -0
  19. package/dist/compiler/preprocess/decode.d.ts +3 -0
  20. package/dist/compiler/preprocess/decode.d.ts.map +1 -0
  21. package/dist/compiler/preprocess/decode.js +60 -0
  22. package/dist/compiler/preprocess/decode.js.map +1 -0
  23. package/dist/compiler/preprocess/index.d.ts +27 -0
  24. package/dist/compiler/preprocess/index.d.ts.map +1 -0
  25. package/dist/compiler/preprocess/index.js +208 -0
  26. package/dist/compiler/preprocess/index.js.map +1 -0
  27. package/dist/compiler/preprocess/mapped.d.ts +25 -0
  28. package/dist/compiler/preprocess/mapped.d.ts.map +1 -0
  29. package/dist/compiler/preprocess/mapped.js +129 -0
  30. package/dist/compiler/preprocess/mapped.js.map +1 -0
  31. package/dist/compiler/proxy.d.ts +3 -0
  32. package/dist/compiler/proxy.d.ts.map +1 -0
  33. package/dist/compiler/proxy.js +133 -0
  34. package/dist/compiler/proxy.js.map +1 -0
  35. package/dist/entries/action.d.ts +2 -0
  36. package/dist/entries/action.d.ts.map +1 -0
  37. package/dist/entries/action.js +1 -0
  38. package/dist/entries/action.js.map +1 -0
  39. package/dist/entries/animate.d.ts +2 -0
  40. package/dist/entries/animate.d.ts.map +1 -0
  41. package/dist/entries/animate.js +2 -0
  42. package/dist/entries/animate.js.map +1 -0
  43. package/dist/entries/attachments.d.ts +2 -0
  44. package/dist/entries/attachments.d.ts.map +1 -0
  45. package/dist/entries/attachments.js +2 -0
  46. package/dist/entries/attachments.js.map +1 -0
  47. package/dist/entries/context.d.ts +15 -0
  48. package/dist/entries/context.d.ts.map +1 -0
  49. package/dist/entries/context.js +32 -0
  50. package/dist/entries/context.js.map +1 -0
  51. package/dist/entries/easing.d.ts +2 -0
  52. package/dist/entries/easing.d.ts.map +1 -0
  53. package/dist/entries/easing.js +2 -0
  54. package/dist/entries/easing.js.map +1 -0
  55. package/dist/entries/events.d.ts +2 -0
  56. package/dist/entries/events.d.ts.map +1 -0
  57. package/dist/entries/events.js +2 -0
  58. package/dist/entries/events.js.map +1 -0
  59. package/dist/entries/index-server.d.ts +4 -0
  60. package/dist/entries/index-server.d.ts.map +1 -0
  61. package/dist/entries/index-server.js +11 -0
  62. package/dist/entries/index-server.js.map +1 -0
  63. package/dist/entries/index.d.ts +10 -0
  64. package/dist/entries/index.d.ts.map +1 -0
  65. package/dist/entries/index.js +24 -0
  66. package/dist/entries/index.js.map +1 -0
  67. package/dist/entries/internal/client.d.ts +4 -0
  68. package/dist/entries/internal/client.d.ts.map +1 -0
  69. package/dist/entries/internal/client.js +9 -0
  70. package/dist/entries/internal/client.js.map +1 -0
  71. package/dist/entries/internal/disclose-version.d.ts +2 -0
  72. package/dist/entries/internal/disclose-version.d.ts.map +1 -0
  73. package/dist/entries/internal/disclose-version.js +4 -0
  74. package/dist/entries/internal/disclose-version.js.map +1 -0
  75. package/dist/entries/internal/index.d.ts +2 -0
  76. package/dist/entries/internal/index.d.ts.map +1 -0
  77. package/dist/entries/internal/index.js +2 -0
  78. package/dist/entries/internal/index.js.map +1 -0
  79. package/dist/entries/internal/server.d.ts +2 -0
  80. package/dist/entries/internal/server.d.ts.map +1 -0
  81. package/dist/entries/internal/server.js +7 -0
  82. package/dist/entries/internal/server.js.map +1 -0
  83. package/dist/entries/internal/tracing.d.ts +2 -0
  84. package/dist/entries/internal/tracing.d.ts.map +1 -0
  85. package/dist/entries/internal/tracing.js +2 -0
  86. package/dist/entries/internal/tracing.js.map +1 -0
  87. package/dist/entries/motion-server.d.ts +2 -0
  88. package/dist/entries/motion-server.d.ts.map +1 -0
  89. package/dist/entries/motion-server.js +2 -0
  90. package/dist/entries/motion-server.js.map +1 -0
  91. package/dist/entries/motion.d.ts +2 -0
  92. package/dist/entries/motion.d.ts.map +1 -0
  93. package/dist/entries/motion.js +2 -0
  94. package/dist/entries/motion.js.map +1 -0
  95. package/dist/entries/proxy.d.ts +6 -0
  96. package/dist/entries/proxy.d.ts.map +1 -0
  97. package/dist/entries/proxy.js +77 -0
  98. package/dist/entries/proxy.js.map +1 -0
  99. package/dist/entries/reactivity-server.d.ts +2 -0
  100. package/dist/entries/reactivity-server.d.ts.map +1 -0
  101. package/dist/entries/reactivity-server.js +2 -0
  102. package/dist/entries/reactivity-server.js.map +1 -0
  103. package/dist/entries/reactivity.d.ts +2 -0
  104. package/dist/entries/reactivity.d.ts.map +1 -0
  105. package/dist/entries/reactivity.js +2 -0
  106. package/dist/entries/reactivity.js.map +1 -0
  107. package/dist/entries/report.d.ts +3 -0
  108. package/dist/entries/report.d.ts.map +1 -0
  109. package/dist/entries/report.js +66 -0
  110. package/dist/entries/report.js.map +1 -0
  111. package/dist/entries/server.d.ts +8 -0
  112. package/dist/entries/server.d.ts.map +1 -0
  113. package/dist/entries/server.js +48 -0
  114. package/dist/entries/server.js.map +1 -0
  115. package/dist/entries/store-client.d.ts +12 -0
  116. package/dist/entries/store-client.d.ts.map +1 -0
  117. package/dist/entries/store-client.js +63 -0
  118. package/dist/entries/store-client.js.map +1 -0
  119. package/dist/entries/store-server.d.ts +12 -0
  120. package/dist/entries/store-server.d.ts.map +1 -0
  121. package/dist/entries/store-server.js +30 -0
  122. package/dist/entries/store-server.js.map +1 -0
  123. package/dist/entries/store.d.ts +25 -0
  124. package/dist/entries/store.d.ts.map +1 -0
  125. package/dist/entries/store.js +139 -0
  126. package/dist/entries/store.js.map +1 -0
  127. package/dist/entries/transition.d.ts +2 -0
  128. package/dist/entries/transition.d.ts.map +1 -0
  129. package/dist/entries/transition.js +2 -0
  130. package/dist/entries/transition.js.map +1 -0
  131. package/dist/entries/window-server.d.ts +2 -0
  132. package/dist/entries/window-server.d.ts.map +1 -0
  133. package/dist/entries/window-server.js +2 -0
  134. package/dist/entries/window-server.js.map +1 -0
  135. package/dist/entries/window.d.ts +2 -0
  136. package/dist/entries/window.d.ts.map +1 -0
  137. package/dist/entries/window.js +2 -0
  138. package/dist/entries/window.js.map +1 -0
  139. package/dist/front/ast.d.ts +290 -0
  140. package/dist/front/ast.d.ts.map +1 -0
  141. package/dist/front/ast.js +1 -0
  142. package/dist/front/ast.js.map +1 -0
  143. package/dist/front/diagnostics.d.ts +13 -0
  144. package/dist/front/diagnostics.d.ts.map +1 -0
  145. package/dist/front/diagnostics.js +38 -0
  146. package/dist/front/diagnostics.js.map +1 -0
  147. package/dist/front/ignores.d.ts +12 -0
  148. package/dist/front/ignores.d.ts.map +1 -0
  149. package/dist/front/ignores.js +75 -0
  150. package/dist/front/ignores.js.map +1 -0
  151. package/dist/front/index.d.ts +17 -0
  152. package/dist/front/index.d.ts.map +1 -0
  153. package/dist/front/index.js +65 -0
  154. package/dist/front/index.js.map +1 -0
  155. package/dist/front/legacy.d.ts +5 -0
  156. package/dist/front/legacy.d.ts.map +1 -0
  157. package/dist/front/legacy.js +408 -0
  158. package/dist/front/legacy.js.map +1 -0
  159. package/dist/front/locate.d.ts +4 -0
  160. package/dist/front/locate.d.ts.map +1 -0
  161. package/dist/front/locate.js +19 -0
  162. package/dist/front/locate.js.map +1 -0
  163. package/dist/front/lower.d.ts +39 -0
  164. package/dist/front/lower.d.ts.map +1 -0
  165. package/dist/front/lower.js +470 -0
  166. package/dist/front/lower.js.map +1 -0
  167. package/dist/front/parse/attribute.d.ts +12 -0
  168. package/dist/front/parse/attribute.d.ts.map +1 -0
  169. package/dist/front/parse/attribute.js +288 -0
  170. package/dist/front/parse/attribute.js.map +1 -0
  171. package/dist/front/parse/bracket.d.ts +3 -0
  172. package/dist/front/parse/bracket.d.ts.map +1 -0
  173. package/dist/front/parse/bracket.js +102 -0
  174. package/dist/front/parse/bracket.js.map +1 -0
  175. package/dist/front/parse/characters.d.ts +4 -0
  176. package/dist/front/parse/characters.d.ts.map +1 -0
  177. package/dist/front/parse/characters.js +6 -0
  178. package/dist/front/parse/characters.js.map +1 -0
  179. package/dist/front/parse/decode.d.ts +2 -0
  180. package/dist/front/parse/decode.d.ts.map +1 -0
  181. package/dist/front/parse/decode.js +89 -0
  182. package/dist/front/parse/decode.js.map +1 -0
  183. package/dist/front/parse/element.d.ts +3 -0
  184. package/dist/front/parse/element.d.ts.map +1 -0
  185. package/dist/front/parse/element.js +311 -0
  186. package/dist/front/parse/element.js.map +1 -0
  187. package/dist/front/parse/entities.d.ts +2 -0
  188. package/dist/front/parse/entities.d.ts.map +1 -0
  189. package/dist/front/parse/entities.js +2234 -0
  190. package/dist/front/parse/entities.js.map +1 -0
  191. package/dist/front/parse/expression.d.ts +5 -0
  192. package/dist/front/parse/expression.d.ts.map +1 -0
  193. package/dist/front/parse/expression.js +86 -0
  194. package/dist/front/parse/expression.js.map +1 -0
  195. package/dist/front/parse/html.d.ts +8 -0
  196. package/dist/front/parse/html.d.ts.map +1 -0
  197. package/dist/front/parse/html.js +146 -0
  198. package/dist/front/parse/html.js.map +1 -0
  199. package/dist/front/parse/identifier.d.ts +4 -0
  200. package/dist/front/parse/identifier.d.ts.map +1 -0
  201. package/dist/front/parse/identifier.js +24 -0
  202. package/dist/front/parse/identifier.js.map +1 -0
  203. package/dist/front/parse/index.d.ts +13 -0
  204. package/dist/front/parse/index.d.ts.map +1 -0
  205. package/dist/front/parse/index.js +74 -0
  206. package/dist/front/parse/index.js.map +1 -0
  207. package/dist/front/parse/js.d.ts +27 -0
  208. package/dist/front/parse/js.d.ts.map +1 -0
  209. package/dist/front/parse/js.js +241 -0
  210. package/dist/front/parse/js.js.map +1 -0
  211. package/dist/front/parse/options.d.ts +3 -0
  212. package/dist/front/parse/options.d.ts.map +1 -0
  213. package/dist/front/parse/options.js +198 -0
  214. package/dist/front/parse/options.js.map +1 -0
  215. package/dist/front/parse/parser.d.ts +50 -0
  216. package/dist/front/parse/parser.d.ts.map +1 -0
  217. package/dist/front/parse/parser.js +157 -0
  218. package/dist/front/parse/parser.js.map +1 -0
  219. package/dist/front/parse/pattern.d.ts +4 -0
  220. package/dist/front/parse/pattern.d.ts.map +1 -0
  221. package/dist/front/parse/pattern.js +53 -0
  222. package/dist/front/parse/pattern.js.map +1 -0
  223. package/dist/front/parse/script.d.ts +4 -0
  224. package/dist/front/parse/script.d.ts.map +1 -0
  225. package/dist/front/parse/script.js +60 -0
  226. package/dist/front/parse/script.js.map +1 -0
  227. package/dist/front/parse/style.d.ts +7 -0
  228. package/dist/front/parse/style.d.ts.map +1 -0
  229. package/dist/front/parse/style.js +397 -0
  230. package/dist/front/parse/style.js.map +1 -0
  231. package/dist/front/parse/tag.d.ts +3 -0
  232. package/dist/front/parse/tag.d.ts.map +1 -0
  233. package/dist/front/parse/tag.js +591 -0
  234. package/dist/front/parse/tag.js.map +1 -0
  235. package/dist/front/print/css.d.ts +5 -0
  236. package/dist/front/print/css.d.ts.map +1 -0
  237. package/dist/front/print/css.js +234 -0
  238. package/dist/front/print/css.js.map +1 -0
  239. package/dist/front/print/index.d.ts +18 -0
  240. package/dist/front/print/index.d.ts.map +1 -0
  241. package/dist/front/print/index.js +24 -0
  242. package/dist/front/print/index.js.map +1 -0
  243. package/dist/front/print/layout.d.ts +11 -0
  244. package/dist/front/print/layout.d.ts.map +1 -0
  245. package/dist/front/print/layout.js +73 -0
  246. package/dist/front/print/layout.js.map +1 -0
  247. package/dist/front/print/template.d.ts +5 -0
  248. package/dist/front/print/template.d.ts.map +1 -0
  249. package/dist/front/print/template.js +455 -0
  250. package/dist/front/print/template.js.map +1 -0
  251. package/dist/front/runes.d.ts +13 -0
  252. package/dist/front/runes.d.ts.map +1 -0
  253. package/dist/front/runes.js +253 -0
  254. package/dist/front/runes.js.map +1 -0
  255. package/dist/front/stores.d.ts +5 -0
  256. package/dist/front/stores.d.ts.map +1 -0
  257. package/dist/front/stores.js +84 -0
  258. package/dist/front/stores.js.map +1 -0
  259. package/dist/front/typescript.d.ts +2 -0
  260. package/dist/front/typescript.d.ts.map +1 -0
  261. package/dist/front/typescript.js +182 -0
  262. package/dist/front/typescript.js.map +1 -0
  263. package/dist/front/validate/anchors.d.ts +15 -0
  264. package/dist/front/validate/anchors.d.ts.map +1 -0
  265. package/dist/front/validate/anchors.js +43 -0
  266. package/dist/front/validate/anchors.js.map +1 -0
  267. package/dist/front/validate/index.d.ts +16 -0
  268. package/dist/front/validate/index.d.ts.map +1 -0
  269. package/dist/front/validate/index.js +139 -0
  270. package/dist/front/validate/index.js.map +1 -0
  271. package/dist/front/validate/legacy.d.ts +9 -0
  272. package/dist/front/validate/legacy.d.ts.map +1 -0
  273. package/dist/front/validate/legacy.js +102 -0
  274. package/dist/front/validate/legacy.js.map +1 -0
  275. package/dist/front/validate/report.d.ts +14 -0
  276. package/dist/front/validate/report.d.ts.map +1 -0
  277. package/dist/front/validate/report.js +29 -0
  278. package/dist/front/validate/report.js.map +1 -0
  279. package/dist/front/validate/template.d.ts +31 -0
  280. package/dist/front/validate/template.d.ts.map +1 -0
  281. package/dist/front/validate/template.js +507 -0
  282. package/dist/front/validate/template.js.map +1 -0
  283. package/dist/front/wording.d.ts +4 -0
  284. package/dist/front/wording.d.ts.map +1 -0
  285. package/dist/front/wording.js +110 -0
  286. package/dist/front/wording.js.map +1 -0
  287. package/dist/shared/format.d.ts +3 -0
  288. package/dist/shared/format.d.ts.map +1 -0
  289. package/dist/shared/format.js +7 -0
  290. package/dist/shared/format.js.map +1 -0
  291. package/easing.d.ts +2 -0
  292. package/elements.d.ts +1220 -0
  293. package/index.d.ts +2 -0
  294. package/motion.d.ts +2 -0
  295. package/package.json +128 -5
  296. package/src/compiler/diagnostics.ts +233 -0
  297. package/src/compiler/index.ts +292 -0
  298. package/src/compiler/options.ts +140 -0
  299. package/src/compiler/preprocess/decode.ts +85 -0
  300. package/src/compiler/preprocess/index.ts +299 -0
  301. package/src/compiler/preprocess/mapped.ts +146 -0
  302. package/src/compiler/proxy.ts +154 -0
  303. package/src/entries/action.ts +1 -0
  304. package/src/entries/animate.ts +1 -0
  305. package/src/entries/attachments.ts +1 -0
  306. package/src/entries/context.ts +50 -0
  307. package/src/entries/easing.ts +1 -0
  308. package/src/entries/events.ts +1 -0
  309. package/src/entries/index-server.ts +17 -0
  310. package/src/entries/index.ts +41 -0
  311. package/src/entries/internal/client.ts +15 -0
  312. package/src/entries/internal/disclose-version.ts +4 -0
  313. package/src/entries/internal/index.ts +3 -0
  314. package/src/entries/internal/server.ts +8 -0
  315. package/src/entries/internal/tracing.ts +1 -0
  316. package/src/entries/motion-server.ts +1 -0
  317. package/src/entries/motion.ts +1 -0
  318. package/src/entries/proxy.ts +86 -0
  319. package/src/entries/reactivity-server.ts +9 -0
  320. package/src/entries/reactivity.ts +9 -0
  321. package/src/entries/report.ts +81 -0
  322. package/src/entries/server.ts +76 -0
  323. package/src/entries/store-client.ts +80 -0
  324. package/src/entries/store-server.ts +44 -0
  325. package/src/entries/store.ts +201 -0
  326. package/src/entries/transition.ts +1 -0
  327. package/src/entries/window-server.ts +1 -0
  328. package/src/entries/window.ts +1 -0
  329. package/src/front/ast.ts +369 -0
  330. package/src/front/diagnostics.ts +53 -0
  331. package/src/front/ignores.ts +84 -0
  332. package/src/front/index.ts +86 -0
  333. package/src/front/legacy.ts +414 -0
  334. package/src/front/locate.ts +20 -0
  335. package/src/front/lower.ts +509 -0
  336. package/src/front/parse/attribute.ts +319 -0
  337. package/src/front/parse/bracket.ts +99 -0
  338. package/src/front/parse/characters.ts +19 -0
  339. package/src/front/parse/decode.ts +87 -0
  340. package/src/front/parse/element.ts +354 -0
  341. package/src/front/parse/entities.ts +2233 -0
  342. package/src/front/parse/expression.ts +85 -0
  343. package/src/front/parse/html.ts +158 -0
  344. package/src/front/parse/identifier.ts +29 -0
  345. package/src/front/parse/index.ts +88 -0
  346. package/src/front/parse/js.ts +284 -0
  347. package/src/front/parse/options.ts +194 -0
  348. package/src/front/parse/parser.ts +189 -0
  349. package/src/front/parse/pattern.ts +57 -0
  350. package/src/front/parse/script.ts +74 -0
  351. package/src/front/parse/style.ts +399 -0
  352. package/src/front/parse/tag.ts +601 -0
  353. package/src/front/print/css.ts +239 -0
  354. package/src/front/print/index.ts +40 -0
  355. package/src/front/print/layout.ts +87 -0
  356. package/src/front/print/template.ts +448 -0
  357. package/src/front/runes.ts +267 -0
  358. package/src/front/stores.ts +98 -0
  359. package/src/front/typescript.ts +178 -0
  360. package/src/front/validate/anchors.ts +54 -0
  361. package/src/front/validate/index.ts +174 -0
  362. package/src/front/validate/legacy.ts +119 -0
  363. package/src/front/validate/report.ts +38 -0
  364. package/src/front/validate/template.ts +549 -0
  365. package/src/front/wording.ts +112 -0
  366. package/src/shared/format.ts +8 -0
  367. package/store.d.ts +2 -0
  368. package/svelte-html.d.ts +53 -0
  369. package/transition.d.ts +2 -0
  370. package/types/compiler/interfaces.d.ts +2 -0
  371. package/types/compiler/preprocess.d.ts +2 -0
  372. package/types/index.d.ts +1453 -0
  373. package/README.md +0 -3
@@ -0,0 +1,549 @@
1
+ import type * as AST from '../ast.ts';
2
+ import { fail } from '../diagnostics.ts';
3
+ import { extractIgnores } from '../ignores.ts';
4
+ import { CompileError } from 'vigla/compiler';
5
+ import { bidirectionalRun } from '../parse/characters.ts';
6
+ import { stopped, type Anchors } from './anchors.ts';
7
+ import { isVoid } from '../parse/html.ts';
8
+ import type { Report } from './report.ts';
9
+
10
+ const bidirectional = bidirectionalRun;
11
+
12
+ const componentAttributes = new Set([
13
+ 'Attribute',
14
+ 'SpreadAttribute',
15
+ 'LetDirective',
16
+ 'OnDirective',
17
+ 'BindDirective',
18
+ 'AttachTag'
19
+ ]);
20
+
21
+ const constParents = new Set([
22
+ 'IfBlock',
23
+ 'SvelteFragment',
24
+ 'Component',
25
+ 'SvelteComponent',
26
+ 'EachBlock',
27
+ 'AwaitBlock',
28
+ 'SnippetBlock',
29
+ 'SvelteBoundary',
30
+ 'KeyBlock'
31
+ ]);
32
+
33
+ const svgNames = new Set([
34
+ 'altGlyph',
35
+ 'altGlyphDef',
36
+ 'altGlyphItem',
37
+ 'animate',
38
+ 'animateColor',
39
+ 'animateMotion',
40
+ 'animateTransform',
41
+ 'circle',
42
+ 'clipPath',
43
+ 'color-profile',
44
+ 'cursor',
45
+ 'defs',
46
+ 'desc',
47
+ 'discard',
48
+ 'ellipse',
49
+ 'feBlend',
50
+ 'feColorMatrix',
51
+ 'feComponentTransfer',
52
+ 'feComposite',
53
+ 'feConvolveMatrix',
54
+ 'feDiffuseLighting',
55
+ 'feDisplacementMap',
56
+ 'feDistantLight',
57
+ 'feDropShadow',
58
+ 'feFlood',
59
+ 'feFuncA',
60
+ 'feFuncB',
61
+ 'feFuncG',
62
+ 'feFuncR',
63
+ 'feGaussianBlur',
64
+ 'feImage',
65
+ 'feMerge',
66
+ 'feMergeNode',
67
+ 'feMorphology',
68
+ 'feOffset',
69
+ 'fePointLight',
70
+ 'feSpecularLighting',
71
+ 'feSpotLight',
72
+ 'feTile',
73
+ 'feTurbulence',
74
+ 'filter',
75
+ 'font',
76
+ 'font-face',
77
+ 'font-face-format',
78
+ 'font-face-name',
79
+ 'font-face-src',
80
+ 'font-face-uri',
81
+ 'foreignObject',
82
+ 'g',
83
+ 'glyph',
84
+ 'glyphRef',
85
+ 'hatch',
86
+ 'hatchpath',
87
+ 'hkern',
88
+ 'image',
89
+ 'line',
90
+ 'linearGradient',
91
+ 'marker',
92
+ 'mask',
93
+ 'mesh',
94
+ 'meshgradient',
95
+ 'meshpatch',
96
+ 'meshrow',
97
+ 'metadata',
98
+ 'missing-glyph',
99
+ 'mpath',
100
+ 'path',
101
+ 'pattern',
102
+ 'polygon',
103
+ 'polyline',
104
+ 'radialGradient',
105
+ 'rect',
106
+ 'set',
107
+ 'solidcolor',
108
+ 'stop',
109
+ 'svg',
110
+ 'switch',
111
+ 'symbol',
112
+ 'text',
113
+ 'textPath',
114
+ 'tref',
115
+ 'tspan',
116
+ 'unknown',
117
+ 'use',
118
+ 'view',
119
+ 'vkern'
120
+ ]);
121
+
122
+ const mathmlNames = new Set([
123
+ 'annotation',
124
+ 'annotation-xml',
125
+ 'maction',
126
+ 'math',
127
+ 'merror',
128
+ 'mfrac',
129
+ 'mi',
130
+ 'mmultiscripts',
131
+ 'mn',
132
+ 'mo',
133
+ 'mover',
134
+ 'mpadded',
135
+ 'mphantom',
136
+ 'mprescripts',
137
+ 'mroot',
138
+ 'mrow',
139
+ 'ms',
140
+ 'mspace',
141
+ 'msqrt',
142
+ 'mstyle',
143
+ 'msub',
144
+ 'msubsup',
145
+ 'msup',
146
+ 'mtable',
147
+ 'mtd',
148
+ 'mtext',
149
+ 'mtr',
150
+ 'munder',
151
+ 'munderover',
152
+ 'semantics'
153
+ ]);
154
+
155
+ type Parent = AST.TemplateNode | AST.Root;
156
+
157
+ const boundaryAttributes = new Set(['onerror', 'failed', 'pending']);
158
+
159
+ function isExpressionValue(value: AST.AttributeValue): boolean {
160
+ return (
161
+ value !== true &&
162
+ (!Array.isArray(value) || (value.length === 1 && value[0]?.type === 'ExpressionTag'))
163
+ );
164
+ }
165
+
166
+ function customElement(node: AST.ElementLike): boolean {
167
+ return (
168
+ node.type === 'RegularElement' &&
169
+ (node.name.includes('-') ||
170
+ node.attributes.some(
171
+ (attribute) => attribute.type === 'Attribute' && attribute.name === 'is'
172
+ ))
173
+ );
174
+ }
175
+
176
+ export class Template {
177
+ readonly source: string;
178
+ readonly report: Report;
179
+ readonly anchors: Anchors;
180
+ #claimed = 0;
181
+
182
+ constructor(source: string, report: Report, anchors: Anchors) {
183
+ this.source = source;
184
+ this.report = report;
185
+ this.anchors = anchors;
186
+ }
187
+
188
+ claim(owner: object): void {
189
+ const warnings = this.report.warnings;
190
+ if (this.#claimed === warnings.length) return;
191
+ this.anchors.warn(owner, warnings.slice(this.#claimed));
192
+ this.#claimed = warnings.length;
193
+ }
194
+
195
+ walk(root: AST.Root): void {
196
+ try {
197
+ this.fragment(root.fragment, root);
198
+ } catch (error) {
199
+ if (error !== stopped) throw error;
200
+ }
201
+ }
202
+
203
+ visit(node: AST.TemplateNode, owner: Parent): void {
204
+ try {
205
+ this.node(node, owner);
206
+ } catch (error) {
207
+ if (error !== stopped) {
208
+ if (!(error instanceof CompileError)) throw error;
209
+ this.claim(node);
210
+ this.anchors.fail(node, error.diagnostic);
211
+ }
212
+ throw stopped;
213
+ }
214
+ this.claim(node);
215
+ }
216
+
217
+ fragment(fragment: AST.Fragment | null | undefined, owner: Parent): void {
218
+ if (!fragment) return;
219
+ this.claim(owner);
220
+ const comments: AST.Comment[] = [];
221
+ let bidiIgnored = false;
222
+ for (const node of fragment.nodes) {
223
+ if (node.type === 'Comment') {
224
+ comments.push(node);
225
+ bidiIgnored ||= extractIgnores(node.start + 4, node.data).codes.includes(
226
+ 'bidirectional_control_characters'
227
+ );
228
+ continue;
229
+ }
230
+ if (node.type === 'Text') {
231
+ if (!bidiIgnored) this.text(node);
232
+ this.claim(node);
233
+ continue;
234
+ }
235
+ const codes = comments
236
+ .splice(0)
237
+ .flatMap((comment) => extractIgnores(comment.start + 4, comment.data).codes);
238
+ if (codes.length > 0) this.report.push(codes);
239
+ this.visit(node, owner);
240
+ if (codes.length > 0) this.report.pop();
241
+ }
242
+ }
243
+
244
+ opening(node: AST.Located, expected: string): void {
245
+ if (this.source[node.start + 1] !== expected) {
246
+ fail(
247
+ 'block_unexpected_character',
248
+ { start: node.start, end: node.start + 5 },
249
+ { character: expected }
250
+ );
251
+ }
252
+ }
253
+
254
+ notEmpty(fragment: AST.Fragment | null | undefined): void {
255
+ const only = fragment?.nodes[0];
256
+ if (fragment?.nodes.length === 1 && only?.type === 'Text' && !only.raw.trim()) {
257
+ this.report.warn('block_empty', only);
258
+ }
259
+ }
260
+
261
+ text(node: AST.Text): void {
262
+ for (const match of node.data.matchAll(bidirectional)) {
263
+ const start = match.index + node.start;
264
+ this.report.warn('bidirectional_control_characters', { start, end: start + match[0].length });
265
+ }
266
+ }
267
+
268
+ clause(node: AST.Pattern | null, keyword: string): void {
269
+ if (node === null) return;
270
+ const start = node.start as number;
271
+ const match = this.source
272
+ .substring(start - 10, start)
273
+ .match(new RegExp(`{(\\s*):${keyword}\\s+$`));
274
+ if (match && match[1] !== '') {
275
+ fail('block_unexpected_character', { start: start - 10, end: start }, { character: ':' });
276
+ }
277
+ }
278
+
279
+ node(node: AST.TemplateNode, parent: Parent): void {
280
+ switch (node.type) {
281
+ case 'IfBlock':
282
+ this.notEmpty(node.consequent);
283
+ this.notEmpty(node.alternate);
284
+ this.opening(node, node.elseif ? ':' : '#');
285
+ this.fragment(node.consequent, node);
286
+ this.fragment(node.alternate, node);
287
+ return;
288
+ case 'EachBlock':
289
+ this.notEmpty(node.body);
290
+ this.notEmpty(node.fallback);
291
+ this.opening(node, '#');
292
+ if (node.key !== undefined && node.context === null) {
293
+ const keyed =
294
+ node.key.type !== 'Identifier' || !node.index || node.key.name !== node.index;
295
+ if (keyed) fail('each_key_without_as', node.key);
296
+ }
297
+ this.fragment(node.body, node);
298
+ this.fragment(node.fallback, node);
299
+ return;
300
+ case 'AwaitBlock':
301
+ this.notEmpty(node.pending);
302
+ this.notEmpty(node.then);
303
+ this.notEmpty(node.catch);
304
+ this.opening(node, '#');
305
+ this.clause(node.value, 'then');
306
+ this.clause(node.error, 'catch');
307
+ this.fragment(node.pending, node);
308
+ this.fragment(node.then, node);
309
+ this.fragment(node.catch, node);
310
+ return;
311
+ case 'KeyBlock':
312
+ this.notEmpty(node.fragment);
313
+ this.opening(node, '#');
314
+ this.fragment(node.fragment, node);
315
+ return;
316
+ case 'SnippetBlock':
317
+ this.notEmpty(node.body);
318
+ this.opening(node, '#');
319
+ for (const parameter of node.parameters) {
320
+ if (parameter.type === 'RestElement') fail('snippet_invalid_rest_parameter', parameter);
321
+ }
322
+ this.fragment(node.body, node);
323
+ return;
324
+ case 'ConstTag':
325
+ this.opening(node, '@');
326
+ this.constTag(node, parent);
327
+ return;
328
+ case 'HtmlTag':
329
+ case 'DebugTag':
330
+ this.opening(node, '@');
331
+ return;
332
+ case 'RenderTag':
333
+ this.opening(node, '@');
334
+ this.renderTag(node);
335
+ return;
336
+ case 'ExpressionTag':
337
+ case 'DeclarationTag':
338
+ case 'Text':
339
+ case 'Comment':
340
+ return;
341
+ default:
342
+ this.element(node);
343
+ }
344
+ }
345
+
346
+ constTag(node: AST.ConstTag, parent: Parent): void {
347
+ const allowed =
348
+ constParents.has(parent.type) ||
349
+ ((parent.type === 'RegularElement' || parent.type === 'SvelteElement') &&
350
+ parent.attributes.some(
351
+ (attribute) => attribute.type === 'Attribute' && attribute.name === 'slot'
352
+ ));
353
+ if (!allowed) fail('const_tag_invalid_placement', node);
354
+ }
355
+
356
+ renderTag(node: AST.RenderTag): void {
357
+ const call =
358
+ node.expression.type === 'ChainExpression' ? node.expression.expression : node.expression;
359
+ const callee = (
360
+ call as { callee: { type: string; property?: { type: string; name?: string } } }
361
+ ).callee;
362
+ if (
363
+ callee.type === 'MemberExpression' &&
364
+ callee.property?.type === 'Identifier' &&
365
+ ['bind', 'apply', 'call'].includes(callee.property.name ?? '')
366
+ ) {
367
+ fail('render_tag_invalid_call_expression', node);
368
+ }
369
+ }
370
+
371
+ element(node: AST.ElementLike): void {
372
+ switch (node.type) {
373
+ case 'Component':
374
+ case 'SvelteComponent':
375
+ case 'SvelteSelf':
376
+ for (const attribute of node.attributes) {
377
+ if (!componentAttributes.has(attribute.type))
378
+ fail('component_invalid_directive', attribute);
379
+ if (attribute.type === 'Attribute') {
380
+ this.attribute(attribute, node);
381
+ this.colon(attribute);
382
+ } else if (attribute.type === 'BindDirective') {
383
+ this.bindParens(attribute);
384
+ }
385
+ }
386
+ break;
387
+ case 'RegularElement':
388
+ case 'SvelteElement':
389
+ this.elementAttributes(node);
390
+ if (node.type === 'RegularElement') this.regular(node);
391
+ break;
392
+ case 'TitleElement':
393
+ for (const attribute of node.attributes) fail('title_illegal_attribute', attribute);
394
+ for (const child of node.fragment.nodes) {
395
+ if (child.type !== 'Text' && child.type !== 'ExpressionTag')
396
+ fail('title_invalid_content', child);
397
+ }
398
+ break;
399
+ case 'SvelteHead':
400
+ for (const attribute of node.attributes) fail('svelte_head_illegal_attribute', attribute);
401
+ break;
402
+ case 'SvelteBoundary':
403
+ for (const attribute of node.attributes) {
404
+ if (attribute.type !== 'Attribute' || !boundaryAttributes.has(attribute.name)) {
405
+ fail('svelte_boundary_invalid_attribute', attribute);
406
+ }
407
+ const value = attribute.value;
408
+ if (
409
+ value === true ||
410
+ (Array.isArray(value) && (value.length !== 1 || value[0]?.type !== 'ExpressionTag'))
411
+ ) {
412
+ fail('svelte_boundary_invalid_attribute_value', attribute);
413
+ }
414
+ }
415
+ break;
416
+ case 'SvelteBody':
417
+ this.childless(node);
418
+ for (const attribute of node.attributes) {
419
+ const event =
420
+ attribute.type === 'Attribute' &&
421
+ attribute.name.startsWith('on') &&
422
+ isExpressionValue(attribute.value);
423
+ if (!event && (attribute.type === 'SpreadAttribute' || attribute.type === 'Attribute')) {
424
+ fail('svelte_body_illegal_attribute', attribute);
425
+ }
426
+ }
427
+ break;
428
+ case 'SvelteWindow':
429
+ case 'SvelteDocument':
430
+ this.childless(node);
431
+ for (const attribute of node.attributes) {
432
+ const event =
433
+ attribute.type === 'Attribute' &&
434
+ attribute.name.startsWith('on') &&
435
+ isExpressionValue(attribute.value);
436
+ if (!event && (attribute.type === 'SpreadAttribute' || attribute.type === 'Attribute')) {
437
+ fail('illegal_element_attribute', attribute, { name: node.name });
438
+ }
439
+ }
440
+ break;
441
+ default:
442
+ break;
443
+ }
444
+ this.fragment(node.fragment, node);
445
+ }
446
+
447
+ childless(node: AST.ElementLike): void {
448
+ const nodes = node.fragment.nodes;
449
+ const first = nodes[0];
450
+ const last = nodes.at(-1);
451
+ if (first !== undefined && last !== undefined) {
452
+ fail(
453
+ 'svelte_meta_invalid_content',
454
+ { start: first.start, end: last.end },
455
+ { name: node.name }
456
+ );
457
+ }
458
+ }
459
+
460
+ colon(attribute: AST.Attribute): void {
461
+ const name = attribute.name;
462
+ if (
463
+ name.includes(':') &&
464
+ !name.startsWith('xmlns:') &&
465
+ !name.startsWith('xlink:') &&
466
+ !name.startsWith('xml:')
467
+ ) {
468
+ this.report.warn('attribute_illegal_colon', attribute);
469
+ }
470
+ }
471
+
472
+ elementAttributes(node: AST.ElementLike): void {
473
+ for (const attribute of node.attributes) {
474
+ if (attribute.type === 'Attribute') {
475
+ this.attribute(attribute, node);
476
+ this.colon(attribute);
477
+ } else if (attribute.type === 'StyleDirective') {
478
+ const modifiers = attribute.modifiers;
479
+ if (modifiers.length > 1 || (modifiers.length > 0 && modifiers[0] !== 'important')) {
480
+ fail('style_directive_invalid_modifier', attribute);
481
+ }
482
+ } else if (attribute.type === 'BindDirective') {
483
+ this.bindParens(attribute);
484
+ }
485
+ }
486
+ }
487
+
488
+ bindParens(attribute: AST.Directive): void {
489
+ const expression = attribute.expression;
490
+ if (expression?.type !== 'SequenceExpression') return;
491
+ const comments = (expression as unknown as { leadingComments?: AST.Located[] }).leadingComments;
492
+ const first = comments?.at(0)?.start;
493
+ const last = comments?.at(-1)?.end;
494
+ for (let index = (expression.start as number) - 1; this.source[index] !== '{'; index--) {
495
+ const inComment =
496
+ first !== undefined && last !== undefined && index <= last && index >= first;
497
+ if (this.source[index] === '(' && !inComment) {
498
+ fail('bind_invalid_parens', attribute, { name: attribute.name });
499
+ }
500
+ }
501
+ }
502
+
503
+ regular(node: AST.ElementLike): void {
504
+ if (node.name === 'textarea' && node.fragment.nodes.length > 0) {
505
+ for (const attribute of node.attributes) {
506
+ if (attribute.type === 'Attribute' && attribute.name === 'value')
507
+ fail('textarea_invalid_content', node);
508
+ }
509
+ }
510
+ const local = node.name.replace(/[a-zA-Z-]*:/g, '');
511
+ if (
512
+ this.source[node.end - 2] === '/' &&
513
+ !isVoid(local) &&
514
+ !svgNames.has(local) &&
515
+ !mathmlNames.has(local)
516
+ ) {
517
+ this.report.warn('element_invalid_self_closing_tag', node, { name: node.name });
518
+ }
519
+ }
520
+
521
+ attribute(attribute: AST.Attribute, owner: AST.ElementLike): void {
522
+ const value = attribute.value;
523
+ if (Array.isArray(value)) {
524
+ for (const part of value) if (part.type === 'Text') this.text(part);
525
+ }
526
+ const component =
527
+ owner.type === 'Component' || owner.type === 'SvelteComponent' || owner.type === 'SvelteSelf';
528
+ if (
529
+ Array.isArray(value) &&
530
+ value.length === 1 &&
531
+ value[0]?.type === 'ExpressionTag' &&
532
+ (component || customElement(owner))
533
+ ) {
534
+ this.report.warn('attribute_quoted', attribute);
535
+ }
536
+ if (Array.isArray(value) && value.length > 1 && value.at(-1)?.end === attribute.end) {
537
+ fail('attribute_unquoted_sequence', attribute);
538
+ }
539
+ const only = Array.isArray(value) ? (value.length === 1 ? value[0] : undefined) : value;
540
+ if (only === undefined || only === true || only.type !== 'ExpressionTag') return;
541
+ const expression = only.expression;
542
+ if (expression.type !== 'SequenceExpression') return;
543
+ for (let index = (expression.start as number) - 1; index > 0; index--) {
544
+ const char = this.source[index];
545
+ if (char === '(') break;
546
+ if (char === '{') fail('attribute_invalid_sequence_expression', expression);
547
+ }
548
+ }
549
+ }
@@ -0,0 +1,112 @@
1
+ import { warningCodes as core, type Catalog, type Wording } from 'vigla/compiler';
2
+
3
+ const errors: Catalog = {
4
+ import_svelte_internal_forbidden: [
5
+ "Imports of `svelte/internal/*` are forbidden. It contains private runtime code which is subject to change without notice. If you're importing from `svelte/internal/*` to work around a limitation of Svelte, please open an issue at https://github.com/sveltejs/svelte and explain your use case"
6
+ ],
7
+ props_illegal_name: [
8
+ 'Declaring or accessing a prop starting with `$$` is illegal (they are reserved for Svelte internals)'
9
+ ],
10
+ store_invalid_subscription_module: ['Cannot reference store value outside a `.svelte` file'],
11
+ typescript_invalid_feature: [
12
+ 'TypeScript language features like %feature% are not natively supported, and their use is generally discouraged. Outside of `<script>` tags, these features are not supported. For use within `<script>` tags, you will need to use a preprocessor to convert it to JavaScript before it gets passed to the Svelte compiler. If you are using `vitePreprocess`, make sure to specifically enable preprocessing script tags (`vitePreprocess({ script: true })`)'
13
+ ],
14
+ const_tag_invalid_placement: [
15
+ '`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary>` or `<Component>`'
16
+ ],
17
+ node_invalid_placement: [
18
+ "%message%. The browser will 'repair' the HTML (by moving, removing, or inserting elements) which breaks Svelte's assumptions about the structure of your components."
19
+ ],
20
+ svelte_body_illegal_attribute: [
21
+ '`<svelte:body>` does not support non-event attributes or spread attributes'
22
+ ],
23
+ svelte_boundary_invalid_attribute: [
24
+ 'Valid attributes on `<svelte:boundary>` are `onerror` and `failed`'
25
+ ],
26
+ svelte_boundary_invalid_attribute_value: ['Attribute value must be a non-string expression'],
27
+ svelte_component_invalid_this: ['Invalid component definition — must be an `{expression}`'],
28
+ svelte_component_missing_this: ["`<svelte:component>` must have a 'this' attribute"],
29
+ svelte_element_missing_this: ["`<svelte:element>` must have a 'this' attribute with a value"],
30
+ svelte_fragment_invalid_attribute: [
31
+ '`<svelte:fragment>` can only have a slot attribute and (optionally) a let: directive'
32
+ ],
33
+ svelte_fragment_invalid_placement: [
34
+ '`<svelte:fragment>` must be the direct child of a component'
35
+ ],
36
+ svelte_head_illegal_attribute: ['`<svelte:head>` cannot have attributes nor directives'],
37
+ svelte_meta_duplicate: ['A component can only have one `<%name%>` element'],
38
+ svelte_meta_invalid_content: ['<%name%> cannot have children'],
39
+ svelte_meta_invalid_placement: ['`<%name%>` tags cannot be inside elements or blocks'],
40
+ svelte_meta_invalid_tag: ['Valid `<svelte:...>` tag names are %list%'],
41
+ svelte_options_deprecated_tag: ['"tag" option is deprecated — use "customElement" instead'],
42
+ svelte_options_invalid_attribute: ['`<svelte:options>` can only receive static attributes'],
43
+ svelte_options_invalid_attribute_value: ['Value must be %list%, if specified'],
44
+ svelte_options_invalid_customelement: [
45
+ '"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }'
46
+ ],
47
+ svelte_options_invalid_customelement_props: [
48
+ '"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"'
49
+ ],
50
+ svelte_options_invalid_customelement_shadow: [
51
+ '"shadow" must be either "open", "none" or `ShadowRootInit` object.'
52
+ ],
53
+ svelte_options_invalid_tagname: ['Tag name must be lowercase and hyphenated'],
54
+ svelte_options_reserved_tagname: ['Tag name is reserved'],
55
+ svelte_options_unknown_attribute: ["`<svelte:options>` unknown attribute '%name%'"],
56
+ svelte_self_invalid_placement: [
57
+ '`<svelte:self>` components can only exist inside `{#if}` blocks, `{#each}` blocks, `{#snippet}` blocks or slots passed to components'
58
+ ]
59
+ };
60
+
61
+ const warnings: Catalog = {
62
+ options_removed_hydratable: [
63
+ 'The `hydratable` option has been removed. Svelte components are always hydratable now'
64
+ ],
65
+ custom_element_props_identifier: [
66
+ "Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option."
67
+ ],
68
+ legacy_component_creation: [
69
+ "Svelte 5 components are no longer classes. Instantiate them using `mount` or `hydrate` (imported from 'svelte') instead."
70
+ ],
71
+ attribute_illegal_colon: [
72
+ "Attributes should not contain ':' characters to prevent ambiguity with Svelte directives"
73
+ ],
74
+ attribute_quoted: [
75
+ "Quoted attributes on components and custom elements will be stringified in a future version of Svelte. If this isn't what you want, remove the quotes"
76
+ ],
77
+ svelte_component_deprecated: [
78
+ '`<svelte:component>` is deprecated in runes mode — components are dynamic by default'
79
+ ],
80
+ svelte_element_invalid_this: [
81
+ '`this` should be an `{expression}`. Using a string attribute value will cause an error in future versions of Svelte'
82
+ ],
83
+ svelte_self_deprecated: [
84
+ "`<svelte:self>` is deprecated — use self-imports (e.g. `import %name% from './%basename%'`) instead"
85
+ ]
86
+ };
87
+
88
+ const after: Readonly<Record<string, string>> = {
89
+ options_removed_hydratable: 'options_removed_enable_sourcemap',
90
+ attribute_illegal_colon: 'attribute_global_event_reference',
91
+ attribute_quoted: 'attribute_invalid_property_name'
92
+ };
93
+
94
+ function ordered(): string[] {
95
+ const codes = [...core];
96
+ for (const code of Object.keys(warnings)) {
97
+ if (codes.includes(code)) continue;
98
+ const anchor = after[code];
99
+ const at = anchor === undefined ? -1 : codes.indexOf(anchor);
100
+ if (at < 0) codes.push(code);
101
+ else codes.splice(at + 1, 0, code);
102
+ }
103
+ return codes;
104
+ }
105
+
106
+ export const wording: Wording = {
107
+ errors,
108
+ warnings,
109
+ name: (host) => `svelte:${host}`
110
+ };
111
+
112
+ export const warningCodes: readonly string[] = ordered();
@@ -0,0 +1,8 @@
1
+ import type { Format } from 'vigla/compiler';
2
+
3
+ export const format: Format = {
4
+ global: '__svelte',
5
+ meta: '__svelte_meta',
6
+ cssWrapper: 'svelte-css-wrapper',
7
+ htmlPolicy: 'svelte-trusted-html'
8
+ };
package/store.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /// <reference path="./types/index.d.ts" />
2
+ export {};