tailwind-styled-v4 5.0.37 → 5.0.39

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 (123) hide show
  1. package/dist/analyzer.js +213 -161
  2. package/dist/analyzer.js.map +1 -1
  3. package/dist/analyzer.mjs +121 -83
  4. package/dist/analyzer.mjs.map +1 -1
  5. package/dist/animate.js +131 -87
  6. package/dist/animate.js.map +1 -1
  7. package/dist/animate.mjs +31 -15
  8. package/dist/animate.mjs.map +1 -1
  9. package/dist/atomic.js +107 -67
  10. package/dist/atomic.js.map +1 -1
  11. package/dist/atomic.mjs +47 -14
  12. package/dist/atomic.mjs.map +1 -1
  13. package/dist/cli.js +601 -428
  14. package/dist/cli.js.map +1 -1
  15. package/dist/cli.mjs +504 -313
  16. package/dist/cli.mjs.map +1 -1
  17. package/dist/compiler.js +833 -508
  18. package/dist/compiler.js.map +1 -1
  19. package/dist/compiler.mjs +298 -30
  20. package/dist/compiler.mjs.map +1 -1
  21. package/dist/dashboard.js +72 -41
  22. package/dist/dashboard.js.map +1 -1
  23. package/dist/dashboard.mjs +12 -6
  24. package/dist/dashboard.mjs.map +1 -1
  25. package/dist/devtools.js +335 -289
  26. package/dist/devtools.js.map +1 -1
  27. package/dist/devtools.mjs +28 -11
  28. package/dist/devtools.mjs.map +1 -1
  29. package/dist/engine.js +719 -506
  30. package/dist/engine.js.map +1 -1
  31. package/dist/engine.mjs +520 -318
  32. package/dist/engine.mjs.map +1 -1
  33. package/dist/index.d.mts +145 -319
  34. package/dist/index.d.ts +145 -319
  35. package/dist/index.js +1337 -7442
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +1275 -7386
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/next.js +327 -242
  40. package/dist/next.js.map +1 -1
  41. package/dist/next.mjs +272 -184
  42. package/dist/next.mjs.map +1 -1
  43. package/dist/plugin-api.js +94 -49
  44. package/dist/plugin-api.js.map +1 -1
  45. package/dist/plugin-api.mjs +26 -6
  46. package/dist/plugin-api.mjs.map +1 -1
  47. package/dist/plugin-registry.js +68 -40
  48. package/dist/plugin-registry.js.map +1 -1
  49. package/dist/plugin-registry.mjs +14 -10
  50. package/dist/plugin-registry.mjs.map +1 -1
  51. package/dist/plugin.js +102 -53
  52. package/dist/plugin.js.map +1 -1
  53. package/dist/plugin.mjs +30 -6
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/preset.js +48 -15
  56. package/dist/preset.js.map +1 -1
  57. package/dist/preset.mjs +13 -5
  58. package/dist/preset.mjs.map +1 -1
  59. package/dist/rspack.js +108 -53
  60. package/dist/rspack.js.map +1 -1
  61. package/dist/rspack.mjs +50 -18
  62. package/dist/rspack.mjs.map +1 -1
  63. package/dist/runtime-css.js +63 -24
  64. package/dist/runtime-css.js.map +1 -1
  65. package/dist/runtime-css.mjs +15 -7
  66. package/dist/runtime-css.mjs.map +1 -1
  67. package/dist/runtime.js +98 -44
  68. package/dist/runtime.js.map +1 -1
  69. package/dist/runtime.mjs +31 -8
  70. package/dist/runtime.mjs.map +1 -1
  71. package/dist/scanner.js +164 -120
  72. package/dist/scanner.js.map +1 -1
  73. package/dist/scanner.mjs +70 -40
  74. package/dist/scanner.mjs.map +1 -1
  75. package/dist/shared.d.mts +0 -12
  76. package/dist/shared.d.ts +0 -12
  77. package/dist/shared.js +481 -299
  78. package/dist/shared.js.map +1 -1
  79. package/dist/shared.mjs +304 -133
  80. package/dist/shared.mjs.map +1 -1
  81. package/dist/storybook-addon.js +40 -10
  82. package/dist/storybook-addon.js.map +1 -1
  83. package/dist/storybook-addon.mjs +8 -3
  84. package/dist/storybook-addon.mjs.map +1 -1
  85. package/dist/svelte.js +95 -64
  86. package/dist/svelte.js.map +1 -1
  87. package/dist/svelte.mjs +37 -14
  88. package/dist/svelte.mjs.map +1 -1
  89. package/dist/syntax.js +69 -37
  90. package/dist/syntax.js.map +1 -1
  91. package/dist/syntax.mjs +8 -7
  92. package/dist/syntax.mjs.map +1 -1
  93. package/dist/testing.js +56 -18
  94. package/dist/testing.js.map +1 -1
  95. package/dist/testing.mjs +16 -3
  96. package/dist/testing.mjs.map +1 -1
  97. package/dist/theme.js +133 -74
  98. package/dist/theme.js.map +1 -1
  99. package/dist/theme.mjs +45 -14
  100. package/dist/theme.mjs.map +1 -1
  101. package/dist/turbopackLoader.js +156 -115
  102. package/dist/turbopackLoader.js.map +1 -1
  103. package/dist/turbopackLoader.mjs +135 -82
  104. package/dist/turbopackLoader.mjs.map +1 -1
  105. package/dist/tw.js +584 -423
  106. package/dist/tw.js.map +1 -1
  107. package/dist/tw.mjs +498 -311
  108. package/dist/tw.mjs.map +1 -1
  109. package/dist/vite.js +599 -450
  110. package/dist/vite.js.map +1 -1
  111. package/dist/vite.mjs +484 -332
  112. package/dist/vite.mjs.map +1 -1
  113. package/dist/vue.js +102 -70
  114. package/dist/vue.js.map +1 -1
  115. package/dist/vue.mjs +39 -15
  116. package/dist/vue.mjs.map +1 -1
  117. package/dist/webpackLoader.js +112 -77
  118. package/dist/webpackLoader.js.map +1 -1
  119. package/dist/webpackLoader.mjs +52 -18
  120. package/dist/webpackLoader.mjs.map +1 -1
  121. package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
  122. package/native/tailwind-styled-native.node +0 -0
  123. package/package.json +3 -1
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
  });
@@ -305,48 +300,78 @@ function getNodeModuleRef() {
305
300
  return null;
306
301
  }
307
302
  }
303
+ function getCurrentFileUrl() {
304
+ if (import.meta.url) {
305
+ return import.meta.url;
306
+ }
307
+ if (typeof __filename !== "undefined") {
308
+ return `file://${__filename.replace(/\\/g, "/")}`;
309
+ }
310
+ return "file://unknown";
311
+ }
308
312
  function getNodePath() {
309
313
  if (isBrowser) throw new Error("node:path not available in browser");
310
- const nodeRequire = getNodeModuleRef();
311
- if (!nodeRequire) throw new Error("require not available");
312
- if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)("node:path");
314
+ if (!_nodePath) {
315
+ if (typeof __require === "function") {
316
+ _nodePath = __require("path");
317
+ } else {
318
+ const nodeRequire = getNodeModuleRef();
319
+ if (!nodeRequire) throw new Error("require not available");
320
+ _nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
321
+ }
322
+ }
313
323
  return _nodePath;
314
324
  }
315
325
  function getNodeUrl() {
316
326
  if (isBrowser) throw new Error("node:url not available in browser");
317
- const nodeRequire = getNodeModuleRef();
318
- if (!nodeRequire) throw new Error("require not available");
319
- if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)("node:url");
327
+ if (!_nodeUrl) {
328
+ if (typeof __require === "function") {
329
+ _nodeUrl = __require("url");
330
+ } else {
331
+ const nodeRequire = getNodeModuleRef();
332
+ if (!nodeRequire) throw new Error("require not available");
333
+ _nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
334
+ }
335
+ }
320
336
  return _nodeUrl;
321
337
  }
322
338
  function getNodeFs() {
323
339
  if (isBrowser) throw new Error("node:fs not available in browser");
324
- const nodeRequire = getNodeModuleRef();
325
- if (!nodeRequire) throw new Error("require not available");
326
- if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)("node:fs");
340
+ if (!_nodeFs) {
341
+ if (typeof __require === "function") {
342
+ _nodeFs = __require("fs");
343
+ } else {
344
+ const nodeRequire = getNodeModuleRef();
345
+ if (!nodeRequire) throw new Error("require not available");
346
+ _nodeFs = nodeRequire.createRequire(getCurrentFileUrl())("node:fs");
347
+ }
348
+ }
327
349
  return _nodeFs;
328
350
  }
329
351
  function createEsmRequire(importMetaUrl) {
330
352
  if (isBrowser) throw new Error("require not available in browser");
353
+ if (typeof __require === "function") return __require;
331
354
  const nodeRequire = getNodeModuleRef();
332
355
  if (!nodeRequire) throw new Error("require not available");
333
356
  return nodeRequire.createRequire(importMetaUrl);
334
357
  }
335
358
  function getDirname(importMetaUrl) {
336
359
  if (isBrowser) return "";
360
+ if (typeof __dirname !== "undefined") return __dirname;
337
361
  const nodePath = getNodePath();
338
362
  const nodeUrl = getNodeUrl();
339
363
  return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
340
364
  }
341
365
  function getFilename(importMetaUrl) {
342
366
  if (isBrowser) return "";
367
+ if (typeof __filename !== "undefined") return __filename;
343
368
  return getNodeUrl().fileURLToPath(importMetaUrl);
344
369
  }
