tailwind-styled-v4 4.0.0 → 5.0.1

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 (194) hide show
  1. package/CHANGELOG.md +398 -0
  2. package/LICENSE +21 -0
  3. package/README.md +532 -0
  4. package/dist/analyzer.d.mts +114 -0
  5. package/dist/analyzer.d.ts +114 -0
  6. package/dist/analyzer.js +1555 -0
  7. package/dist/analyzer.js.map +1 -0
  8. package/dist/analyzer.mjs +1544 -0
  9. package/dist/analyzer.mjs.map +1 -0
  10. package/dist/animate.d.mts +46 -0
  11. package/dist/animate.d.ts +41 -112
  12. package/dist/animate.js +792 -235
  13. package/dist/animate.js.map +1 -1
  14. package/dist/animate.mjs +782 -0
  15. package/dist/animate.mjs.map +1 -0
  16. package/dist/atomic.d.mts +18 -0
  17. package/dist/atomic.d.ts +18 -0
  18. package/dist/atomic.js +191 -0
  19. package/dist/atomic.js.map +1 -0
  20. package/dist/atomic.mjs +185 -0
  21. package/dist/atomic.mjs.map +1 -0
  22. package/dist/cli.d.mts +1 -0
  23. package/dist/cli.d.ts +1 -0
  24. package/dist/cli.js +6063 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/cli.mjs +6053 -0
  27. package/dist/cli.mjs.map +1 -0
  28. package/dist/{compiler.d.cts → compiler.d.mts} +503 -210
  29. package/dist/compiler.d.ts +503 -210
  30. package/dist/compiler.js +1549 -566
  31. package/dist/compiler.js.map +1 -1
  32. package/dist/{compiler.cjs → compiler.mjs} +1476 -627
  33. package/dist/compiler.mjs.map +1 -0
  34. package/dist/dashboard.d.mts +272 -0
  35. package/dist/dashboard.d.ts +272 -0
  36. package/dist/dashboard.js +249 -0
  37. package/dist/dashboard.js.map +1 -0
  38. package/dist/dashboard.mjs +239 -0
  39. package/dist/dashboard.mjs.map +1 -0
  40. package/dist/devtools.js +336 -211
  41. package/dist/devtools.js.map +1 -1
  42. package/dist/{devtools.cjs → devtools.mjs} +331 -220
  43. package/dist/devtools.mjs.map +1 -0
  44. package/dist/engine.d.mts +84 -0
  45. package/dist/engine.d.ts +84 -0
  46. package/dist/engine.js +3014 -0
  47. package/dist/engine.js.map +1 -0
  48. package/dist/engine.mjs +3005 -0
  49. package/dist/engine.mjs.map +1 -0
  50. package/dist/{index.d.cts → index.d.mts} +75 -4
  51. package/dist/index.d.ts +75 -4
  52. package/dist/index.js +1341 -149
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +2162 -0
  55. package/dist/index.mjs.map +1 -0
  56. package/dist/liveTokenEngine-DYN3Zale.d.mts +34 -0
  57. package/dist/liveTokenEngine-DYN3Zale.d.ts +34 -0
  58. package/dist/next.d.mts +55 -0
  59. package/dist/next.d.ts +30 -20
  60. package/dist/next.js +6947 -149
  61. package/dist/next.js.map +1 -1
  62. package/dist/next.mjs +7050 -0
  63. package/dist/next.mjs.map +1 -0
  64. package/dist/plugin.d.mts +90 -0
  65. package/dist/plugin.d.ts +90 -0
  66. package/dist/plugin.js +185 -0
  67. package/dist/plugin.js.map +1 -0
  68. package/dist/plugin.mjs +174 -0
  69. package/dist/plugin.mjs.map +1 -0
  70. package/dist/pluginRegistry.d.mts +83 -0
  71. package/dist/pluginRegistry.d.ts +83 -0
  72. package/dist/pluginRegistry.js +303 -0
  73. package/dist/pluginRegistry.js.map +1 -0
  74. package/dist/pluginRegistry.mjs +298 -0
  75. package/dist/pluginRegistry.mjs.map +1 -0
  76. package/dist/{preset.d.cts → preset.d.mts} +29 -2
  77. package/dist/preset.d.ts +29 -2
  78. package/dist/preset.js +318 -21
  79. package/dist/preset.js.map +1 -1
  80. package/dist/preset.mjs +414 -0
  81. package/dist/preset.mjs.map +1 -0
  82. package/dist/rspack.d.mts +33 -0
  83. package/dist/rspack.d.ts +33 -0
  84. package/dist/rspack.js +55 -0
  85. package/dist/rspack.js.map +1 -0
  86. package/dist/rspack.mjs +45 -0
  87. package/dist/rspack.mjs.map +1 -0
  88. package/dist/runtime.d.mts +62 -0
  89. package/dist/runtime.d.ts +62 -0
  90. package/dist/runtime.js +207 -0
  91. package/dist/runtime.js.map +1 -0
  92. package/dist/runtime.mjs +188 -0
  93. package/dist/runtime.mjs.map +1 -0
  94. package/dist/runtimeCss.d.mts +65 -0
  95. package/dist/runtimeCss.d.ts +65 -0
  96. package/dist/runtimeCss.js +188 -0
  97. package/dist/runtimeCss.js.map +1 -0
  98. package/dist/runtimeCss.mjs +173 -0
  99. package/dist/runtimeCss.mjs.map +1 -0
  100. package/dist/scanner.d.mts +25 -0
  101. package/dist/scanner.d.ts +25 -0
  102. package/dist/scanner.js +717 -0
  103. package/dist/scanner.js.map +1 -0
  104. package/dist/scanner.mjs +703 -0
  105. package/dist/scanner.mjs.map +1 -0
  106. package/dist/shared.d.mts +85 -0
  107. package/dist/shared.d.ts +85 -0
  108. package/dist/shared.js +255 -0
  109. package/dist/shared.js.map +1 -0
  110. package/dist/shared.mjs +233 -0
  111. package/dist/shared.mjs.map +1 -0
  112. package/dist/storybookAddon.d.mts +108 -0
  113. package/dist/storybookAddon.d.ts +108 -0
  114. package/dist/storybookAddon.js +95 -0
  115. package/dist/storybookAddon.js.map +1 -0
  116. package/dist/storybookAddon.mjs +88 -0
  117. package/dist/storybookAddon.mjs.map +1 -0
  118. package/dist/svelte.d.mts +114 -0
  119. package/dist/svelte.d.ts +114 -0
  120. package/dist/svelte.js +67 -0
  121. package/dist/svelte.js.map +1 -0
  122. package/dist/svelte.mjs +59 -0
  123. package/dist/svelte.mjs.map +1 -0
  124. package/dist/testing.d.mts +185 -0
  125. package/dist/testing.d.ts +185 -0
  126. package/dist/testing.js +173 -0
  127. package/dist/testing.js.map +1 -0
  128. package/dist/testing.mjs +158 -0
  129. package/dist/testing.mjs.map +1 -0
  130. package/dist/{theme.d.cts → theme.d.mts} +18 -11
  131. package/dist/theme.d.ts +18 -11
  132. package/dist/theme.js +205 -19
  133. package/dist/theme.js.map +1 -1
  134. package/dist/theme.mjs +311 -0
  135. package/dist/theme.mjs.map +1 -0
  136. package/dist/types-DXr2PmGP.d.mts +31 -0
  137. package/dist/types-DXr2PmGP.d.ts +31 -0
  138. package/dist/vite.d.mts +51 -0
  139. package/dist/vite.d.ts +35 -6
  140. package/dist/vite.js +4254 -57
  141. package/dist/vite.js.map +1 -1
  142. package/dist/vite.mjs +4281 -0
  143. package/dist/vite.mjs.map +1 -0
  144. package/dist/vue.d.mts +89 -0
  145. package/dist/vue.d.ts +89 -0
  146. package/dist/vue.js +104 -0
  147. package/dist/vue.js.map +1 -0
  148. package/dist/vue.mjs +96 -0
  149. package/dist/vue.mjs.map +1 -0
  150. package/package.json +173 -67
  151. package/dist/animate.cjs +0 -252
  152. package/dist/animate.cjs.map +0 -1
  153. package/dist/animate.d.cts +0 -117
  154. package/dist/astTransform-ua-eapqs.d.cts +0 -41
  155. package/dist/astTransform-ua-eapqs.d.ts +0 -41
  156. package/dist/compiler.cjs.map +0 -1
  157. package/dist/css.cjs +0 -71
  158. package/dist/css.cjs.map +0 -1
  159. package/dist/css.d.cts +0 -45
  160. package/dist/css.d.ts +0 -45
  161. package/dist/css.js +0 -62
  162. package/dist/css.js.map +0 -1
  163. package/dist/devtools.cjs.map +0 -1
  164. package/dist/index.cjs +0 -1058
  165. package/dist/index.cjs.map +0 -1
  166. package/dist/next.cjs +0 -268
  167. package/dist/next.cjs.map +0 -1
  168. package/dist/next.d.cts +0 -45
  169. package/dist/plugins.cjs +0 -396
  170. package/dist/plugins.cjs.map +0 -1
  171. package/dist/plugins.d.cts +0 -231
  172. package/dist/plugins.d.ts +0 -231
  173. package/dist/plugins.js +0 -381
  174. package/dist/plugins.js.map +0 -1
  175. package/dist/preset.cjs +0 -129
  176. package/dist/preset.cjs.map +0 -1
  177. package/dist/theme.cjs +0 -154
  178. package/dist/theme.cjs.map +0 -1
  179. package/dist/turbopackLoader.cjs +0 -2689
  180. package/dist/turbopackLoader.cjs.map +0 -1
  181. package/dist/turbopackLoader.d.cts +0 -22
  182. package/dist/turbopackLoader.d.ts +0 -22
  183. package/dist/turbopackLoader.js +0 -2681
  184. package/dist/turbopackLoader.js.map +0 -1
  185. package/dist/vite.cjs +0 -105
  186. package/dist/vite.cjs.map +0 -1
  187. package/dist/vite.d.cts +0 -22
  188. package/dist/webpackLoader.cjs +0 -2670
  189. package/dist/webpackLoader.cjs.map +0 -1
  190. package/dist/webpackLoader.d.cts +0 -24
  191. package/dist/webpackLoader.d.ts +0 -24
  192. package/dist/webpackLoader.js +0 -2662
  193. package/dist/webpackLoader.js.map +0 -1
  194. /package/dist/{devtools.d.cts → devtools.d.mts} +0 -0
@@ -1,42 +1,14 @@
1
- 'use strict';
1
+ import { createHash } from 'crypto';
2
+ import fs3 from 'fs';
3
+ import { createRequire } from 'module';
4
+ import path7 from 'path';
5
+ import { twMerge } from 'tailwind-merge';
2
6
 
