tailwind-styled-v4 5.0.8 → 5.0.10

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 (140) hide show
  1. package/CHANGELOG.md +204 -416
  2. package/README.md +45 -15
  3. package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
  4. package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
  5. package/dist/analyzer.d.mts +5 -3
  6. package/dist/analyzer.d.ts +5 -3
  7. package/dist/analyzer.js +563 -468
  8. package/dist/analyzer.js.map +1 -1
  9. package/dist/analyzer.mjs +562 -467
  10. package/dist/analyzer.mjs.map +1 -1
  11. package/dist/animate.d.mts +4 -7
  12. package/dist/animate.d.ts +4 -7
  13. package/dist/animate.js +171 -265
  14. package/dist/animate.js.map +1 -1
  15. package/dist/animate.mjs +165 -264
  16. package/dist/animate.mjs.map +1 -1
  17. package/dist/atomic.d.mts +22 -1
  18. package/dist/atomic.d.ts +22 -1
  19. package/dist/atomic.js +221 -165
  20. package/dist/atomic.js.map +1 -1
  21. package/dist/atomic.mjs +200 -165
  22. package/dist/atomic.mjs.map +1 -1
  23. package/dist/cli.d.mts +60 -1
  24. package/dist/cli.d.ts +60 -1
  25. package/dist/cli.js +1261 -1517
  26. package/dist/cli.js.map +1 -1
  27. package/dist/cli.mjs +1238 -1513
  28. package/dist/cli.mjs.map +1 -1
  29. package/dist/compiler.d.mts +38 -7
  30. package/dist/compiler.d.ts +38 -7
  31. package/dist/compiler.js +174 -197
  32. package/dist/compiler.js.map +1 -1
  33. package/dist/compiler.mjs +151 -194
  34. package/dist/compiler.mjs.map +1 -1
  35. package/dist/devtools.js +7 -31
  36. package/dist/devtools.js.map +1 -1
  37. package/dist/devtools.mjs +7 -31
  38. package/dist/devtools.mjs.map +1 -1
  39. package/dist/engine.d.mts +134 -63
  40. package/dist/engine.d.ts +134 -63
  41. package/dist/engine.js +2863 -2482
  42. package/dist/engine.js.map +1 -1
  43. package/dist/engine.mjs +2852 -2485
  44. package/dist/engine.mjs.map +1 -1
  45. package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
  46. package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
  47. package/dist/index.d.mts +63 -32
  48. package/dist/index.d.ts +63 -32
  49. package/dist/index.js +335 -169
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +315 -169
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
  54. package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
  55. package/dist/next.d.mts +10 -4
  56. package/dist/next.d.ts +10 -4
  57. package/dist/next.js +32 -45
  58. package/dist/next.js.map +1 -1
  59. package/dist/next.mjs +30 -43
  60. package/dist/next.mjs.map +1 -1
  61. package/dist/plugin-api.d.mts +8 -2
  62. package/dist/plugin-api.d.ts +8 -2
  63. package/dist/plugin-api.js +14 -2
  64. package/dist/plugin-api.js.map +1 -1
  65. package/dist/plugin-api.mjs +14 -3
  66. package/dist/plugin-api.mjs.map +1 -1
  67. package/dist/plugin-registry.js +51 -11
  68. package/dist/plugin-registry.js.map +1 -1
  69. package/dist/plugin-registry.mjs +51 -11
  70. package/dist/plugin-registry.mjs.map +1 -1
  71. package/dist/plugin.d.mts +5 -7
  72. package/dist/plugin.d.ts +5 -7
  73. package/dist/plugin.js +16 -15
  74. package/dist/plugin.js.map +1 -1
  75. package/dist/plugin.mjs +16 -16
  76. package/dist/plugin.mjs.map +1 -1
  77. package/dist/rspack.js +17 -38
  78. package/dist/rspack.js.map +1 -1
  79. package/dist/rspack.mjs +15 -36
  80. package/dist/rspack.mjs.map +1 -1
  81. package/dist/runtime.d.mts +2 -2
  82. package/dist/runtime.d.ts +2 -2
  83. package/dist/scanner.d.mts +10 -1
  84. package/dist/scanner.d.ts +10 -1
  85. package/dist/scanner.js +298 -124
  86. package/dist/scanner.js.map +1 -1
  87. package/dist/scanner.mjs +296 -124
  88. package/dist/scanner.mjs.map +1 -1
  89. package/dist/shared.d.mts +1 -1
  90. package/dist/shared.d.ts +1 -1
  91. package/dist/shared.js +104 -176
  92. package/dist/shared.js.map +1 -1
  93. package/dist/shared.mjs +85 -176
  94. package/dist/shared.mjs.map +1 -1
  95. package/dist/storybook-addon.d.mts +1 -1
  96. package/dist/storybook-addon.d.ts +1 -1
  97. package/dist/svelte.d.mts +1 -1
  98. package/dist/svelte.d.ts +1 -1
  99. package/dist/svelte.js +166 -3
  100. package/dist/svelte.js.map +1 -1
  101. package/dist/svelte.mjs +143 -1
  102. package/dist/svelte.mjs.map +1 -1
  103. package/dist/syntax.js +21 -21
  104. package/dist/syntax.js.map +1 -1
  105. package/dist/syntax.mjs +21 -21
  106. package/dist/syntax.mjs.map +1 -1
  107. package/dist/testing.js +9 -1
  108. package/dist/testing.js.map +1 -1
  109. package/dist/testing.mjs +9 -1
  110. package/dist/testing.mjs.map +1 -1
  111. package/dist/theme.d.mts +2 -2
  112. package/dist/theme.d.ts +2 -2
  113. package/dist/theme.js +40 -112
  114. package/dist/theme.js.map +1 -1
  115. package/dist/theme.mjs +37 -110
  116. package/dist/theme.mjs.map +1 -1
  117. package/dist/turbopackLoader.js +84 -126
  118. package/dist/turbopackLoader.js.map +1 -1
  119. package/dist/turbopackLoader.mjs +68 -124
  120. package/dist/turbopackLoader.mjs.map +1 -1
  121. package/dist/tw.js +1256 -1517
  122. package/dist/tw.js.map +1 -1
  123. package/dist/tw.mjs +1236 -1513
  124. package/dist/tw.mjs.map +1 -1
  125. package/dist/vite.js +1783 -823
  126. package/dist/vite.js.map +1 -1
  127. package/dist/vite.mjs +1767 -821
  128. package/dist/vite.mjs.map +1 -1
  129. package/dist/vue.d.mts +1 -1
  130. package/dist/vue.d.ts +1 -1
  131. package/dist/vue.js +165 -4
  132. package/dist/vue.js.map +1 -1
  133. package/dist/vue.mjs +141 -1
  134. package/dist/vue.mjs.map +1 -1
  135. package/dist/webpackLoader.js +69 -108
  136. package/dist/webpackLoader.js.map +1 -1
  137. package/dist/webpackLoader.mjs +49 -104
  138. package/dist/webpackLoader.mjs.map +1 -1
  139. package/native/tailwind-styled-native.node +0 -0
  140. package/package.json +22 -24