345
370
  function resolveFromRoot(...segments) {
346
371
  if (isBrowser) return segments.join("/");
347
372
  const nodePath = getNodePath();
348
373
  const nodeFs = getNodeFs();
349
- let dir = getDirname(import.meta.url);
374
+ let dir = typeof __dirname !== "undefined" ? __dirname : getDirname(getCurrentFileUrl());
350
375
  for (let i = 0; i < 10; i++) {
351
376
  const pkgPath = nodePath.join(dir, "package.json");
352
377
  try {
@@ -375,6 +400,7 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
375
400
  var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
376
401
  var init_esmHelpers = __esm({
377
402
  "packages/domain/shared/src/esmHelpers.ts"() {
403
+ "use strict";
378
404
  isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
379
405
  nodeModuleRef = null;
380
406
  _nodePath = null;
@@ -425,6 +451,7 @@ function createBuildTimer() {
425
451
  var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
426
452
  var init_telemetry = __esm({
427
453
  "packages/domain/shared/src/telemetry.ts"() {
454
+ "use strict";
428
455
  RING_BUFFER_SIZE = 100;
429
456
  TelemetryCollector = class {
430
457
  data = [];
@@ -491,6 +518,9 @@ var init_telemetry = __esm({
491
518
  _globalCollector = null;
492
519
  }
493
520
  });
521
+
522
+ // packages/domain/shared/src/configSchemas.ts
523
+ import { z as z2 } from "zod";
494
524
  function parseJsonWithSchema(jsonString, schema, sourceName) {
495
525
  let parsed;
496
526
  try {
@@ -524,67 +554,68 @@ function parseJsonFileWithSchema(filePath, schema) {
524
554
  var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
525
555
  var init_configSchemas = __esm({
526
556
  "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([])
557
+ "use strict";
558
+ ScanCacheClassEntrySchema = z2.object({
559
+ name: z2.string().min(1),
560
+ usedIn: z2.array(z2.string()),
561
+ risk: z2.enum(["low", "medium", "high"]).default("low"),
562
+ bundleContribution: z2.number().nonnegative().default(0),
563
+ variants: z2.array(z2.string()).default([])
533
564
  });
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()
565
+ ScanCacheSchema = z2.object({
566
+ version: z2.string().default("1"),
567
+ generatedAt: z2.string(),
568
+ root: z2.string(),
569
+ classNames: z2.array(ScanCacheClassEntrySchema),
570
+ totalFiles: z2.number().int().nonnegative(),
571
+ uniqueCount: z2.number().int().nonnegative()
541
572
  });
542
- TailwindContentItemSchema = z.union([
543
- z.string(),
544
- z.object({
545
- raw: z.string(),
546
- extension: z.string().optional()
573
+ TailwindContentItemSchema = z2.union([
574
+ z2.string(),
575
+ z2.object({
576
+ raw: z2.string(),
577
+ extension: z2.string().optional()
547
578
  }),
548
- z.object({
549
- files: z.array(z.string()),
550
- transform: z.record(z.string(), z.unknown()).optional()
579
+ z2.object({
580
+ files: z2.array(z2.string()),
581
+ transform: z2.record(z2.string(), z2.unknown()).optional()
551
582
  })
552
583
  ]);
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()
584
+ TailwindConfigSchema = z2.object({
585
+ content: z2.array(TailwindContentItemSchema).optional(),
586
+ theme: z2.record(z2.string(), z2.unknown()).optional(),
587
+ plugins: z2.array(z2.unknown()).optional(),
588
+ darkMode: z2.union([z2.literal("class"), z2.literal("media"), z2.literal(false)]).optional(),
589
+ prefix: z2.string().optional(),
590
+ safelist: z2.array(z2.union([z2.string(), z2.object({ pattern: z2.instanceof(RegExp) })])).optional(),
591
+ blocklist: z2.array(z2.string()).optional()
561
592
  }).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()
593
+ RegistryPluginEntrySchema = z2.object({
594
+ name: z2.string().min(1),
595
+ description: z2.string(),
596
+ version: z2.string(),
597
+ tags: z2.array(z2.string()).default([]),
598
+ official: z2.boolean().default(false),
599
+ docs: z2.string().url().optional(),
600
+ install: z2.string().optional(),
601
+ integrity: z2.string().optional()
571
602
  });
572
- RegistryFileSchema = z.object({
573
- version: z.string(),
574
- official: z.array(RegistryPluginEntrySchema).default([]),
575
- community: z.array(RegistryPluginEntrySchema).default([])
603
+ RegistryFileSchema = z2.object({
604
+ version: z2.string(),
605
+ official: z2.array(RegistryPluginEntrySchema).default([]),
606
+ community: z2.array(RegistryPluginEntrySchema).default([])
576
607
  });
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()
608
+ PackageJsonSchema = z2.object({
609
+ name: z2.string(),
610
+ version: z2.string(),
611
+ scripts: z2.record(z2.string(), z2.string()).optional(),
612
+ dependencies: z2.record(z2.string(), z2.string()).optional(),
613
+ devDependencies: z2.record(z2.string(), z2.string()).optional(),
614
+ peerDependencies: z2.record(z2.string(), z2.string()).optional(),
615
+ main: z2.string().optional(),
616
+ module: z2.string().optional(),
617
+ exports: z2.unknown().optional(),
618
+ type: z2.enum(["module", "commonjs"]).optional()
588
619
  }).passthrough();
589
620
  }
590
621
  });
@@ -672,6 +703,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
672
703
  var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
673
704
  var init_workerResolver = __esm({
674
705
  "packages/domain/shared/src/workerResolver.ts"() {
706
+ "use strict";
675
707
  isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
676
708
  NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
677
709
  NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
@@ -821,13 +853,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
821
853
  }
822
854
  return lines.join("\n");
823
855
  }
824
- function generateBarrelFile(exports$1, dir, opts = {}) {
856
+ function generateBarrelFile(exports, dir, opts = {}) {
825
857
  const { includeTypes = true } = opts;
826
858
  const lines = [];
827
859
  lines.push(`// Auto-generated barrel file for ${dir}`);
828
860
  lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
829
861
  lines.push(``);
830
- for (const name of exports$1) {
862
+ for (const name of exports) {
831
863
  lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
832
864
  if (includeTypes) {
833
865
  lines.push(`export type * from "./${name}"`);
@@ -837,8 +869,14 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
837
869
  }
838
870
  var init_codegen = __esm({
839
871
  "packages/domain/shared/src/codegen.ts"() {
872
+ "use strict";
840
873
  }
841
874
  });
875
+
876
+ // packages/domain/shared/src/native-resolution.ts
877
+ import { createRequire } from "module";
878
+ import * as fs from "fs";
879
+ import * as path from "path";
842
880
  function platformKey() {
843
881
  if (isBrowser3) return "browser";
844
882
  return `${process.platform}-${process.arch}`;
@@ -854,7 +892,7 @@ function resolveNativeBinary(runtimeDir) {
854
892
  }
855
893
  const envPath = process.env.TW_NATIVE_PATH?.trim();
856
894
  if (envPath) {
857
- if (fs3.existsSync(envPath)) {
895
+ if (fs.existsSync(envPath)) {
858
896
  return { path: envPath, source: "env", platform, tried };
859
897
  }
860
898
  tried.push(`env:${envPath} (not found)`);
@@ -863,7 +901,7 @@ function resolveNativeBinary(runtimeDir) {
863
901
  for (const pkg of prebuiltPkgs) {
864
902
  try {
865
903
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
866
- if (fs3.existsSync(candidate)) {
904
+ if (fs.existsSync(candidate)) {
867
905
  return { path: candidate, source: "prebuilt", platform, tried };
868
906
  }
869
907
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -874,13 +912,13 @@ function resolveNativeBinary(runtimeDir) {
874
912
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
875
913
  const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
876
914
  if (runtimeDir) {
877
- for (const depth of ["..", path9.join("..", ".."), path9.join("..", "..", "..")]) {
878
- const pkgRoot = path9.resolve(runtimeDir, depth);
915
+ for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
916
+ const pkgRoot = path.resolve(runtimeDir, depth);
879
917
  for (const bin of BINARY_NAMES_SELF) {
880
918
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
881
- const candidate = path9.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
919
+ const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
882
920
  tried.push(`self-bundled:${candidate}`);
883
- if (fs3.existsSync(candidate)) {
921
+ if (fs.existsSync(candidate)) {
884
922
  return { path: candidate, source: "prebuilt", platform, tried };
885
923
  }
886
924
  }
@@ -892,29 +930,29 @@ function resolveNativeBinary(runtimeDir) {
892
930
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
893
931
  const localCandidates = [];
894
932
  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`));
933
+ localCandidates.push(path.resolve(base, `${bin}.node`));
934
+ localCandidates.push(path.resolve(base, "..", `${bin}.node`));
935
+ localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
936
+ localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
899
937
  }
900
938
  for (const startDir of [cwd, base]) {
901
939
  let dir = startDir;
902
940
  for (let i = 0; i < 6; i++) {
903
- const nativeDir = path9.resolve(dir, "native");
941
+ const nativeDir = path.resolve(dir, "native");
904
942
  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`));
943
+ localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
944
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
945
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
946
+ localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
909
947
  }
910
- const parent = path9.resolve(dir, "..");
948
+ const parent = path.resolve(dir, "..");
911
949
  if (parent === dir) break;
912
950
  dir = parent;
913
951
  }
914
952
  }
915
953
  for (const candidate of localCandidates) {
916
954
  tried.push(`local:${candidate}`);
917
- if (fs3.existsSync(candidate)) {
955
+ if (fs.existsSync(candidate)) {
918
956
  return { path: candidate, source: "local", platform, tried };
919
957
  }
920
958
  }
@@ -937,8 +975,11 @@ function formatNativeNotFoundError(result) {
937
975
  var isBrowser3, _require, PLATFORM_MAP;
938
976
  var init_native_resolution = __esm({
939
977
  "packages/domain/shared/src/native-resolution.ts"() {
978
+ "use strict";
940
979
  isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
941
- _require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
980
+ _require = createRequire(
981
+ typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
982
+ );
942
983
  PLATFORM_MAP = {
943
984
  "linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
944
985
  "linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
@@ -984,6 +1025,7 @@ function createObservabilityClient(opts = {}) {
984
1025
  }
985
1026
  var init_observability = __esm({
986
1027
  "packages/domain/shared/src/observability.ts"() {
1028
+ "use strict";
987
1029
  }
988
1030
  });
989
1031
 
@@ -991,6 +1033,7 @@ var init_observability = __esm({
991
1033
  var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
992
1034
  var init_nativeBridge = __esm({
993
1035
  "packages/domain/compiler/src/nativeBridge.ts"() {
1036
+ "use strict";
994
1037
  init_src2();
995
1038
  _loadNative = (path16) => __require(path16);
996
1039
  log = (...args) => {
@@ -1130,6 +1173,7 @@ function resetCacheStats() {
1130
1173
  }
1131
1174
  var init_cssGeneratorNative = __esm({
1132
1175
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1176
+ "use strict";
1133
1177
  init_nativeBridge();
1134
1178
  }
1135
1179
  });
@@ -1202,6 +1246,7 @@ function atomicRegistrySize() {
1202
1246
  }
1203
1247
  var init_compilationNative = __esm({
1204
1248
  "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1249
+ "use strict";
1205
1250
  init_nativeBridge();
1206
1251
  }
1207
1252
  });
@@ -1345,6 +1390,7 @@ function twMergeRaw(classLists) {
1345
1390
  }
1346
1391
  var init_cssCompilationNative = __esm({
1347
1392
  "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1393
+ "use strict";
1348
1394
  init_nativeBridge();
1349
1395
  }
1350
1396
  });
@@ -1444,6 +1490,7 @@ function idRegistryImport(importedData) {
1444
1490
  }
1445
1491
  var init_idRegistryNative = __esm({
1446
1492
  "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1493
+ "use strict";
1447
1494
  init_nativeBridge();
1448
1495
  }
1449
1496
  });
@@ -1585,9 +1632,13 @@ function scanFilesBatchNative(filesJson) {
1585
1632
  }
1586
1633
  var init_streamingNative = __esm({
1587
1634
  "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1635
+ "use strict";
1588
1636
  init_nativeBridge();
1589
1637
  }
1590
1638
  });
1639
+
1640
+ // packages/domain/compiler/src/tailwindEngine.ts
1641
+ import { createRequire as createRequire2 } from "module";
1591
1642
  function loadTailwindEngine() {
1592
1643
  if (_twEngine) return _twEngine;
1593
1644
  if (_twEngineError) throw _twEngineError;
@@ -1607,10 +1658,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
1607
1658
  if (classes.length === 0) return "";
1608
1659
  const tw = loadTailwindEngine();
1609
1660
  const input = cssEntryContent ?? "@import 'tailwindcss';";
1610
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1611
- const { dirname, resolve: resolve2 } = await import('path');
1661
+ const { readFileSync, existsSync: existsSync3 } = await import("fs");
1662
+ const { dirname, resolve: resolve2 } = await import("path");
1612
1663
  const projectRoot = root ?? process.cwd();
1613
- const req = createRequire(resolve2(projectRoot, "package.json"));
1664
+ const req = createRequire2(resolve2(projectRoot, "package.json"));
1614
1665
  const loadStylesheet = async (id, base) => {
1615
1666
  try {
1616
1667
  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 +1681,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
1630
1681
  const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1631
1682
  return compiler.build(classes);
1632
1683
  }
1633
- var require2, _twEngine, _twEngineError;
1684
+ var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
1634
1685
  var init_tailwindEngine = __esm({
1635
1686
  "packages/domain/compiler/src/tailwindEngine.ts"() {
1636
- require2 = createRequire(import.meta.url);
1687
+ "use strict";
1688
+ require2 = createRequire2(
1689
+ typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
1690
+ );
1691
+ MAX_CACHE_MEMORY = 256 * 1024;
1637
1692
  _twEngine = null;
1638
1693
  _twEngineError = null;
1639
1694
  }
@@ -1648,6 +1703,7 @@ __export(tailwindEngine_exports, {
1648
1703
  runCssPipeline: () => runCssPipeline,
1649
1704
  runCssPipelineSync: () => runCssPipelineSync
1650
1705
  });
1706
+ import { createRequire as createRequire3 } from "module";
1651
1707
  function _getCacheKey(classes, minify, cssEntry, root) {
1652
1708
  const sorted = [...classes].sort().join(",");
1653
1709
  const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
@@ -1814,24 +1870,29 @@ function processTailwindCssWithTargets(css, targets) {
1814
1870
  }
1815
1871
  return result.css;
1816
1872
  }
1817
- var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1873
+ var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
1818
1874
  var init_tailwindEngine2 = __esm({
1819
1875
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1876
+ "use strict";
1820
1877
  init_nativeBridge();
1821
1878
  init_cssGeneratorNative();
1822
1879
  init_cssCompilationNative();
1823
1880
  init_tailwindEngine();
1824
- createRequire(import.meta.url);
1881
+ require3 = createRequire3(
1882
+ typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
1883
+ );
1825
1884
  _cssCache = /* @__PURE__ */ new Map();
1826
1885
  _cacheHits = 0;
1827
1886
  _cacheMisses = 0;
1828
1887
  MAX_CACHE_SIZE = 100;
1888
+ MAX_CACHE_MEMORY2 = 256 * 1024;
1829
1889
  }
1830
1890
  });
1831
1891
 
1832
1892
  // packages/domain/compiler/src/compiler/index.ts
1833
1893
  var init_compiler = __esm({
1834
1894
  "packages/domain/compiler/src/compiler/index.ts"() {
1895
+ "use strict";
1835
1896
  init_cssGeneratorNative();
1836
1897
  init_compilationNative();
1837
1898
  init_cssCompilationNative();
@@ -1844,6 +1905,7 @@ var init_compiler = __esm({
1844
1905
  var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1845
1906
  var init_parser = __esm({
1846
1907
  "packages/domain/compiler/src/parser/index.ts"() {
1908
+ "use strict";
1847
1909
  init_nativeBridge();
1848
1910
  parseClasses = (raw) => {
1849
1911
  const native = getNativeBridge();
@@ -2022,6 +2084,7 @@ function resetMemoryStats() {
2022
2084
  }
2023
2085
  var init_analyzerNative = __esm({
2024
2086
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
2087
+ "use strict";
2025
2088
  init_nativeBridge();
2026
2089
  }
2027
2090
  });
@@ -2115,6 +2178,7 @@ function resolveSimpleVariants(configJson) {
2115
2178
  }
2116
2179
  var init_themeResolutionNative = __esm({
2117
2180
  "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2181
+ "use strict";
2118
2182
  init_nativeBridge();
2119
2183
  }
2120
2184
  });
@@ -2162,6 +2226,7 @@ function generateSubComponentTypes(root, outputPath) {
2162
2226
  }
2163
2227
  var init_scannerNative = __esm({
2164
2228
  "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2229
+ "use strict";
2165
2230
  init_nativeBridge();
2166
2231
  }
2167
2232
  });
@@ -2169,6 +2234,7 @@ var init_scannerNative = __esm({
2169
2234
  // packages/domain/compiler/src/analyzer/index.ts
2170
2235
  var init_analyzer = __esm({
2171
2236
  "packages/domain/compiler/src/analyzer/index.ts"() {
2237
+ "use strict";
2172
2238
  init_analyzerNative();
2173
2239
  init_themeResolutionNative();
2174
2240
  init_scannerNative();
@@ -2357,6 +2423,7 @@ function resetResolverPoolStats() {
2357
2423
  }
2358
2424
  var init_cacheNative = __esm({
2359
2425
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
2426
+ "use strict";
2360
2427
  init_nativeBridge();
2361
2428
  }
2362
2429
  });
@@ -2364,6 +2431,7 @@ var init_cacheNative = __esm({
2364
2431
  // packages/domain/compiler/src/cache/index.ts
2365
2432
  var init_cache = __esm({
2366
2433
  "packages/domain/compiler/src/cache/index.ts"() {
2434
+ "use strict";
2367
2435
  init_cacheNative();
2368
2436
  }
2369
2437
  });
@@ -2612,6 +2680,7 @@ function redisDiagnose() {
2612
2680
  }
2613
2681
  var init_redisNative = __esm({
2614
2682
  "packages/domain/compiler/src/redis/redisNative.ts"() {
2683
+ "use strict";
2615
2684
  init_nativeBridge();
2616
2685
  }
2617
2686
  });
@@ -2619,6 +2688,7 @@ var init_redisNative = __esm({
2619
2688
  // packages/domain/compiler/src/redis/index.ts
2620
2689
  var init_redis = __esm({
2621
2690
  "packages/domain/compiler/src/redis/index.ts"() {
2691
+ "use strict";
2622
2692
  init_redisNative();
2623
2693
  }
2624
2694
  });
@@ -2757,6 +2827,7 @@ function getCompilerDiagnostics() {
2757
2827
  }
2758
2828
  var init_watchSystemNative = __esm({
2759
2829
  "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
2830
+ "use strict";
2760
2831
  init_nativeBridge();
2761
2832
  }
2762
2833
  });
@@ -2764,9 +2835,15 @@ var init_watchSystemNative = __esm({
2764
2835
  // packages/domain/compiler/src/watch/index.ts
2765
2836
  var init_watch = __esm({
2766
2837
  "packages/domain/compiler/src/watch/index.ts"() {
2838
+ "use strict";
2767
2839
  init_watchSystemNative();
2768
2840
  }
2769
2841
  });
2842
+
2843
+ // packages/domain/compiler/src/index.ts
2844
+ import fs2 from "fs";
2845
+ import path2 from "path";
2846
+ import { createRequire as createRequire4 } from "module";
2770
2847
  function _layoutClassesToCss(classes) {
2771
2848
  const native = getNativeBridge();
2772
2849
  if (!native?.layoutClassesToCss) {
@@ -2804,6 +2881,7 @@ function extractContainerCssFromSource(source) {
2804
2881
  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
2882
  var init_src = __esm({
2806
2883
  "packages/domain/compiler/src/index.ts"() {
2884
+ "use strict";
2807
2885
  init_nativeBridge();
2808
2886
  init_compiler();
2809
2887
  init_parser();
@@ -2811,7 +2889,9 @@ var init_src = __esm({
2811
2889
  init_cache();
2812
2890
  init_redis();
2813
2891
  init_watch();
2814
- _require2 = createRequire(import.meta.url);
2892
+ _require2 = createRequire4(
2893
+ typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
2894
+ );
2815
2895
  transformSource = (source, opts) => {
2816
2896
  const native = getNativeBridge();
2817
2897
  if (!native?.transformSource) {
@@ -2903,7 +2983,7 @@ var init_src = __esm({
2903
2983
  };
2904
2984
  scanProjectUsage = (dirs, cwd) => {
2905
2985
  const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
2906
- const files = dirs.map((dir) => path9__default.resolve(cwd, dir));
2986
+ const files = dirs.map((dir) => path2.resolve(cwd, dir));
2907
2987
  const results = batchExtractClasses2(files) || [];
2908
2988
  const combined = {};
2909
2989
  for (const result of results) {
@@ -2920,13 +3000,13 @@ var init_src = __esm({
2920
3000
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
2921
3001
  const allClasses = Object.keys(classes).sort();
2922
3002
  if (outputPath) {
2923
- fs3__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3003
+ fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
2924
3004
  }
2925
3005
  return allClasses;
2926
3006
  };
2927
3007
  loadSafelist = (safelistPath) => {
2928
3008
  try {
2929
- const content = fs3__default.readFileSync(safelistPath, "utf-8");
3009
+ const content = fs2.readFileSync(safelistPath, "utf-8");
2930
3010
  return JSON.parse(content);
2931
3011
  } catch {
2932
3012
  return [];
@@ -2940,8 +3020,8 @@ var init_src = __esm({
2940
3020
  "tailwind.config.cjs"
2941
3021
  ];
2942
3022
  for (const file of configFiles) {
2943
- const fullPath = path9__default.join(cwd, file);
2944
- if (fs3__default.existsSync(fullPath)) {
3023
+ const fullPath = path2.join(cwd, file);
3024
+ if (fs2.existsSync(fullPath)) {
2945
3025
  const mod = __require(fullPath);
2946
3026
  return mod.default || mod;
2947
3027
  }
@@ -2951,9 +3031,9 @@ var init_src = __esm({
2951
3031
  getContentPaths = (cwd = process.cwd()) => {
2952
3032
  return {
2953
3033
  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}")
3034
+ path2.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3035
+ path2.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3036
+ path2.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
2957
3037
  ]
2958
3038
  };
2959
3039
  };
@@ -3367,6 +3447,7 @@ __export(internal_exports, {
3367
3447
  });
3368
3448
  var init_internal = __esm({
3369
3449
  "packages/domain/compiler/src/internal.ts"() {
3450
+ "use strict";
3370
3451
  init_src();
3371
3452
  init_tailwindEngine2();
3372
3453
  init_compiler();
@@ -3377,6 +3458,10 @@ var init_internal = __esm({
3377
3458
  init_watch();
3378
3459
  }
3379
3460
  });
3461
+
3462
+ // packages/domain/shared/src/staticStateExtractor.ts
3463
+ import fs3 from "fs";
3464
+ import path3 from "path";
3380
3465
  function getNative() {
3381
3466
  if (_native) return _native;
3382
3467
  try {
@@ -3406,17 +3491,17 @@ function getNative() {
3406
3491
  function* walkSourceFiles(dir) {
3407
3492
  let entries;
3408
3493
  try {
3409
- entries = fs3__default.readdirSync(dir, { withFileTypes: true });
3494
+ entries = fs3.readdirSync(dir, { withFileTypes: true });
3410
3495
  } catch {
3411
3496
  return;
3412
3497
  }
3413
3498
  for (const entry of entries) {
3414
- const fullPath = path9__default.join(dir, entry.name);
3499
+ const fullPath = path3.join(dir, entry.name);
3415
3500
  if (entry.isDirectory()) {
3416
3501
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
3417
3502
  yield* walkSourceFiles(fullPath);
3418
3503
  } else if (entry.isFile()) {
3419
- const ext = path9__default.extname(entry.name);
3504
+ const ext = path3.extname(entry.name);
3420
3505
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
3421
3506
  }
3422
3507
  }
@@ -3480,7 +3565,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3480
3565
  allConfigs.push(...configs);
3481
3566
  if (verbose) {
3482
3567
  process.stderr.write(
3483
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3568
+ `[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
3484
3569
  `
3485
3570
  );
3486
3571
  }
@@ -3491,7 +3576,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3491
3576
  if (filesScanned >= maxFiles) break;
3492
3577
  let source;
3493
3578
  try {
3494
- source = fs3__default.readFileSync(filePath, "utf-8");
3579
+ source = fs3.readFileSync(filePath, "utf-8");
3495
3580
  } catch {
3496
3581
  continue;
3497
3582
  }
@@ -3504,7 +3589,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3504
3589
  allConfigs.push(...configs);
3505
3590
  if (verbose) {
3506
3591
  process.stderr.write(
3507
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3592
+ `[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
3508
3593
  `
3509
3594
  );
3510
3595
  }
@@ -3598,12 +3683,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3598
3683
  resolvedCss: options.resolvedCss || ""
3599
3684
  // ← ensure always passed
3600
3685
  });
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);
3686
+ const twClassesDir = path3.join(path3.dirname(safelistPath), "tw-classes");
3687
+ fs3.mkdirSync(twClassesDir, { recursive: true });
3688
+ const stateFilePath = path3.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3604
3689
  if (result.rulesGenerated === 0) {
3605
3690
  try {
3606
- fs3__default.writeFileSync(
3691
+ fs3.writeFileSync(
3607
3692
  stateFilePath,
3608
3693
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3609
3694
  "utf-8"
@@ -3613,7 +3698,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3613
3698
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3614
3699
  }
3615
3700
  try {
3616
- fs3__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3701
+ fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3617
3702
  return [
3618
3703
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3619
3704
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3628,12 +3713,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3628
3713
  var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3629
3714
  var init_staticStateExtractor = __esm({
3630
3715
  "packages/domain/shared/src/staticStateExtractor.ts"() {
3716
+ "use strict";
3631
3717
  SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
3632
3718
  IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
3633
3719
  _native = null;
3634
3720
  TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
3635
3721
  }
3636
3722
  });
3723
+
3724
+ // packages/domain/shared/src/logger.ts
3725
+ import fs4 from "fs";
3726
+ import path4 from "path";
3637
3727
  function getEnvLevel() {
3638
3728
  const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
3639
3729
  if (env && env in LEVELS) return env;
@@ -3643,8 +3733,8 @@ function setGlobalLogFile(filePath) {
3643
3733
  _globalLogFile = filePath;
3644
3734
  _logFileInitialized = false;
3645
3735
  try {
3646
- fs3__default.mkdirSync(path9__default.dirname(filePath), { recursive: true });
3647
- fs3__default.writeFileSync(
3736
+ fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
3737
+ fs4.writeFileSync(
3648
3738
  filePath,
3649
3739
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3650
3740
  `,
@@ -3657,13 +3747,13 @@ function setGlobalLogFile(filePath) {
3657
3747
  function writeToFile(line) {
3658
3748
  if (!_globalLogFile || !_logFileInitialized) return;
3659
3749
  try {
3660
- fs3__default.appendFileSync(_globalLogFile, line);
3750
+ fs4.appendFileSync(_globalLogFile, line);
3661
3751
  } catch {
3662
3752
  }
3663
3753
  }
3664
3754
  function createLogger(prefix, level) {
3665
3755
  const loggerState = {
3666
- currentLevel: getEnvLevel(),
3756
+ currentLevel: level ?? getEnvLevel(),
3667
3757
  setLevel(l) {
3668
3758
  this.currentLevel = l;
3669
3759
  }
@@ -3684,13 +3774,14 @@ function createLogger(prefix, level) {
3684
3774
  setLogFile: (filePath) => setGlobalLogFile(filePath)
3685
3775
  };
3686
3776
  }
3687
- var LEVELS, _globalLogFile, _logFileInitialized;
3777
+ var LEVELS, _globalLogFile, _logFileInitialized, logger;
3688
3778
  var init_logger = __esm({
3689
3779
  "packages/domain/shared/src/logger.ts"() {
3780
+ "use strict";
3690
3781
  LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3691
3782
  _globalLogFile = null;
3692
3783
  _logFileInitialized = false;
3693
- createLogger("tailwind-styled");
3784
+ logger = createLogger("tailwind-styled");
3694
3785
  }
3695
3786
  });
3696
3787
 
@@ -3766,6 +3857,11 @@ __export(src_exports, {
3766
3857
  tryRequire: () => tryRequire,
3767
3858
  wrapUnknownError: () => wrapUnknownError
3768
3859
  });
3860
+ import { createHash } from "crypto";
3861
+ import fs5 from "fs";
3862
+ import path5 from "path";
3863
+ import { fileURLToPath } from "url";
3864
+ import { createRequire as createRequire5 } from "module";
3769
3865
  function createLogger2(namespace) {
3770
3866
  const prefix = `[${namespace}]`;
3771
3867
  return {
@@ -3811,9 +3907,9 @@ function loadNativeBinding(options) {
3811
3907
  const { runtimeDir, candidates, isValid } = options;
3812
3908
  const loadErrors = [];
3813
3909
  for (const candidate of candidates) {
3814
- const candidatePath = path9__default.resolve(runtimeDir, candidate);
3910
+ const candidatePath = path5.resolve(runtimeDir, candidate);
3815
3911
  try {
3816
- if (!fs3__default.existsSync(candidatePath) && !fs3__default.existsSync(candidatePath + ".node")) {
3912
+ if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
3817
3913
  continue;
3818
3914
  }
3819
3915
  const mod = requireNativeModule(candidatePath);
@@ -3845,9 +3941,9 @@ function resolveNativeBindingCandidates(options) {
3845
3941
  }
3846
3942
  }
3847
3943
  if (!includeDefaultCandidates) return candidates;
3848
- if (fs3__default.existsSync(runtimeDir)) {
3944
+ if (fs5.existsSync(runtimeDir)) {
3849
3945
  try {
3850
- for (const entry of fs3__default.readdirSync(runtimeDir)) {
3946
+ for (const entry of fs5.readdirSync(runtimeDir)) {
3851
3947
  if (entry.endsWith(".node")) candidates.push(entry);
3852
3948
  }
3853
3949
  } catch {
@@ -3856,22 +3952,22 @@ function resolveNativeBindingCandidates(options) {
3856
3952
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3857
3953
  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
3954
  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`));
3955
+ candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
3956
+ candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3957
+ candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
3958
+ candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3959
+ candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
3960
+ candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3961
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3962
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3963
+ candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3868
3964
  }
3869
3965
  return Array.from(new Set(candidates));
3870
3966
  }
3871
3967
  function resolveRuntimeDir(dir, importMetaUrl) {
3872
- if (dir) return path9__default.resolve(dir);
3968
+ if (dir) return path5.resolve(dir);
3873
3969
  try {
3874
- return path9__default.dirname(fileURLToPath(importMetaUrl));
3970
+ return path5.dirname(fileURLToPath(importMetaUrl));
3875
3971
  } catch {
3876
3972
  return process.cwd();
3877
3973
  }
@@ -3888,6 +3984,7 @@ function formatErrorMessage(error) {
3888
3984
  var TwError, _require3, LRUCache;
3889
3985
  var init_src2 = __esm({
3890
3986
  "packages/domain/shared/src/index.ts"() {
3987
+ "use strict";
3891
3988
  init_trace();
3892
3989
  init_error_codes();
3893
3990
  init_compatibility();
@@ -3953,7 +4050,9 @@ var init_src2 = __esm({
3953
4050
  return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
3954
4051
  }
3955
4052
  };
3956
- _require3 = createRequire(import.meta.url);
4053
+ _require3 = createRequire5(
4054
+ typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
4055
+ );
3957
4056
  LRUCache = class {
3958
4057
  capacity;
3959
4058
  cache;
@@ -4027,12 +4126,14 @@ __export(native_bridge_exports, {
4027
4126
  startWatchNative: () => startWatchNative,
4028
4127
  stopWatchNative: () => stopWatchNative
4029
4128
  });
4129
+ import path6 from "path";
4130
+ import { fileURLToPath as fileURLToPath2 } from "url";
4030
4131
  function getDirname2() {
4031
4132
  if (typeof __dirname !== "undefined") {
4032
4133
  return __dirname;
4033
4134
  }
4034
4135
  if (typeof import.meta !== "undefined" && import.meta.url) {
4035
- return path9__default.dirname(fileURLToPath(import.meta.url));
4136
+ return path6.dirname(fileURLToPath2(import.meta.url));
4036
4137
  }
4037
4138
  return process.cwd();
4038
4139
  }
@@ -4240,6 +4341,7 @@ function hasNativeWatchBinding() {
4240
4341
  var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
4241
4342
  var init_native_bridge = __esm({
4242
4343
  "packages/domain/scanner/src/native-bridge.ts"() {
4344
+ "use strict";
4243
4345
  init_src2();
4244
4346
  log2 = createDebugLogger("scanner:native");
4245
4347
  isValidScannerBinding = (module) => {
@@ -4320,13 +4422,17 @@ var init_native_bridge = __esm({
4320
4422
  resetScannerBridgeCache = scannerBridgeLoader.reset;
4321
4423
  }
4322
4424
  });
4425
+
4426
+ // packages/domain/scanner/src/cache-native.ts
4427
+ import fs6 from "fs";
4428
+ import path7 from "path";
4323
4429
  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");
4430
+ const dir = cacheDir ? path7.resolve(rootDir, cacheDir) : path7.join(process.cwd(), ".cache", "tailwind-styled");
4431
+ return path7.join(dir, "scanner-cache.json");
4326
4432
  }
4327
4433
  function readCache(rootDir, cacheDir) {
4328
4434
  const cachePath = defaultCachePath(rootDir, cacheDir);
4329
- fs3__default.mkdirSync(path9__default.dirname(cachePath), { recursive: true });
4435
+ fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
4330
4436
  const result = cacheReadNative(cachePath);
4331
4437
  if (!result) return [];
4332
4438
  return result.entries.map((e) => ({
@@ -4341,7 +4447,7 @@ function readCache(rootDir, cacheDir) {
4341
4447
  }
4342
4448
  function writeCache(rootDir, entries, cacheDir) {
4343
4449
  const cachePath = defaultCachePath(rootDir, cacheDir);
4344
- fs3__default.mkdirSync(path9__default.dirname(cachePath), { recursive: true });
4450
+ fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
4345
4451
  const success = cacheWriteNative(cachePath, entries);
4346
4452
  if (!success) {
4347
4453
  throw new Error(
@@ -4360,11 +4466,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
4360
4466
  nowMs
4361
4467
  );
4362
4468
  }
4469
+ var STALE_THRESHOLD_MS;
4363
4470
  var init_cache_native = __esm({
4364
4471
  "packages/domain/scanner/src/cache-native.ts"() {
4472
+ "use strict";
4365
4473
  init_native_bridge();
4474
+ STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
4366
4475
  }
4367
4476
  });
4477
+
4478
+ // packages/domain/scanner/src/parallel-scanner.ts
4479
+ import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
4480
+ import path8 from "path";
4481
+ import { availableParallelism } from "os";
4482
+ import { fileURLToPath as fileURLToPath3 } from "url";
4368
4483
  function collectFiles2(rootDir, extensions, ignoreDirs) {
4369
4484
  const native = collectFilesNative(rootDir, extensions, ignoreDirs);
4370
4485
  if (native !== null) return native;
@@ -4405,7 +4520,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
4405
4520
  maxWorkers = Math.max(1, availableParallelism() - 1),
4406
4521
  chunkSize = DEFAULT_CHUNK_SIZE
4407
4522
  } = options;
4408
- const files = collectFiles2(path9__default.resolve(rootDir), extensions, ignoreDirs);
4523
+ const files = collectFiles2(path8.resolve(rootDir), extensions, ignoreDirs);
4409
4524
  if (files.length < PARALLEL_THRESHOLD) {
4410
4525
  return mergeResults(batchExtractClassesNative2(files));
4411
4526
  }
@@ -4424,6 +4539,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
4424
4539
  var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
4425
4540
  var init_parallel_scanner = __esm({
4426
4541
  "packages/domain/scanner/src/parallel-scanner.ts"() {
4542
+ "use strict";
4427
4543
  init_src3();
4428
4544
  init_native_bridge();
4429
4545
  PARALLEL_THRESHOLD = 50;
@@ -4442,12 +4558,16 @@ var init_parallel_scanner = __esm({
4442
4558
  parentPort.postMessage(msg);
4443
4559
  }
4444
4560
  }
4445
- _workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url);
4561
+ _workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
4446
4562
  }
4447
4563
  });
4448
- var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
4564
+
4565
+ // packages/domain/scanner/src/schemas.ts
4566
+ import { z as z3 } from "zod";
4567
+ var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
4449
4568
  var init_schemas = __esm({
4450
4569
  "packages/domain/scanner/src/schemas.ts"() {
4570
+ "use strict";
4451
4571
  init_src2();
4452
4572
  formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
4453
4573
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
@@ -4467,40 +4587,40 @@ var init_schemas = __esm({
4467
4587
  parsed.error
4468
4588
  );
4469
4589
  };
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()
4590
+ NonNegativeIntegerSchema = z3.number().int().min(0);
4591
+ ScanWorkspaceOptionsSchema = z3.object({
4592
+ includeExtensions: z3.array(z3.string()).optional(),
4593
+ ignoreDirectories: z3.array(z3.string()).optional(),
4594
+ useCache: z3.boolean().optional(),
4595
+ cacheDir: z3.string().min(1).optional(),
4596
+ smartInvalidation: z3.boolean().optional()
4477
4597
  });
4478
- ScanFileResultSchema = z.object({
4479
- file: z.string(),
4480
- classes: z.array(z.string()),
4481
- hash: z.string().optional()
4598
+ ScanFileResultSchema = z3.object({
4599
+ file: z3.string(),
4600
+ classes: z3.array(z3.string()),
4601
+ hash: z3.string().optional()
4482
4602
  });
4483
- ScanWorkspaceResultSchema = z.object({
4484
- files: z.array(ScanFileResultSchema),
4603
+ ScanWorkspaceResultSchema = z3.object({
4604
+ files: z3.array(ScanFileResultSchema),
4485
4605
  totalFiles: NonNegativeIntegerSchema,
4486
- uniqueClasses: z.array(z.string())
4606
+ uniqueClasses: z3.array(z3.string())
4487
4607
  }).refine((value) => value.totalFiles === value.files.length, {
4488
4608
  message: "scan result totalFiles must match files.length",
4489
4609
  path: ["totalFiles"]
4490
4610
  });
4491
- z.object({
4492
- rootDir: z.string().min(1),
4611
+ ScannerWorkerRequestSchema = z3.object({
4612
+ rootDir: z3.string().min(1),
4493
4613
  options: ScanWorkspaceOptionsSchema.optional()
4494
4614
  });
4495
- ScannerWorkerSuccessMessageSchema = z.object({
4496
- ok: z.literal(true),
4615
+ ScannerWorkerSuccessMessageSchema = z3.object({
4616
+ ok: z3.literal(true),
4497
4617
  result: ScanWorkspaceResultSchema
4498
4618
  });
4499
- ScannerWorkerErrorMessageSchema = z.object({
4500
- ok: z.literal(false),
4501
- error: z.string().optional()
4619
+ ScannerWorkerErrorMessageSchema = z3.object({
4620
+ ok: z3.literal(false),
4621
+ error: z3.string().optional()
4502
4622
  });
4503
- ScannerWorkerMessageSchema = z.union([
4623
+ ScannerWorkerMessageSchema = z3.union([
4504
4624
  ScannerWorkerSuccessMessageSchema,
4505
4625
  ScannerWorkerErrorMessageSchema
4506
4626
  ]);
@@ -4526,12 +4646,17 @@ __export(src_exports2, {
4526
4646
  scanWorkspace: () => scanWorkspace2,
4527
4647
  scanWorkspaceAsync: () => scanWorkspaceAsync
4528
4648
  });
4649
+ import fs7 from "fs";
4650
+ import { createRequire as createRequire6 } from "module";
4651
+ import path9 from "path";
4652
+ import { fileURLToPath as fileURLToPath4 } from "url";
4653
+ import { Worker as Worker2 } from "worker_threads";
4529
4654
  function getRuntimeDir() {
4530
4655
  if (typeof __dirname !== "undefined" && __dirname.length > 0) {
4531
4656
  return __dirname;
4532
4657
  }
4533
4658
  if (typeof import.meta !== "undefined" && import.meta.url) {
4534
- return path9__default.dirname(fileURLToPath(import.meta.url));
4659
+ return path9.dirname(fileURLToPath4(import.meta.url));
4535
4660
  }
4536
4661
  return process.cwd();
4537
4662
  }
@@ -4541,17 +4666,17 @@ function resolveScannerWorkerModulePath() {
4541
4666
  return __dirname;
4542
4667
  }
4543
4668
  if (typeof import.meta !== "undefined" && import.meta.url) {
4544
- return path9__default.dirname(fileURLToPath(import.meta.url));
4669
+ return path9.dirname(fileURLToPath4(import.meta.url));
4545
4670
  }
4546
4671
  return process.cwd();
4547
4672
  })();
4548
4673
  const candidates = [
4549
- path9__default.resolve(runtimeDir, "worker.cjs"),
4550
- path9__default.resolve(runtimeDir, "worker.js"),
4551
- path9__default.resolve(runtimeDir, "worker.ts")
4674
+ path9.resolve(runtimeDir, "worker.cjs"),
4675
+ path9.resolve(runtimeDir, "worker.js"),
4676
+ path9.resolve(runtimeDir, "worker.ts")
4552
4677
  ];
4553
4678
  for (const candidate of candidates) {
4554
- if (fs3__default.existsSync(candidate)) return candidate;
4679
+ if (fs7.existsSync(candidate)) return candidate;
4555
4680
  }
4556
4681
  return null;
4557
4682
  }
@@ -4563,7 +4688,7 @@ function scanWorkspaceInWorker(rootDir, options) {
4563
4688
  }
4564
4689
  return new Promise((resolve2, reject) => {
4565
4690
  const settleState = { settled: false };
4566
- const worker = new Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
4691
+ const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
4567
4692
  const timeout = setTimeout(() => {
4568
4693
  if (!settleState.settled) {
4569
4694
  settleState.settled = true;
@@ -4608,19 +4733,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
4608
4733
  if (!currentDir) continue;
4609
4734
  const entries = (() => {
4610
4735
  try {
4611
- return fs3__default.readdirSync(currentDir, { withFileTypes: true });
4736
+ return fs7.readdirSync(currentDir, { withFileTypes: true });
4612
4737
  } catch {
4613
4738
  return [];
4614
4739
  }
4615
4740
  })();
4616
4741
  for (const entry of entries) {
4617
- const fullPath = path9__default.join(currentDir, entry.name);
4742
+ const fullPath = path9.join(currentDir, entry.name);
4618
4743
  if (entry.isDirectory()) {
4619
4744
  if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
4620
4745
  continue;
4621
4746
  }
4622
4747
  if (!entry.isFile()) continue;
4623
- if (!extensionSet.has(path9__default.extname(entry.name))) continue;
4748
+ if (!extensionSet.has(path9.extname(entry.name))) continue;
4624
4749
  candidates.push(fullPath);
4625
4750
  }
4626
4751
  }
@@ -4647,7 +4772,7 @@ function scanSource(source) {
4647
4772
  );
4648
4773
  }
4649
4774
  function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
4650
- return includeExtensions.includes(path9__default.extname(filePath));
4775
+ return includeExtensions.includes(path9.extname(filePath));
4651
4776
  }
4652
4777
  function scanFile2(filePath) {
4653
4778
  const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
@@ -4667,7 +4792,7 @@ function scanWorkspace2(rootDir, options = {}) {
4667
4792
  const extensionSet = buildExtensionSet(includeExtensions);
4668
4793
  const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
4669
4794
  const useCache = normalizedOptions.useCache ?? true;
4670
- normalizedOptions.smartInvalidation ?? true;
4795
+ const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
4671
4796
  const files = [];
4672
4797
  const unique = /* @__PURE__ */ new Set();
4673
4798
  const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
@@ -4707,7 +4832,7 @@ function scanWorkspace2(rootDir, options = {}) {
4707
4832
  for (const filePath of candidates) {
4708
4833
  const stat = (() => {
4709
4834
  try {
4710
- return fs3__default.statSync(filePath);
4835
+ return fs7.statSync(filePath);
4711
4836
  } catch {
4712
4837
  return null;
4713
4838
  }
@@ -4733,7 +4858,7 @@ function scanWorkspace2(rootDir, options = {}) {
4733
4858
  for (const { filePath, stat, size, cached } of ranked) {
4734
4859
  const content = (() => {
4735
4860
  try {
4736
- return fs3__default.readFileSync(filePath, "utf8");
4861
+ return fs7.readFileSync(filePath, "utf8");
4737
4862
  } catch {
4738
4863
  return null;
4739
4864
  }
@@ -4817,6 +4942,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
4817
4942
  var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
4818
4943
  var init_src3 = __esm({
4819
4944
  "packages/domain/scanner/src/index.ts"() {
4945
+ "use strict";
4820
4946
  init_src2();
4821
4947
  init_cache_native();
4822
4948
  init_native_bridge();
@@ -4837,7 +4963,7 @@ var init_src3 = __esm({
4837
4963
  const loadNativeParserBinding = () => {
4838
4964
  if (_state.binding !== void 0) return _state.binding;
4839
4965
  const runtimeDir = getRuntimeDir();
4840
- const req = createRequire(path9__default.join(runtimeDir, "noop.cjs"));
4966
+ const req = createRequire6(path9.join(runtimeDir, "noop.cjs"));
4841
4967
  const _platform = process.platform;
4842
4968
  const _arch = process.arch;
4843
4969
  const _platformArch = `${_platform}-${_arch}`;
@@ -4845,27 +4971,27 @@ var init_src3 = __esm({
4845
4971
  const candidates = [
4846
4972
  // ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
4847
4973
  // 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`),
4974
+ path9.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
4975
+ path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
4976
+ path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4851
4977
  // runtimeDir = dist/ → naik 1 level ke package root (npm install case)
4852
4978
  // 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`),
4979
+ path9.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
4980
+ path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
4981
+ path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4856
4982
  // 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`),
4983
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
4984
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4859
4985
  // 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`),
4986
+ path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
4987
+ path9.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
4862
4988
  // ── 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(
4989
+ path9.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
4990
+ path9.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
4991
+ path9.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
4992
+ path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
4993
+ path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4994
+ path9.resolve(
4869
4995
  runtimeDir,
4870
4996
  "..",
4871
4997
  "..",
@@ -4877,7 +5003,7 @@ var init_src3 = __esm({
4877
5003
  )
4878
5004
  ];
4879
5005
  for (const fullPath of candidates) {
4880
- if (!fs3__default.existsSync(fullPath)) continue;
5006
+ if (!fs7.existsSync(fullPath)) continue;
4881
5007
  try {
4882
5008
  const required = req(fullPath);
4883
5009
  if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
@@ -4924,6 +5050,7 @@ function getNativeEngineBinding() {
4924
5050
  var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
4925
5051
  var init_native_bridge2 = __esm({
4926
5052
  "packages/domain/engine/src/native-bridge.ts"() {
5053
+ "use strict";
4927
5054
  init_src2();
4928
5055
  log4 = createDebugLogger("engine:native");
4929
5056
  isValidEngineBinding = (module) => {
@@ -5047,6 +5174,7 @@ function createResolutionReason(causes, finalDecision) {
5047
5174
  var RuleId, SelectorId, VariantChainId, PropertyId, ValueId, LayerId, ConditionId, CascadeResolutionId, Origin, Importance, ConditionResult, CascadeStage;
5048
5175
  var init_ir = __esm({
5049
5176
  "packages/domain/engine/src/ir.ts"() {
5177
+ "use strict";
5050
5178
  init_native_bridge2();
5051
5179
  RuleId = class {
5052
5180
  constructor(value) {
@@ -5218,6 +5346,7 @@ function buildResolutionsMap(nativeResult, rules, styleGraph) {
5218
5346
  var CascadeResolver;
5219
5347
  var init_resolver = __esm({
5220
5348
  "packages/domain/engine/src/resolver.ts"() {
5349
+ "use strict";
5221
5350
  init_ir();
5222
5351
  init_native_bridge2();
5223
5352
  CascadeResolver = class {
@@ -5412,7 +5541,7 @@ function _parseCssToIrFallback(css, prefix, native) {
5412
5541
  const parsed = native.parseCssRules(css);
5413
5542
  for (const r of parsed) {
5414
5543
  const className = prefix + r.className;
5415
- r.variants.length > 0;
5544
+ const hasVariants = r.variants.length > 0;
5416
5545
  const layerName = detectLayerFromClassName(className);
5417
5546
  const layer = layerName ? getOrCreateLayerId(layerName) : null;
5418
5547
  const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
@@ -5451,6 +5580,7 @@ function _parseCssToIrFallback(css, prefix, native) {
5451
5580
  var _defaultIdGen, generateRuleId, generateSelectorId, generatePropertyId, generateValueId, generateLayerId, generateConditionId, getNextInsertionOrder, resetIdGenerator, layerMap, layerOrderMap, LAYER_ORDER;
5452
5581
  var init_cssToIr = __esm({
5453
5582
  "packages/domain/engine/src/cssToIr.ts"() {
5583
+ "use strict";
5454
5584
  init_native_bridge2();
5455
5585
  init_ir();
5456
5586
  _defaultIdGen = createIdGenerator();
@@ -5583,18 +5713,26 @@ function trace(className, resolver) {
5583
5713
  }
5584
5714
  var init_trace2 = __esm({
5585
5715
  "packages/domain/engine/src/trace.ts"() {
5716
+ "use strict";
5586
5717
  init_ir();
5587
5718
  }
5588
5719
  });
5589
5720
 
5721
+ // packages/domain/engine/src/index.ts
5722
+ import fs12 from "fs";
5723
+ import path15 from "path";
5724
+ import { pathToFileURL as pathToFileURL2 } from "url";
5725
+
5590
5726
  // packages/domain/analyzer/src/analyzeWorkspace.ts
5591
5727
  init_src3();
5728
+ import path11 from "path";
5592
5729
 
5593
5730
  // packages/domain/analyzer/src/binding.ts
5594
5731
  init_src2();
5595
5732
 
5596
5733
  // packages/domain/analyzer/src/utils.ts
5597
5734
  init_src2();
5735
+ import fs8 from "fs";
5598
5736
  var DEFAULT_TOP_LIMIT = 10;
5599
5737
  var DEFAULT_FREQUENT_THRESHOLD = 2;
5600
5738
  var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
@@ -5608,7 +5746,7 @@ function isRecord(value) {
5608
5746
  }
5609
5747
  async function pathExists(filePath) {
5610
5748
  try {
5611
- await fs3__default.promises.access(filePath, fs3__default.constants.F_OK);
5749
+ await fs8.promises.access(filePath, fs8.constants.F_OK);
5612
5750
  return true;
5613
5751
  } catch {
5614
5752
  return false;
@@ -5707,6 +5845,7 @@ async function requireNativeBinding() {
5707
5845
 
5708
5846
  // packages/domain/analyzer/src/schemas.ts
5709
5847
  init_src2();
5848
+ import { z as z4 } from "zod";
5710
5849
  var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
5711
5850
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
5712
5851
  ).join(".") : "<root>";
@@ -5730,81 +5869,86 @@ var parseWithSchema2 = (schema, data, label) => {
5730
5869
  parsed.error
5731
5870
  );
5732
5871
  };
5733
- var CountSchema = z.number().int().min(0);
5734
- z.object({
5735
- name: z.string(),
5872
+ var CountSchema = z4.number().int().min(0);
5873
+ var ClassUsageSchema = z4.object({
5874
+ name: z4.string(),
5736
5875
  count: CountSchema,
5737
- isUnused: z.boolean().optional(),
5738
- isConflict: z.boolean().optional()
5876
+ isUnused: z4.boolean().optional(),
5877
+ isConflict: z4.boolean().optional()
5739
5878
  });
5740
- z.object({
5741
- className: z.string(),
5742
- variants: z.array(z.string()),
5743
- classes: z.array(z.string()),
5744
- message: z.string()
5879
+ var ClassConflictSchema = z4.object({
5880
+ className: z4.string(),
5881
+ variants: z4.array(z4.string()),
5882
+ classes: z4.array(z4.string()),
5883
+ message: z4.string()
5745
5884
  });
5746
- var ClassCountSchema = z.object({
5747
- name: z.string(),
5885
+ var ClassCountSchema = z4.object({
5886
+ name: z4.string(),
5748
5887
  count: CountSchema
5749
5888
  });
5750
- var NativeReportSchema = z.object({
5751
- root: z.string(),
5889
+ var NativeReportSchema = z4.object({
5890
+ root: z4.string(),
5752
5891
  totalFiles: CountSchema,
5753
5892
  uniqueClassCount: CountSchema,
5754
5893
  totalClassOccurrences: CountSchema,
5755
- topClasses: z.array(ClassCountSchema),
5756
- duplicateCandidates: z.array(ClassCountSchema),
5757
- safelist: z.array(z.string())
5894
+ topClasses: z4.array(ClassCountSchema),
5895
+ duplicateCandidates: z4.array(ClassCountSchema),
5896
+ safelist: z4.array(z4.string())
5758
5897
  });
5759
- z.object({
5760
- css: z.string(),
5761
- resolvedClasses: z.array(z.string()),
5762
- unknownClasses: z.array(z.string()),
5898
+ var NativeCssCompileResultSchema2 = z4.object({
5899
+ css: z4.string(),
5900
+ resolvedClasses: z4.array(z4.string()),
5901
+ unknownClasses: z4.array(z4.string()),
5763
5902
  sizeBytes: CountSchema
5764
5903
  });
5765
- var AnalyzerClassStatsSchema = z.object({
5766
- top: z.number({
5904
+ var AnalyzerClassStatsSchema = z4.object({
5905
+ top: z4.number({
5767
5906
  error: "analyzeWorkspace options.classStats.top must be a number when provided."
5768
5907
  }).finite().optional(),
5769
- frequentThreshold: z.number({
5908
+ frequentThreshold: z4.number({
5770
5909
  error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
5771
5910
  }).finite().optional()
5772
5911
  });
5773
- var AnalyzerSemanticOptionsSchema = z.object({
5774
- tailwindConfigPath: z.string({
5912
+ var AnalyzerSemanticOptionsSchema = z4.object({
5913
+ tailwindConfigPath: z4.string({
5775
5914
  error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5776
5915
  }).min(
5777
5916
  1,
5778
5917
  "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5779
5918
  ).optional()
5780
5919
  });
5781
- var AnalyzerOptionsSchema = z.object({
5782
- scanner: z.custom(
5920
+ var AnalyzerOptionsSchema = z4.object({
5921
+ scanner: z4.custom(
5783
5922
  (value) => isPlainObject(value),
5784
5923
  "analyzeWorkspace options.scanner must be an object when provided."
5785
5924
  ).optional(),
5786
5925
  classStats: AnalyzerClassStatsSchema.optional(),
5787
- semantic: z.union([
5788
- z.boolean({
5926
+ semantic: z4.union([
5927
+ z4.boolean({
5789
5928
  error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
5790
5929
  }),
5791
5930
  AnalyzerSemanticOptionsSchema
5792
5931
  ]).optional(),
5793
- includeClass: z.custom(
5932
+ includeClass: z4.custom(
5794
5933
  (value) => typeof value === "function",
5795
5934
  "analyzeWorkspace options.includeClass must be a function when provided."
5796
5935
  ).optional()
5797
5936
  });
5798
- z.object({
5799
- prefix: z.union([z.string(), z.null()], {
5937
+ var ClassToCssOptionsSchema = z4.object({
5938
+ prefix: z4.union([z4.string(), z4.null()], {
5800
5939
  error: "classToCss options.prefix must be a string or null when provided."
5801
5940
  }).optional(),
5802
- strict: z.boolean({
5941
+ strict: z4.boolean({
5803
5942
  error: "classToCss options.strict must be a boolean when provided."
5804
5943
  }).optional()
5805
5944
  });
5806
5945
  var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
5807
5946
  var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
5947
+
5948
+ // packages/domain/analyzer/src/semantic.ts
5949
+ import fs9 from "fs";
5950
+ import path10 from "path";
5951
+ import { pathToFileURL } from "url";
5808
5952
  var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
5809
5953
  var tailwindConfigCache = /* @__PURE__ */ new Map();
5810
5954
  var detectConflicts2 = async (usages) => {
@@ -5824,11 +5968,11 @@ var detectConflicts2 = async (usages) => {
5824
5968
  };
5825
5969
  };
5826
5970
  var isSupportedTailwindConfigPath = (configPath) => {
5827
- return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path9__default.extname(configPath).toLowerCase());
5971
+ return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path10.extname(configPath).toLowerCase());
5828
5972
  };
5829
5973
  var resolveTailwindConfigPath = async (root, explicitPath) => {
5830
5974
  if (explicitPath) {
5831
- const resolved = path9__default.resolve(root, explicitPath);
5975
+ const resolved = path10.resolve(root, explicitPath);
5832
5976
  if (!await pathExists(resolved)) return null;
5833
5977
  return resolved;
5834
5978
  }
@@ -5839,7 +5983,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
5839
5983
  "tailwind.config.mjs"
5840
5984
  ];
5841
5985
  for (const candidate of candidates) {
5842
- const fullPath = path9__default.resolve(root, candidate);
5986
+ const fullPath = path10.resolve(root, candidate);
5843
5987
  if (await pathExists(fullPath)) return fullPath;
5844
5988
  }
5845
5989
  return null;
@@ -5893,7 +6037,7 @@ var collectCustomUtilities = (config) => {
5893
6037
  return out;
5894
6038
  };
5895
6039
  var collectSafelistFromSource = async (configPath) => {
5896
- const source = await fs3__default.promises.readFile(configPath, "utf8");
6040
+ const source = await fs9.promises.readFile(configPath, "utf8");
5897
6041
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
5898
6042
  const allTokens = extractClassesNative2(source);
5899
6043
  const hasSafelist = source.includes("safelist");
@@ -5920,7 +6064,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
5920
6064
  customUtilities: /* @__PURE__ */ new Set()
5921
6065
  };
5922
6066
  }
5923
- const configStat = await fs3__default.promises.stat(configPath).catch(() => null);
6067
+ const configStat = await fs9.promises.stat(configPath).catch(() => null);
5924
6068
  if (configStat) {
5925
6069
  const cached = tailwindConfigCache.get(configPath);
5926
6070
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -6079,7 +6223,7 @@ async function buildDistribution(usages, native) {
6079
6223
  }
6080
6224
  async function analyzeWorkspace(root, options = {}) {
6081
6225
  const startedAtMs = Date.now();
6082
- const resolvedRoot = path9__default.resolve(root);
6226
+ const resolvedRoot = path11.resolve(root);
6083
6227
  const normalizedOptions = parseAnalyzerOptions(options);
6084
6228
  const scan = await (async () => {
6085
6229
  const scanStartedAtMs = Date.now();
@@ -6191,6 +6335,8 @@ init_src2();
6191
6335
  init_src3();
6192
6336
  init_src2();
6193
6337
  init_native_bridge2();
6338
+ import fs10 from "fs";
6339
+ import path12 from "path";
6194
6340
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
6195
6341
  var log5 = createLogger2("engine:incremental");
6196
6342
  function rebuildWorkspaceResult2(byFile) {
@@ -6223,8 +6369,8 @@ function areClassSetsEqual(a, b) {
6223
6369
  function applyIncrementalChange(previous, filePath, type, scanner) {
6224
6370
  const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
6225
6371
  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);
6372
+ const byFile = new Map(previous.files.map((f) => [path12.resolve(f.file), f]));
6373
+ const normalizedPath = path12.resolve(filePath);
6228
6374
  const native = getNativeEngineBinding();
6229
6375
  if (!native?.processFileChange) {
6230
6376
  throw new Error(
@@ -6240,7 +6386,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
6240
6386
  }
6241
6387
  log5.debug(`native change ${normalizedPath}`);
6242
6388
  const scanned = scanFile2(normalizedPath);
6243
- const content = fs3__default.readFileSync(normalizedPath, "utf8");
6389
+ const content = fs10.readFileSync(normalizedPath, "utf8");
6244
6390
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
6245
6391
  const existing = byFile.get(normalizedPath);
6246
6392
  if (diff && existing) {
@@ -6586,12 +6732,16 @@ var EngineMetricsCollector = class {
6586
6732
 
6587
6733
  // packages/domain/engine/src/metricsWriter.ts
6588
6734
  init_src2();
6735
+ import fs11 from "fs";
6736
+ import path13 from "path";
6737
+ import { performance } from "perf_hooks";
6738
+ var _log = createLogger2("tw:metrics");
6589
6739
  var METRICS_FILE_NAME = "metrics.json";
6590
6740
  var CACHE_DIR = ".tw-cache";
6591
6741
  function writeMetrics(metrics, cwd = process.cwd()) {
6592
6742
  try {
6593
- const cacheDir = path9__default.join(cwd, CACHE_DIR);
6594
- fs3__default.mkdirSync(cacheDir, { recursive: true });
6743
+ const cacheDir = path13.join(cwd, CACHE_DIR);
6744
+ fs11.mkdirSync(cacheDir, { recursive: true });
6595
6745
  const mem = process.memoryUsage();
6596
6746
  const data = {
6597
6747
  ...metrics,
@@ -6602,7 +6752,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
6602
6752
  },
6603
6753
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
6604
6754
  };
6605
- fs3__default.writeFileSync(path9__default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
6755
+ fs11.writeFileSync(path13.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
6606
6756
  } catch {
6607
6757
  }
6608
6758
  }
@@ -6654,6 +6804,9 @@ async function runAfterWatch(plugins, context) {
6654
6804
  await plugin.afterWatch?.(context);
6655
6805
  }
6656
6806
  }
6807
+
6808
+ // packages/domain/engine/src/schemas.ts
6809
+ import { z as z5 } from "zod";
6657
6810
  var formatIssues3 = (error) => error.issues.map((issue) => {
6658
6811
  const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
6659
6812
  return `${p}: ${issue.message}`;
@@ -6663,46 +6816,46 @@ var parseWithSchema3 = (schema, data, label) => {
6663
6816
  if (parsed.success) return parsed.data;
6664
6817
  throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
6665
6818
  };
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()
6819
+ var EngineOptionsSchema = z5.object({
6820
+ root: z5.string().optional(),
6821
+ scanner: z5.object({
6822
+ includeExtensions: z5.array(z5.string()).optional(),
6823
+ ignoreDirectories: z5.array(z5.string()).optional(),
6824
+ useCache: z5.boolean().optional(),
6825
+ cacheDir: z5.string().min(1).optional(),
6826
+ smartInvalidation: z5.boolean().optional()
6674
6827
  }).optional(),
6675
- compileCss: z.boolean().optional(),
6676
- tailwindConfigPath: z.string().optional(),
6677
- analyze: z.boolean().optional(),
6678
- plugins: z.array(z.custom()).optional()
6828
+ compileCss: z5.boolean().optional(),
6829
+ tailwindConfigPath: z5.string().optional(),
6830
+ analyze: z5.boolean().optional(),
6831
+ plugins: z5.array(z5.custom()).optional()
6679
6832
  });
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()
6833
+ var EngineWatchOptionsSchema = z5.object({
6834
+ debounceMs: z5.number().int().min(0).optional(),
6835
+ maxEventsPerFlush: z5.number().int().min(1).optional(),
6836
+ largeFileThreshold: z5.number().int().min(0).optional()
6684
6837
  });
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() })
6838
+ var BuildResultSchema = z5.object({
6839
+ scan: z5.object({
6840
+ files: z5.array(
6841
+ z5.object({ file: z5.string(), classes: z5.array(z5.string()), hash: z5.string().optional() })
6689
6842
  ),
6690
- totalFiles: z.number().int().min(0),
6691
- uniqueClasses: z.array(z.string())
6843
+ totalFiles: z5.number().int().min(0),
6844
+ uniqueClasses: z5.array(z5.string())
6692
6845
  }),
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()
6846
+ mergedClassList: z5.string(),
6847
+ css: z5.string(),
6848
+ analysis: z5.object({
6849
+ unusedClasses: z5.array(z5.string()),
6850
+ classConflicts: z5.array(
6851
+ z5.object({
6852
+ className: z5.string(),
6853
+ files: z5.array(z5.string()),
6854
+ classes: z5.array(z5.string()).optional(),
6855
+ message: z5.string().optional()
6703
6856
  })
6704
6857
  ),
6705
- classUsage: z.record(z.string(), z.number())
6858
+ classUsage: z5.record(z5.string(), z5.number())
6706
6859
  }).optional()
6707
6860
  });
6708
6861
  var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
@@ -6864,6 +7017,8 @@ init_cssToIr();
6864
7017
 
6865
7018
  // packages/domain/engine/src/watch-native.ts
6866
7019
  init_src2();
7020
+ import { createRequire as createRequire7 } from "module";
7021
+ import path14 from "path";
6867
7022
  var watchBindingState = {
6868
7023
  binding: void 0
6869
7024
  };
@@ -6877,27 +7032,29 @@ var getBinding = () => {
6877
7032
  return watchBindingState.binding;
6878
7033
  }
6879
7034
  const runtimeDir = typeof __dirname === "string" ? __dirname : process.cwd();
6880
- const req = createRequire(import.meta.url);
7035
+ const req = createRequire7(
7036
+ typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
7037
+ );
6881
7038
  const _pa = `${process.platform}-${process.arch}`;
6882
7039
  const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
6883
7040
  const candidates = [
6884
7041
  // 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`),
7042
+ path14.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
7043
+ path14.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
6887
7044
  // 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`),
7045
+ path14.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
7046
+ path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
7047
+ path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6891
7048
  // 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`),
7049
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
7050
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
6894
7051
  // 3-level fallback
6895
- path9__default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
7052
+ path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
6896
7053
  // 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")
7054
+ path14.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
7055
+ path14.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
7056
+ path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
7057
+ path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
6901
7058
  ];
6902
7059
  for (const c of candidates) {
6903
7060
  try {
@@ -6918,7 +7075,7 @@ var log6 = createLogger2("engine:watch-native");
6918
7075
  function watchWorkspace2(rootDir, callback, options = {}) {
6919
7076
  const binding = getBinding();
6920
7077
  const pollMs = options.pollIntervalMs ?? 500;
6921
- const resolvedRoot = path9__default.resolve(rootDir);
7078
+ const resolvedRoot = path14.resolve(rootDir);
6922
7079
  const result = (() => {
6923
7080
  try {
6924
7081
  return binding.startWatch(resolvedRoot);
@@ -6955,7 +7112,7 @@ This package requires native Rust bindings.`
6955
7112
  const deduped = /* @__PURE__ */ new Set();
6956
7113
  const events = [];
6957
7114
  for (const e of raw) {
6958
- const absPath = path9__default.isAbsolute(e.path) ? path9__default.normalize(e.path) : path9__default.resolve(resolvedRoot, e.path);
7115
+ const absPath = path14.isAbsolute(e.path) ? path14.normalize(e.path) : path14.resolve(resolvedRoot, e.path);
6959
7116
  const kind = e.kind;
6960
7117
  const key = `${kind}:${absPath}`;
6961
7118
  if (deduped.has(key)) continue;
@@ -6995,11 +7152,11 @@ var configState = {
6995
7152
  var log7 = createLogger2("engine");
6996
7153
  async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
6997
7154
  if (!tailwindConfigPath) return void 0;
6998
- const configPath = path9__default.resolve(root, tailwindConfigPath);
6999
- if (!fs3__default.existsSync(configPath)) {
7155
+ const configPath = path15.resolve(root, tailwindConfigPath);
7156
+ if (!fs12.existsSync(configPath)) {
7000
7157
  throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
7001
7158
  }
7002
- const imported = await import(pathToFileURL(configPath).href);
7159
+ const imported = await import(pathToFileURL2(configPath).href);
7003
7160
  const config = imported.default ?? imported;
7004
7161
  return config;
7005
7162
  }
@@ -7062,11 +7219,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
7062
7219
  };
7063
7220
  }
7064
7221
  function countWorkspacePackages(root) {
7065
- const packagesDir = path9__default.join(root, "packages");
7066
- if (!fs3__default.existsSync(packagesDir)) return 0;
7222
+ const packagesDir = path15.join(root, "packages");
7223
+ if (!fs12.existsSync(packagesDir)) return 0;
7067
7224
  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"))
7225
+ return fs12.readdirSync(packagesDir, { withFileTypes: true }).filter(
7226
+ (entry) => entry.isDirectory() && fs12.existsSync(path15.join(packagesDir, entry.name, "package.json"))
7070
7227
  ).length;
7071
7228
  } catch (err) {
7072
7229
  log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
@@ -7103,7 +7260,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
7103
7260
  async function createEngine(rawOptions = {}) {
7104
7261
  const options = parseEngineOptions(rawOptions);
7105
7262
  const root = options.root ?? process.cwd();
7106
- const resolvedRoot = path9__default.resolve(root);
7263
+ const resolvedRoot = path15.resolve(root);
7107
7264
  const plugins = rawOptions.plugins ?? [];
7108
7265
  const getTailwindConfig = async () => {
7109
7266
  if (configState.isLoaded()) return configState.getConfig();
@@ -7250,7 +7407,7 @@ async function createEngine(rawOptions = {}) {
7250
7407
  const shouldForceFullRescan = (event) => {
7251
7408
  if (event.type === "unlink") return false;
7252
7409
  try {
7253
- const stat = fs3__default.statSync(event.filePath);
7410
+ const stat = fs12.statSync(event.filePath);
7254
7411
  if (stat.size > largeFileThreshold) {
7255
7412
  metrics.markSkippedLargeFile();
7256
7413
  return true;
@@ -7368,14 +7525,14 @@ async function createEngine(rawOptions = {}) {
7368
7525
  };
7369
7526
  }
7370
7527
  async function scanWorkspace3(opts = {}) {
7371
- const root = path9__default.resolve(opts.root ?? process.cwd());
7528
+ const root = path15.resolve(opts.root ?? process.cwd());
7372
7529
  return scanWorkspaceAsync(root, {
7373
7530
  includeExtensions: opts.extensions,
7374
7531
  ignoreDirectories: opts.ignoreDirectories
7375
7532
  });
7376
7533
  }
7377
7534
  async function analyzeWorkspace2(opts = {}) {
7378
- const root = path9__default.resolve(opts.root ?? process.cwd());
7535
+ const root = path15.resolve(opts.root ?? process.cwd());
7379
7536
  return analyzeWorkspace(root, {
7380
7537
  classStats: { top: opts.top ?? 20 }
7381
7538
  });
@@ -7447,7 +7604,52 @@ async function inspectClass(className, scanResult, css = "") {
7447
7604
  bundleBytes: impact.bundleSizeBytes
7448
7605
  };
7449
7606
  }
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
7607
+ export {
7608
+ BuildResultSchema,
7609
+ BundleAnalyzer,
7610
+ CascadeResolutionId,
7611
+ CascadeResolver,
7612
+ CascadeStage,
7613
+ ConditionId,
7614
+ ConditionResult,
7615
+ EngineMetricsCollector,
7616
+ EngineOptionsSchema,
7617
+ EngineWatchOptionsSchema,
7618
+ ImpactTracker,
7619
+ Importance,
7620
+ LayerId,
7621
+ Origin,
7622
+ PropertyId,
7623
+ ReverseLookup,
7624
+ RuleId,
7625
+ SelectorId,
7626
+ ValueId,
7627
+ VariantChainId,
7628
+ analyzeWorkspace2 as analyzeWorkspace,
7629
+ applyIncrementalChange,
7630
+ build,
7631
+ buildProvenanceChain,
7632
+ createEngine,
7633
+ createFingerprint2 as createFingerprint,
7634
+ createResolutionReason,
7635
+ generateSafelist2 as generateSafelist,
7636
+ inspectClass,
7637
+ parseCssToIr,
7638
+ parseEngineOptions,
7639
+ parseEngineWatchOptions,
7640
+ runAfterBuild,
7641
+ runAfterScan,
7642
+ runAfterWatch,
7643
+ runBeforeBuild,
7644
+ runBeforeScan,
7645
+ runBeforeWatch,
7646
+ runOnError,
7647
+ runTransformClasses,
7648
+ scanWorkspace3 as scanWorkspace,
7649
+ trace,
7650
+ traceClass,
7651
+ traceClasses,
7652
+ watchWorkspace as watchWorkspaceLegacy,
7653
+ watchWorkspace2 as watchWorkspaceNative
7654
+ };
7453
7655
  //# sourceMappingURL=engine.mjs.map