rnwind 0.0.1 → 0.0.2

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 (330) hide show
  1. package/lib/cjs/core/parser/animation.cjs +427 -0
  2. package/lib/cjs/core/parser/animation.cjs.map +1 -0
  3. package/lib/cjs/core/parser/animation.d.ts +126 -0
  4. package/lib/cjs/core/parser/border-dispatcher.cjs +180 -0
  5. package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -0
  6. package/lib/cjs/core/parser/border-dispatcher.d.ts +15 -0
  7. package/lib/cjs/core/parser/case-convert.cjs +15 -0
  8. package/lib/cjs/core/parser/case-convert.cjs.map +1 -0
  9. package/lib/cjs/core/parser/case-convert.d.ts +6 -0
  10. package/lib/cjs/core/parser/color-properties-dispatcher.cjs +84 -0
  11. package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -0
  12. package/lib/cjs/core/parser/color-properties-dispatcher.d.ts +19 -0
  13. package/lib/cjs/core/parser/color.cjs +164 -0
  14. package/lib/cjs/core/parser/color.cjs.map +1 -0
  15. package/lib/cjs/core/parser/color.d.ts +12 -0
  16. package/lib/cjs/core/parser/constants.cjs +21 -0
  17. package/lib/cjs/core/parser/constants.cjs.map +1 -0
  18. package/lib/cjs/core/parser/constants.d.ts +8 -0
  19. package/lib/cjs/core/parser/declaration.cjs +347 -0
  20. package/lib/cjs/core/parser/declaration.cjs.map +1 -0
  21. package/lib/cjs/core/parser/declaration.d.ts +15 -0
  22. package/lib/cjs/core/parser/gradient.cjs +132 -0
  23. package/lib/cjs/core/parser/gradient.cjs.map +1 -0
  24. package/lib/cjs/core/parser/gradient.d.ts +59 -0
  25. package/lib/cjs/core/parser/haptics.cjs +73 -0
  26. package/lib/cjs/core/parser/haptics.cjs.map +1 -0
  27. package/lib/cjs/core/parser/haptics.d.ts +47 -0
  28. package/lib/cjs/core/parser/index.d.ts +8 -0
  29. package/lib/cjs/core/parser/keyframes.cjs +95 -0
  30. package/lib/cjs/core/parser/keyframes.cjs.map +1 -0
  31. package/lib/cjs/core/parser/keyframes.d.ts +26 -0
  32. package/lib/cjs/core/parser/layout-dispatcher.cjs +100 -0
  33. package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -0
  34. package/lib/cjs/core/parser/layout-dispatcher.d.ts +14 -0
  35. package/lib/cjs/core/parser/length.cjs +96 -0
  36. package/lib/cjs/core/parser/length.cjs.map +1 -0
  37. package/lib/cjs/core/parser/length.d.ts +48 -0
  38. package/lib/cjs/core/parser/motion-dispatcher.cjs +77 -0
  39. package/lib/cjs/core/parser/motion-dispatcher.cjs.map +1 -0
  40. package/lib/cjs/core/parser/motion-dispatcher.d.ts +11 -0
  41. package/lib/cjs/core/parser/property.cjs +22 -0
  42. package/lib/cjs/core/parser/property.cjs.map +1 -0
  43. package/lib/cjs/core/parser/property.d.ts +8 -0
  44. package/lib/cjs/core/parser/safe-area.cjs +404 -0
  45. package/lib/cjs/core/parser/safe-area.cjs.map +1 -0
  46. package/lib/cjs/core/parser/safe-area.d.ts +39 -0
  47. package/lib/cjs/core/parser/selector.cjs +22 -0
  48. package/lib/cjs/core/parser/selector.cjs.map +1 -0
  49. package/lib/cjs/core/parser/selector.d.ts +11 -0
  50. package/lib/cjs/core/parser/shorthand.cjs +156 -0
  51. package/lib/cjs/core/parser/shorthand.cjs.map +1 -0
  52. package/lib/cjs/core/parser/shorthand.d.ts +61 -0
  53. package/lib/cjs/core/parser/text-truncate.cjs +78 -0
  54. package/lib/cjs/core/parser/text-truncate.cjs.map +1 -0
  55. package/lib/cjs/core/parser/text-truncate.d.ts +44 -0
  56. package/lib/cjs/core/parser/theme-vars.cjs +414 -0
  57. package/lib/cjs/core/parser/theme-vars.cjs.map +1 -0
  58. package/lib/cjs/core/parser/theme-vars.d.ts +61 -0
  59. package/lib/cjs/core/parser/tokens.cjs +304 -0
  60. package/lib/cjs/core/parser/tokens.cjs.map +1 -0
  61. package/lib/cjs/core/parser/tokens.d.ts +45 -0
  62. package/lib/cjs/core/parser/transform.cjs +198 -0
  63. package/lib/cjs/core/parser/transform.cjs.map +1 -0
  64. package/lib/cjs/core/parser/transform.d.ts +36 -0
  65. package/lib/cjs/core/parser/tw-parser.cjs +1567 -0
  66. package/lib/cjs/core/parser/tw-parser.cjs.map +1 -0
  67. package/lib/cjs/core/parser/tw-parser.d.ts +194 -0
  68. package/lib/cjs/core/parser/types.d.ts +37 -0
  69. package/lib/cjs/core/parser/typography-dispatcher.cjs +93 -0
  70. package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -0
  71. package/lib/cjs/core/parser/typography-dispatcher.d.ts +11 -0
  72. package/lib/cjs/core/parser/typography.cjs +97 -0
  73. package/lib/cjs/core/parser/typography.cjs.map +1 -0
  74. package/lib/cjs/core/parser/typography.d.ts +43 -0
  75. package/lib/cjs/core/style-builder/build-style.cjs +397 -0
  76. package/lib/cjs/core/style-builder/build-style.cjs.map +1 -0
  77. package/lib/cjs/core/style-builder/build-style.d.ts +54 -0
  78. package/lib/cjs/core/style-builder/index.d.ts +3 -0
  79. package/lib/cjs/core/style-builder/union-builder.cjs +326 -0
  80. package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -0
  81. package/lib/cjs/core/style-builder/union-builder.d.ts +128 -0
  82. package/lib/cjs/core/types.d.ts +14 -0
  83. package/lib/cjs/metro/dts.cjs +127 -0
  84. package/lib/cjs/metro/dts.cjs.map +1 -0
  85. package/lib/cjs/metro/dts.d.ts +16 -0
  86. package/lib/cjs/metro/index.cjs +19 -0
  87. package/lib/cjs/metro/index.cjs.map +1 -0
  88. package/lib/cjs/metro/index.d.ts +9 -0
  89. package/lib/cjs/metro/resolver.cjs +47 -0
  90. package/lib/cjs/metro/resolver.cjs.map +1 -0
  91. package/lib/cjs/metro/resolver.d.ts +22 -0
  92. package/lib/cjs/metro/state.cjs +251 -0
  93. package/lib/cjs/metro/state.cjs.map +1 -0
  94. package/lib/cjs/metro/state.d.ts +72 -0
  95. package/lib/cjs/metro/transform-ast.cjs +1255 -0
  96. package/lib/cjs/metro/transform-ast.cjs.map +1 -0
  97. package/lib/cjs/metro/transform-ast.d.ts +73 -0
  98. package/lib/cjs/metro/transformer.cjs +345 -0
  99. package/lib/cjs/metro/transformer.cjs.map +1 -0
  100. package/lib/cjs/metro/transformer.d.ts +47 -0
  101. package/lib/cjs/metro/warn-unknown-classes.cjs +86 -0
  102. package/lib/cjs/metro/warn-unknown-classes.cjs.map +1 -0
  103. package/lib/cjs/metro/warn-unknown-classes.d.ts +21 -0
  104. package/lib/cjs/metro/with-config.cjs +196 -0
  105. package/lib/cjs/metro/with-config.cjs.map +1 -0
  106. package/lib/cjs/metro/with-config.d.ts +57 -0
  107. package/lib/cjs/runtime/chain-handlers.cjs +37 -0
  108. package/lib/cjs/runtime/chain-handlers.cjs.map +1 -0
  109. package/lib/cjs/runtime/chain-handlers.d.ts +33 -0
  110. package/lib/cjs/runtime/components/rnwind-provider.cjs +98 -0
  111. package/lib/cjs/runtime/components/rnwind-provider.cjs.map +1 -0
  112. package/lib/cjs/runtime/components/rnwind-provider.d.ts +84 -0
  113. package/lib/cjs/runtime/gradient-types.d.ts +58 -0
  114. package/lib/cjs/runtime/haptics.cjs +113 -0
  115. package/lib/cjs/runtime/haptics.cjs.map +1 -0
  116. package/lib/cjs/runtime/haptics.d.ts +48 -0
  117. package/lib/cjs/runtime/hooks/use-css.cjs +21 -0
  118. package/lib/cjs/runtime/hooks/use-css.cjs.map +1 -0
  119. package/lib/cjs/runtime/hooks/use-css.d.ts +11 -0
  120. package/lib/cjs/runtime/hooks/use-interact.cjs +46 -0
  121. package/lib/cjs/runtime/hooks/use-interact.cjs.map +1 -0
  122. package/lib/cjs/runtime/hooks/use-interact.d.ts +42 -0
  123. package/lib/cjs/runtime/hooks/use-scheme.cjs +68 -0
  124. package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -0
  125. package/lib/cjs/runtime/hooks/use-scheme.d.ts +34 -0
  126. package/lib/cjs/runtime/index.cjs +45 -0
  127. package/lib/cjs/runtime/index.cjs.map +1 -0
  128. package/lib/cjs/runtime/index.d.ts +27 -0
  129. package/lib/cjs/runtime/interactive-box.cjs +35 -0
  130. package/lib/cjs/runtime/interactive-box.cjs.map +1 -0
  131. package/lib/cjs/runtime/interactive-box.d.ts +40 -0
  132. package/lib/cjs/runtime/lookup-css.cjs +542 -0
  133. package/lib/cjs/runtime/lookup-css.cjs.map +1 -0
  134. package/lib/cjs/runtime/lookup-css.d.ts +164 -0
  135. package/lib/cjs/runtime/types.d.ts +29 -0
  136. package/lib/cjs/testing/index.cjs +367 -0
  137. package/lib/cjs/testing/index.cjs.map +1 -0
  138. package/lib/cjs/testing/index.d.ts +145 -0
  139. package/lib/esm/core/parser/animation.d.ts +126 -0
  140. package/lib/esm/core/parser/animation.mjs +408 -0
  141. package/lib/esm/core/parser/animation.mjs.map +1 -0
  142. package/lib/esm/core/parser/border-dispatcher.d.ts +15 -0
  143. package/lib/esm/core/parser/border-dispatcher.mjs +178 -0
  144. package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -0
  145. package/lib/esm/core/parser/case-convert.d.ts +6 -0
  146. package/lib/esm/core/parser/case-convert.mjs +13 -0
  147. package/lib/esm/core/parser/case-convert.mjs.map +1 -0
  148. package/lib/esm/core/parser/color-properties-dispatcher.d.ts +19 -0
  149. package/lib/esm/core/parser/color-properties-dispatcher.mjs +82 -0
  150. package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -0
  151. package/lib/esm/core/parser/color.d.ts +12 -0
  152. package/lib/esm/core/parser/color.mjs +162 -0
  153. package/lib/esm/core/parser/color.mjs.map +1 -0
  154. package/lib/esm/core/parser/constants.d.ts +8 -0
  155. package/lib/esm/core/parser/constants.mjs +13 -0
  156. package/lib/esm/core/parser/constants.mjs.map +1 -0
  157. package/lib/esm/core/parser/declaration.d.ts +15 -0
  158. package/lib/esm/core/parser/declaration.mjs +345 -0
  159. package/lib/esm/core/parser/declaration.mjs.map +1 -0
  160. package/lib/esm/core/parser/gradient.d.ts +59 -0
  161. package/lib/esm/core/parser/gradient.mjs +130 -0
  162. package/lib/esm/core/parser/gradient.mjs.map +1 -0
  163. package/lib/esm/core/parser/haptics.d.ts +47 -0
  164. package/lib/esm/core/parser/haptics.mjs +71 -0
  165. package/lib/esm/core/parser/haptics.mjs.map +1 -0
  166. package/lib/esm/core/parser/index.d.ts +8 -0
  167. package/lib/esm/core/parser/keyframes.d.ts +26 -0
  168. package/lib/esm/core/parser/keyframes.mjs +91 -0
  169. package/lib/esm/core/parser/keyframes.mjs.map +1 -0
  170. package/lib/esm/core/parser/layout-dispatcher.d.ts +14 -0
  171. package/lib/esm/core/parser/layout-dispatcher.mjs +98 -0
  172. package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -0
  173. package/lib/esm/core/parser/length.d.ts +48 -0
  174. package/lib/esm/core/parser/length.mjs +90 -0
  175. package/lib/esm/core/parser/length.mjs.map +1 -0
  176. package/lib/esm/core/parser/motion-dispatcher.d.ts +11 -0
  177. package/lib/esm/core/parser/motion-dispatcher.mjs +75 -0
  178. package/lib/esm/core/parser/motion-dispatcher.mjs.map +1 -0
  179. package/lib/esm/core/parser/property.d.ts +8 -0
  180. package/lib/esm/core/parser/property.mjs +20 -0
  181. package/lib/esm/core/parser/property.mjs.map +1 -0
  182. package/lib/esm/core/parser/safe-area.d.ts +39 -0
  183. package/lib/esm/core/parser/safe-area.mjs +402 -0
  184. package/lib/esm/core/parser/safe-area.mjs.map +1 -0
  185. package/lib/esm/core/parser/selector.d.ts +11 -0
  186. package/lib/esm/core/parser/selector.mjs +20 -0
  187. package/lib/esm/core/parser/selector.mjs.map +1 -0
  188. package/lib/esm/core/parser/shorthand.d.ts +61 -0
  189. package/lib/esm/core/parser/shorthand.mjs +148 -0
  190. package/lib/esm/core/parser/shorthand.mjs.map +1 -0
  191. package/lib/esm/core/parser/text-truncate.d.ts +44 -0
  192. package/lib/esm/core/parser/text-truncate.mjs +75 -0
  193. package/lib/esm/core/parser/text-truncate.mjs.map +1 -0
  194. package/lib/esm/core/parser/theme-vars.d.ts +61 -0
  195. package/lib/esm/core/parser/theme-vars.mjs +409 -0
  196. package/lib/esm/core/parser/theme-vars.mjs.map +1 -0
  197. package/lib/esm/core/parser/tokens.d.ts +45 -0
  198. package/lib/esm/core/parser/tokens.mjs +298 -0
  199. package/lib/esm/core/parser/tokens.mjs.map +1 -0
  200. package/lib/esm/core/parser/transform.d.ts +36 -0
  201. package/lib/esm/core/parser/transform.mjs +193 -0
  202. package/lib/esm/core/parser/transform.mjs.map +1 -0
  203. package/lib/esm/core/parser/tw-parser.d.ts +194 -0
  204. package/lib/esm/core/parser/tw-parser.mjs +1565 -0
  205. package/lib/esm/core/parser/tw-parser.mjs.map +1 -0
  206. package/lib/esm/core/parser/types.d.ts +37 -0
  207. package/lib/esm/core/parser/typography-dispatcher.d.ts +11 -0
  208. package/lib/esm/core/parser/typography-dispatcher.mjs +91 -0
  209. package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -0
  210. package/lib/esm/core/parser/typography.d.ts +43 -0
  211. package/lib/esm/core/parser/typography.mjs +91 -0
  212. package/lib/esm/core/parser/typography.mjs.map +1 -0
  213. package/lib/esm/core/style-builder/build-style.d.ts +54 -0
  214. package/lib/esm/core/style-builder/build-style.mjs +395 -0
  215. package/lib/esm/core/style-builder/build-style.mjs.map +1 -0
  216. package/lib/esm/core/style-builder/index.d.ts +3 -0
  217. package/lib/esm/core/style-builder/union-builder.d.ts +128 -0
  218. package/lib/esm/core/style-builder/union-builder.mjs +324 -0
  219. package/lib/esm/core/style-builder/union-builder.mjs.map +1 -0
  220. package/lib/esm/core/types.d.ts +14 -0
  221. package/lib/esm/metro/dts.d.ts +16 -0
  222. package/lib/esm/metro/dts.mjs +125 -0
  223. package/lib/esm/metro/dts.mjs.map +1 -0
  224. package/lib/esm/metro/index.d.ts +9 -0
  225. package/lib/esm/metro/index.mjs +6 -0
  226. package/lib/esm/metro/index.mjs.map +1 -0
  227. package/lib/esm/metro/resolver.d.ts +22 -0
  228. package/lib/esm/metro/resolver.mjs +43 -0
  229. package/lib/esm/metro/resolver.mjs.map +1 -0
  230. package/lib/esm/metro/state.d.ts +72 -0
  231. package/lib/esm/metro/state.mjs +243 -0
  232. package/lib/esm/metro/state.mjs.map +1 -0
  233. package/lib/esm/metro/transform-ast.d.ts +73 -0
  234. package/lib/esm/metro/transform-ast.mjs +1234 -0
  235. package/lib/esm/metro/transform-ast.mjs.map +1 -0
  236. package/lib/esm/metro/transformer.d.ts +47 -0
  237. package/lib/esm/metro/transformer.mjs +322 -0
  238. package/lib/esm/metro/transformer.mjs.map +1 -0
  239. package/lib/esm/metro/warn-unknown-classes.d.ts +21 -0
  240. package/lib/esm/metro/warn-unknown-classes.mjs +84 -0
  241. package/lib/esm/metro/warn-unknown-classes.mjs.map +1 -0
  242. package/lib/esm/metro/with-config.d.ts +57 -0
  243. package/lib/esm/metro/with-config.mjs +194 -0
  244. package/lib/esm/metro/with-config.mjs.map +1 -0
  245. package/lib/esm/runtime/chain-handlers.d.ts +33 -0
  246. package/lib/esm/runtime/chain-handlers.mjs +34 -0
  247. package/lib/esm/runtime/chain-handlers.mjs.map +1 -0
  248. package/lib/esm/runtime/components/rnwind-provider.d.ts +84 -0
  249. package/lib/esm/runtime/components/rnwind-provider.mjs +94 -0
  250. package/lib/esm/runtime/components/rnwind-provider.mjs.map +1 -0
  251. package/lib/esm/runtime/gradient-types.d.ts +58 -0
  252. package/lib/esm/runtime/haptics.d.ts +48 -0
  253. package/lib/esm/runtime/haptics.mjs +110 -0
  254. package/lib/esm/runtime/haptics.mjs.map +1 -0
  255. package/lib/esm/runtime/hooks/use-css.d.ts +11 -0
  256. package/lib/esm/runtime/hooks/use-css.mjs +19 -0
  257. package/lib/esm/runtime/hooks/use-css.mjs.map +1 -0
  258. package/lib/esm/runtime/hooks/use-interact.d.ts +42 -0
  259. package/lib/esm/runtime/hooks/use-interact.mjs +44 -0
  260. package/lib/esm/runtime/hooks/use-interact.mjs.map +1 -0
  261. package/lib/esm/runtime/hooks/use-scheme.d.ts +34 -0
  262. package/lib/esm/runtime/hooks/use-scheme.mjs +63 -0
  263. package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -0
  264. package/lib/esm/runtime/index.d.ts +27 -0
  265. package/lib/esm/runtime/index.mjs +18 -0
  266. package/lib/esm/runtime/index.mjs.map +1 -0
  267. package/lib/esm/runtime/interactive-box.d.ts +40 -0
  268. package/lib/esm/runtime/interactive-box.mjs +33 -0
  269. package/lib/esm/runtime/interactive-box.mjs.map +1 -0
  270. package/lib/esm/runtime/lookup-css.d.ts +164 -0
  271. package/lib/esm/runtime/lookup-css.mjs +531 -0
  272. package/lib/esm/runtime/lookup-css.mjs.map +1 -0
  273. package/lib/esm/runtime/types.d.ts +29 -0
  274. package/lib/esm/testing/index.d.ts +145 -0
  275. package/lib/esm/testing/index.mjs +344 -0
  276. package/lib/esm/testing/index.mjs.map +1 -0
  277. package/package.json +79 -13
  278. package/preset.css +1171 -0
  279. package/src/core/parser/animation.ts +404 -0
  280. package/src/core/parser/border-dispatcher.ts +176 -0
  281. package/src/core/parser/case-convert.ts +10 -0
  282. package/src/core/parser/color-properties-dispatcher.ts +78 -0
  283. package/src/core/parser/color.ts +157 -0
  284. package/src/core/parser/constants.ts +11 -0
  285. package/src/core/parser/declaration.ts +340 -0
  286. package/src/core/parser/gradient.ts +148 -0
  287. package/src/core/parser/haptics.ts +88 -0
  288. package/src/core/parser/index.ts +8 -0
  289. package/src/core/parser/keyframes.ts +84 -0
  290. package/src/core/parser/layout-dispatcher.ts +92 -0
  291. package/src/core/parser/length.ts +100 -0
  292. package/src/core/parser/motion-dispatcher.ts +89 -0
  293. package/src/core/parser/property.ts +15 -0
  294. package/src/core/parser/safe-area.ts +404 -0
  295. package/src/core/parser/selector.ts +17 -0
  296. package/src/core/parser/shorthand.ts +152 -0
  297. package/src/core/parser/text-truncate.ts +79 -0
  298. package/src/core/parser/theme-vars.ts +412 -0
  299. package/src/core/parser/tokens.ts +286 -0
  300. package/src/core/parser/transform.ts +195 -0
  301. package/src/core/parser/tw-parser.ts +1709 -0
  302. package/src/core/parser/types.ts +45 -0
  303. package/src/core/parser/typography-dispatcher.ts +83 -0
  304. package/src/core/parser/typography.ts +83 -0
  305. package/src/core/style-builder/build-style.ts +442 -0
  306. package/src/core/style-builder/index.ts +3 -0
  307. package/src/core/style-builder/union-builder.ts +328 -0
  308. package/src/core/types.ts +15 -0
  309. package/src/metro/dts.ts +128 -0
  310. package/src/metro/index.ts +9 -0
  311. package/src/metro/resolver.ts +42 -0
  312. package/src/metro/state.ts +257 -0
  313. package/src/metro/transform-ast.ts +1498 -0
  314. package/src/metro/transformer.ts +347 -0
  315. package/src/metro/warn-unknown-classes.ts +79 -0
  316. package/src/metro/with-config.ts +229 -0
  317. package/src/runtime/chain-handlers.ts +47 -0
  318. package/src/runtime/components/rnwind-provider.tsx +144 -0
  319. package/src/runtime/gradient-types.ts +60 -0
  320. package/src/runtime/haptics.ts +120 -0
  321. package/src/runtime/hooks/use-css.ts +16 -0
  322. package/src/runtime/hooks/use-interact.ts +65 -0
  323. package/src/runtime/hooks/use-scheme.ts +63 -0
  324. package/src/runtime/index.ts +54 -0
  325. package/src/runtime/interactive-box.tsx +57 -0
  326. package/src/runtime/lookup-css.ts +628 -0
  327. package/src/runtime/types.ts +32 -0
  328. package/src/testing/index.ts +507 -0
  329. package/src/types/tailwindcss-node.d.ts +33 -0
  330. package/src/index.ts +0 -1