package/dist/vue.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/presentation/vue/src/index.ts"],"names":[],"mappings":";;;;;AA+BA,IAAM,cAAA,GAAiB,CAAC,KAAA,KACtB,OAAO,KAAA,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,SAAA,IACjB,KAAA,KAAU,MAAA;AAEZ,IAAM,cAAA,GAAiB,CAAC,KAAA,KAA0C;AAChE,EAAA,MAAM,QAAe,EAAC;AACtB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,cAAA,CAAe,KAAK,CAAA,EAAG;AACzB,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,KAAA;AAAA,IACf;AAAA,EACF;AACA,EAAA,OAAO,KAAA;AACT,CAAA;AAEA,IAAM,WAAA,GAAc,CAAC,KAAA,KAA4C;AAC/D,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,OAAO,KAAK,CAAA;AAClD,EAAA,OAAO,MAAA;AACT,CAAA;AAmBA,SAAS,eAAA,CACP,QAAA,EACA,KAAA,EACA,QAAA,GAAmC,EAAC,EAC5B;AACR,EAAA,MAAM,UAAoB,EAAC;AAC3B,EAAA,KAAA,MAAW,OAAO,QAAA,EAAU;AAC1B,IAAA,MAAM,GAAA,GAAM,KAAA,CAAM,GA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AiB,MAAM,KAAe;AAAA,SAC3E;AAAA,QACA,MAAM,OAAA;AAAU,OAClB;AAAA,IACJ;AAAA,GACD,CAAA;AACH;AAiBO,IAAM,oBAAA,GAAuB;AAAA,EAClC,QAAQ,GAAA,EAAU;AAChB,IAAA,GAAA,CAAI,MAAA,CAAO,iBAAiB,GAAA,GAAM,EAAA;AAClC,IAAA,GAAA,CAAI,MAAA,CAAO,iBAAiB,GAAA,GAAM,EAAA;AAClC,IAAA,GAAA,CAAI,OAAA,CAAQ,MAAM,EAAE,CAAA;AACpB,IAAA,GAAA,CAAI,OAAA,CAAQ,MAAM,EAAE,CAAA;AAAA,EACtB;AACF","file":"vue.mjs","sourcesContent":["/**\r\n * tailwind-styled-v4 — Vue Adapter\r\n *\r\n * Pola seperti `createComponent` di React tapi untuk Vue 3 Composition API.\r\n * Mendukung: base, variants, defaultVariants, compoundVariants.\r\n *\r\n * @example\r\n * import { tw } from '@tailwind-styled/vue'\r\n *\r\n * const Button = tw('button', {\r\n * base: 'px-4 py-2 rounded font-medium',\r\n * variants: {\r\n * intent: {\r\n * primary: 'bg-blue-500 text-white hover:bg-blue-600',\r\n * danger: 'bg-red-500 text-white hover:bg-red-600',\r\n * },\r\n * size: { sm: 'h-8 text-sm', md: 'h-10 text-base', lg: 'h-12 text-lg' },\r\n * },\r\n * defaultVariants: { intent: 'primary', size: 'md' },\r\n * })\r\n *\r\n * // In template:\r\n * // <Button intent=\"danger\" size=\"lg\">Delete</Button>\r\n */\r\n\r\nimport { twMerge } from \"tailwind-merge\"\r\nimport { type App, type Component, computed, type DefineComponent, defineComponent, h } from \"vue\"\r\n\r\nimport type { VariantValue, VariantProps as Props, HtmlTagName as HtmlTag } from '@tailwind-styled/shared'\r\n\r\n\r\nconst isVariantValue = (value: unknown): value is VariantValue =>\r\n typeof value === \"string\" ||\r\n typeof value === \"number\" ||\r\n typeof value === \"boolean\" ||\r\n value === undefined\r\n\r\nconst toVariantProps = (input: Record<string, unknown>): Props => {\r\n const props: Props = {}\r\n for (const [key, value] of Object.entries(input)) {\r\n if (isVariantValue(value)) {\r\n props[key] = value\r\n }\r\n }\r\n return props\r\n}\r\n\r\nconst toClassName = (value: VariantValue): string | undefined => {\r\n if (typeof value === \"string\") return value\r\n if (typeof value === \"number\") return String(value)\r\n return undefined\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface VueComponentConfig {\r\n base?: string\r\n variants?: Record<string, Record<string, string>>\r\n compoundVariants?: Array<{ class: string; [key: string]: VariantValue }>\r\n defaultVariants?: Record<string, string>\r\n}\r\n\r\nexport type HtmlTagName = HtmlTag\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Variant resolver (sama dengan React adapter)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nfunction resolveVariants(\r\n variants: Record<string, Record<string, string>>,\r\n props: Props,\r\n defaults: Record<string, string> = {}\r\n): string {\r\n const classes: string[] = []\r\n for (const key in variants) {\r\n const val = props[key] ?? defaults[key]\r\n if (val !== undefined && variants[key][String(val)]) {\r\n classes.push(variants[key][String(val)])\r\n }\r\n }\r\n return classes.join(\" \")\r\n}\r\n\r\nfunction resolveCompound(\r\n compounds: Array<{ class: string; [key: string]: VariantValue }>,\r\n props: Props\r\n): string {\r\n return compounds\r\n .filter((c) => {\r\n const { class: _cls, ...conditions } = c\r\n return Object.entries(conditions).every(([k, v]) => props[k] === v)\r\n })\r\n .map((c) => c.class)\r\n .join(\" \")\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Core factory\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Buat Vue component dengan Tailwind class yang terstruktur.\r\n *\r\n * @param tag - HTML tag atau Vue component\r\n * @param config - Konfigurasi base, variants, defaultVariants\r\n */\r\nexport function tw<Tag extends HtmlTag>(\r\n tag: Tag,\r\n config: VueComponentConfig = {}\r\n): DefineComponent<Record<string, unknown>> {\r\n const { base = \"\", variants = {}, compoundVariants = [], defaultVariants = {} } = config\r\n\r\n const variantKeys = new Set(Object.keys(variants))\r\n\r\n // Props definition untuk Vue — semua variant key jadi optional prop\r\n const propsDefinition: Record<string, { type: null; default: undefined }> = {}\r\n for (const key of variantKeys) {\r\n propsDefinition[key] = { type: null, default: undefined }\r\n }\r\n propsDefinition.class = { type: null, default: undefined }\r\n\r\n return defineComponent({\r\n name: `TwStyled${String(tag).charAt(0).toUpperCase() + String(tag).slice(1)}`,\r\n inheritAttrs: false,\r\n props: propsDefinition,\r\n setup(props, { attrs, slots }) {\r\n const className = computed(() => {\r\n const variantProps = toVariantProps(props as Record<string, unknown>)\r\n const attrProps = toVariantProps(attrs as Record<string, unknown>)\r\n const mergedProps = { ...defaultVariants, ...variantProps, ...attrProps }\r\n const variantClasses = resolveVariants(variants, mergedProps, defaultVariants)\r\n const compoundClasses = resolveCompound(compoundVariants, mergedProps)\r\n return twMerge(\r\n base,\r\n variantClasses,\r\n compoundClasses,\r\n toClassName(variantProps.class),\r\n toClassName(attrProps.class)\r\n )\r\n })\r\n\r\n return () => {\r\n // Filter out variant props — jangan diteruskan ke HTML element\r\n const filteredAttrs: Record<string, unknown> = {}\r\n for (const key in attrs) {\r\n if (!variantKeys.has(key)) {\r\n filteredAttrs[key] = attrs[key]\r\n }\r\n }\r\n\r\n return h(tag as string, { ...filteredAttrs, class: className.value }, slots.default?.())\r\n }\r\n },\r\n })\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// cv() — class variant helper (framework-agnostic, sama dengan React)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Class variant function — returns a class string resolver.\r\n * Framework-agnostic, bisa dipakai di mana saja.\r\n *\r\n * @example\r\n * const buttonCv = cv({\r\n * base: 'px-4 py-2 rounded',\r\n * variants: { size: { sm: 'h-8', lg: 'h-12' } },\r\n * defaultVariants: { size: 'sm' },\r\n * })\r\n *\r\n * buttonCv({ size: 'lg' }) // 'px-4 py-2 rounded h-12'\r\n */\r\nexport function cv(config: VueComponentConfig) {\r\n return (props: Props = {}) => {\r\n const { base = \"\", variants = {}, compoundVariants = [], defaultVariants = {} } = config\r\n const merged = { ...defaultVariants, ...props }\r\n const variantClasses = resolveVariants(variants, merged, defaultVariants)\r\n const compoundClasses = resolveCompound(compoundVariants, merged)\r\n return twMerge(base, variantClasses, compoundClasses, toClassName(props.class))\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Extend — tambahkan class ke komponen yang sudah ada\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Extend komponen Vue yang sudah ada dengan class tambahan.\r\n *\r\n * @example\r\n * const PrimaryButton = extend(Button, 'bg-blue-500 text-white')\r\n */\r\nexport function extend(\r\n component: Component,\r\n extraClasses: string\r\n): DefineComponent<Record<string, unknown>> {\r\n return defineComponent({\r\n name: `Extended${(\"name\" in component ? component.name : undefined) ?? \"Component\"}`,\r\n inheritAttrs: false,\r\n props: { class: { type: null, default: undefined } },\r\n setup(props, { attrs, slots }) {\r\n return () =>\r\n h(\r\n component,\r\n {\r\n ...attrs,\r\n class: twMerge(extraClasses, props.class as string, attrs.class as string),\r\n },\r\n slots.default?.()\r\n )\r\n },\r\n })\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Plugin Vue\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Vue plugin — daftarkan `tw` sebagai global composable.\r\n *\r\n * @example\r\n * // main.ts\r\n * import { createApp } from 'vue'\r\n * import { TailwindStyledPlugin } from '@tailwind-styled/vue'\r\n * import App from './App.vue'\r\n *\r\n * createApp(App).use(TailwindStyledPlugin).mount('#app')\r\n */\r\nexport const TailwindStyledPlugin = {\r\n install(app: App) {\r\n app.config.globalProperties.$tw = tw\r\n app.config.globalProperties.$cv = cv\r\n app.provide(\"tw\", tw)\r\n app.provide(\"cv\", cv)\r\n },\r\n}\r\n"]}
1
+ {"version":3,"sources":["../packages/domain/shared/src/native-resolution.ts","../packages/domain/shared/src/index.ts","../packages/domain/core/src/native.ts","../packages/domain/core/src/merge.ts","../packages/presentation/vue/src/index.ts"],"names":["createRequire","isBrowser","path","fileURLToPath","twMerge"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAGvE,IAAM,WAAW,OAAO,SAAA,KAAY,cAAc,SAAA,GAAU,aAAA,CAAc,YAAY,GAAG,CAAA;AAUzF,IAAM,YAAA,GAAyC;AAAA,EAC7C,WAAA,EAAgB,CAAC,mCAAmC,CAAA;AAAA,EACpD,aAAA,EAAgB,CAAC,qCAAqC,CAAA;AAAA,EACtD,YAAA,EAAgB,CAAC,oCAAoC,CAAA;AAAA,EACrD,cAAA,EAAgB,CAAC,sCAAsC,CAAA;AAAA,EACvD,WAAA,EAAgB,CAAC,mCAAmC,CAAA;AAAA,EACpD,aAAA,EAAgB,CAAC,qCAAqC;AACxD,CAAA;AAEA,SAAS,WAAA,GAAsB;AAC7B,EAAA,IAAI,WAAW,OAAO,SAAA;AACtB,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,CAAA,EAAI,QAAQ,IAAI,CAAA,CAAA;AAC5C;AAaO,SAAS,oBAAoB,UAAA,EAA6C;AAC/E,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,EAAE,MAAM,IAAA,EAAM,MAAA,EAAQ,aAAa,QAAA,EAAU,KAAA,EAAO,CAAC,0BAA0B,CAAA,EAAE;AAAA,EAC1F;AAGA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,KAAuB,GAAA,EAAK;AAC1C,IAAA,OAAO,EAAE,MAAM,IAAA,EAAM,MAAA,EAAQ,aAAa,QAAA,EAAU,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AAAA,UACE,GAAG,KAAA;AAAA,UACH,OAAO,OAAA,CAAQ,YAAA,EAAc,KAAA,CAAM,KAAA,EAAiB,MAAM,KAAe;AAAA,SAC3E;AAAA,QACA,MAAM,OAAA;AAAU,OAClB;AAAA,IACJ;AAAA,GACD,CAAA;AACH;AAiBO,IAAM,oBAAA,GAAuB;AAAA,EAClC,QAAQ,GAAA,EAAU;AAChB,IAAA,GAAA,CAAI,MAAA,CAAO,iBAAiB,GAAA,GAAM,EAAA;AAClC,IAAA,GAAA,CAAI,MAAA,CAAO,iBAAiB,GAAA,GAAM,EAAA;AAClC,IAAA,GAAA,CAAI,OAAA,CAAQ,MAAM,EAAE,CAAA;AACpB,IAAA,GAAA,CAAI,OAAA,CAAQ,MAAM,EAAE,CAAA;AAAA,EACtB;AACF","file":"vue.mjs","sourcesContent":["/**\r\n * Prebuilt binary resolution untuk native NAPI bindings.\r\n * QA #1: Resolve native binary dari prebuilt packages atau local build.\r\n *\r\n * Prioritas:\r\n * 1. TW_NATIVE_PATH env var (explicit override)\r\n * 2. Prebuilt binary dari platform-specific npm package\r\n * 3. Local build dari source (developer mode)\r\n */\r\n\r\nimport { createRequire } from \"node:module\"\r\nimport * as fs from \"node:fs\"\r\nimport * as path from \"node:path\"\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require — works in both ESM and CJS contexts\r\nconst _require = typeof require !== \"undefined\" ? require : createRequire(import.meta.url)\r\n\r\nexport interface NativeResolutionResult {\r\n path: string | null\r\n source: \"env\" | \"prebuilt\" | \"local\" | \"not-found\"\r\n platform: string\r\n tried: string[]\r\n}\r\n\r\n/** Platform key → prebuilt npm package name */\r\nconst PLATFORM_MAP: Record<string, string[]> = {\r\n \"linux-x64\": [\"@tailwind-styled/native-linux-x64\"],\r\n \"linux-arm64\": [\"@tailwind-styled/native-linux-arm64\"],\r\n \"darwin-x64\": [\"@tailwind-styled/native-darwin-x64\"],\r\n \"darwin-arm64\": [\"@tailwind-styled/native-darwin-arm64\"],\r\n \"win32-x64\": [\"@tailwind-styled/native-win32-x64\"],\r\n \"win32-arm64\": [\"@tailwind-styled/native-win32-arm64\"],\r\n}\r\n\r\nfunction platformKey(): string {\r\n if (isBrowser) return \"browser\"\r\n return `${process.platform}-${process.arch}`\r\n}\r\n\r\n/**\r\n * Resolve native binary path dari semua sumber yang tersedia.\r\n *\r\n * @example\r\n * const result = resolveNativeBinary()\r\n * if (result.path) {\r\n * const binding = require(result.path)\r\n * } else {\r\n * throw new Error(\"Native binding not found — run npm run build:rust\")\r\n * }\r\n */\r\nexport function resolveNativeBinary(runtimeDir?: string): NativeResolutionResult {\r\n const platform = platformKey()\r\n const tried: string[] = []\r\n\r\n if (isBrowser) {\r\n return { path: null, source: \"not-found\", platform, tried: [\"not available in browser\"] }\r\n }\r\n\r\n // 0. Disabled flag — always short-circuit before any I/O\r\n if (process.env.TWS_DISABLE_NATIVE === \"1\") {\r\n return { path: null, source: \"not-found\", platform, tried: [] }\r\n }\r\n\r\n // 1. Env var override\r\n const envPath = process.env.TW_NATIVE_PATH?.trim()\r\n if (envPath) {\r\n if (fs.existsSync(envPath)) {\r\n return { path: envPath, source: \"env\", platform, tried }\r\n }\r\n tried.push(`env:${envPath} (not found)`)\r\n }\r\n\r\n // 2. Prebuilt binary dari platform-specific npm package\r\n const prebuiltPkgs = PLATFORM_MAP[platform] ?? []\r\n for (const pkg of prebuiltPkgs) {\r\n try {\r\n const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"prebuilt\", platform, tried }\r\n }\r\n tried.push(`prebuilt:${pkg} (resolved but missing)`)\r\n } catch {\r\n tried.push(`prebuilt:${pkg} (not installed)`)\r\n }\r\n }\r\n\r\n // 3. Local build candidates\r\n const cwd = process.cwd()\r\n const base = runtimeDir ?? cwd\r\n // napi-rs naming: platform key may have -gnu suffix on Linux\r\n const napiPlatform = platform === \"linux-x64\" ? \"linux-x64-gnu\"\r\n : platform === \"linux-arm64\" ? \"linux-arm64-gnu\"\r\n : platform\r\n\r\n // Both possible binary names:\r\n // - \"tailwind_styled_parser\" (old hardcoded name in resolvers)\r\n // - \"tailwind-styled-native\" (actual binaryName in native/package.json)\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n\r\n const localCandidates: string[] = []\r\n\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(base, `${bin}.node`))\r\n localCandidates.push(path.resolve(base, \"..\", `${bin}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`))\r\n }\r\n\r\n // Walk up from cwd AND base to find repo root native/ dir\r\n // Needed when npm workspaces sets cwd to the package subdir\r\n for (const startDir of [cwd, base]) {\r\n let dir = startDir\r\n for (let i = 0; i < 6; i++) {\r\n const nativeDir = path.resolve(dir, \"native\")\r\n for (const bin of BINARY_NAMES) {\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`))\r\n localCandidates.push(path.resolve(nativeDir, \"target\", \"release\", `${bin}.node`))\r\n }\r\n const parent = path.resolve(dir, \"..\")\r\n if (parent === dir) break\r\n dir = parent\r\n }\r\n }\r\n\r\n for (const candidate of localCandidates) {\r\n tried.push(`local:${candidate}`)\r\n if (fs.existsSync(candidate)) {\r\n return { path: candidate, source: \"local\", platform, tried }\r\n }\r\n }\r\n\r\n return { path: null, source: \"not-found\", platform, tried }\r\n}\r\n\r\n/**\r\n * Format human-readable error untuk \"binary not found\".\r\n */\r\nexport function formatNativeNotFoundError(result: NativeResolutionResult): string {\r\n const lines = [\r\n `[tailwind-styled] Native binding not found for ${result.platform}`,\r\n ``,\r\n `Tried:`,\r\n ...result.tried.map(t => ` - ${t}`),\r\n ``,\r\n `Solutions:`,\r\n ` 1. Build locally: npm run build:rust`,\r\n ` 2. Install prebuilt: npm install @tailwind-styled/native-${result.platform}`,\r\n ` 3. Override path: TW_NATIVE_PATH=/path/to/parser.node`,\r\n ]\r\n return lines.join(\"\\n\")\r\n}","import { createHash } from \"node:crypto\"\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { fileURLToPath } from \"node:url\"\r\nimport { createRequire } from \"node:module\"\r\n\r\n// Native-only: Node.js is always available. No browser fallback.\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type TokenMap = Record<string, string>\r\n\r\nexport type VariantValue = string | number | boolean | undefined\r\n\r\nexport type VariantProps = Record<string, VariantValue>\r\n\r\nexport type HtmlTagName = keyof HTMLElementTagNameMap\r\n\r\nexport type CompoundCondition = Record<string, string | number | boolean>\r\n\r\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Logging\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface Logger {\r\n warn(...args: unknown[]): void\r\n debug(...args: unknown[]): void\r\n error(...args: unknown[]): void\r\n log(...args: unknown[]): void\r\n}\r\n\r\nexport function createLogger(namespace: string): Logger {\r\n const prefix = `[${namespace}]`\r\n return {\r\n warn(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n debug(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n error(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n log(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n }\r\n}\r\n\r\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\r\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\r\n return (msg: string) => {\r\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\r\n console.debug(prefix, msg)\r\n }\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error handling\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\r\n\r\ntype ZodLikeIssue = {\r\n path?: readonly PropertyKey[]\r\n message?: string\r\n}\r\n\r\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\r\n if (!path || path.length === 0) return \"(root)\"\r\n return path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n}\r\n\r\nexport class TwError extends Error {\r\n /** @deprecated Gunakan source */\r\n public readonly domain: string\r\n public readonly source: ErrorSource\r\n public readonly code: string\r\n public readonly originalCause?: unknown\r\n\r\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\r\n super(message)\r\n this.name = \"TwError\"\r\n this.domain = domainOrSource\r\n this.source = domainOrSource as ErrorSource\r\n this.code = code\r\n this.originalCause = cause\r\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\r\n }\r\n\r\n static fromIo(code: string, message: string): TwError {\r\n return new TwError(\"io\", code, message)\r\n }\r\n\r\n static fromCompile(code: string, message: string): TwError {\r\n return new TwError(\"compile\", code, message)\r\n }\r\n\r\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\r\n if (err && typeof err === \"object\") {\r\n const e = err as { code?: string; message?: string }\r\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\r\n }\r\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\r\n }\r\n\r\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\r\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\r\n const first = err.issues?.[0] ?? err.errors?.[0]\r\n const path = formatIssuePath(first?.path)\r\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\r\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\r\n }\r\n\r\n static wrap(source: string, code: string, err: unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(source, code, err.message, err)\r\n return new TwError(source, code, String(err), err)\r\n }\r\n\r\n override toString(): string {\r\n return `TwError [${this.source}:${this.code}] ${this.message}`\r\n }\r\n\r\n toJSON(): { name: string; source: string; code: string; message: string } {\r\n return { name: this.name, source: this.source, code: this.code, message: this.message }\r\n }\r\n\r\n toCliMessage(): string {\r\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\r\n }\r\n}\r\n\r\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\r\n return TwError.wrap(domain, code, error)\r\n}\r\n\r\nexport function isTwError(err: unknown): err is TwError {\r\n return err instanceof TwError\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Native binding resolution\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface LoadNativeBindingOptions<T> {\r\n runtimeDir: string\r\n candidates: string[]\r\n isValid: (module: unknown) => module is T\r\n invalidExportMessage: string\r\n}\r\n\r\nexport interface LoadNativeBindingResult<T> {\r\n binding: T | null\r\n loadErrors: Array<{ path: string; message: string }>\r\n loadedPath?: string\r\n}\r\n\r\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n\r\n for (const candidate of candidates) {\r\n const candidatePath = path.resolve(runtimeDir, candidate)\r\n try {\r\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\r\n continue\r\n }\r\n const mod = requireNativeModule(candidatePath)\r\n if (mod && isValid(mod)) {\r\n return { binding: mod, loadErrors, loadedPath: candidatePath }\r\n }\r\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\r\n } catch (e) {\r\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\r\n }\r\n }\r\n\r\n return { binding: null, loadErrors }\r\n}\r\n\r\nconst _require = createRequire(import.meta.url)\r\n\r\nfunction requireNativeModule(p: string): unknown {\r\n return _require(p)\r\n}\r\n\r\nexport interface ResolveCandidatesOptions {\r\n runtimeDir?: string\r\n envVarNames?: string[]\r\n includeDefaultCandidates?: boolean\r\n enforceNodeExtensionForEnvPath?: boolean\r\n /** @deprecated — ignored, kept for backward compat */\r\n packageName?: string\r\n}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n const {\r\n envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\r\n includeDefaultCandidates = true,\r\n enforceNodeExtensionForEnvPath = false,\r\n } = options\r\n // Default ke cwd kalau runtimeDir tidak disediakan\r\n const runtimeDir = options.runtimeDir || process.cwd()\r\n const candidates: string[] = []\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\r\n }\r\n }\r\n\r\n if (!includeDefaultCandidates) return candidates\r\n\r\n if (fs.existsSync(runtimeDir)) {\r\n try {\r\n for (const entry of fs.readdirSync(runtimeDir)) {\r\n if (entry.endsWith(\".node\")) candidates.push(entry)\r\n }\r\n } catch { /* ignore read errors */ }\r\n }\r\n\r\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\r\n const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\r\n : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\r\n : `${process.platform}-${process.arch}`\r\n\r\n for (const bin of BINARY_NAMES) {\r\n candidates.push(path.resolve(runtimeDir, `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\r\n // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\r\n // 3 level fallback\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\r\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\r\n }\r\n\r\n return Array.from(new Set(candidates))\r\n}\r\n\r\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\r\n if (dir) return path.resolve(dir)\r\n try {\r\n return path.dirname(fileURLToPath(importMetaUrl))\r\n } catch {\r\n return process.cwd()\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Hashing\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\r\n const hash = createHash(algorithm).update(content).digest(\"hex\")\r\n return length ? hash.slice(0, length) : hash\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error formatting\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function formatErrorMessage(error: unknown): string {\r\n if (error instanceof TwError) return error.toString()\r\n if (error instanceof Error) return error.message\r\n return String(error)\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport class LRUCache<K, V> {\r\n private capacity: number\r\n private cache: Map<K, V>\r\n\r\n constructor(capacity: number) {\r\n this.capacity = capacity\r\n this.cache = new Map()\r\n }\r\n\r\n get(key: K): V | undefined {\r\n if (!this.cache.has(key)) return undefined\r\n const value = this.cache.get(key)!\r\n this.cache.delete(key)\r\n this.cache.set(key, value)\r\n return value\r\n }\r\n\r\n set(key: K, value: V): void {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key)\r\n } else if (this.cache.size >= this.capacity) {\r\n const firstKey = this.cache.keys().next().value\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey)\r\n }\r\n }\r\n this.cache.set(key, value)\r\n }\r\n\r\n delete(key: K): boolean {\r\n return this.cache.delete(key)\r\n }\r\n\r\n has(key: K): boolean {\r\n return this.cache.has(key)\r\n }\r\n\r\n clear(): void {\r\n this.cache.clear()\r\n }\r\n\r\n entries(): IterableIterator<[K, V]> {\r\n return this.cache.entries()\r\n }\r\n\r\n get size(): number {\r\n return this.cache.size\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Trace Utilities\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\r\nexport {\r\n getHealthColor,\r\n getModeColor,\r\n formatMemory,\r\n formatDuration,\r\n calculateHealth,\r\n getBuildTimeColor,\r\n getMemoryColor,\r\n createTraceSnapshot,\r\n getPipelinePercentages,\r\n} from \"./trace\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Performance Telemetry\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error Codes\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { ErrorCode } from \"./error-codes\"\r\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Tailwind Compatibility\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TailwindInfo } from \"./compatibility\"\r\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\r\n\r\n// ── Native binding schemas (Zod boundary validation)\r\nexport {\r\n NativeScanFileSchema, NativeScanResultSchema,\r\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\r\n NativeCssCompileResultSchema, NativeWatchResultSchema,\r\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\r\n safeParseNative, parseNative,\r\n} from './native-schemas'\r\n\r\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\r\nexport {\r\n createEsmRequire,\r\n getDirname,\r\n getFilename,\r\n resolveFromRoot,\r\n tryRequire,\r\n resolveNativeNodePath,\r\n} from \"./esmHelpers\"\r\n\r\n// ── Performance telemetry ────────────────────────────────────────────────────\r\nexport {\r\n TelemetryCollector,\r\n getGlobalTelemetry,\r\n resetGlobalTelemetry,\r\n createBuildTimer,\r\n type BuildTelemetry,\r\n type TelemetrySummary,\r\n type BuildPhases,\r\n} from \"./telemetry\"\r\n\r\n// ── Config/JSON schema validation ─────────────────────────────────────────────\r\nexport {\r\n ScanCacheSchema,\r\n ScanCacheClassEntrySchema,\r\n TailwindConfigSchema,\r\n RegistryPluginEntrySchema,\r\n RegistryFileSchema,\r\n PackageJsonSchema,\r\n parseJsonWithSchema,\r\n parseJsonFileWithSchema,\r\n type ScanCache,\r\n type ScanCacheClassEntry,\r\n type TailwindConfig,\r\n type RegistryPluginEntry,\r\n type RegistryFile,\r\n type PackageJson,\r\n} from \"./configSchemas\"\r\n\r\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\r\nexport {\r\n resolveWorkerPath,\r\n resolveLoaderPath,\r\n type WorkerPathOptions,\r\n type WorkerPathResult,\r\n} from \"./workerResolver\"\r\n\r\n// ── Codegen helpers ───────────────────────────────────────────────────────────\r\nexport {\r\n generateComponentCode,\r\n generateStorybookStory,\r\n generateClassRenameCodemod,\r\n generateBarrelFile,\r\n type ComponentCodegenOptions,\r\n} from \"./codegen\"\r\n\r\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\r\nexport {\r\n resolveNativeBinary,\r\n formatNativeNotFoundError,\r\n type NativeResolutionResult,\r\n} from \"./native-resolution\"\r\n\r\n// ── Shared observability contract ────────────────────────────────────────────\r\nexport {\r\n createObservabilityClient,\r\n type ClassInspection,\r\n type ClassProperty,\r\n type ClassUsageLocation,\r\n type BuildTrace,\r\n type BuildPhaseTrace,\r\n type DashboardMetrics,\r\n type DashboardSummary,\r\n type ObservabilityClient,\r\n} from \"./observability\"","/**\r\n * tailwind-styled-v5 — Native Rust Bindings\r\n *\r\n * All functions require native Rust bindings.\r\n * Uses @tailwind-styled/shared for native resolution.\r\n */\r\n\r\nimport { dirname } from \"node:path\"\r\nimport { fileURLToPath } from \"node:url\"\r\nimport { resolveNativeBinary } from \"@tailwind-styled/shared\"\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\nconst NATIVE_UNAVAILABLE_MESSAGE =\r\n \"[tailwind-styled/core] Native binding is required but not available.\\n\" +\r\n \"Please ensure you have run: npm run build:rust\"\r\n\r\n// require() is safe here — tsup banner injects CJS-compatible require into ESM output.\r\n// See tsup.config.ts esbuildOptions banner for how this is set up.\r\nconst _loadNative = (path: string): unknown => require(path)\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Type Definitions\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface ParsedClassModifier {\r\n type: \"opacity\" | \"arbitrary\"\r\n value: string\r\n}\r\n\r\nexport interface ParsedClass {\r\n raw: string\r\n base: string\r\n variants: string[]\r\n modifier?: ParsedClassModifier\r\n}\r\n\r\nexport interface ThemeConfig {\r\n colors: Record<string, string>\r\n spacing: Record<string, string>\r\n fonts: Record<string, string>\r\n breakpoints: Record<string, string>\r\n animations: Record<string, string>\r\n raw: Record<string, string>\r\n}\r\n\r\ninterface NativeBinding {\r\n batchSplitClasses?: (input: string[]) => Array<{\r\n variantKey: string\r\n base: string\r\n variants: string[]\r\n isArbitrary: boolean\r\n hasModifier: boolean\r\n }>\r\n compileTheme?: (themeConfig: string) => { css: string; variables: Record<string, string> }\r\n extractCssVars?: (css: string) => Record<string, string>\r\n extractThemeFromCss?: (css: string) => Array<{ key: string; value: string }>\r\n parseCssRules?: (css: string) => Array<{\r\n className: string\r\n property: string\r\n value: string\r\n isImportant: boolean\r\n variants: string[]\r\n specificity: number\r\n }>\r\n parseCssToRules?: (css: string) => string\r\n detectDeadCode?: (css: string, usedClasses: string[]) => string[]\r\n classifyKnownClasses?: (classes: string[]) => Array<{ className: string; category: string }>\r\n detectClassConflicts?: (classes: string) => { conflicts: Array<{ class1: string; class2: string; reason: string }>; conflictedClassNames: string[] }\r\n resolveVariants?: (configJson: string, propsJson: string) => { classes: string; resolvedCount: number }\r\n resolveSimpleVariants?: (base: string | null, variants: Record<string, Record<string, string>>, defaults: Record<string, string>, props: Record<string, string>) => string\r\n /** Parse template literal yang sudah di-join. Menggantikan parseTemplate() di twProxy.ts */\r\n parseTemplate?: (raw: string) => {\r\n base: string\r\n subsJson: string\r\n hasSubs: boolean\r\n }\r\n /** Validate ComponentConfig — menggantikan validateVariantConfig() di cv.ts */\r\n validateVariantConfig?: (configJson: string) => {\r\n valid: boolean\r\n errors: Array<{ errorType: string; key: string; value?: string; message: string }>\r\n warnings: string[]\r\n }\r\n /** Build lookup key untuk generated registry — menggantikan key builder di lookupGenerated() */\r\n buildVariantLookupKey?: (defaultVariantsJson: string, propsJson: string) => string\r\n /** Menggantikan cn() — filter+join class names dalam satu Rust pass. (class_utils.rs) */\r\n resolveClassNames?: (inputs: string[]) => string\r\n /** tw_merge dengan custom separator dan optional debug */\r\n twMergeWithSeparator?: (classString: string, opts: { separator?: string; debug?: boolean }) => string\r\n /** tw_merge_many dengan custom separator */\r\n twMergeManyWithSeparator?: (classStrings: string[], opts: { separator?: string; debug?: boolean }) => string\r\n /** conflict-aware Tailwind class merger — port of tailwind-merge. (tw_merge.rs) */\r\n twMerge?: (classString: string) => string\r\n /** variadic convenience wrapper untuk twMerge. (tw_merge.rs) */\r\n twMergeMany?: (classStrings: string[]) => string\r\n /** Tailwind classes → semicolon-separated inline CSS declarations. (state_css.rs) */\r\n twClassesToCss?: (classes: string) => string\r\n /** Iterative CSS var() chain resolver. (theme.rs) */\r\n resolveThemeValue?: (key: string, rawMapJson: string) => string\r\n /** Parse sub-component block syntax from tw`` template. (tw_merge.rs) */\r\n parseSubcomponentBlocksNapi?: (template: string, componentName: string) => {\r\n baseClasses: string\r\n subMapJson: string\r\n }\r\n /** Menggantikan layoutClassesToCss() — static lookup + split dalam satu Rust pass. (container_query.rs) */\r\n layoutClassesToCss?: (classes: string) => string\r\n /** Menggantikan buildContainerRules() — generate @container CSS rules. (container_query.rs) */\r\n buildContainerRules?: (\r\n id: string,\r\n breakpoints: Array<{ key: string; classes: string }>,\r\n containerName: string | null\r\n ) => string\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Binding Loader\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nlet nativeBinding: NativeBinding | null = null\r\nlet bindingLoadAttempted = false\r\n\r\nconst getBinding = (): NativeBinding => {\r\n if (isBrowser) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE + \"\\n\\nNative bindings are not available in browser. Use the compiled CSS output instead.\")\r\n }\r\n \r\n if (nativeBinding) return nativeBinding\r\n\r\n if (bindingLoadAttempted) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n\r\n bindingLoadAttempted = true\r\n\r\n try {\r\n const runtimeDir = isBrowser ? \"\" : dirname(fileURLToPath(import.meta.url))\r\n const result = isBrowser\r\n ? { path: null, source: \"not-found\", platform: \"browser\", tried: [] }\r\n : resolveNativeBinary(runtimeDir)\r\n\r\n if (result.path && result.path.endsWith(\".node\")) {\r\n const mod = _loadNative(result.path) as NativeBinding\r\n if (mod?.batchSplitClasses) {\r\n nativeBinding = mod\r\n return nativeBinding\r\n }\r\n }\r\n\r\n throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}\\n\\nTried: ${result.tried.join(\"\\n\")}`)\r\n } catch (err) {\r\n throw err instanceof Error ? err : new Error(String(err))\r\n }\r\n}\r\n\r\nexport const resetNativeBinding = (): void => {\r\n nativeBinding = null\r\n bindingLoadAttempted = false\r\n}\r\n\r\nexport const getNativeBinding = getBinding\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Parser Functions\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nfunction splitClassListNative(input: string): string[] {\r\n const binding = getBinding()\r\n if (!binding?.batchSplitClasses) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n const result = binding.batchSplitClasses([input])\r\n if (result.length === 0) return []\r\n return result[0].base.split(\" \").filter(Boolean)\r\n}\r\n\r\nfunction parseClassTokenNative(rawToken: string): ParsedClass {\r\n const binding = getBinding()\r\n if (!binding?.batchSplitClasses) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n const result = binding.batchSplitClasses([rawToken])\r\n if (result.length === 0) {\r\n return { raw: rawToken, base: rawToken, variants: [] }\r\n }\r\n const r = result[0]\r\n const parsed: ParsedClass = {\r\n raw: r.base,\r\n base: r.base,\r\n variants: r.variants,\r\n }\r\n if (r.hasModifier) {\r\n const opacityMatch = r.base.match(/^(.*)\\/(\\d{1,3})$/)\r\n if (opacityMatch && opacityMatch[1].length > 0) {\r\n parsed.base = opacityMatch[1]\r\n parsed.modifier = { type: \"opacity\", value: opacityMatch[2] }\r\n } else {\r\n const arbitraryMatch = r.base.match(/\\((--[a-zA-Z0-9_-]+)\\)/)\r\n if (arbitraryMatch) {\r\n parsed.modifier = { type: \"arbitrary\", value: arbitraryMatch[1] }\r\n }\r\n }\r\n }\r\n return parsed\r\n}\r\n\r\nexport function splitClassList(input: string): string[] {\r\n return splitClassListNative(input)\r\n}\r\n\r\nexport function parseClassToken(rawToken: string): ParsedClass {\r\n return parseClassTokenNative(rawToken)\r\n}\r\n\r\nexport function parseTailwindClasses(input: string): ParsedClass[] {\r\n const classes = splitClassListNative(input)\r\n return classes.map((c) => parseClassTokenNative(c))\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// CSS/Theme Functions\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function compileTheme(themeConfig: Record<string, unknown>) {\r\n const binding = getBinding()\r\n if (!binding?.compileTheme) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.compileTheme(JSON.stringify(themeConfig))\r\n}\r\n\r\nexport function extractCssVars(css: string): Record<string, string> {\r\n const binding = getBinding()\r\n if (!binding?.extractCssVars) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.extractCssVars(css)\r\n}\r\n\r\nexport function parseCssRules(css: string) {\r\n const binding = getBinding()\r\n if (!binding?.parseCssRules) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.parseCssRules(css)\r\n}\r\n\r\nexport function parseCssToRules(css: string): string {\r\n const binding = getBinding()\r\n if (!binding?.parseCssToRules) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.parseCssToRules(css)\r\n}\r\n\r\nexport function detectDeadCode(css: string, usedClasses: string[]): string[] {\r\n const binding = getBinding()\r\n if (!binding?.detectDeadCode) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.detectDeadCode(css, usedClasses)\r\n}\r\n\r\nexport function classifyKnownClasses(classes: string[]) {\r\n const binding = getBinding()\r\n if (!binding?.classifyKnownClasses) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.classifyKnownClasses(classes)\r\n}\r\n\r\nexport function detectClassConflicts(classes: string[]) {\r\n const binding = getBinding()\r\n if (!binding?.detectClassConflicts) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n return binding.detectClassConflicts(classes.join(\" \"))\r\n}\r\n\r\nexport function extractThemeFromCSS(cssContent: string): ThemeConfig {\r\n const binding = getBinding()\r\n if (!binding?.parseCssRules) {\r\n throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\r\n }\r\n \r\n const properties = binding.parseCssRules(cssContent)\r\n const theme: ThemeConfig = {\r\n colors: {},\r\n spacing: {},\r\n fonts: {},\r\n breakpoints: {},\r\n animations: {},\r\n raw: {},\r\n }\r\n \r\n const prefixMap: Record<string, keyof ThemeConfig> = {\r\n \"color-\": \"colors\",\r\n \"spacing-\": \"spacing\",\r\n \"font-\": \"fonts\",\r\n \"breakpoint-\": \"breakpoints\",\r\n \"animate-\": \"animations\",\r\n }\r\n \r\n for (const prop of properties) {\r\n const cssVar = prop.property.replace(/^--/, \"\")\r\n theme.raw[cssVar] = prop.value\r\n \r\n for (const [prefix, category] of Object.entries(prefixMap)) {\r\n if (cssVar.startsWith(prefix)) {\r\n const name = cssVar.slice(prefix.length)\r\n if (name) theme[category][name] = prop.value\r\n break\r\n }\r\n }\r\n }\r\n \r\n return theme\r\n}","/**\r\n * tailwind-styled-v4 — createTwMerge()\r\n *\r\n * Native-only: uses Rust `tw_merge_many`; requires native binding.\r\n * No JS fallback — tailwind-merge removed from bundle.\r\n */\r\n\r\nimport { getNativeBinding } from \"./native\"\r\n\r\nimport type { ThemeConfig } from \"./themeReader\"\r\n\r\nexport interface MergeOptions {\r\n prefix?: string\r\n separator?: string\r\n theme?: ThemeConfig\r\n}\r\n\r\nfunction normalizeClassInput(classLists: Array<string | undefined | null | false>): string[] {\r\n return classLists\r\n .filter(Boolean)\r\n .map((v) => String(v).trim())\r\n .filter((v) => v.length > 0)\r\n}\r\n\r\n/**\r\n * createTwMerge — returns a conflict-aware merge function.\r\n * Native-only: uses Rust `tw_merge_many`; throws if native binding unavailable.\r\n *\r\n * Note: `prefix` and `separator` options are not supported in native mode\r\n * (Tailwind v3/v4 defaults are used).\r\n */\r\nexport function createTwMerge(_options: MergeOptions = {}) {\r\n return function twMerge(...classLists: Array<string | undefined | null | false>): string {\r\n const clean = normalizeClassInput(classLists)\r\n if (clean.length === 0) return \"\"\r\n\r\n const native = getNativeBinding()\r\n if (!native?.twMergeMany) {\r\n throw new Error(\"FATAL: Native binding 'twMergeMany' is required but not available.\")\r\n }\r\n return native.twMergeMany(clean)\r\n }\r\n}\r\n\r\nexport const twMerge = createTwMerge()\r\n\r\nexport function mergeWithRules(\r\n rules: Record<string, (classes: string[]) => string>,\r\n ...classLists: string[]\r\n): string {\r\n const base = twMerge(...classLists)\r\n const classes = Object.values(rules).reduce(\r\n (acc, rule) => twMerge(rule(acc)).split(/\\s+/).filter(Boolean),\r\n base.split(/\\s+/).filter(Boolean)\r\n )\r\n\r\n return classes.join(\" \")\r\n}\r\n","/**\r\n * tailwind-styled-v4 — Vue Adapter\r\n *\r\n * Pola seperti `createComponent` di React tapi untuk Vue 3 Composition API.\r\n * Mendukung: base, variants, defaultVariants, compoundVariants.\r\n *\r\n * @example\r\n * import { tw } from '@tailwind-styled/vue'\r\n *\r\n * const Button = tw('button', {\r\n * base: 'px-4 py-2 rounded font-medium',\r\n * variants: {\r\n * intent: {\r\n * primary: 'bg-blue-500 text-white hover:bg-blue-600',\r\n * danger: 'bg-red-500 text-white hover:bg-red-600',\r\n * },\r\n * size: { sm: 'h-8 text-sm', md: 'h-10 text-base', lg: 'h-12 text-lg' },\r\n * },\r\n * defaultVariants: { intent: 'primary', size: 'md' },\r\n * })\r\n *\r\n * // In template:\r\n * // <Button intent=\"danger\" size=\"lg\">Delete</Button>\r\n */\r\n\r\nimport { twMerge } from \"@tailwind-styled/core\"\r\nimport { type App, type Component, computed, type DefineComponent, defineComponent, h } from \"vue\"\r\n\r\nimport type { VariantValue, VariantProps as Props, HtmlTagName as HtmlTag } from '@tailwind-styled/shared'\r\n\r\n\r\nconst isVariantValue = (value: unknown): value is VariantValue =>\r\n typeof value === \"string\" ||\r\n typeof value === \"number\" ||\r\n typeof value === \"boolean\" ||\r\n value === undefined\r\n\r\nconst toVariantProps = (input: Record<string, unknown>): Props => {\r\n const props: Props = {}\r\n for (const [key, value] of Object.entries(input)) {\r\n if (isVariantValue(value)) {\r\n props[key] = value\r\n }\r\n }\r\n return props\r\n}\r\n\r\nconst toClassName = (value: VariantValue): string | undefined => {\r\n if (typeof value === \"string\") return value\r\n if (typeof value === \"number\") return String(value)\r\n return undefined\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface VueComponentConfig {\r\n base?: string\r\n variants?: Record<string, Record<string, string>>\r\n compoundVariants?: Array<{ class: string; [key: string]: VariantValue }>\r\n defaultVariants?: Record<string, string>\r\n}\r\n\r\nexport type HtmlTagName = HtmlTag\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Variant resolver (sama dengan React adapter)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nfunction resolveVariants(\r\n variants: Record<string, Record<string, string>>,\r\n props: Props,\r\n defaults: Record<string, string> = {}\r\n): string {\r\n const classes: string[] = []\r\n for (const key in variants) {\r\n const val = props[key] ?? defaults[key]\r\n if (val !== undefined && variants[key][String(val)]) {\r\n classes.push(variants[key][String(val)])\r\n }\r\n }\r\n return classes.join(\" \")\r\n}\r\n\r\nfunction resolveCompound(\r\n compounds: Array<{ class: string; [key: string]: VariantValue }>,\r\n props: Props\r\n): string {\r\n return compounds\r\n .filter((c) => {\r\n const { class: _cls, ...conditions } = c\r\n return Object.entries(conditions).every(([k, v]) => props[k] === v)\r\n })\r\n .map((c) => c.class)\r\n .join(\" \")\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Core factory\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Buat Vue component dengan Tailwind class yang terstruktur.\r\n *\r\n * @param tag - HTML tag atau Vue component\r\n * @param config - Konfigurasi base, variants, defaultVariants\r\n */\r\nexport function tw<Tag extends HtmlTag>(\r\n tag: Tag,\r\n config: VueComponentConfig = {}\r\n): DefineComponent<Record<string, unknown>> {\r\n const { base = \"\", variants = {}, compoundVariants = [], defaultVariants = {} } = config\r\n\r\n const variantKeys = new Set(Object.keys(variants))\r\n\r\n // Props definition untuk Vue — semua variant key jadi optional prop\r\n const propsDefinition: Record<string, { type: null; default: undefined }> = {}\r\n for (const key of variantKeys) {\r\n propsDefinition[key] = { type: null, default: undefined }\r\n }\r\n propsDefinition.class = { type: null, default: undefined }\r\n\r\n return defineComponent({\r\n name: `TwStyled${String(tag).charAt(0).toUpperCase() + String(tag).slice(1)}`,\r\n inheritAttrs: false,\r\n props: propsDefinition,\r\n setup(props, { attrs, slots }) {\r\n const className = computed(() => {\r\n const variantProps = toVariantProps(props as Record<string, unknown>)\r\n const attrProps = toVariantProps(attrs as Record<string, unknown>)\r\n const mergedProps = { ...defaultVariants, ...variantProps, ...attrProps }\r\n const variantClasses = resolveVariants(variants, mergedProps, defaultVariants)\r\n const compoundClasses = resolveCompound(compoundVariants, mergedProps)\r\n return twMerge(\r\n base,\r\n variantClasses,\r\n compoundClasses,\r\n toClassName(variantProps.class),\r\n toClassName(attrProps.class)\r\n )\r\n })\r\n\r\n return () => {\r\n // Filter out variant props — jangan diteruskan ke HTML element\r\n const filteredAttrs: Record<string, unknown> = {}\r\n for (const key in attrs) {\r\n if (!variantKeys.has(key)) {\r\n filteredAttrs[key] = attrs[key]\r\n }\r\n }\r\n\r\n return h(tag as string, { ...filteredAttrs, class: className.value }, slots.default?.())\r\n }\r\n },\r\n })\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// cv() — class variant helper (framework-agnostic, sama dengan React)\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Class variant function — returns a class string resolver.\r\n * Framework-agnostic, bisa dipakai di mana saja.\r\n *\r\n * @example\r\n * const buttonCv = cv({\r\n * base: 'px-4 py-2 rounded',\r\n * variants: { size: { sm: 'h-8', lg: 'h-12' } },\r\n * defaultVariants: { size: 'sm' },\r\n * })\r\n *\r\n * buttonCv({ size: 'lg' }) // 'px-4 py-2 rounded h-12'\r\n */\r\nexport function cv(config: VueComponentConfig) {\r\n return (props: Props = {}) => {\r\n const { base = \"\", variants = {}, compoundVariants = [], defaultVariants = {} } = config\r\n const merged = { ...defaultVariants, ...props }\r\n const variantClasses = resolveVariants(variants, merged, defaultVariants)\r\n const compoundClasses = resolveCompound(compoundVariants, merged)\r\n return twMerge(base, variantClasses, compoundClasses, toClassName(props.class))\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Extend — tambahkan class ke komponen yang sudah ada\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Extend komponen Vue yang sudah ada dengan class tambahan.\r\n *\r\n * @example\r\n * const PrimaryButton = extend(Button, 'bg-blue-500 text-white')\r\n */\r\nexport function extend(\r\n component: Component,\r\n extraClasses: string\r\n): DefineComponent<Record<string, unknown>> {\r\n return defineComponent({\r\n name: `Extended${(\"name\" in component ? component.name : undefined) ?? \"Component\"}`,\r\n inheritAttrs: false,\r\n props: { class: { type: null, default: undefined } },\r\n setup(props, { attrs, slots }) {\r\n return () =>\r\n h(\r\n component,\r\n {\r\n ...attrs,\r\n class: twMerge(extraClasses, props.class as string, attrs.class as string),\r\n },\r\n slots.default?.()\r\n )\r\n },\r\n })\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Plugin Vue\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Vue plugin — daftarkan `tw` sebagai global composable.\r\n *\r\n * @example\r\n * // main.ts\r\n * import { createApp } from 'vue'\r\n * import { TailwindStyledPlugin } from '@tailwind-styled/vue'\r\n * import App from './App.vue'\r\n *\r\n * createApp(App).use(TailwindStyledPlugin).mount('#app')\r\n */\r\nexport const TailwindStyledPlugin = {\r\n install(app: App) {\r\n app.config.globalProperties.$tw = tw\r\n app.config.globalProperties.$cv = cv\r\n app.provide(\"tw\", tw)\r\n app.provide(\"cv\", cv)\r\n },\r\n}\r\n"]}
@@ -1,13 +1,33 @@
1
1
  'use strict';
