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/vite.mjs CHANGED
@@ -1,15 +1,3 @@
1
- import { z } from 'zod';
2
- import { createRequire } from 'module';
3
- import * as fs13 from 'fs';
4
- import fs13__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 (fs13.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 (fs13.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 (fs13.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 (fs13.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
 
@@ -1022,6 +1064,7 @@ function resetCacheStats() {
1022
1064
  }
1023
1065
  var init_cssGeneratorNative = __esm({
1024
1066
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
1067
+ "use strict";
1025
1068
  init_nativeBridge();
1026
1069
  }
1027
1070
  });
@@ -1165,9 +1208,13 @@ function twMergeRaw(classLists) {
1165
1208
  }
1166
1209
  var init_cssCompilationNative = __esm({
1167
1210
  "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
1211
+ "use strict";
1168
1212
  init_nativeBridge();
1169
1213
  }
1170
1214
  });
1215
+
1216
+ // packages/domain/compiler/src/tailwindEngine.ts
1217
+ import { createRequire as createRequire2 } from "module";
1171
1218
  function loadTailwindEngine() {
1172
1219
  if (_twEngine) return _twEngine;
1173
1220
  if (_twEngineError) throw _twEngineError;
@@ -1187,10 +1234,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
1187
1234
  if (classes.length === 0) return "";
1188
1235
  const tw = loadTailwindEngine();
1189
1236
  const input = cssEntryContent ?? "@import 'tailwindcss';";
1190
- const { readFileSync, existsSync: existsSync3 } = await import('fs');
1191
- const { dirname, resolve: resolve2 } = await import('path');
1237
+ const { readFileSync, existsSync: existsSync3 } = await import("fs");
1238
+ const { dirname, resolve: resolve2 } = await import("path");
1192
1239
  const projectRoot = root ?? process.cwd();
1193
- const req = createRequire(resolve2(projectRoot, "package.json"));
1240
+ const req = createRequire2(resolve2(projectRoot, "package.json"));
1194
1241
  const loadStylesheet = async (id, base) => {
1195
1242
  try {
1196
1243
  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;
@@ -1210,10 +1257,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
1210
1257
  const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
1211
1258
  return compiler.build(classes);
1212
1259
  }
1213
- var require2, _twEngine, _twEngineError;
1260
+ var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
1214
1261
  var init_tailwindEngine = __esm({
1215
1262
  "packages/domain/compiler/src/tailwindEngine.ts"() {
1216
- require2 = createRequire(import.meta.url);
1263
+ "use strict";
1264
+ require2 = createRequire2(
1265
+ typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
1266
+ );
1267
+ MAX_CACHE_MEMORY = 256 * 1024;
1217
1268
  _twEngine = null;
1218
1269
  _twEngineError = null;
1219
1270
  }
@@ -1228,6 +1279,7 @@ __export(tailwindEngine_exports, {
1228
1279
  runCssPipeline: () => runCssPipeline,
1229
1280
  runCssPipelineSync: () => runCssPipelineSync
1230
1281
  });
1282
+ import { createRequire as createRequire3 } from "module";
1231
1283
  function _getCacheKey(classes, minify, cssEntry, root) {
1232
1284
  const sorted = [...classes].sort().join(",");
1233
1285
  const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
@@ -1394,18 +1446,22 @@ function processTailwindCssWithTargets(css, targets) {
1394
1446
  }
1395
1447
  return result.css;
1396
1448
  }
1397
- var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
1449
+ var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
1398
1450
  var init_tailwindEngine2 = __esm({
1399
1451
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
1452
+ "use strict";
1400
1453
  init_nativeBridge();
1401
1454
  init_cssGeneratorNative();
1402
1455
  init_cssCompilationNative();
1403
1456
  init_tailwindEngine();
1404
- createRequire(import.meta.url);
1457
+ require3 = createRequire3(
1458
+ typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
1459
+ );
1405
1460
  _cssCache = /* @__PURE__ */ new Map();
1406
1461
  _cacheHits = 0;
1407
1462
  _cacheMisses = 0;
1408
1463
  MAX_CACHE_SIZE = 100;
1464
+ MAX_CACHE_MEMORY2 = 256 * 1024;
1409
1465
  }
1410
1466
  });
1411
1467
 
@@ -1477,6 +1533,7 @@ function atomicRegistrySize() {
1477
1533
  }
1478
1534
  var init_compilationNative = __esm({
1479
1535
  "packages/domain/compiler/src/compiler/compilationNative.ts"() {
1536
+ "use strict";
1480
1537
  init_nativeBridge();
1481
1538
  }
1482
1539
  });
@@ -1576,6 +1633,7 @@ function idRegistryImport(importedData) {
1576
1633
  }
1577
1634
  var init_idRegistryNative = __esm({
1578
1635
  "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
1636
+ "use strict";
1579
1637
  init_nativeBridge();
1580
1638
  }
1581
1639
  });
@@ -1717,6 +1775,7 @@ function scanFilesBatchNative(filesJson) {
1717
1775
  }
1718
1776
  var init_streamingNative = __esm({
1719
1777
  "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1778
+ "use strict";
1720
1779
  init_nativeBridge();
1721
1780
  }
1722
1781
  });
@@ -1724,6 +1783,7 @@ var init_streamingNative = __esm({
1724
1783
  // packages/domain/compiler/src/compiler/index.ts
1725
1784
  var init_compiler = __esm({
1726
1785
  "packages/domain/compiler/src/compiler/index.ts"() {
1786
+ "use strict";
1727
1787
  init_cssGeneratorNative();
1728
1788
  init_compilationNative();
1729
1789
  init_cssCompilationNative();
@@ -1736,6 +1796,7 @@ var init_compiler = __esm({
1736
1796
  var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
1737
1797
  var init_parser = __esm({
1738
1798
  "packages/domain/compiler/src/parser/index.ts"() {
1799
+ "use strict";
1739
1800
  init_nativeBridge();
1740
1801
  parseClasses = (raw) => {
1741
1802
  const native = getNativeBridge();
@@ -1914,6 +1975,7 @@ function resetMemoryStats() {
1914
1975
  }
1915
1976
  var init_analyzerNative = __esm({
1916
1977
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1978
+ "use strict";
1917
1979
  init_nativeBridge();
1918
1980
  }
1919
1981
  });
@@ -2007,6 +2069,7 @@ function resolveSimpleVariants(configJson) {
2007
2069
  }
2008
2070
  var init_themeResolutionNative = __esm({
2009
2071
  "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
2072
+ "use strict";
2010
2073
  init_nativeBridge();
2011
2074
  }
2012
2075
  });
@@ -2054,6 +2117,7 @@ function generateSubComponentTypes(root, outputPath) {
2054
2117
  }
2055
2118
  var init_scannerNative = __esm({
2056
2119
  "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
2120
+ "use strict";
2057
2121
  init_nativeBridge();
2058
2122
  }
2059
2123
  });
@@ -2061,6 +2125,7 @@ var init_scannerNative = __esm({
2061
2125
  // packages/domain/compiler/src/analyzer/index.ts
2062
2126
  var init_analyzer = __esm({
2063
2127
  "packages/domain/compiler/src/analyzer/index.ts"() {
2128
+ "use strict";
2064
2129
  init_analyzerNative();
2065
2130
  init_themeResolutionNative();
2066
2131
  init_scannerNative();
@@ -2249,6 +2314,7 @@ function resetResolverPoolStats() {
2249
2314
  }
2250
2315
  var init_cacheNative = __esm({
2251
2316
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
2317
+ "use strict";
2252
2318
  init_nativeBridge();
2253
2319
  }
2254
2320
  });
@@ -2256,6 +2322,7 @@ var init_cacheNative = __esm({
2256
2322
  // packages/domain/compiler/src/cache/index.ts
2257
2323
  var init_cache = __esm({
2258
2324
  "packages/domain/compiler/src/cache/index.ts"() {
2325
+ "use strict";
2259
2326
  init_cacheNative();
2260
2327
  }
2261
2328
  });
@@ -2504,6 +2571,7 @@ function redisDiagnose() {
2504
2571
  }
2505
2572
  var init_redisNative = __esm({
2506
2573
  "packages/domain/compiler/src/redis/redisNative.ts"() {
2574
+ "use strict";
2507
2575
  init_nativeBridge();
2508
2576
  }
2509
2577
  });
@@ -2511,6 +2579,7 @@ var init_redisNative = __esm({
2511
2579
  // packages/domain/compiler/src/redis/index.ts
2512
2580
  var init_redis = __esm({
2513
2581
  "packages/domain/compiler/src/redis/index.ts"() {
2582
+ "use strict";
2514
2583
  init_redisNative();
2515
2584
  }
2516
2585
  });
@@ -2649,6 +2718,7 @@ function getCompilerDiagnostics() {
2649
2718
  }
2650
2719
  var init_watchSystemNative = __esm({
2651
2720
  "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
2721
+ "use strict";
2652
2722
  init_nativeBridge();
2653
2723
  }
2654
2724
  });
@@ -2656,6 +2726,7 @@ var init_watchSystemNative = __esm({
2656
2726
  // packages/domain/compiler/src/watch/index.ts
2657
2727
  var init_watch = __esm({
2658
2728
  "packages/domain/compiler/src/watch/index.ts"() {
2729
+ "use strict";
2659
2730
  init_watchSystemNative();
2660
2731
  }
2661
2732
  });
@@ -2884,6 +2955,7 @@ __export(internal_exports, {
2884
2955
  });
2885
2956
  var init_internal = __esm({
2886
2957
  "packages/domain/compiler/src/internal.ts"() {
2958
+ "use strict";
2887
2959
  init_src2();
2888
2960
  init_tailwindEngine2();
2889
2961
  init_compiler();
@@ -2894,6 +2966,10 @@ var init_internal = __esm({
2894
2966
  init_watch();
2895
2967
  }
2896
2968
  });
2969
+
2970
+ // packages/domain/shared/src/staticStateExtractor.ts
2971
+ import fs2 from "fs";
2972
+ import path2 from "path";
2897
2973
  function getNative() {
2898
2974
  if (_native) return _native;
2899
2975
  try {
@@ -2923,17 +2999,17 @@ function getNative() {
2923
2999
  function* walkSourceFiles(dir) {
2924
3000
  let entries;
2925
3001
  try {
2926
- entries = fs13__default.readdirSync(dir, { withFileTypes: true });
3002
+ entries = fs2.readdirSync(dir, { withFileTypes: true });
2927
3003
  } catch {
2928
3004
  return;
2929
3005
  }
2930
3006
  for (const entry of entries) {
2931
- const fullPath = path9__default.join(dir, entry.name);
3007
+ const fullPath = path2.join(dir, entry.name);
2932
3008
  if (entry.isDirectory()) {
2933
3009
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
2934
3010
  yield* walkSourceFiles(fullPath);
2935
3011
  } else if (entry.isFile()) {
2936
- const ext = path9__default.extname(entry.name);
3012
+ const ext = path2.extname(entry.name);
2937
3013
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
2938
3014
  }
2939
3015
  }
@@ -2997,7 +3073,7 @@ function extractStaticStateCss(srcDir, options = {}) {
2997
3073
  allConfigs.push(...configs);
2998
3074
  if (verbose) {
2999
3075
  process.stderr.write(
3000
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3076
+ `[tw:static-state] ${path2.relative(srcDir, filePath)}: ${configs.length} komponen
3001
3077
  `
3002
3078
  );
3003
3079
  }
@@ -3008,7 +3084,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3008
3084
  if (filesScanned >= maxFiles) break;
3009
3085
  let source;
3010
3086
  try {
3011
- source = fs13__default.readFileSync(filePath, "utf-8");
3087
+ source = fs2.readFileSync(filePath, "utf-8");
3012
3088
  } catch {
3013
3089
  continue;
3014
3090
  }
@@ -3021,7 +3097,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3021
3097
  allConfigs.push(...configs);
3022
3098
  if (verbose) {
3023
3099
  process.stderr.write(
3024
- `[tw:static-state] ${path9__default.relative(srcDir, filePath)}: ${configs.length} komponen
3100
+ `[tw:static-state] ${path2.relative(srcDir, filePath)}: ${configs.length} komponen
3025
3101
  `
3026
3102
  );
3027
3103
  }
@@ -3115,12 +3191,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3115
3191
  resolvedCss: options.resolvedCss || ""
3116
3192
  // ← ensure always passed
3117
3193
  });
3118
- const twClassesDir = path9__default.join(path9__default.dirname(safelistPath), "tw-classes");
3119
- fs13__default.mkdirSync(twClassesDir, { recursive: true });
3120
- const stateFilePath = path9__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3194
+ const twClassesDir = path2.join(path2.dirname(safelistPath), "tw-classes");
3195
+ fs2.mkdirSync(twClassesDir, { recursive: true });
3196
+ const stateFilePath = path2.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3121
3197
  if (result.rulesGenerated === 0) {
3122
3198
  try {
3123
- fs13__default.writeFileSync(
3199
+ fs2.writeFileSync(
3124
3200
  stateFilePath,
3125
3201
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3126
3202
  "utf-8"
@@ -3130,7 +3206,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3130
3206
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3131
3207
  }
3132
3208
  try {
3133
- fs13__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3209
+ fs2.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3134
3210
  return [
3135
3211
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3136
3212
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3145,12 +3221,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3145
3221
  var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
3146
3222
  var init_staticStateExtractor = __esm({
3147
3223
  "packages/domain/shared/src/staticStateExtractor.ts"() {
3224
+ "use strict";
3148
3225
  SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
3149
3226
  IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
3150
3227
  _native = null;
3151
3228
  TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
3152
3229
  }
3153
3230
  });
3231
+
3232
+ // packages/domain/shared/src/logger.ts
3233
+ import fs3 from "fs";
3234
+ import path3 from "path";
3154
3235
  function getEnvLevel() {
3155
3236
  const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
3156
3237
  if (env && env in LEVELS) return env;
@@ -3160,8 +3241,8 @@ function setGlobalLogFile(filePath) {
3160
3241
  _globalLogFile = filePath;
3161
3242
  _logFileInitialized = false;
3162
3243
  try {
3163
- fs13__default.mkdirSync(path9__default.dirname(filePath), { recursive: true });
3164
- fs13__default.writeFileSync(
3244
+ fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
3245
+ fs3.writeFileSync(
3165
3246
  filePath,
3166
3247
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3167
3248
  `,
@@ -3174,13 +3255,13 @@ function setGlobalLogFile(filePath) {
3174
3255
  function writeToFile(line) {
3175
3256
  if (!_globalLogFile || !_logFileInitialized) return;
3176
3257
  try {
3177
- fs13__default.appendFileSync(_globalLogFile, line);
3258
+ fs3.appendFileSync(_globalLogFile, line);
3178
3259
  } catch {
3179
3260
  }
3180
3261
  }
3181
3262
  function createLogger(prefix, level) {
3182
3263
  const loggerState = {
3183
- currentLevel: getEnvLevel(),
3264
+ currentLevel: level ?? getEnvLevel(),
3184
3265
  setLevel(l) {
3185
3266
  this.currentLevel = l;
3186
3267
  }
@@ -3201,13 +3282,14 @@ function createLogger(prefix, level) {
3201
3282
  setLogFile: (filePath) => setGlobalLogFile(filePath)
3202
3283
  };
3203
3284
  }
3204
- var LEVELS, _globalLogFile, _logFileInitialized;
3285
+ var LEVELS, _globalLogFile, _logFileInitialized, logger;
3205
3286
  var init_logger = __esm({
3206
3287
  "packages/domain/shared/src/logger.ts"() {
3288
+ "use strict";
3207
3289
  LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
3208
3290
  _globalLogFile = null;
3209
3291
  _logFileInitialized = false;
3210
- createLogger("tailwind-styled");
3292
+ logger = createLogger("tailwind-styled");
3211
3293
  }
3212
3294
  });
3213
3295
 
@@ -3283,6 +3365,11 @@ __export(src_exports, {
3283
3365
  tryRequire: () => tryRequire,
3284
3366
  wrapUnknownError: () => wrapUnknownError
3285
3367
  });
3368
+ import { createHash } from "crypto";
3369
+ import fs4 from "fs";
3370
+ import path4 from "path";
3371
+ import { fileURLToPath } from "url";
3372
+ import { createRequire as createRequire4 } from "module";
3286
3373
  function createLogger2(namespace) {
3287
3374
  const prefix = `[${namespace}]`;
3288
3375
  return {
@@ -3328,9 +3415,9 @@ function loadNativeBinding(options) {
3328
3415
  const { runtimeDir, candidates, isValid } = options;
3329
3416
  const loadErrors = [];
3330
3417
  for (const candidate of candidates) {
3331
- const candidatePath = path9__default.resolve(runtimeDir, candidate);
3418
+ const candidatePath = path4.resolve(runtimeDir, candidate);
3332
3419
  try {
3333
- if (!fs13__default.existsSync(candidatePath) && !fs13__default.existsSync(candidatePath + ".node")) {
3420
+ if (!fs4.existsSync(candidatePath) && !fs4.existsSync(candidatePath + ".node")) {
3334
3421
  continue;
3335
3422
  }
3336
3423
  const mod = requireNativeModule(candidatePath);
@@ -3362,9 +3449,9 @@ function resolveNativeBindingCandidates(options) {
3362
3449
  }
3363
3450
  }
3364
3451
  if (!includeDefaultCandidates) return candidates;
3365
- if (fs13__default.existsSync(runtimeDir)) {
3452
+ if (fs4.existsSync(runtimeDir)) {
3366
3453
  try {
3367
- for (const entry of fs13__default.readdirSync(runtimeDir)) {
3454
+ for (const entry of fs4.readdirSync(runtimeDir)) {
3368
3455
  if (entry.endsWith(".node")) candidates.push(entry);
3369
3456
  }
3370
3457
  } catch {
@@ -3373,22 +3460,22 @@ function resolveNativeBindingCandidates(options) {
3373
3460
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3374
3461
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
3375
3462
  for (const bin of BINARY_NAMES) {
3376
- candidates.push(path9__default.resolve(runtimeDir, `${bin}.node`));
3377
- candidates.push(path9__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3378
- candidates.push(path9__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
3379
- candidates.push(path9__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3380
- candidates.push(path9__default.resolve(process.cwd(), "native", `${bin}.node`));
3381
- candidates.push(path9__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3382
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3383
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3384
- candidates.push(path9__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3463
+ candidates.push(path4.resolve(runtimeDir, `${bin}.node`));
3464
+ candidates.push(path4.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3465
+ candidates.push(path4.resolve(runtimeDir, "..", "native", `${bin}.node`));
3466
+ candidates.push(path4.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3467
+ candidates.push(path4.resolve(process.cwd(), "native", `${bin}.node`));
3468
+ candidates.push(path4.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3469
+ candidates.push(path4.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3470
+ candidates.push(path4.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3471
+ candidates.push(path4.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3385
3472
  }
3386
3473
  return Array.from(new Set(candidates));
3387
3474
  }
3388
3475
  function resolveRuntimeDir(dir, importMetaUrl) {
3389
- if (dir) return path9__default.resolve(dir);
3476
+ if (dir) return path4.resolve(dir);
3390
3477
  try {
3391
- return path9__default.dirname(fileURLToPath(importMetaUrl));
3478
+ return path4.dirname(fileURLToPath(importMetaUrl));
3392
3479
  } catch {
3393
3480
  return process.cwd();
3394
3481
  }
@@ -3405,6 +3492,7 @@ function formatErrorMessage(error) {
3405
3492
  var TwError, _require2, LRUCache;
3406
3493
  var init_src = __esm({
3407
3494
  "packages/domain/shared/src/index.ts"() {
3495
+ "use strict";
3408
3496
  init_trace();
3409
3497
  init_error_codes();
3410
3498
  init_compatibility();
@@ -3470,7 +3558,9 @@ var init_src = __esm({
3470
3558
  return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
3471
3559
  }
3472
3560
  };
3473
- _require2 = createRequire(import.meta.url);
3561
+ _require2 = createRequire4(
3562
+ typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
3563
+ );
3474
3564
  LRUCache = class {
3475
3565
  capacity;
3476
3566
  cache;
@@ -3519,6 +3609,7 @@ var init_src = __esm({
3519
3609
  var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
3520
3610
  var init_nativeBridge = __esm({
3521
3611
  "packages/domain/compiler/src/nativeBridge.ts"() {
3612
+ "use strict";
3522
3613
  init_src();
3523
3614
  _loadNative = (path16) => __require(path16);
3524
3615
  log = (...args) => {
@@ -3622,6 +3713,11 @@ Tried paths: ${result.tried.join("\n")}`);
3622
3713
  }
3623
3714
  }
3624
3715
  });
3716
+
3717
+ // packages/domain/compiler/src/index.ts
3718
+ import fs5 from "fs";
3719
+ import path5 from "path";
3720
+ import { createRequire as createRequire5 } from "module";
3625
3721
  function _layoutClassesToCss(classes) {
3626
3722
  const native = getNativeBridge();
3627
3723
  if (!native?.layoutClassesToCss) {
@@ -3659,6 +3755,7 @@ function extractContainerCssFromSource(source) {
3659
3755
  var _require3, 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;
3660
3756
  var init_src2 = __esm({
3661
3757
  "packages/domain/compiler/src/index.ts"() {
3758
+ "use strict";
3662
3759
  init_nativeBridge();
3663
3760
  init_compiler();
3664
3761
  init_parser();
@@ -3666,7 +3763,9 @@ var init_src2 = __esm({
3666
3763
  init_cache();
3667
3764
  init_redis();
3668
3765
  init_watch();
3669
- _require3 = createRequire(import.meta.url);
3766
+ _require3 = createRequire5(
3767
+ typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
3768
+ );
3670
3769
  transformSource = (source, opts) => {
3671
3770
  const native = getNativeBridge();
3672
3771
  if (!native?.transformSource) {
@@ -3758,7 +3857,7 @@ var init_src2 = __esm({
3758
3857
  };
3759
3858
  scanProjectUsage = (dirs, cwd) => {
3760
3859
  const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
3761
- const files = dirs.map((dir) => path9__default.resolve(cwd, dir));
3860
+ const files = dirs.map((dir) => path5.resolve(cwd, dir));
3762
3861
  const results = batchExtractClasses2(files) || [];
3763
3862
  const combined = {};
3764
3863
  for (const result of results) {
@@ -3775,13 +3874,13 @@ var init_src2 = __esm({
3775
3874
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
3776
3875
  const allClasses = Object.keys(classes).sort();
3777
3876
  if (outputPath) {
3778
- fs13__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3877
+ fs5.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3779
3878
  }
3780
3879
  return allClasses;
3781
3880
  };
3782
3881
  loadSafelist = (safelistPath) => {
3783
3882
  try {
3784
- const content = fs13__default.readFileSync(safelistPath, "utf-8");
3883
+ const content = fs5.readFileSync(safelistPath, "utf-8");
3785
3884
  return JSON.parse(content);
3786
3885
  } catch {
3787
3886
  return [];
@@ -3795,8 +3894,8 @@ var init_src2 = __esm({
3795
3894
  "tailwind.config.cjs"
3796
3895
  ];
3797
3896
  for (const file of configFiles) {
3798
- const fullPath = path9__default.join(cwd, file);
3799
- if (fs13__default.existsSync(fullPath)) {
3897
+ const fullPath = path5.join(cwd, file);
3898
+ if (fs5.existsSync(fullPath)) {
3800
3899
  const mod = __require(fullPath);
3801
3900
  return mod.default || mod;
3802
3901
  }
@@ -3806,9 +3905,9 @@ var init_src2 = __esm({
3806
3905
  getContentPaths = (cwd = process.cwd()) => {
3807
3906
  return {
3808
3907
  content: [
3809
- path9__default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3810
- path9__default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3811
- path9__default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
3908
+ path5.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3909
+ path5.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3910
+ path5.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
3812
3911
  ]
3813
3912
  };
3814
3913
  };
@@ -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_src();
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
- fs13__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
- fs13__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_src();
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 (fs13__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 fs13__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 fs13__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 fs13__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_src();
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 (!fs13__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_src();
4928
5055
  log4 = createDebugLogger("engine:native");
4929
5056
  isValidEngineBinding = (module) => {
@@ -5004,15 +5131,24 @@ var init_native_bridge2 = __esm({
5004
5131
 
5005
5132
  // packages/presentation/vite/src/plugin.ts
5006
5133
  init_src2();
5134
+ import fs13 from "fs";
5135
+ import path15 from "path";
5136
+
5137
+ // packages/domain/engine/src/index.ts
5138
+ import fs12 from "fs";
5139
+ import path14 from "path";
5140
+ import { pathToFileURL as pathToFileURL2 } from "url";
5007
5141
 
5008
5142
  // packages/domain/analyzer/src/analyzeWorkspace.ts
5009
5143
  init_src3();
5144
+ import path11 from "path";
5010
5145
 
5011
5146
  // packages/domain/analyzer/src/binding.ts
5012
5147
  init_src();
5013
5148
 
5014
5149
  // packages/domain/analyzer/src/utils.ts
5015
5150
  init_src();
5151
+ import fs8 from "fs";
5016
5152
  var DEFAULT_TOP_LIMIT = 10;
5017
5153
  var DEFAULT_FREQUENT_THRESHOLD = 2;
5018
5154
  var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
@@ -5026,7 +5162,7 @@ function isRecord(value) {
5026
5162
  }
5027
5163
  async function pathExists(filePath) {
5028
5164
  try {
5029
- await fs13__default.promises.access(filePath, fs13__default.constants.F_OK);
5165
+ await fs8.promises.access(filePath, fs8.constants.F_OK);
5030
5166
  return true;
5031
5167
  } catch {
5032
5168
  return false;
@@ -5125,6 +5261,7 @@ async function requireNativeBinding() {
5125
5261
 
5126
5262
  // packages/domain/analyzer/src/schemas.ts
5127
5263
  init_src();
5264
+ import { z as z4 } from "zod";
5128
5265
  var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
5129
5266
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
5130
5267
  ).join(".") : "<root>";
@@ -5148,81 +5285,86 @@ var parseWithSchema2 = (schema, data, label) => {
5148
5285
  parsed.error
5149
5286
  );
5150
5287
  };
5151
- var CountSchema = z.number().int().min(0);
5152
- z.object({
5153
- name: z.string(),
5288
+ var CountSchema = z4.number().int().min(0);
5289
+ var ClassUsageSchema = z4.object({
5290
+ name: z4.string(),
5154
5291
  count: CountSchema,
5155
- isUnused: z.boolean().optional(),
5156
- isConflict: z.boolean().optional()
5292
+ isUnused: z4.boolean().optional(),
5293
+ isConflict: z4.boolean().optional()
5157
5294
  });
5158
- z.object({
5159
- className: z.string(),
5160
- variants: z.array(z.string()),
5161
- classes: z.array(z.string()),
5162
- message: z.string()
5295
+ var ClassConflictSchema = z4.object({
5296
+ className: z4.string(),
5297
+ variants: z4.array(z4.string()),
5298
+ classes: z4.array(z4.string()),
5299
+ message: z4.string()
5163
5300
  });
5164
- var ClassCountSchema = z.object({
5165
- name: z.string(),
5301
+ var ClassCountSchema = z4.object({
5302
+ name: z4.string(),
5166
5303
  count: CountSchema
5167
5304
  });
5168
- var NativeReportSchema = z.object({
5169
- root: z.string(),
5305
+ var NativeReportSchema = z4.object({
5306
+ root: z4.string(),
5170
5307
  totalFiles: CountSchema,
5171
5308
  uniqueClassCount: CountSchema,
5172
5309
  totalClassOccurrences: CountSchema,
5173
- topClasses: z.array(ClassCountSchema),
5174
- duplicateCandidates: z.array(ClassCountSchema),
5175
- safelist: z.array(z.string())
5310
+ topClasses: z4.array(ClassCountSchema),
5311
+ duplicateCandidates: z4.array(ClassCountSchema),
5312
+ safelist: z4.array(z4.string())
5176
5313
  });
5177
- z.object({
5178
- css: z.string(),
5179
- resolvedClasses: z.array(z.string()),
5180
- unknownClasses: z.array(z.string()),
5314
+ var NativeCssCompileResultSchema2 = z4.object({
5315
+ css: z4.string(),
5316
+ resolvedClasses: z4.array(z4.string()),
5317
+ unknownClasses: z4.array(z4.string()),
5181
5318
  sizeBytes: CountSchema
5182
5319
  });
5183
- var AnalyzerClassStatsSchema = z.object({
5184
- top: z.number({
5320
+ var AnalyzerClassStatsSchema = z4.object({
5321
+ top: z4.number({
5185
5322
  error: "analyzeWorkspace options.classStats.top must be a number when provided."
5186
5323
  }).finite().optional(),
5187
- frequentThreshold: z.number({
5324
+ frequentThreshold: z4.number({
5188
5325
  error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
5189
5326
  }).finite().optional()
5190
5327
  });
5191
- var AnalyzerSemanticOptionsSchema = z.object({
5192
- tailwindConfigPath: z.string({
5328
+ var AnalyzerSemanticOptionsSchema = z4.object({
5329
+ tailwindConfigPath: z4.string({
5193
5330
  error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5194
5331
  }).min(
5195
5332
  1,
5196
5333
  "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
5197
5334
  ).optional()
5198
5335
  });
5199
- var AnalyzerOptionsSchema = z.object({
5200
- scanner: z.custom(
5336
+ var AnalyzerOptionsSchema = z4.object({
5337
+ scanner: z4.custom(
5201
5338
  (value) => isPlainObject(value),
5202
5339
  "analyzeWorkspace options.scanner must be an object when provided."
5203
5340
  ).optional(),
5204
5341
  classStats: AnalyzerClassStatsSchema.optional(),
5205
- semantic: z.union([
5206
- z.boolean({
5342
+ semantic: z4.union([
5343
+ z4.boolean({
5207
5344
  error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
5208
5345
  }),
5209
5346
  AnalyzerSemanticOptionsSchema
5210
5347
  ]).optional(),
5211
- includeClass: z.custom(
5348
+ includeClass: z4.custom(
5212
5349
  (value) => typeof value === "function",
5213
5350
  "analyzeWorkspace options.includeClass must be a function when provided."
5214
5351
  ).optional()
5215
5352
  });
5216
- z.object({
5217
- prefix: z.union([z.string(), z.null()], {
5353
+ var ClassToCssOptionsSchema = z4.object({
5354
+ prefix: z4.union([z4.string(), z4.null()], {
5218
5355
  error: "classToCss options.prefix must be a string or null when provided."
5219
5356
  }).optional(),
5220
- strict: z.boolean({
5357
+ strict: z4.boolean({
5221
5358
  error: "classToCss options.strict must be a boolean when provided."
5222
5359
  }).optional()
5223
5360
  });
5224
5361
  var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
5225
5362
  var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
5363
+
5364
+ // packages/domain/analyzer/src/semantic.ts
5365
+ import fs9 from "fs";
5366
+ import path10 from "path";
5367
+ import { pathToFileURL } from "url";
5226
5368
  var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
5227
5369
  var tailwindConfigCache = /* @__PURE__ */ new Map();
5228
5370
  var detectConflicts2 = async (usages) => {
@@ -5242,11 +5384,11 @@ var detectConflicts2 = async (usages) => {
5242
5384
  };
5243
5385
  };
5244
5386
  var isSupportedTailwindConfigPath = (configPath) => {
5245
- return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path9__default.extname(configPath).toLowerCase());
5387
+ return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path10.extname(configPath).toLowerCase());
5246
5388
  };
5247
5389
  var resolveTailwindConfigPath = async (root, explicitPath) => {
5248
5390
  if (explicitPath) {
5249
- const resolved = path9__default.resolve(root, explicitPath);
5391
+ const resolved = path10.resolve(root, explicitPath);
5250
5392
  if (!await pathExists(resolved)) return null;
5251
5393
  return resolved;
5252
5394
  }
@@ -5257,7 +5399,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
5257
5399
  "tailwind.config.mjs"
5258
5400
  ];
5259
5401
  for (const candidate of candidates) {
5260
- const fullPath = path9__default.resolve(root, candidate);
5402
+ const fullPath = path10.resolve(root, candidate);
5261
5403
  if (await pathExists(fullPath)) return fullPath;
5262
5404
  }
5263
5405
  return null;
@@ -5311,7 +5453,7 @@ var collectCustomUtilities = (config) => {
5311
5453
  return out;
5312
5454
  };
5313
5455
  var collectSafelistFromSource = async (configPath) => {
5314
- const source = await fs13__default.promises.readFile(configPath, "utf8");
5456
+ const source = await fs9.promises.readFile(configPath, "utf8");
5315
5457
  const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
5316
5458
  const allTokens = extractClassesNative2(source);
5317
5459
  const hasSafelist = source.includes("safelist");
@@ -5338,7 +5480,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
5338
5480
  customUtilities: /* @__PURE__ */ new Set()
5339
5481
  };
5340
5482
  }
5341
- const configStat = await fs13__default.promises.stat(configPath).catch(() => null);
5483
+ const configStat = await fs9.promises.stat(configPath).catch(() => null);
5342
5484
  if (configStat) {
5343
5485
  const cached = tailwindConfigCache.get(configPath);
5344
5486
  if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
@@ -5497,7 +5639,7 @@ async function buildDistribution(usages, native) {
5497
5639
  }
5498
5640
  async function analyzeWorkspace(root, options = {}) {
5499
5641
  const startedAtMs = Date.now();
5500
- const resolvedRoot = path9__default.resolve(root);
5642
+ const resolvedRoot = path11.resolve(root);
5501
5643
  const normalizedOptions = parseAnalyzerOptions(options);
5502
5644
  const scan = await (async () => {
5503
5645
  const scanStartedAtMs = Date.now();
@@ -5609,6 +5751,8 @@ init_src();
5609
5751
  init_src3();
5610
5752
  init_src();
5611
5753
  init_native_bridge2();
5754
+ import fs10 from "fs";
5755
+ import path12 from "path";
5612
5756
  var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
5613
5757
  var log5 = createLogger2("engine:incremental");
5614
5758
  function rebuildWorkspaceResult2(byFile) {
@@ -5641,8 +5785,8 @@ function areClassSetsEqual(a, b) {
5641
5785
  function applyIncrementalChange(previous, filePath, type, scanner) {
5642
5786
  const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
5643
5787
  if (!isScannableFile2(filePath, includeExtensions)) return previous;
5644
- const byFile = new Map(previous.files.map((f) => [path9__default.resolve(f.file), f]));
5645
- const normalizedPath = path9__default.resolve(filePath);
5788
+ const byFile = new Map(previous.files.map((f) => [path12.resolve(f.file), f]));
5789
+ const normalizedPath = path12.resolve(filePath);
5646
5790
  const native = getNativeEngineBinding();
5647
5791
  if (!native?.processFileChange) {
5648
5792
  throw new Error(
@@ -5658,7 +5802,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
5658
5802
  }
5659
5803
  log5.debug(`native change ${normalizedPath}`);
5660
5804
  const scanned = scanFile2(normalizedPath);
5661
- const content = fs13__default.readFileSync(normalizedPath, "utf8");
5805
+ const content = fs10.readFileSync(normalizedPath, "utf8");
5662
5806
  const diff = native.processFileChange(normalizedPath, scanned.classes, content);
5663
5807
  const existing = byFile.get(normalizedPath);
5664
5808
  if (diff && existing) {
@@ -5723,12 +5867,16 @@ var EngineMetricsCollector = class {
5723
5867
 
5724
5868
  // packages/domain/engine/src/metricsWriter.ts
5725
5869
  init_src();
5870
+ import fs11 from "fs";
5871
+ import path13 from "path";
5872
+ import { performance } from "perf_hooks";
5873
+ var _log = createLogger2("tw:metrics");
5726
5874
  var METRICS_FILE_NAME = "metrics.json";
5727
5875
  var CACHE_DIR = ".tw-cache";
5728
5876
  function writeMetrics(metrics, cwd = process.cwd()) {
5729
5877
  try {
5730
- const cacheDir = path9__default.join(cwd, CACHE_DIR);
5731
- fs13__default.mkdirSync(cacheDir, { recursive: true });
5878
+ const cacheDir = path13.join(cwd, CACHE_DIR);
5879
+ fs11.mkdirSync(cacheDir, { recursive: true });
5732
5880
  const mem = process.memoryUsage();
5733
5881
  const data = {
5734
5882
  ...metrics,
@@ -5739,7 +5887,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
5739
5887
  },
5740
5888
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
5741
5889
  };
5742
- fs13__default.writeFileSync(path9__default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
5890
+ fs11.writeFileSync(path13.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
5743
5891
  } catch {
5744
5892
  }
5745
5893
  }
@@ -5791,6 +5939,9 @@ async function runAfterWatch(plugins, context) {
5791
5939
  await plugin.afterWatch?.(context);
5792
5940
  }
5793
5941
  }
5942
+
5943
+ // packages/domain/engine/src/schemas.ts
5944
+ import { z as z5 } from "zod";
5794
5945
  var formatIssues3 = (error) => error.issues.map((issue) => {
5795
5946
  const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
5796
5947
  return `${p}: ${issue.message}`;
@@ -5800,46 +5951,46 @@ var parseWithSchema3 = (schema, data, label) => {
5800
5951
  if (parsed.success) return parsed.data;
5801
5952
  throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
5802
5953
  };
5803
- var EngineOptionsSchema = z.object({
5804
- root: z.string().optional(),
5805
- scanner: z.object({
5806
- includeExtensions: z.array(z.string()).optional(),
5807
- ignoreDirectories: z.array(z.string()).optional(),
5808
- useCache: z.boolean().optional(),
5809
- cacheDir: z.string().min(1).optional(),
5810
- smartInvalidation: z.boolean().optional()
5954
+ var EngineOptionsSchema = z5.object({
5955
+ root: z5.string().optional(),
5956
+ scanner: z5.object({
5957
+ includeExtensions: z5.array(z5.string()).optional(),
5958
+ ignoreDirectories: z5.array(z5.string()).optional(),
5959
+ useCache: z5.boolean().optional(),
5960
+ cacheDir: z5.string().min(1).optional(),
5961
+ smartInvalidation: z5.boolean().optional()
5811
5962
  }).optional(),
5812
- compileCss: z.boolean().optional(),
5813
- tailwindConfigPath: z.string().optional(),
5814
- analyze: z.boolean().optional(),
5815
- plugins: z.array(z.custom()).optional()
5963
+ compileCss: z5.boolean().optional(),
5964
+ tailwindConfigPath: z5.string().optional(),
5965
+ analyze: z5.boolean().optional(),
5966
+ plugins: z5.array(z5.custom()).optional()
5816
5967
  });
5817
- var EngineWatchOptionsSchema = z.object({
5818
- debounceMs: z.number().int().min(0).optional(),
5819
- maxEventsPerFlush: z.number().int().min(1).optional(),
5820
- largeFileThreshold: z.number().int().min(0).optional()
5968
+ var EngineWatchOptionsSchema = z5.object({
5969
+ debounceMs: z5.number().int().min(0).optional(),
5970
+ maxEventsPerFlush: z5.number().int().min(1).optional(),
5971
+ largeFileThreshold: z5.number().int().min(0).optional()
5821
5972
  });
5822
- z.object({
5823
- scan: z.object({
5824
- files: z.array(
5825
- z.object({ file: z.string(), classes: z.array(z.string()), hash: z.string().optional() })
5973
+ var BuildResultSchema = z5.object({
5974
+ scan: z5.object({
5975
+ files: z5.array(
5976
+ z5.object({ file: z5.string(), classes: z5.array(z5.string()), hash: z5.string().optional() })
5826
5977
  ),
5827
- totalFiles: z.number().int().min(0),
5828
- uniqueClasses: z.array(z.string())
5978
+ totalFiles: z5.number().int().min(0),
5979
+ uniqueClasses: z5.array(z5.string())
5829
5980
  }),
5830
- mergedClassList: z.string(),
5831
- css: z.string(),
5832
- analysis: z.object({
5833
- unusedClasses: z.array(z.string()),
5834
- classConflicts: z.array(
5835
- z.object({
5836
- className: z.string(),
5837
- files: z.array(z.string()),
5838
- classes: z.array(z.string()).optional(),
5839
- message: z.string().optional()
5981
+ mergedClassList: z5.string(),
5982
+ css: z5.string(),
5983
+ analysis: z5.object({
5984
+ unusedClasses: z5.array(z5.string()),
5985
+ classConflicts: z5.array(
5986
+ z5.object({
5987
+ className: z5.string(),
5988
+ files: z5.array(z5.string()),
5989
+ classes: z5.array(z5.string()).optional(),
5990
+ message: z5.string().optional()
5840
5991
  })
5841
5992
  ),
5842
- classUsage: z.record(z.string(), z.number())
5993
+ classUsage: z5.record(z5.string(), z5.number())
5843
5994
  }).optional()
5844
5995
  });
5845
5996
  var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
@@ -5938,11 +6089,11 @@ var configState = {
5938
6089
  var log6 = createLogger2("engine");
5939
6090
  async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
5940
6091
  if (!tailwindConfigPath) return void 0;
5941
- const configPath = path9__default.resolve(root, tailwindConfigPath);
5942
- if (!fs13__default.existsSync(configPath)) {
6092
+ const configPath = path14.resolve(root, tailwindConfigPath);
6093
+ if (!fs12.existsSync(configPath)) {
5943
6094
  throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
5944
6095
  }
5945
- const imported = await import(pathToFileURL(configPath).href);
6096
+ const imported = await import(pathToFileURL2(configPath).href);
5946
6097
  const config = imported.default ?? imported;
5947
6098
  return config;
5948
6099
  }
@@ -6005,11 +6156,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
6005
6156
  };
6006
6157
  }
6007
6158
  function countWorkspacePackages(root) {
6008
- const packagesDir = path9__default.join(root, "packages");
6009
- if (!fs13__default.existsSync(packagesDir)) return 0;
6159
+ const packagesDir = path14.join(root, "packages");
6160
+ if (!fs12.existsSync(packagesDir)) return 0;
6010
6161
  try {
6011
- return fs13__default.readdirSync(packagesDir, { withFileTypes: true }).filter(
6012
- (entry) => entry.isDirectory() && fs13__default.existsSync(path9__default.join(packagesDir, entry.name, "package.json"))
6162
+ return fs12.readdirSync(packagesDir, { withFileTypes: true }).filter(
6163
+ (entry) => entry.isDirectory() && fs12.existsSync(path14.join(packagesDir, entry.name, "package.json"))
6013
6164
  ).length;
6014
6165
  } catch (err) {
6015
6166
  log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
@@ -6046,7 +6197,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
6046
6197
  async function createEngine(rawOptions = {}) {
6047
6198
  const options = parseEngineOptions(rawOptions);
6048
6199
  const root = options.root ?? process.cwd();
6049
- const resolvedRoot = path9__default.resolve(root);
6200
+ const resolvedRoot = path14.resolve(root);
6050
6201
  const plugins = rawOptions.plugins ?? [];
6051
6202
  const getTailwindConfig = async () => {
6052
6203
  if (configState.isLoaded()) return configState.getConfig();
@@ -6193,7 +6344,7 @@ async function createEngine(rawOptions = {}) {
6193
6344
  const shouldForceFullRescan = (event) => {
6194
6345
  if (event.type === "unlink") return false;
6195
6346
  try {
6196
- const stat = fs13__default.statSync(event.filePath);
6347
+ const stat = fs12.statSync(event.filePath);
6197
6348
  if (stat.size > largeFileThreshold) {
6198
6349
  metrics.markSkippedLargeFile();
6199
6350
  return true;
@@ -6313,6 +6464,7 @@ async function createEngine(rawOptions = {}) {
6313
6464
 
6314
6465
  // packages/presentation/vite/src/schemas.ts
6315
6466
  init_src();
6467
+ import { z as z6 } from "zod";
6316
6468
  var formatIssuePath4 = (path16) => path16.length > 0 ? path16.map(
6317
6469
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
6318
6470
  ).join(".") : "<root>";
@@ -6331,23 +6483,23 @@ var parseWithSchema4 = (schema, data, label) => {
6331
6483
  parsed.error
6332
6484
  );
6333
6485
  };
6334
- var VitePluginOptionsSchema = z.object({
6335
- include: z.instanceof(RegExp).optional(),
6336
- exclude: z.instanceof(RegExp).optional(),
6337
- scanDirs: z.array(z.string()).optional(),
6338
- safelistOutput: z.string().optional(),
6339
- generateSafelist: z.boolean().optional(),
6340
- scanReportOutput: z.string().optional(),
6341
- useEngineBuild: z.boolean().optional(),
6342
- analyze: z.boolean().optional(),
6343
- strict: z.boolean().optional(),
6344
- mode: z.enum(["zero-runtime", "runtime"]).optional(),
6345
- routeCss: z.boolean().optional(),
6346
- deadStyleElimination: z.boolean().optional(),
6347
- addDataAttr: z.boolean().optional(),
6348
- autoClientBoundary: z.boolean().optional(),
6349
- hoist: z.boolean().optional(),
6350
- incremental: z.boolean().optional()
6486
+ var VitePluginOptionsSchema = z6.object({
6487
+ include: z6.instanceof(RegExp).optional(),
6488
+ exclude: z6.instanceof(RegExp).optional(),
6489
+ scanDirs: z6.array(z6.string()).optional(),
6490
+ safelistOutput: z6.string().optional(),
6491
+ generateSafelist: z6.boolean().optional(),
6492
+ scanReportOutput: z6.string().optional(),
6493
+ useEngineBuild: z6.boolean().optional(),
6494
+ analyze: z6.boolean().optional(),
6495
+ strict: z6.boolean().optional(),
6496
+ mode: z6.enum(["zero-runtime", "runtime"]).optional(),
6497
+ routeCss: z6.boolean().optional(),
6498
+ deadStyleElimination: z6.boolean().optional(),
6499
+ addDataAttr: z6.boolean().optional(),
6500
+ autoClientBoundary: z6.boolean().optional(),
6501
+ hoist: z6.boolean().optional(),
6502
+ incremental: z6.boolean().optional()
6351
6503
  });
6352
6504
  var parseVitePluginOptions = (options) => parseWithSchema4(VitePluginOptionsSchema, options ?? {}, "vite plugin options are invalid");
6353
6505
 
@@ -6359,14 +6511,14 @@ function warnDeprecated(options, key, message) {
6359
6511
  }
6360
6512
  }
6361
6513
  function isInsideDirectory(filePath, directory) {
6362
- const relative = path9__default.relative(directory, filePath);
6363
- return relative === "" || !relative.startsWith("..") && !path9__default.isAbsolute(relative);
6514
+ const relative = path15.relative(directory, filePath);
6515
+ return relative === "" || !relative.startsWith("..") && !path15.isAbsolute(relative);
6364
6516
  }
6365
6517
  function filterScanToDirs(scan, root, scanDirs) {
6366
- const resolvedDirs = scanDirs.map((dir) => path9__default.resolve(root, dir));
6518
+ const resolvedDirs = scanDirs.map((dir) => path15.resolve(root, dir));
6367
6519
  if (resolvedDirs.length === 0) return scan;
6368
6520
  const files = scan.files.filter((file) => {
6369
- const absoluteFile = path9__default.resolve(file.file);
6521
+ const absoluteFile = path15.resolve(file.file);
6370
6522
  return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
6371
6523
  });
6372
6524
  const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
@@ -6377,9 +6529,9 @@ function filterScanToDirs(scan, root, scanDirs) {
6377
6529
  };
6378
6530
  }
6379
6531
  function writeJsonArtifact(root, relativePath, value) {
6380
- const outputPath = path9__default.resolve(root, relativePath);
6381
- fs13__default.mkdirSync(path9__default.dirname(outputPath), { recursive: true });
6382
- fs13__default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
6532
+ const outputPath = path15.resolve(root, relativePath);
6533
+ fs13.mkdirSync(path15.dirname(outputPath), { recursive: true });
6534
+ fs13.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
6383
6535
  `);
6384
6536
  }
6385
6537
  function tailwindStyledPlugin(opts = {}) {
@@ -6420,7 +6572,7 @@ function tailwindStyledPlugin(opts = {}) {
6420
6572
  return rules.join("\n");
6421
6573
  }
6422
6574
  function getStaticCssOutputPath(root, safelistOutputPath) {
6423
- return path9__default.resolve(root, path9__default.dirname(safelistOutputPath), "_tw-state-static.css");
6575
+ return path15.resolve(root, path15.dirname(safelistOutputPath), "_tw-state-static.css");
6424
6576
  }
6425
6577
  function flushStaticCss(root) {
6426
6578
  if (staticCssPerFile.size === 0) return;
@@ -6429,8 +6581,8 @@ function tailwindStyledPlugin(opts = {}) {
6429
6581
  if (!deduped.trim()) return;
6430
6582
  const outPath = getStaticCssOutputPath(root, safelistOutput);
6431
6583
  try {
6432
- fs13__default.mkdirSync(path9__default.dirname(outPath), { recursive: true });
6433
- fs13__default.writeFileSync(
6584
+ fs13.mkdirSync(path15.dirname(outPath), { recursive: true });
6585
+ fs13.writeFileSync(
6434
6586
  outPath,
6435
6587
  `/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
6436
6588
  * Import this in globals.css: @import "./_tw-state-static.css";
@@ -6462,17 +6614,17 @@ ${deduped}
6462
6614
  "src/style.css"
6463
6615
  ];
6464
6616
  for (const candidate of CSS_CANDIDATES) {
6465
- const candidatePath = path9__default.resolve(config.root, candidate);
6466
- if (!fs13__default.existsSync(candidatePath)) continue;
6467
- const content = fs13__default.readFileSync(candidatePath, "utf-8");
6617
+ const candidatePath = path15.resolve(config.root, candidate);
6618
+ if (!fs13.existsSync(candidatePath)) continue;
6619
+ const content = fs13.readFileSync(candidatePath, "utf-8");
6468
6620
  if (content.includes("_tw-state-static.css")) break;
6469
- const rel = path9__default.relative(path9__default.dirname(candidatePath), outPath).replace(/\\/g, "/");
6621
+ const rel = path15.relative(path15.dirname(candidatePath), outPath).replace(/\\/g, "/");
6470
6622
  const importLine = `@import "./${rel}";`;
6471
6623
  const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
6472
6624
  const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
6473
6625
  `) : `${importLine}
6474
6626
  ${content}`;
6475
- fs13__default.writeFileSync(candidatePath, updated, "utf-8");
6627
+ fs13.writeFileSync(candidatePath, updated, "utf-8");
6476
6628
  break;
6477
6629
  }
6478
6630
  } catch {
@@ -6556,7 +6708,7 @@ ${content}`;
6556
6708
  }
6557
6709
  };
6558
6710
  }
6559
-
6560
- export { tailwindStyledPlugin };
6561
- //# sourceMappingURL=vite.mjs.map
6711
+ export {
6712
+ tailwindStyledPlugin
6713
+ };
6562
6714
  //# sourceMappingURL=vite.mjs.map