react-native-unistyles 3.0.0-rc.3 → 3.0.0-rc.5

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 (318) hide show
  1. package/README.md +10 -8
  2. package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
  3. package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
  4. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
  5. package/cxx/core/UnistyleWrapper.h +4 -1
  6. package/cxx/core/UnistylesCommitShadowNode.h +0 -21
  7. package/cxx/core/UnistylesRegistry.cpp +45 -49
  8. package/cxx/core/UnistylesState.cpp +10 -0
  9. package/cxx/core/UnistylesState.h +3 -0
  10. package/cxx/hybridObjects/HybridShadowRegistry.cpp +6 -1
  11. package/cxx/hybridObjects/HybridShadowRegistry.h +6 -0
  12. package/cxx/hybridObjects/HybridStyleSheet.cpp +13 -16
  13. package/cxx/hybridObjects/HybridStyleSheet.h +2 -7
  14. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +8 -0
  15. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
  16. package/cxx/parser/Parser.cpp +175 -110
  17. package/cxx/parser/Parser.h +1 -0
  18. package/cxx/shadowTree/ShadowTreeManager.cpp +36 -33
  19. package/cxx/shadowTree/ShadowTreeManager.h +0 -1
  20. package/ios/UnistylesModuleOnLoad.h +1 -5
  21. package/ios/UnistylesModuleOnLoad.mm +5 -13
  22. package/lib/commonjs/components/AdaptiveTheme.js +35 -0
  23. package/lib/commonjs/components/AdaptiveTheme.js.map +1 -0
  24. package/lib/commonjs/components/ApplyScopedTheme.js +19 -0
  25. package/lib/commonjs/components/ApplyScopedTheme.js.map +1 -0
  26. package/lib/commonjs/components/NamedTheme.js +31 -0
  27. package/lib/commonjs/components/NamedTheme.js.map +1 -0
  28. package/lib/commonjs/components/ScopedTheme.js +24 -20
  29. package/lib/commonjs/components/ScopedTheme.js.map +1 -1
  30. package/lib/commonjs/components/native/Image.js +1 -2
  31. package/lib/commonjs/components/native/Image.js.map +1 -1
  32. package/lib/commonjs/components/native/ImageBackground.js +1 -2
  33. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  34. package/lib/commonjs/components/native/Pressable.js +1 -2
  35. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  36. package/lib/commonjs/components/native/Pressable.native.js +1 -2
  37. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  38. package/lib/commonjs/core/createUnistylesElement.js +3 -3
  39. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  40. package/lib/commonjs/core/createUnistylesElement.native.js +18 -31
  41. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  42. package/lib/commonjs/core/createUnistylesImageBackground.js +6 -21
  43. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  44. package/lib/commonjs/core/getClassname.js +1 -2
  45. package/lib/commonjs/core/getClassname.js.map +1 -1
  46. package/lib/commonjs/core/parseBoxShadow.js +57 -0
  47. package/lib/commonjs/core/parseBoxShadow.js.map +1 -0
  48. package/lib/commonjs/core/useProxifiedUnistyles/listener.js +1 -2
  49. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  50. package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -2
  51. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  52. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -2
  53. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  54. package/lib/commonjs/index.js +6 -0
  55. package/lib/commonjs/index.js.map +1 -1
  56. package/lib/commonjs/mocks.js +5 -2
  57. package/lib/commonjs/mocks.js.map +1 -1
  58. package/lib/commonjs/reanimated/index.js +20 -0
  59. package/lib/commonjs/reanimated/index.js.map +1 -0
  60. package/lib/commonjs/reanimated/useAnimatedTheme.js +22 -0
  61. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -0
  62. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +24 -0
  63. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -0
  64. package/lib/commonjs/reanimated/variant/index.js +17 -0
  65. package/lib/commonjs/reanimated/variant/index.js.map +1 -0
  66. package/lib/commonjs/reanimated/variant/types.js +2 -0
  67. package/lib/commonjs/reanimated/variant/types.js.map +1 -0
  68. package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js +38 -0
  69. package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
  70. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js +66 -0
  71. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -0
  72. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +39 -0
  73. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
  74. package/lib/commonjs/server/getServerUnistyles.js +1 -2
  75. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  76. package/lib/commonjs/server/hydrateServerUnistyles.js +1 -2
  77. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  78. package/lib/commonjs/server/resetServerUnistyles.js +1 -2
  79. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  80. package/lib/commonjs/specs/ShadowRegistry/index.js +6 -1
  81. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  82. package/lib/commonjs/specs/StyleSheet/index.js +3 -1
  83. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  84. package/lib/commonjs/utils.js +0 -3
  85. package/lib/commonjs/utils.js.map +1 -1
  86. package/lib/commonjs/web/create.js +2 -3
  87. package/lib/commonjs/web/create.js.map +1 -1
  88. package/lib/commonjs/web/css/core.js +6 -1
  89. package/lib/commonjs/web/css/core.js.map +1 -1
  90. package/lib/commonjs/web/css/state.js +10 -7
  91. package/lib/commonjs/web/css/state.js.map +1 -1
  92. package/lib/commonjs/web/index.js +1 -2
  93. package/lib/commonjs/web/index.js.map +1 -1
  94. package/lib/commonjs/web/listener.js +2 -0
  95. package/lib/commonjs/web/listener.js.map +1 -1
  96. package/lib/commonjs/web/runtime.js +15 -1
  97. package/lib/commonjs/web/runtime.js.map +1 -1
  98. package/lib/commonjs/web/shadowRegistry.js +12 -4
  99. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  100. package/lib/commonjs/web/state.js +1 -10
  101. package/lib/commonjs/web/state.js.map +1 -1
  102. package/lib/commonjs/web/types.js +2 -0
  103. package/lib/commonjs/web/types.js.map +1 -1
  104. package/lib/commonjs/web/utils/createUnistylesRef.js +1 -2
  105. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
  106. package/lib/commonjs/web/utils/unistyle.js +30 -3
  107. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  108. package/lib/commonjs/web-only/getWebProps.js +19 -0
  109. package/lib/commonjs/web-only/getWebProps.js.map +1 -0
  110. package/lib/commonjs/web-only/index.js +13 -0
  111. package/lib/commonjs/web-only/index.js.map +1 -0
  112. package/lib/module/components/AdaptiveTheme.js +29 -0
  113. package/lib/module/components/AdaptiveTheme.js.map +1 -0
  114. package/lib/module/components/ApplyScopedTheme.js +14 -0
  115. package/lib/module/components/ApplyScopedTheme.js.map +1 -0
  116. package/lib/module/components/NamedTheme.js +25 -0
  117. package/lib/module/components/NamedTheme.js.map +1 -0
  118. package/lib/module/components/ScopedTheme.js +24 -19
  119. package/lib/module/components/ScopedTheme.js.map +1 -1
  120. package/lib/module/core/createUnistylesElement.js +3 -3
  121. package/lib/module/core/createUnistylesElement.js.map +1 -1
  122. package/lib/module/core/createUnistylesElement.native.js +18 -30
  123. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  124. package/lib/module/core/createUnistylesImageBackground.js +5 -19
  125. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  126. package/lib/module/core/parseBoxShadow.js +52 -0
  127. package/lib/module/core/parseBoxShadow.js.map +1 -0
  128. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  129. package/lib/module/index.js +5 -0
  130. package/lib/module/index.js.map +1 -1
  131. package/lib/module/mocks.js +5 -2
  132. package/lib/module/mocks.js.map +1 -1
  133. package/lib/module/reanimated/index.js +5 -0
  134. package/lib/module/reanimated/index.js.map +1 -0
  135. package/lib/module/reanimated/useAnimatedTheme.js +17 -0
  136. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -0
  137. package/lib/module/reanimated/useAnimatedTheme.native.js +19 -0
  138. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -0
  139. package/lib/module/reanimated/variant/index.js +4 -0
  140. package/lib/module/reanimated/variant/index.js.map +1 -0
  141. package/lib/module/reanimated/variant/types.js +2 -0
  142. package/lib/module/reanimated/variant/types.js.map +1 -0
  143. package/lib/module/reanimated/variant/useAnimatedVariantColor.js +33 -0
  144. package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
  145. package/lib/module/reanimated/variant/useUpdateVariantColor.js +61 -0
  146. package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -0
  147. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +34 -0
  148. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
  149. package/lib/module/specs/ShadowRegistry/index.js +6 -1
  150. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  151. package/lib/module/specs/StyleSheet/index.js +3 -1
  152. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  153. package/lib/module/utils.js +0 -3
  154. package/lib/module/utils.js.map +1 -1
  155. package/lib/module/web/create.js +1 -1
  156. package/lib/module/web/create.js.map +1 -1
  157. package/lib/module/web/css/core.js +6 -1
  158. package/lib/module/web/css/core.js.map +1 -1
  159. package/lib/module/web/css/state.js +10 -7
  160. package/lib/module/web/css/state.js.map +1 -1
  161. package/lib/module/web/listener.js +2 -0
  162. package/lib/module/web/listener.js.map +1 -1
  163. package/lib/module/web/runtime.js +16 -2
  164. package/lib/module/web/runtime.js.map +1 -1
  165. package/lib/module/web/shadowRegistry.js +13 -5
  166. package/lib/module/web/shadowRegistry.js.map +1 -1
  167. package/lib/module/web/state.js +1 -10
  168. package/lib/module/web/state.js.map +1 -1
  169. package/lib/module/web/types.js +1 -1
  170. package/lib/module/web/types.js.map +1 -1
  171. package/lib/module/web/utils/unistyle.js +27 -2
  172. package/lib/module/web/utils/unistyle.js.map +1 -1
  173. package/lib/module/web-only/getWebProps.js +14 -0
  174. package/lib/module/web-only/getWebProps.js.map +1 -0
  175. package/lib/module/web-only/index.js +4 -0
  176. package/lib/module/web-only/index.js.map +1 -0
  177. package/lib/typescript/plugin/src/consts.d.ts +17 -0
  178. package/lib/typescript/plugin/src/consts.d.ts.map +1 -0
  179. package/lib/typescript/repack-plugin/src/index.d.ts +18 -0
  180. package/lib/typescript/repack-plugin/src/index.d.ts.map +1 -0
  181. package/lib/typescript/repack-plugin/src/loader.d.ts +9 -0
  182. package/lib/typescript/repack-plugin/src/loader.d.ts.map +1 -0
  183. package/lib/typescript/src/components/AdaptiveTheme.d.ts +8 -0
  184. package/lib/typescript/src/components/AdaptiveTheme.d.ts.map +1 -0
  185. package/lib/typescript/src/components/ApplyScopedTheme.d.ts +7 -0
  186. package/lib/typescript/src/components/ApplyScopedTheme.d.ts.map +1 -0
  187. package/lib/typescript/src/components/NamedTheme.d.ts +10 -0
  188. package/lib/typescript/src/components/NamedTheme.d.ts.map +1 -0
  189. package/lib/typescript/src/components/ScopedTheme.d.ts +4 -0
  190. package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
  191. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  192. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  193. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  194. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  195. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  196. package/lib/typescript/src/core/parseBoxShadow.d.ts +11 -0
  197. package/lib/typescript/src/core/parseBoxShadow.d.ts.map +1 -0
  198. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
  199. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  200. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  201. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  202. package/lib/typescript/src/core/warn.d.ts.map +1 -1
  203. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  204. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  205. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  206. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  207. package/lib/typescript/src/index.d.ts.map +1 -1
  208. package/lib/typescript/src/reanimated/index.d.ts +3 -0
  209. package/lib/typescript/src/reanimated/index.d.ts.map +1 -0
  210. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts +4 -0
  211. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -0
  212. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts +4 -0
  213. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -0
  214. package/lib/typescript/src/reanimated/variant/index.d.ts +2 -0
  215. package/lib/typescript/src/reanimated/variant/index.d.ts.map +1 -0
  216. package/lib/typescript/src/reanimated/variant/types.d.ts +10 -0
  217. package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -0
  218. package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts +3 -0
  219. package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -0
  220. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +6 -0
  221. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -0
  222. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +6 -0
  223. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -0
  224. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  225. package/lib/typescript/src/server/serialize.d.ts.map +1 -1
  226. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  227. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +1 -0
  228. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  229. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  230. package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -0
  231. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  232. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +2 -0
  233. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  234. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  235. package/lib/typescript/src/utils.d.ts.map +1 -1
  236. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  237. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  238. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  239. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  240. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  241. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  242. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
  243. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
  244. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
  245. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  246. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  247. package/lib/typescript/src/web/create.d.ts.map +1 -1
  248. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  249. package/lib/typescript/src/web/css/state.d.ts +2 -1
  250. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  251. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  252. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  253. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  254. package/lib/typescript/src/web/runtime.d.ts +2 -0
  255. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  256. package/lib/typescript/src/web/shadowRegistry.d.ts +4 -2
  257. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  258. package/lib/typescript/src/web/state.d.ts.map +1 -1
  259. package/lib/typescript/src/web/types.d.ts +6 -0
  260. package/lib/typescript/src/web/types.d.ts.map +1 -1
  261. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  262. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -1
  263. package/lib/typescript/src/web/utils/unistyle.d.ts +7 -1
  264. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  265. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  266. package/lib/typescript/src/web-only/getWebProps.d.ts +7 -0
  267. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -0
  268. package/lib/typescript/src/web-only/index.d.ts +2 -0
  269. package/lib/typescript/src/web-only/index.d.ts.map +1 -0
  270. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +1 -0
  271. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +2 -0
  272. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
  273. package/package.json +57 -25
  274. package/plugin/index.d.ts +6 -5
  275. package/plugin/index.js +103 -99
  276. package/reanimated/package.json +6 -0
  277. package/repack-plugin/index.d.ts +19 -0
  278. package/repack-plugin/index.js +149 -0
  279. package/src/components/AdaptiveTheme.tsx +34 -0
  280. package/src/components/ApplyScopedTheme.tsx +17 -0
  281. package/src/components/NamedTheme.tsx +33 -0
  282. package/src/components/ScopedTheme.tsx +42 -22
  283. package/src/core/createUnistylesElement.native.tsx +21 -31
  284. package/src/core/createUnistylesElement.tsx +3 -3
  285. package/src/core/createUnistylesImageBackground.tsx +7 -22
  286. package/src/core/parseBoxShadow.ts +87 -0
  287. package/src/core/withUnistyles/withUnistyles.native.tsx +1 -0
  288. package/src/index.ts +8 -0
  289. package/src/mocks.ts +5 -2
  290. package/src/reanimated/index.ts +2 -0
  291. package/src/reanimated/useAnimatedTheme.native.ts +21 -0
  292. package/src/reanimated/useAnimatedTheme.ts +19 -0
  293. package/src/reanimated/variant/index.ts +1 -0
  294. package/src/reanimated/variant/types.ts +14 -0
  295. package/src/reanimated/variant/useAnimatedVariantColor.ts +38 -0
  296. package/src/reanimated/variant/useUpdateVariantColor.native.ts +38 -0
  297. package/src/reanimated/variant/useUpdateVariantColor.ts +81 -0
  298. package/src/specs/ShadowRegistry/index.ts +7 -1
  299. package/src/specs/StyleSheet/index.ts +5 -2
  300. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +2 -0
  301. package/src/utils.ts +1 -3
  302. package/src/web/create.ts +1 -1
  303. package/src/web/css/core.ts +9 -1
  304. package/src/web/css/state.ts +10 -8
  305. package/src/web/listener.ts +2 -0
  306. package/src/web/runtime.ts +23 -2
  307. package/src/web/shadowRegistry.ts +15 -6
  308. package/src/web/state.ts +7 -17
  309. package/src/web/types.ts +12 -4
  310. package/src/web/utils/unistyle.ts +38 -3
  311. package/src/web-only/getWebProps.ts +18 -0
  312. package/src/web-only/index.ts +2 -0
  313. package/web/package.json +6 -0
  314. package/cxx/core/UnistylesCommitHook.cpp +0 -52
  315. package/cxx/core/UnistylesCommitHook.h +0 -27
  316. package/cxx/core/UnistylesMountHook.cpp +0 -28
  317. package/cxx/core/UnistylesMountHook.h +0 -24
  318. package/lib/module/package.json +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-rc.3",
