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
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../packages/presentation/rspack/src/schemas.ts","../packages/presentation/rspack/src/index.ts"],"names":["isBrowser","nodeModuleRef","getNodeModuleRef","path","formatIssuePath","z","getDirname","fs","rule"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAGvE,IAAI,aAAA,GAAqB,IAAA;AACzB,SAAS,gBAAA,GAAmB;AAC1B,EAAA,IAAI,WAAW,OAAO,IAAA;AACtB,EAAA,IAAI,aAAA,KAAkB,MAAM,OAAO,aAAA;AACnC,EAAA,IAAI;AAEF,IAAA,MAAM,OAAO,OAAO,SAAA,KAAY,UAAA,GAAa,SAAA,CAAQ,QAAa,CAAA,GAAI,IAAA;AACtE,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,IAAI,SAAA,GAAiB,IAAA;AACrB,IAAI,QAAA,GAAgB,IAAA;AAKpB,SAAS,WAAA,GAAc;AACrB,EAAA,IAAI,SAAA,EAAW,MAAM,IAAI,KAAA,CAAM,oCAAoC,CAAA;AACnE,EAAA,MAAM,cAAc,gBAAA,EAAiB;AACrC,EAAA,IAAI,CAAC,WAAA,EAAa,MAAM,IAAI,MAAM,uBAAuB,CAAA;A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AM,oBAAoB,QAAA,CAAS,IAAA;AAAA,MACjC,CAACK,UACC,OAAOA,KAAAA,KAAS,YAAYA,KAAAA,KAAS,IAAA,IAAQA,MAAK,2BAAA,KAAgC;AAAA,KACtF;AAEA,IAAA,IAAI,iBAAA,EAAmB;AAEvB,IAAA,MAAM,IAAA,GAAmB;AAAA,MACvB,2BAAA,EAA6B,IAAA;AAAA,MAC7B,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,YAAA;AAAA,MAC3B,OAAA,EAAS,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,cAAA;AAAA,MAC9B,GAAA,EAAK;AAAA,QACH;AAAA,UACE,MAAA,EAAQ,UAAA;AAAA,UACR,OAAA,EAAS;AAAA,YACP,IAAA,EAAM,cAAA;AAAA,YACN,WAAA,EAAa,IAAA,CAAK,IAAA,CAAK,WAAA,IAAe,KAAA;AAAA,YACtC,eAAA,EAAiB;AAAA;AACnB;AACF;AACF,KACF;AAEA,IAAA,QAAA,CAAS,QAAQ,MAAA,GAAS;AAAA,MACxB,GAAI,QAAA,CAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAAA,MAChC,KAAA,EAAO,CAAC,IAAA,EAAM,GAAG,QAAQ;AAAA,KAC3B;AAAA,EACF;AACF;AAEO,SAAS,0BAAA,CACd,IAAA,GAA4B,EAAC,EACD;AAC5B,EAAA,OAAO,IAAI,2BAA2B,IAAI,CAAA;AAC5C","file":"rspack.js","sourcesContent":["/**\r\n * ESM-safe runtime helpers untuk monorepo.\r\n *\r\n * Menggantikan pola fragile seperti:\r\n * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\r\n * - `__dirname` → gunakan `getDirname(import.meta.url)`\r\n * - `__filename` → gunakan `getFilename(import.meta.url)`\r\n *\r\n * Semua helper ini bekerja di ESM dan CJS.\r\n *\r\n * @module @tailwind-styled/shared/esmHelpers\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// Safe check for require availability - works in both CJS and ESM\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n // Test if require actually works\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeCrypto: any = null\r\nlet _nodeOs: any = null\r\n\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeOs() {\r\n if (isBrowser) throw new Error(\"node:os not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeOs) _nodeOs = nodeRequire.createRequire(import.meta.url)(\"node:os\")\r\n return _nodeOs!\r\n}\r\n\r\n/**\r\n * Buat `require()` function yang relative terhadap sebuah ESM module.\r\n *\r\n * @example\r\n * // Ganti: createRequire(import.meta.url)(\"some-pkg\")\r\n * const req = createEsmRequire(import.meta.url)\r\n * const mod = req(\"some-pkg\")\r\n */\r\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\r\n if (isBrowser) throw new Error(\"require not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n return nodeRequire.createRequire(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Dapat `__dirname` dari `import.meta.url`.\r\n *\r\n * @example\r\n * // Ganti: const __dirname = ...\r\n * const dir = getDirname(import.meta.url)\r\n */\r\nexport function getDirname(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n const nodePath = getNodePath()\r\n const nodeUrl = getNodeUrl()\r\n return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\r\n}\r\n\r\n/**\r\n * Dapat `__filename` dari `import.meta.url`.\r\n */\r\nexport function getFilename(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Resolve path dari root monorepo (bukan CWD).\r\n * Berguna untuk scripts dan tools yang dipanggil dari lokasi berbeda.\r\n *\r\n * @example\r\n * const root = resolveFromRoot(\"packages/domain/shared/src\")\r\n */\r\nexport function resolveFromRoot(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\")\r\n\r\n const nodePath = getNodePath()\r\n const nodeFs = getNodeFs()\r\n \r\n let dir = getDirname(import.meta.url)\r\n for (let i = 0; i < 10; i++) {\r\n const pkgPath = nodePath.join(dir, \"package.json\")\r\n try {\r\n const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\r\n if (pkg.workspaces) {\r\n return nodePath.resolve(dir, ...segments)\r\n }\r\n } catch { /* intentionally silent */ }\r\n dir = nodePath.dirname(dir)\r\n }\r\n return nodePath.resolve(process.cwd(), ...segments)\r\n}\r\n\r\n/**\r\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\r\n * Berguna untuk optional dependencies.\r\n *\r\n * @example\r\n * const oxc = tryRequire(\"oxc-parser\", import.meta.url)\r\n * if (!oxc) console.warn(\"oxc-parser not installed\")\r\n */\r\nexport function tryRequire<T = unknown>(\r\n moduleName: string,\r\n importMetaUrl: string\r\n): T | null {\r\n if (isBrowser) return null\r\n try {\r\n return createEsmRequire(importMetaUrl)(moduleName) as T\r\n } catch { /* intentionally silent — optional dep */ }\r\n return null\r\n}\r\n\r\n/**\r\n * Resolve .node binary path yang cross-platform dan ESM-safe.\r\n * Menggantikan pola `path.resolve(__dirname, \"../native.node\")`.\r\n */\r\nexport function resolveNativeNodePath(\r\n importMetaUrl: string,\r\n ...relativeSegments: string[]\r\n): string {\r\n if (isBrowser) return relativeSegments.join(\"/\")\r\n return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\r\n}\r\n","const isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require detection\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodeCrypto: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeModule: any = null\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\n\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeModule() {\r\n if (isBrowser) throw new Error(\"node:module not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeModule) _nodeModule = nodeRequire\r\n return _nodeModule!\r\n}\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\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 if (isBrowser) {\r\n return { binding: null, loadErrors: [{ path: \"\", message: \"Native bindings not available in browser\" }] }\r\n }\r\n \r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\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\nfunction getRequire(): NodeRequire {\r\n if (isBrowser) return (() => { throw new Error(\"require not available in browser\") }) as unknown as NodeRequire\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) return (() => { throw new Error(\"require not available\") }) as unknown as NodeRequire\r\n return nodeRequire.createRequire(import.meta.url)\r\n}\r\n\r\nconst _require = getRequire()\r\n\r\nfunction requireNativeModule(path: string): unknown {\r\n return _require(path)\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}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n if (isBrowser) return []\r\n \r\n const { runtimeDir, envVarNames = [], includeDefaultCandidates = true, enforceNodeExtensionForEnvPath = false } = options\r\n const candidates: string[] = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n if (enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\")) {\r\n candidates.push(envPath + \".node\")\r\n } else {\r\n candidates.push(envPath)\r\n }\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 const entries = fs.readdirSync(runtimeDir)\r\n for (const entry of entries) {\r\n if (entry.endsWith(\".node\")) {\r\n candidates.push(entry)\r\n }\r\n }\r\n } catch {\r\n // ignore read errors\r\n }\r\n }\r\n\r\n const platform = typeof process !== \"undefined\" ? process.platform : \"\"\r\n const ext = platform === \"win32\" ? \".dll\" : platform === \"darwin\" ? \".dylib\" : \".so\"\r\n const defaultBindingName = `tailwind_styled_parser${ext}`\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(process.cwd(), \"native\", defaultBindingName))\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 (isBrowser) return \"\"\r\n \r\n if (dir) return getNodePath().resolve(dir)\r\n try {\r\n return getNodeUrl().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 if (isBrowser) {\r\n // Simple hash fallback for browser\r\n let hash = 0\r\n for (let i = 0; i < content.length; i++) {\r\n const char = content.charCodeAt(i)\r\n hash = ((hash << 5) - hash) + char\r\n hash = hash & hash\r\n }\r\n return Math.abs(hash).toString(16).slice(0, length ?? 8)\r\n }\r\n const hash = getNodeCrypto().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","import { z } from \"zod\"\r\nimport { TwError } from \"@tailwind-styled/shared\"\r\n\r\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\r\n path.length > 0\r\n ? path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n : \"<root>\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = formatIssuePath(issue.path)\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n const details = formatIssues(parsed.error)\r\n throw new TwError(\r\n \"validation\",\r\n \"SCHEMA_VALIDATION_FAILED\",\r\n details ? `${label}: ${details}` : label,\r\n parsed.error\r\n )\r\n}\r\n\r\nexport const RspackPluginOptionsSchema = z.object({\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n addDataAttr: z.boolean().optional(),\r\n analyze: z.boolean().optional(),\r\n cssEntry: z.string().optional(),\r\n})\r\n\r\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\r\n\r\nexport const parseRspackPluginOptions = (options: unknown) =>\r\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\r\n","/**\r\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\r\n *\r\n * Usage:\r\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\r\n *\r\n * export default defineConfig({\r\n * plugins: [tailwindStyledRspackPlugin()],\r\n * })\r\n *\r\n * v5:\r\n * - Simplified API\r\n * - Mode always zero-runtime\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseRspackPluginOptions } from \"./schemas\"\r\n\r\nfunction getDirname(): string {\r\n if (typeof __dirname !== \"undefined\") {\r\n return __dirname\r\n }\r\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\r\n return getEsmDirname(import.meta.url)\r\n }\r\n return process.cwd()\r\n}\r\n\r\nfunction resolveLoaderPath(basename: string): string {\r\n const runtimeDir = getDirname()\r\n const preferredExtensions =\r\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\r\n\r\n for (const ext of preferredExtensions) {\r\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\r\n if (fs.existsSync(candidate)) return candidate\r\n }\r\n\r\n return path.resolve(runtimeDir, `${basename}.js`)\r\n}\r\n\r\ninterface RspackRule {\r\n _tailwindStyledRspackMarker?: boolean\r\n test?: RegExp\r\n exclude?: RegExp\r\n use?: Array<{\r\n loader: string\r\n options: {\r\n mode: \"zero-runtime\"\r\n addDataAttr: boolean\r\n preserveImports: boolean\r\n }\r\n }>\r\n}\r\n\r\ninterface RspackCompiler {\r\n options: {\r\n mode?: string\r\n module?: {\r\n rules?: RspackRule[]\r\n }\r\n }\r\n}\r\n\r\nexport interface RspackPluginOptions {\r\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\r\n include?: RegExp\r\n /** File patterns to exclude. Default: /node_modules/ */\r\n exclude?: RegExp\r\n /** Add data-tw debug attributes in dev. Default: true in dev */\r\n addDataAttr?: boolean\r\n /** Enable analyzer. Default: false */\r\n analyze?: boolean\r\n}\r\n\r\nexport class TailwindStyledRspackPlugin {\r\n private opts: RspackPluginOptions\r\n\r\n constructor(opts: RspackPluginOptions = {}) {\r\n this.opts = parseRspackPluginOptions(opts)\r\n }\r\n\r\n apply(compiler: RspackCompiler): void {\r\n const isDev = compiler.options.mode !== \"production\"\r\n const loaderPath = resolveLoaderPath(\"loader\")\r\n const existing = compiler.options.module?.rules ?? []\r\n const alreadyRegistered = existing.some(\r\n (rule) =>\r\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\r\n )\r\n\r\n if (alreadyRegistered) return\r\n\r\n const rule: RspackRule = {\r\n _tailwindStyledRspackMarker: true,\r\n test: this.opts.include ?? /\\.[jt]sx?$/,\r\n exclude: this.opts.exclude ?? /node_modules/,\r\n use: [\r\n {\r\n loader: loaderPath,\r\n options: {\r\n mode: \"zero-runtime\",\r\n addDataAttr: this.opts.addDataAttr ?? isDev,\r\n preserveImports: true,\r\n },\r\n },\r\n ],\r\n }\r\n\r\n compiler.options.module = {\r\n ...(compiler.options.module ?? {}),\r\n rules: [rule, ...existing],\r\n }\r\n }\r\n}\r\n\r\nexport function tailwindStyledRspackPlugin(\r\n opts: RspackPluginOptions = {}\r\n): TailwindStyledRspackPlugin {\r\n return new TailwindStyledRspackPlugin(opts)\r\n}\r\n\r\nexport default tailwindStyledRspackPlugin\r\n\r\nexport {\r\n parseRspackPluginOptions,\r\n type RspackPluginOptionsInput,\r\n RspackPluginOptionsSchema,\r\n} from \"./schemas\"\r\n"]}
1
+ {"version":3,"sources":["../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../packages/presentation/rspack/src/schemas.ts","../packages/presentation/rspack/src/index.ts"],"names":["path","createRequire","formatIssuePath","z","getDirname","fs","rule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAGvE,IAAI,aAAA,GAAqB,IAAA;AACzB,SAAS,gBAAA,GAAmB;AAC1B,EAAA,IAAI,WAAW,OAAO,IAAA;AACtB,EAAA,IAAI,aAAA,KAAkB,MAAM,OAAO,aAAA;AACnC,EAAA,IAAI;AAEF,IAAA,MAAM,OAAO,OAAO,SAAA,KAAY,UAAA,GAAa,SAAA,CAAQ,QAAa,CAAA,GAAI,IAAA;AACtE,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,IAAI,SAAA,GAAiB,IAAA;AACrB,IAAI,QAAA,GAAgB,IAAA;AAKpB,SAAS,WAAA,GAAc;AACrB,EAAA,IAAI,SAAA,EAAW,MAAM,IAAI,KAAA,CAAM,oCAAoC,CAAA;AACnE,EAAA,MA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,CAAC,IAAA,EAAM,GAAG,QAAQ;AAAA,KAC3B;AAAA,EACF;AACF;AAEO,SAAS,0BAAA,CACd,IAAA,GAA4B,EAAC,EACD;AAC5B,EAAA,OAAO,IAAI,2BAA2B,IAAI,CAAA;AAC5C","file":"rspack.js","sourcesContent":["/**\r\n * ESM-safe runtime helpers untuk monorepo.\r\n *\r\n * Menggantikan pola fragile seperti:\r\n * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\r\n * - `__dirname` → gunakan `getDirname(import.meta.url)`\r\n * - `__filename` → gunakan `getFilename(import.meta.url)`\r\n *\r\n * Semua helper ini bekerja di ESM dan CJS.\r\n *\r\n * @module @tailwind-styled/shared/esmHelpers\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// Safe check for require availability - works in both CJS and ESM\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n // Test if require actually works\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeCrypto: any = null\r\nlet _nodeOs: any = null\r\n\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeOs() {\r\n if (isBrowser) throw new Error(\"node:os not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeOs) _nodeOs = nodeRequire.createRequire(import.meta.url)(\"node:os\")\r\n return _nodeOs!\r\n}\r\n\r\n/**\r\n * Buat `require()` function yang relative terhadap sebuah ESM module.\r\n *\r\n * @example\r\n * // Ganti: createRequire(import.meta.url)(\"some-pkg\")\r\n * const req = createEsmRequire(import.meta.url)\r\n * const mod = req(\"some-pkg\")\r\n */\r\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\r\n if (isBrowser) throw new Error(\"require not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n return nodeRequire.createRequire(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Dapat `__dirname` dari `import.meta.url`.\r\n *\r\n * @example\r\n * // Ganti: const __dirname = ...\r\n * const dir = getDirname(import.meta.url)\r\n */\r\nexport function getDirname(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n const nodePath = getNodePath()\r\n const nodeUrl = getNodeUrl()\r\n return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\r\n}\r\n\r\n/**\r\n * Dapat `__filename` dari `import.meta.url`.\r\n */\r\nexport function getFilename(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Resolve path dari root monorepo (bukan CWD).\r\n * Berguna untuk scripts dan tools yang dipanggil dari lokasi berbeda.\r\n *\r\n * @example\r\n * const root = resolveFromRoot(\"packages/domain/shared/src\")\r\n */\r\nexport function resolveFromRoot(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\")\r\n\r\n const nodePath = getNodePath()\r\n const nodeFs = getNodeFs()\r\n \r\n let dir = getDirname(import.meta.url)\r\n for (let i = 0; i < 10; i++) {\r\n const pkgPath = nodePath.join(dir, \"package.json\")\r\n try {\r\n const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\r\n if (pkg.workspaces) {\r\n return nodePath.resolve(dir, ...segments)\r\n }\r\n } catch { /* intentionally silent */ }\r\n dir = nodePath.dirname(dir)\r\n }\r\n return nodePath.resolve(process.cwd(), ...segments)\r\n}\r\n\r\n/**\r\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\r\n * Berguna untuk optional dependencies.\r\n *\r\n * @example\r\n * const oxc = tryRequire(\"oxc-parser\", import.meta.url)\r\n * if (!oxc) console.warn(\"oxc-parser not installed\")\r\n */\r\nexport function tryRequire<T = unknown>(\r\n moduleName: string,\r\n importMetaUrl: string\r\n): T | null {\r\n if (isBrowser) return null\r\n try {\r\n return createEsmRequire(importMetaUrl)(moduleName) as T\r\n } catch { /* intentionally silent — optional dep */ }\r\n return null\r\n}\r\n\r\n/**\r\n * Resolve .node binary path yang cross-platform dan ESM-safe.\r\n * Menggantikan pola `path.resolve(__dirname, \"../native.node\")`.\r\n */\r\nexport function resolveNativeNodePath(\r\n importMetaUrl: string,\r\n ...relativeSegments: string[]\r\n): string {\r\n if (isBrowser) return relativeSegments.join(\"/\")\r\n return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\r\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\"","import { z } from \"zod\"\r\nimport { TwError } from \"@tailwind-styled/shared\"\r\n\r\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\r\n path.length > 0\r\n ? path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n : \"<root>\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = formatIssuePath(issue.path)\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n const details = formatIssues(parsed.error)\r\n throw new TwError(\r\n \"validation\",\r\n \"SCHEMA_VALIDATION_FAILED\",\r\n details ? `${label}: ${details}` : label,\r\n parsed.error\r\n )\r\n}\r\n\r\nexport const RspackPluginOptionsSchema = z.object({\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n addDataAttr: z.boolean().optional(),\r\n analyze: z.boolean().optional(),\r\n cssEntry: z.string().optional(),\r\n})\r\n\r\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\r\n\r\nexport const parseRspackPluginOptions = (options: unknown) =>\r\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\r\n","/**\r\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\r\n *\r\n * Usage:\r\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\r\n *\r\n * export default defineConfig({\r\n * plugins: [tailwindStyledRspackPlugin()],\r\n * })\r\n *\r\n * v5:\r\n * - Simplified API\r\n * - Mode always zero-runtime\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseRspackPluginOptions } from \"./schemas\"\r\n\r\nfunction getDirname(): string {\r\n if (typeof __dirname !== \"undefined\") {\r\n return __dirname\r\n }\r\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\r\n return getEsmDirname(import.meta.url)\r\n }\r\n return process.cwd()\r\n}\r\n\r\nfunction resolveLoaderPath(basename: string): string {\r\n const runtimeDir = getDirname()\r\n const preferredExtensions =\r\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\r\n\r\n for (const ext of preferredExtensions) {\r\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\r\n if (fs.existsSync(candidate)) return candidate\r\n }\r\n\r\n return path.resolve(runtimeDir, `${basename}.js`)\r\n}\r\n\r\ninterface RspackRule {\r\n _tailwindStyledRspackMarker?: boolean\r\n test?: RegExp\r\n exclude?: RegExp\r\n use?: Array<{\r\n loader: string\r\n options: {\r\n mode: \"zero-runtime\"\r\n addDataAttr: boolean\r\n preserveImports: boolean\r\n }\r\n }>\r\n}\r\n\r\ninterface RspackCompiler {\r\n options: {\r\n mode?: string\r\n module?: {\r\n rules?: RspackRule[]\r\n }\r\n }\r\n}\r\n\r\nexport interface RspackPluginOptions {\r\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\r\n include?: RegExp\r\n /** File patterns to exclude. Default: /node_modules/ */\r\n exclude?: RegExp\r\n /** Add data-tw debug attributes in dev. Default: true in dev */\r\n addDataAttr?: boolean\r\n /** Enable analyzer. Default: false */\r\n analyze?: boolean\r\n}\r\n\r\nexport class TailwindStyledRspackPlugin {\r\n private opts: RspackPluginOptions\r\n\r\n constructor(opts: RspackPluginOptions = {}) {\r\n this.opts = parseRspackPluginOptions(opts)\r\n }\r\n\r\n apply(compiler: RspackCompiler): void {\r\n const isDev = compiler.options.mode !== \"production\"\r\n const loaderPath = resolveLoaderPath(\"loader\")\r\n const existing = compiler.options.module?.rules ?? []\r\n const alreadyRegistered = existing.some(\r\n (rule) =>\r\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\r\n )\r\n\r\n if (alreadyRegistered) return\r\n\r\n const rule: RspackRule = {\r\n _tailwindStyledRspackMarker: true,\r\n test: this.opts.include ?? /\\.[jt]sx?$/,\r\n exclude: this.opts.exclude ?? /node_modules/,\r\n use: [\r\n {\r\n loader: loaderPath,\r\n options: {\r\n mode: \"zero-runtime\",\r\n addDataAttr: this.opts.addDataAttr ?? isDev,\r\n preserveImports: true,\r\n },\r\n },\r\n ],\r\n }\r\n\r\n compiler.options.module = {\r\n ...(compiler.options.module ?? {}),\r\n rules: [rule, ...existing],\r\n }\r\n }\r\n}\r\n\r\nexport function tailwindStyledRspackPlugin(\r\n opts: RspackPluginOptions = {}\r\n): TailwindStyledRspackPlugin {\r\n return new TailwindStyledRspackPlugin(opts)\r\n}\r\n\r\nexport default tailwindStyledRspackPlugin\r\n\r\nexport {\r\n parseRspackPluginOptions,\r\n type RspackPluginOptionsInput,\r\n RspackPluginOptionsSchema,\r\n} from \"./schemas\"\r\n"]}
package/dist/rspack.mjs CHANGED
@@ -1,5 +1,8 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import fs2 from 'fs';
2
+ import path2 from 'path';
3
+ import 'crypto';
4
+ import 'url';
5
+ import { createRequire } from 'module';
3
6
  import { z } from 'zod';
4
7
 
5
8
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
@@ -49,23 +52,9 @@ function getDirname(importMetaUrl) {
49
52
  }
50
53
 
51
54
  // packages/domain/shared/src/index.ts
52
- var isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
53
- var nodeModuleRef2 = null;
54
- function getNodeModuleRef2() {
55
- if (isBrowser2) return null;
56
- if (nodeModuleRef2 !== null) return nodeModuleRef2;
57
- try {
58
- const test = typeof __require === "function" ? __require("module") : null;
59
- nodeModuleRef2 = test;
60
- return test;
61
- } catch {
62
- nodeModuleRef2 = null;
63
- return null;
64
- }
65
- }
66
- function formatIssuePath(path2) {
67
- if (!path2 || path2.length === 0) return "(root)";
68
- return path2.map(
55
+ function formatIssuePath(path3) {
56
+ if (!path3 || path3.length === 0) return "(root)";
57
+ return path3.map(
69
58
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
70
59
  ).join(".");
71
60
  }
@@ -102,8 +91,8 @@ var TwError = class _TwError extends Error {
102
91
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
103
92
  static fromZod(err) {
104
93
  const first = err.issues?.[0] ?? err.errors?.[0];
105
- const path2 = formatIssuePath(first?.path);
106
- const message = first ? `${path2}: ${first.message}` : "Schema validation failed";
94
+ const path3 = formatIssuePath(first?.path);
95
+ const message = first ? `${path3}: ${first.message}` : "Schema validation failed";
107
96
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
108
97
  }
109
98
  static wrap(source, code, err) {
@@ -121,18 +110,8 @@ var TwError = class _TwError extends Error {
121
110
  return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
122
111
  }
123
112
  };
124
- function getRequire() {
125
- if (isBrowser2) return (() => {
126
- throw new Error("require not available in browser");
127
- });
128
- const nodeRequire = getNodeModuleRef2();
129
- if (!nodeRequire) return (() => {
130
- throw new Error("require not available");
131
- });
132
- return nodeRequire.createRequire(import.meta.url);
133
- }
134
- getRequire();
135
- var formatIssuePath2 = (path2) => path2.length > 0 ? path2.map(
113
+ createRequire(import.meta.url);
114
+ var formatIssuePath2 = (path3) => path3.length > 0 ? path3.map(
136
115
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
137
116
  ).join(".") : "<root>";
138
117
  var formatIssues = (error) => error.issues.map((issue) => {
@@ -173,10 +152,10 @@ function resolveLoaderPath(basename) {
173
152
  const runtimeDir = getDirname2();
174
153
  const preferredExtensions = typeof __dirname !== "undefined" && __dirname.length > 0 ? [".cjs", ".js"] : [".js", ".cjs"];
175
154
  for (const ext of preferredExtensions) {
176
- const candidate = path.resolve(runtimeDir, `${basename}${ext}`);
177
- if (fs.existsSync(candidate)) return candidate;
155
+ const candidate = path2.resolve(runtimeDir, `${basename}${ext}`);
156
+ if (fs2.existsSync(candidate)) return candidate;
178
157
  }
179
- return path.resolve(runtimeDir, `${basename}.js`);
158
+ return path2.resolve(runtimeDir, `${basename}.js`);
180
159
  }
181
160
  var TailwindStyledRspackPlugin = class {
182
161
  opts;
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../packages/presentation/rspack/src/schemas.ts","../packages/presentation/rspack/src/index.ts"],"names":["isBrowser","nodeModuleRef","getNodeModuleRef","path","formatIssuePath","getDirname","rule"],"mappings":";;;;;;;;;;;;;AAaA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAGvE,IAAI,aAAA,GAAqB,IAAA;AACzB,SAAS,gBAAA,GAAmB;AAC1B,EAAA,IAAI,WAAW,OAAO,IAAA;AACtB,EAAA,IAAI,aAAA,KAAkB,MAAM,OAAO,aAAA;AACnC,EAAA,IAAI;AAEF,IAAA,MAAM,OAAO,OAAO,SAAA,KAAY,UAAA,GAAa,SAAA,CAAQ,QAAa,CAAA,GAAI,IAAA;AACtE,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,IAAI,SAAA,GAAiB,IAAA;AACrB,IAAI,QAAA,GAAgB,IAAA;AAKpB,SAAS,WAAA,GAAc;AACrB,EAAA,IA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fragile seperti:\r\n * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\r\n * - `__dirname` → gunakan `getDirname(import.meta.url)`\r\n * - `__filename` → gunakan `getFilename(import.meta.url)`\r\n *\r\n * Semua helper ini bekerja di ESM dan CJS.\r\n *\r\n * @module @tailwind-styled/shared/esmHelpers\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// Safe check for require availability - works in both CJS and ESM\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n // Test if require actually works\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeCrypto: any = null\r\nlet _nodeOs: any = null\r\n\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeOs() {\r\n if (isBrowser) throw new Error(\"node:os not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeOs) _nodeOs = nodeRequire.createRequire(import.meta.url)(\"node:os\")\r\n return _nodeOs!\r\n}\r\n\r\n/**\r\n * Buat `require()` function yang relative terhadap sebuah ESM module.\r\n *\r\n * @example\r\n * // Ganti: createRequire(import.meta.url)(\"some-pkg\")\r\n * const req = createEsmRequire(import.meta.url)\r\n * const mod = req(\"some-pkg\")\r\n */\r\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\r\n if (isBrowser) throw new Error(\"require not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n return nodeRequire.createRequire(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Dapat `__dirname` dari `import.meta.url`.\r\n *\r\n * @example\r\n * // Ganti: const __dirname = ...\r\n * const dir = getDirname(import.meta.url)\r\n */\r\nexport function getDirname(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n const nodePath = getNodePath()\r\n const nodeUrl = getNodeUrl()\r\n return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\r\n}\r\n\r\n/**\r\n * Dapat `__filename` dari `import.meta.url`.\r\n */\r\nexport function getFilename(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Resolve path dari root monorepo (bukan CWD).\r\n * Berguna untuk scripts dan tools yang dipanggil dari lokasi berbeda.\r\n *\r\n * @example\r\n * const root = resolveFromRoot(\"packages/domain/shared/src\")\r\n */\r\nexport function resolveFromRoot(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\")\r\n\r\n const nodePath = getNodePath()\r\n const nodeFs = getNodeFs()\r\n \r\n let dir = getDirname(import.meta.url)\r\n for (let i = 0; i < 10; i++) {\r\n const pkgPath = nodePath.join(dir, \"package.json\")\r\n try {\r\n const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\r\n if (pkg.workspaces) {\r\n return nodePath.resolve(dir, ...segments)\r\n }\r\n } catch { /* intentionally silent */ }\r\n dir = nodePath.dirname(dir)\r\n }\r\n return nodePath.resolve(process.cwd(), ...segments)\r\n}\r\n\r\n/**\r\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\r\n * Berguna untuk optional dependencies.\r\n *\r\n * @example\r\n * const oxc = tryRequire(\"oxc-parser\", import.meta.url)\r\n * if (!oxc) console.warn(\"oxc-parser not installed\")\r\n */\r\nexport function tryRequire<T = unknown>(\r\n moduleName: string,\r\n importMetaUrl: string\r\n): T | null {\r\n if (isBrowser) return null\r\n try {\r\n return createEsmRequire(importMetaUrl)(moduleName) as T\r\n } catch { /* intentionally silent — optional dep */ }\r\n return null\r\n}\r\n\r\n/**\r\n * Resolve .node binary path yang cross-platform dan ESM-safe.\r\n * Menggantikan pola `path.resolve(__dirname, \"../native.node\")`.\r\n */\r\nexport function resolveNativeNodePath(\r\n importMetaUrl: string,\r\n ...relativeSegments: string[]\r\n): string {\r\n if (isBrowser) return relativeSegments.join(\"/\")\r\n return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\r\n}\r\n","const isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require detection\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodeCrypto: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeModule: any = null\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\n\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeModule() {\r\n if (isBrowser) throw new Error(\"node:module not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeModule) _nodeModule = nodeRequire\r\n return _nodeModule!\r\n}\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\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 if (isBrowser) {\r\n return { binding: null, loadErrors: [{ path: \"\", message: \"Native bindings not available in browser\" }] }\r\n }\r\n \r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\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\nfunction getRequire(): NodeRequire {\r\n if (isBrowser) return (() => { throw new Error(\"require not available in browser\") }) as unknown as NodeRequire\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) return (() => { throw new Error(\"require not available\") }) as unknown as NodeRequire\r\n return nodeRequire.createRequire(import.meta.url)\r\n}\r\n\r\nconst _require = getRequire()\r\n\r\nfunction requireNativeModule(path: string): unknown {\r\n return _require(path)\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}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n if (isBrowser) return []\r\n \r\n const { runtimeDir, envVarNames = [], includeDefaultCandidates = true, enforceNodeExtensionForEnvPath = false } = options\r\n const candidates: string[] = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n if (enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\")) {\r\n candidates.push(envPath + \".node\")\r\n } else {\r\n candidates.push(envPath)\r\n }\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 const entries = fs.readdirSync(runtimeDir)\r\n for (const entry of entries) {\r\n if (entry.endsWith(\".node\")) {\r\n candidates.push(entry)\r\n }\r\n }\r\n } catch {\r\n // ignore read errors\r\n }\r\n }\r\n\r\n const platform = typeof process !== \"undefined\" ? process.platform : \"\"\r\n const ext = platform === \"win32\" ? \".dll\" : platform === \"darwin\" ? \".dylib\" : \".so\"\r\n const defaultBindingName = `tailwind_styled_parser${ext}`\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(process.cwd(), \"native\", defaultBindingName))\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 (isBrowser) return \"\"\r\n \r\n if (dir) return getNodePath().resolve(dir)\r\n try {\r\n return getNodeUrl().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 if (isBrowser) {\r\n // Simple hash fallback for browser\r\n let hash = 0\r\n for (let i = 0; i < content.length; i++) {\r\n const char = content.charCodeAt(i)\r\n hash = ((hash << 5) - hash) + char\r\n hash = hash & hash\r\n }\r\n return Math.abs(hash).toString(16).slice(0, length ?? 8)\r\n }\r\n const hash = getNodeCrypto().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","import { z } from \"zod\"\r\nimport { TwError } from \"@tailwind-styled/shared\"\r\n\r\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\r\n path.length > 0\r\n ? path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n : \"<root>\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = formatIssuePath(issue.path)\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n const details = formatIssues(parsed.error)\r\n throw new TwError(\r\n \"validation\",\r\n \"SCHEMA_VALIDATION_FAILED\",\r\n details ? `${label}: ${details}` : label,\r\n parsed.error\r\n )\r\n}\r\n\r\nexport const RspackPluginOptionsSchema = z.object({\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n addDataAttr: z.boolean().optional(),\r\n analyze: z.boolean().optional(),\r\n cssEntry: z.string().optional(),\r\n})\r\n\r\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\r\n\r\nexport const parseRspackPluginOptions = (options: unknown) =>\r\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\r\n","/**\r\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\r\n *\r\n * Usage:\r\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\r\n *\r\n * export default defineConfig({\r\n * plugins: [tailwindStyledRspackPlugin()],\r\n * })\r\n *\r\n * v5:\r\n * - Simplified API\r\n * - Mode always zero-runtime\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseRspackPluginOptions } from \"./schemas\"\r\n\r\nfunction getDirname(): string {\r\n if (typeof __dirname !== \"undefined\") {\r\n return __dirname\r\n }\r\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\r\n return getEsmDirname(import.meta.url)\r\n }\r\n return process.cwd()\r\n}\r\n\r\nfunction resolveLoaderPath(basename: string): string {\r\n const runtimeDir = getDirname()\r\n const preferredExtensions =\r\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\r\n\r\n for (const ext of preferredExtensions) {\r\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\r\n if (fs.existsSync(candidate)) return candidate\r\n }\r\n\r\n return path.resolve(runtimeDir, `${basename}.js`)\r\n}\r\n\r\ninterface RspackRule {\r\n _tailwindStyledRspackMarker?: boolean\r\n test?: RegExp\r\n exclude?: RegExp\r\n use?: Array<{\r\n loader: string\r\n options: {\r\n mode: \"zero-runtime\"\r\n addDataAttr: boolean\r\n preserveImports: boolean\r\n }\r\n }>\r\n}\r\n\r\ninterface RspackCompiler {\r\n options: {\r\n mode?: string\r\n module?: {\r\n rules?: RspackRule[]\r\n }\r\n }\r\n}\r\n\r\nexport interface RspackPluginOptions {\r\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\r\n include?: RegExp\r\n /** File patterns to exclude. Default: /node_modules/ */\r\n exclude?: RegExp\r\n /** Add data-tw debug attributes in dev. Default: true in dev */\r\n addDataAttr?: boolean\r\n /** Enable analyzer. Default: false */\r\n analyze?: boolean\r\n}\r\n\r\nexport class TailwindStyledRspackPlugin {\r\n private opts: RspackPluginOptions\r\n\r\n constructor(opts: RspackPluginOptions = {}) {\r\n this.opts = parseRspackPluginOptions(opts)\r\n }\r\n\r\n apply(compiler: RspackCompiler): void {\r\n const isDev = compiler.options.mode !== \"production\"\r\n const loaderPath = resolveLoaderPath(\"loader\")\r\n const existing = compiler.options.module?.rules ?? []\r\n const alreadyRegistered = existing.some(\r\n (rule) =>\r\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\r\n )\r\n\r\n if (alreadyRegistered) return\r\n\r\n const rule: RspackRule = {\r\n _tailwindStyledRspackMarker: true,\r\n test: this.opts.include ?? /\\.[jt]sx?$/,\r\n exclude: this.opts.exclude ?? /node_modules/,\r\n use: [\r\n {\r\n loader: loaderPath,\r\n options: {\r\n mode: \"zero-runtime\",\r\n addDataAttr: this.opts.addDataAttr ?? isDev,\r\n preserveImports: true,\r\n },\r\n },\r\n ],\r\n }\r\n\r\n compiler.options.module = {\r\n ...(compiler.options.module ?? {}),\r\n rules: [rule, ...existing],\r\n }\r\n }\r\n}\r\n\r\nexport function tailwindStyledRspackPlugin(\r\n opts: RspackPluginOptions = {}\r\n): TailwindStyledRspackPlugin {\r\n return new TailwindStyledRspackPlugin(opts)\r\n}\r\n\r\nexport default tailwindStyledRspackPlugin\r\n\r\nexport {\r\n parseRspackPluginOptions,\r\n type RspackPluginOptionsInput,\r\n RspackPluginOptionsSchema,\r\n} from \"./schemas\"\r\n"]}
1
+ {"version":3,"sources":["../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../packages/presentation/rspack/src/schemas.ts","../packages/presentation/rspack/src/index.ts"],"names":["path","formatIssuePath","getDirname","fs","rule"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAGvE,IAAI,aAAA,GAAqB,IAAA;AACzB,SAAS,gBAAA,GAAmB;AAC1B,EAAA,IAAI,WAAW,OAAO,IAAA;AACtB,EAAA,IAAI,aAAA,KAAkB,MAAM,OAAO,aAAA;AACnC,EAAA,IAAI;AAEF,IAAA,MAAM,OAAO,OAAO,SAAA,KAAY,UAAA,GAAa,SAAA,CAAQ,QAAa,CAAA,GAAI,IAAA;AACtE,IAAA,aAAA,GAAgB,IAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ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K;AAAA,QACH;AAAA,UACE,MAAA,EAAQ,UAAA;AAAA,UACR,OAAA,EAAS;AAAA,YACP,IAAA,EAAM,cAAA;AAAA,YACN,WAAA,EAAa,IAAA,CAAK,IAAA,CAAK,WAAA,IAAe,KAAA;AAAA,YACtC,eAAA,EAAiB;AAAA;AACnB;AACF;AACF,KACF;AAEA,IAAA,QAAA,CAAS,QAAQ,MAAA,GAAS;AAAA,MACxB,GAAI,QAAA,CAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAAA,MAChC,KAAA,EAAO,CAAC,IAAA,EAAM,GAAG,QAAQ;AAAA,KAC3B;AAAA,EACF;AACF;AAEO,SAAS,0BAAA,CACd,IAAA,GAA4B,EAAC,EACD;AAC5B,EAAA,OAAO,IAAI,2BAA2B,IAAI,CAAA;AAC5C","file":"rspack.mjs","sourcesContent":["/**\r\n * ESM-safe runtime helpers untuk monorepo.\r\n *\r\n * Menggantikan pola fragile seperti:\r\n * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\r\n * - `__dirname` → gunakan `getDirname(import.meta.url)`\r\n * - `__filename` → gunakan `getFilename(import.meta.url)`\r\n *\r\n * Semua helper ini bekerja di ESM dan CJS.\r\n *\r\n * @module @tailwind-styled/shared/esmHelpers\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// Safe check for require availability - works in both CJS and ESM\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n // Test if require actually works\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeCrypto: any = null\r\nlet _nodeOs: any = null\r\n\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeOs() {\r\n if (isBrowser) throw new Error(\"node:os not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeOs) _nodeOs = nodeRequire.createRequire(import.meta.url)(\"node:os\")\r\n return _nodeOs!\r\n}\r\n\r\n/**\r\n * Buat `require()` function yang relative terhadap sebuah ESM module.\r\n *\r\n * @example\r\n * // Ganti: createRequire(import.meta.url)(\"some-pkg\")\r\n * const req = createEsmRequire(import.meta.url)\r\n * const mod = req(\"some-pkg\")\r\n */\r\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\r\n if (isBrowser) throw new Error(\"require not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n return nodeRequire.createRequire(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Dapat `__dirname` dari `import.meta.url`.\r\n *\r\n * @example\r\n * // Ganti: const __dirname = ...\r\n * const dir = getDirname(import.meta.url)\r\n */\r\nexport function getDirname(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n const nodePath = getNodePath()\r\n const nodeUrl = getNodeUrl()\r\n return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\r\n}\r\n\r\n/**\r\n * Dapat `__filename` dari `import.meta.url`.\r\n */\r\nexport function getFilename(importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n}\r\n\r\n/**\r\n * Resolve path dari root monorepo (bukan CWD).\r\n * Berguna untuk scripts dan tools yang dipanggil dari lokasi berbeda.\r\n *\r\n * @example\r\n * const root = resolveFromRoot(\"packages/domain/shared/src\")\r\n */\r\nexport function resolveFromRoot(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\")\r\n\r\n const nodePath = getNodePath()\r\n const nodeFs = getNodeFs()\r\n \r\n let dir = getDirname(import.meta.url)\r\n for (let i = 0; i < 10; i++) {\r\n const pkgPath = nodePath.join(dir, \"package.json\")\r\n try {\r\n const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\r\n if (pkg.workspaces) {\r\n return nodePath.resolve(dir, ...segments)\r\n }\r\n } catch { /* intentionally silent */ }\r\n dir = nodePath.dirname(dir)\r\n }\r\n return nodePath.resolve(process.cwd(), ...segments)\r\n}\r\n\r\n/**\r\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\r\n * Berguna untuk optional dependencies.\r\n *\r\n * @example\r\n * const oxc = tryRequire(\"oxc-parser\", import.meta.url)\r\n * if (!oxc) console.warn(\"oxc-parser not installed\")\r\n */\r\nexport function tryRequire<T = unknown>(\r\n moduleName: string,\r\n importMetaUrl: string\r\n): T | null {\r\n if (isBrowser) return null\r\n try {\r\n return createEsmRequire(importMetaUrl)(moduleName) as T\r\n } catch { /* intentionally silent — optional dep */ }\r\n return null\r\n}\r\n\r\n/**\r\n * Resolve .node binary path yang cross-platform dan ESM-safe.\r\n * Menggantikan pola `path.resolve(__dirname, \"../native.node\")`.\r\n */\r\nexport function resolveNativeNodePath(\r\n importMetaUrl: string,\r\n ...relativeSegments: string[]\r\n): string {\r\n if (isBrowser) return relativeSegments.join(\"/\")\r\n return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\r\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\"","import { z } from \"zod\"\r\nimport { TwError } from \"@tailwind-styled/shared\"\r\n\r\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\r\n path.length > 0\r\n ? path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n : \"<root>\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = formatIssuePath(issue.path)\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n const details = formatIssues(parsed.error)\r\n throw new TwError(\r\n \"validation\",\r\n \"SCHEMA_VALIDATION_FAILED\",\r\n details ? `${label}: ${details}` : label,\r\n parsed.error\r\n )\r\n}\r\n\r\nexport const RspackPluginOptionsSchema = z.object({\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n addDataAttr: z.boolean().optional(),\r\n analyze: z.boolean().optional(),\r\n cssEntry: z.string().optional(),\r\n})\r\n\r\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\r\n\r\nexport const parseRspackPluginOptions = (options: unknown) =>\r\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\r\n","/**\r\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\r\n *\r\n * Usage:\r\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\r\n *\r\n * export default defineConfig({\r\n * plugins: [tailwindStyledRspackPlugin()],\r\n * })\r\n *\r\n * v5:\r\n * - Simplified API\r\n * - Mode always zero-runtime\r\n */\r\n\r\nimport fs from \"node:fs\"\r\nimport path from \"node:path\"\r\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseRspackPluginOptions } from \"./schemas\"\r\n\r\nfunction getDirname(): string {\r\n if (typeof __dirname !== \"undefined\") {\r\n return __dirname\r\n }\r\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\r\n return getEsmDirname(import.meta.url)\r\n }\r\n return process.cwd()\r\n}\r\n\r\nfunction resolveLoaderPath(basename: string): string {\r\n const runtimeDir = getDirname()\r\n const preferredExtensions =\r\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\r\n\r\n for (const ext of preferredExtensions) {\r\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\r\n if (fs.existsSync(candidate)) return candidate\r\n }\r\n\r\n return path.resolve(runtimeDir, `${basename}.js`)\r\n}\r\n\r\ninterface RspackRule {\r\n _tailwindStyledRspackMarker?: boolean\r\n test?: RegExp\r\n exclude?: RegExp\r\n use?: Array<{\r\n loader: string\r\n options: {\r\n mode: \"zero-runtime\"\r\n addDataAttr: boolean\r\n preserveImports: boolean\r\n }\r\n }>\r\n}\r\n\r\ninterface RspackCompiler {\r\n options: {\r\n mode?: string\r\n module?: {\r\n rules?: RspackRule[]\r\n }\r\n }\r\n}\r\n\r\nexport interface RspackPluginOptions {\r\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\r\n include?: RegExp\r\n /** File patterns to exclude. Default: /node_modules/ */\r\n exclude?: RegExp\r\n /** Add data-tw debug attributes in dev. Default: true in dev */\r\n addDataAttr?: boolean\r\n /** Enable analyzer. Default: false */\r\n analyze?: boolean\r\n}\r\n\r\nexport class TailwindStyledRspackPlugin {\r\n private opts: RspackPluginOptions\r\n\r\n constructor(opts: RspackPluginOptions = {}) {\r\n this.opts = parseRspackPluginOptions(opts)\r\n }\r\n\r\n apply(compiler: RspackCompiler): void {\r\n const isDev = compiler.options.mode !== \"production\"\r\n const loaderPath = resolveLoaderPath(\"loader\")\r\n const existing = compiler.options.module?.rules ?? []\r\n const alreadyRegistered = existing.some(\r\n (rule) =>\r\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\r\n )\r\n\r\n if (alreadyRegistered) return\r\n\r\n const rule: RspackRule = {\r\n _tailwindStyledRspackMarker: true,\r\n test: this.opts.include ?? /\\.[jt]sx?$/,\r\n exclude: this.opts.exclude ?? /node_modules/,\r\n use: [\r\n {\r\n loader: loaderPath,\r\n options: {\r\n mode: \"zero-runtime\",\r\n addDataAttr: this.opts.addDataAttr ?? isDev,\r\n preserveImports: true,\r\n },\r\n },\r\n ],\r\n }\r\n\r\n compiler.options.module = {\r\n ...(compiler.options.module ?? {}),\r\n rules: [rule, ...existing],\r\n }\r\n }\r\n}\r\n\r\nexport function tailwindStyledRspackPlugin(\r\n opts: RspackPluginOptions = {}\r\n): TailwindStyledRspackPlugin {\r\n return new TailwindStyledRspackPlugin(opts)\r\n}\r\n\r\nexport default tailwindStyledRspackPlugin\r\n\r\nexport {\r\n parseRspackPluginOptions,\r\n type RspackPluginOptionsInput,\r\n RspackPluginOptionsSchema,\r\n} from \"./schemas\"\r\n"]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, f as liveTokenEngine, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-CX5_0c4q.mjs';
2
+ export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, f as liveTokenEngine, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-DKoWRtqH.mjs';
3
3
  import { z } from 'zod';
4
- export { T as TokenMap } from './index-eWAocnD2.mjs';
4
+ export { T as TokenMap } from './index-NDINUhLN.mjs';
5
5
 
6
6
  declare const SubComponentDefSchema: z.ZodObject<{
7
7
  tag: z.ZodOptional<z.ZodString>;
package/dist/runtime.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, f as liveTokenEngine, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-DSUk88P6.js';
2
+ export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, f as liveTokenEngine, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-CN9ian1R.js';
3
3
  import { z } from 'zod';
4
- export { T as TokenMap } from './index-eWAocnD2.js';
4
+ export { T as TokenMap } from './index-NDINUhLN.js';
5
5
 
6
6
  declare const SubComponentDefSchema: z.ZodObject<{
7
7
  tag: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,15 @@ import { S as ScanFileResult, a as ScanWorkspaceOptions, b as ScanWorkspaceResul
2
2
  export { p as parseScanWorkspaceOptions, c as parseScanWorkspaceResult, d as parseScannerWorkerMessage } from './schemas-DR-SLxZZ.mjs';
3
3
  import 'zod';
4
4
 
5
+ declare function extractClassesNative(source: string): string[];
6
+ declare function batchExtractClassesNative(filePaths: string[]): Array<{
7
+ file: string;
8
+ classes: string[];
9
+ content_hash: string;
10
+ ok: boolean;
11
+ error?: string | null;
12
+ }>;
13
+
5
14
  declare const DEFAULT_EXTENSIONS: string[];
6
15
  declare const DEFAULT_IGNORES: string[];
7
16
  declare function scanSource(source: string): string[];
@@ -10,4 +19,4 @@ declare function scanFile(filePath: string): ScanFileResult;
10
19
  declare function scanWorkspace(rootDir: string, options?: ScanWorkspaceOptions): ScanWorkspaceResult;
11
20
  declare function scanWorkspaceAsync(rootDir: string, options?: ScanWorkspaceOptions): Promise<ScanWorkspaceResult>;
12
21
 
13
- export { DEFAULT_EXTENSIONS, DEFAULT_IGNORES, ScanFileResult, ScanWorkspaceOptions, ScanWorkspaceResult, isScannableFile, scanFile, scanSource, scanWorkspace, scanWorkspaceAsync };
22
+ export { DEFAULT_EXTENSIONS, DEFAULT_IGNORES, ScanFileResult, ScanWorkspaceOptions, ScanWorkspaceResult, batchExtractClassesNative, extractClassesNative, isScannableFile, scanFile, scanSource, scanWorkspace, scanWorkspaceAsync };
package/dist/scanner.d.ts CHANGED
@@ -2,6 +2,15 @@ import { S as ScanFileResult, a as ScanWorkspaceOptions, b as ScanWorkspaceResul
2
2
  export { p as parseScanWorkspaceOptions, c as parseScanWorkspaceResult, d as parseScannerWorkerMessage } from './schemas-DR-SLxZZ.js';
3
3
  import 'zod';
4
4
 
5
+ declare function extractClassesNative(source: string): string[];
6
+ declare function batchExtractClassesNative(filePaths: string[]): Array<{
7
+ file: string;
8
+ classes: string[];
9
+ content_hash: string;
10
+ ok: boolean;
11
+ error?: string | null;
12
+ }>;
13
+
5
14
  declare const DEFAULT_EXTENSIONS: string[];
6
15
  declare const DEFAULT_IGNORES: string[];
7
16
  declare function scanSource(source: string): string[];
@@ -10,4 +19,4 @@ declare function scanFile(filePath: string): ScanFileResult;
10
19
  declare function scanWorkspace(rootDir: string, options?: ScanWorkspaceOptions): ScanWorkspaceResult;
11
20
  declare function scanWorkspaceAsync(rootDir: string, options?: ScanWorkspaceOptions): Promise<ScanWorkspaceResult>;
12
21
 
13
- export { DEFAULT_EXTENSIONS, DEFAULT_IGNORES, ScanFileResult, ScanWorkspaceOptions, ScanWorkspaceResult, isScannableFile, scanFile, scanSource, scanWorkspace, scanWorkspaceAsync };
22
+ export { DEFAULT_EXTENSIONS, DEFAULT_IGNORES, ScanFileResult, ScanWorkspaceOptions, ScanWorkspaceResult, batchExtractClassesNative, extractClassesNative, isScannableFile, scanFile, scanSource, scanWorkspace, scanWorkspaceAsync };