3
- var module$1 = require('module');
4
- var tailwindMerge = require('tailwind-merge');
5
- var fs2 = require('fs');
6
- var path4 = require('path');
7
- var crypto = require('crypto');
8
-
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
- var fs2__default = /*#__PURE__*/_interopDefault(fs2);
12
- var path4__default = /*#__PURE__*/_interopDefault(path4);
13
- var crypto__default = /*#__PURE__*/_interopDefault(crypto);
14
-
15
- /* tailwind-styled-v4 v4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
7
+ /* tailwind-styled-v4 v5.0.1 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
16
8
  var __defProp = Object.defineProperty;
17
- var __defProps = Object.defineProperties;
18
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
20
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
21
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
22
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
23
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
24
- var __typeError = (msg) => {
25
- throw TypeError(msg);
26
- };
27
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
28
- var __spreadValues = (a, b) => {
29
- for (var prop in b || (b = {}))
30
- if (__hasOwnProp.call(b, prop))
31
- __defNormalProp(a, prop, b[prop]);
32
- if (__getOwnPropSymbols)
33
- for (var prop of __getOwnPropSymbols(b)) {
34
- if (__propIsEnum.call(b, prop))
35
- __defNormalProp(a, prop, b[prop]);
36
- }
37
- return a;
38
- };
39
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
40
12
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
41
13
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
42
14
  }) : x)(function(x) {
@@ -59,12 +31,165 @@ var __copyProps = (to, from, except, desc) => {
59
31
  return to;
60
32
  };
61
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
62
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
63
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
64
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
65
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
34
+
35
+ // packages/shared/src/logger.ts
36
+ function getEnvLevel() {
37
+ const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
38
+ if (env && env in LEVELS) return env;
39
+ return process.env.TWS_DEBUG_SCANNER === "1" ? "debug" : "info";
40
+ }
41
+ function createLogger(prefix, level) {
42
+ let currentLevel = getEnvLevel();
43
+ const log2 = (msgLevel, stream, args) => {
44
+ if (LEVELS[msgLevel] > LEVELS[currentLevel]) return;
45
+ const line = `[${prefix}] ${args.map(String).join(" ")}
46
+ `;
47
+ process[stream].write(line);
48
+ };
49
+ return {
50
+ error: (...a) => log2("error", "stderr", a),
51
+ warn: (...a) => log2("warn", "stderr", a),
52
+ info: (...a) => log2("info", "stdout", a),
53
+ debug: (...a) => log2("debug", "stderr", a),
54
+ setLevel: (l) => {
55
+ currentLevel = l;
56
+ }
57
+ };
58
+ }
59
+ var LEVELS;
60
+ var init_logger = __esm({
61
+ "packages/shared/src/logger.ts"() {
62
+ LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
63
+ createLogger("tailwind-styled");
64
+ }
65
+ });
66
+ function hashContent(content, algorithm = "md5", length = 8) {
67
+ return createHash(algorithm).update(content).digest("hex").slice(0, length);
68
+ }
69
+ var init_hash = __esm({
70
+ "packages/shared/src/hash.ts"() {
71
+ }
72
+ });
73
+
74
+ // packages/shared/src/index.ts
75
+ var init_src = __esm({
76
+ "packages/shared/src/index.ts"() {
77
+ init_logger();
78
+ init_hash();
79
+ }
80
+ });
81
+
82
+ // packages/compiler/src/nativeBridge.ts
83
+ var nativeBridge_exports = {};
84
+ __export(nativeBridge_exports, {
85
+ adaptNativeResult: () => adaptNativeResult,
86
+ getNativeBridge: () => getNativeBridge,
87
+ resetNativeBridgeCache: () => resetNativeBridgeCache
88
+ });
89
+ function tryRequire(id) {
90
+ try {
91
+ const mod = requireFromRuntime(id);
92
+ return mod ?? null;
93
+ } catch (error) {
94
+ log.debug(
95
+ `native bridge load miss ${id}: ${error instanceof Error ? error.message : String(error)}`
96
+ );
97
+ return null;
98
+ }
99
+ }
100
+ function getNativeBridge() {
101
+ if (cachedBridge !== void 0) {
102
+ if (cachedBridge === null) {
103
+ throw new Error(
104
+ `[tailwind-styled/compiler v5] Native binding is required but not available.
105
+ Please ensure:
106
+ 1. The native module is properly installed
107
+ 2. You have run: npm run build:native (or use prebuilt binary)
108
+ 3. TWS_NO_NATIVE environment variable is not set
109
+
110
+ For help, see: https://tailwind-styled.dev/docs/install`
111
+ );
112
+ }
113
+ return cachedBridge;
114
+ }
115
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1") {
116
+ cachedBridge = null;
117
+ throw new Error(
118
+ `[tailwind-styled/compiler v5] Native binding is required.
119
+ The TWS_NO_NATIVE or TWS_NO_RUST environment variable is set, which disables native binding.
120
+ Please unset this environment variable to use the native compiler.`
121
+ );
122
+ }
123
+ const candidates = [
124
+ "@tailwind-styled/native",
125
+ path7.resolve(process.cwd(), "native", "index.mjs"),
126
+ path7.resolve(runtimeDir, "..", "..", "native", "index.mjs"),
127
+ path7.resolve(runtimeDir, "..", "..", "..", "native", "index.mjs"),
128
+ path7.resolve(process.cwd(), "native", "index.node"),
129
+ path7.resolve(runtimeDir, "..", "..", "native", "index.node"),
130
+ path7.resolve(runtimeDir, "..", "..", "..", "native", "index.node")
131
+ ];
132
+ for (const candidate of candidates) {
133
+ const bridge = tryRequire(candidate);
134
+ if (bridge) {
135
+ log.debug(`native bridge loaded from ${candidate}`);
136
+ cachedBridge = bridge;
137
+ return cachedBridge;
138
+ }
139
+ }
140
+ cachedBridge = null;
141
+ throw new Error(
142
+ `[tailwind-styled/compiler v5] Native binding not found.
143
+ Tried loading from:
144
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
145
+
146
+ Please build the native module:
147
+ npm run build:native
148
+
149
+ Or install a prebuilt binary for your platform.`
150
+ );
151
+ }
152
+ function resetNativeBridgeCache() {
153
+ cachedBridge = void 0;
154
+ }
155
+ function adaptNativeResult(raw) {
156
+ let rsc;
157
+ if (raw.rscJson) {
158
+ try {
159
+ const parsed = JSON.parse(raw.rscJson);
160
+ rsc = {
161
+ isServer: parsed.isServer,
162
+ needsClientDirective: parsed.needsClientDirective,
163
+ clientReasons: []
164
+ };
165
+ } catch {
166
+ }
167
+ }
168
+ let metadata;
169
+ if (raw.metadataJson) {
170
+ try {
171
+ metadata = JSON.parse(raw.metadataJson);
172
+ } catch {
173
+ }
174
+ }
175
+ return {
176
+ code: raw.code,
177
+ classes: raw.classes,
178
+ changed: raw.changed,
179
+ rsc,
180
+ metadata
181
+ };
182
+ }
183
+ var runtimeDir, requireFromRuntime, cachedBridge, log;
184
+ var init_nativeBridge = __esm({
185
+ "packages/compiler/src/nativeBridge.ts"() {
186
+ init_src();
187
+ runtimeDir = typeof __dirname === "string" && __dirname.length > 0 ? __dirname : process.cwd();
188
+ requireFromRuntime = typeof module !== "undefined" && typeof module.require === "function" ? module.require.bind(module) : createRequire(path7.join(runtimeDir, "noop.cjs"));
189
+ log = createLogger("compiler:native");
190
+ }
191
+ });
66
192
  function requireNative() {
67
- var _a2, _b2, _c, _d;
68
193
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
69
194
  try {
70
195
  return require2(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
@@ -81,8 +206,8 @@ function requireNative() {
81
206
  try {
82
207
  const binding = require2("@oxc-parser/binding-android-arm64");
83
208
  const bindingPackageVersion = require2("@oxc-parser/binding-android-arm64/package.json").version;
84
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
85
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
209
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
210
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
86
211
  }
87
212
  return binding;
88
213
  } catch (e) {
@@ -97,8 +222,8 @@ function requireNative() {
97
222
  try {
98
223
  const binding = require2("@oxc-parser/binding-android-arm-eabi");
99
224
  const bindingPackageVersion = require2("@oxc-parser/binding-android-arm-eabi/package.json").version;
100
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
101
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
225
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
226
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
102
227
  }
103
228
  return binding;
104
229
  } catch (e) {
@@ -109,7 +234,7 @@ function requireNative() {
109
234
  }
110
235
  } else if (process.platform === "win32") {
111
236
  if (process.arch === "x64") {
112
- if (((_b2 = (_a2 = process.config) == null ? void 0 : _a2.variables) == null ? void 0 : _b2.shlib_suffix) === "dll.a" || ((_d = (_c = process.config) == null ? void 0 : _c.variables) == null ? void 0 : _d.node_target_type) === "shared_library") {
237
+ if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
113
238
  try {
114
239
  return require2("./parser.win32-x64-gnu.node");
115
240
  } catch (e) {
@@ -118,8 +243,8 @@ function requireNative() {
118
243
  try {
119
244
  const binding = require2("@oxc-parser/binding-win32-x64-gnu");
120
245
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-gnu/package.json").version;
121
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
122
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
246
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
247
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
248
  }
124
249
  return binding;
125
250
  } catch (e) {
@@ -134,8 +259,8 @@ function requireNative() {
134
259
  try {
135
260
  const binding = require2("@oxc-parser/binding-win32-x64-msvc");
136
261
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-msvc/package.json").version;
137
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
138
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
262
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
263
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
139
264
  }
140
265
  return binding;
141
266
  } catch (e) {
@@ -151,8 +276,8 @@ function requireNative() {
151
276
  try {
152
277
  const binding = require2("@oxc-parser/binding-win32-ia32-msvc");
153
278
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-ia32-msvc/package.json").version;
154
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
155
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
279
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
280
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
156
281
  }
157
282
  return binding;
158
283
  } catch (e) {
@@ -167,8 +292,8 @@ function requireNative() {
167
292
  try {
168
293
  const binding = require2("@oxc-parser/binding-win32-arm64-msvc");
169
294
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-arm64-msvc/package.json").version;
170
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
171
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
295
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
296
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
172
297
  }
173
298
  return binding;
174
299
  } catch (e) {
@@ -186,8 +311,8 @@ function requireNative() {
186
311
  try {
187
312
  const binding = require2("@oxc-parser/binding-darwin-universal");
188
313
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-universal/package.json").version;
189
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
190
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
314
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
315
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
191
316
  }
192
317
  return binding;
193
318
  } catch (e) {
@@ -202,8 +327,8 @@ function requireNative() {
202
327
  try {
203
328
  const binding = require2("@oxc-parser/binding-darwin-x64");
204
329
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-x64/package.json").version;
205
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
206
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
330
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
331
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
207
332
  }
208
333
  return binding;
209
334
  } catch (e) {
@@ -218,8 +343,8 @@ function requireNative() {
218
343
  try {
219
344
  const binding = require2("@oxc-parser/binding-darwin-arm64");
220
345
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-arm64/package.json").version;
221
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
222
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
346
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
347
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
223
348
  }
224
349
  return binding;
225
350
  } catch (e) {
@@ -238,8 +363,8 @@ function requireNative() {
238
363
  try {
239
364
  const binding = require2("@oxc-parser/binding-freebsd-x64");
240
365
  const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-x64/package.json").version;
241
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
242
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
366
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
367
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
243
368
  }
244
369
  return binding;
245
370
  } catch (e) {
@@ -254,8 +379,8 @@ function requireNative() {
254
379
  try {
255
380
  const binding = require2("@oxc-parser/binding-freebsd-arm64");
256
381
  const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-arm64/package.json").version;
257
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
258
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
382
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
383
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
259
384
  }
260
385
  return binding;
261
386
  } catch (e) {
@@ -275,8 +400,8 @@ function requireNative() {
275
400
  try {
276
401
  const binding = require2("@oxc-parser/binding-linux-x64-musl");
277
402
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-musl/package.json").version;
278
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
279
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
403
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
404
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
280
405
  }
281
406
  return binding;
282
407
  } catch (e) {
@@ -291,8 +416,8 @@ function requireNative() {
291
416
  try {
292
417
  const binding = require2("@oxc-parser/binding-linux-x64-gnu");
293
418
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-gnu/package.json").version;
294
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
295
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
419
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
420
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
296
421
  }
297
422
  return binding;
298
423
  } catch (e) {
@@ -309,8 +434,8 @@ function requireNative() {
309
434
  try {
310
435
  const binding = require2("@oxc-parser/binding-linux-arm64-musl");
311
436
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-musl/package.json").version;
312
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
313
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
437
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
438
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
314
439
  }
315
440
  return binding;
316
441
  } catch (e) {
@@ -325,8 +450,8 @@ function requireNative() {
325
450
  try {
326
451
  const binding = require2("@oxc-parser/binding-linux-arm64-gnu");
327
452
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-gnu/package.json").version;
328
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
329
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
453
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
454
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
330
455
  }
331
456
  return binding;
332
457
  } catch (e) {
@@ -343,8 +468,8 @@ function requireNative() {
343
468
  try {
344
469
  const binding = require2("@oxc-parser/binding-linux-arm-musleabihf");
345
470
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-musleabihf/package.json").version;
346
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
347
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
471
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
472
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
348
473
  }
349
474
  return binding;
350
475
  } catch (e) {
@@ -359,8 +484,8 @@ function requireNative() {
359
484
  try {
360
485
  const binding = require2("@oxc-parser/binding-linux-arm-gnueabihf");
361
486
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-gnueabihf/package.json").version;
362
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
363
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
487
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
488
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
364
489
  }
365
490
  return binding;
366
491
  } catch (e) {
@@ -377,8 +502,8 @@ function requireNative() {
377
502
  try {
378
503
  const binding = require2("@oxc-parser/binding-linux-loong64-musl");
379
504
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-musl/package.json").version;
380
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
381
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
505
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
506
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
382
507
  }
383
508
  return binding;
384
509
  } catch (e) {
@@ -393,8 +518,8 @@ function requireNative() {
393
518
  try {
394
519
  const binding = require2("@oxc-parser/binding-linux-loong64-gnu");
395
520
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-gnu/package.json").version;
396
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
397
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
521
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
522
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
398
523
  }
399
524
  return binding;
400
525
  } catch (e) {
@@ -411,8 +536,8 @@ function requireNative() {
411
536
  try {
412
537
  const binding = require2("@oxc-parser/binding-linux-riscv64-musl");
413
538
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-musl/package.json").version;
414
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
415
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
539
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
540
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
416
541
  }
417
542
  return binding;
418
543
  } catch (e) {
@@ -427,8 +552,8 @@ function requireNative() {
427
552
  try {
428
553
  const binding = require2("@oxc-parser/binding-linux-riscv64-gnu");
429
554
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-gnu/package.json").version;
430
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
431
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
555
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
556
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
432
557
  }
433
558
  return binding;
434
559
  } catch (e) {
@@ -444,8 +569,8 @@ function requireNative() {
444
569
  try {
445
570
  const binding = require2("@oxc-parser/binding-linux-ppc64-gnu");
446
571
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-ppc64-gnu/package.json").version;
447
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
448
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
572
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
573
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
449
574
  }
450
575
  return binding;
451
576
  } catch (e) {
@@ -460,8 +585,8 @@ function requireNative() {
460
585
  try {
461
586
  const binding = require2("@oxc-parser/binding-linux-s390x-gnu");
462
587
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-s390x-gnu/package.json").version;
463
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
464
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
588
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
589
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
465
590
  }
466
591
  return binding;
467
592
  } catch (e) {
@@ -480,8 +605,8 @@ function requireNative() {
480
605
  try {
481
606
  const binding = require2("@oxc-parser/binding-openharmony-arm64");
482
607
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm64/package.json").version;
483
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
484
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
608
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
609
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
485
610
  }
486
611
  return binding;
487
612
  } catch (e) {
@@ -496,8 +621,8 @@ function requireNative() {
496
621
  try {
497
622
  const binding = require2("@oxc-parser/binding-openharmony-x64");
498
623
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-x64/package.json").version;
499
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
500
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
624
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
625
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
501
626
  }
502
627
  return binding;
503
628
  } catch (e) {
@@ -512,8 +637,8 @@ function requireNative() {
512
637
  try {
513
638
  const binding = require2("@oxc-parser/binding-openharmony-arm");
514
639
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm/package.json").version;
515
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
516
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
640
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
641
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
517
642
  }
518
643
  return binding;
519
644
  } catch (e) {
@@ -526,12 +651,11 @@ function requireNative() {
526
651
  loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
527
652
  }
528
653
  }
529
- var import_meta, require2, readFileSync, nativeBinding, loadErrors, isMusl, isFileMusl, isMuslFromFilesystem, isMuslFromReport, isMuslFromChildProcess, _a, _b, Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse, parseSync, rawTransferSupported, getBufferOffset, parseRaw, parseRawSync;
654
+ var require2, readFileSync, nativeBinding, loadErrors, isMusl, isFileMusl, isMuslFromFilesystem, isMuslFromReport, isMuslFromChildProcess, Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse, parseSync, rawTransferSupported, getBufferOffset, parseRaw, parseRawSync;
530
655
  var init_bindings = __esm({
531
- "../../node_modules/oxc-parser/src-js/bindings.js"() {
532
- import_meta = {};
533
- require2 = module$1.createRequire(import_meta.url);
534
- new URL(".", import_meta.url).pathname;
656
+ "node_modules/oxc-parser/src-js/bindings.js"() {
657
+ require2 = createRequire(import.meta.url);
658
+ new URL(".", import.meta.url).pathname;
535
659
  ({ readFileSync } = require2("node:fs"));
536
660
  nativeBinding = null;
537
661
  loadErrors = [];
@@ -552,14 +676,13 @@ var init_bindings = __esm({
552
676
  isMuslFromFilesystem = () => {
553
677
  try {
554
678
  return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
555
- } catch (e) {
679
+ } catch {
556
680
  return null;
557
681
  }
558
682
  };
559
683
  isMuslFromReport = () => {
560
- var _a2;
561
684
  let report = null;
562
- if (typeof ((_a2 = process.report) == null ? void 0 : _a2.getReport) === "function") {
685
+ if (typeof process.report?.getReport === "function") {
563
686
  process.report.excludeNetwork = true;
564
687
  report = process.report.getReport();
565
688
  }
@@ -616,7 +739,7 @@ var init_bindings = __esm({
616
739
  throw error;
617
740
  }
618
741
  }
619
- if (!nativeBinding && ((_b = (_a = globalThis.process) == null ? void 0 : _a.versions) == null ? void 0 : _b["webcontainer"])) {
742
+ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
620
743
  try {
621
744
  nativeBinding = require2("./webcontainer-fallback.cjs");
622
745
  } catch (err) {
@@ -642,17 +765,17 @@ var init_bindings = __esm({
642
765
  }
643
766
  });
644
767
 
645
- // ../../node_modules/oxc-parser/src-js/wrap.js
768
+ // node_modules/oxc-parser/src-js/wrap.js
646
769
  function wrap(result) {
647
- let program, module, comments, errors;
770
+ let program, module2, comments, errors;
648
771
  return {
649
772
  get program() {
650
773
  if (!program) program = jsonParseAst(result.program);
651
774
  return program;
652
775
  },
653
776
  get module() {
654
- if (!module) module = result.module;
655
- return module;
777
+ if (!module2) module2 = result.module;
778
+ return module2;
656
779
  },
657
780
  get comments() {
658
781
  if (!comments) comments = result.comments;
@@ -681,19 +804,19 @@ function applyFix(program, fixPath) {
681
804
  } else {
682
805
  try {
683
806
  node.value = RegExp(node.regex.pattern, node.regex.flags);
684
- } catch (e) {
807
+ } catch {
685
808
  }
686
809
  }
687
810
  }
688
811
  var init_wrap = __esm({
689
- "../../node_modules/oxc-parser/src-js/wrap.js"() {
812
+ "node_modules/oxc-parser/src-js/wrap.js"() {
690
813
  }
691
814
  });
692
815
 
693
- // ../../node_modules/oxc-parser/src-js/generated/visit/keys.js
816
+ // node_modules/oxc-parser/src-js/generated/visit/keys.js
694
817
  var freeze, $EMPTY, DECORATORS__KEY__TYPE_ANNOTATION__VALUE, LEFT__RIGHT, ARGUMENT, BODY, LABEL, CALLEE__TYPE_ARGUMENTS__ARGUMENTS, EXPRESSION, DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY, TEST__CONSEQUENT__ALTERNATE, LEFT__RIGHT__BODY, ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY, KEY__VALUE, LOCAL, OBJECT__PROPERTY, DECORATORS__KEY__TYPE_ANNOTATION, EXPRESSION__TYPE_ANNOTATION, TYPE_PARAMETERS__PARAMS__RETURN_TYPE, EXPRESSION__TYPE_ARGUMENTS, MEMBERS, ID__BODY, TYPES, TYPE_ANNOTATION, PARAMS, keys_default;
695
818
  var init_keys = __esm({
696
- "../../node_modules/oxc-parser/src-js/generated/visit/keys.js"() {
819
+ "node_modules/oxc-parser/src-js/generated/visit/keys.js"() {
697
820
  ({ freeze } = Object);
698
821
  $EMPTY = freeze([]);
699
822
  DECORATORS__KEY__TYPE_ANNOTATION__VALUE = freeze([
@@ -909,16 +1032,15 @@ var init_keys = __esm({
909
1032
  });
910
1033
  }
911
1034
  });
912
- var import_meta2, walkProgram, addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor, _compiledVisitor, Visitor;
1035
+ var walkProgram, addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor, Visitor;
913
1036
  var init_visit = __esm({
914
- "../../node_modules/oxc-parser/src-js/visit/index.js"() {
915
- import_meta2 = {};
1037
+ "node_modules/oxc-parser/src-js/visit/index.js"() {
916
1038
  walkProgram = null;
917
1039
  Visitor = class {
1040
+ #compiledVisitor = null;
918
1041
  constructor(visitor) {
919
- __privateAdd(this, _compiledVisitor, null);
920
1042
  if (walkProgram === null) {
921
- const require4 = module$1.createRequire(import_meta2.url);
1043
+ const require4 = createRequire(import.meta.url);
922
1044
  ({ walkProgram } = require4("../generated/visit/walk.js"));
923
1045
  ({
924
1046
  addVisitorToCompiled,
@@ -929,7 +1051,7 @@ var init_visit = __esm({
929
1051
  const compiledVisitor = createCompiledVisitor();
930
1052
  addVisitorToCompiled(visitor);
931
1053
  const needsVisit = finalizeCompiledVisitor();
932
- if (needsVisit) __privateSet(this, _compiledVisitor, compiledVisitor);
1054
+ if (needsVisit) this.#compiledVisitor = compiledVisitor;
933
1055
  }
934
1056
  /**
935
1057
  * Visit AST.
@@ -937,15 +1059,14 @@ var init_visit = __esm({
937
1059
  * @returns {undefined}
938
1060
  */
939
1061
  visit(program) {
940
- const compiledVisitor = __privateGet(this, _compiledVisitor);
1062
+ const compiledVisitor = this.#compiledVisitor;
941
1063
  if (compiledVisitor !== null) walkProgram(program, compiledVisitor);
942
1064
  }
943
1065
  };
944
- _compiledVisitor = new WeakMap();
945
1066
  }
946
1067
  });
947
1068
 
