tailwind-styled-v4 5.0.36 → 5.0.38

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 (163) hide show
  1. package/dist/analyzer.d.mts +152 -5
  2. package/dist/analyzer.d.ts +152 -5
  3. package/dist/analyzer.js +213 -161
  4. package/dist/analyzer.js.map +1 -1
  5. package/dist/analyzer.mjs +118 -82
  6. package/dist/analyzer.mjs.map +1 -1
  7. package/dist/animate.d.mts +30 -3
  8. package/dist/animate.d.ts +30 -3
  9. package/dist/animate.js +131 -87
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +28 -14
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +105 -68
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +40 -13
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +577 -426
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +466 -304
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +5 -0
  22. package/dist/compiler.d.ts +5 -0
  23. package/dist/compiler.js +826 -508
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +287 -29
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/dashboard.js +71 -41
  28. package/dist/dashboard.js.map +1 -1
  29. package/dist/dashboard.mjs +12 -6
  30. package/dist/dashboard.mjs.map +1 -1
  31. package/dist/devtools.d.mts +88 -2
  32. package/dist/devtools.d.ts +88 -2
  33. package/dist/devtools.js +333 -289
  34. package/dist/devtools.js.map +1 -1
  35. package/dist/devtools.mjs +26 -11
  36. package/dist/devtools.mjs.map +1 -1
  37. package/dist/engine.d.mts +557 -6
  38. package/dist/engine.d.ts +557 -6
  39. package/dist/engine.js +679 -502
  40. package/dist/engine.js.map +1 -1
  41. package/dist/engine.mjs +467 -307
  42. package/dist/engine.mjs.map +1 -1
  43. package/dist/index.d.mts +180 -127
  44. package/dist/index.d.ts +180 -127
  45. package/dist/index.js +1329 -7441
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +1266 -7385
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/next.js +318 -243
  50. package/dist/next.js.map +1 -1
  51. package/dist/next.mjs +256 -181
  52. package/dist/next.mjs.map +1 -1
  53. package/dist/plugin-api.d.mts +4 -2
  54. package/dist/plugin-api.d.ts +4 -2
  55. package/dist/plugin-api.js +93 -49
  56. package/dist/plugin-api.js.map +1 -1
  57. package/dist/plugin-api.mjs +26 -6
  58. package/dist/plugin-api.mjs.map +1 -1
  59. package/dist/plugin-registry.js +103 -62
  60. package/dist/plugin-registry.js.map +1 -1
  61. package/dist/plugin-registry.mjs +53 -35
  62. package/dist/plugin-registry.mjs.map +1 -1
  63. package/dist/plugin.d.mts +165 -5
  64. package/dist/plugin.d.ts +165 -5
  65. package/dist/plugin.js +115 -50
  66. package/dist/plugin.js.map +1 -1
  67. package/dist/plugin.mjs +44 -6
  68. package/dist/plugin.mjs.map +1 -1
  69. package/dist/preset.js +47 -15
  70. package/dist/preset.js.map +1 -1
  71. package/dist/preset.mjs +13 -5
  72. package/dist/preset.mjs.map +1 -1
  73. package/dist/rspack.js +82 -50
  74. package/dist/rspack.js.map +1 -1
  75. package/dist/rspack.mjs +20 -12
  76. package/dist/rspack.mjs.map +1 -1
  77. package/dist/runtime-css.js +62 -24
  78. package/dist/runtime-css.js.map +1 -1
  79. package/dist/runtime-css.mjs +15 -7
  80. package/dist/runtime-css.mjs.map +1 -1
  81. package/dist/runtime.d.mts +38 -3
  82. package/dist/runtime.d.ts +38 -3
  83. package/dist/runtime.js +97 -44
  84. package/dist/runtime.js.map +1 -1
  85. package/dist/runtime.mjs +31 -8
  86. package/dist/runtime.mjs.map +1 -1
  87. package/dist/scanner.d.mts +58 -4
  88. package/dist/scanner.d.ts +58 -4
  89. package/dist/scanner.js +163 -120
  90. package/dist/scanner.js.map +1 -1
  91. package/dist/scanner.mjs +67 -39
  92. package/dist/scanner.mjs.map +1 -1
  93. package/dist/shared.d.mts +185 -3
  94. package/dist/shared.d.ts +185 -3
  95. package/dist/shared.js +441 -295
  96. package/dist/shared.js.map +1 -1
  97. package/dist/shared.mjs +253 -122
  98. package/dist/shared.mjs.map +1 -1
  99. package/dist/storybook-addon.d.mts +2 -2
  100. package/dist/storybook-addon.d.ts +2 -2
  101. package/dist/storybook-addon.js +39 -10
  102. package/dist/storybook-addon.js.map +1 -1
  103. package/dist/storybook-addon.mjs +8 -3
  104. package/dist/storybook-addon.mjs.map +1 -1
  105. package/dist/svelte.d.mts +2 -1
  106. package/dist/svelte.d.ts +2 -1
  107. package/dist/svelte.js +88 -64
  108. package/dist/svelte.js.map +1 -1
  109. package/dist/svelte.mjs +28 -13
  110. package/dist/svelte.mjs.map +1 -1
  111. package/dist/syntax.js +68 -37
  112. package/dist/syntax.js.map +1 -1
  113. package/dist/syntax.mjs +8 -7
  114. package/dist/syntax.mjs.map +1 -1
  115. package/dist/testing.js +55 -18
  116. package/dist/testing.js.map +1 -1
  117. package/dist/testing.mjs +16 -3
  118. package/dist/testing.mjs.map +1 -1
  119. package/dist/theme.d.mts +38 -3
  120. package/dist/theme.d.ts +38 -3
  121. package/dist/theme.js +131 -74
  122. package/dist/theme.js.map +1 -1
  123. package/dist/theme.mjs +42 -13
  124. package/dist/theme.mjs.map +1 -1
  125. package/dist/turbopackLoader.js +150 -116
  126. package/dist/turbopackLoader.js.map +1 -1
  127. package/dist/turbopackLoader.mjs +124 -81
  128. package/dist/turbopackLoader.mjs.map +1 -1
  129. package/dist/tw.js +560 -421
  130. package/dist/tw.js.map +1 -1
  131. package/dist/tw.mjs +460 -302
  132. package/dist/tw.mjs.map +1 -1
  133. package/dist/vite.js +561 -446
  134. package/dist/vite.js.map +1 -1
  135. package/dist/vite.mjs +433 -321
  136. package/dist/vite.mjs.map +1 -1
  137. package/dist/vue.d.mts +4 -1
  138. package/dist/vue.d.ts +4 -1
  139. package/dist/vue.js +95 -70
  140. package/dist/vue.js.map +1 -1
  141. package/dist/vue.mjs +30 -14
  142. package/dist/vue.mjs.map +1 -1
  143. package/dist/webpackLoader.js +110 -78
  144. package/dist/webpackLoader.js.map +1 -1
  145. package/dist/webpackLoader.mjs +45 -17
  146. package/dist/webpackLoader.mjs.map +1 -1
  147. package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
  148. package/native/tailwind-styled-native.node +0 -0
  149. package/package.json +3 -1
  150. package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
  151. package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
  152. package/dist/index-DQI6O24n.d.mts +0 -464
  153. package/dist/index-NDINUhLN.d.mts +0 -90
  154. package/dist/index-NDINUhLN.d.ts +0 -90
  155. package/dist/index-UkYbyBkR.d.ts +0 -464
  156. package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
  157. package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
  158. package/dist/schemas-DR-SLxZZ.d.mts +0 -59
  159. package/dist/schemas-DR-SLxZZ.d.ts +0 -59
  160. package/dist/trace-Dz4vmZdy.d.mts +0 -96
  161. package/dist/trace-Dz4vmZdy.d.ts +0 -96
  162. package/dist/types-DXr2PmGP.d.mts +0 -31
  163. package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/engine.mjs CHANGED
@@ -1,15 +1,3 @@
1
- import { z } from 'zod';
2
- import { createRequire } from 'module';
3
- import * as fs3 from 'fs';
4
- import fs3__default from 'fs';
5
- import * as path9 from 'path';
6
- import path9__default from 'path';
7
- import { createHash } from 'crypto';
8
- import { fileURLToPath, pathToFileURL } from 'url';
9
- import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
10
- import { availableParallelism } from 'os';
11
- import 'perf_hooks';
12
-
13
1
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
14
2
  var __defProp = Object.defineProperty;
15
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -130,6 +118,7 @@ function getPipelinePercentages(metrics) {
130
118
  }
131
119
  var init_trace = __esm({
132
120
  "packages/domain/shared/src/trace.ts"() {
121
+ "use strict";
133
122
  }
134
123
  });
135
124
 