3
+ "version": "3.0.0-rc.5",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "NODE_ENV=babel-test jest ./plugin",
@@ -9,10 +9,11 @@
9
9
  "lint": "biome lint",
10
10
  "check": "biome check --write",
11
11
  "check:ci": "biome check",
12
- "prepare": "husky && bob build && yarn plugin:build",
12
+ "prepare": "husky && bob build && yarn plugin:build && yarn repack:plugin:build",
13
13
  "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn check' 'yarn test' 'yarn circular:check'",
14
14
  "release": "release-it",
15
15
  "plugin:build": "node plugin/esbuild.js",
16
+ "repack:plugin:build": "node repack-plugin/esbuild.js",
16
17
  "circular:check": "dpdm --no-warning --no-tree -T --exit-code circular:1 src/**/*.ts",
17
18
  "components:build": "node build-components.js"
18
19
  },
@@ -46,13 +47,32 @@
46
47
  "types": "./plugin/index.d.ts",
47
48
  "default": "./plugin/index.js"
48
49
  },
50
+ "./repack-plugin": {
51
+ "import": "./repack-plugin/index.js",
52
+ "types": "./repack-plugin/index.d.ts",
53
+ "default": "./repack-plugin/index.js"
54
+ },
49
55
  "./package.json": "./package.json",