2
2
 
3
3
  var module$1 = require('module');
4
+ var fs = require('fs');
4
5
  var path = require('path');
6
+ require('crypto');
7
+ var url = require('url');
5
8
  var zod = require('zod');
6
9
 
7
10
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
9
28
 
10
- var path__default = /*#__PURE__*/_interopDefault(path);
29
+ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
30
+ var path__namespace = /*#__PURE__*/_interopNamespace(path);
11
31
 
12
32
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
13
33
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -20,45 +40,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
20
40
  var __esm = (fn, res) => function __init() {
21
41
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
22
42
  };
23
-
24
- // packages/domain/shared/src/native-resolution.ts
25
- function getNodeModuleRef() {
26
- if (isBrowser) return null;
27
- if (nodeModuleRef !== null) return nodeModuleRef;
28
- try {
29
- const test = typeof __require === "function" ? __require("module") : null;
30
- nodeModuleRef = test;
31
- return test;
32
- } catch {
33
- nodeModuleRef = null;
34
- return null;
35
- }
36
- }
37
- function getNodeFs() {
38
- if (isBrowser) return { existsSync: () => false };
39
- const nodeRequire = getNodeModuleRef();
40
- if (!nodeRequire) return { existsSync: () => false };
41
- if (!_nodeFs) _nodeFs = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)))("node:fs");
42
- return _nodeFs;
43
- }
44
- function getNodePath() {
45
- if (isBrowser) return { resolve: () => "", dirname: "" };
46
- const nodeRequire = getNodeModuleRef();
47
- if (!nodeRequire) return { resolve: () => "", dirname: "" };
48
- if (!_nodePath) _nodePath = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)))("node:path");
49
- return _nodePath;
50
- }
51
- function getRequire(_importMetaUrl) {
52
- if (isBrowser) return () => {
53
- throw new Error("node:module not available");
54
- };
55
- const nodeRequire = getNodeModuleRef();
56
- if (!nodeRequire) return () => {
57
- throw new Error("require not available");
58
- };
59
- if (!_require) _require = nodeRequire.createRequire(_importMetaUrl);
60
- return _require;
61
- }
62
43
  function platformKey() {
63
44
  if (isBrowser) return "browser";
64
45
  return `${process.platform}-${process.arch}`;
@@ -69,24 +50,21 @@ function resolveNativeBinary(runtimeDir) {
69
50
  if (isBrowser) {
70
51
  return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
71
52
  }
72
- const fs = getNodeFs();
73
- const path2 = getNodePath();
74
- const _req = getRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
53
+ if (process.env.TWS_DISABLE_NATIVE === "1") {
54
+ return { path: null, source: "not-found", platform, tried: [] };
55
+ }
75
56
  const envPath = process.env.TW_NATIVE_PATH?.trim();
76
57
  if (envPath) {
77
- if (fs.existsSync(envPath)) {
58
+ if (fs__namespace.existsSync(envPath)) {
78
59
  return { path: envPath, source: "env", platform, tried };
79
60
  }
80
61
  tried.push(`env:${envPath} (not found)`);
81
62
  }
82
- if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
83
- return { path: null, source: "not-found", platform, tried: ["disabled by env"] };
84
- }
85
63
  const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
86
64
  for (const pkg of prebuiltPkgs) {
87
65
  try {
88
- const candidate = _req.resolve(`${pkg}/tailwind_styled_parser.node`);
89
- if (fs.existsSync(candidate)) {
66
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
67
+ if (fs__namespace.existsSync(candidate)) {
90
68
  return { path: candidate, source: "prebuilt", platform, tried };
91
69
  }
92
70
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -96,30 +74,43 @@ function resolveNativeBinary(runtimeDir) {
96
74
  }
97
75
  const cwd = process.cwd();
98
76
  const base = runtimeDir ?? cwd;
99
- const localCandidates = [
100
- path2.resolve(base, "tailwind_styled_parser.node"),
101
- path2.resolve(base, "..", "tailwind_styled_parser.node"),
102
- path2.resolve(cwd, "native", "tailwind_styled_parser.node"),
103
- path2.resolve(cwd, "native", "target", "release", "tailwind_styled_parser.node"),
104
- // napi-rs conventional output
105
- path2.resolve(base, `tailwind_styled_parser.${platform}.node`)
106
- ];
77
+ const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
78
+ const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
79
+ const localCandidates = [];
80
+ for (const bin of BINARY_NAMES) {
81
+ localCandidates.push(path__namespace.resolve(base, `${bin}.node`));
82
+ localCandidates.push(path__namespace.resolve(base, "..", `${bin}.node`));
83
+ localCandidates.push(path__namespace.resolve(base, `${bin}.${platform}.node`));
84
+ localCandidates.push(path__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
85
+ }
86
+ for (const startDir of [cwd, base]) {
87
+ let dir = startDir;
88
+ for (let i = 0; i < 6; i++) {
89
+ const nativeDir = path__namespace.resolve(dir, "native");
90
+ for (const bin of BINARY_NAMES) {
91
+ localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.node`));
92
+ localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
93
+ localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
94
+ localCandidates.push(path__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
95
+ }
96
+ const parent = path__namespace.resolve(dir, "..");
97
+ if (parent === dir) break;
98
+ dir = parent;
99
+ }
100
+ }
107
101
  for (const candidate of localCandidates) {
108
102
  tried.push(`local:${candidate}`);
109
- if (fs.existsSync(candidate)) {
103
+ if (fs__namespace.existsSync(candidate)) {
110
104
  return { path: candidate, source: "local", platform, tried };
111
105
  }
112
106
  }
113
107
  return { path: null, source: "not-found", platform, tried };
114
108
  }
115
- var isBrowser, nodeModuleRef, _nodeFs, _nodePath, _require, PLATFORM_MAP;
109
+ var isBrowser, _require, PLATFORM_MAP;
116
110
  var init_native_resolution = __esm({
117
111
  "packages/domain/shared/src/native-resolution.ts"() {
118
112
  isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
119
- nodeModuleRef = null;
120
- _nodeFs = null;
121
- _nodePath = null;
122
- _require = null;
113
+ _require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
123
114
  PLATFORM_MAP = {
124
115
  "linux-x64": ["@tailwind-styled/native-linux-x64"],
125
116
  "linux-arm64": ["@tailwind-styled/native-linux-arm64"],
@@ -130,59 +121,26 @@ var init_native_resolution = __esm({
130
121
  };
131
122
  }
132
123
  });
133
-
134
- // packages/domain/shared/src/index.ts
135
- function getNodeModuleRef2() {
136
- if (isBrowser2) return null;
137
- if (nodeModuleRef2 !== null) return nodeModuleRef2;
138
- try {
139
- const test = typeof __require === "function" ? __require("module") : null;
140
- nodeModuleRef2 = test;
141
- return test;
142
- } catch {
143
- nodeModuleRef2 = null;
144
- return null;
145
- }
146
- }
147
- function getNodeUrl() {
148
- if (isBrowser2) throw new Error("node:url not available in browser");
149
- const nodeRequire = getNodeModuleRef2();
150
- if (!nodeRequire) throw new Error("require not available");
151
- if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)))("node:url");
152
- return _nodeUrl;
153
- }
154
- function getRequire2() {
155
- if (isBrowser2) return (() => {
156
- throw new Error("require not available in browser");
157
- });
158
- const nodeRequire = getNodeModuleRef2();
159
- if (!nodeRequire) return (() => {
160
- throw new Error("require not available");
161
- });
162
- return nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
163
- }
164
124
  function resolveRuntimeDir(dir, importMetaUrl) {
165
- if (isBrowser2) return "";
166
125
  try {
167
- return getNodeUrl().fileURLToPath(importMetaUrl);
126
+ return path__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
168
127
  } catch {
169
128
  return process.cwd();
170
129
  }
171
130
  }
172
- var isBrowser2, nodeModuleRef2, _nodeUrl;
173
131
  var init_src = __esm({
174
132
  "packages/domain/shared/src/index.ts"() {
175
133
  init_native_resolution();
176
- isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
177
- nodeModuleRef2 = null;
178
- _nodeUrl = null;
179
- getRequire2();
134
+ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
180
135
  }
181
136
  });
182
- var log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
137
+
138
+ // packages/domain/compiler/src/nativeBridge.ts
139
+ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
183
140
  var init_nativeBridge = __esm({
184
141
  "packages/domain/compiler/src/nativeBridge.ts"() {
185
142
  init_src();
143
+ _loadNative = (path4) => __require(path4);
186
144
  log = (...args) => {
187
145
  if (process.env.DEBUG?.includes("compiler:native")) {
188
146
  console.log("[compiler:native]", ...args);
@@ -209,11 +167,10 @@ var init_nativeBridge = __esm({
209
167
  bridgeLoadAttempted = true;
210
168
  try {
211
169
  const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
212
- const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('webpackLoader.js', document.baseURI).href)));
213
170
  const result = resolveNativeBinary(runtimeDir);
214
171
  if (result.path && result.path.endsWith(".node")) {
215
172
  try {
216
- const binding = require2(result.path);
173
+ const binding = _loadNative(result.path);
217
174
  if (isValidNativeBridge(binding)) {
218
175
  nativeBridge = binding;
219
176
  log("Native bridge loaded successfully from:", result.path);
@@ -274,7 +231,7 @@ var shouldSkipFile = (filepath) => {
274
231
  }
275
232
  return false;
276
233
  };
277
- var registerFileClasses = (filepath, classes) => {
234
+ var registerFileClasses = (_filepath, _classes) => {
278
235
  };
279
236
  var WebpackLoaderOptionsSchema = zod.z.object({
280
237
  mode: zod.z.literal("zero-runtime").optional(),
@@ -286,7 +243,7 @@ var WebpackLoaderOptionsSchema = zod.z.object({
286
243
  verbose: zod.z.boolean().optional(),
287
244
  preserveImports: zod.z.boolean().optional()
288
245
  });
289
- var isNextBuildArtifact = (filepath) => filepath.includes(`${path__default.default.sep}.next${path__default.default.sep}`);
246
+ var isNextBuildArtifact = (filepath) => filepath.includes(`${path__namespace.default.sep}.next${path__namespace.default.sep}`);
290
247
  function webpackLoader(source) {
291
248
  const callback = this.async?.();
292
249
  if (!callback) {
@@ -318,11 +275,15 @@ function webpackLoader(source) {
318
275
  if (typeof output.code !== "string") {
319
276
  throw new TypeError(`[tailwind-styled] Invalid transform output for ${filepath}: code is not a string`);
320
277
  }
278
+ if (!output.changed) {
279
+ callback(null, source);
280
+ return;
281
+ }
321
282
  if (options.verbose && output.changed) {
322
283
  const rsc = output.rsc;
323
284
  const engine = output.engine ?? "js";
324
285
  const env = rsc?.isServer ? "server" : "client";
325
- const name = path__default.default.basename(filepath);
286
+ const name = path__namespace.default.basename(filepath);
326
287
  process.stdout.write(
327
288
  `[tailwind-styled/webpack] ${name} -> ${output.classes.length} classes (${env}) [${engine}]
328
289
  `