@@ -0,0 +1,507 @@
1
+ /* eslint-disable sonarjs/no-unused-vars */
2
+ import type { File as BabelFile } from '@babel/types'
3
+ import { parse } from '@babel/parser'
4
+ import generateImport from '@babel/generator'
5
+ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
6
+ import { createRequire } from 'node:module'
7
+ import { tmpdir } from 'node:os'
8
+ import path from 'node:path'
9
+ import * as React from 'react'
10
+ import type {
11
+ render as testingLibraryRender,
12
+ renderHook as testingLibraryRenderHook,
13
+ RenderHookOptions,
14
+ } from '@testing-library/react-native'
15
+ import { configureRnwindState, resetRnwindState, transform as metroTransform } from '../metro'
16
+ import { __resetLookupCssState, lookupCss, registerAtoms } from '../runtime/lookup-css'
17
+ import type { Insets } from '../runtime/components/rnwind-provider'
18
+ import { RnwindProvider, useRnwind, useR_ } from '../runtime/components/rnwind-provider'
19
+ import { triggerHaptic, useMountHaptic } from '../runtime/haptics'
20
+ import type { OnHaptics } from '../core/parser/haptics'
21
+ import type { Scheme } from '../runtime/types'
22
+
23
+ // ────────────────────────────────────────────────────────────────────────
24
+ // Private constants
25
+ // ────────────────────────────────────────────────────────────────────────
26
+
27
+ /**
28
+ * Minimal theme every `renderWithCss` call defaults to. Ships the two
29
+ * conventional schemes so atoms carrying `dark:` / `light:` prefixes
30
+ * resolve without the caller having to craft a theme CSS string.
31
+ */
32
+ const DEFAULT_THEME_CSS = `@import 'tailwindcss';
33
+ @layer theme {
34
+ :root {
35
+ @variant light { --color-bg: #ffffff; --color-fg: #0a0a0a; }
36
+ @variant dark { --color-bg: #0a0a0a; --color-fg: #ffffff; }
37
+ }
38
+ }
39
+ `
40
+
41
+ /** `StyleSheet.create` stub the evaluated bundle calls — identity at test time. */
42
+ const BUNDLE_STYLE_SHEET = { create: <T>(styles: T): T => styles, hairlineWidth: 1 }
43
+
44
+ /** Stubbed interactive-state hook return matching `useInteract()`. */
45
+ const NOOP_INTERACT = {
46
+ state: undefined,
47
+ onPressIn: (): void => undefined,
48
+ onPressOut: (): void => undefined,
49
+ onFocus: (): void => undefined,
50
+ onBlur: (): void => undefined,
51
+ }
52
+
53
+ /**
54
+ * Identity chain helper matching `chainPress` / `chainFocus`. Returns a
55
+ * single callback that invokes every supplied handler in turn.
56
+ * @param handlers Handlers to chain.
57
+ * @returns Combined callback.
58
+ */
59
+ const NOOP_CHAIN =
60
+ (...handlers: ReadonlyArray<((...args: unknown[]) => unknown) | undefined>) =>
61
+ (...args: unknown[]): void => {
62
+ for (const handler of handlers) {
63
+ if (typeof handler === 'function') handler(...args)
64
+ }
65
+ }
66
+
67
+ // Synthesize a require rooted at the consumer's cwd so optional peer
68
+ // lookups (`@testing-library/react-native`, `esbuild`) resolve from THEIR
69
+ // node_modules, not rnwind's. A workspace-local rnwind install resolves
70
+ // through a different node_modules chain than the test cwd — we want the
71
+ // test's chain.
72
+ const localRequire: NodeRequire = createRequire(path.join(process.cwd(), 'package.json'))
73
+
74
+ const generate: typeof generateImport = (generateImport as { default?: typeof generateImport }).default ?? generateImport
75
+
76
+ /**
77
+ * Pre-loaded `@testing-library/react-native`. Resolved once at module
78
+ * init (not lazily per-call) because the testing library registers
79
+ * `beforeAll`/`afterEach` cleanup hooks on import — and Bun's test
80
+ * runner refuses to register lifecycle hooks from inside a running
81
+ * test body, which is where the first `renderWithCss` call lands.
82
+ */
83
+ const TESTING_LIBRARY: {
84
+ render: typeof testingLibraryRender
85
+ renderHook: typeof testingLibraryRenderHook
86
+ } = (() => {
87
+ try {
88
+ return localRequire('@testing-library/react-native') as {
89
+ render: typeof testingLibraryRender
90
+ renderHook: typeof testingLibraryRenderHook
91
+ }
92
+ } catch (error) {
93
+ throw new Error(
94
+ 'rnwind/testing: cannot load `@testing-library/react-native`. Add it to your dev dependencies. Underlying error: ' +
95
+ (error instanceof Error ? error.message : String(error)),
96
+ )
97
+ }
98
+ })()
99
+
100
+ // ────────────────────────────────────────────────────────────────────────
101
+ // Private helpers
102
+ // ────────────────────────────────────────────────────────────────────────
103
+
104
+ /**
105
+ * Scheme string typed to match what `<RnwindProvider>` accepts. Users
106
+ * who declare their own scheme names via `rnwind-types.d.ts` get them
107
+ * through `Scheme`; everyone else gets `'light' | 'dark' | string`.
108
+ */
109
+ type SchemeName = Scheme
110
+
111
+ /**
112
+ * Default lookup for the test process's `react-native` module. Users
113
+ * who run with a mocked `react-native` (via Bun's `mock.module` or
114
+ * Jest's `jest.mock`) get the mock here automatically.
115
+ * @returns React Native namespace bindings.
116
+ */
117
+ function resolveReactNative(): Record<string, unknown> {
118
+ return localRequire('react-native') as Record<string, unknown>
119
+ }
120
+
121
+ /**
122
+ * Compile JSX + TypeScript source to plain JS. Prefers Bun's built-in
123
+ * transpiler (fast, zero-dep); falls back to `esbuild` if running under
124
+ * Node (Jest users). Throws with an install hint if neither is available.
125
+ * @param source Source text to compile.
126
+ * @returns JavaScript suitable for `new Function(...)` evaluation.
127
+ */
128
+ function compileToJs(source: string): string {
129
+ const globalBun = (
130
+ globalThis as { Bun?: { Transpiler: new (options: unknown) => { transformSync: (text: string) => string } } }
131
+ ).Bun
132
+ if (globalBun?.Transpiler) {
133
+ return new globalBun.Transpiler({
134
+ loader: 'tsx',
135
+ tsconfig: JSON.stringify({ compilerOptions: { jsx: 'react', target: 'esnext' } }),
136
+ }).transformSync(source)
137
+ }
138
+ try {
139
+ const esbuild = localRequire('esbuild') as {
140
+ transformSync: (text: string, options: { loader: string; jsx: string; target?: string }) => { code: string }
141
+ }
142
+ return esbuild.transformSync(source, { loader: 'tsx', jsx: 'transform', target: 'esnext' }).code
143
+ } catch {
144
+ throw new Error(
145
+ 'rnwind/testing: cannot compile JSX. Run tests under Bun (which has a built-in transpiler) ' +
146
+ 'or install `esbuild` as a dev dependency for Node / Jest setups.',
147
+ )
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Evaluate the union `style.js` the ledger wrote during the transform
153
+ * so its `registerAtoms` call lands in the process-global registry.
154
+ * Strips the `react-native` + `rnwind` imports from the source and
155
+ * forwards local bindings into the evaluated closure.
156
+ * @param cacheDir The rnwind cache dir where the ledger writes bundles.
157
+ */
158
+ function evaluateStyleBundle(cacheDir: string): void {
159
+ const filePath = path.join(cacheDir, 'style.js')
160
+ if (!existsSync(filePath)) return
161
+ const body = readFileSync(filePath, 'utf8')
162
+ .replaceAll(/import \{ StyleSheet \} from 'react-native'\s*\n/g, '')
163
+ .replaceAll(/import \{[^}]+\} from 'rnwind'\s*\n/g, '')
164
+ // Bundle body is generated by rnwind itself — not user-controlled.
165
+ // eslint-disable-next-line sonarjs/code-eval
166
+ new Function('StyleSheet', 'registerAtoms', body)(BUNDLE_STYLE_SHEET, registerAtoms)
167
+ }
168
+
169
+ /**
170
+ * Evaluate the transformer's rewritten source as a standalone module:
171
+ * strip synthetic imports, forward `import ... from 'rnwind'` +
172
+ * `'react-native'` to local bindings, compile JSX via the compiler, and
173
+ * capture the default export.
174
+ * @param transformedSource Post-transformer source.
175
+ * @param reactNative `react-native` namespace bindings to forward.
176
+ * @returns The default-exported component.
177
+ */
178
+ function evaluateRewrittenModule(
179
+ transformedSource: string,
180
+ reactNative: Record<string, unknown>,
181
+ ): React.ComponentType<Record<string, unknown>> {
182
+ const prepared = transformedSource
183
+ .replaceAll(/import\s+["']rnwind\/__generated\/[^"']+["'];?\s*\n?/g, '')
184
+ .replaceAll(/import\s+\{([^}]+)\}\s+from\s+["']rnwind["'];?/g, 'const {$1} = __rnwind;')
185
+ .replaceAll(/import\s+\{([^}]+)\}\s+from\s+["']react-native["'];?/g, 'const {$1} = __reactNative;')
186
+ .replace(/export\s+default\s+/, 'module.exports.default = ')
187
+
188
+ const compiled = compileToJs(prepared)
189
+ const rnwindEnv = {
190
+ lookupCss,
191
+ useRnwind,
192
+ useR_,
193
+ useMountHaptic,
194
+ triggerHaptic,
195
+ useInteract: () => NOOP_INTERACT,
196
+ chainPress: NOOP_CHAIN,
197
+ chainFocus: NOOP_CHAIN,
198
+ }
199
+ const moduleObject: { exports: { default?: React.ComponentType<Record<string, unknown>> } } = { exports: {} }
200
+ // Compiled source originates from rnwind's own transformer + the JSX compiler.
201
+ // eslint-disable-next-line sonarjs/code-eval
202
+ new Function('React', '__rnwind', '__reactNative', 'module', compiled)(React, rnwindEnv, reactNative, moduleObject)
203
+ if (!moduleObject.exports.default) {
204
+ throw new Error('rnwind/testing: evaluated module did not export a default component.')
205
+ }
206
+ return moduleObject.exports.default
207
+ }
208
+
209
+ /**
210
+ * Build the root element `@testing-library/react-native`'s `render`
211
+ * receives. When a scheme is specified, wrap the component in a live
212
+ * `<RnwindProvider>` so hooks like `useScheme()` and `useCss()` return
213
+ * the requested scheme. Otherwise render bare (context falls back to the
214
+ * default `'light'`).
215
+ * @param Component Component to render.
216
+ * @param scheme Optional active scheme override.
217
+ * @param insets
218
+ * @param onHaptics
219
+ * @returns The React element to hand to `render`.
220
+ */
221
+ function buildRootElement(
222
+ Component: React.ComponentType<Record<string, unknown>>,
223
+ scheme: string | undefined,
224
+ insets: Partial<Insets> | undefined,
225
+ onHaptics: OnHaptics | undefined,
226
+ ): React.ReactElement {
227
+ const child = React.createElement(Component)
228
+ if (scheme === undefined && !insets && !onHaptics) return child
229
+ const providerProps: { scheme: SchemeName; insets?: Partial<Insets>; onHaptics?: OnHaptics } = {
230
+ scheme: (scheme ?? 'light') as SchemeName,
231
+ }
232
+ if (insets) providerProps.insets = insets
233
+ if (onHaptics) providerProps.onHaptics = onHaptics
234
+ return React.createElement(RnwindProvider, providerProps, child)
235
+ }
236
+
237
+ /**
238
+ * Compose the `wrapper` option `renderHook` accepts. When a scheme is
239
+ * set, wrap the hook's execution context in `<RnwindProvider>` so hooks
240
+ * that read `useScheme()` see the requested scheme. If the user also
241
+ * supplies their own wrapper, nest it inside the provider so both apply.
242
+ * @param scheme Optional active scheme override.
243
+ * @param userWrapper Optional user-supplied wrapper component.
244
+ * @returns A wrapper component suitable for `renderHook`'s `wrapper` option.
245
+ */
246
+ function composeHookWrapper(
247
+ scheme: string | undefined,
248
+ userWrapper: React.ComponentType<{ children?: React.ReactNode }> | undefined,
249
+ ): React.ComponentType<{ children?: React.ReactNode }> | undefined {
250
+ if (scheme === undefined && !userWrapper) return undefined
251
+ return function RnwindTestWrapper({ children }: { children?: React.ReactNode }): React.ReactElement {
252
+ const inner = userWrapper ? React.createElement(userWrapper, null, children) : (children as React.ReactElement)
253
+ if (scheme === undefined) return inner
254
+ return React.createElement(RnwindProvider, { scheme: scheme as SchemeName }, inner)
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Spin up an ephemeral rnwind project and register the atoms produced
260
+ * by `source` (when provided) into the runtime. Returns the project
261
+ * state and the post-transform source so callers can render the
262
+ * rewritten module or just rely on the registered atoms.
263
+ *
264
+ * Shared between `renderWithCss` (needs the rewritten component) and
265
+ * `renderHookWithCss` (only needs the atoms in the registry).
266
+ * @param options Options controlling the theme and pre-registered source.
267
+ * @param options.themeCss Theme CSS override.
268
+ * @param options.source Source whose Tailwind candidates should be registered.
269
+ * @returns Paths plus the transformed source and a `cleanup` closure.
270
+ */
271
+ async function bootstrapRnwindRuntime(options: { themeCss?: string; source?: string }): Promise<{
272
+ projectRoot: string
273
+ cacheDir: string
274
+ transformedSource: string
275
+ cleanup: () => void
276
+ }> {
277
+ const projectRoot = mkdtempSync(path.join(tmpdir(), 'rnwind-test-'))
278
+ const cacheDir = path.join(projectRoot, '.rnwind-cache')
279
+ const cssPath = path.join(projectRoot, 'theme.css')
280
+ writeFileSync(cssPath, options.themeCss ?? DEFAULT_THEME_CSS)
281
+ configureRnwindState(cssPath, cacheDir)
282
+
283
+ let transformedSource = ''
284
+ if (options.source !== undefined) {
285
+ const filename = path.join(projectRoot, 'App.tsx')
286
+ writeFileSync(filename, options.source)
287
+ const ast: BabelFile = parse(options.source, { sourceType: 'module', plugins: ['typescript', 'jsx'] })
288
+ const result = await metroTransform({ filename, src: options.source, options: { projectRoot }, ast })
289
+ transformedSource = generate(result.ast).code
290
+ evaluateStyleBundle(cacheDir)
291
+ }
292
+
293
+ const cleanup = (): void => {
294
+ __resetLookupCssState()
295
+ resetRnwindState()
296
+ if (existsSync(projectRoot)) rmSync(projectRoot, { recursive: true, force: true })
297
+ }
298
+
299
+ return { projectRoot, cacheDir, transformedSource, cleanup }
300
+ }
301
+
302
+ /**
303
+ * Synthesize a throwaway source file that mentions each className in a
304
+ * JSX `className="..."` attribute so the Metro transformer's scanner
305
+ * picks them up and records their resolved styles into the union
306
+ * `style.js`. Used by `renderHookWithCss` to pre-register atoms the
307
+ * hook under test will look up.
308
+ * @param classNames Class names to include.
309
+ * @returns Source string suitable for `bootstrapRnwindRuntime`.
310
+ */
311
+ function sourceFromClassNames(classNames: readonly string[]): string {
312
+ const joined = classNames.join(' ').replaceAll('"', String.raw`\"`)
313
+ return `const V: any = () => null\nexport default () => <V className="${joined}" />\n`
314
+ }
315
+
316
+ // ────────────────────────────────────────────────────────────────────────
317
+ // Public exports — types
318
+ // ────────────────────────────────────────────────────────────────────────
319
+
320
+ /** Exact signature of `@testing-library/react-native`'s `render`. */
321
+ export type Render = typeof testingLibraryRender
322
+
323
+ /** Exact signature of `@testing-library/react-native`'s `renderHook`. */
324
+ export type RenderHook = typeof testingLibraryRenderHook
325
+
326
+ /**
327
+ * Exact return type of `@testing-library/react-native`'s `render` — we
328
+ * re-export the upstream type so tests get every query (`getByTestId`,
329
+ * `queryByText`, `rerender`, `unmount`, `debug`, `UNSAFE_root`, …) with
330
+ * its real signature.
331
+ */
332
+ export type TestingLibraryRenderAPI = ReturnType<typeof testingLibraryRender>
333
+
334
+ /** Options accepted by {@link renderWithCss}. */
335
+ export interface RenderWithCssOptions {
336
+ /** Theme CSS fed to rnwind's parser. Defaults to {@link DEFAULT_THEME_CSS}. */
337
+ themeCss?: string
338
+ /**
339
+ * Active scheme the runtime resolver uses. Defaults to `'light'`.
340
+ * Flip to `'dark'` / `'brand'` / ... to exercise scheme-variant atoms.
341
+ */
342
+ scheme?: string
343
+ /**
344
+ * Safe-area insets to inject. When provided, the component tree is
345
+ * rendered under a `<RnwindProvider insets={...}>` so `*-safe` atoms
346
+ * resolve to real numbers instead of the `0` fallback. Partial is
347
+ * accepted — missing sides default to zero.
348
+ */
349
+ insets?: Partial<Insets>
350
+ /**
351
+ * Haptic dispatcher forwarded onto the implicit `<RnwindProvider>`.
352
+ * Tests pass a spy callback to assert which haptic atoms fired.
353
+ */
354
+ onHaptics?: OnHaptics
355
+ /**
356
+ * `react-native` namespace bindings forwarded into the rewritten
357
+ * module. Defaults to importing the test process's `react-native`
358
+ * (typically a mocked stub). Override to inject custom host elements.
359
+ */
360
+ reactNative?: Record<string, unknown>
361
+ }
362
+
363
+ /**
364
+ * Result of a {@link renderWithCss} call. Every key from
365
+ * `@testing-library/react-native`'s `render` return value is spread onto
366
+ * this object — `getByTestId`, `queryByText`, `rerender`, `unmount`,
367
+ * `debug`, etc. — so tests use the testing-library API directly.
368
+ *
369
+ * Two rnwind-specific handles are added:
370
+ * - `transformedSource` — the exact code the rnwind Metro transformer
371
+ * emitted for your input. Log it to confirm the rewrite.
372
+ * - `cleanup` — tears down the ephemeral rnwind state + chunk cache dir.
373
+ * Call from `afterEach` so successive tests don't share atoms.
374
+ */
375
+ export type RenderWithCssResult = TestingLibraryRenderAPI & {
376
+ /** The post-transformer source text. Same code Metro would ship. */
377
+ transformedSource: string
378
+ /** Tear down the ephemeral rnwind state + cache dir. */
379
+ cleanup: () => void
380
+ }
381
+
382
+ /** Options accepted by {@link renderHookWithCss}. */
383
+ export interface RenderHookWithCssOptions<Props> extends RenderHookOptions<Props> {
384
+ /** Theme CSS fed to rnwind's parser. Defaults to the built-in minimal theme. */
385
+ themeCss?: string
386
+ /**
387
+ * Active scheme the runtime resolver uses. Defaults to `'light'`. When
388
+ * set, the hook is wrapped in `<RnwindProvider scheme={scheme}>` so
389
+ * `useScheme()` / `useCss()` observe the override.
390
+ */
391
+ scheme?: string
392
+ /**
393
+ * Class names to pre-register into the runtime atom registry before
394
+ * the hook runs. rnwind synthesizes a throwaway source file mentioning
395
+ * these classes, feeds it through the real Metro transformer, and
396
+ * evaluates the generated `style.js` bundle — so the hook sees
397
+ * exactly the atoms the production bundle would register.
398
+ */
399
+ classNames?: readonly string[]
400
+ }
401
+
402
+ /**
403
+ * Result of a {@link renderHookWithCss} call. Mirrors
404
+ * `@testing-library/react-native`'s `renderHook` return type — `result`,
405
+ * `rerender`, `unmount` — and adds a `cleanup` that tears down the
406
+ * ephemeral rnwind state.
407
+ */
408
+ export type RenderHookWithCssResult<Result, Props> = ReturnType<typeof testingLibraryRenderHook<Result, Props>> & {
409
+ /** Tear down the ephemeral rnwind state + cache dir. */
410
+ cleanup: () => void
411
+ }
412
+
413
+ // ────────────────────────────────────────────────────────────────────────
414
+ // Public exports — functions
415
+ // ────────────────────────────────────────────────────────────────────────
416
+
417
+ /**
418
+ * Feed a source string through rnwind's Metro transformer, evaluate
419
+ * the generated `style.js` bundle, evaluate the rewritten module, and
420
+ * render the default-exported component with
421
+ * `@testing-library/react-native`.
422
+ *
423
+ * The rendered RN element's `style` prop is the EXACT array your
424
+ * production bundle would attach — same transformer, same runtime
425
+ * resolver, same atoms. Assert on `flatten(node.props.style)` to verify
426
+ * the resolved values.
427
+ * @example
428
+ * ```tsx
429
+ * const handle = await renderWithCss(
430
+ * `import { View } from 'react-native'
431
+ * export default () => <View className="bg-primary p-4" testID="box" />`,
432
+ * { themeCss: `@import 'tailwindcss'; @theme { --color-primary: #6366f1; }` },
433
+ * )
434
+ * const flat = flatten(handle.getByTestId('box').props.style)
435
+ * expect(flat.backgroundColor).toBe('#6366f1')
436
+ * ```
437
+ * @param source User source (one file) to transform + render.
438
+ * @param options Optional theme override, scheme, and `react-native` bindings.
439
+ * @returns Render queries + diagnostic handles.
440
+ */
441
+ export async function renderWithCss(source: string, options: RenderWithCssOptions = {}): Promise<RenderWithCssResult> {
442
+ const reactNative = options.reactNative ?? resolveReactNative()
443
+ const {
444
+ projectRoot: _projectRoot,
445
+ transformedSource,
446
+ cleanup,
447
+ } = await bootstrapRnwindRuntime({
448
+ themeCss: options.themeCss,
449
+ source,
450
+ })
451
+ const Component = evaluateRewrittenModule(transformedSource, reactNative)
452
+ const rendered = TESTING_LIBRARY.render(buildRootElement(Component, options.scheme, options.insets, options.onHaptics))
453
+ return Object.assign({}, rendered, { transformedSource, cleanup })
454
+ }
455
+
456
+ /**
457
+ * Render-side counterpart to {@link renderWithCss} for testing hooks in
458
+ * isolation. Pre-registers atoms for the supplied `classNames`, wraps
459
+ * the hook in an optional `<RnwindProvider>`, and forwards to
460
+ * `@testing-library/react-native`'s `renderHook`.
461
+ * @example
462
+ * ```ts
463
+ * const { result, cleanup } = await renderHookWithCss(
464
+ * () => useCss('bg-primary'),
465
+ * {
466
+ * themeCss: `@import 'tailwindcss'; @theme { --color-primary: #6366f1; }`,
467
+ * classNames: ['bg-primary'],
468
+ * },
469
+ * )
470
+ * expect(flatten(result.current).backgroundColor).toBe('#6366f1')
471
+ * cleanup()
472
+ * ```
473
+ * @param callback Hook body — same shape as `renderHook(callback)`.
474
+ * @param options Theme, scheme, classNames to pre-register, plus
475
+ * everything `renderHook` itself accepts (`initialProps`, `wrapper`).
476
+ * @returns `renderHook`'s return value plus a `cleanup` function.
477
+ */
478
+ export async function renderHookWithCss<Result, Props = unknown>(
479
+ callback: (props: Props) => Result,
480
+ options: RenderHookWithCssOptions<Props> = {},
481
+ ): Promise<RenderHookWithCssResult<Result, Props>> {
482
+ const { cleanup } = await bootstrapRnwindRuntime({
483
+ themeCss: options.themeCss,
484
+ source: options.classNames && options.classNames.length > 0 ? sourceFromClassNames(options.classNames) : undefined,
485
+ })
486
+ const wrapper = composeHookWrapper(options.scheme, options.wrapper as RenderHookWithCssOptions<Props>['wrapper'])
487
+ const { themeCss: _themeCss, scheme: _scheme, classNames: _classNames, ...hookOptions } = options
488
+ const rendered = TESTING_LIBRARY.renderHook<Result, Props>(callback, {
489
+ ...(hookOptions as RenderHookOptions<Props>),
490
+ wrapper,
491
+ })
492
+ return Object.assign({}, rendered, { cleanup })
493
+ }
494
+
495
+ /**
496
+ * Flatten a React Native style array (or single style object) into one
497
+ * merged record. RN flattens left-to-right (later wins), so the returned
498
+ * record is what the native view manager actually applies.
499
+ * @param styles Style array, single object, or null/undefined.
500
+ * @returns Flat style record.
501
+ */
502
+ export function flatten(styles: unknown): Record<string, unknown> {
503
+ if (styles == null) return {}
504
+ if (Array.isArray(styles)) return Object.assign({}, ...styles.map((entry) => flatten(entry)))
505
+ if (typeof styles === 'object') return styles as Record<string, unknown>
506
+ return {}
507
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Minimal type shim for `@tailwindcss/node`. The upstream package exposes its
3
+ * types only through package `exports`, which classical `moduleResolution:
4
+ * 'node'` cannot resolve. We only depend on `compile()` so this keeps the
5
+ * surface tight and ESLint-friendly.
6
+ */
7
+ declare module '@tailwindcss/node' {
8
+ /**
9
+ * Result of `compile()` — a built CSS stringifier plus source metadata. Only
10
+ * the subset rnwind consumes is typed here.
11
+ */
12
+ export interface TailwindCompiler {
13
+ build: (candidates: string[]) => string
14
+ }
15
+
16
+ /**
17
+ * Options accepted by `compile()`. The real type includes more fields (see
18
+ * upstream `CompileOptions`), but rnwind only uses `base` + `onDependency`.
19
+ */
20
+ export interface TailwindCompileOptions {
21
+ base: string
22
+ onDependency: (path: string) => void
23
+ }
24
+
25
+ /**
26
+ * Compile a Tailwind CSS source string into a function that can build
27
+ * class-name CSS on demand.
28
+ * @param css Theme CSS source.
29
+ * @param options Compile options (resolution base + dependency sink).
30
+ * @returns Promise resolving to the compiler.
31
+ */
32
+ export function compile(css: string, options: TailwindCompileOptions): Promise<TailwindCompiler>
33
+ }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export {}