@fluentic/style 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +409 -0
  4. package/atomic/atRule/counterStyle.ts +35 -0
  5. package/atomic/atRule/fontFace.ts +37 -0
  6. package/atomic/atRule/fontPaletteValues.ts +36 -0
  7. package/atomic/atRule/fontSrc.ts +13 -0
  8. package/atomic/atRule/keyframes.ts +43 -0
  9. package/atomic/atRule/positionTry.ts +73 -0
  10. package/atomic/atRule/property.ts +39 -0
  11. package/atomic/atRule/utils.ts +81 -0
  12. package/atomic/className.ts +93 -0
  13. package/atomic/debug/className/className.ts +33 -0
  14. package/atomic/debug/className/index.ts +1 -0
  15. package/atomic/debug/property/data.ts +59 -0
  16. package/atomic/debug/property/index.ts +1 -0
  17. package/atomic/debug/property/property.ts +59 -0
  18. package/atomic/debug/selector.ts +88 -0
  19. package/atomic/debug/value.ts +53 -0
  20. package/atomic/element.ts +29 -0
  21. package/atomic/layer/README.md +116 -0
  22. package/atomic/layer/index.ts +3 -0
  23. package/atomic/layer/layer.ts +95 -0
  24. package/atomic/layer/types.ts +37 -0
  25. package/atomic/layer/utils.ts +51 -0
  26. package/atomic/property/index.ts +2 -0
  27. package/atomic/property/presets.ts +34 -0
  28. package/atomic/property/property.ts +13 -0
  29. package/atomic/property/type_maps.ts +389 -0
  30. package/atomic/property/types.ts +7 -0
  31. package/atomic/rule.ts +116 -0
  32. package/atomic/theme.ts +48 -0
  33. package/atomic/token.ts +53 -0
  34. package/atomic/utils/css.ts +49 -0
  35. package/atomic/utils/debug.ts +37 -0
  36. package/atomic/utils/format.ts +192 -0
  37. package/atomic/utils/selector.ts +14 -0
  38. package/atomic/utils/types.ts +11 -0
  39. package/atomic/value/index.ts +2 -0
  40. package/atomic/value/unitless.ts +47 -0
  41. package/atomic/value/value.ts +17 -0
  42. package/atomic/var.ts +19 -0
  43. package/builder/data/check_selector.noop.ts +8 -0
  44. package/builder/data/check_selector.ts +30 -0
  45. package/builder/data/const.ts +25 -0
  46. package/builder/data/create.ts +96 -0
  47. package/builder/data/data.ts +63 -0
  48. package/builder/data/debug.ts +113 -0
  49. package/builder/data/index.ts +9 -0
  50. package/builder/data/is.ts +68 -0
  51. package/builder/data/merge/index.ts +2 -0
  52. package/builder/data/merge/scope.ts +300 -0
  53. package/builder/data/merge/style.ts +284 -0
  54. package/builder/data/merge/utils.ts +35 -0
  55. package/builder/data/selector.ts +11 -0
  56. package/builder/data/state.ts +134 -0
  57. package/builder/extract/index.ts +6 -0
  58. package/builder/extract/scope.ts +30 -0
  59. package/builder/extract/slot.ts +36 -0
  60. package/builder/extract/style.ts +89 -0
  61. package/builder/extract/theme.ts +16 -0
  62. package/builder/extract/token.ts +41 -0
  63. package/builder/extract/utils.ts +95 -0
  64. package/builder/extract/withTokens.ts +64 -0
  65. package/builder/index.ts +2 -0
  66. package/builder/style_builder.ts +234 -0
  67. package/builder/style_data.ts +81 -0
  68. package/builder/style_fns.ts +611 -0
  69. package/builder/types/alias.ts +83 -0
  70. package/builder/types/fns.ts +185 -0
  71. package/builder/types/index.ts +1 -0
  72. package/builder/types/types.ts +51 -0
  73. package/builder/utils.ts +19 -0
  74. package/compiler/compiler/cache.ts +155 -0
  75. package/compiler/compiler/compiler.ts +173 -0
  76. package/compiler/compiler/index.ts +3 -0
  77. package/compiler/compiler/types.ts +62 -0
  78. package/compiler/extract/collector.ts +25 -0
  79. package/compiler/extract/extract.ts +51 -0
  80. package/compiler/extract/index.ts +3 -0
  81. package/compiler/extract/types.ts +35 -0
  82. package/compiler/index.ts +2 -0
  83. package/compiler/transform/debug/index.ts +2 -0
  84. package/compiler/transform/debug/plugin.ts +1347 -0
  85. package/compiler/transform/debug/transform.ts +47 -0
  86. package/compiler/transform/debug/utils/debug_data.ts +187 -0
  87. package/compiler/transform/debug/utils/source_url.ts +29 -0
  88. package/compiler/transform/evaluator/evaluator.ts +1138 -0
  89. package/compiler/transform/evaluator/index.ts +3 -0
  90. package/compiler/transform/evaluator/tracer.ts +607 -0
  91. package/compiler/transform/evaluator/types.ts +22 -0
  92. package/compiler/transform/extract/chain/chain.ts +2343 -0
  93. package/compiler/transform/extract/chain/extract_chain.ts +89 -0
  94. package/compiler/transform/extract/chain/index.ts +3 -0
  95. package/compiler/transform/extract/chain/types.ts +37 -0
  96. package/compiler/transform/extract/index.ts +2 -0
  97. package/compiler/transform/extract/plugin.ts +665 -0
  98. package/compiler/transform/extract/transform.ts +45 -0
  99. package/compiler/transform/extract/utils/imports.ts +132 -0
  100. package/compiler/transform/extract/utils/replacement.ts +349 -0
  101. package/compiler/transform/extract/utils/slot.ts +186 -0
  102. package/compiler/transform/extract/utils/state.ts +48 -0
  103. package/compiler/transform/extract/utils/theme.ts +86 -0
  104. package/compiler/transform/extract/utils/token.ts +1 -0
  105. package/compiler/transform/index.ts +5 -0
  106. package/compiler/transform/syntax/index.ts +5 -0
  107. package/compiler/transform/syntax/isStaticStyleValue.ts +44 -0
  108. package/compiler/transform/syntax/isStyleChainCall.ts +16 -0
  109. package/compiler/transform/syntax/static_ids.ts +282 -0
  110. package/compiler/transform/syntax/types.ts +7 -0
  111. package/compiler/transform/syntax/utils.ts +31 -0
  112. package/compiler/transform/utils/babel.ts +100 -0
  113. package/compiler/transform/utils/import.ts +47 -0
  114. package/compiler/transform/utils/path.ts +13 -0
  115. package/compiler/transform/utils/selector.ts +252 -0
  116. package/compiler/utils/constants.ts +69 -0
  117. package/compiler/utils/file_resolver.ts +72 -0
  118. package/compiler/utils/import_source.ts +200 -0
  119. package/compiler/utils/imports.ts +24 -0
  120. package/compiler/utils/path.ts +40 -0
  121. package/compiler/utils/sourcemap.ts +61 -0
  122. package/config/build.ts +32 -0
  123. package/config/config/css.ts +32 -0
  124. package/config/config/css_extra.ts +22 -0
  125. package/config/config/debug.ts +26 -0
  126. package/config/config/dev.ts +145 -0
  127. package/config/config/runtime.ts +29 -0
  128. package/config/configure.ts +28 -0
  129. package/config/constants.ts +1 -0
  130. package/config/index.ts +2 -0
  131. package/config/types.ts +56 -0
  132. package/config/utils.ts +5 -0
  133. package/css/counterStyle.ts +20 -0
  134. package/css/fontFace.ts +25 -0
  135. package/css/fontPaletteValues.ts +20 -0
  136. package/css/index.ts +8 -0
  137. package/css/keyframes.ts +20 -0
  138. package/css/positionTry.ts +20 -0
  139. package/css/property.ts +32 -0
  140. package/css/utils.ts +56 -0
  141. package/dev/config.ts +16 -0
  142. package/dev/fns.ts +48 -0
  143. package/dev/index.ts +2 -0
  144. package/dev/trace.ts +413 -0
  145. package/dev/utils.ts +528 -0
  146. package/dist/assert-h_Zkqc4E.js +105 -0
  147. package/dist/assert-h_Zkqc4E.js.map +1 -0
  148. package/dist/className-C1Ht5Wvv.js +144 -0
  149. package/dist/className-C1Ht5Wvv.js.map +1 -0
  150. package/dist/className-DC2Cq8p3.js +251 -0
  151. package/dist/className-DC2Cq8p3.js.map +1 -0
  152. package/dist/compiler/index.mjs +2 -0
  153. package/dist/compiler-DweanHoB.mjs +6847 -0
  154. package/dist/compiler-DweanHoB.mjs.map +1 -0
  155. package/dist/config/index.js +3 -0
  156. package/dist/config-BryWDfQX.js +25 -0
  157. package/dist/config-BryWDfQX.js.map +1 -0
  158. package/dist/config-DKHXWhe1.js +1 -0
  159. package/dist/config-Di2VYYKV.js +6 -0
  160. package/dist/config-Di2VYYKV.js.map +1 -0
  161. package/dist/config-DloHOG6I.js +13 -0
  162. package/dist/config-DloHOG6I.js.map +1 -0
  163. package/dist/css-BowBszUt.js +243 -0
  164. package/dist/css-BowBszUt.js.map +1 -0
  165. package/dist/css-ByOrugEX.js +805 -0
  166. package/dist/css-ByOrugEX.js.map +1 -0
  167. package/dist/css-DcazYor9.js +235 -0
  168. package/dist/css-DcazYor9.js.map +1 -0
  169. package/dist/css.js +2 -0
  170. package/dist/css_extra-DlOnsnR1.js +8 -0
  171. package/dist/css_extra-DlOnsnR1.js.map +1 -0
  172. package/dist/css_extra-oIi3UEPK.js +8 -0
  173. package/dist/css_extra-oIi3UEPK.js.map +1 -0
  174. package/dist/data-_te7t0M4.js +473 -0
  175. package/dist/data-_te7t0M4.js.map +1 -0
  176. package/dist/debug-BAw63qX6.js +15 -0
  177. package/dist/debug-BAw63qX6.js.map +1 -0
  178. package/dist/debug-DGki_v7g.js +15 -0
  179. package/dist/debug-DGki_v7g.js.map +1 -0
  180. package/dist/debug-n2aZQBSa.js +172 -0
  181. package/dist/debug-n2aZQBSa.js.map +1 -0
  182. package/dist/dev/rsc.js +183 -0
  183. package/dist/dev/rsc.js.map +1 -0
  184. package/dist/dev-CcphAa3R.js +376 -0
  185. package/dist/dev-CcphAa3R.js.map +1 -0
  186. package/dist/dev-DfBbuLeE.js +71 -0
  187. package/dist/dev-DfBbuLeE.js.map +1 -0
  188. package/dist/dev.js +2 -0
  189. package/dist/elementMarker-Bu7gDAkE.js +800 -0
  190. package/dist/elementMarker-Bu7gDAkE.js.map +1 -0
  191. package/dist/entry/dev/css.js +3 -0
  192. package/dist/entry/dev/jsx-dev-runtime.js +3 -0
  193. package/dist/entry/dev/jsx-runtime.js +3 -0
  194. package/dist/entry/dev.js +10 -0
  195. package/dist/entry/prod/css.js +3 -0
  196. package/dist/entry/prod/extract.js +3 -0
  197. package/dist/entry/prod/jsx-dev-runtime.js +3 -0
  198. package/dist/entry/prod/jsx-runtime.js +3 -0
  199. package/dist/entry/prod/runtime.js +5 -0
  200. package/dist/entry/prod.js +1230 -0
  201. package/dist/entry/prod.js.map +1 -0
  202. package/dist/entry/rsc-dev/css.js +3 -0
  203. package/dist/entry/rsc-dev/dev.js +544 -0
  204. package/dist/entry/rsc-dev/dev.js.map +1 -0
  205. package/dist/entry/rsc-dev/jsx-dev-runtime.js +12 -0
  206. package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -0
  207. package/dist/entry/rsc-dev/jsx-runtime.js +3 -0
  208. package/dist/entry/rsc-dev.js +1429 -0
  209. package/dist/entry/rsc-dev.js.map +1 -0
  210. package/dist/entry/rsc-prod/css.js +3 -0
  211. package/dist/entry/rsc-prod/jsx-dev-runtime.js +3 -0
  212. package/dist/entry/rsc-prod/jsx-runtime.js +3 -0
  213. package/dist/entry/rsc-prod/runtime.js +5 -0
  214. package/dist/entry/rsc-prod.js +10 -0
  215. package/dist/extract-CzWJeQi8.js +121 -0
  216. package/dist/extract-CzWJeQi8.js.map +1 -0
  217. package/dist/extract-DEwSDJ9Z.js +2 -0
  218. package/dist/format-3nKBE_5t.js +144 -0
  219. package/dist/format-3nKBE_5t.js.map +1 -0
  220. package/dist/getClassName-BlvXHYuf.js +260 -0
  221. package/dist/getClassName-BlvXHYuf.js.map +1 -0
  222. package/dist/global-CvfmFLsK.js +11 -0
  223. package/dist/global-CvfmFLsK.js.map +1 -0
  224. package/dist/index.js +9 -0
  225. package/dist/jsx/jsx-dev-runtime.js +12 -0
  226. package/dist/jsx/jsx-dev-runtime.js.map +1 -0
  227. package/dist/jsx/jsx-dev-runtime.server.js +11 -0
  228. package/dist/jsx/jsx-dev-runtime.server.js.map +1 -0
  229. package/dist/jsx/jsx-runtime.js +13 -0
  230. package/dist/jsx/jsx-runtime.js.map +1 -0
  231. package/dist/jsx/jsx-runtime.server.js +12 -0
  232. package/dist/jsx/jsx-runtime.server.js.map +1 -0
  233. package/dist/jsx-CwTeyUxr.js +39 -0
  234. package/dist/jsx-CwTeyUxr.js.map +1 -0
  235. package/dist/jsx-D2BksHSv.js +38 -0
  236. package/dist/jsx-D2BksHSv.js.map +1 -0
  237. package/dist/jsx_dev_runtime-B6xs4by8.js +12 -0
  238. package/dist/jsx_dev_runtime-B6xs4by8.js.map +1 -0
  239. package/dist/jsx_runtime-04xfnsi7.js +13 -0
  240. package/dist/jsx_runtime-04xfnsi7.js.map +1 -0
  241. package/dist/jsx_runtime-iHLDwpcW.js +12 -0
  242. package/dist/jsx_runtime-iHLDwpcW.js.map +1 -0
  243. package/dist/layer-D1SaH07m.js +94 -0
  244. package/dist/layer-D1SaH07m.js.map +1 -0
  245. package/dist/loader-DS61nRqr.mjs +81 -0
  246. package/dist/loader-DS61nRqr.mjs.map +1 -0
  247. package/dist/misc-B9kqEb2N.mjs +360 -0
  248. package/dist/misc-B9kqEb2N.mjs.map +1 -0
  249. package/dist/plugin/farm/index.mjs +176 -0
  250. package/dist/plugin/farm/index.mjs.map +1 -0
  251. package/dist/plugin/nextjs/index.mjs +282 -0
  252. package/dist/plugin/nextjs/index.mjs.map +1 -0
  253. package/dist/plugin/nextjs/loader.mjs +162 -0
  254. package/dist/plugin/nextjs/loader.mjs.map +1 -0
  255. package/dist/plugin/parcel/index.cjs +9 -0
  256. package/dist/plugin/parcel/index.mjs +5 -0
  257. package/dist/plugin/parcel/optimizer.cjs +28 -0
  258. package/dist/plugin/parcel/optimizer.cjs.map +1 -0
  259. package/dist/plugin/parcel/optimizer.mjs +29 -0
  260. package/dist/plugin/parcel/optimizer.mjs.map +1 -0
  261. package/dist/plugin/parcel/resolver.cjs +17 -0
  262. package/dist/plugin/parcel/resolver.cjs.map +1 -0
  263. package/dist/plugin/parcel/resolver.mjs +18 -0
  264. package/dist/plugin/parcel/resolver.mjs.map +1 -0
  265. package/dist/plugin/parcel/runtime.cjs +17 -0
  266. package/dist/plugin/parcel/runtime.cjs.map +1 -0
  267. package/dist/plugin/parcel/runtime.mjs +17 -0
  268. package/dist/plugin/parcel/runtime.mjs.map +1 -0
  269. package/dist/plugin/parcel/transformer.cjs +41 -0
  270. package/dist/plugin/parcel/transformer.cjs.map +1 -0
  271. package/dist/plugin/parcel/transformer.mjs +41 -0
  272. package/dist/plugin/parcel/transformer.mjs.map +1 -0
  273. package/dist/plugin/rspack/index.mjs +11 -0
  274. package/dist/plugin/rspack/index.mjs.map +1 -0
  275. package/dist/plugin/vite/index.mjs +176 -0
  276. package/dist/plugin/vite/index.mjs.map +1 -0
  277. package/dist/plugin/webpack/index.mjs +2 -0
  278. package/dist/plugin/webpack/loader.mjs +19 -0
  279. package/dist/plugin/webpack/loader.mjs.map +1 -0
  280. package/dist/presets-Bye3ea2x.js +139 -0
  281. package/dist/presets-Bye3ea2x.js.map +1 -0
  282. package/dist/property-CnLFt5kx.js +406 -0
  283. package/dist/property-CnLFt5kx.js.map +1 -0
  284. package/dist/registry-CyIj8LYK.mjs +22 -0
  285. package/dist/registry-CyIj8LYK.mjs.map +1 -0
  286. package/dist/rules-9HSO1pxL.js +767 -0
  287. package/dist/rules-9HSO1pxL.js.map +1 -0
  288. package/dist/runtime-CYqNCiaM.js +53 -0
  289. package/dist/runtime-CYqNCiaM.js.map +1 -0
  290. package/dist/selector/index.js +3 -0
  291. package/dist/server.js +63 -0
  292. package/dist/server.js.map +1 -0
  293. package/dist/shared-BAL9peIw.cjs +7646 -0
  294. package/dist/shared-BAL9peIw.cjs.map +1 -0
  295. package/dist/shared-CCpq1zqA.mjs +132 -0
  296. package/dist/shared-CCpq1zqA.mjs.map +1 -0
  297. package/dist/sidecar-4u6GnlQG.mjs +236 -0
  298. package/dist/sidecar-4u6GnlQG.mjs.map +1 -0
  299. package/dist/style-4rFUy-zW.js +752 -0
  300. package/dist/style-4rFUy-zW.js.map +1 -0
  301. package/dist/style-B1UUqjj5.js +743 -0
  302. package/dist/style-B1UUqjj5.js.map +1 -0
  303. package/dist/style-Cw3NtvR0.js +5 -0
  304. package/dist/style-DNqQ6H-7.js +1255 -0
  305. package/dist/style-DNqQ6H-7.js.map +1 -0
  306. package/dist/styleStore-Dea_WVbr.js +2000 -0
  307. package/dist/styleStore-Dea_WVbr.js.map +1 -0
  308. package/dist/styleStore-DyNXBcUK.js +54 -0
  309. package/dist/styleStore-DyNXBcUK.js.map +1 -0
  310. package/dist/token-CKXUECuU.js +76 -0
  311. package/dist/token-CKXUECuU.js.map +1 -0
  312. package/dist/token-u_tM-mtg.js +204 -0
  313. package/dist/token-u_tM-mtg.js.map +1 -0
  314. package/dist/trace-Bu_qOqRy.js +245 -0
  315. package/dist/trace-Bu_qOqRy.js.map +1 -0
  316. package/dist/trace-CU0rvNYr.js +244 -0
  317. package/dist/trace-CU0rvNYr.js.map +1 -0
  318. package/dist/utils-BbehLOby.js +2415 -0
  319. package/dist/utils-BbehLOby.js.map +1 -0
  320. package/dist/utils-C7xfDxtM.mjs +97 -0
  321. package/dist/utils-C7xfDxtM.mjs.map +1 -0
  322. package/dist/utils-CWNHx4EC.js +170 -0
  323. package/dist/utils-CWNHx4EC.js.map +1 -0
  324. package/dist/utils-CdI6vZsP.js +37 -0
  325. package/dist/utils-CdI6vZsP.js.map +1 -0
  326. package/dist/utils-D7FAOyg6.js +129 -0
  327. package/dist/utils-D7FAOyg6.js.map +1 -0
  328. package/dist/utils-DMFgOOtA.mjs +49 -0
  329. package/dist/utils-DMFgOOtA.mjs.map +1 -0
  330. package/dist/utils.js +26 -0
  331. package/dist/utils.js.map +1 -0
  332. package/dist/value-BR4e2MKt.js +910 -0
  333. package/dist/value-BR4e2MKt.js.map +1 -0
  334. package/dist/value-E8rEv2Oe.js +136 -0
  335. package/dist/value-E8rEv2Oe.js.map +1 -0
  336. package/dist/valueRef-lshFk1Cs.js +16 -0
  337. package/dist/valueRef-lshFk1Cs.js.map +1 -0
  338. package/dist/webpack-CxS2FDYU.mjs +107 -0
  339. package/dist/webpack-CxS2FDYU.mjs.map +1 -0
  340. package/dist/withTokens-LRidu3Vc.js +95 -0
  341. package/dist/withTokens-LRidu3Vc.js.map +1 -0
  342. package/entry/dev/config.ts +2 -0
  343. package/entry/dev/css.ts +3 -0
  344. package/entry/dev/index.ts +3 -0
  345. package/entry/dev/jsx_dev_runtime.ts +3 -0
  346. package/entry/dev/jsx_runtime.ts +3 -0
  347. package/entry/prod/config.ts +2 -0
  348. package/entry/prod/css.ts +3 -0
  349. package/entry/prod/extract.ts +1 -0
  350. package/entry/prod/index.ts +3 -0
  351. package/entry/prod/jsx_dev_runtime.ts +3 -0
  352. package/entry/prod/jsx_runtime.ts +3 -0
  353. package/entry/prod/runtime.ts +14 -0
  354. package/entry/rsc_dev/config.ts +6 -0
  355. package/entry/rsc_dev/css.ts +3 -0
  356. package/entry/rsc_dev/dev.ts +5 -0
  357. package/entry/rsc_dev/index.ts +3 -0
  358. package/entry/rsc_dev/jsx_dev_runtime.ts +3 -0
  359. package/entry/rsc_dev/jsx_runtime.ts +3 -0
  360. package/entry/rsc_dev/server.ts +11 -0
  361. package/entry/rsc_prod/config.ts +6 -0
  362. package/entry/rsc_prod/css.ts +3 -0
  363. package/entry/rsc_prod/index.ts +3 -0
  364. package/entry/rsc_prod/jsx_dev_runtime.ts +3 -0
  365. package/entry/rsc_prod/jsx_runtime.ts +3 -0
  366. package/entry/rsc_prod/runtime.ts +12 -0
  367. package/entry/rsc_prod/server.ts +13 -0
  368. package/entry/shared/config.ts +5 -0
  369. package/entry/shared/dev.ts +19 -0
  370. package/entry/shared/prod.ts +4 -0
  371. package/index.ts +36 -0
  372. package/jsx/extracted/jsx_dev_runtime.ts +11 -0
  373. package/jsx/extracted/jsx_runtime.ts +12 -0
  374. package/jsx/rsc/jsx_dev_runtime.ts +11 -0
  375. package/jsx/rsc/jsx_runtime.ts +12 -0
  376. package/jsx/rsc_extracted/jsx_dev_runtime.ts +2 -0
  377. package/jsx/rsc_extracted/jsx_runtime.ts +2 -0
  378. package/jsx/runtime/jsx_dev_runtime.ts +11 -0
  379. package/jsx/runtime/jsx_runtime.ts +12 -0
  380. package/jsx/types.ts +8 -0
  381. package/jsx/utils.ts +59 -0
  382. package/package.json +298 -0
  383. package/plugin/bundler/farm/index.ts +1 -0
  384. package/plugin/bundler/farm/plugin.ts +320 -0
  385. package/plugin/bundler/parcel/config.json +19 -0
  386. package/plugin/bundler/parcel/index.ts +1 -0
  387. package/plugin/bundler/parcel/optimizer.ts +36 -0
  388. package/plugin/bundler/parcel/plugin.ts +4 -0
  389. package/plugin/bundler/parcel/resolver.ts +36 -0
  390. package/plugin/bundler/parcel/runtime.ts +23 -0
  391. package/plugin/bundler/parcel/shared.ts +234 -0
  392. package/plugin/bundler/parcel/transformer.ts +67 -0
  393. package/plugin/bundler/rspack/index.ts +1 -0
  394. package/plugin/bundler/rspack/plugin.ts +14 -0
  395. package/plugin/bundler/vite/index.ts +1 -0
  396. package/plugin/bundler/vite/plugin.ts +133 -0
  397. package/plugin/bundler/vite/state.ts +153 -0
  398. package/plugin/bundler/webpack/index.ts +1 -0
  399. package/plugin/bundler/webpack/loader.ts +19 -0
  400. package/plugin/bundler/webpack/plugin.ts +240 -0
  401. package/plugin/bundler/webpack/shared/index.ts +2 -0
  402. package/plugin/bundler/webpack/shared/loader.ts +155 -0
  403. package/plugin/bundler/webpack/shared/registry.ts +16 -0
  404. package/plugin/bundler/webpack/utils.ts +96 -0
  405. package/plugin/nextjs/constants.ts +7 -0
  406. package/plugin/nextjs/html.ts +62 -0
  407. package/plugin/nextjs/index.ts +2 -0
  408. package/plugin/nextjs/loader.ts +222 -0
  409. package/plugin/nextjs/plugin.ts +532 -0
  410. package/plugin/nextjs/types.ts +33 -0
  411. package/plugin/nextjs/utils.ts +210 -0
  412. package/plugin/utils/cache/css_cache.ts +146 -0
  413. package/plugin/utils/cache/file.ts +40 -0
  414. package/plugin/utils/cache/index.ts +2 -0
  415. package/plugin/utils/compiler.ts +94 -0
  416. package/plugin/utils/constants.ts +7 -0
  417. package/plugin/utils/cssMarker.ts +14 -0
  418. package/plugin/utils/cssOutput.ts +65 -0
  419. package/plugin/utils/filter.ts +98 -0
  420. package/plugin/utils/imports.ts +5 -0
  421. package/plugin/utils/index.ts +10 -0
  422. package/plugin/utils/injection.ts +28 -0
  423. package/plugin/utils/misc.ts +5 -0
  424. package/plugin/utils/runtimeEntry.ts +57 -0
  425. package/plugin/utils/sidecar/index.ts +1 -0
  426. package/plugin/utils/sidecar/server.ts +143 -0
  427. package/plugin/utils/sidecar/sidecar.ts +167 -0
  428. package/plugin/utils/sidecar/utils.ts +109 -0
  429. package/plugin/utils/sourcemap.ts +52 -0
  430. package/plugin/utils/virtual.ts +81 -0
  431. package/runtime/core/cache/combine.ts +102 -0
  432. package/runtime/core/cache/index.ts +5 -0
  433. package/runtime/core/cache/item.ts +231 -0
  434. package/runtime/core/cache/pool.ts +310 -0
  435. package/runtime/core/cache/prop.ts +283 -0
  436. package/runtime/core/cache/propCache.ts +62 -0
  437. package/runtime/core/cache/resolvedItem.ts +31 -0
  438. package/runtime/core/cache/result.ts +115 -0
  439. package/runtime/core/cache/stateItem.ts +208 -0
  440. package/runtime/core/cache/tokenValues.ts +150 -0
  441. package/runtime/core/cache/utils/tree.ts +57 -0
  442. package/runtime/core/cache/utils/walk.ts +24 -0
  443. package/runtime/core/className.ts +101 -0
  444. package/runtime/core/combinedStyle.ts +101 -0
  445. package/runtime/core/createTransformElement.ts +39 -0
  446. package/runtime/core/elementMarker.ts +189 -0
  447. package/runtime/core/elementMarkerData.ts +27 -0
  448. package/runtime/core/getClassName.ts +47 -0
  449. package/runtime/core/getSheetRules.ts +7 -0
  450. package/runtime/core/getToken.ts +14 -0
  451. package/runtime/core/index.ts +5 -0
  452. package/runtime/core/jsx.ts +4 -0
  453. package/runtime/core/resolveClassNameRuntime.ts +33 -0
  454. package/runtime/env.ts +7 -0
  455. package/runtime/extract/getClassName.ts +476 -0
  456. package/runtime/extract/index.ts +4 -0
  457. package/runtime/extract/jsx.ts +55 -0
  458. package/runtime/index.ts +12 -0
  459. package/runtime/rsc/constants.ts +6 -0
  460. package/runtime/rsc/dev.ts +38 -0
  461. package/runtime/rsc/getClassName.ts +98 -0
  462. package/runtime/rsc/index.ts +3 -0
  463. package/runtime/rsc/jsx.ts +4 -0
  464. package/runtime/rsc/observer.ts +238 -0
  465. package/runtime/rsc/styleStore.ts +82 -0
  466. package/runtime/sheet/element.ts +13 -0
  467. package/runtime/sheet/global-noop.ts +13 -0
  468. package/runtime/sheet/global-prod.ts +13 -0
  469. package/runtime/sheet/global.ts +13 -0
  470. package/runtime/sheet/index.ts +3 -0
  471. package/runtime/sheet/insert.ts +37 -0
  472. package/runtime/sheet/rule.ts +77 -0
  473. package/runtime/sheet/rules.ts +131 -0
  474. package/runtime/sheet/theme.ts +34 -0
  475. package/runtime/style/index.ts +3 -0
  476. package/runtime/style/scope.ts +65 -0
  477. package/runtime/style/style.ts +34 -0
  478. package/runtime/style/token.ts +1 -0
  479. package/runtime/types.ts +42 -0
  480. package/selector/assert.ts +131 -0
  481. package/selector/index.ts +5 -0
  482. package/selector/presets/default.ts +27 -0
  483. package/selector/presets/index.ts +3 -0
  484. package/selector/presets/minimal.ts +37 -0
  485. package/selector/presets/selectors.ts +85 -0
  486. package/selector/selector.ts +68 -0
  487. package/selector/types.ts +24 -0
  488. package/selector/validate.ts +91 -0
  489. package/sheet/dev/dev_layer.ts +151 -0
  490. package/sheet/dev/dev_sort.ts +249 -0
  491. package/sheet/dev/index.ts +129 -0
  492. package/sheet/dev/utils.ts +130 -0
  493. package/sheet/index.ts +4 -0
  494. package/sheet/prod.ts +109 -0
  495. package/sheet/sheet.ts +10 -0
  496. package/sheet/sourcemap.ts +70 -0
  497. package/sheet/types.ts +31 -0
  498. package/sheet/utils/dom.ts +71 -0
  499. package/sheet/utils/index.ts +4 -0
  500. package/sheet/utils/layer.ts +14 -0
  501. package/sheet/utils/noop.ts +11 -0
  502. package/sheet/utils/rule.ts +3 -0
  503. package/sheet/utils/sourcemap.ts +221 -0
  504. package/style/index.ts +9 -0
  505. package/style/keyframes.ts +40 -0
  506. package/style/style.ts +112 -0
  507. package/style/theme.ts +36 -0
  508. package/style/token.ts +101 -0
  509. package/style/tokens.ts +64 -0
  510. package/style/transform.ts +9 -0
  511. package/style/types.ts +32 -0
  512. package/style/utils/expose.ts +43 -0
  513. package/style/utils/index.ts +1 -0
  514. package/style/value.ts +103 -0
  515. package/style/valueRef.ts +25 -0
  516. package/utils/global.ts +44 -0
  517. package/utils/hash.ts +22 -0
  518. package/utils/id.ts +20 -0
  519. package/utils/object.ts +87 -0
  520. package/utils/trace.ts +211 -0
  521. package/utils/type.ts +22 -0