50
56
  "./server": {
51
57
  "types": "./lib/typescript/src/server/index.d.ts",
52
58
  "import": "./lib/module/server/index.js",
53
59
  "browser": "./lib/module/server/index.js",
54
- "react-native": "./src/server.ts",
60
+ "react-native": "./src/server/index.ts",
55
61
  "default": "./lib/commonjs/server/index.js"
62
+ },
63
+ "./web": {
64
+ "types": "./lib/typescript/src/web-only/index.d.ts",
65
+ "import": "./lib/module/web-only/index.js",
66
+ "browser": "./lib/module/web-only/index.js",
67
+ "react-native": "./src/web-only/index.ts",
68
+ "default": "./lib/commonjs/web-only/index.js"
69
+ },
70
+ "./reanimated": {
71
+ "types": "./lib/typescript/src/reanimated/index.d.ts",
72
+ "import": "./lib/module/reanimated/index.js",
73
+ "browser": "./lib/module/reanimated/index.js",
74
+ "react-native": "./src/reanimated/index.ts",
75
+ "default": "./lib/commonjs/reanimated/index.js"
56
76
  }
57
77
  },
58
78
  "files": [
@@ -66,8 +86,14 @@
66
86
  "web",
67
87
  "components",
68
88
  "server",
89
+ "web-only",
90
+ "reanimated",
69
91
  "react-native.config.js",
70
92
  "Unistyles.podspec",
93
+ "repack-plugin",
94
+ "!repack-plugin/__tests__",
95
+ "!repack-plugin/src",
96
+ "!repack-plugin/esbuild.js",
71
97
  "!plugin/__tests__",
72
98
  "!plugin/src",
73
99
  "!plugin/esbuild.js",
@@ -100,41 +126,50 @@
100
126
  "registry": "https://registry.npmjs.org/"
101
127
  },