948
- // ../../node_modules/oxc-parser/src-js/raw-transfer/supported.js
1069
+ // node_modules/oxc-parser/src-js/raw-transfer/supported.js
949
1070
  function rawTransferSupported2() {
950
1071
  if (rawTransferIsSupported === null) {
951
1072
  rawTransferIsSupported = rawTransferRuntimeSupported() && rawTransferSupported();
@@ -953,34 +1074,33 @@ function rawTransferSupported2() {
953
1074
  return rawTransferIsSupported;
954
1075
  }
955
1076
  function rawTransferRuntimeSupported() {
956
- var _a2, _b2, _c, _d, _e, _f, _g;
957
1077
  let global;
958
1078
  try {
959
1079
  global = globalThis;
960
- } catch (e) {
1080
+ } catch {
961
1081
  return false;
962
1082
  }
963
- const isBun = !!global.Bun || !!((_b2 = (_a2 = global.process) == null ? void 0 : _a2.versions) == null ? void 0 : _b2.bun);
1083
+ const isBun = !!global.Bun || !!global.process?.versions?.bun;
964
1084
  if (isBun) return false;
965
1085
  const isDeno = !!global.Deno;
966
1086
  if (isDeno) {
967
- const match2 = (_d = (_c = Deno.version) == null ? void 0 : _c.deno) == null ? void 0 : _d.match(/^(\d+)\./);
1087
+ const match2 = Deno.version?.deno?.match(/^(\d+)\./);
968
1088
  return !!match2 && match2[1] * 1 >= 2;
969
1089
  }
970
- const isNode = ((_f = (_e = global.process) == null ? void 0 : _e.release) == null ? void 0 : _f.name) === "node";
1090
+ const isNode = global.process?.release?.name === "node";
971
1091
  if (!isNode) return false;
972
- const match = (_g = process.version) == null ? void 0 : _g.match(/^v(\d+)\./);
1092
+ const match = process.version?.match(/^v(\d+)\./);
973
1093
  return !!match && match[1] * 1 >= 22;
974
1094
  }
975
1095
  var rawTransferIsSupported;
976
1096
  var init_supported = __esm({
977
- "../../node_modules/oxc-parser/src-js/raw-transfer/supported.js"() {
1097
+ "node_modules/oxc-parser/src-js/raw-transfer/supported.js"() {
978
1098
  init_bindings();
979
1099
  rawTransferIsSupported = null;
980
1100
  }
981
1101
  });
982
1102
 
983
- // ../../node_modules/oxc-parser/src-js/index.js
1103
+ // node_modules/oxc-parser/src-js/index.js
984
1104
  var src_js_exports = {};
985
1105
  __export(src_js_exports, {
986
1106
  ExportExportNameKind: () => ExportExportNameKind,
@@ -1007,22 +1127,22 @@ function loadRawTransferLazy() {
1007
1127
  }
1008
1128
  }
1009
1129
  function parseSync2(filename, sourceText, options) {
1010
- if (options == null ? void 0 : options.experimentalRawTransfer) {
1130
+ if (options?.experimentalRawTransfer) {
1011
1131
  loadRawTransfer();
1012
1132
  return parseSyncRaw(filename, sourceText, options);
1013
1133
  }
1014
- if (options == null ? void 0 : options.experimentalLazy) {
1134
+ if (options?.experimentalLazy) {
1015
1135
  loadRawTransferLazy();
1016
1136
  return parseSyncLazy(filename, sourceText, options);
1017
1137
  }
1018
1138
  return wrap(parseSync(filename, sourceText, options));
1019
1139
  }
1020
1140
  async function parse2(filename, sourceText, options) {
1021
- if (options == null ? void 0 : options.experimentalRawTransfer) {
1141
+ if (options?.experimentalRawTransfer) {
1022
1142
  loadRawTransfer();
1023
1143
  return await parseRaw2(filename, sourceText, options);
1024
1144
  }
1025
- if (options == null ? void 0 : options.experimentalLazy) {
1145
+ if (options?.experimentalLazy) {
1026
1146
  loadRawTransferLazy();
1027
1147
  return await parseLazy(filename, sourceText, options);
1028
1148
  }
@@ -1032,23 +1152,91 @@ function experimentalGetLazyVisitor() {
1032
1152
  loadRawTransferLazy();
1033
1153
  return LazyVisitor;
1034
1154
  }
1035
- var import_meta3, require3, parseSyncRaw, parseRaw2, parseSyncLazy, parseLazy, LazyVisitor;
1155
+ var require3, parseSyncRaw, parseRaw2, parseSyncLazy, parseLazy, LazyVisitor;
1036
1156
  var init_src_js = __esm({
1037
- "../../node_modules/oxc-parser/src-js/index.js"() {
1157
+ "node_modules/oxc-parser/src-js/index.js"() {
1038
1158
  init_bindings();
1039
1159
  init_wrap();
1040
1160
  init_keys();
1041
1161
  init_visit();
1042
1162
  init_bindings();
1043
1163
  init_supported();
1044
- import_meta3 = {};
1045
- require3 = module$1.createRequire(import_meta3.url);
1164
+ require3 = createRequire(import.meta.url);
1046
1165
  parseSyncRaw = null;
1047
1166
  parseSyncLazy = null;
1048
1167
  }
1049
1168
  });
1050
1169
 
1051
- // ../compiler/src/atomicCss.ts
1170
+ // packages/compiler/src/cssCompiler.ts
1171
+ var cssCompiler_exports = {};
1172
+ __export(cssCompiler_exports, {
1173
+ buildStyleTag: () => buildStyleTag,
1174
+ compileCssFromClasses: () => compileCssFromClasses
1175
+ });
1176
+ function getBinding() {
1177
+ if (_binding !== void 0) {
1178
+ if (_binding === null) {
1179
+ throw new Error(
1180
+ `[tailwind-styled/compiler v5] Native CSS binding is required but not available.
1181
+ Please ensure the native module is properly built.`
1182
+ );
1183
+ }
1184
+ return _binding;
1185
+ }
1186
+ if (process.env.TWS_NO_NATIVE === "1") {
1187
+ _binding = null;
1188
+ throw new Error(
1189
+ `[tailwind-styled/compiler v5] Native binding is required.
1190
+ The TWS_NO_NATIVE environment variable is set, which disables native binding.`
1191
+ );
1192
+ }
1193
+ const req = typeof __require === "function" ? __require : createRequire(import.meta.url);
1194
+ const candidates = [
1195
+ path7.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
1196
+ path7.resolve(__dirname, "..", "..", "..", "..", "native", "tailwind_styled_parser.node")
1197
+ ];
1198
+ for (const c of candidates) {
1199
+ try {
1200
+ const mod = req(c);
1201
+ if (mod?.compileCss) {
1202
+ _binding = mod;
1203
+ return _binding;
1204
+ }
1205
+ } catch {
1206
+ }
1207
+ }
1208
+ _binding = null;
1209
+ throw new Error(
1210
+ `[tailwind-styled/compiler v5] Native CSS binding not found.
1211
+ Tried loading from:
1212
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
1213
+
1214
+ Please build the native module.`
1215
+ );
1216
+ }
1217
+ function compileCssFromClasses(classes, options = {}) {
1218
+ const binding = getBinding();
1219
+ const prefix = options.prefix ?? null;
1220
+ const r = binding.compileCss(classes, prefix);
1221
+ return {
1222
+ css: r.css,
1223
+ resolvedClasses: r.resolvedClasses,
1224
+ unknownClasses: r.unknownClasses,
1225
+ sizeBytes: r.sizeBytes,
1226
+ engine: "rust"
1227
+ };
1228
+ }
1229
+ function buildStyleTag(classes) {
1230
+ const { css } = compileCssFromClasses(classes);
1231
+ return css ? `<style data-tailwind-styled>${css}</style>` : "";
1232
+ }
1233
+ var _binding;
1234
+ var init_cssCompiler = __esm({
1235
+ "packages/compiler/src/cssCompiler.ts"() {
1236
+ }
1237
+ });
1238
+
1239
+ // packages/compiler/src/atomicCss.ts
1052
1240
  var atomicCss_exports = {};
1053
1241
  __export(atomicCss_exports, {
1054
1242
  clearAtomicRegistry: () => clearAtomicRegistry,
@@ -1058,7 +1246,6 @@ __export(atomicCss_exports, {
1058
1246
  toAtomicClasses: () => toAtomicClasses
1059
1247
  });
1060
1248
  function sizeValue(v) {
1061
- var _a2;
1062
1249
  const num = Number(v);
1063
1250
  if (!Number.isNaN(num)) return `${num * 0.25}rem`;
1064
1251
  const special = {
@@ -1071,10 +1258,9 @@ function sizeValue(v) {
1071
1258
  svw: "100svw",
1072
1259
  svh: "100svh"
1073
1260
  };
1074
- return (_a2 = special[v]) != null ? _a2 : v;
1261
+ return special[v] ?? v;
1075
1262
  }
1076
1263
  function textSize(v) {
1077
- var _a2;
1078
1264
  const map = {
1079
1265
  xs: "0.75rem",
1080
1266
  sm: "0.875rem",
@@ -1090,10 +1276,9 @@ function textSize(v) {
1090
1276
  "8xl": "6rem",
1091
1277
  "9xl": "8rem"
1092
1278
  };
1093
- return (_a2 = map[v]) != null ? _a2 : v;
1279
+ return map[v] ?? v;
1094
1280
  }
1095
1281
  function fontWeight(v) {
1096
- var _a2;
1097
1282
  const map = {
1098
1283
  thin: "100",
1099
1284
  extralight: "200",
@@ -1105,10 +1290,9 @@ function fontWeight(v) {
1105
1290
  extrabold: "800",
1106
1291
  black: "900"
1107
1292
  };
1108
- return (_a2 = map[v]) != null ? _a2 : v;
1293
+ return map[v] ?? v;
1109
1294
  }
1110
1295
  function leadingValue(v) {
1111
- var _a2;
1112
1296
  const map = {
1113
1297
  none: "1",
1114
1298
  tight: "1.25",
@@ -1117,10 +1301,9 @@ function leadingValue(v) {
1117
1301
  relaxed: "1.625",
1118
1302
  loose: "2"
1119
1303
  };
1120
- return (_a2 = map[v]) != null ? _a2 : v;
1304
+ return map[v] ?? v;
1121
1305
  }
1122
1306
  function roundedValue(v) {
1123
- var _a2;
1124
1307
  const map = {
1125
1308
  "": "0.25rem",
1126
1309
  sm: "0.125rem",
@@ -1132,7 +1315,7 @@ function roundedValue(v) {
1132
1315
  full: "9999px",
1133
1316
  none: "0"
1134
1317
  };
1135
- return (_a2 = map[v]) != null ? _a2 : `${v}rem`;
1318
+ return map[v] ?? `${v}rem`;
1136
1319
  }
1137
1320
  function sanitizeClassName(cls) {
1138
1321
  return cls.replace(/[/:[\].!%]/g, "_");
@@ -1216,7 +1399,7 @@ function clearAtomicRegistry() {
1216
1399
  }
1217
1400
  var REGISTRY, TW_PROPERTY_MAP;
1218
1401
  var init_atomicCss = __esm({
1219
- "../compiler/src/atomicCss.ts"() {
1402
+ "packages/compiler/src/atomicCss.ts"() {
1220
1403
  REGISTRY = /* @__PURE__ */ new Map();
1221
1404
  TW_PROPERTY_MAP = {
1222
1405
  // Spacing
@@ -1250,14 +1433,109 @@ var init_atomicCss = __esm({
1250
1433
  }
1251
1434
  });
1252
1435
 
1253
- // ../preset/src/defaultPreset.ts
1436
+ // packages/preset/src/defaultPreset.ts
1254
1437
  var defaultPreset_exports = {};
1255
1438
  __export(defaultPreset_exports, {
1256
1439
  defaultGlobalCss: () => defaultGlobalCss,
1257
1440
  defaultPreset: () => defaultPreset,
1441
+ defaultThemeCss: () => defaultThemeCss,
1258
1442
  designTokens: () => designTokens,
1259
- generateTailwindConfig: () => generateTailwindConfig
1443
+ generateTailwindConfig: () => generateTailwindConfig,
1444
+ generateTailwindCss: () => generateTailwindCss
1260
1445
  });
1446
+ function generateTailwindCss(contentPaths = STANDARD_CONTENT_PATHS) {
1447
+ return `@import "tailwindcss";
1448
+
1449
+ @theme {
1450
+ /* colors */
1451
+ --color-primary: #3b82f6;
1452
+ --color-primary-hover: #2563eb;
1453
+ --color-primary-active: #1d4ed8;
1454
+ --color-primary-foreground: #ffffff;
1455
+ --color-secondary: #6366f1;
1456
+ --color-secondary-hover: #4f46e5;
1457
+ --color-secondary-active: #4338ca;
1458
+ --color-secondary-foreground: #ffffff;
1459
+ --color-accent: #f59e0b;
1460
+ --color-accent-hover: #d97706;
1461
+ --color-accent-active: #b45309;
1462
+ --color-accent-foreground: #000000;
1463
+ --color-success: #10b981;
1464
+ --color-success-foreground: #ffffff;
1465
+ --color-warning: #f59e0b;
1466
+ --color-warning-foreground: #000000;
1467
+ --color-danger: #ef4444;
1468
+ --color-danger-foreground: #ffffff;
1469
+ --color-info: #3b82f6;
1470
+ --color-info-foreground: #ffffff;
1471
+ --color-surface: #18181b;
1472
+ --color-border: #27272a;
1473
+ --color-muted: #71717a;
1474
+ --color-subtle: #3f3f46;
1475
+
1476
+ /* fonts */
1477
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1478
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1479
+
1480
+ /* spacing */
1481
+ --spacing-1: 0.25rem;
1482
+ --spacing-2: 0.5rem;
1483
+ --spacing-3: 0.75rem;
1484
+ --spacing-4: 1rem;
1485
+ --spacing-5: 1.25rem;
1486
+ --spacing-6: 1.5rem;
1487
+ --spacing-8: 2rem;
1488
+ --spacing-10: 2.5rem;
1489
+ --spacing-12: 3rem;
1490
+ --spacing-16: 4rem;
1491
+
1492
+ /* breakpoints */
1493
+ --breakpoint-sm: 40rem;
1494
+ --breakpoint-md: 48rem;
1495
+ --breakpoint-lg: 64rem;
1496
+ --breakpoint-xl: 80rem;
1497
+ --breakpoint-2xl: 96rem;
1498
+
1499
+ /* border radius */
1500
+ --radius-sm: 0.25rem;
1501
+ --radius-md: 0.5rem;
1502
+ --radius-lg: 0.75rem;
1503
+ --radius-xl: 1rem;
1504
+ --radius-2xl: 1.5rem;
1505
+ --radius-full: 9999px;
1506
+
1507
+ /* animations */
1508
+ --animate-fade-in: fadeIn 0.2s ease-out;
1509
+ --animate-fade-out: fadeOut 0.2s ease-in;
1510
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1511
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1512
+ --animate-scale-in: scaleIn 0.2s ease-out;
1513
+ }
1514
+
1515
+ @keyframes fadeIn {
1516
+ from { opacity: 0; }
1517
+ to { opacity: 1; }
1518
+ }
1519
+ @keyframes fadeOut {
1520
+ from { opacity: 1; }
1521
+ to { opacity: 0; }
1522
+ }
1523
+ @keyframes slideUp {
1524
+ from { transform: translateY(8px); opacity: 0; }
1525
+ to { transform: translateY(0); opacity: 1; }
1526
+ }
1527
+ @keyframes slideDown {
1528
+ from { transform: translateY(-8px); opacity: 0; }
1529
+ to { transform: translateY(0); opacity: 1; }
1530
+ }
1531
+ @keyframes scaleIn {
1532
+ from { transform: scale(0.95); opacity: 0; }
1533
+ to { transform: scale(1); opacity: 1; }
1534
+ }
1535
+
1536
+ @source ${contentPaths.join("\n@source ")}
1537
+ `;
1538
+ }
1261
1539
  function generateTailwindConfig(safelistPath = ".tailwind-styled-safelist.json", contentPaths = STANDARD_CONTENT_PATHS) {
1262
1540
  return `import type { Config } from "tailwindcss"
1263
1541
  import { defaultPreset } from "tailwind-styled-v4/preset"
@@ -1275,9 +1553,9 @@ export default {
1275
1553
  } satisfies Config
1276
1554
  `;
1277
1555
  }
1278
- var STANDARD_CONTENT_PATHS, designTokens, defaultPreset, defaultGlobalCss;
1556
+ var STANDARD_CONTENT_PATHS, designTokens, defaultPreset, defaultThemeCss, defaultGlobalCss;
1279
1557
  var init_defaultPreset = __esm({
1280
- "../preset/src/defaultPreset.ts"() {
1558
+ "packages/preset/src/defaultPreset.ts"() {
1281
1559
  STANDARD_CONTENT_PATHS = [
1282
1560
  // Next.js App Router
1283
1561
  "./src/**/*.{tsx,ts,jsx,js,mdx}",
@@ -1292,21 +1570,43 @@ var init_defaultPreset = __esm({
1292
1570
  ];
1293
1571
  designTokens = {
1294
1572
  colors: {
1295
- // Brand
1296
1573
  primary: { DEFAULT: "#3b82f6", hover: "#2563eb", active: "#1d4ed8", foreground: "#ffffff" },
1297
1574
  secondary: { DEFAULT: "#6366f1", hover: "#4f46e5", active: "#4338ca", foreground: "#ffffff" },
1298
1575
  accent: { DEFAULT: "#f59e0b", hover: "#d97706", active: "#b45309", foreground: "#000000" },
1299
- // Semantic
1300
1576
  success: { DEFAULT: "#10b981", foreground: "#ffffff" },
1301
1577
  warning: { DEFAULT: "#f59e0b", foreground: "#000000" },
1302
1578
  danger: { DEFAULT: "#ef4444", foreground: "#ffffff" },
1303
1579
  info: { DEFAULT: "#3b82f6", foreground: "#ffffff" },
1304
- // Neutral
1305
1580
  surface: "#18181b",
1306
1581
  border: "#27272a",
1307
1582
  muted: "#71717a",
1308
1583
  subtle: "#3f3f46"
1309
1584
  },
1585
+ spacing: {
1586
+ 1: "0.25rem",
1587
+ 2: "0.5rem",
1588
+ 3: "0.75rem",
1589
+ 4: "1rem",
1590
+ 5: "1.25rem",
1591
+ 6: "1.5rem",
1592
+ 8: "2rem",
1593
+ 10: "2.5rem",
1594
+ 12: "3rem",
1595
+ 16: "4rem"
1596
+ },
1597
+ breakpoints: {
1598
+ sm: "40rem",
1599
+ md: "48rem",
1600
+ lg: "64rem",
1601
+ xl: "80rem",
1602
+ "2xl": "96rem"
1603
+ },
1604
+ fontWeight: {
1605
+ normal: "400",
1606
+ medium: "500",
1607
+ semibold: "600",
1608
+ bold: "700"
1609
+ },
1310
1610
  fontFamily: {
1311
1611
  sans: ["InterVariable", "Inter", "system-ui", "sans-serif"],
1312
1612
  mono: ["JetBrains Mono", "Fira Code", "Consolas", "monospace"]
@@ -1358,8 +1658,183 @@ var init_defaultPreset = __esm({
1358
1658
  },
1359
1659
  plugins: []
1360
1660
  };
1661
+ defaultThemeCss = `@import "tailwindcss";
1662
+
1663
+ @theme {
1664
+ /* colors */
1665
+ --color-primary: #3b82f6;
1666
+ --color-primary-hover: #2563eb;
1667
+ --color-primary-active: #1d4ed8;
1668
+ --color-primary-foreground: #ffffff;
1669
+ --color-secondary: #6366f1;
1670
+ --color-secondary-hover: #4f46e5;
1671
+ --color-secondary-active: #4338ca;
1672
+ --color-secondary-foreground: #ffffff;
1673
+ --color-accent: #f59e0b;
1674
+ --color-accent-hover: #d97706;
1675
+ --color-accent-active: #b45309;
1676
+ --color-accent-foreground: #000000;
1677
+ --color-success: #10b981;
1678
+ --color-success-foreground: #ffffff;
1679
+ --color-warning: #f59e0b;
1680
+ --color-warning-foreground: #000000;
1681
+ --color-danger: #ef4444;
1682
+ --color-danger-foreground: #ffffff;
1683
+ --color-info: #3b82f6;
1684
+ --color-info-foreground: #ffffff;
1685
+ --color-surface: #18181b;
1686
+ --color-border: #27272a;
1687
+ --color-muted: #71717a;
1688
+ --color-subtle: #3f3f46;
1689
+
1690
+ /* fonts */
1691
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1692
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1693
+
1694
+ /* spacing */
1695
+ --spacing-1: 0.25rem;
1696
+ --spacing-2: 0.5rem;
1697
+ --spacing-3: 0.75rem;
1698
+ --spacing-4: 1rem;
1699
+ --spacing-5: 1.25rem;
1700
+ --spacing-6: 1.5rem;
1701
+ --spacing-8: 2rem;
1702
+ --spacing-10: 2.5rem;
1703
+ --spacing-12: 3rem;
1704
+ --spacing-16: 4rem;
1705
+
1706
+ /* breakpoints */
1707
+ --breakpoint-sm: 40rem;
1708
+ --breakpoint-md: 48rem;
1709
+ --breakpoint-lg: 64rem;
1710
+ --breakpoint-xl: 80rem;
1711
+ --breakpoint-2xl: 96rem;
1712
+
1713
+ /* border radius */
1714
+ --radius-sm: 0.25rem;
1715
+ --radius-md: 0.5rem;
1716
+ --radius-lg: 0.75rem;
1717
+ --radius-xl: 1rem;
1718
+ --radius-2xl: 1.5rem;
1719
+ --radius-full: 9999px;
1720
+
1721
+ /* animations */
1722
+ --animate-fade-in: fadeIn 0.2s ease-out;
1723
+ --animate-fade-out: fadeOut 0.2s ease-in;
1724
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1725
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1726
+ --animate-scale-in: scaleIn 0.2s ease-out;
1727
+ }
1728
+
1729
+ @keyframes fadeIn {
1730
+ from { opacity: 0; }
1731
+ to { opacity: 1; }
1732
+ }
1733
+ @keyframes fadeOut {
1734
+ from { opacity: 1; }
1735
+ to { opacity: 0; }
1736
+ }
1737
+ @keyframes slideUp {
1738
+ from { transform: translateY(8px); opacity: 0; }
1739
+ to { transform: translateY(0); opacity: 1; }
1740
+ }
1741
+ @keyframes slideDown {
1742
+ from { transform: translateY(-8px); opacity: 0; }
1743
+ to { transform: translateY(0); opacity: 1; }
1744
+ }
1745
+ @keyframes scaleIn {
1746
+ from { transform: scale(0.95); opacity: 0; }
1747
+ to { transform: scale(1); opacity: 1; }
1748
+ }`;
1361
1749
  defaultGlobalCss = `@import "tailwindcss";
1362
1750
 
1751
+ @theme {
1752
+ /* colors */
1753
+ --color-primary: #3b82f6;
1754
+ --color-primary-hover: #2563eb;
1755
+ --color-primary-active: #1d4ed8;
1756
+ --color-primary-foreground: #ffffff;
1757
+ --color-secondary: #6366f1;
1758
+ --color-secondary-hover: #4f46e5;
1759
+ --color-secondary-active: #4338ca;
1760
+ --color-secondary-foreground: #ffffff;
1761
+ --color-accent: #f59e0b;
1762
+ --color-accent-hover: #d97706;
1763
+ --color-accent-active: #b45309;
1764
+ --color-accent-foreground: #000000;
1765
+ --color-success: #10b981;
1766
+ --color-success-foreground: #ffffff;
1767
+ --color-warning: #f59e0b;
1768
+ --color-warning-foreground: #000000;
1769
+ --color-danger: #ef4444;
1770
+ --color-danger-foreground: #ffffff;
1771
+ --color-info: #3b82f6;
1772
+ --color-info-foreground: #ffffff;
1773
+ --color-surface: #18181b;
1774
+ --color-border: #27272a;
1775
+ --color-muted: #71717a;
1776
+ --color-subtle: #3f3f46;
1777
+
1778
+ /* fonts */
1779
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1780
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1781
+
1782
+ /* spacing */
1783
+ --spacing-1: 0.25rem;
1784
+ --spacing-2: 0.5rem;
1785
+ --spacing-3: 0.75rem;
1786
+ --spacing-4: 1rem;
1787
+ --spacing-5: 1.25rem;
1788
+ --spacing-6: 1.5rem;
1789
+ --spacing-8: 2rem;
1790
+ --spacing-10: 2.5rem;
1791
+ --spacing-12: 3rem;
1792
+ --spacing-16: 4rem;
1793
+
1794
+ /* breakpoints */
1795
+ --breakpoint-sm: 40rem;
1796
+ --breakpoint-md: 48rem;
1797
+ --breakpoint-lg: 64rem;
1798
+ --breakpoint-xl: 80rem;
1799
+ --breakpoint-2xl: 96rem;
1800
+
1801
+ /* border radius */
1802
+ --radius-sm: 0.25rem;
1803
+ --radius-md: 0.5rem;
1804
+ --radius-lg: 0.75rem;
1805
+ --radius-xl: 1rem;
1806
+ --radius-2xl: 1.5rem;
1807
+ --radius-full: 9999px;
1808
+
1809
+ /* animations */
1810
+ --animate-fade-in: fadeIn 0.2s ease-out;
1811
+ --animate-fade-out: fadeOut 0.2s ease-in;
1812
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1813
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1814
+ --animate-scale-in: scaleIn 0.2s ease-out;
1815
+ }
1816
+
1817
+ @keyframes fadeIn {
1818
+ from { opacity: 0; }
1819
+ to { opacity: 1; }
1820
+ }
1821
+ @keyframes fadeOut {
1822
+ from { opacity: 1; }
1823
+ to { opacity: 0; }
1824
+ }
1825
+ @keyframes slideUp {
1826
+ from { transform: translateY(8px); opacity: 0; }
1827
+ to { transform: translateY(0); opacity: 1; }
1828
+ }
1829
+ @keyframes slideDown {
1830
+ from { transform: translateY(-8px); opacity: 0; }
1831
+ to { transform: translateY(0); opacity: 1; }
1832
+ }
1833
+ @keyframes scaleIn {
1834
+ from { transform: scale(0.95); opacity: 0; }
1835
+ to { transform: scale(1); opacity: 1; }
1836
+ }
1837
+
1363
1838
  /* tailwind-styled-v4 \u2014 zero-config base styles */
1364
1839
  *, *::before, *::after {
1365
1840
  box-sizing: border-box;
@@ -1374,20 +1849,29 @@ html {
1374
1849
  body {
1375
1850
  margin: 0;
1376
1851
  font-family: var(--font-sans, system-ui, sans-serif);
1377
- background: var(--color-background, #09090b);
1852
+ background: var(--color-surface, #18181b);
1378
1853
  color: var(--color-foreground, #fafafa);
1379
1854
  }
1380
1855
  `;
1381
1856
  }
1382
1857
  });
1858
+
1859
+ // packages/plugin/src/index.ts
1860
+ var globalRegistry = {
1861
+ transforms: [],
1862
+ tokens: {}
1863
+ };
1864
+ function getGlobalRegistry() {
1865
+ return globalRegistry;
1866
+ }
1383
1867
  function mergeClassesStatic(classes) {
1384
- return tailwindMerge.twMerge(classes);
1868
+ return twMerge(classes);
1385
1869
  }
1386
1870
  function normalizeClasses(raw) {
1387
1871
  return raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
1388
1872
  }
1389
1873
 
1390
- // ../compiler/src/componentHoister.ts
1874
+ // packages/compiler/src/componentHoister.ts
1391
1875
  var INDENTED_TW_DECL_RE = /^([ \t]+)(const|let)\s+([A-Z]\w*)\s*=\s*tw\.[\w]+[`(]/gm;
1392
1876
  function hoistComponents(source) {
1393
1877
  const hoisted = [];
@@ -1474,7 +1958,7 @@ function findAfterImports(source) {
1474
1958
  return lines.slice(0, lastImportLine + 1).join("\n").length + 1;
1475
1959
  }
1476
1960
 
1477
- // ../compiler/src/rscAnalyzer.ts
1961
+ // packages/compiler/src/rscAnalyzer.ts
1478
1962
  var CSS_INTERACTIVE_OK = [
1479
1963
  /^hover:/,
1480
1964
  // CSS :hover — no JS needed
@@ -1586,10 +2070,9 @@ function analyzeVariantUsage(source, componentName, variantKeys) {
1586
2070
  return { resolved, dynamic };
1587
2071
  }
1588
2072
  function resolveServerVariant(base, table, defaults, resolved) {
1589
- var _a2;
1590
2073
  const parts = [base];
1591
2074
  for (const key in table) {
1592
- const val = (_a2 = resolved[key]) != null ? _a2 : defaults[key];
2075
+ const val = resolved[key] ?? defaults[key];
1593
2076
  if (val && table[key][val]) {
1594
2077
  parts.push(table[key][val]);
1595
2078
  }
@@ -1615,16 +2098,24 @@ function injectServerOnlyComment(code) {
1615
2098
  ${code}`;
1616
2099
  }
1617
2100
 
1618
- // ../compiler/src/twDetector.ts
1619
- var TEMPLATE_RE = /\btw\.(server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
1620
- var OBJECT_RE = /\btw\.(server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
1621
- var EXTEND_RE = /(\w+)\.extend`((?:[^`\\]|\\.)*)`/g;
2101
+ // packages/compiler/src/twDetector.ts
2102
+ init_nativeBridge();
1622
2103
  var IMPORT_RE = /from\s*["']tailwind-styled-v4["']/;
1623
2104
  var TRANSFORM_MARKER = "/* @tw-transformed */";
1624
2105
  function hasTwUsage(source) {
2106
+ const native = getNativeBridge();
2107
+ if (native?.hasTwUsageNative) {
2108
+ const result = native.hasTwUsageNative(source);
2109
+ if (result !== null && result !== void 0) return result;
2110
+ }
1625
2111
  return IMPORT_RE.test(source) || source.includes("tw.");
1626
2112
  }
1627
2113
  function isAlreadyTransformed(source) {
2114
+ const native = getNativeBridge();
2115
+ if (native?.isAlreadyTransformedNative) {
2116
+ const result = native.isAlreadyTransformedNative(source);
2117
+ if (result !== null && result !== void 0) return result;
2118
+ }
1628
2119
  return source.includes(TRANSFORM_MARKER);
1629
2120
  }
1630
2121
  function isDynamic(content) {
@@ -1639,7 +2130,7 @@ function hasInteractiveFeatures(content) {
1639
2130
  );
1640
2131
  }
1641
2132
 
1642
- // ../compiler/src/astParser.ts
2133
+ // packages/compiler/src/astParser.ts
1643
2134
  function oxcKey(node) {
1644
2135
  if (!node) return null;
1645
2136
  if (node.type === "Identifier") return node.name;
@@ -1647,22 +2138,17 @@ function oxcKey(node) {
1647
2138
  return null;
1648
2139
  }
1649
2140
  function oxcStringVal(node) {
1650
- var _a2;
1651
2141
  if (!node) return null;
1652
2142
  if (node.type === "Literal" && typeof node.value === "string") return node.value;
1653
- if (node.type === "TemplateLiteral" && ((_a2 = node.expressions) == null ? void 0 : _a2.length) === 0) {
1654
- return node.quasis.map((q) => {
1655
- var _a3, _b2, _c, _d;
1656
- return (_d = (_c = (_a3 = q.value) == null ? void 0 : _a3.cooked) != null ? _c : (_b2 = q.value) == null ? void 0 : _b2.raw) != null ? _d : "";
1657
- }).join("");
2143
+ if (node.type === "TemplateLiteral" && node.expressions?.length === 0) {
2144
+ return node.quasis.map((q) => q.value?.cooked ?? q.value?.raw ?? "").join("");
1658
2145
  }
1659
2146
  return null;
1660
2147
  }
1661
2148
  function oxcWalkObject(node) {
1662
- var _a2;
1663
2149
  const result = {};
1664
- if ((node == null ? void 0 : node.type) !== "ObjectExpression") return result;
1665
- for (const prop of (_a2 = node.properties) != null ? _a2 : []) {
2150
+ if (node?.type !== "ObjectExpression") return result;
2151
+ for (const prop of node.properties ?? []) {
1666
2152
  if (prop.type !== "Property") continue;
1667
2153
  const key = oxcKey(prop.key);
1668
2154
  if (!key) continue;
@@ -1670,30 +2156,29 @@ function oxcWalkObject(node) {
1670
2156
  const strVal = oxcStringVal(val);
1671
2157
  if (strVal !== null) {
1672
2158
  result[key] = strVal;
1673
- } else if ((val == null ? void 0 : val.type) === "ObjectExpression") {
2159
+ } else if (val?.type === "ObjectExpression") {
1674
2160
  result[key] = oxcWalkObject(val);
1675
- } else if ((val == null ? void 0 : val.type) === "ArrayExpression") {
1676
- result[key] = val.elements.filter((el) => (el == null ? void 0 : el.type) === "ObjectExpression").map((el) => oxcWalkObject(el));
2161
+ } else if (val?.type === "ArrayExpression") {
2162
+ result[key] = val.elements.filter((el) => el?.type === "ObjectExpression").map((el) => oxcWalkObject(el));
1677
2163
  }
1678
2164
  }
1679
2165
  return result;
1680
2166
  }
1681
2167
  function parseWithOxc(objectStr) {
1682
- var _a2, _b2, _c;
1683
2168
  let parseSync3;
1684
2169
  try {
1685
2170
  parseSync3 = (init_src_js(), __toCommonJS(src_js_exports)).parseSync;
1686
- } catch (e) {
2171
+ } catch {
1687
2172
  return null;
1688
2173
  }
1689
2174
  try {
1690
2175
  const source = `const __c = ${objectStr}`;
1691
2176
  const { program, errors } = parseSync3("config.ts", source, { sourceType: "script" });
1692
- if ((errors == null ? void 0 : errors.length) > 0 || !((_a2 = program == null ? void 0 : program.body) == null ? void 0 : _a2[0])) return null;
2177
+ if (errors?.length > 0 || !program?.body?.[0]) return null;
1693
2178
  const varDecl = program.body[0];
1694
2179
  if (varDecl.type !== "VariableDeclaration") return null;
1695
- const init = (_c = (_b2 = varDecl.declarations) == null ? void 0 : _b2[0]) == null ? void 0 : _c.init;
1696
- if ((init == null ? void 0 : init.type) !== "ObjectExpression") return null;
2180
+ const init = varDecl.declarations?.[0]?.init;
2181
+ if (init?.type !== "ObjectExpression") return null;
1697
2182
  const raw = oxcWalkObject(init);
1698
2183
  const base = typeof raw.base === "string" ? raw.base.trim() : "";
1699
2184
  const variants = {};
@@ -1725,7 +2210,7 @@ function parseWithOxc(objectStr) {
1725
2210
  }
1726
2211
  }
1727
2212
  return { base, variants, compounds, defaults };
1728
- } catch (e) {
2213
+ } catch {
1729
2214
  return null;
1730
2215
  }
1731
2216
  }
@@ -1807,41 +2292,40 @@ function tokenize(src) {
1807
2292
  return tokens;
1808
2293
  }
1809
2294
  function parseObject(tokens, startIdx) {
1810
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
1811
2295
  const obj = {};
1812
2296
  let i = startIdx;
1813
- if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbrace") return { obj, endIdx: i };
2297
+ if (tokens[i]?.type !== "lbrace") return { obj, endIdx: i };
1814
2298
  i++;
1815
- while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbrace") {
1816
- if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2299
+ while (i < tokens.length && tokens[i]?.type !== "rbrace") {
2300
+ if (tokens[i]?.type === "comma") {
1817
2301
  i++;
1818
2302
  continue;
1819
2303
  }
1820
2304
  let key = null;
1821
- if (((_d = tokens[i]) == null ? void 0 : _d.type) === "string") {
2305
+ if (tokens[i]?.type === "string") {
1822
2306
  key = tokens[i].value;
1823
2307
  i++;
1824
- } else if (((_e = tokens[i]) == null ? void 0 : _e.type) === "key") {
2308
+ } else if (tokens[i]?.type === "key") {
1825
2309
  key = tokens[i].value;
1826
2310
  i++;
1827
2311
  } else {
1828
2312
  i++;
1829
2313
  continue;
1830
2314
  }
1831
- if (((_f = tokens[i]) == null ? void 0 : _f.type) !== "colon") continue;
2315
+ if (tokens[i]?.type !== "colon") continue;
1832
2316
  i++;
1833
- if (((_g = tokens[i]) == null ? void 0 : _g.type) === "lbrace") {
2317
+ if (tokens[i]?.type === "lbrace") {
1834
2318
  const { obj: nested, endIdx } = parseObject(tokens, i);
1835
2319
  obj[key] = nested;
1836
2320
  i = endIdx + 1;
1837
- } else if (((_h = tokens[i]) == null ? void 0 : _h.type) === "lbracket") {
2321
+ } else if (tokens[i]?.type === "lbracket") {
1838
2322
  const { arr, endIdx } = parseArray(tokens, i);
1839
2323
  obj[key] = arr;
1840
2324
  i = endIdx + 1;
1841
- } else if (((_i = tokens[i]) == null ? void 0 : _i.type) === "string") {
2325
+ } else if (tokens[i]?.type === "string") {
1842
2326
  obj[key] = tokens[i].value;
1843
2327
  i++;
1844
- } else if (((_j = tokens[i]) == null ? void 0 : _j.type) === "key") {
2328
+ } else if (tokens[i]?.type === "key") {
1845
2329
  obj[key] = tokens[i].value;
1846
2330
  i++;
1847
2331
  } else {
@@ -1851,17 +2335,16 @@ function parseObject(tokens, startIdx) {
1851
2335
  return { obj, endIdx: i };
1852
2336
  }
1853
2337
  function parseArray(tokens, startIdx) {
1854
- var _a2, _b2, _c, _d;
1855
2338
  const arr = [];
1856
2339
  let i = startIdx;
1857
- if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbracket") return { arr, endIdx: i };
2340
+ if (tokens[i]?.type !== "lbracket") return { arr, endIdx: i };
1858
2341
  i++;
1859
- while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbracket") {
1860
- if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2342
+ while (i < tokens.length && tokens[i]?.type !== "rbracket") {
2343
+ if (tokens[i]?.type === "comma") {
1861
2344
  i++;
1862
2345
  continue;
1863
2346
  }
1864
- if (((_d = tokens[i]) == null ? void 0 : _d.type) === "lbrace") {
2347
+ if (tokens[i]?.type === "lbrace") {
1865
2348
  const { obj, endIdx } = parseObject(tokens, i);
1866
2349
  arr.push(obj);
1867
2350
  i = endIdx + 1;
@@ -1909,7 +2392,7 @@ function parseComponentConfig(objectStr) {
1909
2392
  return parseComponentConfigFallback(objectStr);
1910
2393
  }
1911
2394
 
1912
- // ../compiler/src/variantCompiler.ts
2395
+ // packages/compiler/src/variantCompiler.ts
1913
2396
  function compileVariants(base, variants, compounds = [], defaults = {}) {
1914
2397
  const table = {};
1915
2398
  for (const key in variants) {
@@ -1933,7 +2416,7 @@ function parseObjectConfig(objectStr) {
1933
2416
  return parseComponentConfig(objectStr);
1934
2417
  }
1935
2418
 
1936
- // ../compiler/src/astTransform.ts
2419
+ // packages/compiler/src/astTransform.ts
1937
2420
  var TEMPLATE_RE2 = /\btw\.(server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
1938
2421
  var OBJECT_RE2 = /\btw\.(server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
1939
2422
  var EXTEND_RE2 = /(\w+)\.extend`((?:[^`\\]|\\.)*)`/g;
@@ -1960,10 +2443,7 @@ function renderVariantComponent(tag, id, base, variantKeys, defaults, opts) {
1960
2443
  const vKeys = variantKeys.map((k) => `"${k}"`).join(", ");
1961
2444
  const destructure = variantKeys.length > 0 ? `var _vp = {}; [${vKeys}].forEach(function(k){ _vp[k] = props[k]; delete _rest[k]; });` : "";
1962
2445
  const variantLookup = variantKeys.length > 0 ? variantKeys.map(
1963
- (k) => {
1964
- var _a2;
1965
- return `(__vt_${id}["${k}"] && __vt_${id}["${k}"][_vp["${k}"] ?? ${JSON.stringify((_a2 = defaults[k]) != null ? _a2 : "")}] || "")`;
1966
- }
2446
+ (k) => `(__vt_${id}["${k}"] && __vt_${id}["${k}"][_vp["${k}"] ?? ${JSON.stringify(defaults[k] ?? "")}] || "")`
1967
2447
  ).join(", ") : "";
1968
2448
  const classParts = variantKeys.length > 0 ? `[${JSON.stringify(base)}, ${variantLookup}, _rest.className]` : `[${JSON.stringify(base)}, _rest.className]`;
1969
2449
  return `React.forwardRef(function ${fnName}(props, ref) {
@@ -1973,13 +2453,81 @@ function renderVariantComponent(tag, id, base, variantKeys, defaults, opts) {
1973
2453
  return React.createElement("${tag}", Object.assign({ ref }, _rest${dataAttr}, { className: ${classParts}.filter(Boolean).join(" ") }));
1974
2454
  })`;
1975
2455
  }
2456
+ var SUB_BLOCK_RE = /\b([a-z][a-zA-Z0-9_]*)\s*\{([^}]*)\}/g;
2457
+ function shortHash(input) {
2458
+ let h = 5381;
2459
+ for (let i = 0; i < input.length; i++) {
2460
+ h = Math.imul(h, 33) + input.charCodeAt(i) >>> 0;
2461
+ }
2462
+ return (h & 16777215).toString(16).padStart(6, "0");
2463
+ }
2464
+ function parseSubcomponentBlocks(template, componentName) {
2465
+ const subComponents = [];
2466
+ let stripped = template;
2467
+ SUB_BLOCK_RE.lastIndex = 0;
2468
+ let match;
2469
+ while ((match = SUB_BLOCK_RE.exec(template)) !== null) {
2470
+ const [fullMatch, subName, subClassesRaw] = match;
2471
+ const subClasses = subClassesRaw.trim();
2472
+ if (!subClasses) continue;
2473
+ const subTag = (() => {
2474
+ switch (subName) {
2475
+ case "label":
2476
+ return "label";
2477
+ case "input":
2478
+ return "input";
2479
+ case "img":
2480
+ case "image":
2481
+ return "img";
2482
+ case "header":
2483
+ return "header";
2484
+ case "footer":
2485
+ return "footer";
2486
+ default:
2487
+ return "span";
2488
+ }
2489
+ })();
2490
+ const hash = shortHash(`${componentName}_${subName}_${subClasses}`);
2491
+ const scopedClass = `${componentName}_${subName}_${hash}`;
2492
+ subComponents.push({ name: subName, tag: subTag, classes: subClasses, scopedClass });
2493
+ stripped = stripped.replace(fullMatch, "");
2494
+ }
2495
+ return { baseContent: stripped.trim(), subComponents };
2496
+ }
2497
+ function renderCompoundComponent(tag, baseClasses, componentName, subComponents, opts) {
2498
+ const fnName = `_Tw_${componentName}`;
2499
+ const dataAttr = opts.addDataAttr ? `, "data-tw": "${fnName}"` : "";
2500
+ const baseBody = `React.forwardRef(function ${fnName}(props, ref) {
2501
+ var _c = props.className;
2502
+ var _r = Object.assign({}, props);
2503
+ delete _r.className;
2504
+ return React.createElement("${tag}", Object.assign({ ref }, _r${dataAttr}, { className: [${JSON.stringify(baseClasses)}, _c].filter(Boolean).join(" ") }));
2505
+ })`;
2506
+ if (subComponents.length === 0) return baseBody;
2507
+ const subAssignments = subComponents.map((sub) => {
2508
+ const subFn = `_Tw_${componentName}_${sub.name}`;
2509
+ return ` _base.${sub.name} = React.forwardRef(function ${subFn}(props, ref) {
2510
+ var _c = props.className;
2511
+ var _r = Object.assign({}, props);
2512
+ delete _r.className;
2513
+ return React.createElement("${sub.tag}", Object.assign({ ref }, _r, { className: [${JSON.stringify(sub.scopedClass)}, _c].filter(Boolean).join(" ") }));
2514
+ });`;
2515
+ }).join("\n");
2516
+ return `(function() {
2517
+ var _base = ${baseBody};
2518
+ ${subAssignments}
2519
+ return _base;
2520
+ })()`;
2521
+ }
1976
2522
  function transformSource(source, opts = {}) {
1977
2523
  const {
1978
2524
  mode = "zero-runtime",
2525
+ // v5: always zero-runtime, parameter kept for backward compat
1979
2526
  autoClientBoundary = true,
1980
2527
  addDataAttr = false,
1981
2528
  hoist = true,
1982
- filename = ""
2529
+ filename = "",
2530
+ preserveImports = false
1983
2531
  } = opts;
1984
2532
  if (!hasTwUsage(source)) {
1985
2533
  return { code: source, classes: [], changed: false };
@@ -1987,8 +2535,10 @@ function transformSource(source, opts = {}) {
1987
2535
  if (isAlreadyTransformed(source)) {
1988
2536
  return { code: source, classes: [], changed: false };
1989
2537
  }
1990
- if (mode === "runtime" || mode === "extract-only") {
1991
- return { code: source, classes: [], changed: false };
2538
+ if (mode && mode !== "zero-runtime") {
2539
+ console.warn(
2540
+ "[tailwind-styled] Warning: mode option is deprecated in v5. Only zero-runtime is supported."
2541
+ );
1992
2542
  }
1993
2543
  const rscAnalysis = analyzeFile(source, filename);
1994
2544
  let code = source;
@@ -2007,31 +2557,92 @@ function transformSource(source, opts = {}) {
2007
2557
  const allClasses = [];
2008
2558
  const prelude = [];
2009
2559
  let needsReact = false;
2010
- code = code.replace(
2011
- TEMPLATE_RE2,
2012
- (match, serverMark, tag, content) => {
2013
- if (isDynamic(content)) return match;
2014
- const classes = normalizeClasses(content);
2015
- if (!classes) return match;
2560
+ {
2561
+ const snap = code;
2562
+ const replacements = [];
2563
+ const ASSIGN_RE = /(?:const|let|var)\s+(\w+)\s*=\s*tw\.(?:server\.)?(\w+)`/g;
2564
+ const assignMap = /* @__PURE__ */ new Map();
2565
+ let am;
2566
+ while ((am = ASSIGN_RE.exec(snap)) !== null) {
2567
+ const twPos = am.index + am[0].indexOf("tw.");
2568
+ assignMap.set(twPos, am[1]);
2569
+ }
2570
+ TEMPLATE_RE2.lastIndex = 0;
2571
+ let m;
2572
+ while ((m = TEMPLATE_RE2.exec(snap)) !== null) {
2573
+ const [fullMatch, serverMark, tag, content] = m;
2574
+ if (isDynamic(content)) continue;
2016
2575
  const isServerOnly = !!serverMark;
2017
- allClasses.push(...classes.split(/\s+/).filter(Boolean));
2576
+ const compName = assignMap.get(m.index) ?? null;
2577
+ const { baseContent, subComponents } = compName ? parseSubcomponentBlocks(content, compName) : { baseContent: content, subComponents: [] };
2578
+ const classes = normalizeClasses(baseContent);
2579
+ if (!classes && subComponents.length === 0) continue;
2580
+ allClasses.push(...(classes ?? "").split(/\s+/).filter(Boolean));
2581
+ for (const sub of subComponents) {
2582
+ allClasses.push(...sub.classes.split(/\s+/).filter(Boolean));
2583
+ }
2018
2584
  changed = true;
2019
2585
  needsReact = true;
2020
- const rendered = renderStaticComponent(tag, classes, {
2021
- addDataAttr,
2022
- isServer: rscAnalysis.isServer || isServerOnly
2586
+ let rendered;
2587
+ if (subComponents.length > 0 && compName) {
2588
+ rendered = renderCompoundComponent(tag, classes ?? "", compName, subComponents, {
2589
+ addDataAttr
2590
+ });
2591
+ } else {
2592
+ rendered = renderStaticComponent(tag, classes ?? "", {
2593
+ addDataAttr,
2594
+ isServer: rscAnalysis.isServer || isServerOnly,
2595
+ compName: compName ?? void 0
2596
+ });
2597
+ }
2598
+ replacements.push({
2599
+ match: fullMatch,
2600
+ replacement: isServerOnly ? `/* @server-only */ ${rendered}` : rendered
2023
2601
  });
2024
- return isServerOnly ? `/* @server-only */ ${rendered}` : rendered;
2025
2602
  }
2026
- );
2603
+ for (const { match, replacement } of replacements) {
2604
+ code = code.replace(match, replacement);
2605
+ }
2606
+ }
2027
2607
  code = code.replace(
2028
2608
  OBJECT_RE2,
2029
2609
  (match, serverMark, tag, objectStr) => {
2030
2610
  const { base, variants, compounds, defaults } = parseObjectConfig(objectStr);
2031
- if (!base && Object.keys(variants).length === 0) return match;
2611
+ let config = {
2612
+ base,
2613
+ variants,
2614
+ compoundVariants: compounds,
2615
+ defaultVariants: defaults
2616
+ };
2617
+ const registry = getGlobalRegistry();
2618
+ if (registry.transforms.length > 0) {
2619
+ const componentName = `Tw${tag}`;
2620
+ for (const transform of registry.transforms) {
2621
+ try {
2622
+ const transformed = transform(config, { componentName, tag });
2623
+ if (transformed && typeof transformed === "object") {
2624
+ config = {
2625
+ base: typeof transformed.base === "string" ? transformed.base : config.base,
2626
+ variants: isVariantRecord(transformed.variants) ? transformed.variants : config.variants,
2627
+ compoundVariants: isCompoundVariantsArray(transformed.compoundVariants) ? transformed.compoundVariants : config.compoundVariants,
2628
+ defaultVariants: isStringRecord(transformed.defaultVariants) ? transformed.defaultVariants : config.defaultVariants
2629
+ };
2630
+ }
2631
+ } catch (error) {
2632
+ if (process.env.NODE_ENV !== "production") {
2633
+ console.warn("[tailwind-styled] plugin transform error:", error);
2634
+ }
2635
+ }
2636
+ }
2637
+ }
2638
+ const nextBase = normalizeClasses(config.base) ?? "";
2639
+ const nextVariants = config.variants;
2640
+ const nextCompounds = config.compoundVariants;
2641
+ const nextDefaults = config.defaultVariants;
2642
+ if (!nextBase && Object.keys(nextVariants).length === 0) return match;
2032
2643
  const isServerOnly = !!serverMark;
2033
- allClasses.push(...base.split(/\s+/).filter(Boolean));
2034
- for (const vMap of Object.values(variants)) {
2644
+ allClasses.push(...nextBase.split(/\s+/).filter(Boolean));
2645
+ for (const vMap of Object.values(nextVariants)) {
2035
2646
  for (const cls of Object.values(vMap)) {
2036
2647
  allClasses.push(...cls.split(/\s+/).filter(Boolean));
2037
2648
  }
@@ -2039,10 +2650,10 @@ function transformSource(source, opts = {}) {
2039
2650
  changed = true;
2040
2651
  needsReact = true;
2041
2652
  const id = genId();
2042
- const compiled = compileVariants(base, variants, compounds, defaults);
2653
+ const compiled = compileVariants(nextBase, nextVariants, nextCompounds, nextDefaults);
2043
2654
  prelude.push(generateVariantCode(id, compiled));
2044
- const variantKeys = Object.keys(variants);
2045
- const rendered = renderVariantComponent(tag, id, base, variantKeys, defaults, {
2655
+ const variantKeys = Object.keys(nextVariants);
2656
+ const rendered = renderVariantComponent(tag, id, nextBase, variantKeys, nextDefaults, {
2046
2657
  addDataAttr,
2047
2658
  isServer: rscAnalysis.isServer || isServerOnly
2048
2659
  });
@@ -2089,12 +2700,14 @@ ${code}`;
2089
2700
  if (autoClientBoundary && rscAnalysis.needsClientDirective) {
2090
2701
  code = injectClientDirective(code);
2091
2702
  }
2092
- const stillUsesTw = /\btw\.(server\.)?\w+[`(]/.test(code) || /\btw\(\w+\)/.test(code);
2093
- if (!stillUsesTw) {
2094
- code = code.replace(
2095
- /import\s*\{[^}]*\btw\b[^}]*\}\s*from\s*["']tailwind-styled-v4["'];?\n?/g,
2096
- ""
2097
- );
2703
+ if (!preserveImports) {
2704
+ const stillUsesTw = /\btw\.(server\.)?\w+[`(]/.test(code) || /\btw\(\w+\)/.test(code);
2705
+ if (!stillUsesTw) {
2706
+ code = code.replace(
2707
+ /import\s*\{[^}]*\btw\b[^}]*\}\s*from\s*["']tailwind-styled-v4["'];?\n?/g,
2708
+ ""
2709
+ );
2710
+ }
2098
2711
  }
2099
2712
  code = `${TRANSFORM_MARKER}
2100
2713
  ${code}`;
@@ -2109,6 +2722,18 @@ ${code}`;
2109
2722
  changed: true
2110
2723
  };
2111
2724
  }
2725
+ function isObjectRecord(value) {
2726
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2727
+ }
2728
+ function isStringRecord(value) {
2729
+ return isObjectRecord(value) && Object.values(value).every((entry) => typeof entry === "string");
2730
+ }
2731
+ function isVariantRecord(value) {
2732
+ return isObjectRecord(value) && Object.values(value).every((entry) => isStringRecord(entry));
2733
+ }
2734
+ function isCompoundVariantsArray(value) {
2735
+ return Array.isArray(value) && value.every((entry) => isObjectRecord(entry) && typeof entry.class === "string");
2736
+ }
2112
2737
  function hasReactImport(source) {
2113
2738
  return source.includes("import React") || source.includes("from 'react'") || source.includes('from "react"');
2114
2739
  }
@@ -2126,40 +2751,24 @@ function findAfterImports2(source) {
2126
2751
  return lines.slice(0, lastImportIdx + 1).join("\n").length + 1;
2127
2752
  }
2128
2753
 
2129
- // ../compiler/src/index.ts
2130
- init_atomicCss();
2131
-
2132
- // ../compiler/src/classExtractor.ts
2133
- var VALID_CLASS_RE = /^[-a-z0-9:/[\]!.()+%]+$/;
2134
- function parseClasses(raw) {
2135
- return raw.split(/[\n\s]+/).map((c) => c.trim()).filter((c) => c.length > 0 && VALID_CLASS_RE.test(c));
2136
- }
2754
+ // packages/compiler/src/index.ts
2755
+ init_cssCompiler();
2137
2756
  function extractAllClasses(source) {
2138
- const classes = /* @__PURE__ */ new Set();
2139
- const add = (str) => {
2140
- for (const c of parseClasses(str)) classes.add(c);
2141
- };
2142
- let m;
2143
- const re1 = new RegExp(TEMPLATE_RE.source, "g");
2144
- while ((m = re1.exec(source)) !== null) {
2145
- add(m[3]);
2757
+ const { getNativeBridge: getNativeBridge2 } = (init_nativeBridge(), __toCommonJS(nativeBridge_exports));
2758
+ const native = getNativeBridge2();
2759
+ if (!native?.extractClassesFromSourceNative) {
2760
+ throw new Error(
2761
+ `[tailwind-styled/compiler v5] extractClassesFromSourceNative is required but not available.
2762
+ Please ensure the native module is properly built.`
2763
+ );
2146
2764
  }
2147
- const re2 = new RegExp(OBJECT_RE.source, "g");
2148
- while ((m = re2.exec(source)) !== null) {
2149
- const parsed = parseComponentConfig(m[3]);
2150
- if (parsed.base) add(parsed.base);
2151
- for (const vMap of Object.values(parsed.variants)) {
2152
- for (const cls of Object.values(vMap)) add(cls);
2153
- }
2154
- for (const compound of parsed.compounds) {
2155
- if (compound.class) add(compound.class);
2156
- }
2765
+ const result = native.extractClassesFromSourceNative(source);
2766
+ if (!result || result.length < 0) {
2767
+ throw new Error(
2768
+ `[tailwind-styled/compiler v5] extractClassesFromSourceNative returned invalid result.`
2769
+ );
2157
2770
  }
2158
- const re3 = new RegExp(EXTEND_RE.source, "g");
2159
- while ((m = re3.exec(source)) !== null) add(m[2]);
2160
- const classNameRe = /className\s*=\s*["']([^"']+)["']/g;
2161
- while ((m = classNameRe.exec(source)) !== null) add(m[1]);
2162
- return Array.from(classes).sort();
2771
+ return result.sort();
2163
2772
  }
2164
2773
  function extractComponentUsage(source) {
2165
2774
  const usage = {};
@@ -2187,11 +2796,11 @@ var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".next", "dist", ".git"
2187
2796
  function scanFiles(dir) {
2188
2797
  const files = [];
2189
2798
  function walk(current) {
2190
- if (!fs2__default.default.existsSync(current)) return;
2191
- const entries = fs2__default.default.readdirSync(current, { withFileTypes: true });
2799
+ if (!fs3.existsSync(current)) return;
2800
+ const entries = fs3.readdirSync(current, { withFileTypes: true });
2192
2801
  for (const entry of entries) {
2193
2802
  if (SKIP_DIRS.has(entry.name)) continue;
2194
- const fullPath = path4__default.default.join(current, entry.name);
2803
+ const fullPath = path7.join(current, entry.name);
2195
2804
  if (entry.isDirectory()) {
2196
2805
  walk(fullPath);
2197
2806
  } else if (SCAN_EXTENSIONS.some((ext) => entry.name.endsWith(ext))) {
@@ -2205,11 +2814,11 @@ function scanFiles(dir) {
2205
2814
  function scanProjectUsage(dirs, cwd = process.cwd()) {
2206
2815
  const combined = {};
2207
2816
  for (const dir of dirs) {
2208
- const absDir = path4__default.default.isAbsolute(dir) ? dir : path4__default.default.resolve(cwd, dir);
2817
+ const absDir = path7.isAbsolute(dir) ? dir : path7.resolve(cwd, dir);
2209
2818
  const files = scanFiles(absDir);
2210
2819
  for (const file of files) {
2211
2820
  try {
2212
- const source = fs2__default.default.readFileSync(file, "utf-8");
2821
+ const source = fs3.readFileSync(file, "utf-8");
2213
2822
  const usage = extractComponentUsage(source);
2214
2823
  for (const [comp, props] of Object.entries(usage)) {
2215
2824
  if (!combined[comp]) combined[comp] = {};
@@ -2218,27 +2827,26 @@ function scanProjectUsage(dirs, cwd = process.cwd()) {
2218
2827
  values.forEach((v) => combined[comp][prop].add(v));
2219
2828
  }
2220
2829
  }
2221
- } catch (e) {
2830
+ } catch {
2222
2831
  }
2223
2832
  }
2224
2833
  }
2225
2834
  return combined;
2226
2835
  }
2227
2836
  function findDeadVariants(registered, projectUsage) {
2228
- var _a2, _b2;
2229
2837
  const report = {
2230
2838
  unusedCount: 0,
2231
2839
  bytesSaved: 0,
2232
2840
  components: {}
2233
2841
  };
2234
2842
  for (const component of registered) {
2235
- const usage = (_a2 = projectUsage[component.name]) != null ? _a2 : {};
2843
+ const usage = projectUsage[component.name] ?? {};
2236
2844
  const usedVariants = {};
2237
2845
  const unusedVariants = {};
2238
2846
  for (const [variantKey, variantValues] of Object.entries(component.variants)) {
2239
2847
  usedVariants[variantKey] = [];
2240
2848
  unusedVariants[variantKey] = [];
2241
- const usedValueSet = (_b2 = usage[variantKey]) != null ? _b2 : /* @__PURE__ */ new Set();
2849
+ const usedValueSet = usage[variantKey] ?? /* @__PURE__ */ new Set();
2242
2850
  for (const [valueName, classes] of Object.entries(variantValues)) {
2243
2851
  if (usedValueSet.has(valueName)) {
2244
2852
  usedVariants[variantKey].push(valueName);
@@ -2349,21 +2957,24 @@ function runElimination(opts) {
2349
2957
  }
2350
2958
  return { css, report };
2351
2959
  }
2960
+
2961
+ // packages/compiler/src/incrementalEngine.ts
2962
+ init_src();
2352
2963
  var CACHE_DIR = ".tw-cache";
2353
- var HASH_CACHE_FILE = path4__default.default.join(CACHE_DIR, "file-hashes.json");
2354
- var GRAPH_CACHE_FILE = path4__default.default.join(CACHE_DIR, "dep-graph.json");
2964
+ var HASH_CACHE_FILE = path7.join(CACHE_DIR, "file-hashes.json");
2965
+ var GRAPH_CACHE_FILE = path7.join(CACHE_DIR, "dep-graph.json");
2355
2966
  function ensureCacheDir() {
2356
- if (!fs2__default.default.existsSync(CACHE_DIR)) {
2357
- fs2__default.default.mkdirSync(CACHE_DIR, { recursive: true });
2967
+ if (!fs3.existsSync(CACHE_DIR)) {
2968
+ fs3.mkdirSync(CACHE_DIR, { recursive: true });
2358
2969
  }
2359
2970
  }
2360
2971
  function loadHashCache() {
2361
2972
  try {
2362
- if (fs2__default.default.existsSync(HASH_CACHE_FILE)) {
2363
- const raw = fs2__default.default.readFileSync(HASH_CACHE_FILE, "utf-8");
2973
+ if (fs3.existsSync(HASH_CACHE_FILE)) {
2974
+ const raw = fs3.readFileSync(HASH_CACHE_FILE, "utf-8");
2364
2975
  return new Map(Object.entries(JSON.parse(raw)));
2365
2976
  }
2366
- } catch (e) {
2977
+ } catch {
2367
2978
  }
2368
2979
  return /* @__PURE__ */ new Map();
2369
2980
  }
@@ -2371,18 +2982,18 @@ function saveHashCache(cache) {
2371
2982
  try {
2372
2983
  ensureCacheDir();
2373
2984
  const obj = Object.fromEntries(cache);
2374
- fs2__default.default.writeFileSync(HASH_CACHE_FILE, JSON.stringify(obj, null, 2));
2375
- } catch (e) {
2985
+ fs3.writeFileSync(HASH_CACHE_FILE, JSON.stringify(obj, null, 2));
2986
+ } catch {
2376
2987
  }
2377
2988
  }
2378
2989
  function loadGraphCache() {
2379
2990
  try {
2380
- if (fs2__default.default.existsSync(GRAPH_CACHE_FILE)) {
2381
- const raw = fs2__default.default.readFileSync(GRAPH_CACHE_FILE, "utf-8");
2991
+ if (fs3.existsSync(GRAPH_CACHE_FILE)) {
2992
+ const raw = fs3.readFileSync(GRAPH_CACHE_FILE, "utf-8");
2382
2993
  const data = JSON.parse(raw);
2383
2994
  return new Map(Object.entries(data));
2384
2995
  }
2385
- } catch (e) {
2996
+ } catch {
2386
2997
  }
2387
2998
  return /* @__PURE__ */ new Map();
2388
2999
  }
@@ -2390,8 +3001,8 @@ function saveGraphCache(graph) {
2390
3001
  try {
2391
3002
  ensureCacheDir();
2392
3003
  const obj = Object.fromEntries(graph);
2393
- fs2__default.default.writeFileSync(GRAPH_CACHE_FILE, JSON.stringify(obj, null, 2));
2394
- } catch (e) {
3004
+ fs3.writeFileSync(GRAPH_CACHE_FILE, JSON.stringify(obj, null, 2));
3005
+ } catch {
2395
3006
  }
2396
3007
  }
2397
3008
  function fnv1a(str) {
@@ -2413,7 +3024,7 @@ function toBase36(n, len = 4) {
2413
3024
  return result;
2414
3025
  }
2415
3026
  function hashFileContent(content) {
2416
- return crypto__default.default.createHash("md5").update(content).digest("hex").slice(0, 8);
3027
+ return hashContent(content, "md5", 8);
2417
3028
  }
2418
3029
  function makeAtomicClass(declaration, modifier) {
2419
3030
  const key = modifier ? `${declaration}::${modifier}` : declaration;
@@ -2495,8 +3106,8 @@ var CssDiffWriter = class {
2495
3106
  }
2496
3107
  loadFromDisk() {
2497
3108
  try {
2498
- if (fs2__default.default.existsSync(this.outputPath)) {
2499
- const css = fs2__default.default.readFileSync(this.outputPath, "utf-8");
3109
+ if (fs3.existsSync(this.outputPath)) {
3110
+ const css = fs3.readFileSync(this.outputPath, "utf-8");
2500
3111
  const ruleRe = /(\.tw-[a-z0-9]+(?::[\w-]+)?)\{([^}]+)\}|(@[^{]+)\{(\.tw-[a-z0-9]+)\{([^}]+)\}\}/g;
2501
3112
  let m;
2502
3113
  while ((m = ruleRe.exec(css)) !== null) {
@@ -2506,7 +3117,7 @@ var CssDiffWriter = class {
2506
3117
  }
2507
3118
  }
2508
3119
  }
2509
- } catch (e) {
3120
+ } catch {
2510
3121
  }
2511
3122
  }
2512
3123
  /** Apply diff ke internal map */
@@ -2526,9 +3137,9 @@ var CssDiffWriter = class {
2526
3137
  try {
2527
3138
  ensureCacheDir();
2528
3139
  const css = Array.from(this.ruleMap.values()).join("\n");
2529
- await fs2__default.default.promises.writeFile(this.outputPath, css, "utf-8");
3140
+ await fs3.promises.writeFile(this.outputPath, css, "utf-8");
2530
3141
  this.dirty = false;
2531
- } catch (e) {
3142
+ } catch {
2532
3143
  }
2533
3144
  }
2534
3145
  /** Sync flush untuk build end */
@@ -2537,9 +3148,9 @@ var CssDiffWriter = class {
2537
3148
  try {
2538
3149
  ensureCacheDir();
2539
3150
  const css = Array.from(this.ruleMap.values()).join("\n");
2540
- fs2__default.default.writeFileSync(this.outputPath, css, "utf-8");
3151
+ fs3.writeFileSync(this.outputPath, css, "utf-8");
2541
3152
  this.dirty = false;
2542
- } catch (e) {
3153
+ } catch {
2543
3154
  }
2544
3155
  }
2545
3156
  size() {
@@ -2558,11 +3169,10 @@ var IncrementalEngine = class {
2558
3169
  buildTimeMs: 0
2559
3170
  };
2560
3171
  this.sessionStart = Date.now();
2561
- var _a2, _b2, _c;
2562
3172
  this.opts = {
2563
- outputPath: (_a2 = opts.outputPath) != null ? _a2 : path4__default.default.join(CACHE_DIR, "atomic.css"),
2564
- persistCache: (_b2 = opts.persistCache) != null ? _b2 : true,
2565
- verbose: (_c = opts.verbose) != null ? _c : false
3173
+ outputPath: opts.outputPath ?? path7.join(CACHE_DIR, "atomic.css"),
3174
+ persistCache: opts.persistCache ?? true,
3175
+ verbose: opts.verbose ?? false
2566
3176
  };
2567
3177
  this.hashCache = this.opts.persistCache ? loadHashCache() : /* @__PURE__ */ new Map();
2568
3178
  this.depGraph = this.opts.persistCache ? loadGraphCache() : /* @__PURE__ */ new Map();
@@ -2583,14 +3193,13 @@ var IncrementalEngine = class {
2583
3193
  * @returns ProcessResult dengan diff dan stats
2584
3194
  */
2585
3195
  processFile(filepath, source, extractedNodes) {
2586
- var _a2;
2587
3196
  const t0 = Date.now();
2588
3197
  this.stats.totalFiles++;
2589
3198
  const currentHash = hashFileContent(source);
2590
3199
  const cachedHash = this.hashCache.get(filepath);
2591
3200
  if (cachedHash === currentHash) {
2592
3201
  this.stats.skippedFiles++;
2593
- this.log(`[skip] ${path4__default.default.relative(process.cwd(), filepath)}`);
3202
+ this.log(`[skip] ${path7.relative(process.cwd(), filepath)}`);
2594
3203
  return {
2595
3204
  filepath,
2596
3205
  changed: false,
@@ -2600,8 +3209,8 @@ var IncrementalEngine = class {
2600
3209
  }
2601
3210
  this.hashCache.set(filepath, currentHash);
2602
3211
  this.stats.changedFiles++;
2603
- this.log(`[change] ${path4__default.default.relative(process.cwd(), filepath)}`);
2604
- const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
3212
+ this.log(`[change] ${path7.relative(process.cwd(), filepath)}`);
3213
+ const oldNodes = this.depGraph.get(filepath) ?? [];
2605
3214
  const diff = computeDiff(oldNodes, extractedNodes);
2606
3215
  this.depGraph.set(filepath, extractedNodes);
2607
3216
  const trulyRemoved = [];
@@ -2658,14 +3267,13 @@ var IncrementalEngine = class {
2658
3267
  * Invalidate satu file (untuk hot reload — file dihapus atau renamed).
2659
3268
  */
2660
3269
  invalidateFile(filepath) {
2661
- var _a2;
2662
- const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
3270
+ const oldNodes = this.depGraph.get(filepath) ?? [];
2663
3271
  for (const node of oldNodes) {
2664
3272
  this.globalReg.remove(filepath, node.atomicClass);
2665
3273
  }
2666
3274
  this.depGraph.delete(filepath);
2667
3275
  this.hashCache.delete(filepath);
2668
- this.log(`[invalidate] ${path4__default.default.relative(process.cwd(), filepath)}`);
3276
+ this.log(`[invalidate] ${path7.relative(process.cwd(), filepath)}`);
2669
3277
  }
2670
3278
  /** Get all active style nodes — untuk full CSS generation */
2671
3279
  getAllNodes() {
@@ -2673,7 +3281,7 @@ var IncrementalEngine = class {
2673
3281
  }
2674
3282
  /** Get stats untuk current build session */
2675
3283
  getStats() {
2676
- return __spreadProps(__spreadValues({}, this.stats), { buildTimeMs: Date.now() - this.sessionStart });
3284
+ return { ...this.stats, buildTimeMs: Date.now() - this.sessionStart };
2677
3285
  }
2678
3286
  /** Get output CSS path */
2679
3287
  getOutputPath() {
@@ -2731,7 +3339,6 @@ function parseOneClass(cls) {
2731
3339
  return { twClass: cls, declaration, modifier, atomicClass };
2732
3340
  }
2733
3341
  function resolveModifier(mod) {
2734
- var _a2, _b2;
2735
3342
  const pseudoMap = {
2736
3343
  hover: ":hover",
2737
3344
  focus: ":focus",
@@ -2753,10 +3360,9 @@ function resolveModifier(mod) {
2753
3360
  dark: "@media (prefers-color-scheme: dark)",
2754
3361
  print: "@media print"
2755
3362
  };
2756
- return (_b2 = (_a2 = pseudoMap[mod]) != null ? _a2 : mediaMap[mod]) != null ? _b2 : `:${mod}`;
3363
+ return pseudoMap[mod] ?? mediaMap[mod] ?? `:${mod}`;
2757
3364
  }
2758
3365
  function twToDeclaration(cls) {
2759
- var _a2;
2760
3366
  const sp = cls.match(/^(p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-([\d.]+)$/);
2761
3367
  if (sp) {
2762
3368
  const propMap = {
@@ -2835,10 +3441,9 @@ function twToDeclaration(cls) {
2835
3441
  truncate: "overflow: hidden; text-overflow: ellipsis; white-space: nowrap",
2836
3442
  transition: "transition-property: color,background-color,border-color,opacity,box-shadow,transform; transition-duration: 150ms"
2837
3443
  };
2838
- return (_a2 = map[cls]) != null ? _a2 : null;
3444
+ return map[cls] ?? null;
2839
3445
  }
2840
3446
  function sizeVal(v) {
2841
- var _a2;
2842
3447
  const num = parseFloat(v);
2843
3448
  if (!Number.isNaN(num)) return `${num * 0.25}rem`;
2844
3449
  const special = {
@@ -2849,7 +3454,7 @@ function sizeVal(v) {
2849
3454
  max: "max-content",
2850
3455
  fit: "fit-content"
2851
3456
  };
2852
- return (_a2 = special[v]) != null ? _a2 : v;
3457
+ return special[v] ?? v;
2853
3458
  }
2854
3459
  var _engine = null;
2855
3460
  function getIncrementalEngine(opts) {
@@ -2861,234 +3466,8 @@ function getIncrementalEngine(opts) {
2861
3466
  function resetIncrementalEngine() {
2862
3467
  _engine = null;
2863
3468
  }
2864
- var CONFIG_FILES = [
2865
- "tailwind.config.ts",
2866
- "tailwind.config.js",
2867
- "tailwind.config.mjs",
2868
- "tailwind.config.cjs"
2869
- ];
2870
- var _cachedConfig = null;
2871
- var _cachedCwd = "";
2872
- function loadTailwindConfig(cwd = process.cwd()) {
2873
- var _a2;
2874
- if (_cachedConfig && _cachedCwd === cwd) return _cachedConfig;
2875
- _cachedCwd = cwd;
2876
- for (const file of CONFIG_FILES) {
2877
- const fullPath = path4__default.default.join(cwd, file);
2878
- if (fs2__default.default.existsSync(fullPath)) {
2879
- try {
2880
- const mod = __require(fullPath);
2881
- const config = (_a2 = mod.default) != null ? _a2 : mod;
2882
- _cachedConfig = config;
2883
- console.log(`[tailwind-styled-v4] Using config: ${file}`);
2884
- return config;
2885
- } catch (e) {
2886
- }
2887
- }
2888
- }
2889
- console.log("[tailwind-styled-v4] No tailwind config found \u2192 using built-in preset");
2890
- const { defaultPreset: defaultPreset2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
2891
- _cachedConfig = defaultPreset2;
2892
- return defaultPreset2;
2893
- }
2894
- function getContentPaths(config, cwd = process.cwd()) {
2895
- var _a2;
2896
- const paths = [];
2897
- if (Array.isArray(config.content)) {
2898
- for (const item of config.content) {
2899
- if (typeof item === "string") paths.push(item);
2900
- else if (typeof item === "object" && item.raw) ;
2901
- }
2902
- return paths;
2903
- }
2904
- if ((_a2 = config.content) == null ? void 0 : _a2.files) {
2905
- return config.content.files.filter((f) => typeof f === "string");
2906
- }
2907
- return ["src", "app", "pages", "components"].filter((d) => fs2__default.default.existsSync(path4__default.default.join(cwd, d))).map((d) => `./${d}/**/*.{tsx,ts,jsx,js}`);
2908
- }
2909
- function invalidateConfigCache() {
2910
- _cachedConfig = null;
2911
- _cachedCwd = "";
2912
- }
2913
- function isZeroConfig(cwd = process.cwd()) {
2914
- return !CONFIG_FILES.some((f) => fs2__default.default.existsSync(path4__default.default.join(cwd, f)));
2915
- }
2916
- function bootstrapZeroConfig(cwd = process.cwd()) {
2917
- let generatedConfig = false;
2918
- let generatedCss = false;
2919
- generatedConfig = false;
2920
- const cssPaths = [
2921
- "src/app/globals.css",
2922
- "app/globals.css",
2923
- "src/index.css",
2924
- "src/styles/globals.css"
2925
- ];
2926
- const hasGlobalCss = cssPaths.some((p) => fs2__default.default.existsSync(path4__default.default.join(cwd, p)));
2927
- if (!hasGlobalCss) {
2928
- const { defaultGlobalCss: defaultGlobalCss2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
2929
- const appDir = fs2__default.default.existsSync(path4__default.default.join(cwd, "src/app")) ? "src/app" : fs2__default.default.existsSync(path4__default.default.join(cwd, "app")) ? "app" : "src";
2930
- const cssPath = path4__default.default.join(cwd, appDir, "globals.css");
2931
- if (fs2__default.default.existsSync(path4__default.default.dirname(cssPath))) {
2932
- fs2__default.default.writeFileSync(cssPath, defaultGlobalCss2);
2933
- generatedCss = true;
2934
- console.log(`[tailwind-styled-v4] Generated ${cssPath}`);
2935
- }
2936
- }
2937
- return { generatedConfig, generatedCss };
2938
- }
2939
3469
 
2940
- // ../compiler/src/routeCssCollector.ts
2941
- var _collector = {
2942
- files: /* @__PURE__ */ new Map(),
2943
- routes: /* @__PURE__ */ new Map(),
2944
- global: /* @__PURE__ */ new Set()
2945
- };
2946
- function registerFileClasses(filepath, classes) {
2947
- if (!_collector.files.has(filepath)) {
2948
- _collector.files.set(filepath, /* @__PURE__ */ new Set());
2949
- }
2950
- const fileSet = _collector.files.get(filepath);
2951
- classes.forEach((c) => fileSet.add(c));
2952
- const route = fileToRoute(filepath);
2953
- if (route) {
2954
- if (!_collector.routes.has(route)) {
2955
- _collector.routes.set(route, /* @__PURE__ */ new Set());
2956
- }
2957
- _collector.routes.get(route).add(filepath);
2958
- }
2959
- }
2960
- function registerGlobalClasses(classes) {
2961
- classes.forEach((c) => _collector.global.add(c));
2962
- }
2963
- function getRouteClasses(route) {
2964
- var _a2, _b2;
2965
- const result = new Set(_collector.global);
2966
- const routeFiles = (_a2 = _collector.routes.get(route)) != null ? _a2 : /* @__PURE__ */ new Set();
2967
- for (const filepath of routeFiles) {
2968
- const fileClasses = (_b2 = _collector.files.get(filepath)) != null ? _b2 : /* @__PURE__ */ new Set();
2969
- fileClasses.forEach((c) => result.add(c));
2970
- }
2971
- return result;
2972
- }
2973
- function getAllRoutes() {
2974
- return Array.from(_collector.routes.keys()).sort();
2975
- }
2976
- function getCollector() {
2977
- return _collector;
2978
- }
2979
- function resetCollector() {
2980
- _collector = {
2981
- files: /* @__PURE__ */ new Map(),
2982
- routes: /* @__PURE__ */ new Map(),
2983
- global: /* @__PURE__ */ new Set()
2984
- };
2985
- }
2986
- function fileToRoute(filepath) {
2987
- const normalized = filepath.replace(/\\/g, "/");
2988
- if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
2989
- return "__global";
2990
- }
2991
- const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2992
- if (pageMatch) return `/${pageMatch[1]}`;
2993
- const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2994
- if (rootPage) return "/";
2995
- const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
2996
- if (pagesMatch) {
2997
- const route = pagesMatch[1].replace(/\/index$/, "");
2998
- return `/${route}`;
2999
- }
3000
- if (normalized.includes("/components/") || normalized.includes("/ui/") || normalized.includes("/shared/")) {
3001
- return "__global";
3002
- }
3003
- return null;
3004
- }
3005
- function getCollectorSummary() {
3006
- const routes = getAllRoutes();
3007
- const totalFiles = _collector.files.size;
3008
- const totalGlobal = _collector.global.size;
3009
- const lines = [
3010
- `[tailwind-styled-v4] Route CSS Summary:`,
3011
- ` Files processed: ${totalFiles}`,
3012
- ` Global classes: ${totalGlobal}`,
3013
- ` Routes found: ${routes.length}`,
3014
- ...routes.map((r) => {
3015
- const cls = getRouteClasses(r).size;
3016
- return ` ${r} \u2192 ${cls} classes`;
3017
- })
3018
- ];
3019
- return lines.join("\n");
3020
- }
3021
- var SCAN_EXTENSIONS2 = [".tsx", ".ts", ".jsx", ".js"];
3022
- function scanDir(dir, files = []) {
3023
- if (!fs2__default.default.existsSync(dir)) return files;
3024
- const entries = fs2__default.default.readdirSync(dir, { withFileTypes: true });
3025
- for (const entry of entries) {
3026
- if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
3027
- const fullPath = path4__default.default.join(dir, entry.name);
3028
- if (entry.isDirectory()) {
3029
- scanDir(fullPath, files);
3030
- } else if (SCAN_EXTENSIONS2.some((ext) => entry.name.endsWith(ext))) {
3031
- files.push(fullPath);
3032
- }
3033
- }
3034
- return files;
3035
- }
3036
- function generateSafelist(scanDirs, outputPath = ".tailwind-styled-safelist.json", cwd = process.cwd()) {
3037
- const allClasses = /* @__PURE__ */ new Set();
3038
- for (const dir of scanDirs) {
3039
- const absDir = path4__default.default.isAbsolute(dir) ? dir : path4__default.default.resolve(cwd, dir);
3040
- const files = scanDir(absDir);
3041
- for (const file of files) {
3042
- try {
3043
- const source = fs2__default.default.readFileSync(file, "utf-8");
3044
- const classes = extractAllClasses(source);
3045
- classes.forEach((c) => allClasses.add(c));
3046
- } catch (e) {
3047
- }
3048
- }
3049
- }
3050
- const sorted = Array.from(allClasses).sort();
3051
- const absOutput = path4__default.default.isAbsolute(outputPath) ? outputPath : path4__default.default.resolve(cwd, outputPath);
3052
- fs2__default.default.writeFileSync(absOutput, JSON.stringify(sorted, null, 2));
3053
- console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
3054
- return sorted;
3055
- }
3056
- function loadSafelist(safelistPath) {
3057
- try {
3058
- const content = fs2__default.default.readFileSync(safelistPath, "utf-8");
3059
- return JSON.parse(content);
3060
- } catch (e) {
3061
- return [];
3062
- }
3063
- }
3064
- function generateSafelistCss(scanDirs, outputPath = "src/app/__tw-safelist.css", cwd = process.cwd()) {
3065
- const allClasses = /* @__PURE__ */ new Set();
3066
- for (const dir of scanDirs) {
3067
- const absDir = path4__default.default.isAbsolute(dir) ? dir : path4__default.default.resolve(cwd, dir);
3068
- const files = scanDir(absDir);
3069
- for (const file of files) {
3070
- try {
3071
- const source = fs2__default.default.readFileSync(file, "utf-8");
3072
- const classes = extractAllClasses(source);
3073
- classes.forEach((c) => allClasses.add(c));
3074
- } catch (e) {
3075
- }
3076
- }
3077
- }
3078
- const sorted = Array.from(allClasses).sort();
3079
- const absOutput = path4__default.default.isAbsolute(outputPath) ? outputPath : path4__default.default.resolve(cwd, outputPath);
3080
- fs2__default.default.mkdirSync(path4__default.default.dirname(absOutput), { recursive: true });
3081
- const css = sorted.length > 0 ? `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
3082
- @source inline("${sorted.join(" ")}");
3083
- ` : `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
3084
- /* No safelist classes found */
3085
- `;
3086
- fs2__default.default.writeFileSync(absOutput, css);
3087
- console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
3088
- return sorted;
3089
- }
3090
-
3091
- // ../compiler/src/styleBucketSystem.ts
3470
+ // packages/compiler/src/styleBucketSystem.ts
3092
3471
  var BUCKET_ORDER = [
3093
3472
  "reset",
3094
3473
  "layout",
@@ -3230,10 +3609,9 @@ var PROPERTY_BUCKET_MAP = {
3230
3609
  all: "reset"
3231
3610
  };
3232
3611
  function classifyNode(node) {
3233
- var _a2, _b2, _c;
3234
- if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) return "responsive";
3612
+ if (node.modifier?.startsWith("@")) return "responsive";
3235
3613
  const declarations = node.declaration.split(";").map((d) => d.trim()).filter(Boolean);
3236
- const firstProp = (_c = (_b2 = declarations[0]) == null ? void 0 : _b2.split(":")[0]) == null ? void 0 : _c.trim();
3614
+ const firstProp = declarations[0]?.split(":")[0]?.trim();
3237
3615
  if (!firstProp) return "unknown";
3238
3616
  if (PROPERTY_BUCKET_MAP[firstProp]) return PROPERTY_BUCKET_MAP[firstProp];
3239
3617
  for (const [prefix, bucket] of Object.entries(PROPERTY_BUCKET_MAP)) {
@@ -3364,14 +3742,13 @@ function nodeToCSS2(node) {
3364
3742
  return `.${atomicClass}${modifier}{${declaration}}`;
3365
3743
  }
3366
3744
  function detectConflicts(nodes) {
3367
- var _a2, _b2, _c;
3368
3745
  const seen = /* @__PURE__ */ new Map();
3369
3746
  const warnings = [];
3370
3747
  for (const node of nodes) {
3371
- if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) continue;
3372
- const firstProp = (_b2 = node.declaration.split(":")[0]) == null ? void 0 : _b2.trim();
3748
+ if (node.modifier?.startsWith("@")) continue;
3749
+ const firstProp = node.declaration.split(":")[0]?.trim();
3373
3750
  if (!firstProp) continue;
3374
- const key = `${firstProp}::${(_c = node.modifier) != null ? _c : ""}`;
3751
+ const key = `${firstProp}::${node.modifier ?? ""}`;
3375
3752
  const prev = seen.get(key);
3376
3753
  if (prev) {
3377
3754
  warnings.push({
@@ -3394,15 +3771,554 @@ function getBucketEngine() {
3394
3771
  function resetBucketEngine() {
3395
3772
  _bucketEngine = null;
3396
3773
  }
3774
+
3775
+ // packages/compiler/src/index.ts
3776
+ init_atomicCss();
3777
+
3778
+ // packages/compiler/src/context.ts
3779
+ var CompileContext = class {
3780
+ constructor(input) {
3781
+ this.filepath = input.filepath;
3782
+ this.source = input.source;
3783
+ this.options = input.options;
3784
+ this.result = null;
3785
+ this.done = false;
3786
+ this.engine = "none";
3787
+ }
3788
+ };
3789
+ init_nativeBridge();
3790
+
3791
+ // packages/compiler/src/pipeline.ts
3792
+ var Pipeline = class {
3793
+ constructor() {
3794
+ this.steps = [];
3795
+ }
3796
+ use(step) {
3797
+ this.steps.push(step);
3798
+ return this;
3799
+ }
3800
+ run(ctx) {
3801
+ for (const step of this.steps) {
3802
+ step(ctx);
3803
+ if (ctx.done) break;
3804
+ }
3805
+ return ctx;
3806
+ }
3807
+ };
3808
+
3809
+ // packages/compiler/src/coreCompiler.ts
3810
+ var MAX_CACHE_ENTRIES = 512;
3811
+ var compileCache = /* @__PURE__ */ new Map();
3812
+ function makeCacheKey(input) {
3813
+ const options = {
3814
+ mode: input.options.mode,
3815
+ autoClientBoundary: input.options.autoClientBoundary,
3816
+ addDataAttr: input.options.addDataAttr,
3817
+ hoist: input.options.hoist,
3818
+ filename: input.options.filename ?? input.filepath,
3819
+ deadStyleElimination: input.options.deadStyleElimination
3820
+ };
3821
+ return createHash("sha1").update(input.filepath).update("").update(input.source).update("").update(JSON.stringify(options)).digest("hex");
3822
+ }
3823
+ function cloneTransformResult(result) {
3824
+ return {
3825
+ code: result.code,
3826
+ classes: [...result.classes],
3827
+ changed: result.changed,
3828
+ rsc: result.rsc ? {
3829
+ isServer: result.rsc.isServer,
3830
+ needsClientDirective: result.rsc.needsClientDirective,
3831
+ clientReasons: [...result.rsc.clientReasons]
3832
+ } : void 0
3833
+ };
3834
+ }
3835
+ function cloneCoreCompileResult(result) {
3836
+ return {
3837
+ result: cloneTransformResult(result.result),
3838
+ engine: result.engine,
3839
+ cacheHit: result.cacheHit,
3840
+ metadata: result.metadata ? result.metadata.map((m) => ({ ...m })) : void 0,
3841
+ css: result.css
3842
+ };
3843
+ }
3844
+ function persistCache(key, value) {
3845
+ compileCache.set(key, { ...value, cacheHit: false });
3846
+ if (compileCache.size <= MAX_CACHE_ENTRIES) return;
3847
+ const oldestKey = compileCache.keys().next().value;
3848
+ if (oldestKey) compileCache.delete(oldestKey);
3849
+ }
3850
+ function createPassthrough(source) {
3851
+ return { code: source, classes: [], changed: false };
3852
+ }
3853
+ var CompilerCore = class {
3854
+ constructor() {
3855
+ this.pipeline = new Pipeline().use((ctx) => this.nativeStep(ctx));
3856
+ }
3857
+ compile(input) {
3858
+ const cacheKey = makeCacheKey(input);
3859
+ const cached = compileCache.get(cacheKey);
3860
+ if (cached) {
3861
+ const hit = cloneCoreCompileResult(cached);
3862
+ hit.cacheHit = true;
3863
+ return hit;
3864
+ }
3865
+ const ctx = new CompileContext(input);
3866
+ this.pipeline.run(ctx);
3867
+ const result = ctx.result ?? createPassthrough(input.source);
3868
+ let cssOutput;
3869
+ if (ctx.options.deadStyleElimination && result.classes.length > 0) {
3870
+ cssOutput = this.runDeadStyleElimination(result.classes, input.options);
3871
+ }
3872
+ const compiled = {
3873
+ result,
3874
+ engine: ctx.engine,
3875
+ cacheHit: false,
3876
+ metadata: ctx.metadata,
3877
+ css: cssOutput
3878
+ };
3879
+ persistCache(cacheKey, compiled);
3880
+ return cloneCoreCompileResult(compiled);
3881
+ }
3882
+ runDeadStyleElimination(classes, options) {
3883
+ if (classes.length === 0) return "";
3884
+ const native = getNativeBridge();
3885
+ if (native?.analyzeClassesNative) {
3886
+ try {
3887
+ const filesJson = JSON.stringify([{ file: "compiled", classes }]);
3888
+ const analysis = native.analyzeClassesNative(filesJson, process.cwd(), 0);
3889
+ if (analysis && analysis.safelist) {
3890
+ const deadClasses = /* @__PURE__ */ new Set();
3891
+ const safelistSet = new Set(analysis.safelist);
3892
+ for (const cls of classes) {
3893
+ if (!safelistSet.has(cls)) {
3894
+ deadClasses.add(cls);
3895
+ }
3896
+ }
3897
+ if (deadClasses.size > 0) {
3898
+ return "";
3899
+ }
3900
+ }
3901
+ } catch {
3902
+ }
3903
+ }
3904
+ return "";
3905
+ }
3906
+ /**
3907
+ * v5: Native step now THROWS if native binding is unavailable.
3908
+ * Previously returned early to allow JS fallback.
3909
+ */
3910
+ nativeStep(ctx) {
3911
+ const native = getNativeBridge();
3912
+ if (!native?.transformSourceNative) {
3913
+ throw new Error(
3914
+ `[tailwind-styled/compiler v5] transformSourceNative is required but not available.
3915
+ Please ensure the native module is properly built with transform support.`
3916
+ );
3917
+ }
3918
+ const opts = {};
3919
+ if (ctx.options.mode) opts.mode = ctx.options.mode;
3920
+ if (ctx.options.filename ?? ctx.filepath) opts.filename = ctx.options.filename ?? ctx.filepath;
3921
+ const raw = native.transformSourceNative(ctx.source, opts);
3922
+ if (raw === null) {
3923
+ throw new Error(
3924
+ `[tailwind-styled/compiler v5] Native transform returned null for: ${ctx.filepath}
3925
+ This indicates an issue with the native module.`
3926
+ );
3927
+ }
3928
+ const adapted = adaptNativeResult(raw);
3929
+ ctx.result = adapted;
3930
+ ctx.metadata = adapted.metadata;
3931
+ ctx.engine = "native";
3932
+ ctx.done = true;
3933
+ }
3934
+ /**
3935
+ * v5: JS pipeline has been removed.
3936
+ * Previously used as fallback when native was unavailable.
3937
+ *
3938
+ * @throws Error always - JS pipeline is no longer supported in v5
3939
+ * @deprecated JS pipeline was removed in v5
3940
+ */
3941
+ jsStep(ctx) {
3942
+ throw new Error(
3943
+ `[tailwind-styled/compiler v5] JS pipeline is no longer supported.
3944
+ The native binding is required for all transformations.`
3945
+ );
3946
+ }
3947
+ };
3948
+ var compilerCore = new CompilerCore();
3949
+ function compileWithCore(input) {
3950
+ return compilerCore.compile(input);
3951
+ }
3952
+ function resetCompileCache() {
3953
+ compileCache.clear();
3954
+ }
3955
+
3956
+ // packages/compiler/src/routeCssCollector.ts
3957
+ var _collector = {
3958
+ files: /* @__PURE__ */ new Map(),
3959
+ routes: /* @__PURE__ */ new Map(),
3960
+ global: /* @__PURE__ */ new Set()
3961
+ };
3962
+ function registerFileClasses(filepath, classes) {
3963
+ if (!_collector.files.has(filepath)) {
3964
+ _collector.files.set(filepath, /* @__PURE__ */ new Set());
3965
+ }
3966
+ const fileSet = _collector.files.get(filepath);
3967
+ classes.forEach((c) => fileSet.add(c));
3968
+ const route = fileToRoute(filepath);
3969
+ if (route) {
3970
+ if (!_collector.routes.has(route)) {
3971
+ _collector.routes.set(route, /* @__PURE__ */ new Set());
3972
+ }
3973
+ _collector.routes.get(route).add(filepath);
3974
+ }
3975
+ }
3976
+ function registerGlobalClasses(classes) {
3977
+ classes.forEach((c) => _collector.global.add(c));
3978
+ }
3979
+ function getRouteClasses(route) {
3980
+ const result = new Set(_collector.global);
3981
+ const routeFiles = _collector.routes.get(route) ?? /* @__PURE__ */ new Set();
3982
+ for (const filepath of routeFiles) {
3983
+ const fileClasses = _collector.files.get(filepath) ?? /* @__PURE__ */ new Set();
3984
+ fileClasses.forEach((c) => result.add(c));
3985
+ }
3986
+ return result;
3987
+ }
3988
+ function getAllRoutes() {
3989
+ return Array.from(_collector.routes.keys()).sort();
3990
+ }
3991
+ function getCollector() {
3992
+ return _collector;
3993
+ }
3994
+ function resetCollector() {
3995
+ _collector = {
3996
+ files: /* @__PURE__ */ new Map(),
3997
+ routes: /* @__PURE__ */ new Map(),
3998
+ global: /* @__PURE__ */ new Set()
3999
+ };
4000
+ }
4001
+ function fileToRoute(filepath) {
4002
+ const normalized = filepath.replace(/\\/g, "/");
4003
+ if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
4004
+ return "__global";
4005
+ }
4006
+ const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
4007
+ if (pageMatch) return `/${pageMatch[1]}`;
4008
+ const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
4009
+ if (rootPage) return "/";
4010
+ const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
4011
+ if (pagesMatch) {
4012
+ const route = pagesMatch[1].replace(/\/index$/, "");
4013
+ return `/${route}`;
4014
+ }
4015
+ if (normalized.includes("/components/") || normalized.includes("/ui/") || normalized.includes("/shared/")) {
4016
+ return "__global";
4017
+ }
4018
+ return null;
4019
+ }
4020
+ function getCollectorSummary() {
4021
+ const routes = getAllRoutes();
4022
+ const totalFiles = _collector.files.size;
4023
+ const totalGlobal = _collector.global.size;
4024
+ const lines = [
4025
+ `[tailwind-styled-v4] Route CSS Summary:`,
4026
+ ` Files processed: ${totalFiles}`,
4027
+ ` Global classes: ${totalGlobal}`,
4028
+ ` Routes found: ${routes.length}`,
4029
+ ...routes.map((r) => {
4030
+ const cls = getRouteClasses(r).size;
4031
+ return ` ${r} \u2192 ${cls} classes`;
4032
+ })
4033
+ ];
4034
+ return lines.join("\n");
4035
+ }
4036
+
4037
+ // packages/compiler/src/loaderCore.ts
4038
+ var SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
4039
+ function shouldSkipFile(filepath) {
4040
+ return SKIP_PATHS.some((p) => filepath.includes(p)) || !/\.[jt]sx?$/.test(filepath);
4041
+ }
4042
+ function runLoaderTransform(ctx) {
4043
+ const { filepath, source, options } = ctx;
4044
+ const passthrough = { code: source, changed: false, classes: [] };
4045
+ if (shouldSkipFile(filepath)) return passthrough;
4046
+ try {
4047
+ if (options.incremental !== false) {
4048
+ const engine = getIncrementalEngine({ verbose: options.verbose });
4049
+ const precheck = engine.processFile(filepath, source, []);
4050
+ if (!precheck.changed) return passthrough;
4051
+ }
4052
+ const compiled = compileWithCore({
4053
+ filepath,
4054
+ source,
4055
+ options: { ...options, filename: filepath }
4056
+ });
4057
+ if (!compiled.result.changed) return passthrough;
4058
+ return finalize(
4059
+ compiled.result,
4060
+ filepath,
4061
+ options,
4062
+ compiled.engine,
4063
+ compiled.cacheHit,
4064
+ compiled.metadata
4065
+ );
4066
+ } catch (err) {
4067
+ if (process.env.NODE_ENV !== "production") {
4068
+ const name = filepath.split(/[/\\]/).pop();
4069
+ console.warn(`[tailwind-styled] Transform failed for ${name}:`, err);
4070
+ }
4071
+ return passthrough;
4072
+ }
4073
+ }
4074
+ function finalize(result, filepath, options, engine, cacheHit, metadata) {
4075
+ if (!result.changed) {
4076
+ return { code: result.code, changed: false, classes: [] };
4077
+ }
4078
+ if (options.routeCss && result.classes.length > 0) {
4079
+ registerFileClasses(filepath, result.classes);
4080
+ }
4081
+ if (options.incremental !== false) {
4082
+ try {
4083
+ const engineInst = getIncrementalEngine({ verbose: options.verbose });
4084
+ const nodes = parseClassesToNodes(result.classes);
4085
+ const diff = engineInst.processFile(filepath, result.code, nodes);
4086
+ getBucketEngine().applyDiff(diff.diff);
4087
+ } catch {
4088
+ }
4089
+ }
4090
+ if (options.verbose) {
4091
+ const env = result.rsc?.isServer ? "server" : "client";
4092
+ const name = filepath.split(/[/\\]/).pop();
4093
+ const pathHint = result.rsc ? ` (${env})` : "";
4094
+ const cacheText = cacheHit ? " cache-hit" : "";
4095
+ const metaText = metadata?.length ? ` [${metadata.length} compound]` : "";
4096
+ console.log(
4097
+ `[tailwind-styled] ${name} -> ${result.classes.length} classes${pathHint} [${engine}${cacheText}]${metaText}`
4098
+ );
4099
+ }
4100
+ return {
4101
+ code: result.code,
4102
+ changed: result.changed,
4103
+ classes: result.classes,
4104
+ rsc: result.rsc,
4105
+ engine,
4106
+ cacheHit,
4107
+ metadata
4108
+ };
4109
+ }
4110
+ var CONFIG_FILES = [
4111
+ "tailwind.config.ts",
4112
+ "tailwind.config.js",
4113
+ "tailwind.config.mjs",
4114
+ "tailwind.config.cjs"
4115
+ ];
4116
+ var _cachedConfig = null;
4117
+ var _cachedCwd = "";
4118
+ function loadTailwindConfig(cwd = process.cwd()) {
4119
+ if (_cachedConfig && _cachedCwd === cwd) return _cachedConfig;
4120
+ _cachedCwd = cwd;
4121
+ for (const file of CONFIG_FILES) {
4122
+ const fullPath = path7.join(cwd, file);
4123
+ if (fs3.existsSync(fullPath)) {
4124
+ try {
4125
+ const mod = __require(fullPath);
4126
+ const config = mod.default ?? mod;
4127
+ _cachedConfig = config;
4128
+ console.log(`[tailwind-styled-v4] Using config: ${file}`);
4129
+ return config;
4130
+ } catch {
4131
+ }
4132
+ }
4133
+ }
4134
+ console.log("[tailwind-styled-v4] No tailwind config found \u2192 using built-in preset");
4135
+ const { defaultPreset: defaultPreset2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
4136
+ _cachedConfig = defaultPreset2;
4137
+ return defaultPreset2;
4138
+ }
4139
+ function getContentPaths(config, cwd = process.cwd()) {
4140
+ const paths = [];
4141
+ if (Array.isArray(config.content)) {
4142
+ for (const item of config.content) {
4143
+ if (typeof item === "string") paths.push(item);
4144
+ else if (typeof item === "object" && item.raw) ;
4145
+ }
4146
+ return paths;
4147
+ }
4148
+ if (config.content?.files) {
4149
+ return config.content.files.filter((f) => typeof f === "string");
4150
+ }
4151
+ return ["src", "app", "pages", "components"].filter((d) => fs3.existsSync(path7.join(cwd, d))).map((d) => `./${d}/**/*.{tsx,ts,jsx,js}`);
4152
+ }
4153
+ function invalidateConfigCache() {
4154
+ _cachedConfig = null;
4155
+ _cachedCwd = "";
4156
+ }
4157
+ function isZeroConfig(cwd = process.cwd()) {
4158
+ return !CONFIG_FILES.some((f) => fs3.existsSync(path7.join(cwd, f)));
4159
+ }
4160
+ function bootstrapZeroConfig(cwd = process.cwd()) {
4161
+ let generatedConfig = false;
4162
+ let generatedCss = false;
4163
+ generatedConfig = false;
4164
+ const cssPaths = [
4165
+ "src/app/globals.css",
4166
+ "app/globals.css",
4167
+ "src/index.css",
4168
+ "src/styles/globals.css"
4169
+ ];
4170
+ const hasGlobalCss = cssPaths.some((p) => fs3.existsSync(path7.join(cwd, p)));
4171
+ if (!hasGlobalCss) {
4172
+ const { defaultGlobalCss: defaultGlobalCss2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
4173
+ const appDir = fs3.existsSync(path7.join(cwd, "src/app")) ? "src/app" : fs3.existsSync(path7.join(cwd, "app")) ? "app" : "src";
4174
+ const cssPath = path7.join(cwd, appDir, "globals.css");
4175
+ if (fs3.existsSync(path7.dirname(cssPath))) {
4176
+ fs3.writeFileSync(cssPath, defaultGlobalCss2);
4177
+ generatedCss = true;
4178
+ console.log(`[tailwind-styled-v4] Generated ${cssPath}`);
4179
+ }
4180
+ }
4181
+ return { generatedConfig, generatedCss };
4182
+ }
4183
+
4184
+ // packages/compiler/src/index.ts
4185
+ init_nativeBridge();
4186
+ var _binding2;
4187
+ function getBinding2() {
4188
+ if (_binding2 !== void 0) {
4189
+ if (_binding2 === null) {
4190
+ throw new Error(
4191
+ `[tailwind-styled/compiler v5] Native CSS binding is required but not available.
4192
+ Please ensure the native module is properly built.`
4193
+ );
4194
+ }
4195
+ return _binding2;
4196
+ }
4197
+ if (process.env.TWS_NO_NATIVE === "1") {
4198
+ _binding2 = null;
4199
+ throw new Error(
4200
+ `[tailwind-styled/compiler v5] Native binding is required.
4201
+ The TWS_NO_NATIVE environment variable is set, which disables native binding.`
4202
+ );
4203
+ }
4204
+ const req = typeof __require === "function" ? __require : createRequire(import.meta.url);
4205
+ const candidates = [
4206
+ path7.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
4207
+ path7.resolve(__dirname, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4208
+ path7.resolve(__dirname, "..", "..", "..", "..", "native", "tailwind_styled_parser.node")
4209
+ ];
4210
+ for (const c of candidates) {
4211
+ try {
4212
+ const mod = req(c);
4213
+ if (mod?.compileCss) {
4214
+ _binding2 = mod;
4215
+ return _binding2;
4216
+ }
4217
+ } catch {
4218
+ }
4219
+ }
4220
+ _binding2 = null;
4221
+ throw new Error(
4222
+ `[tailwind-styled/compiler v5] Native CSS binding not found.
4223
+ Tried loading from:
4224
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
4225
+
4226
+ Please build the native module.`
4227
+ );
4228
+ }
4229
+ function compileCssNative(classes, prefix = null) {
4230
+ const binding = getBinding2();
4231
+ const r = binding.compileCss(classes, prefix);
4232
+ return { ...r, engine: "rust" };
4233
+ }
4234
+ function astExtractClassesNative(source, filename) {
4235
+ const binding = getBinding2();
4236
+ const r = binding.astExtractClasses(source, filename);
4237
+ return { ...r, engine: "rust" };
4238
+ }
4239
+ var SCAN_EXTENSIONS2 = [".tsx", ".ts", ".jsx", ".js"];
4240
+ function scanDir(dir, files = []) {
4241
+ if (!fs3.existsSync(dir)) return files;
4242
+ const entries = fs3.readdirSync(dir, { withFileTypes: true });
4243
+ for (const entry of entries) {
4244
+ if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
4245
+ const fullPath = path7.join(dir, entry.name);
4246
+ if (entry.isDirectory()) {
4247
+ scanDir(fullPath, files);
4248
+ } else if (SCAN_EXTENSIONS2.some((ext) => entry.name.endsWith(ext))) {
4249
+ files.push(fullPath);
4250
+ }
4251
+ }
4252
+ return files;
4253
+ }
4254
+ function generateSafelist(scanDirs, outputPath = ".tailwind-styled-safelist.json", cwd = process.cwd()) {
4255
+ const allClasses = /* @__PURE__ */ new Set();
4256
+ for (const dir of scanDirs) {
4257
+ const absDir = path7.isAbsolute(dir) ? dir : path7.resolve(cwd, dir);
4258
+ const files = scanDir(absDir);
4259
+ for (const file of files) {
4260
+ try {
4261
+ const source = fs3.readFileSync(file, "utf-8");
4262
+ const classes = extractAllClasses(source);
4263
+ classes.forEach((c) => allClasses.add(c));
4264
+ } catch {
4265
+ }
4266
+ }
4267
+ }
4268
+ const sorted = Array.from(allClasses).sort();
4269
+ const absOutput = path7.isAbsolute(outputPath) ? outputPath : path7.resolve(cwd, outputPath);
4270
+ fs3.writeFileSync(absOutput, JSON.stringify(sorted, null, 2));
4271
+ console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
4272
+ return sorted;
4273
+ }
4274
+ function loadSafelist(safelistPath) {
4275
+ try {
4276
+ const content = fs3.readFileSync(safelistPath, "utf-8");
4277
+ return JSON.parse(content);
4278
+ } catch {
4279
+ return [];
4280
+ }
4281
+ }
4282
+ function generateSafelistCss(scanDirs, outputPath = "src/app/__tw-safelist.css", cwd = process.cwd()) {
4283
+ const allClasses = /* @__PURE__ */ new Set();
4284
+ for (const dir of scanDirs) {
4285
+ const absDir = path7.isAbsolute(dir) ? dir : path7.resolve(cwd, dir);
4286
+ const files = scanDir(absDir);
4287
+ for (const file of files) {
4288
+ try {
4289
+ const source = fs3.readFileSync(file, "utf-8");
4290
+ const classes = extractAllClasses(source);
4291
+ classes.forEach((c) => allClasses.add(c));
4292
+ } catch {
4293
+ }
4294
+ }
4295
+ }
4296
+ const sorted = Array.from(allClasses).sort();
4297
+ const absOutput = path7.isAbsolute(outputPath) ? outputPath : path7.resolve(cwd, outputPath);
4298
+ fs3.mkdirSync(path7.dirname(absOutput), { recursive: true });
4299
+ const css = sorted.length > 0 ? `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
4300
+ @source inline("${sorted.join(" ")}");
4301
+ ` : `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
4302
+ /* No safelist classes found */
4303
+ `;
4304
+ fs3.writeFileSync(absOutput, css);
4305
+ console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
4306
+ return sorted;
4307
+ }
3397
4308
  async function generateCssForClasses(classes, config, cwd = process.cwd()) {
3398
- const twConfig = config != null ? config : loadTailwindConfig(cwd);
3399
4309
  try {
3400
- return await generateViaTailwindV4(classes, twConfig, cwd);
3401
- } catch (e) {
4310
+ const { compileCssFromClasses: compileCssFromClasses2 } = (init_cssCompiler(), __toCommonJS(cssCompiler_exports));
4311
+ const result = compileCssFromClasses2(classes);
4312
+ if (result?.css && result.resolvedClasses.length > 0) {
4313
+ const resolveRate = result.resolvedClasses.length / classes.length;
4314
+ if (resolveRate >= 0.5) return result.css;
4315
+ }
4316
+ } catch {
3402
4317
  }
4318
+ const twConfig = config ?? loadTailwindConfig(cwd);
3403
4319
  try {
3404
- return await generateViaTailwindV3(classes, twConfig);
3405
- } catch (e) {
4320
+ return await generateViaTailwindV4(classes, twConfig, cwd);
4321
+ } catch {
3406
4322
  }
3407
4323
  return generateManualCss(classes);
3408
4324
  }
@@ -3420,26 +4336,10 @@ async function generateViaTailwindV4(classes, _config, cwd) {
3420
4336
  optimize: { minify: false }
3421
4337
  })
3422
4338
  ]).process(virtualCss, {
3423
- from: path4__default.default.join(cwd, "virtual.css")
4339
+ from: path7.join(cwd, "virtual.css")
3424
4340
  });
3425
4341
  return filterCssForClasses(result.css, classes);
3426
4342
  }
3427
- async function generateViaTailwindV3(classes, config) {
3428
- const postcss = __require("postcss");
3429
- const tailwindcss = __require("tailwindcss");
3430
- const virtualContent = classes.map((c) => `<div class="${c}">`).join("\n");
3431
- const twConfigWithContent = __spreadProps(__spreadValues({}, config), {
3432
- content: [{ raw: virtualContent, extension: "html" }],
3433
- safelist: classes
3434
- });
3435
- const inputCss = `@tailwind base;
3436
- @tailwind components;
3437
- @tailwind utilities;`;
3438
- const result = await postcss([tailwindcss(twConfigWithContent)]).process(inputCss, {
3439
- from: void 0
3440
- });
3441
- return result.css;
3442
- }
3443
4343
  function generateManualCss(classes) {
3444
4344
  const { generateAtomicCss: generateAtomicCss2, parseAtomicClass: parseAtomicClass2 } = (init_atomicCss(), __toCommonJS(atomicCss_exports));
3445
4345
  const rules = classes.map((c) => parseAtomicClass2(c)).filter(Boolean);
@@ -3489,7 +4389,7 @@ async function generateAllRouteCss(opts = {}) {
3489
4389
  const { cwd = process.cwd(), outputDir, config, minify = true } = opts;
3490
4390
  const results = [];
3491
4391
  const routes = getAllRoutes();
3492
- const twConfig = config != null ? config : loadTailwindConfig(cwd);
4392
+ const twConfig = config ?? loadTailwindConfig(cwd);
3493
4393
  for (const route of routes) {
3494
4394
  const classes = Array.from(getRouteClasses(route));
3495
4395
  if (classes.length === 0) continue;
@@ -3509,13 +4409,13 @@ async function generateAllRouteCss(opts = {}) {
3509
4409
  }
3510
4410
  }
3511
4411
  if (outputDir) {
3512
- const fs5 = __require("fs");
3513
- fs5.mkdirSync(outputDir, { recursive: true });
4412
+ const fs6 = __require("fs");
4413
+ fs6.mkdirSync(outputDir, { recursive: true });
3514
4414
  for (const result of results) {
3515
4415
  const filename = routeToFilename(result.route);
3516
- const filepath = path4__default.default.join(outputDir, filename);
3517
- fs5.mkdirSync(path4__default.default.dirname(filepath), { recursive: true });
3518
- fs5.writeFileSync(filepath, result.css);
4416
+ const filepath = path7.join(outputDir, filename);
4417
+ fs6.mkdirSync(path7.dirname(filepath), { recursive: true });
4418
+ fs6.writeFileSync(filepath, result.css);
3519
4419
  }
3520
4420
  const totalSize = results.reduce((sum, r) => sum + r.sizeBytes, 0);
3521
4421
  console.log(
@@ -3538,57 +4438,6 @@ function formatBytes(bytes) {
3538
4438
  return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
3539
4439
  }
3540
4440
 
3541
- exports.BucketEngine = BucketEngine;
3542
- exports.IncrementalEngine = IncrementalEngine;
3543
- exports.analyzeFile = analyzeFile;
3544
- exports.analyzeVariantUsage = analyzeVariantUsage;
3545
- exports.bootstrapZeroConfig = bootstrapZeroConfig;
3546
- exports.bucketSort = bucketSort;
3547
- exports.classifyNode = classifyNode;
3548
- exports.clearAtomicRegistry = clearAtomicRegistry;
3549
- exports.compileVariants = compileVariants;
3550
- exports.detectConflicts = detectConflicts;
3551
- exports.extractAllClasses = extractAllClasses;
3552
- exports.extractComponentUsage = extractComponentUsage;
3553
- exports.fileToRoute = fileToRoute;
3554
- exports.generateAllRouteCss = generateAllRouteCss;
3555
- exports.generateAtomicCss = generateAtomicCss;
3556
- exports.generateCssForClasses = generateCssForClasses;
3557
- exports.generateSafelist = generateSafelist;
3558
- exports.generateSafelistCss = generateSafelistCss;
3559
- exports.getAllRoutes = getAllRoutes;
3560
- exports.getAtomicRegistry = getAtomicRegistry;
3561
- exports.getBucketEngine = getBucketEngine;
3562
- exports.getCollector = getCollector;
3563
- exports.getCollectorSummary = getCollectorSummary;
3564
- exports.getContentPaths = getContentPaths;
3565
- exports.getIncrementalEngine = getIncrementalEngine;
3566
- exports.getRouteClasses = getRouteClasses;
3567
- exports.hasInteractiveFeatures = hasInteractiveFeatures;
3568
- exports.hasTwUsage = hasTwUsage;
3569
- exports.hoistComponents = hoistComponents;
3570
- exports.injectClientDirective = injectClientDirective;
3571
- exports.injectServerOnlyComment = injectServerOnlyComment;
3572
- exports.invalidateConfigCache = invalidateConfigCache;
3573
- exports.isDynamic = isDynamic;
3574
- exports.isServerComponent = isServerComponent;
3575
- exports.isZeroConfig = isZeroConfig;
3576
- exports.loadSafelist = loadSafelist;
3577
- exports.loadTailwindConfig = loadTailwindConfig;
3578
- exports.mergeClassesStatic = mergeClassesStatic;
3579
- exports.normalizeClasses = normalizeClasses;
3580
- exports.parseAtomicClass = parseAtomicClass;
3581
- exports.parseClassesToNodes = parseClassesToNodes;
3582
- exports.registerFileClasses = registerFileClasses;
3583
- exports.registerGlobalClasses = registerGlobalClasses;
3584
- exports.resetBucketEngine = resetBucketEngine;
3585
- exports.resetCollector = resetCollector;
3586
- exports.resetIncrementalEngine = resetIncrementalEngine;
3587
- exports.resolveServerVariant = resolveServerVariant;
3588
- exports.runElimination = runElimination;
3589
- exports.scanProjectUsage = scanProjectUsage;
3590
- exports.shouldProcess = hasTwUsage;
3591
- exports.toAtomicClasses = toAtomicClasses;
3592
- exports.transformSource = transformSource;
3593
- //# sourceMappingURL=compiler.cjs.map
3594
- //# sourceMappingURL=compiler.cjs.map
4441
+ export { BucketEngine, CompileContext, IncrementalEngine, Pipeline, adaptNativeResult, analyzeFile, analyzeVariantUsage, astExtractClassesNative, bootstrapZeroConfig, bucketSort, buildStyleTag, classifyNode, clearAtomicRegistry, compileCssFromClasses, compileCssNative, compileVariants, compileWithCore, detectConflicts, eliminateDeadCss, extractAllClasses, extractComponentUsage, fileToRoute, findDeadVariants, generateAllRouteCss, generateAtomicCss, generateCssForClasses, generateSafelist, generateSafelistCss, getAllRoutes, getAtomicRegistry, getBucketEngine, getCollector, getCollectorSummary, getContentPaths, getIncrementalEngine, getNativeBridge, getRouteClasses, hasInteractiveFeatures, hasTwUsage, hoistComponents, injectClientDirective, injectServerOnlyComment, invalidateConfigCache, isDynamic, isServerComponent, isZeroConfig, loadSafelist, loadTailwindConfig, mergeClassesStatic, normalizeClasses, optimizeCss, parseAtomicClass, parseClassesToNodes, registerFileClasses, registerGlobalClasses, resetBucketEngine, resetCollector, resetCompileCache, resetIncrementalEngine, resetNativeBridgeCache, resolveServerVariant, runElimination, runLoaderTransform, scanProjectUsage, hasTwUsage as shouldProcess, shouldSkipFile, toAtomicClasses, transformSource };
4442
+ //# sourceMappingURL=compiler.mjs.map
4443
+ //# sourceMappingURL=compiler.mjs.map