@@ -0,0 +1,94 @@
1
+ import { o as LayerPlaceholder } from "./runtime-CYqNCiaM.js";
2
+ import "./config-BryWDfQX.js";
3
+ import { c as hashString } from "./format-3nKBE_5t.js";
4
+ //#region atomic/layer/layer.ts
5
+ function compareLayerPriority(p1, p2) {
6
+ return p1[0] - p2[0] || p1[1] - p2[1] || p1[2] - p2[2] || p1[3] - p2[3] || p1[4] - p2[4] || p1[5] - p2[5] || p1[6] - p2[6];
7
+ }
8
+ function createLayerNamePool() {
9
+ const lookup = /* @__PURE__ */ new Map();
10
+ const getLayerId = (priority) => {
11
+ const key = priority.join("|");
12
+ let name = lookup.get(key);
13
+ if (name) return name;
14
+ name = "p" + hashString(key);
15
+ lookup.set(key, name);
16
+ return name;
17
+ };
18
+ const getLayerName = (layerNamespace, priority) => {
19
+ const layerId = getLayerId(priority);
20
+ return layerNamespace ? layerNamespace + "." + layerId : layerId;
21
+ };
22
+ return {
23
+ getLayerName,
24
+ getLayerId
25
+ };
26
+ }
27
+ function createLayerPool(layerNamespace) {
28
+ const namePool = createLayerNamePool();
29
+ const priorities = /* @__PURE__ */ new Map();
30
+ const getName = (priority) => {
31
+ const key = priority.join("|");
32
+ if (!priorities.has(key)) priorities.set(key, priority);
33
+ return namePool.getLayerName(layerNamespace, priority);
34
+ };
35
+ const getNames = () => {
36
+ return Array.from(priorities.values()).sort(compareLayerPriority).map((priority) => namePool.getLayerName(layerNamespace, priority));
37
+ };
38
+ return {
39
+ getName,
40
+ getNames
41
+ };
42
+ }
43
+ function flattenCssLayers(layers, layerNames) {
44
+ const names = typeof layerNames === "string" ? [layerNames] : layerNames;
45
+ return layers.flatMap((layer) => layer === "$layer" ? names : layer).filter(Boolean);
46
+ }
47
+ //#endregion
48
+ //#region atomic/layer/types.ts
49
+ const LayerDefaultLayers = [LayerPlaceholder];
50
+ const LayerDefaultPriority = [
51
+ 0,
52
+ 0,
53
+ 0,
54
+ 0,
55
+ 0,
56
+ 0,
57
+ 0
58
+ ];
59
+ const LayerMediaPriorities = {
60
+ base: 0,
61
+ media: 1,
62
+ priorityMedia: 2
63
+ };
64
+ const LayerSelectorPriorities = {
65
+ base: 0,
66
+ parentSelector: 1,
67
+ selector: 2,
68
+ prioritySelector: 3
69
+ };
70
+ const LayerPropertyPriorities = {
71
+ shorthand: 0,
72
+ intermediate: 1,
73
+ longhand: 2
74
+ };
75
+ //#endregion
76
+ //#region atomic/layer/utils.ts
77
+ function getLayerOrderCss(layers, layerNames) {
78
+ const names = flattenCssLayers(layers, layerNames);
79
+ if (!names.length) return "";
80
+ return "@layer " + names.join(", ") + ";";
81
+ }
82
+ function getLayerBlockCss(layerName, css) {
83
+ return "@layer " + layerName + " {" + css + "}";
84
+ }
85
+ function joinLayerCss(layerOrderCss, css) {
86
+ const output = [];
87
+ if (layerOrderCss) output.push(layerOrderCss);
88
+ output.push(...css);
89
+ return output.join("\n") + "\n";
90
+ }
91
+ //#endregion
92
+ export { LayerDefaultPriority as a, LayerSelectorPriorities as c, LayerDefaultLayers as i, compareLayerPriority as l, getLayerOrderCss as n, LayerMediaPriorities as o, joinLayerCss as r, LayerPropertyPriorities as s, getLayerBlockCss as t, createLayerPool as u };
93
+
94
+ //# sourceMappingURL=layer-D1SaH07m.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-D1SaH07m.js","names":[],"sources":["../atomic/layer/layer.ts","../atomic/layer/types.ts","../atomic/layer/utils.ts"],"sourcesContent":["import { LayerPlaceholder } from '../../config';\nimport { hashString } from '../../utils/hash';\nimport type { LayerPriority } from './types';\n\nexport function compareLayerPriority(\n p1: LayerPriority,\n p2: LayerPriority,\n) {\n // Priority expands from broad domains into narrower ones:\n // value -> direct selector -> parent selector -> media -> scope/origin -> property.\n return (\n // Explicit value weight wins across all lower priority domains.\n p1[0] - p2[0] ||\n // Direct selector bucket: base < parent-only < selector < priority selector.\n p1[1] - p2[1] ||\n // Parent selector bucket inside the same direct selector bucket.\n p1[2] - p2[2] ||\n // Media bucket inside the same selector/parent selector bucket.\n p1[3] - p2[3] ||\n // Nested at-rule depth inside the same media bucket.\n p1[4] - p2[4] ||\n // Scope-origin tiebreaker inside the same contextual bucket.\n p1[5] - p2[5] ||\n // Property bucket: shorthand < intermediate < longhand.\n p1[6] - p2[6]\n );\n}\n\nexport function createLayerNamePool() {\n const lookup: Map<string, string> = new Map();\n\n const getLayerId = (priority: LayerPriority) => {\n const key = priority.join('|');\n\n let name = lookup.get(key);\n if (name) return name;\n\n name = 'p' + hashString(key);\n lookup.set(key, name);\n\n return name;\n };\n\n const getLayerName = (layerNamespace: string, priority: LayerPriority) => {\n const layerId = getLayerId(priority);\n\n return layerNamespace ? layerNamespace + '.' + layerId : layerId;\n };\n\n return { getLayerName, getLayerId };\n}\n\nexport function createLayerPool(layerNamespace: string) {\n const namePool = createLayerNamePool();\n const priorities = new Map<string, LayerPriority>();\n\n const getName = (priority: LayerPriority) => {\n const key = priority.join('|');\n\n if (!priorities.has(key)) priorities.set(key, priority);\n\n return namePool.getLayerName(layerNamespace, priority);\n };\n\n const getNames = () => {\n const names = Array.from(priorities.values())\n .sort(compareLayerPriority)\n .map((priority) => namePool.getLayerName(layerNamespace, priority));\n\n return names;\n };\n\n return { getName, getNames };\n}\n\nexport function ensureLayerPlaceholder(layers: string[]) {\n layers = layers.filter(Boolean);\n\n return layers.includes(LayerPlaceholder)\n ? layers\n : layers.concat(LayerPlaceholder);\n}\n\nexport function flattenCssLayers(\n layers: readonly string[],\n layerNames: string | readonly string[],\n) {\n const names = typeof layerNames === 'string'\n ? [layerNames]\n : layerNames;\n\n return layers\n .flatMap((layer) => layer === LayerPlaceholder ? names : layer)\n .filter(Boolean);\n}\n","import { LayerPlaceholder } from '../../config';\n\nexport { LayerPlaceholder };\n\nexport const LayerDefaultLayers = [LayerPlaceholder];\nexport const LayerDefaultNamespace = 'css';\n\nexport const LayerDefaultPriority: LayerPriority = [0, 0, 0, 0, 0, 0, 0];\n\nexport const LayerMediaPriorities = {\n base: 0,\n media: 1,\n priorityMedia: 2,\n};\n\nexport const LayerSelectorPriorities = {\n base: 0,\n parentSelector: 1,\n selector: 2,\n prioritySelector: 3,\n};\n\nexport const LayerPropertyPriorities = {\n shorthand: 0,\n intermediate: 1,\n longhand: 2,\n};\n\nexport type LayerPriority = readonly [\n value: number,\n selector: number,\n parentSelector: number,\n media: number,\n atRule: number,\n origin: number,\n property: number,\n];\n","import { flattenCssLayers } from './layer';\n\nexport function getLayerOrderCss(\n layers: readonly string[],\n layerNames: string | readonly string[],\n) {\n const names = flattenCssLayers(layers, layerNames);\n\n if (!names.length) return '';\n\n return '@layer ' + names.join(', ') + ';';\n}\n\nexport function getLayerBlockCss(\n layerName: string,\n css: string,\n) {\n return '@layer ' + layerName + ' {' + css + '}';\n}\n\nexport function getLayerBundleCss(\n layers: readonly string[],\n layerName: string,\n css: readonly string[],\n) {\n const output: string[] = [];\n const layerOrder = getLayerOrderCss(layers, layerName);\n\n if (layerOrder) {\n output.push(layerOrder);\n }\n\n output.push(getLayerBlockCss(layerName, '\\n' + css.join('\\n') + '\\n'));\n\n return output.join('\\n');\n}\n\nexport function joinLayerCss(\n layerOrderCss: string,\n css: readonly string[],\n) {\n const output: string[] = [];\n\n if (layerOrderCss) {\n output.push(layerOrderCss);\n }\n\n output.push(...css);\n\n return output.join('\\n') + '\\n';\n}\n"],"mappings":";;;;AAIA,SAAgB,qBACd,IACA,IACA;CAGA,OAEE,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG,MAEX,GAAG,KAAK,GAAG;AAEf;AAEA,SAAgB,sBAAsB;CACpC,MAAM,yBAA8B,IAAI,IAAI;CAE5C,MAAM,cAAc,aAA4B;EAC9C,MAAM,MAAM,SAAS,KAAK,GAAG;EAE7B,IAAI,OAAO,OAAO,IAAI,GAAG;EACzB,IAAI,MAAM,OAAO;EAEjB,OAAO,MAAM,WAAW,GAAG;EA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B,OAAO,YAAY,MAAM,KAAK,IAAI,IAAI;AACxC;AAEA,SAAgB,iBACd,WACA,KACA;CACA,OAAO,YAAY,YAAY,OAAO,MAAM;AAC9C;AAmBA,SAAgB,aACd,eACA,KACA;CACA,MAAM,SAAmB,CAAC;CAE1B,IAAI,eACF,OAAO,KAAK,aAAa;CAG3B,OAAO,KAAK,GAAG,GAAG;CAElB,OAAO,OAAO,KAAK,IAAI,IAAI;AAC7B"}
@@ -0,0 +1,81 @@
1
+ import { o as normalizePath } from "./compiler-DweanHoB.mjs";
2
+ import { O as createTransformFilter, k as normalizeModuleId, t as formatError } from "./misc-B9kqEb2N.mjs";
3
+ import path from "node:path";
4
+ //#region plugin/bundler/webpack/shared/loader.ts
5
+ function createWebpackLoader(args) {
6
+ return function(source, inputMap) {
7
+ const callback = this.async();
8
+ const options = this.getOptions();
9
+ const entry = args.getEntry(options.compilerId, options);
10
+ if (!entry) {
11
+ callback(new Error(formatError(args.missingCompilerMessage)));
12
+ return;
13
+ }
14
+ const filePath = normalizeModuleId(this.resourcePath);
15
+ if (!(args.shouldTransform ? args.shouldTransform({
16
+ entry,
17
+ filePath,
18
+ options
19
+ }) : createTransformFilter(options)(filePath))) {
20
+ callback(null, source, inputMap);
21
+ return;
22
+ }
23
+ try {
24
+ const result = args.transform({
25
+ code: source.toString(),
26
+ entry,
27
+ filePath,
28
+ inputMap,
29
+ loaderContext: this,
30
+ options
31
+ });
32
+ if (!result) {
33
+ callback(null, source, inputMap);
34
+ return;
35
+ }
36
+ callback(null, result.code, parseWebpackSourceMap(result.sourcemap, this.rootContext));
37
+ } catch (err) {
38
+ callback(err);
39
+ }
40
+ };
41
+ }
42
+ function parseWebpackSourceMap(map, rootContext) {
43
+ if (!map) return null;
44
+ return normalizeWebpackSourceMap(JSON.parse(map), rootContext);
45
+ }
46
+ function normalizeWebpackSourceMap(map, rootContext) {
47
+ if (!Array.isArray(map.sources)) return map;
48
+ const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
49
+ return {
50
+ ...map,
51
+ sourceRoot: isFilePathLike(sourceRoot) ? void 0 : map.sourceRoot,
52
+ sources: map.sources.map((source) => normalizeWebpackSource(source, rootContext, sourceRoot))
53
+ };
54
+ }
55
+ function normalizeWebpackSource(source, rootContext, sourceRoot) {
56
+ if (!isFilePathLike(source) && !isFilePathLike(sourceRoot)) return source;
57
+ const filePath = toAbsoluteFilePath(source, sourceRoot);
58
+ if (!filePath) return source;
59
+ const relativePath = normalizePath(path.relative(rootContext, filePath));
60
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
61
+ }
62
+ function toAbsoluteFilePath(source, sourceRoot) {
63
+ const sourcePath = stripFileProtocol(source);
64
+ const rootPath = stripFileProtocol(sourceRoot);
65
+ if (path.isAbsolute(sourcePath) || path.win32.isAbsolute(sourcePath)) return sourcePath;
66
+ if (rootPath && (path.isAbsolute(rootPath) || path.win32.isAbsolute(rootPath))) return path.join(rootPath, sourcePath);
67
+ return null;
68
+ }
69
+ function stripFileProtocol(value) {
70
+ if (!value.startsWith("file://")) return value;
71
+ return decodeURIComponent(value.slice(7));
72
+ }
73
+ function isFilePathLike(value) {
74
+ if (!value) return false;
75
+ if (value.startsWith("file://")) return true;
76
+ return path.isAbsolute(value) || path.win32.isAbsolute(value);
77
+ }
78
+ //#endregion
79
+ export { createWebpackLoader as t };
80
+
81
+ //# sourceMappingURL=loader-DS61nRqr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-DS61nRqr.mjs","names":[],"sources":["../plugin/bundler/webpack/shared/loader.ts"],"sourcesContent":["import path from 'node:path';\nimport type { LoaderDefinitionFunction } from 'webpack';\nimport type { BabelTransformSourceMap } from '../../../../compiler/transform';\nimport { normalizePath } from '../../../../compiler/utils/path';\nimport { createTransformFilter, normalizeModuleId, type PluginOptions } from '../../../utils';\nimport { formatError } from '../../../utils/misc';\n\nexport type WebpackLoaderOptions = PluginOptions & {\n compilerId: string;\n};\n\nexport type WebpackLoaderContext = ThisParameterType<LoaderDefinitionFunction<WebpackLoaderOptions>>;\n\nexport type WebpackLoaderResult = {\n code: string;\n sourcemap: string | null;\n};\n\nexport type WebpackLoaderTransformArgs<State> = {\n code: string;\n entry: State;\n filePath: string;\n inputMap: BabelTransformSourceMap;\n loaderContext: WebpackLoaderContext;\n options: WebpackLoaderOptions;\n};\n\nexport type WebpackLoaderFilterArgs<State> = {\n entry: State;\n filePath: string;\n options: WebpackLoaderOptions;\n};\n\nexport function createWebpackLoader<State>(args: {\n getEntry: (compilerId: string, options: WebpackLoaderOptions) => State | null | undefined;\n missingCompilerMessage: string;\n shouldTransform?: (args: WebpackLoaderFilterArgs<State>) => boolean;\n transform: (args: WebpackLoaderTransformArgs<State>) => WebpackLoaderResult | null;\n}): LoaderDefinitionFunction<WebpackLoaderOptions> {\n return function(source, inputMap) {\n const callback = this.async();\n const options = this.getOptions();\n\n const entry = args.getEntry(options.compilerId, options);\n\n if (!entry) {\n callback(new Error(formatError(args.missingCompilerMessage)));\n return;\n }\n\n const filePath = normalizeModuleId(this.resourcePath);\n const shouldTransform = args.shouldTransform\n ? args.shouldTransform({ entry, filePath, options })\n : createTransformFilter(options)(filePath);\n\n if (!shouldTransform) {\n callback(null, source, inputMap);\n return;\n }\n\n try {\n const result = args.transform({\n code: source.toString(),\n entry,\n filePath,\n inputMap: inputMap as BabelTransformSourceMap,\n loaderContext: this,\n options,\n });\n\n if (!result) {\n callback(null, source, inputMap);\n return;\n }\n\n callback(\n null,\n result.code,\n parseWebpackSourceMap(\n result.sourcemap,\n this.rootContext,\n ),\n );\n } catch (err) {\n callback(err as Error);\n }\n };\n}\n\ntype WebpackSourceMap = {\n version: number;\n sources: string[];\n names: string[];\n mappings: string;\n file: string;\n sourceRoot?: string;\n sourcesContent?: string[];\n debugId?: string;\n [key: string]: unknown;\n};\n\nfunction parseWebpackSourceMap(map: string | null, rootContext: string): WebpackSourceMap | null {\n if (!map) return null;\n return normalizeWebpackSourceMap(JSON.parse(map) as WebpackSourceMap, rootContext);\n}\n\nfunction normalizeWebpackSourceMap(map: WebpackSourceMap, rootContext: string): WebpackSourceMap {\n if (!Array.isArray(map.sources)) return map;\n\n const sourceRoot = typeof map.sourceRoot === 'string' ? map.sourceRoot : '';\n\n return {\n ...map,\n sourceRoot: isFilePathLike(sourceRoot) ? undefined : map.sourceRoot,\n sources: map.sources.map((source) => normalizeWebpackSource(source, rootContext, sourceRoot)),\n };\n}\n\nfunction normalizeWebpackSource(source: string, rootContext: string, sourceRoot: string) {\n if (!isFilePathLike(source) && !isFilePathLike(sourceRoot)) return source;\n\n const filePath = toAbsoluteFilePath(source, sourceRoot);\n\n if (!filePath) return source;\n\n const relativePath = normalizePath(path.relative(rootContext, filePath));\n\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n}\n\nfunction toAbsoluteFilePath(source: string, sourceRoot: string) {\n const sourcePath = stripFileProtocol(source);\n const rootPath = stripFileProtocol(sourceRoot);\n\n if (path.isAbsolute(sourcePath) || path.win32.isAbsolute(sourcePath)) {\n return sourcePath;\n }\n\n if (rootPath && (path.isAbsolute(rootPath) || path.win32.isAbsolute(rootPath))) {\n return path.join(rootPath, sourcePath);\n }\n\n return null;\n}\n\nfunction stripFileProtocol(value: string) {\n if (!value.startsWith('file://')) return value;\n return decodeURIComponent(value.slice('file://'.length));\n}\n\nfunction isFilePathLike(value: string) {\n if (!value) return false;\n if (value.startsWith('file://')) return true;\n return path.isAbsolute(value) || path.win32.isAbsolute(value);\n}\n"],"mappings":";;;;AAiCA,SAAgB,oBAA2B,MAKQ;CACjD,OAAO,SAAS,QAAQ,UAAU;EAChC,MAAM,WAAW,KAAK,MAAM;EAC5B,MAAM,UAAU,KAAK,WAAW;EAEhC,MAAM,QAAQ,KAAK,SAAS,QAAQ,YAAY,OAAO;EAEvD,IAAI,CAAC,OAAO;GACV,SAAS,IAAI,MAAM,YAAY,KAAK,sBAAsB,CAAC,CAAC;GAC5D;EACF;EAEA,MAAM,WAAW,kBAAkB,KAAK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kB,MAAM;CAC3C,MAAM,WAAW,kBAAkB,UAAU;CAE7C,IAAI,KAAK,WAAW,UAAU,KAAK,KAAK,MAAM,WAAW,UAAU,GACjE,OAAO;CAGT,IAAI,aAAa,KAAK,WAAW,QAAQ,KAAK,KAAK,MAAM,WAAW,QAAQ,IAC1E,OAAO,KAAK,KAAK,UAAU,UAAU;CAGvC,OAAO;AACT;AAEA,SAAS,kBAAkB,OAAe;CACxC,IAAI,CAAC,MAAM,WAAW,SAAS,GAAG,OAAO;CACzC,OAAO,mBAAmB,MAAM,MAAM,CAAgB,CAAC;AACzD;AAEA,SAAS,eAAe,OAAe;CACrC,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,WAAW,SAAS,GAAG,OAAO;CACxC,OAAO,KAAK,WAAW,KAAK,KAAK,KAAK,MAAM,WAAW,KAAK;AAC9D"}
@@ -0,0 +1,360 @@
1
+ import { d as compareLayerPriority, i as getDefaultSourcemapUrl, l as extractCss, n as createCompiler, o as normalizePath } from "./compiler-DweanHoB.mjs";
2
+ import { createHash } from "node:crypto";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import picomatch from "picomatch";
6
+ //#region plugin/utils/cache/css_cache.ts
7
+ function createFileCssCache(args) {
8
+ const rootDir = path.join(args.cacheDir, args.cacheSubdir);
9
+ const filesDir = path.join(rootDir, "files");
10
+ const getFilePath = (filePath) => {
11
+ return path.join(filesDir, hashFilePath(filePath) + ".json");
12
+ };
13
+ const setFileCss = (item) => {
14
+ const record = {
15
+ filePath: normalizePath(item.filePath),
16
+ contentHash: item.contentHash,
17
+ configHash: item.configHash,
18
+ rules: item.rules,
19
+ updatedAt: Date.now()
20
+ };
21
+ fs.mkdirSync(filesDir, { recursive: true });
22
+ fs.writeFileSync(getFilePath(record.filePath), JSON.stringify(record), "utf8");
23
+ };
24
+ const getCss = (args = {}) => {
25
+ return extractCss(getRules(args), args);
26
+ };
27
+ const getRules = (args = {}) => {
28
+ const records = readRecords(filesDir, args);
29
+ const rules = [];
30
+ for (const record of records) rules.push(...record.rules);
31
+ return rules.sort((a, b) => compareLayerPriority(a.priority, b.priority));
32
+ };
33
+ const clear = () => {
34
+ try {
35
+ fs.rmSync(rootDir, {
36
+ recursive: true,
37
+ force: true
38
+ });
39
+ } catch {}
40
+ };
41
+ const invalidateFile = (filePath) => {
42
+ try {
43
+ fs.rmSync(getFilePath(normalizePath(filePath)));
44
+ } catch {}
45
+ };
46
+ return {
47
+ rootDir,
48
+ filesDir,
49
+ setFileCss,
50
+ getCss,
51
+ getRules,
52
+ clear,
53
+ invalidateFile
54
+ };
55
+ }
56
+ function createFileCssContentHash(code) {
57
+ return hash(code);
58
+ }
59
+ function createFileCssConfigHash(config) {
60
+ return hash(JSON.stringify(config ?? null));
61
+ }
62
+ function readRecords(filesDir, args) {
63
+ let entries;
64
+ try {
65
+ entries = fs.readdirSync(filesDir);
66
+ } catch {
67
+ return [];
68
+ }
69
+ const records = [];
70
+ for (const entry of entries) {
71
+ if (!entry.endsWith(".json")) continue;
72
+ try {
73
+ const record = JSON.parse(fs.readFileSync(path.join(filesDir, entry), "utf8"));
74
+ if (!record.filePath || !Array.isArray(record.rules)) continue;
75
+ if (args.configHash && record.configHash !== args.configHash) continue;
76
+ records.push(record);
77
+ } catch {}
78
+ }
79
+ return records;
80
+ }
81
+ function hashFilePath(filePath) {
82
+ return hash(normalizePath(path.resolve(filePath)));
83
+ }
84
+ function hash(text) {
85
+ return createHash("sha256").update(text).digest("hex");
86
+ }
87
+ //#endregion
88
+ //#region plugin/utils/cache/file.ts
89
+ function writeCacheFile(cacheDir, fileName, content) {
90
+ const filePath = path.join(cacheDir, fileName);
91
+ if (fs.existsSync(filePath)) {
92
+ const size = Buffer.byteLength(content);
93
+ if (fs.statSync(filePath).size === size && fs.readFileSync(filePath, "utf8") === content) return filePath;
94
+ }
95
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
96
+ fs.writeFileSync(filePath, content, "utf8");
97
+ return filePath;
98
+ }
99
+ function writePluginCacheFile(compiler, fileName, content) {
100
+ return writeCacheFile(compiler.cacheDir, fileName, content);
101
+ }
102
+ //#endregion
103
+ //#region plugin/utils/constants.ts
104
+ const PLUGIN_NAME = "fluentic-style";
105
+ const PLUGIN_CACHE_DIR = "node_modules/.cache/fluentic-style";
106
+ const EXTRACTED_CSS_MARKER = ".__fluentic_style_css_marker__{--fluentic-style:0}";
107
+ const BUNDLE_CSS_FILE = "bundle.css";
108
+ //#endregion
109
+ //#region plugin/utils/filter.ts
110
+ const DEFAULT_TRANSFORM_INCLUDE_PATTERN = "\\.[cm]?[jt]sx?$";
111
+ const DEFAULT_TRANSFORM_INCLUDE = new RegExp(DEFAULT_TRANSFORM_INCLUDE_PATTERN);
112
+ const DEFAULT_TRANSFORM_EXCLUDE = /node_modules/;
113
+ function normalizeModuleId(id) {
114
+ return id.split("?")[0]?.split("#")[0] ?? id;
115
+ }
116
+ function createTransformFilter(options = {}) {
117
+ const includes = normalizeMatchers(options.include);
118
+ const excludes = normalizeMatchers(options.exclude ?? (options.include ? void 0 : DEFAULT_TRANSFORM_EXCLUDE));
119
+ const cache = /* @__PURE__ */ new Map();
120
+ const filter = ((id) => {
121
+ const filePath = normalizeModuleId(id);
122
+ const cached = cache.get(filePath);
123
+ if (cached !== void 0) return cached;
124
+ const result = shouldTransform(filePath, includes, excludes);
125
+ cache.set(filePath, result);
126
+ return result;
127
+ });
128
+ filter.clear = () => {
129
+ cache.clear();
130
+ };
131
+ return filter;
132
+ }
133
+ function normalizeMatchers(patterns) {
134
+ if (!patterns) return [];
135
+ return (Array.isArray(patterns) ? patterns : [patterns]).map(createMatcher);
136
+ }
137
+ function createMatcher(pattern) {
138
+ if (pattern instanceof RegExp) return (id) => {
139
+ pattern.lastIndex = 0;
140
+ return pattern.test(id);
141
+ };
142
+ const matcher = picomatch(normalizePath(pattern), { dot: true });
143
+ return (id) => matcher(normalizePath(id));
144
+ }
145
+ function shouldTransform(id, includes, excludes) {
146
+ for (const exclude of excludes) if (exclude(id)) return false;
147
+ if (!includes.length) return DEFAULT_TRANSFORM_INCLUDE.test(id);
148
+ for (const include of includes) if (include(id)) return true;
149
+ return false;
150
+ }
151
+ //#endregion
152
+ //#region plugin/utils/compiler.ts
153
+ let nextCompilerId = 0;
154
+ function createCompilerId(name) {
155
+ return [
156
+ PLUGIN_NAME,
157
+ name,
158
+ String(nextCompilerId++)
159
+ ].filter(Boolean).join("|");
160
+ }
161
+ function getPluginCacheDir(projectDir, cacheDir) {
162
+ return cacheDir ?? path.join(projectDir, "node_modules/.cache/fluentic-style");
163
+ }
164
+ function createPluginCompiler(args) {
165
+ const dev = args.dev;
166
+ const options = args.options;
167
+ const projectDir = args.projectDir;
168
+ const cacheDir = args.cacheDir;
169
+ const compiler = createCompiler({
170
+ projectDir,
171
+ cacheDir,
172
+ runtimeMode: args.runtimeMode
173
+ }, options);
174
+ const filter = createTransformFilter(options);
175
+ const transform = (code, id, sourcemap = null) => {
176
+ const filePath = normalizeModuleId(id);
177
+ if (!filter(filePath)) return null;
178
+ const result = dev ? compiler.compileDebug({
179
+ code,
180
+ filePath,
181
+ sourcemap
182
+ }) : compiler.compileExtract({
183
+ code,
184
+ filePath,
185
+ sourcemap
186
+ });
187
+ if (!result) return null;
188
+ return {
189
+ code: result.code,
190
+ map: result.sourcemap,
191
+ rules: "rules" in result ? result.rules : []
192
+ };
193
+ };
194
+ return {
195
+ projectDir,
196
+ cacheDir,
197
+ dev,
198
+ compiler,
199
+ filter,
200
+ transform
201
+ };
202
+ }
203
+ function invalidateFiles(compiler, filePaths) {
204
+ for (const filePath of filePaths) compiler.invalidateFile({ filePath });
205
+ }
206
+ //#endregion
207
+ //#region plugin/utils/cssMarker.ts
208
+ function replaceCssMarker(text, css) {
209
+ return text.replace(EXTRACTED_CSS_MARKER, css);
210
+ }
211
+ function hasCssMarker(text) {
212
+ return text.includes(EXTRACTED_CSS_MARKER);
213
+ }
214
+ //#endregion
215
+ //#region plugin/utils/cssOutput.ts
216
+ async function transformCssOutput(css, options, filename) {
217
+ if (!css || !options) return css;
218
+ const outputOptions = options === true ? {} : options;
219
+ const lightningcss = await import("lightningcss");
220
+ const targets = getLightningTargets(lightningcss.browserslistToTargets, outputOptions.targets ?? "defaults");
221
+ const exclude = getLightningExclude(lightningcss.Features, outputOptions);
222
+ const result = lightningcss.transform({
223
+ filename,
224
+ code: new TextEncoder().encode(css),
225
+ ...outputOptions.lightningcss,
226
+ targets,
227
+ minify: outputOptions.minify,
228
+ exclude
229
+ });
230
+ return new TextDecoder().decode(result.code);
231
+ }
232
+ function getLightningTargets(browserslistToTargets, targets) {
233
+ if (!targets) return void 0;
234
+ if (typeof targets === "string") return browserslistToTargets([targets]);
235
+ if (Array.isArray(targets)) return browserslistToTargets(targets);
236
+ return targets;
237
+ }
238
+ function getLightningExclude(features, options) {
239
+ const exclude = options.lightningcss?.exclude ?? 0;
240
+ return options.vendorPrefixes === false ? exclude | features.VendorPrefixes : exclude;
241
+ }
242
+ //#endregion
243
+ //#region plugin/utils/injection.ts
244
+ function shouldInjectModuleImport(code, moduleId) {
245
+ return !code.includes(moduleId);
246
+ }
247
+ function injectModuleImport(code, moduleId) {
248
+ if (!shouldInjectModuleImport(code, moduleId)) return code;
249
+ return injectCodeAfterDirectivePrologue(code, `import ${JSON.stringify(moduleId)};\n`);
250
+ }
251
+ function injectCodeAfterDirectivePrologue(code, injectedCode) {
252
+ const insertAt = getDirectivePrologueEnd(code);
253
+ return code.slice(0, insertAt) + injectedCode + code.slice(insertAt);
254
+ }
255
+ function getDirectivePrologueEnd(code) {
256
+ const match = /^(?:\s*(?:"[^"]*"|'[^']*')\s*;?)+/.exec(code);
257
+ return match ? match[0].length : 0;
258
+ }
259
+ //#endregion
260
+ //#region plugin/utils/runtimeEntry.ts
261
+ function getStyleRuntimeMode(dev, rsc = false) {
262
+ if (rsc) return dev ? "rsc-dev" : "rsc-prod";
263
+ return dev ? "dev" : "prod";
264
+ }
265
+ function getPluginBuildConfig(options) {
266
+ const css = hasBuildConfig(options.css) ? options.css : {};
267
+ return {
268
+ hoist: options.hoist !== false,
269
+ css
270
+ };
271
+ }
272
+ function getPluginBuildDevConfig(options) {
273
+ return hasBuildConfig(options.dev) ? options.dev : null;
274
+ }
275
+ function hasBuildConfig(config) {
276
+ if (!config) return false;
277
+ for (const key in config) if (config[key] !== void 0) return true;
278
+ return false;
279
+ }
280
+ function getStyleEntryDefines(buildConfig, buildDevConfig, sidecarUrl, stringify = true) {
281
+ const defines = {
282
+ FLUENTIC_STYLE_BUILD_CONFIG: JSON.stringify(buildConfig),
283
+ FLUENTIC_STYLE_DEV_CONFIG: JSON.stringify(buildDevConfig ?? {}),
284
+ FLUENTIC_STYLE_SIDECAR_SERVER_URL: sidecarUrl ?? ""
285
+ };
286
+ if (stringify) Object.keys(defines).forEach((key) => {
287
+ defines[key] = JSON.stringify(defines[key]);
288
+ });
289
+ return defines;
290
+ }
291
+ //#endregion
292
+ //#region plugin/utils/sourcemap.ts
293
+ function parseBundlerSourceMap(map) {
294
+ if (!map) return null;
295
+ return JSON.parse(map);
296
+ }
297
+ function resolveDevSourcemapMode(mode, dev) {
298
+ return mode ?? (dev ? "sidecarServer" : "sourceUrl");
299
+ }
300
+ function resolvePluginSourcemapFilePath(getSourcemapFilePath, sourcemapSidecar) {
301
+ return (info) => {
302
+ const defaultSourceUrl = getDefaultSourcemapUrl(info);
303
+ const resolvedSourceUrl = getSourcemapFilePath?.({
304
+ ...info,
305
+ sourcePath: info.sourcePath,
306
+ sourceUrl: defaultSourceUrl
307
+ }) || defaultSourceUrl;
308
+ sourcemapSidecar?.registerSource(info.absolutePath, resolvedSourceUrl);
309
+ return resolvedSourceUrl;
310
+ };
311
+ }
312
+ function resolvePluginSourcemapOptions(options, sourcemapSidecar) {
313
+ return {
314
+ ...options,
315
+ getSourcemapFilePath: resolvePluginSourcemapFilePath(options.getSourcemapFilePath, sourcemapSidecar)
316
+ };
317
+ }
318
+ //#endregion
319
+ //#region plugin/utils/virtual.ts
320
+ const RUNTIME_MODULE_ID = "virtual:fluentic-style";
321
+ const CSS_MODULE_ID = `${RUNTIME_MODULE_ID}.css`;
322
+ const RESOLVED_RUNTIME_MODULE_ID = `\0${RUNTIME_MODULE_ID}`;
323
+ const RESOLVED_CSS_MODULE_ID = `\0${CSS_MODULE_ID}`;
324
+ const VIRTUAL_MODULE_REQUEST_PATTERN = `^${escapeRegex(RUNTIME_MODULE_ID)}(?:\\.css)?$`;
325
+ new RegExp(VIRTUAL_MODULE_REQUEST_PATTERN);
326
+ function createRuntimeModuleSource(extract, cssModuleId) {
327
+ return [extract && cssModuleId && `import ${JSON.stringify(cssModuleId)};`, ""].filter(Boolean).join("\n");
328
+ }
329
+ function isVirtualModuleRequest(id, moduleId) {
330
+ const normalized = normalizeVirtualModuleId(id);
331
+ return normalized === moduleId || normalized === `\0${moduleId}`;
332
+ }
333
+ function getVirtualModuleId(id) {
334
+ if (isVirtualModuleRequest(id, "virtual:fluentic-style")) return RESOLVED_RUNTIME_MODULE_ID;
335
+ if (isVirtualModuleRequest(id, CSS_MODULE_ID)) return RESOLVED_CSS_MODULE_ID;
336
+ return null;
337
+ }
338
+ function loadVirtualModule(id, extract, cssModuleId) {
339
+ if (isVirtualModuleRequest(id, "virtual:fluentic-style")) return createRuntimeModuleSource(extract, cssModuleId);
340
+ if (isVirtualModuleRequest(id, CSS_MODULE_ID)) return EXTRACTED_CSS_MARKER;
341
+ return null;
342
+ }
343
+ function normalizeVirtualModuleId(id) {
344
+ const base = id.split("?")[0]?.split("#")[0] ?? id;
345
+ if (base.startsWith("/@id/__x00__")) return `\0${base.slice(12)}`;
346
+ if (base.startsWith("/@id/")) return base.slice(5);
347
+ return base;
348
+ }
349
+ function escapeRegex(value) {
350
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
351
+ }
352
+ //#endregion
353
+ //#region plugin/utils/misc.ts
354
+ function formatError(msg) {
355
+ return `[${PLUGIN_NAME}] ${msg}`;
356
+ }
357
+ //#endregion
358
+ export { BUNDLE_CSS_FILE as A, getPluginCacheDir as C, DEFAULT_TRANSFORM_INCLUDE_PATTERN as D, DEFAULT_TRANSFORM_INCLUDE as E, writePluginCacheFile as F, createFileCssCache as I, createFileCssConfigHash as L, PLUGIN_CACHE_DIR as M, PLUGIN_NAME as N, createTransformFilter as O, writeCacheFile as P, createFileCssContentHash as R, createPluginCompiler as S, DEFAULT_TRANSFORM_EXCLUDE as T, injectModuleImport as _, VIRTUAL_MODULE_REQUEST_PATTERN as a, replaceCssMarker as b, loadVirtualModule as c, resolvePluginSourcemapFilePath as d, resolvePluginSourcemapOptions as f, getStyleRuntimeMode as g, getStyleEntryDefines as h, RUNTIME_MODULE_ID as i, EXTRACTED_CSS_MARKER as j, normalizeModuleId as k, parseBundlerSourceMap as l, getPluginBuildDevConfig as m, CSS_MODULE_ID as n, getVirtualModuleId as o, getPluginBuildConfig as p, RESOLVED_RUNTIME_MODULE_ID as r, isVirtualModuleRequest as s, formatError as t, resolveDevSourcemapMode as u, transformCssOutput as v, invalidateFiles as w, createCompilerId as x, hasCssMarker as y };
359
+
360
+ //# sourceMappingURL=misc-B9kqEb2N.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc-B9kqEb2N.mjs","names":[],"sources":["../plugin/utils/cache/css_cache.ts","../plugin/utils/cache/file.ts","../plugin/utils/constants.ts","../plugin/utils/filter.ts","../plugin/utils/compiler.ts","../plugin/utils/cssMarker.ts","../plugin/utils/cssOutput.ts","../plugin/utils/injection.ts","../plugin/utils/runtimeEntry.ts","../plugin/utils/sourcemap.ts","../plugin/utils/virtual.ts","../plugin/utils/misc.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { compareLayerPriority } from '../../../atomic/layer';\nimport { type CompilerExtractCssArgs, type CssExtractRule, extractCss } from '../../../compiler/extract';\nimport { normalizePath } from '../../../compiler/utils/path';\n\nexport type FileCssCacheRule = CssExtractRule;\n\nexport type FileCssCacheRecord = {\n filePath: string;\n contentHash: string;\n configHash: string;\n rules: FileCssCacheRule[];\n updatedAt: number;\n};\n\nexport type SetFileCssArgs = {\n filePath: string;\n contentHash: string;\n configHash: string;\n rules: FileCssCacheRule[];\n};\n\nexport type GetFileCssArgs = CompilerExtractCssArgs & {\n configHash?: string;\n};\n\nexport type FileCssCacheArgs = {\n cacheDir: string;\n cacheSubdir: string;\n};\n\nexport type FileCssCache = ReturnType<typeof createFileCssCache>;\n\nexport function createFileCssCache(args: FileCssCacheArgs) {\n const rootDir = path.join(args.cacheDir, args.cacheSubdir);\n const filesDir = path.join(rootDir, 'files');\n\n const getFilePath = (filePath: string) => {\n return path.join(filesDir, hashFilePath(filePath) + '.json');\n };\n\n const setFileCss = (item: SetFileCssArgs) => {\n const record: FileCssCacheRecord = {\n filePath: normalizePath(item.filePath),\n contentHash: item.contentHash,\n configHash: item.configHash,\n rules: item.rules,\n updatedAt: Date.now(),\n };\n\n fs.mkdirSync(filesDir, { recursive: true });\n\n fs.writeFileSync(getFilePath(record.filePath), JSON.stringify(record), 'utf8');\n };\n\n const getCss = (args: GetFileCssArgs = {}) => {\n const rules = getRules(args);\n return extractCss(rules, args);\n };\n\n const getRules = (args: GetFileCssArgs = {}) => {\n const records = readRecords(filesDir, args);\n const rules: FileCssCacheRule[] = [];\n\n for (const record of records) {\n rules.push(...record.rules);\n }\n\n return rules.sort((a, b) => compareLayerPriority(a.priority, b.priority));\n };\n\n const clear = () => {\n try {\n fs.rmSync(rootDir, { recursive: true, force: true });\n } catch {\n // Cache cleanup is best effort.\n }\n };\n\n const invalidateFile = (filePath: string) => {\n try {\n fs.rmSync(getFilePath(normalizePath(filePath)));\n } catch {\n // Cache invalidation is best effort.\n }\n };\n\n return {\n rootDir,\n filesDir,\n setFileCss,\n getCss,\n getRules,\n clear,\n invalidateFile,\n };\n}\n\nexport function createFileCssContentHash(code: string) {\n return hash(code);\n}\n\nexport function createFileCssConfigHash(config: unknown) {\n return hash(JSON.stringify(config ?? null));\n}\n\nfunction readRecords(filesDir: string, args: GetFileCssArgs) {\n let entries: string[];\n\n try {\n entries = fs.readdirSync(filesDir);\n } catch {\n return [];\n }\n\n const records: FileCssCacheRecord[] = [];\n\n for (const entry of entries) {\n if (!entry.endsWith('.json')) continue;\n\n try {\n const record = JSON.parse(\n fs.readFileSync(path.join(filesDir, entry), 'utf8'),\n ) as FileCssCacheRecord;\n\n if (!record.filePath || !Array.isArray(record.rules)) continue;\n if (args.configHash && record.configHash !== args.configHash) continue;\n\n records.push(record);\n } catch {\n // Ignore partial cache files from interrupted dev builds.\n }\n }\n\n return records;\n}\n\nfunction hashFilePath(filePath: string) {\n return hash(normalizePath(path.resolve(filePath)));\n}\n\nfunction hash(text: string) {\n return createHash('sha256').update(text).digest('hex');\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport type { PluginCompiler } from '../compiler';\n\nexport function getPluginCacheFilePath(\n compiler: PluginCompiler,\n fileName: string,\n) {\n return path.join(compiler.cacheDir, fileName);\n}\n\nexport function writeCacheFile(\n cacheDir: string,\n fileName: string,\n content: string,\n) {\n const filePath = path.join(cacheDir, fileName);\n\n if (fs.existsSync(filePath)) {\n const size = Buffer.byteLength(content);\n const stat = fs.statSync(filePath);\n\n if (stat.size === size && fs.readFileSync(filePath, 'utf8') === content) {\n return filePath;\n }\n }\n\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n fs.writeFileSync(filePath, content, 'utf8');\n\n return filePath;\n}\n\nexport function writePluginCacheFile(\n compiler: PluginCompiler,\n fileName: string,\n content: string,\n) {\n return writeCacheFile(compiler.cacheDir, fileName, content);\n}\n","export const PLUGIN_NAME = 'fluentic-style';\n\nexport const PLUGIN_CACHE_DIR = 'node_modules/.cache/fluentic-style';\n\nexport const EXTRACTED_CSS_MARKER = '.__fluentic_style_css_marker__{--fluentic-style:0}';\n\nexport const BUNDLE_CSS_FILE = 'bundle.css';\n","import picomatch from 'picomatch';\nimport { normalizePath } from '../../compiler/utils/path';\n\nexport const DEFAULT_TRANSFORM_INCLUDE_PATTERN = '\\\\.[cm]?[jt]sx?$';\n\nexport const DEFAULT_TRANSFORM_INCLUDE = new RegExp(DEFAULT_TRANSFORM_INCLUDE_PATTERN);\n\nexport const DEFAULT_TRANSFORM_EXCLUDE = /node_modules/;\n\nexport type FilterPattern = string | RegExp | Array<string | RegExp>;\n\nexport type TransformFilterOptions = {\n include?: FilterPattern;\n exclude?: FilterPattern;\n};\n\nexport type TransformFilter = {\n (id: string): boolean;\n clear(): void;\n};\n\nexport function normalizeModuleId(id: string) {\n return id.split('?')[0]?.split('#')[0] ?? id;\n}\n\nexport function createTransformFilter(options: TransformFilterOptions = {}): TransformFilter {\n const includes = normalizeMatchers(options.include);\n\n const excludes = normalizeMatchers(\n options.exclude ?? (options.include ? undefined : DEFAULT_TRANSFORM_EXCLUDE),\n );\n\n const cache = new Map<string, boolean>();\n\n const filter = ((id: string) => {\n const filePath = normalizeModuleId(id);\n const cached = cache.get(filePath);\n\n if (cached !== undefined) return cached;\n\n const result = shouldTransform(filePath, includes, excludes);\n\n cache.set(filePath, result);\n\n return result;\n }) as TransformFilter;\n\n filter.clear = () => {\n cache.clear();\n };\n\n return filter;\n}\n\ntype FilterMatcher = (id: string) => boolean;\n\nfunction normalizeMatchers(patterns?: FilterPattern) {\n if (!patterns) return [];\n\n const items = Array.isArray(patterns) ? patterns : [patterns];\n\n return items.map(createMatcher);\n}\n\nfunction createMatcher(pattern: string | RegExp): FilterMatcher {\n if (pattern instanceof RegExp) {\n return (id) => {\n pattern.lastIndex = 0;\n return pattern.test(id);\n };\n }\n\n const matcher = picomatch(normalizePath(pattern), {\n dot: true,\n });\n\n return (id) => matcher(normalizePath(id));\n}\n\nfunction shouldTransform(\n id: string,\n includes: FilterMatcher[],\n excludes: FilterMatcher[],\n): boolean {\n for (const exclude of excludes) {\n if (exclude(id)) return false;\n }\n\n if (!includes.length) {\n return DEFAULT_TRANSFORM_INCLUDE.test(id);\n }\n\n for (const include of includes) {\n if (include(id)) return true;\n }\n\n return false;\n}\n","import path from 'node:path';\nimport { createCompiler } from '../../compiler';\nimport type { Compiler, CompilerCssOptions, CompilerOptions, CompilerRuntimeMode } from '../../compiler';\nimport { PLUGIN_CACHE_DIR, PLUGIN_NAME } from './constants';\nimport type { PluginCssOutputOptions } from './cssOutput';\nimport { createTransformFilter, normalizeModuleId, type TransformFilterOptions } from './filter';\nimport type { BundlerSourceMap } from './sourcemap';\n\nexport type PluginCssOptions = CompilerCssOptions;\n\nexport type PluginOptions = CompilerOptions & TransformFilterOptions & {\n cacheDir?: string;\n cssOutput?: PluginCssOutputOptions;\n};\n\nexport type PluginCompiler = ReturnType<typeof createPluginCompiler>;\n\nexport type PluginCompilerArgs = {\n dev: boolean;\n projectDir: string;\n cacheDir: string;\n options: PluginOptions;\n runtimeMode: CompilerRuntimeMode | null;\n};\n\nlet nextCompilerId = 0;\n\nexport function createCompilerId(name?: string) {\n return [PLUGIN_NAME, name, String(nextCompilerId++)].filter(Boolean).join('|');\n}\n\nexport function getPluginCacheDir(projectDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(projectDir, PLUGIN_CACHE_DIR);\n}\n\nexport function createPluginCompiler(args: PluginCompilerArgs) {\n const dev = args.dev;\n const options = args.options;\n\n const projectDir = args.projectDir;\n const cacheDir = args.cacheDir;\n\n const compiler = createCompiler(\n {\n projectDir,\n cacheDir,\n runtimeMode: args.runtimeMode,\n },\n options,\n );\n\n const filter = createTransformFilter(options);\n\n const transform = (\n code: string,\n id: string,\n sourcemap: BundlerSourceMap | null = null,\n ) => {\n const filePath = normalizeModuleId(id);\n\n if (!filter(filePath)) return null;\n\n const result = dev\n ? compiler.compileDebug({ code, filePath, sourcemap })\n : compiler.compileExtract({ code, filePath, sourcemap });\n\n if (!result) return null;\n\n return {\n code: result.code,\n map: result.sourcemap,\n rules: 'rules' in result ? result.rules : [],\n };\n };\n\n return {\n projectDir,\n cacheDir,\n dev,\n //\n compiler,\n filter,\n transform,\n };\n}\n\nexport function invalidateFiles(\n compiler: Compiler,\n filePaths: Iterable<string>,\n) {\n for (const filePath of filePaths) {\n compiler.invalidateFile({ filePath });\n }\n}\n","import type { PluginCompiler } from './compiler';\nimport { EXTRACTED_CSS_MARKER } from './constants';\n\nexport function getExtractedCss(compiler: PluginCompiler) {\n return compiler.compiler.getExtractedCss();\n}\n\nexport function replaceCssMarker(text: string, css: string) {\n return text.replace(EXTRACTED_CSS_MARKER, css);\n}\n\nexport function hasCssMarker(text: string) {\n return text.includes(EXTRACTED_CSS_MARKER);\n}\n","import type { Features, Targets, TransformOptions } from 'lightningcss';\n\nexport type CssOutputTargets = Targets | string | string[];\n\nexport type CssOutputOptions = {\n targets?: CssOutputTargets;\n vendorPrefixes?: boolean;\n minify?: boolean;\n lightningcss?: Partial<\n Omit<\n TransformOptions<Record<string, never>>,\n 'code' | 'filename' | 'minify' | 'targets'\n >\n >;\n};\n\nexport type PluginCssOutputOptions = boolean | CssOutputOptions;\n\nexport async function transformCssOutput(\n css: string,\n options: PluginCssOutputOptions | undefined,\n filename: string,\n): Promise<string> {\n if (!css || !options) return css;\n\n const outputOptions = options === true ? {} : options;\n const lightningcss = await import('lightningcss');\n const targets = getLightningTargets(\n lightningcss.browserslistToTargets,\n outputOptions.targets ?? 'defaults',\n );\n const exclude = getLightningExclude(lightningcss.Features, outputOptions);\n\n const result = lightningcss.transform({\n filename,\n code: new TextEncoder().encode(css),\n ...outputOptions.lightningcss,\n targets,\n minify: outputOptions.minify,\n exclude,\n });\n\n return new TextDecoder().decode(result.code);\n}\n\nfunction getLightningTargets(\n browserslistToTargets: (browserslist: string[]) => Targets,\n targets: CssOutputTargets | undefined,\n): Targets | undefined {\n if (!targets) return undefined;\n if (typeof targets === 'string') return browserslistToTargets([targets]);\n if (Array.isArray(targets)) return browserslistToTargets(targets);\n return targets;\n}\n\nfunction getLightningExclude(\n features: typeof Features,\n options: CssOutputOptions,\n) {\n const exclude = options.lightningcss?.exclude ?? 0;\n\n return options.vendorPrefixes === false\n ? exclude | features.VendorPrefixes\n : exclude;\n}\n","export function shouldInjectModuleImport(code: string, moduleId: string) {\n return !code.includes(moduleId);\n}\n\nexport function injectModuleImport(code: string, moduleId: string) {\n if (!shouldInjectModuleImport(code, moduleId)) return code;\n\n return injectCodeAfterDirectivePrologue(\n code,\n `import ${JSON.stringify(moduleId)};\\n`,\n );\n}\n\nexport function injectCodeAfterDirectivePrologue(\n code: string,\n injectedCode: string,\n) {\n const insertAt = getDirectivePrologueEnd(code);\n\n return code.slice(0, insertAt) + injectedCode + code.slice(insertAt);\n}\n\nfunction getDirectivePrologueEnd(code: string) {\n const pattern = /^(?:\\s*(?:\"[^\"]*\"|'[^']*')\\s*;?)+/;\n const match = pattern.exec(code);\n\n return match ? match[0].length : 0;\n}\n","import { type CompilerCssOptions, type CompilerDevOptions, CompilerRuntimeMode } from '../../compiler';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport type { PluginOptions } from './compiler';\n\nexport function getStyleRuntimeMode(dev: boolean, rsc = false): CompilerRuntimeMode {\n if (rsc) {\n return dev ? CompilerRuntimeMode.RscDev : CompilerRuntimeMode.RscProd;\n }\n\n return dev ? CompilerRuntimeMode.Dev : CompilerRuntimeMode.Prod;\n}\n\nexport function getPluginBuildConfig(options: PluginOptions): BuildConfig {\n const css: CompilerCssOptions = hasBuildConfig(options.css) ? options.css! : {};\n\n return {\n hoist: options.hoist !== false,\n css,\n };\n}\n\nexport function getPluginBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n const devConfig: BuildDevConfig | null = hasBuildConfig(options.dev) ? options.dev! : null;\n\n return devConfig;\n}\n\nfunction hasBuildConfig(config: CompilerCssOptions | CompilerDevOptions | null | undefined) {\n if (!config) return false;\n\n for (const key in config) {\n if (config[key as keyof typeof config] !== undefined) return true;\n }\n\n return false;\n}\n\nexport function getStyleEntryDefines(\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n sidecarUrl: string | null,\n stringify = true,\n) {\n const defines: Record<string, string> = {\n FLUENTIC_STYLE_BUILD_CONFIG: JSON.stringify(buildConfig),\n FLUENTIC_STYLE_DEV_CONFIG: JSON.stringify(buildDevConfig ?? {}),\n FLUENTIC_STYLE_SIDECAR_SERVER_URL: sidecarUrl ?? '',\n };\n\n if (stringify) {\n Object.keys(defines).forEach((key) => {\n defines[key] = JSON.stringify(defines[key]);\n });\n }\n\n return defines;\n}\n","import type { CompilerOptions, DevSourcemapMode } from '../../compiler';\nimport type { BabelTransformSourceMap } from '../../compiler/transform';\nimport { getDefaultSourcemapUrl, type GetSourcemapFilePathFn } from '../../compiler/utils/sourcemap';\nimport type { SourcemapSidecar } from './sidecar';\n\nexport type BundlerSourceMap = BabelTransformSourceMap | undefined;\n\nexport function parseBundlerSourceMap(map: string | null | undefined): any {\n if (!map) return null;\n return JSON.parse(map) as Exclude<BabelTransformSourceMap, string | null | undefined>;\n}\n\nexport function resolveDevSourcemapMode(\n mode: DevSourcemapMode | undefined,\n dev: boolean,\n): DevSourcemapMode {\n return mode ?? (dev ? 'sidecarServer' : 'sourceUrl');\n}\n\nexport function resolvePluginSourcemapFilePath(\n getSourcemapFilePath: GetSourcemapFilePathFn | undefined,\n sourcemapSidecar: SourcemapSidecar | null,\n): GetSourcemapFilePathFn {\n return (info) => {\n const defaultSourceUrl = getDefaultSourcemapUrl(info);\n\n const sourcePath = getSourcemapFilePath?.({\n ...info,\n sourcePath: info.sourcePath,\n sourceUrl: defaultSourceUrl,\n });\n\n const resolvedSourceUrl = sourcePath || defaultSourceUrl;\n\n sourcemapSidecar?.registerSource(info.absolutePath, resolvedSourceUrl);\n\n return resolvedSourceUrl;\n };\n}\n\nexport function resolvePluginSourcemapOptions<T extends CompilerOptions>(\n options: T,\n sourcemapSidecar: SourcemapSidecar | null,\n): T {\n return {\n ...options,\n getSourcemapFilePath: resolvePluginSourcemapFilePath(\n options.getSourcemapFilePath,\n sourcemapSidecar,\n ),\n };\n}\n","import { EXTRACTED_CSS_MARKER } from './constants';\n\nexport const RUNTIME_MODULE_ID = 'virtual:fluentic-style';\nexport const CSS_MODULE_ID = `${RUNTIME_MODULE_ID}.css`;\n\nexport const RESOLVED_RUNTIME_MODULE_ID = `\\0${RUNTIME_MODULE_ID}`;\nexport const RESOLVED_CSS_MODULE_ID = `\\0${CSS_MODULE_ID}`;\n\nexport const VIRTUAL_MODULE_REQUEST_PATTERN = `^${escapeRegex(RUNTIME_MODULE_ID)}(?:\\\\.css)?$`;\nexport const VIRTUAL_MODULE_REQUEST_REGEX = new RegExp(VIRTUAL_MODULE_REQUEST_PATTERN);\n\nexport function createRuntimeModuleSource(\n extract: boolean,\n cssModuleId?: string | null,\n) {\n return [\n extract && cssModuleId && `import ${JSON.stringify(cssModuleId)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function createRuntimeImport() {\n return `import ${JSON.stringify(RUNTIME_MODULE_ID)};\\n`;\n}\n\nexport function prependRuntimeImport(code: string) {\n if (code.includes(RUNTIME_MODULE_ID)) return code;\n return createRuntimeImport() + code;\n}\n\nexport function isVirtualModuleRequest(id: string, moduleId: string) {\n const normalized = normalizeVirtualModuleId(id);\n\n return normalized === moduleId || normalized === `\\0${moduleId}`;\n}\n\nexport function getVirtualModuleId(id: string) {\n if (isVirtualModuleRequest(id, RUNTIME_MODULE_ID)) {\n return RESOLVED_RUNTIME_MODULE_ID;\n }\n\n if (isVirtualModuleRequest(id, CSS_MODULE_ID)) {\n return RESOLVED_CSS_MODULE_ID;\n }\n\n return null;\n}\n\nexport function loadVirtualModule(\n id: string,\n extract: boolean,\n cssModuleId: string | null,\n) {\n if (isVirtualModuleRequest(id, RUNTIME_MODULE_ID)) {\n return createRuntimeModuleSource(extract, cssModuleId);\n }\n\n if (isVirtualModuleRequest(id, CSS_MODULE_ID)) {\n return EXTRACTED_CSS_MARKER;\n }\n\n return null;\n}\n\nfunction normalizeVirtualModuleId(id: string) {\n const base = id.split('?')[0]?.split('#')[0] ?? id;\n\n if (base.startsWith('/@id/__x00__')) {\n return `\\0${base.slice('/@id/__x00__'.length)}`;\n }\n\n if (base.startsWith('/@id/')) {\n return base.slice('/@id/'.length);\n }\n\n return base;\n}\n\nfunction escapeRegex(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n","import { PLUGIN_NAME } from './constants';\n\nexport function formatError(msg: string) {\n return `[${PLUGIN_NAME}] ${msg}`;\n}\n"],"mappings":";;;;;;AAmCA,SAAgB,mBAAmB,MAAwB;CACzD,MAAM,UAAU,KAAK,KAAK,KAAK,UAAU,KAAK,WAAW;CACzD,MAAM,WAAW,KAAK,KAAK,SAAS,OAAO;CAE3C,MAAM,eAAe,aAAqB;EACxC,OAAO,KAAK,KAAK,UAAU,aAAa,QAAQ,IAAI,OAAO;CAC7D;CAEA,MAAM,cAAc,SAAyB;EAC3C,MAAM,SAA6B;GACjC,UAAU,cAAc,KAAK,QAAQ;GACrC,aAAa,KAAK;GAClB,YAAY,KAAK;GACjB,OAAO,KAAK;GACZ,WAAW,KAAK,IAAI;EACtB;EAEA,GAAG,UAAU,UAAU,EAAE,WAAW,KAAK,CAAC;EAE1C,GAAG,cAAc,YAAY,OAAO,QAAQ,GAAG,KAAK,UAAU,MAAM,GAAG,MAAM;CAC/E;CAEA,MAAM,UAAU,OAAuB,CAAC,MAAM;EAE5C,OAAO,WADO,SAAS,IACD,GAAG,IAAI;CAC/B;CAEA,MAAM,YAAY,OAAuB,CAAC,MAAM;EAC9C,MAAM,UAAU,YAAY,UAAU,IAAI;EAC1C,MAAM,QAA4B,CAAC;EAEnC,KAAK,MAAM,UAAU,SACnB,MAAM,KAAK,GAAG,OAAO,KAAK;EAG5B,OAAO,MAAM,MAAM,GAAG,MAAM,qBAAqB,EAAE,UAAU,EAAE,QAAQ,CAAC;CAC1E;CAEA,MAAM,cAAc;EAClB,IAAI;GACF,GAAG,OAAO,SAAS;IAAE,WAAW;IAAM,OAAO;GAAK,CAAC;EACrD,QAAQ,CAER;CACF;CAEA,MAAM,kBAAkB,aAAqB;EA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