102
128
  "devDependencies": {
103
- "@babel/core": "7.26.9",
104
- "@babel/plugin-syntax-jsx": "7.25.9",
105
- "@babel/preset-flow": "7.25.9",
106
- "@babel/preset-typescript": "7.26.0",
107
- "@babel/types": "7.26.9",
129
+ "@babel/core": "7.27.1",
130
+ "@babel/plugin-syntax-jsx": "7.27.1",
131
+ "@babel/preset-flow": "7.27.1",
132
+ "@babel/preset-typescript": "7.27.1",
133
+ "@babel/types": "7.27.1",
108
134
  "@biomejs/biome": "1.9.4",
109
- "@commitlint/config-conventional": "19.7.1",
110
- "@react-native/normalize-colors": "0.78.0",
135
+ "@callstack/repack": "5.1.0",
136
+ "@commitlint/config-conventional": "19.8.1",
137
+ "@react-native/normalize-colors": "0.79.2",
111
138
  "@release-it/conventional-changelog": "8.0.2",
139
+ "@rspack/core": "1.3.10",
112
140
  "@types/jest": "29.5.14",
113
- "@types/react": "19.0.10",
141
+ "@types/react": "19.1.4",
114
142
  "babel-plugin-tester": "11.0.4",
115
- "commitlint": "19.7.1",
143
+ "commitlint": "19.8.1",
116
144
  "concurrently": "9.1.2",
117
145
  "dpdm": "3.14.0",
118
- "esbuild": "0.25.0",
146
+ "esbuild": "0.25.4",
119
147
  "husky": "9.1.7",
120
148
  "jest": "29.7.0",
121
149
  "metro-react-native-babel-preset": "0.77.0",
122
- "nitro-codegen": "0.25.2",
123
- "react": "18.3.1",
124
- "react-native": "0.77.1",
125
- "react-native-builder-bob": "0.37.0",
126
- "react-native-nitro-modules": "0.25.2",
127
- "react-native-web": "0.19.13",
128
- "react-test-renderer": "18.3.1",
150
+ "nitro-codegen": "0.26.2",
151
+ "react": "19.1.0",
152
+ "react-native": "0.79.2",
153
+ "react-native-builder-bob": "0.40.10",
154
+ "react-native-nitro-modules": "0.26.2",
155
+ "react-native-reanimated": "3.17.5",
156
+ "react-native-web": "0.20.0",
157
+ "react-test-renderer": "19.1.0",
129
158
  "release-it": "17.11.0",
130
- "typescript": "5.7.3"
159
+ "typescript": "5.8.3"
131
160
  },
132
161
  "peerDependencies": {
133
162
  "@react-native/normalize-colors": "*",
134
163
  "react": "*",
135
164
  "react-native": ">=0.76.0",
136
165
  "react-native-edge-to-edge": "*",
137
- "react-native-nitro-modules": "*"
166
+ "react-native-nitro-modules": "*",
167
+ "react-native-reanimated": "*"
168
+ },
169
+ "peerDependenciesMeta": {
170
+ "react-native-reanimated": {
171
+ "optional": true
172
+ }
138
173
  },
139
174
  "workspaces": [
140
175
  "example",
@@ -199,8 +234,5 @@
199
234
  "name": "TurboUnistyles",
200
235
  "type": "modules",
201
236
  "jsSrcsDir": "./src/specs/TurboUnistyles"
202
- },
203
- "resolutions": {
204
- "@babel/types": "7.26.8"
205
237
  }
206
238
  }