@@ -144,6 +133,7 @@ function formatErrorCode(code) {
144
133
  var ERROR_CODES, ERROR_SUGGESTIONS;
145
134
  var init_error_codes = __esm({
146
135
  "packages/domain/shared/src/error-codes.ts"() {
136
+ "use strict";
147
137
  ERROR_CODES = {
148
138
  // E0xx — Native binding
149
139
  NATIVE_NOT_FOUND: "E001",
@@ -210,8 +200,12 @@ function isTailwindV4() {
210
200
  }
211
201
  var init_compatibility = __esm({
212
202
  "packages/domain/shared/src/compatibility.ts"() {
203
+ "use strict";
213
204
  }
214
205
  });
206
+
207
+ // packages/domain/shared/src/native-schemas.ts
208
+ import { z } from "zod";
215
209
  function safeParseNative(schema, data, fallback) {
216
210
  const result = schema.safeParse(data);
217
211
  return result.success ? result.data : fallback;
@@ -227,9 +221,10 @@ function parseNative(schema, data, context) {
227
221
  }
228
222
  return result.data;
229
223
  }
230
- var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
224
+ var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchEventSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
231
225
  var init_native_schemas = __esm({
232
226
  "packages/domain/shared/src/native-schemas.ts"() {
227
+ "use strict";
233
228
  NativeScanFileSchema = z.object({
234
229
  file: z.string().min(1, "file path cannot be empty"),
235
230
  classes: z.array(z.string()),
@@ -269,7 +264,7 @@ var init_native_schemas = __esm({
269
264
  resolvedClasses: z.array(z.string()),
270
265
  unresolvedClasses: z.array(z.string()).optional()
271
266
  });
272
- z.object({
267
+ NativeWatchEventSchema = z.object({
273
268
  type: z.enum(["change", "unlink", "create"]),
274
269
  path: z.string()
275
270
  });
@@ -375,6 +370,7 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
375
370
  var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
376
371
  var init_esmHelpers = __esm({
377
372
  "packages/domain/shared/src/esmHelpers.ts"() {
373
+ "use strict";
378
374
  isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
379
375
  nodeModuleRef = null;
380
376
  _nodePath = null;
@@ -425,6 +421,7 @@ function createBuildTimer() {
425
421
  var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
426
422
  var init_telemetry = __esm({
427
423
  "packages/domain/shared/src/telemetry.ts"() {
424
+ "use strict";
428
425
  RING_BUFFER_SIZE = 100;
429
426
  TelemetryCollector = class {
430
427
  data = [];
@@ -491,6 +488,9 @@ var init_telemetry = __esm({
491
488
  _globalCollector = null;
492
489
  }
493
490
  });
491
+
492
+ // packages/domain/shared/src/configSchemas.ts
493
+ import { z as z2 } from "zod";
494
494
  function parseJsonWithSchema(jsonString, schema, sourceName) {
495
495
  let parsed;
496
496
  try {
@@ -524,67 +524,68 @@ function parseJsonFileWithSchema(filePath, schema) {
524
524
  var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
525
525
  var init_configSchemas = __esm({
526
526
  "packages/domain/shared/src/configSchemas.ts"() {
527
- ScanCacheClassEntrySchema = z.object({
528
- name: z.string().min(1),
529
- usedIn: z.array(z.string()),
530
- risk: z.enum(["low", "medium", "high"]).default("low"),
531
- bundleContribution: z.number().nonnegative().default(0),
532
- variants: z.array(z.string()).default([])
527
+ "use strict";
528
+ ScanCacheClassEntrySchema = z2.object({
529
+ name: z2.string().min(1),
530
+ usedIn: z2.array(z2.string()),
531
+ risk: z2.enum(["low", "medium", "high"]).default("low"),
532
+ bundleContribution: z2.number().nonnegative().default(0),
533
+ variants: z2.array(z2.string()).default([])
533
534
  });
534
- ScanCacheSchema = z.object({
535
- version: z.string().default("1"),
536
- generatedAt: z.string(),
537
- root: z.string(),
538
- classNames: z.array(ScanCacheClassEntrySchema),
539
- totalFiles: z.number().int().nonnegative(),
540
- uniqueCount: z.number().int().nonnegative()
535
+ ScanCacheSchema = z2.object({
536
+ version: z2.string().default("1"),
537
+ generatedAt: z2.string(),
538
+ root: z2.string(),
539
+ classNames: z2.array(ScanCacheClassEntrySchema),
540
+ totalFiles: z2.number().int().nonnegative(),
541
+ uniqueCount: z2.number().int().nonnegative()
541
542
  });
542
- TailwindContentItemSchema = z.union([
543
- z.string(),
544
- z.object({
545
- raw: z.string(),
546
- extension: z.string().optional()
543
+ TailwindContentItemSchema = z2.union([
544
+ z2.string(),
545
+ z2.object({
546
+ raw: z2.string(),
547
+ extension: z2.string().optional()
547
548
  }),
548
- z.object({
549
- files: z.array(z.string()),
550
- transform: z.record(z.string(), z.unknown()).optional()
549
+ z2.object({
550
+ files: z2.array(z2.string()),
551
+ transform: z2.record(z2.string(), z2.unknown()).optional()
551
552
  })
552
553
  ]);
553
- TailwindConfigSchema = z.object({
554
- content: z.array(TailwindContentItemSchema).optional(),
555
- theme: z.record(z.string(), z.unknown()).optional(),
556
- plugins: z.array(z.unknown()).optional(),
557
- darkMode: z.union([z.literal("class"), z.literal("media"), z.literal(false)]).optional(),
558
- prefix: z.string().optional(),
559
- safelist: z.array(z.union([z.string(), z.object({ pattern: z.instanceof(RegExp) })])).optional(),
560
- blocklist: z.array(z.string()).optional()
554
+ TailwindConfigSchema = z2.object({
555
+ content: z2.array(TailwindContentItemSchema).optional(),
556
+ theme: z2.record(z2.string(), z2.unknown()).optional(),
557
+ plugins: z2.array(z2.unknown()).optional(),
558
+ darkMode: z2.union([z2.literal("class"), z2.literal("media"), z2.literal(false)]).optional(),
559
+ prefix: z2.string().optional(),
560
+ safelist: z2.array(z2.union([z2.string(), z2.object({ pattern: z2.instanceof(RegExp) })])).optional(),
561
+ blocklist: z2.array(z2.string()).optional()
561
562
  }).passthrough();
562
- RegistryPluginEntrySchema = z.object({
563
- name: z.string().min(1),
564
- description: z.string(),
565
- version: z.string(),
566
- tags: z.array(z.string()).default([]),
567
- official: z.boolean().default(false),
568
- docs: z.string().url().optional(),
569
- install: z.string().optional(),
570
- integrity: z.string().optional()
563
+ RegistryPluginEntrySchema = z2.object({
564
+ name: z2.string().min(1),
565
+ description: z2.string(),
566
+ version: z2.string(),
567
+ tags: z2.array(z2.string()).default([]),
568
+ official: z2.boolean().default(false),
569
+ docs: z2.string().url().optional(),
570
+ install: z2.string().optional(),
571
+ integrity: z2.string().optional()
571
572
  });
572
- RegistryFileSchema = z.object({
573
- version: z.string(),
574
- official: z.array(RegistryPluginEntrySchema).default([]),
575
- community: z.array(RegistryPluginEntrySchema).default([])
573
+ RegistryFileSchema = z2.object({
574
+ version: z2.string(),
575
+ official: z2.array(RegistryPluginEntrySchema).default([]),
576
+ community: z2.array(RegistryPluginEntrySchema).default([])
576
577
  });
577
- PackageJsonSchema = z.object({
578
- name: z.string(),
579
- version: z.string(),
580
- scripts: z.record(z.string(), z.string()).optional(),
581
- dependencies: z.record(z.string(), z.string()).optional(),
582
- devDependencies: z.record(z.string(), z.string()).optional(),
583
- peerDependencies: z.record(z.string(), z.string()).optional(),
584
- main: z.string().optional(),
585
- module: z.string().optional(),
586
- exports: z.unknown().optional(),
587
- type: z.enum(["module", "commonjs"]).optional()
578
+ PackageJsonSchema = z2.object({
579
+ name: z2.string(),
580
+ version: z2.string(),
581
+ scripts: z2.record(z2.string(), z2.string()).optional(),
582
+ dependencies: z2.record(z2.string(), z2.string()).optional(),
583
+ devDependencies: z2.record(z2.string(), z2.string()).optional(),
584
+ peerDependencies: z2.record(z2.string(), z2.string()).optional(),
585
+ main: z2.string().optional(),
586
+ module: z2.string().optional(),
587
+ exports: z2.unknown().optional(),
588
+ type: z2.enum(["module", "commonjs"]).optional()
588
589
  }).passthrough();
589
590
  }
590
591
  });
@@ -672,6 +673,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
672
673
  var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
673
674
  var init_workerResolver = __esm({
674
675
  "packages/domain/shared/src/workerResolver.ts"() {
676
+ "use strict";
675
677
  isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
676
678
  NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
677
679
  NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
@@ -821,13 +823,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
821
823
  }
822
824
  return lines.join("\n");
823
825
  }
824
- function generateBarrelFile(exports$1, dir, opts = {}) {
826
+ function generateBarrelFile(exports, dir, opts = {}) {
825
827
  const { includeTypes = true } = opts;
826
828
  const lines = [];
827
829
  lines.push(`// Auto-generated barrel file for ${dir}`);
828
830
  lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
829
831
  lines.push(``);
830
- for (const name of exports$1) {
832
+ for (const name of exports) {
831
833
  lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
832
834
  if (includeTypes) {
833
835
  lines.push(`export type * from "./${name}"`);
@@ -837,8 +839,14 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
837
839
  }
838
840
  var init_codegen = __esm({
839
841
  "packages/domain/shared/src/codegen.ts"() {
842
+ "use strict";
840
843
  }
841
844
  });
845
+
846
+ // packages/domain/shared/src/native-resolution.ts
847
+ import { createRequire } from "module";
848
+ import * as fs from "fs";
849
+ import * as path from "path";
842
850
  function platformKey() {
843
851
  if (isBrowser3) return "browser";
844
852
  return `${process.platform}-${process.arch}`;
@@ -854,7 +862,7 @@ function resolveNativeBinary(runtimeDir) {
854
862
  }
855
863
  const envPath = process.env.TW_NATIVE_PATH?.trim();
856
864
  if (envPath) {
857
- if (fs3.existsSync(envPath)) {
865
+ if (fs.existsSync(envPath)) {
858
866
  return { path: envPath, source: "env", platform, tried };
859
867
  }
860
868
  tried.push(`env:${envPath} (not found)`);
@@ -863,7 +871,7 @@ function resolveNativeBinary(runtimeDir) {
863
871
  for (const pkg of prebuiltPkgs) {
864
872
  try {
865
873
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
866
- if (fs3.existsSync(candidate)) {
874
+ if (fs.existsSync(candidate)) {
867
875
  return { path: candidate, source: "prebuilt", platform, tried };
868
876
  }
869
877
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -874,13 +882,13 @@ function resolveNativeBinary(runtimeDir) {
874
882
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
875
883
  const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
876
884
  if (runtimeDir) {
877
- for (const depth of ["..", path9.join("..", ".."), path9.join("..", "..", "..")]) {
878
- const pkgRoot = path9.resolve(runtimeDir, depth);
885
+ for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
886
+ const pkgRoot = path.resolve(runtimeDir, depth);
879
887
  for (const bin of BINARY_NAMES_SELF) {
880
888
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
881
- const candidate = path9.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
889
+ const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
882
890
  tried.push(`self-bundled:${candidate}`);
883
- if (fs3.existsSync(candidate)) {
891
+ if (fs.existsSync(candidate)) {
884
892
  return { path: candidate, source: "prebuilt", platform, tried };
885
893
  }
886
894
  }
@@ -892,29 +900,29 @@ function resolveNativeBinary(runtimeDir) {
892
900
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
893
901
  const localCandidates = [];
894
902
  for (const bin of BINARY_NAMES) {
895
- localCandidates.push(path9.resolve(base, `${bin}.node`));
896
- localCandidates.push(path9.resolve(base, "..", `${bin}.node`));
897
- localCandidates.push(path9.resolve(base, `${bin}.${platform}.node`));
898
- localCandidates.push(path9.resolve(base, `${bin}.${napiPlatform}.node`));
903
+ localCandidates.push(path.resolve(base, `${bin}.node`));
904
+ localCandidates.push(path.resolve(base, "..", `${bin}.node`));
905
+ localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
906
+ localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
899
907
  }
900
908
  for (const startDir of [cwd, base]) {
901
909
  let dir = startDir;
902
910
  for (let i = 0; i < 6; i++) {
903
- const nativeDir = path9.resolve(dir, "native");
911
+ const nativeDir = path.resolve(dir, "native");
904
912
  for (const bin of BINARY_NAMES) {
905
- localCandidates.push(path9.resolve(nativeDir, `${bin}.node`));
906
- localCandidates.push(path9.resolve(nativeDir, `${bin}.${platform}.node`));
907
- localCandidates.push(path9.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
908
- localCandidates.push(path9.resolve(nativeDir, "target", "release", `${bin}.node`));
913
+ localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
914
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
915
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
916
+ localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
909
917
  }
910
- const parent = path9.resolve(dir, "..");
918
+ const parent = path.resolve(dir, "..");
911
919
  if (parent === dir) break;
912
920
  dir = parent;
913
921
  }
914
922
  }
915
923
  for (const candidate of localCandidates) {
916
924
  tried.push(`local:${candidate}`);
917
- if (fs3.existsSync(candidate)) {
925
+ if (fs.existsSync(candidate)) {
918
926
  return { path: candidate, source: "local", platform, tried };
919
927
  }
920
928
  }
@@ -937,6 +945,7 @@ function formatNativeNotFoundError(result) {
937
945
  var isBrowser3, _require, PLATFORM_MAP;
938
946
  var init_native_resolution = __esm({
939
947
  "packages/domain/shared/src/native-resolution.ts"() {
948
+ "use strict";
940
949
  isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
941
950
  _require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
942
951
  PLATFORM_MAP = {
@@ -984,6 +993,7 @@ function createObservabilityClient(opts = {}) {
984
993
  }
985
994
  var init_observability = __esm({
986
995
  "packages/domain/shared/src/observability.ts"() {
996
+ "use strict";
987
997
  }
988
998
  });
989
999
 
@@ -991,6 +1001,7 @@ var init_observability = __esm({
991
1001
  var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
992
1002
  var init_nativeBridge = __esm({
993
1003
  "packages/domain/compiler/src/nativeBridge.ts"() {
1004
+ "use strict";
994
1005
  init_src2();
995
1006
  _loadNative = (path16) => __require(path16);
996
1007
  log = (...args) => {
@@ -1130,6 +1141,7 @@ function resetCacheStats() {
1130
1141
  }
1131
1142
  var init_cssGeneratorNative = __esm({
1132
1143
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1144
+ "use strict";
1133
1145
  init_nativeBridge();
1134
1146
  }
1135
1147
  });
@@ -1202,6 +1214,7 @@ function atomicRegistrySize() {
1202
1214
  }
1203
1215
  var init_compilationNative = __esm({
1204
1216
  "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1217
+ "use strict";
1205
1218
  init_nativeBridge();
1206
1219
  }
1207
1220
  });
@@ -1345,6 +1358,7 @@ function twMergeRaw(classLists) {
1345
1358
  }
1346
1359
  var init_cssCompilationNative = __esm({
1347
1360
  "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1361
+ "use strict";
1348
1362
  init_nativeBridge();
1349
1363
  }
1350
1364
  });
@@ -1444,6 +1458,7 @@ function idRegistryImport(importedData) {
1444
1458
  }
1445
1459
  var init_idRegistryNative = __esm({
1446
1460
  "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1461
+ "use strict";
1447
1462
  init_nativeBridge();
1448
1463
  }
1449
1464
  });
@@ -1585,9 +1600,13 @@ function scanFilesBatchNative(filesJson) {
1585
1600
  }
1586
1601
  var init_streamingNative = __esm({
1587
1602
  "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1603
+ "use strict";
1588
1604
  init_nativeBridge();
1589
1605
  }
1590
1606
  });
1607
+
1608
+ // packages/domain/compiler/src/tailwindEngine.ts
1609
+ import { createRequire as createRequire2 } from "module";
1591
1610
  function loadTailwindEngine() {
1592
1611
  if (_twEngine) return _twEngine;
1593
1612
  if (_twEngineError) throw _twEngineError;
@@ -1607,10 +1626,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
1607
1626
  if (classes.length === 0) return "";
1608
1627
  const tw = loadTailwindEngine();
1609
1628
  const input = cssEntryContent ?? "@import 'tailwindcss';";
1610
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1611
- const { dirname, resolve: resolve2 } = await import('path');
1629
+ const { readFileSync, existsSync: existsSync3 } = await import("fs");
1630
+ const { dirname, resolve: resolve2 } = await import("path");
1612
1631
  const projectRoot = root ?? process.cwd();
1613
- const req = createRequire(resolve2(projectRoot, "package.json"));
1632
+ const req = createRequire2(resolve2(projectRoot, "package.json"));
1614
1633
  const loadStylesheet = async (id, base) => {
1615
1634
  try {
1616
1635
  const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
@@ -1630,10 +1649,12 @@ async function generateRawCss(classes, cssEntryContent, root) {
1630
1649
  const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1631
1650
  return compiler.build(classes);
1632
1651
  }
1633
- var require2, _twEngine, _twEngineError;
1652
+ var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
1634
1653
  var init_tailwindEngine = __esm({
1635
1654
  "packages/domain/compiler/src/tailwindEngine.ts"() {
1636
- require2 = createRequire(import.meta.url);
1655
+ "use strict";
1656
+ require2 = createRequire2(import.meta.url);
1657
+ MAX_CACHE_MEMORY = 256 * 1024;
1637
1658
  _twEngine = null;
1638
1659
  _twEngineError = null;
1639
1660
  }
@@ -1648,6 +1669,7 @@ __export(tailwindEngine_exports, {
1648
1669
  runCssPipeline: () => runCssPipeline,
1649
1670
  runCssPipelineSync: () => runCssPipelineSync
1650
1671
  });
1672
+ import { createRequire as createRequire3 } from "module";
1651
1673
  function _getCacheKey(classes, minify, cssEntry, root) {
1652
1674
  const sorted = [...classes].sort().join(",");
1653
1675
  const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
@@ -1814,24 +1836,27 @@ function processTailwindCssWithTargets(css, targets) {
1814
1836
  }
1815
1837
  return result.css;
1816
1838
  }
1817
- var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1839
+ var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
1818
1840
  var init_tailwindEngine2 = __esm({
1819
1841
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1842
+ "use strict";
1820
1843
  init_nativeBridge();
1821
1844
  init_cssGeneratorNative();
1822
1845
  init_cssCompilationNative();
1823
1846
  init_tailwindEngine();
1824
- createRequire(import.meta.url);
1847
+ require3 = createRequire3(import.meta.url);
1825
1848
  _cssCache = /* @__PURE__ */ new Map();
1826
1849
  _cacheHits = 0;
1827
1850
  _cacheMisses = 0;
1828
1851
  MAX_CACHE_SIZE = 100;
1852
+ MAX_CACHE_MEMORY2 = 256 * 1024;
1829
1853
  }
1830
1854
  });
1831
1855
 
1832
1856
  // packages/domain/compiler/src/compiler/index.ts
1833
1857
  var init_compiler = __esm({
1834
1858
  "packages/domain/compiler/src/compiler/index.ts"() {
1859
+ "use strict";
1835
1860
  init_cssGeneratorNative();
1836
1861
  init_compilationNative();
1837
1862
  init_cssCompilationNative();
@@ -1844,6 +1869,7 @@ var init_compiler = __esm({
1844
1869
  var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1845
1870
  var init_parser = __esm({
1846
1871
  "packages/domain/compiler/src/parser/index.ts"() {
1872
+ "use strict";
1847
1873
  init_nativeBridge();
1848
1874
  parseClasses = (raw) => {
1849
1875
  const native = getNativeBridge();
@@ -2022,6 +2048,7 @@ function resetMemoryStats() {
2022
2048
  }
2023
2049
  var init_analyzerNative = __esm({
2024
2050
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
2051
+ "use strict";
2025
2052
  init_nativeBridge();
2026
2053
  }
2027
2054
  });
@@ -2115,6 +2142,7 @@ function resolveSimpleVariants(configJson) {
2115
2142
  }
2116
2143
  var init_themeResolutionNative = __esm({
2117
2144
  "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2145
+ "use strict";
2118
2146
  init_nativeBridge();
2119
2147
  }
2120
2148
  });
@@ -2162,6 +2190,7 @@ function generateSubComponentTypes(root, outputPath) {
2162
2190
  }
2163
2191
  var init_scannerNative = __esm({
2164
2192
  "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2193
+ "use strict";
2165
2194
  init_nativeBridge();
2166
2195
  }
2167
2196
  });
@@ -2169,6 +2198,7 @@ var init_scannerNative = __esm({
2169
2198
  // packages/domain/compiler/src/analyzer/index.ts
2170
2199
  var init_analyzer = __esm({
2171
2200
  "packages/domain/compiler/src/analyzer/index.ts"() {
2201
+ "use strict";
2172
2202
  init_analyzerNative();
2173
2203
  init_themeResolutionNative();
2174
2204
  init_scannerNative();
@@ -2357,6 +2387,7 @@ function resetResolverPoolStats() {
2357
2387
  }
2358
2388
  var init_cacheNative = __esm({
2359
2389
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
2390
+ "use strict";
2360
2391
  init_nativeBridge();
2361
2392
  }
2362
2393
  });
@@ -2364,6 +2395,7 @@ var init_cacheNative = __esm({
2364
2395
  // packages/domain/compiler/src/cache/index.ts
2365
2396
  var init_cache = __esm({
2366
2397
  "packages/domain/compiler/src/cache/index.ts"() {
2398
+ "use strict";
2367
2399
  init_cacheNative();
2368
2400
  }
2369
2401
  });
@@ -2612,6 +2644,7 @@ function redisDiagnose() {
2612
2644
  }
2613
2645
  var init_redisNative = __esm({
2614
2646
  "packages/domain/compiler/src/redis/redisNative.ts"() {
2647
+ "use strict";
2615
2648
  init_nativeBridge();
2616
2649
  }
2617
2650
  });
@@ -2619,6 +2652,7 @@ var init_redisNative = __esm({
2619
2652
  // packages/domain/compiler/src/redis/index.ts
2620
2653
  var init_redis = __esm({
2621
2654
  "packages/domain/compiler/src/redis/index.ts"() {
2655
+ "use strict";
2622
2656
  init_redisNative();
2623
2657
  }
2624
2658
  });
@@ -2757,6 +2791,7 @@ function getCompilerDiagnostics() {
2757
2791
  }
2758
2792
  var init_watchSystemNative = __esm({
2759
2793
  "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
2794
+ "use strict";
2760
2795
  init_nativeBridge();
2761
2796
  }
2762
2797
  });
@@ -2764,9 +2799,15 @@ var init_watchSystemNative = __esm({
2764
2799
  // packages/domain/compiler/src/watch/index.ts
2765
2800
  var init_watch = __esm({
2766
2801
  "packages/domain/compiler/src/watch/index.ts"() {
2802
+ "use strict";
2767
2803
  init_watchSystemNative();
2768
2804
  }
2769
2805
  });
2806
+
2807
+ // packages/domain/compiler/src/index.ts
2808
+ import fs2 from "fs";
2809
+ import path2 from "path";
2810
+ import { createRequire as createRequire4 } from "module";
2770
2811
  function _layoutClassesToCss(classes) {
2771
2812
  const native = getNativeBridge();
2772
2813
  if (!native?.layoutClassesToCss) {
@@ -2804,6 +2845,7 @@ function extractContainerCssFromSource(source) {
2804
2845
  var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2805
2846
  var init_src = __esm({
2806
2847
  "packages/domain/compiler/src/index.ts"() {
2848
+ "use strict";
2807
2849
  init_nativeBridge();
2808
2850
  init_compiler();
2809
2851
  init_parser();
@@ -2811,7 +2853,7 @@ var init_src = __esm({
2811
2853
  init_cache();
2812
2854
  init_redis();
2813
2855
  init_watch();
2814
- _require2 = createRequire(import.meta.url);
2856
+ _require2 = createRequire4(import.meta.url);
2815
2857
  transformSource = (source, opts) => {
2816
2858
  const native = getNativeBridge();
2817
2859
  if (!native?.transformSource) {
@@ -2903,7 +2945,7 @@ var init_src = __esm({
2903
2945
  };
2904
2946
  scanProjectUsage = (dirs, cwd) => {
2905
2947
  const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
2906
- const files = dirs.map((dir) => path9__default.resolve(cwd, dir));
2948
+ const files = dirs.map((dir) => path2.resolve(cwd, dir));
2907
2949
  const results = batchExtractClasses2(files) || [];
2908
2950
  const combined = {};
2909
2951
  for (const result of results) {
@@ -2920,13 +2962,13 @@ var init_src = __esm({
2920
2962
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
2921
2963
  const allClasses = Object.keys(classes).sort();
2922
2964
  if (outputPath) {
2923
- fs3__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2965
+ fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2924
2966
  }
2925
2967
  return allClasses;
2926
2968
  };
2927
2969
  loadSafelist = (safelistPath) => {
2928
2970
  try {
2929
- const content = fs3__default.readFileSync(safelistPath, "utf-8");
2971
+ const content = fs2.readFileSync(safelistPath, "utf-8");
2930
2972
  return JSON.parse(content);
2931
2973
  } catch {
2932
2974
  return [];
@@ -2940,8 +2982,8 @@ var init_src = __esm({
2940
2982
  "tailwind.config.cjs"
2941
2983
  ];
2942
2984
  for (const file of configFiles) {
2943
- const fullPath = path9__default.join(cwd, file);
2944
- if (fs3__default.existsSync(fullPath)) {
2985
+ const fullPath = path2.join(cwd, file);
2986
+ if (fs2.existsSync(fullPath)) {
2945
2987
  const mod = __require(fullPath);
2946
2988
  return mod.default || mod;
2947
2989
  }
@@ -2951,9 +2993,9 @@ var init_src = __esm({
2951
2993
  getContentPaths = (cwd = process.cwd()) => {
2952
2994
  return {
2953
2995
  content: [
2954
- path9__default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2955
- path9__default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2956
- path9__default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2996
+ path2.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
2997
+ path2.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
2998
+ path2.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2957
2999
  ]
2958
3000
  };
2959
3001
  };
@@ -3367,6 +3409,7 @@ __export(internal_exports, {
3367
3409
  });
3368
3410
  var init_internal = __esm({
3369
3411
  "packages/domain/compiler/src/internal.ts"() {
3412
+ "use strict";
3370
3413
  init_src();
3371
3414
  init_tailwindEngine2();
3372
3415
  init_compiler();
@@ -3377,6 +3420,10 @@ var init_internal = __esm({
3377
3420
  init_watch();
3378
3421
  }
3379
3422
  });
3423
+
3424
+ // packages/domain/shared/src/staticStateExtractor.ts
3425
+ import fs3 from "fs";
3426
+ import path3 from "path";
3380
3427
  function getNative() {
3381
3428
  if (_native) return _native;
3382
3429
  try {
@@ -3406,17 +3453,17 @@ function getNative() {
3406
3453
  function* walkSourceFiles(dir) {
3407
3454
  let entries;
3408
3455
  try {
3409
- entries = fs3__default.readdirSync(dir, { withFileTypes: true });
3456
+ entries = fs3.readdirSync(dir, { withFileTypes: true });
3410
3457
  } catch {
3411
3458
  return;
3412
3459
  }
3413
3460
  for (const entry of entries) {
3414
- const fullPath = path9__default.join(dir, entry.name);
3461
+ const fullPath = path3.join(dir, entry.name);
3415
3462
  if (entry.isDirectory()) {
3416
3463
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
3417
3464
  yield* walkSourceFiles(fullPath);
3418
3465
  } else if (entry.isFile()) {
3419
- const ext = path9__default.extname(entry.name);
3466
+ const ext = path3.extname(entry.name);
3420
3467
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
3421
3468
  }
3422
3469
  }
@@ -3480,7 +3527,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3480
3527
  allConfigs.push(...configs);
3481
3528
  if (verbose) {
3482
3529
  process.stderr.write(
3483
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3530
+ `[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
3484
3531
  `
3485
3532
  );
3486
3533
  }
@@ -3491,7 +3538,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3491
3538
  if (filesScanned >= maxFiles) break;
3492
3539
  let source;
3493
3540
  try {
3494
- source = fs3__default.readFileSync(filePath, "utf-8");
3541
+ source = fs3.readFileSync(filePath, "utf-8");
3495
3542
  } catch {
3496
3543
  continue;
3497
3544
  }
@@ -3504,7 +3551,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3504
3551
  allConfigs.push(...configs);
3505
3552
  if (verbose) {
3506
3553
  process.stderr.write(
3507
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3554
+ `[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
3508
3555
  `
3509
3556
  );
3510
3557
  }
@@ -3598,12 +3645,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3598
3645
  resolvedCss: options.resolvedCss || ""
3599
3646
  // ← ensure always passed
3600
3647
  });
3601
- const twClassesDir = path9__default.join(path9__default.dirname(safelistPath), "tw-classes");
3602
- fs3__default.mkdirSync(twClassesDir, { recursive: true });
3603
- const stateFilePath = path9__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3648
+ const twClassesDir = path3.join(path3.dirname(safelistPath), "tw-classes");
3649
+ fs3.mkdirSync(twClassesDir, { recursive: true });
3650
+ const stateFilePath = path3.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3604
3651
  if (result.rulesGenerated === 0) {
3605
3652
  try {
3606
- fs3__default.writeFileSync(
3653
+ fs3.writeFileSync(
3607
3654
  stateFilePath,
3608
3655
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3609
3656
  "utf-8"
@@ -3613,7 +3660,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3613
3660
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3614
3661
  }
3615
3662
  try {
3616
- fs3__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3663
+ fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3617
3664
  return [
3618
3665
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3619
3666
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3628,12 +3675,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3628
3675
  var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3629
3676
  var init_staticStateExtractor = __esm({
3630
3677
  "packages/domain/shared/src/staticStateExtractor.ts"() {
3678
+ "use strict";
3631
3679
  SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
3632
3680
  IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
3633
3681
  _native = null;
3634
3682
  TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
3635
3683
  }
3636
3684
  });
3685
+
3686
+ // packages/domain/shared/src/logger.ts
3687
+ import fs4 from "fs";
3688
+ import path4 from "path";
3637
3689
  function getEnvLevel() {
3638
3690
  const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
3639
3691
  if (env && env in LEVELS) return env;
@@ -3643,8 +3695,8 @@ function setGlobalLogFile(filePath) {
3643
3695
  _globalLogFile = filePath;
3644
3696
  _logFileInitialized = false;
3645
3697
  try {
3646
- fs3__default.mkdirSync(path9__default.dirname(filePath), { recursive: true });
3647
- fs3__default.writeFileSync(
3698
+ fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
3699
+ fs4.writeFileSync(
3648
3700
  filePath,
3649
3701
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3650
3702
  `,
@@ -3657,13 +3709,13 @@ function setGlobalLogFile(filePath) {
3657
3709
  function writeToFile(line) {
3658
3710
  if (!_globalLogFile || !_logFileInitialized) return;
3659
3711
  try {
3660
- fs3__default.appendFileSync(_globalLogFile, line);
3712
+ fs4.appendFileSync(_globalLogFile, line);
3661
3713
  } catch {
3662
3714
  }
3663
3715
  }
3664
3716
  function createLogger(prefix, level) {
3665
3717
  const loggerState = {
3666
- currentLevel: getEnvLevel(),
3718
+ currentLevel: level ?? getEnvLevel(),
3667
3719
  setLevel(l) {
3668
3720
  this.currentLevel = l;
3669
3721
  }
@@ -3684,13 +3736,14 @@ function createLogger(prefix, level) {
3684
3736
  setLogFile: (filePath) => setGlobalLogFile(filePath)
3685
3737
  };
3686
3738
  }
3687
- var LEVELS, _globalLogFile, _logFileInitialized;
3739
+ var LEVELS, _globalLogFile, _logFileInitialized, logger;
3688
3740
  var init_logger = __esm({
3689
3741
  "packages/domain/shared/src/logger.ts"() {
3742
+ "use strict";
3690
3743
  LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3691
3744
  _globalLogFile = null;
3692
3745
  _logFileInitialized = false;
3693
- createLogger("tailwind-styled");
3746
+ logger = createLogger("tailwind-styled");
3694
3747
  }
3695
3748
  });
3696
3749
 
@@ -3766,6 +3819,11 @@ __export(src_exports, {
3766
3819
  tryRequire: () => tryRequire,
3767
3820
  wrapUnknownError: () => wrapUnknownError
3768
3821
  });
3822
+ import { createHash } from "crypto";
3823
+ import fs5 from "fs";
3824
+ import path5 from "path";
3825
+ import { fileURLToPath } from "url";
3826
+ import { createRequire as createRequire5 } from "module";
3769
3827
  function createLogger2(namespace) {
3770
3828
  const prefix = `[${namespace}]`;
3771
3829
  return {
@@ -3811,9 +3869,9 @@ function loadNativeBinding(options) {
3811
3869
  const { runtimeDir, candidates, isValid } = options;
3812
3870
  const loadErrors = [];
3813
3871
  for (const candidate of candidates) {
3814
- const candidatePath = path9__default.resolve(runtimeDir, candidate);
3872
+ const candidatePath = path5.resolve(runtimeDir, candidate);
3815
3873
  try {
3816
- if (!fs3__default.existsSync(candidatePath) && !fs3__default.existsSync(candidatePath + ".node")) {
3874
+ if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
3817
3875
  continue;
3818
3876
  }
3819
3877
  const mod = requireNativeModule(candidatePath);
@@ -3845,9 +3903,9 @@ function resolveNativeBindingCandidates(options) {
3845
3903
  }
3846
3904
  }
3847
3905
  if (!includeDefaultCandidates) return candidates;
3848
- if (fs3__default.existsSync(runtimeDir)) {
3906
+ if (fs5.existsSync(runtimeDir)) {
3849
3907
  try {
3850
- for (const entry of fs3__default.readdirSync(runtimeDir)) {
3908
+ for (const entry of fs5.readdirSync(runtimeDir)) {
3851
3909
  if (entry.endsWith(".node")) candidates.push(entry);
3852
3910
  }
3853
3911
  } catch {
@@ -3856,22 +3914,22 @@ function resolveNativeBindingCandidates(options) {
3856
3914
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3857
3915
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
3858
3916
  for (const bin of BINARY_NAMES) {
3859
- candidates.push(path9__default.resolve(runtimeDir, `${bin}.node`));
3860
- candidates.push(path9__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3861
- candidates.push(path9__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3862
- candidates.push(path9__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3863
- candidates.push(path9__default.resolve(process.cwd(), "native", `${bin}.node`));
3864
- candidates.push(path9__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3865
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3866
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3867
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3917
+ candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
3918
+ candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3919
+ candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
3920
+ candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3921
+ candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
3922
+ candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3923
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3924
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3925
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3868
3926
  }
3869
3927
  return Array.from(new Set(candidates));
3870
3928
  }
3871
3929
  function resolveRuntimeDir(dir, importMetaUrl) {
3872
- if (dir) return path9__default.resolve(dir);
3930
+ if (dir) return path5.resolve(dir);
3873
3931
  try {
3874
- return path9__default.dirname(fileURLToPath(importMetaUrl));
3932
+ return path5.dirname(fileURLToPath(importMetaUrl));
3875
3933
  } catch {
3876
3934
  return process.cwd();
3877
3935
  }
@@ -3888,6 +3946,7 @@ function formatErrorMessage(error) {
3888
3946
  var TwError, _require3, LRUCache;
3889
3947
  var init_src2 = __esm({
3890
3948
  "packages/domain/shared/src/index.ts"() {
3949
+ "use strict";
3891
3950
  init_trace();
3892
3951
  init_error_codes();
3893
3952
  init_compatibility();
@@ -3953,7 +4012,7 @@ var init_src2 = __esm({
3953
4012
  return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
3954
4013
  }
3955
4014
  };
3956
- _require3 = createRequire(import.meta.url);
4015
+ _require3 = createRequire5(import.meta.url);
3957
4016
  LRUCache = class {
3958
4017
  capacity;
3959
4018
  cache;
@@ -4027,12 +4086,14 @@ __export(native_bridge_exports, {
4027
4086
  startWatchNative: () => startWatchNative,
4028
4087
  stopWatchNative: () => stopWatchNative
4029
4088
  });
4089
+ import path6 from "path";
4090
+ import { fileURLToPath as fileURLToPath2 } from "url";
4030
4091
  function getDirname2() {
4031
4092
  if (typeof __dirname !== "undefined") {
4032
4093
  return __dirname;
4033
4094
  }
4034
4095
  if (typeof import.meta !== "undefined" && import.meta.url) {
4035
- return path9__default.dirname(fileURLToPath(import.meta.url));
4096
+ return path6.dirname(fileURLToPath2(import.meta.url));
4036
4097
  }
4037
4098
  return process.cwd();
4038
4099
  }
@@ -4240,6 +4301,7 @@ function hasNativeWatchBinding() {
4240
4301
  var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
4241
4302
  var init_native_bridge = __esm({
4242
4303
  "packages/domain/scanner/src/native-bridge.ts"() {
4304
+ "use strict";
4243
4305
  init_src2();
4244
4306
  log2 = createDebugLogger("scanner:native");
4245
4307
  isValidScannerBinding = (module) => {
@@ -4320,13 +4382,17 @@ var init_native_bridge = __esm({
4320
4382
  resetScannerBridgeCache = scannerBridgeLoader.reset;
4321
4383
  }
4322
4384
  });
4385
+
4386
+ // packages/domain/scanner/src/cache-native.ts
4387
+ import fs6 from "fs";
4388
+ import path7 from "path";
4323
4389
  function defaultCachePath(rootDir, cacheDir) {
4324
- const dir = cacheDir ? path9__default.resolve(rootDir, cacheDir) : path9__default.join(process.cwd(), ".cache", "tailwind-styled");
4325
- return path9__default.join(dir, "scanner-cache.json");
4390
+ const dir = cacheDir ? path7.resolve(rootDir, cacheDir) : path7.join(process.cwd(), ".cache", "tailwind-styled");
4391
+ return path7.join(dir, "scanner-cache.json");
4326
4392
  }
4327
4393
  function readCache(rootDir, cacheDir) {
4328
4394
  const cachePath = defaultCachePath(rootDir, cacheDir);
4329
- fs3__default.mkdirSync(path9__default.dirname(cachePath), { recursive: true });
4395
+ fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
4330
4396
  const result = cacheReadNative(cachePath);
4331
4397
  if (!result) return [];
4332
4398
  return result.entries.map((e) => ({
@@ -4341,7 +4407,7 @@ function readCache(rootDir, cacheDir) {
4341
4407
  }
4342
4408
  function writeCache(rootDir, entries, cacheDir) {
4343
4409
  const cachePath = defaultCachePath(rootDir, cacheDir);
4344
- fs3__default.mkdirSync(path9__default.dirname(cachePath), { recursive: true });
4410
+ fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
4345
4411
  const success = cacheWriteNative(cachePath, entries);
4346
4412
  if (!success) {
4347
4413
  throw new Error(
@@ -4360,11 +4426,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
4360
4426
  nowMs
4361
4427
  );
4362
4428
  }
4429
+ var STALE_THRESHOLD_MS;
4363
4430
  var init_cache_native = __esm({
4364
4431
  "packages/domain/scanner/src/cache-native.ts"() {
4432
+ "use strict";
4365
4433
  init_native_bridge();
4434
+ STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
4366
4435
  }
4367
4436
  });
4437
+
4438
+ // packages/domain/scanner/src/parallel-scanner.ts
4439
+ import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
4440
+ import path8 from "path";
4441
+ import { availableParallelism } from "os";
4442
+ import { fileURLToPath as fileURLToPath3 } from "url";
4368
4443
  function collectFiles2(rootDir, extensions, ignoreDirs) {
4369
4444
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
4370
4445
  if (native !== null) return native;
@@ -4405,7 +4480,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
4405
4480
  maxWorkers = Math.max(1, availableParallelism() - 1),
4406
4481
  chunkSize = DEFAULT_CHUNK_SIZE
4407
4482
  } = options;
4408
- const files = collectFiles2(path9__default.resolve(rootDir), extensions, ignoreDirs);
4483
+ const files = collectFiles2(path8.resolve(rootDir), extensions, ignoreDirs);
4409
4484
  if (files.length < PARALLEL_THRESHOLD) {
4410
4485
  return mergeResults(batchExtractClassesNative2(files));
4411
4486
  }
@@ -4424,6 +4499,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
4424
4499
  var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
4425
4500
  var init_parallel_scanner = __esm({
4426
4501
  "packages/domain/scanner/src/parallel-scanner.ts"() {
4502
+ "use strict";
4427
4503
  init_src3();
4428
4504
  init_native_bridge();
4429
4505
  PARALLEL_THRESHOLD = 50;
@@ -4442,12 +4518,16 @@ var init_parallel_scanner = __esm({
4442
4518
  parentPort.postMessage(msg);
4443
4519
  }
4444
4520
  }
4445
- _workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url);
4521
+ _workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
4446
4522
  }
4447
4523
  });
4448
- var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
4524
+
4525
+ // packages/domain/scanner/src/schemas.ts
4526
+ import { z as z3 } from "zod";
4527
+ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
4449
4528
  var init_schemas = __esm({
4450
4529
  "packages/domain/scanner/src/schemas.ts"() {
4530
+ "use strict";
4451
4531
  init_src2();
4452
4532
  formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
4453
4533
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
@@ -4467,40 +4547,40 @@ var init_schemas = __esm({
4467
4547
  parsed.error
4468
4548
  );
4469
4549
  };
4470
- NonNegativeIntegerSchema = z.number().int().min(0);
4471
- ScanWorkspaceOptionsSchema = z.object({
4472
- includeExtensions: z.array(z.string()).optional(),
4473
- ignoreDirectories: z.array(z.string()).optional(),
4474
- useCache: z.boolean().optional(),
4475
- cacheDir: z.string().min(1).optional(),
4476
- smartInvalidation: z.boolean().optional()
4550
+ NonNegativeIntegerSchema = z3.number().int().min(0);
4551
+ ScanWorkspaceOptionsSchema = z3.object({
4552
+ includeExtensions: z3.array(z3.string()).optional(),
4553
+ ignoreDirectories: z3.array(z3.string()).optional(),
4554
+ useCache: z3.boolean().optional(),
4555
+ cacheDir: z3.string().min(1).optional(),
4556
+ smartInvalidation: z3.boolean().optional()
4477
4557
  });
4478
- ScanFileResultSchema = z.object({
4479
- file: z.string(),
4480
- classes: z.array(z.string()),
4481
- hash: z.string().optional()
4558
+ ScanFileResultSchema = z3.object({
4559
+ file: z3.string(),
4560
+ classes: z3.array(z3.string()),
4561
+ hash: z3.string().optional()
4482
4562
  });
4483
- ScanWorkspaceResultSchema = z.object({
4484
- files: z.array(ScanFileResultSchema),
4563
+ ScanWorkspaceResultSchema = z3.object({
4564
+ files: z3.array(ScanFileResultSchema),
4485
4565
  totalFiles: NonNegativeIntegerSchema,
4486
- uniqueClasses: z.array(z.string())
4566
+ uniqueClasses: z3.array(z3.string())
4487
4567
  }).refine((value) => value.totalFiles === value.files.length, {
4488
4568
  message: "scan result totalFiles must match files.length",
4489
4569
  path: ["totalFiles"]
4490
4570
  });
4491
- z.object({
4492
- rootDir: z.string().min(1),
4571
+ ScannerWorkerRequestSchema = z3.object({
4572
+ rootDir: z3.string().min(1),
4493
4573
  options: ScanWorkspaceOptionsSchema.optional()
4494
4574
  });
4495
- ScannerWorkerSuccessMessageSchema = z.object({
4496
- ok: z.literal(true),
4575
+ ScannerWorkerSuccessMessageSchema = z3.object({
4576
+ ok: z3.literal(true),
4497
4577
  result: ScanWorkspaceResultSchema
4498
4578
  });
4499
- ScannerWorkerErrorMessageSchema = z.object({
4500
- ok: z.literal(false),
4501
- error: z.string().optional()
4579
+ ScannerWorkerErrorMessageSchema = z3.object({
4580
+ ok: z3.literal(false),
4581
+ error: z3.string().optional()
4502
4582
  });
4503
- ScannerWorkerMessageSchema = z.union([
4583
+ ScannerWorkerMessageSchema = z3.union([
4504
4584
  ScannerWorkerSuccessMessageSchema,
4505
4585
  ScannerWorkerErrorMessageSchema
4506
4586
  ]);
@@ -4526,12 +4606,17 @@ __export(src_exports2, {
4526
4606
  scanWorkspace: () => scanWorkspace2,
4527
4607
  scanWorkspaceAsync: () => scanWorkspaceAsync
4528
4608
  });
4609
+ import fs7 from "fs";
4610
+ import { createRequire as createRequire6 } from "module";
4611
+ import path9 from "path";
4612
+ import { fileURLToPath as fileURLToPath4 } from "url";
4613
+ import { Worker as Worker2 } from "worker_threads";
4529
4614
  function getRuntimeDir() {
4530
4615
  if (typeof __dirname !== "undefined" && __dirname.length > 0) {
4531
4616
  return __dirname;
4532
4617
  }
4533
4618
  if (typeof import.meta !== "undefined" && import.meta.url) {
4534
- return path9__default.dirname(fileURLToPath(import.meta.url));
4619
+ return path9.dirname(fileURLToPath4(import.meta.url));
4535
4620
  }
4536
4621
  return process.cwd();
4537
4622
  }
@@ -4541,17 +4626,17 @@ function resolveScannerWorkerModulePath() {
4541
4626
  return __dirname;
4542
4627
  }
4543
4628
  if (typeof import.meta !== "undefined" && import.meta.url) {
4544
- return path9__default.dirname(fileURLToPath(import.meta.url));
4629
+ return path9.dirname(fileURLToPath4(import.meta.url));
4545
4630
  }
4546
4631
  return process.cwd();
4547
4632
  })();
4548
4633
  const candidates = [
4549
- path9__default.resolve(runtimeDir, "worker.cjs"),
4550
- path9__default.resolve(runtimeDir, "worker.js"),
4551
- path9__default.resolve(runtimeDir, "worker.ts")
4634
+ path9.resolve(runtimeDir, "worker.cjs"),
4635
+ path9.resolve(runtimeDir, "worker.js"),
4636
+ path9.resolve(runtimeDir, "worker.ts")
4552
4637
  ];
4553
4638
  for (const candidate of candidates) {
4554
- if (fs3__default.existsSync(candidate)) return candidate;
4639
+ if (fs7.existsSync(candidate)) return candidate;
4555
4640
  }
4556
4641
  return null;
4557
4642
  }
@@ -4563,7 +4648,7 @@ function scanWorkspaceInWorker(rootDir, options) {
4563
4648
  }
4564
4649
  return new Promise((resolve2, reject) => {
4565
4650
  const settleState = { settled: false };
4566
- const worker = new Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
4651
+ const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
4567
4652
  const timeout = setTimeout(() => {
4568
4653
  if (!settleState.settled) {
4569
4654
  settleState.settled = true;
@@ -4608,19 +4693,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4608
4693
  if (!currentDir) continue;
4609
4694
  const entries = (() => {
4610
4695
  try {
4611
- return fs3__default.readdirSync(currentDir, { withFileTypes: true });
4696
+ return fs7.readdirSync(currentDir, { withFileTypes: true });
4612
4697
  } catch {
4613
4698
  return [];
4614
4699
  }
4615
4700
  })();
4616
4701
  for (const entry of entries) {
4617
- const fullPath = path9__default.join(currentDir, entry.name);
4702
+ const fullPath = path9.join(currentDir, entry.name);
4618
4703
  if (entry.isDirectory()) {
4619
4704
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
4620
4705
  continue;
4621
4706
  }
4622
4707
  if (!entry.isFile()) continue;
4623
- if (!extensionSet.has(path9__default.extname(entry.name))) continue;
4708
+ if (!extensionSet.has(path9.extname(entry.name))) continue;
4624
4709
  candidates.push(fullPath);
4625
4710
  }
4626
4711
  }
@@ -4647,7 +4732,7 @@ function scanSource(source) {
4647
4732
  );
4648
4733
  }
4649
4734
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4650
- return includeExtensions.includes(path9__default.extname(filePath));
4735
+ return includeExtensions.includes(path9.extname(filePath));
4651
4736
  }
4652
4737
  function scanFile2(filePath) {
4653
4738
  const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
@@ -4667,7 +4752,7 @@ function scanWorkspace2(rootDir, options = {}) {
4667
4752
  const extensionSet = buildExtensionSet(includeExtensions);
4668
4753
  const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
4669
4754
  const useCache = normalizedOptions.useCache ?? true;
4670
- normalizedOptions.smartInvalidation ?? true;
4755
+ const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
4671
4756
  const files = [];
4672
4757
  const unique = /* @__PURE__ */ new Set();
4673
4758
  const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
@@ -4707,7 +4792,7 @@ function scanWorkspace2(rootDir, options = {}) {
4707
4792
  for (const filePath of candidates) {
4708
4793
  const stat = (() => {
4709
4794
  try {
4710
- return fs3__default.statSync(filePath);
4795
+ return fs7.statSync(filePath);
4711
4796
  } catch {
4712
4797
  return null;
4713
4798
  }
@@ -4733,7 +4818,7 @@ function scanWorkspace2(rootDir, options = {}) {
4733
4818
  for (const { filePath, stat, size, cached } of ranked) {
4734
4819
  const content = (() => {
4735
4820
  try {
4736
- return fs3__default.readFileSync(filePath, "utf8");
4821
+ return fs7.readFileSync(filePath, "utf8");
4737
4822
  } catch {
4738
4823
  return null;
4739
4824
  }
@@ -4817,6 +4902,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
4817
4902
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
4818
4903
  var init_src3 = __esm({
4819
4904
  "packages/domain/scanner/src/index.ts"() {
4905
+ "use strict";
4820
4906
  init_src2();
4821
4907
  init_cache_native();
4822
4908
  init_native_bridge();
@@ -4837,7 +4923,7 @@ var init_src3 = __esm({
4837
4923
  const loadNativeParserBinding = () => {
4838
4924
  if (_state.binding !== void 0) return _state.binding;
4839
4925
  const runtimeDir = getRuntimeDir();
4840
- const req = createRequire(path9__default.join(runtimeDir, "noop.cjs"));
4926
+ const req = createRequire6(path9.join(runtimeDir, "noop.cjs"));
4841
4927
  const _platform = process.platform;
4842
4928
  const _arch = process.arch;
4843
4929
  const _platformArch = `${_platform}-${_arch}`;
@@ -4845,27 +4931,27 @@ var init_src3 = __esm({
4845
4931
  const candidates = [
4846
4932
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
4847
4933
  // cwd = repo root saat run dari root, atau package dir saat workspaces
4848
- path9__default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4849
- path9__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4850
- path9__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4934
+ path9.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4935
+ path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4936
+ path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4851
4937
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
4852
4938
  // e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
4853
- path9__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4854
- path9__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4855
- path9__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4939
+ path9.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4940
+ path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4941
+ path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4856
4942
  // runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
4857
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4858
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4943
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4944
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4859
4945
  // 3 level fallback (jika package di-nest lebih dangkal)
4860
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4861
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4946
+ path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4947
+ path9.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4862
4948
  // ── binaryName lama: tailwind_styled_parser (backward compat) ──
4863
- path9__default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4864
- path9__default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4865
- path9__default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4866
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4867
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4868
- path9__default.resolve(
4949
+ path9.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4950
+ path9.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4951
+ path9.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4952
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4953
+ path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4954
+ path9.resolve(
4869
4955
  runtimeDir,
4870
4956
  "..",
4871
4957
  "..",
@@ -4877,7 +4963,7 @@ var init_src3 = __esm({
4877
4963
  )
4878
4964
  ];
4879
4965
  for (const fullPath of candidates) {
4880
- if (!fs3__default.existsSync(fullPath)) continue;
4966
+ if (!fs7.existsSync(fullPath)) continue;
4881
4967
  try {
4882
4968
  const required = req(fullPath);
4883
4969
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4924,6 +5010,7 @@ function getNativeEngineBinding() {
4924
5010
  var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
4925
5011
  var init_native_bridge2 = __esm({
4926
5012
  "packages/domain/engine/src/native-bridge.ts"() {
5013
+ "use strict";
4927
5014
  init_src2();
4928
5015
  log4 = createDebugLogger("engine:native");
4929
5016
  isValidEngineBinding = (module) => {
@@ -5047,6 +5134,7 @@ function createResolutionReason(causes, finalDecision) {
5047
5134
  var RuleId, SelectorId, VariantChainId, PropertyId, ValueId, LayerId, ConditionId, CascadeResolutionId, Origin, Importance, ConditionResult, CascadeStage;
5048
5135
  var init_ir = __esm({
5049
5136
  "packages/domain/engine/src/ir.ts"() {
5137
+ "use strict";
5050
5138
  init_native_bridge2();
5051
5139
  RuleId = class {
5052
5140
  constructor(value) {
@@ -5218,6 +5306,7 @@ function buildResolutionsMap(nativeResult, rules, styleGraph) {
5218
5306
  var CascadeResolver;
5219
5307
  var init_resolver = __esm({
5220
5308
  "packages/domain/engine/src/resolver.ts"() {
5309
+ "use strict";
5221
5310
  init_ir();
5222
5311
  init_native_bridge2();
5223
5312
  CascadeResolver = class {
@@ -5412,7 +5501,7 @@ function _parseCssToIrFallback(css, prefix, native) {
5412
5501
  const parsed = native.parseCssRules(css);
5413
5502
  for (const r of parsed) {
5414
5503
  const className = prefix + r.className;
5415
- r.variants.length > 0;
5504
+ const hasVariants = r.variants.length > 0;
5416
5505
  const layerName = detectLayerFromClassName(className);
5417
5506
  const layer = layerName ? getOrCreateLayerId(layerName) : null;
5418
5507
  const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
@@ -5451,6 +5540,7 @@ function _parseCssToIrFallback(css, prefix, native) {
5451
5540
  var _defaultIdGen, generateRuleId, generateSelectorId, generatePropertyId, generateValueId, generateLayerId, generateConditionId, getNextInsertionOrder, resetIdGenerator, layerMap, layerOrderMap, LAYER_ORDER;
5452
5541
  var init_cssToIr = __esm({
5453
5542
  "packages/domain/engine/src/cssToIr.ts"() {
5543
+ "use strict";
5454
5544
  init_native_bridge2();
5455
5545
  init_ir();
5456
5546
  _defaultIdGen = createIdGenerator();
@@ -5583,18 +5673,26 @@ function trace(className, resolver) {
5583
5673
  }
5584
5674
  var init_trace2 = __esm({
5585
5675
  "packages/domain/engine/src/trace.ts"() {
5676
+ "use strict";
5586
5677
  init_ir();
5587
5678
  }
5588
5679
  });
5589
5680
 
5681
+ // packages/domain/engine/src/index.ts
5682
+ import fs12 from "fs";
5683
+ import path15 from "path";
5684
+ import { pathToFileURL as pathToFileURL2 } from "url";
5685
+
5590
5686
  // packages/domain/analyzer/src/analyzeWorkspace.ts
5591
5687
  init_src3();
5688
+ import path11 from "path";
5592
5689
 
5593
5690
  // packages/domain/analyzer/src/binding.ts
5594
5691
  init_src2();
5595
5692
 
5596
5693
  // packages/domain/analyzer/src/utils.ts
5597
5694
  init_src2();
5695
+ import fs8 from "fs";
5598
5696
  var DEFAULT_TOP_LIMIT = 10;
5599
5697
  var DEFAULT_FREQUENT_THRESHOLD = 2;
5600
5698
  var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
@@ -5608,7 +5706,7 @@ function isRecord(value) {
5608
5706
  }
5609
5707
  async function pathExists(filePath) {
5610
5708
  try {
5611
- await fs3__default.promises.access(filePath, fs3__default.constants.F_OK);
5709
+ await fs8.promises.access(filePath, fs8.constants.F_OK);
5612
5710
  return true;
5613
5711
  } catch {
5614
5712
  return false;
@@ -5707,6 +5805,7 @@ async function requireNativeBinding() {
5707
5805
 
5708
5806
  // packages/domain/analyzer/src/schemas.ts
5709
5807
  init_src2();
5808
+ import { z as z4 } from "zod";
5710
5809
  var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
5711
5810
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
5712
5811
  ).join(".") : "<root>";
@@ -5730,81 +5829,86 @@ var parseWithSchema2 = (schema, data, label) => {
5730
5829
  parsed.error
5731
5830
  );
5732
5831
  };
5733
- var CountSchema = z.number().int().min(0);
5734
- z.object({
5735
- name: z.string(),
5832
+ var CountSchema = z4.number().int().min(0);
5833
+ var ClassUsageSchema = z4.object({
5834
+ name: z4.string(),
5736
5835
  count: CountSchema,
5737
- isUnused: z.boolean().optional(),
5738
- isConflict: z.boolean().optional()
5836
+ isUnused: z4.boolean().optional(),
5837
+ isConflict: z4.boolean().optional()
5739
5838
  });
5740
- z.object({
5741
- className: z.string(),
5742
- variants: z.array(z.string()),
5743
- classes: z.array(z.string()),
5744
- message: z.string()
5839
+ var ClassConflictSchema = z4.object({
5840
+ className: z4.string(),
5841
+ variants: z4.array(z4.string()),
5842
+ classes: z4.array(z4.string()),
5843
+ message: z4.string()
5745
5844
  });
5746
- var ClassCountSchema = z.object({
5747
- name: z.string(),
5845
+ var ClassCountSchema = z4.object({
5846
+ name: z4.string(),
5748
5847
  count: CountSchema
5749
5848
  });
5750
- var NativeReportSchema = z.object({
5751
- root: z.string(),
5849
+ var NativeReportSchema = z4.object({
5850
+ root: z4.string(),
5752
5851
  totalFiles: CountSchema,
5753
5852
  uniqueClassCount: CountSchema,
5754
5853
  totalClassOccurrences: CountSchema,
5755
- topClasses: z.array(ClassCountSchema),
5756
- duplicateCandidates: z.array(ClassCountSchema),
5757
- safelist: z.array(z.string())
5854
+ topClasses: z4.array(ClassCountSchema),
5855
+ duplicateCandidates: z4.array(ClassCountSchema),
5856
+ safelist: z4.array(z4.string())
5758
5857
  });
5759
- z.object({
5760
- css: z.string(),
5761
- resolvedClasses: z.array(z.string()),
5762
- unknownClasses: z.array(z.string()),
5858
+ var NativeCssCompileResultSchema2 = z4.object({
5859
+ css: z4.string(),
5860
+ resolvedClasses: z4.array(z4.string()),
5861
+ unknownClasses: z4.array(z4.string()),
5763
5862
  sizeBytes: CountSchema
5764
5863
  });
5765
- var AnalyzerClassStatsSchema = z.object({
5766
- top: z.number({
5864
+ var AnalyzerClassStatsSchema = z4.object({
5865
+ top: z4.number({
5767
5866
  error: "analyzeWorkspace options.classStats.top must be a number when provided."
5768
5867
  }).finite().optional(),
5769
- frequentThreshold: z.number({
5868
+ frequentThreshold: z4.number({
5770
5869
  error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
5771
5870
  }).finite().optional()
5772
5871
  });
5773
- var AnalyzerSemanticOptionsSchema = z.object({
5774
- tailwindConfigPath: z.string({
5872
+ var AnalyzerSemanticOptionsSchema = z4.object({
5873
+ tailwindConfigPath: z4.string({
5775
5874
  error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5776
5875
  }).min(
5777
5876
  1,
5778
5877
  "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5779
5878
  ).optional()
5780
5879
  });
5781
- var AnalyzerOptionsSchema = z.object({
5782
- scanner: z.custom(
5880
+ var AnalyzerOptionsSchema = z4.object({
5881
+ scanner: z4.custom(
5783
5882
  (value) => isPlainObject(value),
5784
5883
  "analyzeWorkspace options.scanner must be an object when provided."
5785
5884
  ).optional(),
5786
5885
  classStats: AnalyzerClassStatsSchema.optional(),
5787
- semantic: z.union([
5788
- z.boolean({
5886
+ semantic: z4.union([
5887
+ z4.boolean({
5789
5888
  error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
5790
5889
  }),
5791
5890
  AnalyzerSemanticOptionsSchema
5792
5891
  ]).optional(),
5793
- includeClass: z.custom(
5892
+ includeClass: z4.custom(
5794
5893
  (value) => typeof value === "function",
5795
5894
  "analyzeWorkspace options.includeClass must be a function when provided."
5796
5895
  ).optional()
5797
5896
  });
5798
- z.object({
5799
- prefix: z.union([z.string(), z.null()], {
5897
+ var ClassToCssOptionsSchema = z4.object({
5898
+ prefix: z4.union([z4.string(), z4.null()], {
5800
5899
  error: "classToCss options.prefix must be a string or null when provided."
5801
5900
  }).optional(),
5802
- strict: z.boolean({
5901
+ strict: z4.boolean({
5803
5902
  error: "classToCss options.strict must be a boolean when provided."
5804
5903
  }).optional()
5805
5904
  });
5806
5905
  var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
5807
5906
  var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
5907
+
5908
+ // packages/domain/analyzer/src/semantic.ts
5909
+ import fs9 from "fs";
5910
+ import path10 from "path";
5911
+ import { pathToFileURL } from "url";
5808
5912
  var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
5809
5913
  var tailwindConfigCache = /* @__PURE__ */ new Map();
5810
5914
  var detectConflicts2 = async (usages) => {
@@ -5824,11 +5928,11 @@ var detectConflicts2 = async (usages) => {
5824
5928
  };
5825
5929
  };
5826
5930
  var isSupportedTailwindConfigPath = (configPath) => {
5827
- return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path9__default.extname(configPath).toLowerCase());
5931
+ return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path10.extname(configPath).toLowerCase());
5828
5932
  };
5829
5933
  var resolveTailwindConfigPath = async (root, explicitPath) => {
5830
5934
  if (explicitPath) {
5831
- const resolved = path9__default.resolve(root, explicitPath);
5935
+ const resolved = path10.resolve(root, explicitPath);
5832
5936
  if (!await pathExists(resolved)) return null;
5833
5937
  return resolved;
5834
5938
  }
@@ -5839,7 +5943,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
5839
5943
  "tailwind.config.mjs"
5840
5944
  ];
5841
5945
  for (const candidate of candidates) {
5842
- const fullPath = path9__default.resolve(root, candidate);
5946
+ const fullPath = path10.resolve(root, candidate);
5843
5947
  if (await pathExists(fullPath)) return fullPath;
5844
5948
  }
5845
5949
  return null;
@@ -5893,7 +5997,7 @@ var collectCustomUtilities = (config) => {
5893
5997
  return out;
5894
5998
  };
5895
5999
  var collectSafelistFromSource = async (configPath) => {
5896
- const source = await fs3__default.promises.readFile(configPath, "utf8");
6000
+ const source = await fs9.promises.readFile(configPath, "utf8");
5897
6001
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
5898
6002
  const allTokens = extractClassesNative2(source);
5899
6003
  const hasSafelist = source.includes("safelist");
@@ -5920,7 +6024,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
5920
6024
  customUtilities: /* @__PURE__ */ new Set()
5921
6025
  };
5922
6026
  }
5923
- const configStat = await fs3__default.promises.stat(configPath).catch(() => null);
6027
+ const configStat = await fs9.promises.stat(configPath).catch(() => null);
5924
6028
  if (configStat) {
5925
6029
  const cached = tailwindConfigCache.get(configPath);
5926
6030
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -6079,7 +6183,7 @@ async function buildDistribution(usages, native) {
6079
6183
  }
6080
6184
  async function analyzeWorkspace(root, options = {}) {
6081
6185
  const startedAtMs = Date.now();
6082
- const resolvedRoot = path9__default.resolve(root);
6186
+ const resolvedRoot = path11.resolve(root);
6083
6187
  const normalizedOptions = parseAnalyzerOptions(options);
6084
6188
  const scan = await (async () => {
6085
6189
  const scanStartedAtMs = Date.now();
@@ -6191,6 +6295,8 @@ init_src2();
6191
6295
  init_src3();
6192
6296
  init_src2();
6193
6297
  init_native_bridge2();
6298
+ import fs10 from "fs";
6299
+ import path12 from "path";
6194
6300
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
6195
6301
  var log5 = createLogger2("engine:incremental");
6196
6302
  function rebuildWorkspaceResult2(byFile) {
@@ -6223,8 +6329,8 @@ function areClassSetsEqual(a, b) {
6223
6329
  function applyIncrementalChange(previous, filePath, type, scanner) {
6224
6330
  const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
6225
6331
  if (!isScannableFile2(filePath, includeExtensions)) return previous;
6226
- const byFile = new Map(previous.files.map((f) => [path9__default.resolve(f.file), f]));
6227
- const normalizedPath = path9__default.resolve(filePath);
6332
+ const byFile = new Map(previous.files.map((f) => [path12.resolve(f.file), f]));
6333
+ const normalizedPath = path12.resolve(filePath);
6228
6334
  const native = getNativeEngineBinding();
6229
6335
  if (!native?.processFileChange) {
6230
6336
  throw new Error(
@@ -6240,7 +6346,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
6240
6346
  }
6241
6347
  log5.debug(`native change ${normalizedPath}`);
6242
6348
  const scanned = scanFile2(normalizedPath);
6243
- const content = fs3__default.readFileSync(normalizedPath, "utf8");
6349
+ const content = fs10.readFileSync(normalizedPath, "utf8");
6244
6350
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
6245
6351
  const existing = byFile.get(normalizedPath);
6246
6352
  if (diff && existing) {
@@ -6586,12 +6692,16 @@ var EngineMetricsCollector = class {
6586
6692
 
6587
6693
  // packages/domain/engine/src/metricsWriter.ts
6588
6694
  init_src2();
6695
+ import fs11 from "fs";
6696
+ import path13 from "path";
6697
+ import { performance } from "perf_hooks";
6698
+ var _log = createLogger2("tw:metrics");
6589
6699
  var METRICS_FILE_NAME = "metrics.json";
6590
6700
  var CACHE_DIR = ".tw-cache";
6591
6701
  function writeMetrics(metrics, cwd = process.cwd()) {
6592
6702
  try {
6593
- const cacheDir = path9__default.join(cwd, CACHE_DIR);
6594
- fs3__default.mkdirSync(cacheDir, { recursive: true });
6703
+ const cacheDir = path13.join(cwd, CACHE_DIR);
6704
+ fs11.mkdirSync(cacheDir, { recursive: true });
6595
6705
  const mem = process.memoryUsage();
6596
6706
  const data = {
6597
6707
  ...metrics,
@@ -6602,7 +6712,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
6602
6712
  },
6603
6713
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
6604
6714
  };
6605
- fs3__default.writeFileSync(path9__default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
6715
+ fs11.writeFileSync(path13.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
6606
6716
  } catch {
6607
6717
  }
6608
6718
  }
@@ -6654,6 +6764,9 @@ async function runAfterWatch(plugins, context) {
6654
6764
  await plugin.afterWatch?.(context);
6655
6765
  }
6656
6766
  }
6767
+
6768
+ // packages/domain/engine/src/schemas.ts
6769
+ import { z as z5 } from "zod";
6657
6770
  var formatIssues3 = (error) => error.issues.map((issue) => {
6658
6771
  const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
6659
6772
  return `${p}: ${issue.message}`;
@@ -6663,46 +6776,46 @@ var parseWithSchema3 = (schema, data, label) => {
6663
6776
  if (parsed.success) return parsed.data;
6664
6777
  throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
6665
6778
  };
6666
- var EngineOptionsSchema = z.object({
6667
- root: z.string().optional(),
6668
- scanner: z.object({
6669
- includeExtensions: z.array(z.string()).optional(),
6670
- ignoreDirectories: z.array(z.string()).optional(),
6671
- useCache: z.boolean().optional(),
6672
- cacheDir: z.string().min(1).optional(),
6673
- smartInvalidation: z.boolean().optional()
6779
+ var EngineOptionsSchema = z5.object({
6780
+ root: z5.string().optional(),
6781
+ scanner: z5.object({
6782
+ includeExtensions: z5.array(z5.string()).optional(),
6783
+ ignoreDirectories: z5.array(z5.string()).optional(),
6784
+ useCache: z5.boolean().optional(),
6785
+ cacheDir: z5.string().min(1).optional(),
6786
+ smartInvalidation: z5.boolean().optional()
6674
6787
  }).optional(),
6675
- compileCss: z.boolean().optional(),
6676
- tailwindConfigPath: z.string().optional(),
6677
- analyze: z.boolean().optional(),
6678
- plugins: z.array(z.custom()).optional()
6788
+ compileCss: z5.boolean().optional(),
6789
+ tailwindConfigPath: z5.string().optional(),
6790
+ analyze: z5.boolean().optional(),
6791
+ plugins: z5.array(z5.custom()).optional()
6679
6792
  });
6680
- var EngineWatchOptionsSchema = z.object({
6681
- debounceMs: z.number().int().min(0).optional(),
6682
- maxEventsPerFlush: z.number().int().min(1).optional(),
6683
- largeFileThreshold: z.number().int().min(0).optional()
6793
+ var EngineWatchOptionsSchema = z5.object({
6794
+ debounceMs: z5.number().int().min(0).optional(),
6795
+ maxEventsPerFlush: z5.number().int().min(1).optional(),
6796
+ largeFileThreshold: z5.number().int().min(0).optional()
6684
6797
  });
6685
- var BuildResultSchema = z.object({
6686
- scan: z.object({
6687
- files: z.array(
6688
- z.object({ file: z.string(), classes: z.array(z.string()), hash: z.string().optional() })
6798
+ var BuildResultSchema = z5.object({
6799
+ scan: z5.object({
6800
+ files: z5.array(
6801
+ z5.object({ file: z5.string(), classes: z5.array(z5.string()), hash: z5.string().optional() })
6689
6802
  ),
6690
- totalFiles: z.number().int().min(0),
6691
- uniqueClasses: z.array(z.string())
6803
+ totalFiles: z5.number().int().min(0),
6804
+ uniqueClasses: z5.array(z5.string())
6692
6805
  }),
6693
- mergedClassList: z.string(),
6694
- css: z.string(),
6695
- analysis: z.object({
6696
- unusedClasses: z.array(z.string()),
6697
- classConflicts: z.array(
6698
- z.object({
6699
- className: z.string(),
6700
- files: z.array(z.string()),
6701
- classes: z.array(z.string()).optional(),
6702
- message: z.string().optional()
6806
+ mergedClassList: z5.string(),
6807
+ css: z5.string(),
6808
+ analysis: z5.object({
6809
+ unusedClasses: z5.array(z5.string()),
6810
+ classConflicts: z5.array(
6811
+ z5.object({
6812
+ className: z5.string(),
6813
+ files: z5.array(z5.string()),
6814
+ classes: z5.array(z5.string()).optional(),
6815
+ message: z5.string().optional()
6703
6816
  })
6704
6817
  ),
6705
- classUsage: z.record(z.string(), z.number())
6818
+ classUsage: z5.record(z5.string(), z5.number())
6706
6819
  }).optional()
6707
6820
  });
6708
6821
  var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
@@ -6864,6 +6977,8 @@ init_cssToIr();
6864
6977
 
6865
6978
  // packages/domain/engine/src/watch-native.ts
6866
6979
  init_src2();
6980
+ import { createRequire as createRequire7 } from "module";
6981
+ import path14 from "path";
6867
6982
  var watchBindingState = {
6868
6983
  binding: void 0
6869
6984
  };
@@ -6877,27 +6992,27 @@ var getBinding = () => {
6877
6992
  return watchBindingState.binding;
6878
6993
  }
6879
6994
  const runtimeDir = typeof __dirname === "string" ? __dirname : process.cwd();
6880
- const req = createRequire(import.meta.url);
6995
+ const req = createRequire7(import.meta.url);
6881
6996
  const _pa = `${process.platform}-${process.arch}`;
6882
6997
  const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
6883
6998
  const candidates = [
6884
6999
  // new binary name: tailwind-styled-native
6885
- path9__default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
6886
- path9__default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
7000
+ path14.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
7001
+ path14.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
6887
7002
  // npm install case: dist/../native/
6888
- path9__default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
6889
- path9__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
6890
- path9__default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
7003
+ path14.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
7004
+ path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
7005
+ path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6891
7006
  // monorepo dev: 4-level up
6892
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
6893
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
7007
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
7008
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6894
7009
  // 3-level fallback
6895
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
7010
+ path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
6896
7011
  // backward compat: tailwind_styled_parser
6897
- path9__default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
6898
- path9__default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
6899
- path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
6900
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
7012
+ path14.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
7013
+ path14.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
7014
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
7015
+ path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
6901
7016
  ];
6902
7017
  for (const c of candidates) {
6903
7018
  try {
@@ -6918,7 +7033,7 @@ var log6 = createLogger2("engine:watch-native");
6918
7033
  function watchWorkspace2(rootDir, callback, options = {}) {
6919
7034
  const binding = getBinding();
6920
7035
  const pollMs = options.pollIntervalMs ?? 500;
6921
- const resolvedRoot = path9__default.resolve(rootDir);
7036
+ const resolvedRoot = path14.resolve(rootDir);
6922
7037
  const result = (() => {
6923
7038
  try {
6924
7039
  return binding.startWatch(resolvedRoot);
@@ -6955,7 +7070,7 @@ This package requires native Rust bindings.`
6955
7070
  const deduped = /* @__PURE__ */ new Set();
6956
7071
  const events = [];
6957
7072
  for (const e of raw) {
6958
- const absPath = path9__default.isAbsolute(e.path) ? path9__default.normalize(e.path) : path9__default.resolve(resolvedRoot, e.path);
7073
+ const absPath = path14.isAbsolute(e.path) ? path14.normalize(e.path) : path14.resolve(resolvedRoot, e.path);
6959
7074
  const kind = e.kind;
6960
7075
  const key = `${kind}:${absPath}`;
6961
7076
  if (deduped.has(key)) continue;
@@ -6995,11 +7110,11 @@ var configState = {
6995
7110
  var log7 = createLogger2("engine");
6996
7111
  async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
6997
7112
  if (!tailwindConfigPath) return void 0;
6998
- const configPath = path9__default.resolve(root, tailwindConfigPath);
6999
- if (!fs3__default.existsSync(configPath)) {
7113
+ const configPath = path15.resolve(root, tailwindConfigPath);
7114
+ if (!fs12.existsSync(configPath)) {
7000
7115
  throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
7001
7116
  }
7002
- const imported = await import(pathToFileURL(configPath).href);
7117
+ const imported = await import(pathToFileURL2(configPath).href);
7003
7118
  const config = imported.default ?? imported;
7004
7119
  return config;
7005
7120
  }
@@ -7062,11 +7177,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
7062
7177
  };
7063
7178
  }
7064
7179
  function countWorkspacePackages(root) {
7065
- const packagesDir = path9__default.join(root, "packages");
7066
- if (!fs3__default.existsSync(packagesDir)) return 0;
7180
+ const packagesDir = path15.join(root, "packages");
7181
+ if (!fs12.existsSync(packagesDir)) return 0;
7067
7182
  try {
7068
- return fs3__default.readdirSync(packagesDir, { withFileTypes: true }).filter(
7069
- (entry) => entry.isDirectory() && fs3__default.existsSync(path9__default.join(packagesDir, entry.name, "package.json"))
7183
+ return fs12.readdirSync(packagesDir, { withFileTypes: true }).filter(
7184
+ (entry) => entry.isDirectory() && fs12.existsSync(path15.join(packagesDir, entry.name, "package.json"))
7070
7185
  ).length;
7071
7186
  } catch (err) {
7072
7187
  log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
@@ -7103,7 +7218,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
7103
7218
  async function createEngine(rawOptions = {}) {
7104
7219
  const options = parseEngineOptions(rawOptions);
7105
7220
  const root = options.root ?? process.cwd();
7106
- const resolvedRoot = path9__default.resolve(root);
7221
+ const resolvedRoot = path15.resolve(root);
7107
7222
  const plugins = rawOptions.plugins ?? [];
7108
7223
  const getTailwindConfig = async () => {
7109
7224
  if (configState.isLoaded()) return configState.getConfig();
@@ -7250,7 +7365,7 @@ async function createEngine(rawOptions = {}) {
7250
7365
  const shouldForceFullRescan = (event) => {
7251
7366
  if (event.type === "unlink") return false;
7252
7367
  try {
7253
- const stat = fs3__default.statSync(event.filePath);
7368
+ const stat = fs12.statSync(event.filePath);
7254
7369
  if (stat.size > largeFileThreshold) {
7255
7370
  metrics.markSkippedLargeFile();
7256
7371
  return true;
@@ -7368,14 +7483,14 @@ async function createEngine(rawOptions = {}) {
7368
7483
  };
7369
7484
  }
7370
7485
  async function scanWorkspace3(opts = {}) {
7371
- const root = path9__default.resolve(opts.root ?? process.cwd());
7486
+ const root = path15.resolve(opts.root ?? process.cwd());
7372
7487
  return scanWorkspaceAsync(root, {
7373
7488
  includeExtensions: opts.extensions,
7374
7489
  ignoreDirectories: opts.ignoreDirectories
7375
7490
  });
7376
7491
  }
7377
7492
  async function analyzeWorkspace2(opts = {}) {
7378
- const root = path9__default.resolve(opts.root ?? process.cwd());
7493
+ const root = path15.resolve(opts.root ?? process.cwd());
7379
7494
  return analyzeWorkspace(root, {
7380
7495
  classStats: { top: opts.top ?? 20 }
7381
7496
  });
@@ -7447,7 +7562,52 @@ async function inspectClass(className, scanResult, css = "") {
7447
7562
  bundleBytes: impact.bundleSizeBytes
7448
7563
  };
7449
7564
  }
7450
-
7451
- export { BuildResultSchema, BundleAnalyzer, CascadeResolutionId, CascadeResolver, CascadeStage, ConditionId, ConditionResult, EngineMetricsCollector, EngineOptionsSchema, EngineWatchOptionsSchema, ImpactTracker, Importance, LayerId, Origin, PropertyId, ReverseLookup, RuleId, SelectorId, ValueId, VariantChainId, analyzeWorkspace2 as analyzeWorkspace, applyIncrementalChange, build, buildProvenanceChain, createEngine, createFingerprint2 as createFingerprint, createResolutionReason, generateSafelist2 as generateSafelist, inspectClass, parseCssToIr, parseEngineOptions, parseEngineWatchOptions, runAfterBuild, runAfterScan, runAfterWatch, runBeforeBuild, runBeforeScan, runBeforeWatch, runOnError, runTransformClasses, scanWorkspace3 as scanWorkspace, trace, traceClass, traceClasses, watchWorkspace as watchWorkspaceLegacy, watchWorkspace2 as watchWorkspaceNative };
7452
- //# sourceMappingURL=engine.mjs.map
7565
+ export {
7566
+ BuildResultSchema,
7567
+ BundleAnalyzer,
7568
+ CascadeResolutionId,
7569
+ CascadeResolver,
7570
+ CascadeStage,
7571
+ ConditionId,
7572
+ ConditionResult,
7573
+ EngineMetricsCollector,
7574
+ EngineOptionsSchema,
7575
+ EngineWatchOptionsSchema,
7576
+ ImpactTracker,
7577
+ Importance,
7578
+ LayerId,
7579
+ Origin,
7580
+ PropertyId,
7581
+ ReverseLookup,
7582
+ RuleId,
7583
+ SelectorId,
7584
+ ValueId,
7585
+ VariantChainId,
7586
+ analyzeWorkspace2 as analyzeWorkspace,
7587
+ applyIncrementalChange,
7588
+ build,
7589
+ buildProvenanceChain,
7590
+ createEngine,
7591
+ createFingerprint2 as createFingerprint,
7592
+ createResolutionReason,
7593
+ generateSafelist2 as generateSafelist,
7594
+ inspectClass,
7595
+ parseCssToIr,
7596
+ parseEngineOptions,
7597
+ parseEngineWatchOptions,
7598
+ runAfterBuild,
7599
+ runAfterScan,
7600
+ runAfterWatch,
7601
+ runBeforeBuild,
7602
+ runBeforeScan,
7603
+ runBeforeWatch,
7604
+ runOnError,
7605
+ runTransformClasses,
7606
+ scanWorkspace3 as scanWorkspace,
7607
+ trace,
7608
+ traceClass,
7609
+ traceClasses,
7610
+ watchWorkspace as watchWorkspaceLegacy,
7611
+ watchWorkspace2 as watchWorkspaceNative
7612
+ };
7453
7613
  //# sourceMappingURL=engine.mjs.map