package/plugin/index.d.ts CHANGED
@@ -37,11 +37,12 @@ export interface RemapConfig {
37
37
 
38
38
  export interface UnistylesPluginOptions {
39
39
  /**
40
- * Example: 'src' or 'apps/mobile'
41
- * Add this option if some of your components don't have `react-native-unistyles` import.
42
- * Babel plugin will automatically process all files under this root.
40
+ * Required from RC.5
41
+ * Example: 'src' or 'app'
42
+ * Add root folder of your project. All files under this folder will be processed by the Babel plugin.
43
+ * If you need to process extra folders, use with `autoProcessPaths` option.
43
44
  */
44
- autoProcessRoot?: string,
45
+ root: string,
45
46
 
46
47
  /**
47
48
  * Example: ['@codemask/styles']
@@ -103,7 +104,7 @@ export interface UnistylesPluginOptions {
103
104
  * Defaults to:
104
105
  *
105
106
  * ```ts
106
- * ['react-native-reanimated/src/component', 'react-native-gesture-handler/src/components']
107
+ * ['react-native-reanimated/src/component']
107
108
  * ```
108
109
  */
109
110
  autoProcessPaths?: Array<string>,
package/plugin/index.js CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  default: () => index_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
+ var import_node_path2 = __toESM(require("node:path"));
36
37
  var t6 = __toESM(require("@babel/types"));
37
38
 
38
39
  // plugin/src/consts.ts
@@ -59,10 +60,7 @@ var REACT_NATIVE_COMPONENT_NAMES = [
59
60
  ];
60
61
  var REPLACE_WITH_UNISTYLES_PATHS = [
61
62
  "react-native-reanimated/src/component",
62
- "react-native-reanimated/lib/module/component",
63
- "react-native-gesture-handler/lib/module/components",
64
- "react-native-gesture-handler/lib/commonjs/components",
65
- "react-native-gesture-handler/src/components"
63
+ "react-native-reanimated/lib/module/component"
66
64
  ];
67
65
  var REPLACE_WITH_UNISTYLES_EXOTIC_PATHS = [];
68
66
  var NATIVE_COMPONENTS_PATHS = {
@@ -83,21 +81,10 @@ var NATIVE_COMPONENTS_PATHS = {
83
81
 
84
82
  // plugin/src/exotic.ts
85
83
  var t = __toESM(require("@babel/types"));
86
-
87
- // plugin/src/paths.ts
88
- var isWindows = process.platform === "win32";
89
- var toWinPath = (pathString) => {
90
- return pathString;
91
- };
92
- var toPlatformPath = (pathString) => {
93
- return isWindows ? toWinPath(pathString) : pathString;
94
- };
95
-
96
- // plugin/src/exotic.ts
97
- function handleExoticImport(path, state, exoticImport) {
98
- const specifiers = path.node.specifiers;
99
- const source = path.node.source;
100
- if (path.node.importKind !== "value") {
84
+ function handleExoticImport(path2, state, exoticImport) {
85
+ const specifiers = path2.node.specifiers;
86
+ const source = path2.node.source;
87
+ if (path2.node.importKind !== "value") {
101
88
  return;
102
89
  }
103
90
  specifiers.forEach((specifier) => {
@@ -112,22 +99,22 @@ function handleExoticImport(path, state, exoticImport) {
112
99
  const newImport = t.importDeclaration(
113
100
  [t.importDefaultSpecifier(t.identifier(specifier.local.name))],
114
101
  t.stringLiteral(
115
- state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)
102
+ state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(`react-native-unistyles/components/native/${rule.mapTo}`) ?? "" : `react-native-unistyles/components/native/${rule.mapTo}`
116
103
  )
117
104
  );
118
- path.replaceWith(newImport);
105
+ path2.replaceWith(newImport);
119
106
  } else {
120
107
  const newImport = t.importDeclaration(
121
108
  [t.importSpecifier(t.identifier(rule.mapTo), t.identifier(rule.mapTo))],
122
109
  t.stringLiteral(
123
- state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)
110
+ state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(`react-native-unistyles/components/native/${rule.mapTo}`) ?? "" : `react-native-unistyles/components/native/${rule.mapTo}`
124
111
  )
125
112
  );
126
- path.node.specifiers = specifiers.filter((s) => s !== specifier);
127
- if (path.node.specifiers.length === 0) {
128
- path.replaceWith(newImport);
113
+ path2.node.specifiers = specifiers.filter((s) => s !== specifier);
114
+ if (path2.node.specifiers.length === 0) {
115
+ path2.replaceWith(newImport);
129
116
  } else {
130
- path.insertBefore(newImport);
117
+ path2.insertBefore(newImport);
131
118
  }
132
119
  }
133
120
  return;
@@ -137,12 +124,12 @@ function handleExoticImport(path, state, exoticImport) {
137
124
 
138
125
  // plugin/src/import.ts
139
126
  var t2 = __toESM(require("@babel/types"));
140
- function addUnistylesImport(path, state) {
127
+ function addUnistylesImport(path2, state) {
141
128
  const localNames = Object.keys(state.reactNativeImports);
142
129
  const names = Object.values(state.reactNativeImports);
143
130
  const pairs = Object.entries(state.reactNativeImports);
144
131
  const nodesToRemove = [];
145
- path.node.body.forEach((node) => {
132
+ path2.node.body.forEach((node) => {
146
133
  if (t2.isImportDeclaration(node) && node.source.value === "react-native") {
147
134
  node.specifiers = node.specifiers.filter((specifier) => !localNames.some((name) => name === specifier.local.name));
148
135
  if (node.specifiers.length === 0) {
@@ -151,7 +138,7 @@ function addUnistylesImport(path, state) {
151
138
  }
152
139
  });
153
140
  names.forEach((name) => {
154
- const rnWebImport = path.node.body.find((node) => t2.isImportDeclaration(node) && node.source.value === toPlatformPath(`react-native-web/dist/exports/${name}`));
141
+ const rnWebImport = path2.node.body.find((node) => t2.isImportDeclaration(node) && node.source.value === `react-native-web/dist/exports/${name}`);
155
142
  if (rnWebImport) {
156
143
  rnWebImport.specifiers = [];
157
144
  }
@@ -160,34 +147,44 @@ function addUnistylesImport(path, state) {
160
147
  const newImport = t2.importDeclaration(
161
148
  [t2.importSpecifier(t2.identifier(localName), t2.identifier(name))],
162
149
  t2.stringLiteral(
163
- state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/src/components/native/${name}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${name}`)
150
+ state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(`react-native-unistyles/src/components/native/${name}`) ?? "" : `react-native-unistyles/components/native/${name}`
164
151
  )
165
152
  );
166
- path.node.body.unshift(newImport);
153
+ path2.node.body.unshift(newImport);
167
154
  });
168
- nodesToRemove.forEach((node) => path.node.body.splice(path.node.body.indexOf(node), 1));
155
+ nodesToRemove.forEach((node) => path2.node.body.splice(path2.node.body.indexOf(node), 1));
169
156
  }
170
157
  function isInsideNodeModules(state) {
171
158
  return state.file.opts.filename?.includes("node_modules") && !state.file.replaceWithUnistyles;
172
159
  }
173
- function addUnistylesRequire(path, state) {
160
+ function addUnistylesRequire(path2, state) {
174
161
  Object.entries(state.reactNativeImports).forEach(([componentName, uniqueName]) => {
175
162
  const newRequire = t2.variableDeclaration("const", [
176
163
  t2.variableDeclarator(
177
164
  t2.identifier(uniqueName),
178
165
  t2.callExpression(t2.identifier("require"), [
179
- t2.stringLiteral(toPlatformPath(`react-native-unistyles/src/components/native/${componentName}`))
166
+ t2.stringLiteral(`react-native-unistyles/components/native/${componentName}`)
180
167
  ])
181
168
  )
182
169
  ]);
183
- path.node.body.unshift(newRequire);
170
+ path2.node.body.unshift(newRequire);
184
171
  });
185
172
  }
186
173
 
174
+ // plugin/src/paths.ts
175
+ var import_node_path = __toESM(require("node:path"));
176
+ var isWindows = process.platform === "win32";
177
+ var toWinPath = (pathString) => {
178
+ return import_node_path.default.normalize(pathString).replace(/\//g, "\\");
179
+ };
180
+ var toPlatformPath = (pathString) => {
181
+ return isWindows ? toWinPath(pathString) : pathString;
182
+ };
183
+
187
184
  // plugin/src/ref.ts
188
185
  var t3 = __toESM(require("@babel/types"));
189
- function hasStringRef(path) {
190
- return path.node.openingElement.attributes.find(
186
+ function hasStringRef(path2) {
187
+ return path2.node.openingElement.attributes.find(
191
188
  (attr) => t3.isJSXAttribute(attr) && t3.isJSXIdentifier(attr.name, { name: "ref" }) && t3.isStringLiteral(attr.value)
192
189
  );
193
190
  }
@@ -324,8 +321,8 @@ function stringToUniqueId(str) {
324
321
  const absHash = Math.abs(hash);
325
322
  return absHash % 1e9;
326
323
  }
327
- function isUnistylesStyleSheet(path, state) {
328
- const { callee } = path.node;
324
+ function isUnistylesStyleSheet(path2, state) {
325
+ const { callee } = path2.node;
329
326
  if (!t4.isMemberExpression(callee) || !t4.isIdentifier(callee.property)) {
330
327
  return false;
331
328
  }
@@ -333,38 +330,38 @@ function isUnistylesStyleSheet(path, state) {
333
330
  const isRequire = state.file.hasUnistylesImport && callee.property.name === "create" && t4.isMemberExpression(callee.object) && t4.isIdentifier(callee.object.property) && t4.isIdentifier(callee.object.object) && callee.object.object.name === state.file.styleSheetLocalName && callee.object.property.name === "StyleSheet";
334
331
  return isImport || isRequire;
335
332
  }
336
- function isUnistylesCommonJSRequire(path, state) {
337
- const isRequire = t4.isIdentifier(path.node.callee) && path.node.arguments.length > 0 && t4.isStringLiteral(path.node.arguments[0]) && path.node.arguments[0].value === "react-native-unistyles";
338
- if (isRequire && t4.isVariableDeclarator(path.parent) && t4.isIdentifier(path.parent.id)) {
333
+ function isUnistylesCommonJSRequire(path2, state) {
334
+ const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && t4.isStringLiteral(path2.node.arguments[0]) && path2.node.arguments[0].value === "react-native-unistyles";
335
+ if (isRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
339
336
  state.file.hasUnistylesImport = true;
340
- state.file.styleSheetLocalName = path.parent.id.name;
337
+ state.file.styleSheetLocalName = path2.parent.id.name;
341
338
  }
342
339
  return isRequire;
343
340
  }
344
- function isReactNativeCommonJSRequire(path, state) {
345
- const isRequire = t4.isIdentifier(path.node.callee) && path.node.arguments.length > 0 && path.node.callee.name === "require";
346
- const requireImportName = path.node.arguments.find((node) => t4.isStringLiteral(node));
341
+ function isReactNativeCommonJSRequire(path2, state) {
342
+ const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && path2.node.callee.name === "require";
343
+ const requireImportName = path2.node.arguments.find((node) => t4.isStringLiteral(node));
347
344
  const isReactNativeRequire = isRequire && requireImportName && (requireImportName.value === "react-native" || requireImportName.value === "react-native-web/dist/index");
348
- if (isReactNativeRequire && t4.isVariableDeclarator(path.parent) && t4.isIdentifier(path.parent.id)) {
349
- state.file.reactNativeCommonJSName = path.parent.id.name;
345
+ if (isReactNativeRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
346
+ state.file.reactNativeCommonJSName = path2.parent.id.name;
350
347
  }
351
348
  return isRequire;
352
349
  }
353
- function isKindOfStyleSheet(path, state) {
350
+ function isKindOfStyleSheet(path2, state) {
354
351
  if (!state.file.forceProcessing && !state.file.hasUnistylesImport) {
355
352
  return false;
356
353
  }
357
- const { callee } = path.node;
354
+ const { callee } = path2.node;
358
355
  return t4.isMemberExpression(callee) && t4.isIdentifier(callee.property) && callee.property.name === "create" && t4.isIdentifier(callee.object);
359
356
  }
360
- function addStyleSheetTag(path, state) {
357
+ function addStyleSheetTag(path2, state) {
361
358
  const str = state.filename?.replace(state.cwd, "") ?? "";
362
359
  const uniqueId = stringToUniqueId(str) + ++state.file.tagNumber;
363
- path.node.arguments.push(t4.numericLiteral(uniqueId));
360
+ path2.node.arguments.push(t4.numericLiteral(uniqueId));
364
361
  }
365
- function getStylesDependenciesFromObject(path) {
362
+ function getStylesDependenciesFromObject(path2) {
366
363
  const detectedStylesWithVariants = /* @__PURE__ */ new Set();
367
- const stylesheet = path.node.arguments[0];
364
+ const stylesheet = path2.node.arguments[0];
368
365
  if (t4.isObjectExpression(stylesheet)) {
369
366
  stylesheet?.properties.forEach((property) => {
370
367
  if (!t4.isObjectProperty(property) || !t4.isIdentifier(property.key)) {
@@ -663,8 +660,8 @@ function addDependencies(state, styleName, unistyle, detectedDependencies) {
663
660
 
664
661
  // plugin/src/variants.ts
665
662
  var t5 = __toESM(require("@babel/types"));
666
- function extractVariants(path, state) {
667
- const maybeVariants = path.node.body.filter((node2) => t5.isExpressionStatement(node2) && t5.isCallExpression(node2.expression) && t5.isMemberExpression(node2.expression.callee));
663
+ function extractVariants(path2, state) {
664
+ const maybeVariants = path2.node.body.filter((node2) => t5.isExpressionStatement(node2) && t5.isCallExpression(node2.expression) && t5.isMemberExpression(node2.expression.callee));
668
665
  if (maybeVariants.length === 0) {
669
666
  return;
670
667
  }
@@ -687,7 +684,7 @@ function extractVariants(path, state) {
687
684
  return;
688
685
  }
689
686
  const calleeName = callee.object.name;
690
- const newUniqueName = path.scope.generateUidIdentifier(calleeName);
687
+ const newUniqueName = path2.scope.generateUidIdentifier(calleeName);
691
688
  const shadowDeclaration = t5.variableDeclaration("const", [
692
689
  t5.variableDeclarator(newUniqueName, t5.identifier(calleeName))
693
690
  ]);
@@ -698,14 +695,14 @@ function extractVariants(path, state) {
698
695
  const finalDeclaration = t5.variableDeclaration("const", [
699
696
  t5.variableDeclarator(t5.identifier(calleeName), newCallExpression)
700
697
  ]);
701
- const pathIndex = path.node.body.findIndex((bodyPath) => bodyPath === targetVariant);
702
- const rest = path.node.body.slice(pathIndex + 1);
698
+ const pathIndex = path2.node.body.findIndex((bodyPath) => bodyPath === targetVariant);
699
+ const rest = path2.node.body.slice(pathIndex + 1);
703
700
  const statement = t5.blockStatement([
704
701
  finalDeclaration,
705
702
  ...rest
706
703
  ]);
707
- path.node.body = [
708
- ...path.node.body.slice(0, pathIndex),
704
+ path2.node.body = [
705
+ ...path2.node.body.slice(0, pathIndex),
709
706
  shadowDeclaration,
710
707
  statement
711
708
  ];
@@ -724,8 +721,15 @@ function index_default() {
724
721
  name: "babel-react-native-unistyles",
725
722
  visitor: {
726
723
  Program: {
727
- enter(path, state) {
728
- state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path2) => state.filename?.includes(path2));
724
+ enter(path2, state) {
725
+ if (!state.opts.root) {
726
+ throw new Error("Unistyles \u{1F984}: Babel plugin requires `root` option to be set. Please check https://www.unistyl.es/v3/other/babel-plugin#extra-configuration");
727
+ }
728
+ const appRoot = toPlatformPath(import_node_path2.default.join(state.file.opts.root, state.opts.root));
729
+ if (state.file.opts.root === appRoot) {
730
+ throw new Error("Unistyles \u{1F984}: Root option can't resolve to project root as it will include node_modules folder. Please check https://www.unistyl.es/v3/other/babel-plugin#extra-configuration");
731
+ }
732
+ state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path3) => state.filename?.includes(path3));
729
733
  state.file.hasAnyUnistyle = false;
730
734
  state.file.hasUnistylesImport = false;
731
735
  state.file.addUnistylesRequire = false;
@@ -734,8 +738,8 @@ function index_default() {
734
738
  state.file.reactNativeCommonJSName = "";
735
739
  state.file.tagNumber = 0;
736
740
  state.reactNativeImports = {};
737
- state.file.forceProcessing = state.opts.autoProcessRoot && state.filename ? state.filename.includes(toPlatformPath(`${state.file.opts.root}/${state.opts.autoProcessRoot}/`)) : false;
738
- path.traverse({
741
+ state.file.forceProcessing = state.filename?.includes(appRoot) ?? false;
742
+ path2.traverse({
739
743
  BlockStatement(blockPath) {
740
744
  if (isInsideNodeModules(state)) {
741
745
  return;
@@ -744,41 +748,41 @@ function index_default() {
744
748
  }
745
749
  });
746
750
  },
747
- exit(path, state) {
751
+ exit(path2, state) {
748
752
  if (isInsideNodeModules(state)) {
749
753
  return;
750
754
  }
751
755
  if (state.file.addUnistylesRequire) {
752
- return addUnistylesRequire(path, state);
756
+ return addUnistylesRequire(path2, state);
753
757
  }
754
758
  if (state.file.hasAnyUnistyle || state.file.hasVariants || state.file.replaceWithUnistyles || state.file.forceProcessing) {
755
- addUnistylesImport(path, state);
759
+ addUnistylesImport(path2, state);
756
760
  }
757
761
  }
758
762
  },
759
- FunctionDeclaration(path, state) {
763
+ FunctionDeclaration(path2, state) {
760
764
  if (isInsideNodeModules(state)) {
761
765
  return;
762
766
  }
763
- const componentName = path.node.id ? path.node.id.name : null;
767
+ const componentName = path2.node.id ? path2.node.id.name : null;
764
768
  if (componentName) {
765
769
  state.file.hasVariants = false;
766
770
  }
767
771
  },
768
- ClassDeclaration(path, state) {
772
+ ClassDeclaration(path2, state) {
769
773
  if (isInsideNodeModules(state)) {
770
774
  return;
771
775
  }
772
- const componentName = path.node.id ? path.node.id.name : null;
776
+ const componentName = path2.node.id ? path2.node.id.name : null;
773
777
  if (componentName) {
774
778
  state.file.hasVariants = false;
775
779
  }
776
780
  },
777
- VariableDeclaration(path, state) {
781
+ VariableDeclaration(path2, state) {
778
782
  if (isInsideNodeModules(state)) {
779
783
  return;
780
784
  }
781
- path.node.declarations.forEach((declaration) => {
785
+ path2.node.declarations.forEach((declaration) => {
782
786
  if (t6.isArrowFunctionExpression(declaration.init) || t6.isFunctionExpression(declaration.init)) {
783
787
  const componentName = declaration.id && t6.isIdentifier(declaration.id) ? declaration.id.name : null;
784
788
  if (componentName) {
@@ -787,83 +791,83 @@ function index_default() {
787
791
  }
788
792
  });
789
793
  },
790
- ImportDeclaration(path, state) {
794
+ ImportDeclaration(path2, state) {
791
795
  const exoticImport = REPLACE_WITH_UNISTYLES_EXOTIC_PATHS.concat(state.opts.autoRemapImports ?? []).find((exotic) => state.filename?.includes(exotic.path));
792
796
  if (exoticImport) {
793
- return handleExoticImport(path, state, exoticImport);
797
+ return handleExoticImport(path2, state, exoticImport);
794
798
  }
795
799
  if (isInsideNodeModules(state)) {
796
800
  return;
797
801
  }
798
- const importSource = path.node.source.value;
802
+ const importSource = path2.node.source.value;
799
803
  if (importSource.includes("react-native-unistyles")) {
800
804
  state.file.hasUnistylesImport = true;
801
- path.node.specifiers.forEach((specifier) => {
805
+ path2.node.specifiers.forEach((specifier) => {
802
806
  if (t6.isImportSpecifier(specifier) && t6.isIdentifier(specifier.imported) && specifier.imported.name === "StyleSheet") {
803
807
  state.file.styleSheetLocalName = specifier.local.name;
804
808
  }
805
809
  });
806
810
  }
807
811
  if (importSource === "react-native") {
808
- path.node.specifiers.forEach((specifier) => {
812
+ path2.node.specifiers.forEach((specifier) => {
809
813
  if (t6.isImportSpecifier(specifier) && t6.isIdentifier(specifier.imported) && REACT_NATIVE_COMPONENT_NAMES.includes(specifier.imported.name)) {
810
814
  state.reactNativeImports[specifier.local.name] = specifier.imported.name;
811
815
  }
812
816
  });
813
817
  }
814
- if (importSource.includes(toPlatformPath("react-native/Libraries"))) {
815
- handleExoticImport(path, state, NATIVE_COMPONENTS_PATHS);
818
+ if (importSource.includes("react-native/Libraries")) {
819
+ handleExoticImport(path2, state, NATIVE_COMPONENTS_PATHS);
816
820
  }
817
821
  if (!state.file.forceProcessing && Array.isArray(state.opts.autoProcessImports)) {
818
822
  state.file.forceProcessing = state.opts.autoProcessImports.includes(importSource);
819
823
  }
820
824
  },
821
- JSXElement(path, state) {
825
+ JSXElement(path2, state) {
822
826
  if (isInsideNodeModules(state)) {
823
827
  return;
824
828
  }
825
- if (hasStringRef(path)) {
829
+ if (hasStringRef(path2)) {
826
830
  throw new Error("Detected string based ref which is not supported by Unistyles.");
827
831
  }
828
832
  },
829
- MemberExpression(path, state) {
833
+ MemberExpression(path2, state) {
830
834
  if (isInsideNodeModules(state)) {
831
835
  return;
832
836
  }
833
- if (!state.file.reactNativeCommonJSName || !t6.isIdentifier(path.node.object)) {
837
+ if (!state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.object)) {
834
838
  return;
835
839
  }
836
- if (path.node.object.name !== state.file.reactNativeCommonJSName || !t6.isIdentifier(path.node.property)) {
840
+ if (path2.node.object.name !== state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.property)) {
837
841
  return;
838
842
  }
839
- if (!REACT_NATIVE_COMPONENT_NAMES.includes(path.node.property.name)) {
843
+ if (!REACT_NATIVE_COMPONENT_NAMES.includes(path2.node.property.name)) {
840
844
  return;
841
845
  }
842
- if (!state.reactNativeImports[path.node.property.name]) {
843
- const uniqueId = path.scope.generateUidIdentifier(`reactNativeUnistyles_${path.node.property.name}`);
844
- state.reactNativeImports[path.node.property.name] = uniqueId.name;
846
+ if (!state.reactNativeImports[path2.node.property.name]) {
847
+ const uniqueId = path2.scope.generateUidIdentifier(`reactNativeUnistyles_${path2.node.property.name}`);
848
+ state.reactNativeImports[path2.node.property.name] = uniqueId.name;
845
849
  state.file.addUnistylesRequire = true;
846
850
  }
847
- path.node.object.name = state.reactNativeImports[path.node.property.name];
851
+ path2.node.object.name = state.reactNativeImports[path2.node.property.name];
848
852
  },
849
- CallExpression(path, state) {
853
+ CallExpression(path2, state) {
850
854
  if (isInsideNodeModules(state)) {
851
855
  return;
852
856
  }
853
- if (isUnistylesCommonJSRequire(path, state)) {
857
+ if (isUnistylesCommonJSRequire(path2, state)) {
854
858
  return;
855
859
  }
856
- if (isReactNativeCommonJSRequire(path, state)) {
860
+ if (isReactNativeCommonJSRequire(path2, state)) {
857
861
  return;
858
862
  }
859
- if (!isUnistylesStyleSheet(path, state) && !isKindOfStyleSheet(path, state)) {
863
+ if (!isUnistylesStyleSheet(path2, state) && !isKindOfStyleSheet(path2, state)) {
860
864
  return;
861
865
  }
862
866
  state.file.hasAnyUnistyle = true;
863
- addStyleSheetTag(path, state);
864
- const arg = t6.isAssignmentExpression(path.node.arguments[0]) ? path.node.arguments[0].right : path.node.arguments[0];
867
+ addStyleSheetTag(path2, state);
868
+ const arg = t6.isAssignmentExpression(path2.node.arguments[0]) ? path2.node.arguments[0].right : path2.node.arguments[0];
865
869
  if (t6.isObjectExpression(arg)) {
866
- const detectedDependencies = getStylesDependenciesFromObject(path);
870
+ const detectedDependencies = getStylesDependenciesFromObject(path2);
867
871
  if (detectedDependencies) {
868
872
  if (t6.isObjectExpression(arg)) {
869
873
  arg.properties.forEach((property) => {
@@ -875,7 +879,7 @@ function index_default() {
875
879
  }
876
880
  }
877
881
  if (t6.isArrowFunctionExpression(arg) || t6.isFunctionExpression(arg)) {
878
- const funcPath = t6.isAssignmentExpression(path.node.arguments[0]) ? path.get("arguments.0.right") : path.get("arguments.0");
882
+ const funcPath = t6.isAssignmentExpression(path2.node.arguments[0]) ? path2.get("arguments.0.right") : path2.get("arguments.0");
879
883
  const detectedDependencies = getStylesDependenciesFromFunction(funcPath);
880
884
  if (detectedDependencies) {
881
885
  const body = t6.isBlockStatement(arg.body) ? arg.body.body.find((statement) => t6.isReturnStatement(statement))?.argument : arg.body;
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../lib/commonjs/reanimated/index",
3
+ "module": "../lib/module/reanimated/index",
4
+ "react-native": "../src/reanimated/index",
5
+ "types": "../lib/typescript/src/reanimated/index"
6
+ }
@@ -0,0 +1,19 @@
1
+ import type {Compiler,LoaderContext,RspackPluginInstance } from '@rspack/core'
2
+ import type { UnistylesPluginOptions } from 'react-native-unistyles/plugin'
3
+
4
+ export declare const BASE_REPACK_EXCLUDE_PATHS: Array<RegExp>
5
+ interface ConstructorParams {
6
+ ruleExcludePaths?: Array<RegExp>
7
+ unistylesPluginOptions?: UnistylesPluginOptions
8
+ }
9
+
10
+ export declare class RepackUnistylePlugin implements RspackPluginInstance {
11
+ private ruleExcludePaths
12
+ private unistylesPluginOptions
13
+ constructor({ ruleExcludePaths, unistylesPluginOptions }?: ConstructorParams)
14
+ apply(compiler: Compiler): void
15
+ }
16
+
17
+ declare function unistylesLoader(this: LoaderContext<UnistylesLoaderOptions>, source: string): void;
18
+
19
+ export default unistylesLoader