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
package/dist/compiler.js CHANGED
@@ -1,34 +1,22 @@
1
- import { createRequire } from 'module';
2
- import { twMerge } from 'tailwind-merge';
3
- import fs2 from 'fs';
4
- import path4 from 'path';
5
- import crypto from 'crypto';
1
+ 'use strict';
6
2
 
7
- /* tailwind-styled-v4 v4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
3
+ var crypto = require('crypto');
4
+ var fs3 = require('fs');
5
+ var module$1 = require('module');
6
+ var path7 = require('path');
7
+ var tailwindMerge = require('tailwind-merge');
8
+
9
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var fs3__default = /*#__PURE__*/_interopDefault(fs3);
13
+ var path7__default = /*#__PURE__*/_interopDefault(path7);
14
+
15
+ /* tailwind-styled-v4 v5.0.1 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
8
16
  var __defProp = Object.defineProperty;
9
- var __defProps = Object.defineProperties;
10
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
12
18
  var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
19
  var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
- var __typeError = (msg) => {
17
- throw TypeError(msg);
18
- };
19
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20
- var __spreadValues = (a, b) => {
21
- for (var prop in b || (b = {}))
22
- if (__hasOwnProp.call(b, prop))
23
- __defNormalProp(a, prop, b[prop]);
24
- if (__getOwnPropSymbols)
25
- for (var prop of __getOwnPropSymbols(b)) {
26
- if (__propIsEnum.call(b, prop))
27
- __defNormalProp(a, prop, b[prop]);
28
- }
29
- return a;
30
- };
31
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
32
20
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
33
21
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
34
22
  }) : x)(function(x) {
@@ -51,12 +39,165 @@ var __copyProps = (to, from, except, desc) => {
51
39
  return to;
52
40
  };
53
41
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
55
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
56
- 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);
57
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
42
+
43
+ // packages/shared/src/logger.ts
44
+ function getEnvLevel() {
45
+ const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
46
+ if (env && env in LEVELS) return env;
47
+ return process.env.TWS_DEBUG_SCANNER === "1" ? "debug" : "info";
48
+ }
49
+ function createLogger(prefix, level) {
50
+ let currentLevel = getEnvLevel();
51
+ const log2 = (msgLevel, stream, args) => {
52
+ if (LEVELS[msgLevel] > LEVELS[currentLevel]) return;
53
+ const line = `[${prefix}] ${args.map(String).join(" ")}
54
+ `;
55
+ process[stream].write(line);
56
+ };
57
+ return {
58
+ error: (...a) => log2("error", "stderr", a),
59
+ warn: (...a) => log2("warn", "stderr", a),
60
+ info: (...a) => log2("info", "stdout", a),
61
+ debug: (...a) => log2("debug", "stderr", a),
62
+ setLevel: (l) => {
63
+ currentLevel = l;
64
+ }
65
+ };
66
+ }
67
+ var LEVELS;
68
+ var init_logger = __esm({
69
+ "packages/shared/src/logger.ts"() {
70
+ LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
71
+ createLogger("tailwind-styled");
72
+ }
73
+ });
74
+ function hashContent(content, algorithm = "md5", length = 8) {
75
+ return crypto.createHash(algorithm).update(content).digest("hex").slice(0, length);
76
+ }
77
+ var init_hash = __esm({
78
+ "packages/shared/src/hash.ts"() {
79
+ }
80
+ });
81
+
82
+ // packages/shared/src/index.ts
83
+ var init_src = __esm({
84
+ "packages/shared/src/index.ts"() {
85
+ init_logger();
86
+ init_hash();
87
+ }
88
+ });
89
+
90
+ // packages/compiler/src/nativeBridge.ts
91
+ var nativeBridge_exports = {};
92
+ __export(nativeBridge_exports, {
93
+ adaptNativeResult: () => adaptNativeResult,
94
+ getNativeBridge: () => getNativeBridge,
95
+ resetNativeBridgeCache: () => resetNativeBridgeCache
96
+ });
97
+ function tryRequire(id) {
98
+ try {
99
+ const mod = requireFromRuntime(id);
100
+ return mod ?? null;
101
+ } catch (error) {
102
+ log.debug(
103
+ `native bridge load miss ${id}: ${error instanceof Error ? error.message : String(error)}`
104
+ );
105
+ return null;
106
+ }
107
+ }
108
+ function getNativeBridge() {
109
+ if (cachedBridge !== void 0) {
110
+ if (cachedBridge === null) {
111
+ throw new Error(
112
+ `[tailwind-styled/compiler v5] Native binding is required but not available.
113
+ Please ensure:
114
+ 1. The native module is properly installed
115
+ 2. You have run: npm run build:native (or use prebuilt binary)
116
+ 3. TWS_NO_NATIVE environment variable is not set
117
+
118
+ For help, see: https://tailwind-styled.dev/docs/install`
119
+ );
120
+ }
121
+ return cachedBridge;
122
+ }
123
+ if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1") {
124
+ cachedBridge = null;
125
+ throw new Error(
126
+ `[tailwind-styled/compiler v5] Native binding is required.
127
+ The TWS_NO_NATIVE or TWS_NO_RUST environment variable is set, which disables native binding.
128
+ Please unset this environment variable to use the native compiler.`
129
+ );
130
+ }
131
+ const candidates = [
132
+ "@tailwind-styled/native",
133
+ path7__default.default.resolve(process.cwd(), "native", "index.mjs"),
134
+ path7__default.default.resolve(runtimeDir, "..", "..", "native", "index.mjs"),
135
+ path7__default.default.resolve(runtimeDir, "..", "..", "..", "native", "index.mjs"),
136
+ path7__default.default.resolve(process.cwd(), "native", "index.node"),
137
+ path7__default.default.resolve(runtimeDir, "..", "..", "native", "index.node"),
138
+ path7__default.default.resolve(runtimeDir, "..", "..", "..", "native", "index.node")
139
+ ];
140
+ for (const candidate of candidates) {
141
+ const bridge = tryRequire(candidate);
142
+ if (bridge) {
143
+ log.debug(`native bridge loaded from ${candidate}`);
144
+ cachedBridge = bridge;
145
+ return cachedBridge;
146
+ }
147
+ }
148
+ cachedBridge = null;
149
+ throw new Error(
150
+ `[tailwind-styled/compiler v5] Native binding not found.
151
+ Tried loading from:
152
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
153
+
154
+ Please build the native module:
155
+ npm run build:native
156
+
157
+ Or install a prebuilt binary for your platform.`
158
+ );
159
+ }
160
+ function resetNativeBridgeCache() {
161
+ cachedBridge = void 0;
162
+ }
163
+ function adaptNativeResult(raw) {
164
+ let rsc;
165
+ if (raw.rscJson) {
166
+ try {
167
+ const parsed = JSON.parse(raw.rscJson);
168
+ rsc = {
169
+ isServer: parsed.isServer,
170
+ needsClientDirective: parsed.needsClientDirective,
171
+ clientReasons: []
172
+ };
173
+ } catch {
174
+ }
175
+ }
176
+ let metadata;
177
+ if (raw.metadataJson) {
178
+ try {
179
+ metadata = JSON.parse(raw.metadataJson);
180
+ } catch {
181
+ }
182
+ }
183
+ return {
184
+ code: raw.code,
185
+ classes: raw.classes,
186
+ changed: raw.changed,
187
+ rsc,
188
+ metadata
189
+ };
190
+ }
191
+ var runtimeDir, requireFromRuntime, cachedBridge, log;
192
+ var init_nativeBridge = __esm({
193
+ "packages/compiler/src/nativeBridge.ts"() {
194
+ init_src();
195
+ runtimeDir = typeof __dirname === "string" && __dirname.length > 0 ? __dirname : process.cwd();
196
+ requireFromRuntime = typeof module !== "undefined" && typeof module.require === "function" ? module.require.bind(module) : module$1.createRequire(path7__default.default.join(runtimeDir, "noop.cjs"));
197
+ log = createLogger("compiler:native");
198
+ }
199
+ });
58
200
  function requireNative() {
59
- var _a2, _b2, _c, _d;
60
201
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
61
202
  try {
62
203
  return require2(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
@@ -73,8 +214,8 @@ function requireNative() {
73
214
  try {
74
215
  const binding = require2("@oxc-parser/binding-android-arm64");
75
216
  const bindingPackageVersion = require2("@oxc-parser/binding-android-arm64/package.json").version;
76
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
77
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
217
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
218
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
78
219
  }
79
220
  return binding;
80
221
  } catch (e) {
@@ -89,8 +230,8 @@ function requireNative() {
89
230
  try {
90
231
  const binding = require2("@oxc-parser/binding-android-arm-eabi");
91
232
  const bindingPackageVersion = require2("@oxc-parser/binding-android-arm-eabi/package.json").version;
92
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
93
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
233
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
234
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
94
235
  }
95
236
  return binding;
96
237
  } catch (e) {
@@ -101,7 +242,7 @@ function requireNative() {
101
242
  }
102
243
  } else if (process.platform === "win32") {
103
244
  if (process.arch === "x64") {
104
- 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") {
245
+ if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
105
246
  try {
106
247
  return require2("./parser.win32-x64-gnu.node");
107
248
  } catch (e) {
@@ -110,8 +251,8 @@ function requireNative() {
110
251
  try {
111
252
  const binding = require2("@oxc-parser/binding-win32-x64-gnu");
112
253
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-gnu/package.json").version;
113
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
114
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
254
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
255
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
115
256
  }
116
257
  return binding;
117
258
  } catch (e) {
@@ -126,8 +267,8 @@ function requireNative() {
126
267
  try {
127
268
  const binding = require2("@oxc-parser/binding-win32-x64-msvc");
128
269
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-msvc/package.json").version;
129
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
130
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
270
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
271
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
131
272
  }
132
273
  return binding;
133
274
  } catch (e) {
@@ -143,8 +284,8 @@ function requireNative() {
143
284
  try {
144
285
  const binding = require2("@oxc-parser/binding-win32-ia32-msvc");
145
286
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-ia32-msvc/package.json").version;
146
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
147
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
287
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
288
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
148
289
  }
149
290
  return binding;
150
291
  } catch (e) {
@@ -159,8 +300,8 @@ function requireNative() {
159
300
  try {
160
301
  const binding = require2("@oxc-parser/binding-win32-arm64-msvc");
161
302
  const bindingPackageVersion = require2("@oxc-parser/binding-win32-arm64-msvc/package.json").version;
162
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
163
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
303
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
304
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
164
305
  }
165
306
  return binding;
166
307
  } catch (e) {
@@ -178,8 +319,8 @@ function requireNative() {
178
319
  try {
179
320
  const binding = require2("@oxc-parser/binding-darwin-universal");
180
321
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-universal/package.json").version;
181
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
182
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
322
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
323
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
183
324
  }
184
325
  return binding;
185
326
  } catch (e) {
@@ -194,8 +335,8 @@ function requireNative() {
194
335
  try {
195
336
  const binding = require2("@oxc-parser/binding-darwin-x64");
196
337
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-x64/package.json").version;
197
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
198
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
338
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
339
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
199
340
  }
200
341
  return binding;
201
342
  } catch (e) {
@@ -210,8 +351,8 @@ function requireNative() {
210
351
  try {
211
352
  const binding = require2("@oxc-parser/binding-darwin-arm64");
212
353
  const bindingPackageVersion = require2("@oxc-parser/binding-darwin-arm64/package.json").version;
213
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
214
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
354
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
355
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
215
356
  }
216
357
  return binding;
217
358
  } catch (e) {
@@ -230,8 +371,8 @@ function requireNative() {
230
371
  try {
231
372
  const binding = require2("@oxc-parser/binding-freebsd-x64");
232
373
  const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-x64/package.json").version;
233
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
234
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
374
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
375
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
235
376
  }
236
377
  return binding;
237
378
  } catch (e) {
@@ -246,8 +387,8 @@ function requireNative() {
246
387
  try {
247
388
  const binding = require2("@oxc-parser/binding-freebsd-arm64");
248
389
  const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-arm64/package.json").version;
249
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
250
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
390
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
391
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
251
392
  }
252
393
  return binding;
253
394
  } catch (e) {
@@ -267,8 +408,8 @@ function requireNative() {
267
408
  try {
268
409
  const binding = require2("@oxc-parser/binding-linux-x64-musl");
269
410
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-musl/package.json").version;
270
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
271
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
411
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
412
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
272
413
  }
273
414
  return binding;
274
415
  } catch (e) {
@@ -283,8 +424,8 @@ function requireNative() {
283
424
  try {
284
425
  const binding = require2("@oxc-parser/binding-linux-x64-gnu");
285
426
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-gnu/package.json").version;
286
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
287
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
427
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
428
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
288
429
  }
289
430
  return binding;
290
431
  } catch (e) {
@@ -301,8 +442,8 @@ function requireNative() {
301
442
  try {
302
443
  const binding = require2("@oxc-parser/binding-linux-arm64-musl");
303
444
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-musl/package.json").version;
304
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
305
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
445
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
446
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
306
447
  }
307
448
  return binding;
308
449
  } catch (e) {
@@ -317,8 +458,8 @@ function requireNative() {
317
458
  try {
318
459
  const binding = require2("@oxc-parser/binding-linux-arm64-gnu");
319
460
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-gnu/package.json").version;
320
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
321
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
461
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
462
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
322
463
  }
323
464
  return binding;
324
465
  } catch (e) {
@@ -335,8 +476,8 @@ function requireNative() {
335
476
  try {
336
477
  const binding = require2("@oxc-parser/binding-linux-arm-musleabihf");
337
478
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-musleabihf/package.json").version;
338
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
339
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
479
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
480
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
340
481
  }
341
482
  return binding;
342
483
  } catch (e) {
@@ -351,8 +492,8 @@ function requireNative() {
351
492
  try {
352
493
  const binding = require2("@oxc-parser/binding-linux-arm-gnueabihf");
353
494
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-gnueabihf/package.json").version;
354
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
355
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
495
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
496
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
356
497
  }
357
498
  return binding;
358
499
  } catch (e) {
@@ -369,8 +510,8 @@ function requireNative() {
369
510
  try {
370
511
  const binding = require2("@oxc-parser/binding-linux-loong64-musl");
371
512
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-musl/package.json").version;
372
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
373
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
513
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
514
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
374
515
  }
375
516
  return binding;
376
517
  } catch (e) {
@@ -385,8 +526,8 @@ function requireNative() {
385
526
  try {
386
527
  const binding = require2("@oxc-parser/binding-linux-loong64-gnu");
387
528
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-gnu/package.json").version;
388
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
389
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
529
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
530
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
390
531
  }
391
532
  return binding;
392
533
  } catch (e) {
@@ -403,8 +544,8 @@ function requireNative() {
403
544
  try {
404
545
  const binding = require2("@oxc-parser/binding-linux-riscv64-musl");
405
546
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-musl/package.json").version;
406
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
407
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
547
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
548
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
549
  }
409
550
  return binding;
410
551
  } catch (e) {
@@ -419,8 +560,8 @@ function requireNative() {
419
560
  try {
420
561
  const binding = require2("@oxc-parser/binding-linux-riscv64-gnu");
421
562
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-gnu/package.json").version;
422
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
423
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
563
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
564
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
424
565
  }
425
566
  return binding;
426
567
  } catch (e) {
@@ -436,8 +577,8 @@ function requireNative() {
436
577
  try {
437
578
  const binding = require2("@oxc-parser/binding-linux-ppc64-gnu");
438
579
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-ppc64-gnu/package.json").version;
439
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
440
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
580
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
581
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
441
582
  }
442
583
  return binding;
443
584
  } catch (e) {
@@ -452,8 +593,8 @@ function requireNative() {
452
593
  try {
453
594
  const binding = require2("@oxc-parser/binding-linux-s390x-gnu");
454
595
  const bindingPackageVersion = require2("@oxc-parser/binding-linux-s390x-gnu/package.json").version;
455
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
456
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
596
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
597
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
457
598
  }
458
599
  return binding;
459
600
  } catch (e) {
@@ -472,8 +613,8 @@ function requireNative() {
472
613
  try {
473
614
  const binding = require2("@oxc-parser/binding-openharmony-arm64");
474
615
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm64/package.json").version;
475
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
476
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
616
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
617
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
477
618
  }
478
619
  return binding;
479
620
  } catch (e) {
@@ -488,8 +629,8 @@ function requireNative() {
488
629
  try {
489
630
  const binding = require2("@oxc-parser/binding-openharmony-x64");
490
631
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-x64/package.json").version;
491
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
492
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
632
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
633
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
493
634
  }
494
635
  return binding;
495
636
  } catch (e) {
@@ -504,8 +645,8 @@ function requireNative() {
504
645
  try {
505
646
  const binding = require2("@oxc-parser/binding-openharmony-arm");
506
647
  const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm/package.json").version;
507
- if (bindingPackageVersion !== "0.118.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
508
- throw new Error(`Native binding package version mismatch, expected 0.118.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
648
+ if (bindingPackageVersion !== "0.120.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
649
+ throw new Error(`Native binding package version mismatch, expected 0.120.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
509
650
  }
510
651
  return binding;
511
652
  } catch (e) {
@@ -518,12 +659,11 @@ function requireNative() {
518
659
  loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
519
660
  }
520
661
  }
521
- 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;
662
+ var require2, readFileSync, nativeBinding, loadErrors, isMusl, isFileMusl, isMuslFromFilesystem, isMuslFromReport, isMuslFromChildProcess, Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse, parseSync, rawTransferSupported, getBufferOffset, parseRaw, parseRawSync;
522
663
  var init_bindings = __esm({
523
- "../../node_modules/oxc-parser/src-js/bindings.js"() {
524
- import_meta = {};
525
- require2 = createRequire(import_meta.url);
526
- new URL(".", import_meta.url).pathname;
664
+ "node_modules/oxc-parser/src-js/bindings.js"() {
665
+ require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
666
+ new URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href))).pathname;
527
667
  ({ readFileSync } = require2("node:fs"));
528
668
  nativeBinding = null;
529
669
  loadErrors = [];
@@ -544,14 +684,13 @@ var init_bindings = __esm({
544
684
  isMuslFromFilesystem = () => {
545
685
  try {
546
686
  return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
547
- } catch (e) {
687
+ } catch {
548
688
  return null;
549
689
  }
550
690
  };
551
691
  isMuslFromReport = () => {
552
- var _a2;
553
692
  let report = null;
554
- if (typeof ((_a2 = process.report) == null ? void 0 : _a2.getReport) === "function") {
693
+ if (typeof process.report?.getReport === "function") {
555
694
  process.report.excludeNetwork = true;
556
695
  report = process.report.getReport();
557
696
  }
@@ -608,7 +747,7 @@ var init_bindings = __esm({
608
747
  throw error;
609
748
  }
610
749
  }
611
- if (!nativeBinding && ((_b = (_a = globalThis.process) == null ? void 0 : _a.versions) == null ? void 0 : _b["webcontainer"])) {
750
+ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
612
751
  try {
613
752
  nativeBinding = require2("./webcontainer-fallback.cjs");
614
753
  } catch (err) {
@@ -634,17 +773,17 @@ var init_bindings = __esm({
634
773
  }
635
774
  });
636
775
 
637
- // ../../node_modules/oxc-parser/src-js/wrap.js
776
+ // node_modules/oxc-parser/src-js/wrap.js
638
777
  function wrap(result) {
639
- let program, module, comments, errors;
778
+ let program, module2, comments, errors;
640
779
  return {
641
780
  get program() {
642
781
  if (!program) program = jsonParseAst(result.program);
643
782
  return program;
644
783
  },
645
784
  get module() {
646
- if (!module) module = result.module;
647
- return module;
785
+ if (!module2) module2 = result.module;
786
+ return module2;
648
787
  },
649
788
  get comments() {
650
789
  if (!comments) comments = result.comments;
@@ -673,19 +812,19 @@ function applyFix(program, fixPath) {
673
812
  } else {
674
813
  try {
675
814
  node.value = RegExp(node.regex.pattern, node.regex.flags);
676
- } catch (e) {
815
+ } catch {
677
816
  }
678
817
  }
679
818
  }
680
819
  var init_wrap = __esm({
681
- "../../node_modules/oxc-parser/src-js/wrap.js"() {
820
+ "node_modules/oxc-parser/src-js/wrap.js"() {
682
821
  }
683
822
  });
684
823
 
685
- // ../../node_modules/oxc-parser/src-js/generated/visit/keys.js
824
+ // node_modules/oxc-parser/src-js/generated/visit/keys.js
686
825
  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;
687
826
  var init_keys = __esm({
688
- "../../node_modules/oxc-parser/src-js/generated/visit/keys.js"() {
827
+ "node_modules/oxc-parser/src-js/generated/visit/keys.js"() {
689
828
  ({ freeze } = Object);
690
829
  $EMPTY = freeze([]);
691
830
  DECORATORS__KEY__TYPE_ANNOTATION__VALUE = freeze([
@@ -901,16 +1040,15 @@ var init_keys = __esm({
901
1040
  });
902
1041
  }
903
1042
  });
904
- var import_meta2, walkProgram, addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor, _compiledVisitor, Visitor;
1043
+ var walkProgram, addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor, Visitor;
905
1044
  var init_visit = __esm({
906
- "../../node_modules/oxc-parser/src-js/visit/index.js"() {
907
- import_meta2 = {};
1045
+ "node_modules/oxc-parser/src-js/visit/index.js"() {
908
1046
  walkProgram = null;
909
1047
  Visitor = class {
1048
+ #compiledVisitor = null;
910
1049
  constructor(visitor) {
911
- __privateAdd(this, _compiledVisitor, null);
912
1050
  if (walkProgram === null) {
913
- const require4 = createRequire(import_meta2.url);
1051
+ const require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
914
1052
  ({ walkProgram } = require4("../generated/visit/walk.js"));
915
1053
  ({
916
1054
  addVisitorToCompiled,
@@ -921,7 +1059,7 @@ var init_visit = __esm({
921
1059
  const compiledVisitor = createCompiledVisitor();
922
1060
  addVisitorToCompiled(visitor);
923
1061
  const needsVisit = finalizeCompiledVisitor();
924
- if (needsVisit) __privateSet(this, _compiledVisitor, compiledVisitor);
1062
+ if (needsVisit) this.#compiledVisitor = compiledVisitor;
925
1063
  }
926
1064
  /**
927
1065
  * Visit AST.
@@ -929,15 +1067,14 @@ var init_visit = __esm({
929
1067
  * @returns {undefined}
930
1068
  */
931
1069
  visit(program) {
932
- const compiledVisitor = __privateGet(this, _compiledVisitor);
1070
+ const compiledVisitor = this.#compiledVisitor;
933
1071
  if (compiledVisitor !== null) walkProgram(program, compiledVisitor);
934
1072
  }
935
1073
  };
936
- _compiledVisitor = new WeakMap();
937
1074
  }
938
1075
  });
939
1076
 
940
- // ../../node_modules/oxc-parser/src-js/raw-transfer/supported.js
1077
+ // node_modules/oxc-parser/src-js/raw-transfer/supported.js
941
1078
  function rawTransferSupported2() {
942
1079
  if (rawTransferIsSupported === null) {
943
1080
  rawTransferIsSupported = rawTransferRuntimeSupported() && rawTransferSupported();
@@ -945,34 +1082,33 @@ function rawTransferSupported2() {
945
1082
  return rawTransferIsSupported;
946
1083
  }
947
1084
  function rawTransferRuntimeSupported() {
948
- var _a2, _b2, _c, _d, _e, _f, _g;
949
1085
  let global;
950
1086
  try {
951
1087
  global = globalThis;
952
- } catch (e) {
1088
+ } catch {
953
1089
  return false;
954
1090
  }
955
- const isBun = !!global.Bun || !!((_b2 = (_a2 = global.process) == null ? void 0 : _a2.versions) == null ? void 0 : _b2.bun);
1091
+ const isBun = !!global.Bun || !!global.process?.versions?.bun;
956
1092
  if (isBun) return false;
957
1093
  const isDeno = !!global.Deno;
958
1094
  if (isDeno) {
959
- const match2 = (_d = (_c = Deno.version) == null ? void 0 : _c.deno) == null ? void 0 : _d.match(/^(\d+)\./);
1095
+ const match2 = Deno.version?.deno?.match(/^(\d+)\./);
960
1096
  return !!match2 && match2[1] * 1 >= 2;
961
1097
  }
962
- const isNode = ((_f = (_e = global.process) == null ? void 0 : _e.release) == null ? void 0 : _f.name) === "node";
1098
+ const isNode = global.process?.release?.name === "node";
963
1099
  if (!isNode) return false;
964
- const match = (_g = process.version) == null ? void 0 : _g.match(/^v(\d+)\./);
1100
+ const match = process.version?.match(/^v(\d+)\./);
965
1101
  return !!match && match[1] * 1 >= 22;
966
1102
  }
967
1103
  var rawTransferIsSupported;
968
1104
  var init_supported = __esm({
969
- "../../node_modules/oxc-parser/src-js/raw-transfer/supported.js"() {
1105
+ "node_modules/oxc-parser/src-js/raw-transfer/supported.js"() {
970
1106
  init_bindings();
971
1107
  rawTransferIsSupported = null;
972
1108
  }
973
1109
  });
974
1110
 
975
- // ../../node_modules/oxc-parser/src-js/index.js
1111
+ // node_modules/oxc-parser/src-js/index.js
976
1112
  var src_js_exports = {};
977
1113
  __export(src_js_exports, {
978
1114
  ExportExportNameKind: () => ExportExportNameKind,
@@ -999,22 +1135,22 @@ function loadRawTransferLazy() {
999
1135
  }
1000
1136
  }
1001
1137
  function parseSync2(filename, sourceText, options) {
1002
- if (options == null ? void 0 : options.experimentalRawTransfer) {
1138
+ if (options?.experimentalRawTransfer) {
1003
1139
  loadRawTransfer();
1004
1140
  return parseSyncRaw(filename, sourceText, options);
1005
1141
  }
1006
- if (options == null ? void 0 : options.experimentalLazy) {
1142
+ if (options?.experimentalLazy) {
1007
1143
  loadRawTransferLazy();
1008
1144
  return parseSyncLazy(filename, sourceText, options);
1009
1145
  }
1010
1146
  return wrap(parseSync(filename, sourceText, options));
1011
1147
  }
1012
1148
  async function parse2(filename, sourceText, options) {
1013
- if (options == null ? void 0 : options.experimentalRawTransfer) {
1149
+ if (options?.experimentalRawTransfer) {
1014
1150
  loadRawTransfer();
1015
1151
  return await parseRaw2(filename, sourceText, options);
1016
1152
  }
1017
- if (options == null ? void 0 : options.experimentalLazy) {
1153
+ if (options?.experimentalLazy) {
1018
1154
  loadRawTransferLazy();
1019
1155
  return await parseLazy(filename, sourceText, options);
1020
1156
  }
@@ -1024,23 +1160,91 @@ function experimentalGetLazyVisitor() {
1024
1160
  loadRawTransferLazy();
1025
1161
  return LazyVisitor;
1026
1162
  }
1027
- var import_meta3, require3, parseSyncRaw, parseRaw2, parseSyncLazy, parseLazy, LazyVisitor;
1163
+ var require3, parseSyncRaw, parseRaw2, parseSyncLazy, parseLazy, LazyVisitor;
1028
1164
  var init_src_js = __esm({
1029
- "../../node_modules/oxc-parser/src-js/index.js"() {
1165
+ "node_modules/oxc-parser/src-js/index.js"() {
1030
1166
  init_bindings();
1031
1167
  init_wrap();
1032
1168
  init_keys();
1033
1169
  init_visit();
1034
1170
  init_bindings();
1035
1171
  init_supported();
1036
- import_meta3 = {};
1037
- require3 = createRequire(import_meta3.url);
1172
+ require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
1038
1173
  parseSyncRaw = null;
1039
1174
  parseSyncLazy = null;
1040
1175
  }
1041
1176
  });
1042
1177
 
1043
- // ../compiler/src/atomicCss.ts
1178
+ // packages/compiler/src/cssCompiler.ts
1179
+ var cssCompiler_exports = {};
1180
+ __export(cssCompiler_exports, {
1181
+ buildStyleTag: () => buildStyleTag,
1182
+ compileCssFromClasses: () => compileCssFromClasses
1183
+ });
1184
+ function getBinding() {
1185
+ if (_binding !== void 0) {
1186
+ if (_binding === null) {
1187
+ throw new Error(
1188
+ `[tailwind-styled/compiler v5] Native CSS binding is required but not available.
1189
+ Please ensure the native module is properly built.`
1190
+ );
1191
+ }
1192
+ return _binding;
1193
+ }
1194
+ if (process.env.TWS_NO_NATIVE === "1") {
1195
+ _binding = null;
1196
+ throw new Error(
1197
+ `[tailwind-styled/compiler v5] Native binding is required.
1198
+ The TWS_NO_NATIVE environment variable is set, which disables native binding.`
1199
+ );
1200
+ }
1201
+ const req = typeof __require === "function" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
1202
+ const candidates = [
1203
+ path7__default.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
1204
+ path7__default.default.resolve(__dirname, "..", "..", "..", "..", "native", "tailwind_styled_parser.node")
1205
+ ];
1206
+ for (const c of candidates) {
1207
+ try {
1208
+ const mod = req(c);
1209
+ if (mod?.compileCss) {
1210
+ _binding = mod;
1211
+ return _binding;
1212
+ }
1213
+ } catch {
1214
+ }
1215
+ }
1216
+ _binding = null;
1217
+ throw new Error(
1218
+ `[tailwind-styled/compiler v5] Native CSS binding not found.
1219
+ Tried loading from:
1220
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
1221
+
1222
+ Please build the native module.`
1223
+ );
1224
+ }
1225
+ function compileCssFromClasses(classes, options = {}) {
1226
+ const binding = getBinding();
1227
+ const prefix = options.prefix ?? null;
1228
+ const r = binding.compileCss(classes, prefix);
1229
+ return {
1230
+ css: r.css,
1231
+ resolvedClasses: r.resolvedClasses,
1232
+ unknownClasses: r.unknownClasses,
1233
+ sizeBytes: r.sizeBytes,
1234
+ engine: "rust"
1235
+ };
1236
+ }
1237
+ function buildStyleTag(classes) {
1238
+ const { css } = compileCssFromClasses(classes);
1239
+ return css ? `<style data-tailwind-styled>${css}</style>` : "";
1240
+ }
1241
+ var _binding;
1242
+ var init_cssCompiler = __esm({
1243
+ "packages/compiler/src/cssCompiler.ts"() {
1244
+ }
1245
+ });
1246
+
1247
+ // packages/compiler/src/atomicCss.ts
1044
1248
  var atomicCss_exports = {};
1045
1249
  __export(atomicCss_exports, {
1046
1250
  clearAtomicRegistry: () => clearAtomicRegistry,
@@ -1050,7 +1254,6 @@ __export(atomicCss_exports, {
1050
1254
  toAtomicClasses: () => toAtomicClasses
1051
1255
  });
1052
1256
  function sizeValue(v) {
1053
- var _a2;
1054
1257
  const num = Number(v);
1055
1258
  if (!Number.isNaN(num)) return `${num * 0.25}rem`;
1056
1259
  const special = {
@@ -1063,10 +1266,9 @@ function sizeValue(v) {
1063
1266
  svw: "100svw",
1064
1267
  svh: "100svh"
1065
1268
  };
1066
- return (_a2 = special[v]) != null ? _a2 : v;
1269
+ return special[v] ?? v;
1067
1270
  }
1068
1271
  function textSize(v) {
1069
- var _a2;
1070
1272
  const map = {
1071
1273
  xs: "0.75rem",
1072
1274
  sm: "0.875rem",
@@ -1082,10 +1284,9 @@ function textSize(v) {
1082
1284
  "8xl": "6rem",
1083
1285
  "9xl": "8rem"
1084
1286
  };
1085
- return (_a2 = map[v]) != null ? _a2 : v;
1287
+ return map[v] ?? v;
1086
1288
  }
1087
1289
  function fontWeight(v) {
1088
- var _a2;
1089
1290
  const map = {
1090
1291
  thin: "100",
1091
1292
  extralight: "200",
@@ -1097,10 +1298,9 @@ function fontWeight(v) {
1097
1298
  extrabold: "800",
1098
1299
  black: "900"
1099
1300
  };
1100
- return (_a2 = map[v]) != null ? _a2 : v;
1301
+ return map[v] ?? v;
1101
1302
  }
1102
1303
  function leadingValue(v) {
1103
- var _a2;
1104
1304
  const map = {
1105
1305
  none: "1",
1106
1306
  tight: "1.25",
@@ -1109,10 +1309,9 @@ function leadingValue(v) {
1109
1309
  relaxed: "1.625",
1110
1310
  loose: "2"
1111
1311
  };
1112
- return (_a2 = map[v]) != null ? _a2 : v;
1312
+ return map[v] ?? v;
1113
1313
  }
1114
1314
  function roundedValue(v) {
1115
- var _a2;
1116
1315
  const map = {
1117
1316
  "": "0.25rem",
1118
1317
  sm: "0.125rem",
@@ -1124,7 +1323,7 @@ function roundedValue(v) {
1124
1323
  full: "9999px",
1125
1324
  none: "0"
1126
1325
  };
1127
- return (_a2 = map[v]) != null ? _a2 : `${v}rem`;
1326
+ return map[v] ?? `${v}rem`;
1128
1327
  }
1129
1328
  function sanitizeClassName(cls) {
1130
1329
  return cls.replace(/[/:[\].!%]/g, "_");
@@ -1208,7 +1407,7 @@ function clearAtomicRegistry() {
1208
1407
  }
1209
1408
  var REGISTRY, TW_PROPERTY_MAP;
1210
1409
  var init_atomicCss = __esm({
1211
- "../compiler/src/atomicCss.ts"() {
1410
+ "packages/compiler/src/atomicCss.ts"() {
1212
1411
  REGISTRY = /* @__PURE__ */ new Map();
1213
1412
  TW_PROPERTY_MAP = {
1214
1413
  // Spacing
@@ -1242,14 +1441,109 @@ var init_atomicCss = __esm({
1242
1441
  }
1243
1442
  });
1244
1443
 
1245
- // ../preset/src/defaultPreset.ts
1444
+ // packages/preset/src/defaultPreset.ts
1246
1445
  var defaultPreset_exports = {};
1247
1446
  __export(defaultPreset_exports, {
1248
1447
  defaultGlobalCss: () => defaultGlobalCss,
1249
1448
  defaultPreset: () => defaultPreset,
1449
+ defaultThemeCss: () => defaultThemeCss,
1250
1450
  designTokens: () => designTokens,
1251
- generateTailwindConfig: () => generateTailwindConfig
1451
+ generateTailwindConfig: () => generateTailwindConfig,
1452
+ generateTailwindCss: () => generateTailwindCss
1252
1453
  });
1454
+ function generateTailwindCss(contentPaths = STANDARD_CONTENT_PATHS) {
1455
+ return `@import "tailwindcss";
1456
+
1457
+ @theme {
1458
+ /* colors */
1459
+ --color-primary: #3b82f6;
1460
+ --color-primary-hover: #2563eb;
1461
+ --color-primary-active: #1d4ed8;
1462
+ --color-primary-foreground: #ffffff;
1463
+ --color-secondary: #6366f1;
1464
+ --color-secondary-hover: #4f46e5;
1465
+ --color-secondary-active: #4338ca;
1466
+ --color-secondary-foreground: #ffffff;
1467
+ --color-accent: #f59e0b;
1468
+ --color-accent-hover: #d97706;
1469
+ --color-accent-active: #b45309;
1470
+ --color-accent-foreground: #000000;
1471
+ --color-success: #10b981;
1472
+ --color-success-foreground: #ffffff;
1473
+ --color-warning: #f59e0b;
1474
+ --color-warning-foreground: #000000;
1475
+ --color-danger: #ef4444;
1476
+ --color-danger-foreground: #ffffff;
1477
+ --color-info: #3b82f6;
1478
+ --color-info-foreground: #ffffff;
1479
+ --color-surface: #18181b;
1480
+ --color-border: #27272a;
1481
+ --color-muted: #71717a;
1482
+ --color-subtle: #3f3f46;
1483
+
1484
+ /* fonts */
1485
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1486
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1487
+
1488
+ /* spacing */
1489
+ --spacing-1: 0.25rem;
1490
+ --spacing-2: 0.5rem;
1491
+ --spacing-3: 0.75rem;
1492
+ --spacing-4: 1rem;
1493
+ --spacing-5: 1.25rem;
1494
+ --spacing-6: 1.5rem;
1495
+ --spacing-8: 2rem;
1496
+ --spacing-10: 2.5rem;
1497
+ --spacing-12: 3rem;
1498
+ --spacing-16: 4rem;
1499
+
1500
+ /* breakpoints */
1501
+ --breakpoint-sm: 40rem;
1502
+ --breakpoint-md: 48rem;
1503
+ --breakpoint-lg: 64rem;
1504
+ --breakpoint-xl: 80rem;
1505
+ --breakpoint-2xl: 96rem;
1506
+
1507
+ /* border radius */
1508
+ --radius-sm: 0.25rem;
1509
+ --radius-md: 0.5rem;
1510
+ --radius-lg: 0.75rem;
1511
+ --radius-xl: 1rem;
1512
+ --radius-2xl: 1.5rem;
1513
+ --radius-full: 9999px;
1514
+
1515
+ /* animations */
1516
+ --animate-fade-in: fadeIn 0.2s ease-out;
1517
+ --animate-fade-out: fadeOut 0.2s ease-in;
1518
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1519
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1520
+ --animate-scale-in: scaleIn 0.2s ease-out;
1521
+ }
1522
+
1523
+ @keyframes fadeIn {
1524
+ from { opacity: 0; }
1525
+ to { opacity: 1; }
1526
+ }
1527
+ @keyframes fadeOut {
1528
+ from { opacity: 1; }
1529
+ to { opacity: 0; }
1530
+ }
1531
+ @keyframes slideUp {
1532
+ from { transform: translateY(8px); opacity: 0; }
1533
+ to { transform: translateY(0); opacity: 1; }
1534
+ }
1535
+ @keyframes slideDown {
1536
+ from { transform: translateY(-8px); opacity: 0; }
1537
+ to { transform: translateY(0); opacity: 1; }
1538
+ }
1539
+ @keyframes scaleIn {
1540
+ from { transform: scale(0.95); opacity: 0; }
1541
+ to { transform: scale(1); opacity: 1; }
1542
+ }
1543
+
1544
+ @source ${contentPaths.join("\n@source ")}
1545
+ `;
1546
+ }
1253
1547
  function generateTailwindConfig(safelistPath = ".tailwind-styled-safelist.json", contentPaths = STANDARD_CONTENT_PATHS) {
1254
1548
  return `import type { Config } from "tailwindcss"
1255
1549
  import { defaultPreset } from "tailwind-styled-v4/preset"
@@ -1267,9 +1561,9 @@ export default {
1267
1561
  } satisfies Config
1268
1562
  `;
1269
1563
  }
1270
- var STANDARD_CONTENT_PATHS, designTokens, defaultPreset, defaultGlobalCss;
1564
+ var STANDARD_CONTENT_PATHS, designTokens, defaultPreset, defaultThemeCss, defaultGlobalCss;
1271
1565
  var init_defaultPreset = __esm({
1272
- "../preset/src/defaultPreset.ts"() {
1566
+ "packages/preset/src/defaultPreset.ts"() {
1273
1567
  STANDARD_CONTENT_PATHS = [
1274
1568
  // Next.js App Router
1275
1569
  "./src/**/*.{tsx,ts,jsx,js,mdx}",
@@ -1284,21 +1578,43 @@ var init_defaultPreset = __esm({
1284
1578
  ];
1285
1579
  designTokens = {
1286
1580
  colors: {
1287
- // Brand
1288
1581
  primary: { DEFAULT: "#3b82f6", hover: "#2563eb", active: "#1d4ed8", foreground: "#ffffff" },
1289
1582
  secondary: { DEFAULT: "#6366f1", hover: "#4f46e5", active: "#4338ca", foreground: "#ffffff" },
1290
1583
  accent: { DEFAULT: "#f59e0b", hover: "#d97706", active: "#b45309", foreground: "#000000" },
1291
- // Semantic
1292
1584
  success: { DEFAULT: "#10b981", foreground: "#ffffff" },
1293
1585
  warning: { DEFAULT: "#f59e0b", foreground: "#000000" },
1294
1586
  danger: { DEFAULT: "#ef4444", foreground: "#ffffff" },
1295
1587
  info: { DEFAULT: "#3b82f6", foreground: "#ffffff" },
1296
- // Neutral
1297
1588
  surface: "#18181b",
1298
1589
  border: "#27272a",
1299
1590
  muted: "#71717a",
1300
1591
  subtle: "#3f3f46"
1301
1592
  },
1593
+ spacing: {
1594
+ 1: "0.25rem",
1595
+ 2: "0.5rem",
1596
+ 3: "0.75rem",
1597
+ 4: "1rem",
1598
+ 5: "1.25rem",
1599
+ 6: "1.5rem",
1600
+ 8: "2rem",
1601
+ 10: "2.5rem",
1602
+ 12: "3rem",
1603
+ 16: "4rem"
1604
+ },
1605
+ breakpoints: {
1606
+ sm: "40rem",
1607
+ md: "48rem",
1608
+ lg: "64rem",
1609
+ xl: "80rem",
1610
+ "2xl": "96rem"
1611
+ },
1612
+ fontWeight: {
1613
+ normal: "400",
1614
+ medium: "500",
1615
+ semibold: "600",
1616
+ bold: "700"
1617
+ },
1302
1618
  fontFamily: {
1303
1619
  sans: ["InterVariable", "Inter", "system-ui", "sans-serif"],
1304
1620
  mono: ["JetBrains Mono", "Fira Code", "Consolas", "monospace"]
@@ -1350,8 +1666,183 @@ var init_defaultPreset = __esm({
1350
1666
  },
1351
1667
  plugins: []
1352
1668
  };
1669
+ defaultThemeCss = `@import "tailwindcss";
1670
+
1671
+ @theme {
1672
+ /* colors */
1673
+ --color-primary: #3b82f6;
1674
+ --color-primary-hover: #2563eb;
1675
+ --color-primary-active: #1d4ed8;
1676
+ --color-primary-foreground: #ffffff;
1677
+ --color-secondary: #6366f1;
1678
+ --color-secondary-hover: #4f46e5;
1679
+ --color-secondary-active: #4338ca;
1680
+ --color-secondary-foreground: #ffffff;
1681
+ --color-accent: #f59e0b;
1682
+ --color-accent-hover: #d97706;
1683
+ --color-accent-active: #b45309;
1684
+ --color-accent-foreground: #000000;
1685
+ --color-success: #10b981;
1686
+ --color-success-foreground: #ffffff;
1687
+ --color-warning: #f59e0b;
1688
+ --color-warning-foreground: #000000;
1689
+ --color-danger: #ef4444;
1690
+ --color-danger-foreground: #ffffff;
1691
+ --color-info: #3b82f6;
1692
+ --color-info-foreground: #ffffff;
1693
+ --color-surface: #18181b;
1694
+ --color-border: #27272a;
1695
+ --color-muted: #71717a;
1696
+ --color-subtle: #3f3f46;
1697
+
1698
+ /* fonts */
1699
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1700
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1701
+
1702
+ /* spacing */
1703
+ --spacing-1: 0.25rem;
1704
+ --spacing-2: 0.5rem;
1705
+ --spacing-3: 0.75rem;
1706
+ --spacing-4: 1rem;
1707
+ --spacing-5: 1.25rem;
1708
+ --spacing-6: 1.5rem;
1709
+ --spacing-8: 2rem;
1710
+ --spacing-10: 2.5rem;
1711
+ --spacing-12: 3rem;
1712
+ --spacing-16: 4rem;
1713
+
1714
+ /* breakpoints */
1715
+ --breakpoint-sm: 40rem;
1716
+ --breakpoint-md: 48rem;
1717
+ --breakpoint-lg: 64rem;
1718
+ --breakpoint-xl: 80rem;
1719
+ --breakpoint-2xl: 96rem;
1720
+
1721
+ /* border radius */
1722
+ --radius-sm: 0.25rem;
1723
+ --radius-md: 0.5rem;
1724
+ --radius-lg: 0.75rem;
1725
+ --radius-xl: 1rem;
1726
+ --radius-2xl: 1.5rem;
1727
+ --radius-full: 9999px;
1728
+
1729
+ /* animations */
1730
+ --animate-fade-in: fadeIn 0.2s ease-out;
1731
+ --animate-fade-out: fadeOut 0.2s ease-in;
1732
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1733
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1734
+ --animate-scale-in: scaleIn 0.2s ease-out;
1735
+ }
1736
+
1737
+ @keyframes fadeIn {
1738
+ from { opacity: 0; }
1739
+ to { opacity: 1; }
1740
+ }
1741
+ @keyframes fadeOut {
1742
+ from { opacity: 1; }
1743
+ to { opacity: 0; }
1744
+ }
1745
+ @keyframes slideUp {
1746
+ from { transform: translateY(8px); opacity: 0; }
1747
+ to { transform: translateY(0); opacity: 1; }
1748
+ }
1749
+ @keyframes slideDown {
1750
+ from { transform: translateY(-8px); opacity: 0; }
1751
+ to { transform: translateY(0); opacity: 1; }
1752
+ }
1753
+ @keyframes scaleIn {
1754
+ from { transform: scale(0.95); opacity: 0; }
1755
+ to { transform: scale(1); opacity: 1; }
1756
+ }`;
1353
1757
  defaultGlobalCss = `@import "tailwindcss";
1354
1758
 
1759
+ @theme {
1760
+ /* colors */
1761
+ --color-primary: #3b82f6;
1762
+ --color-primary-hover: #2563eb;
1763
+ --color-primary-active: #1d4ed8;
1764
+ --color-primary-foreground: #ffffff;
1765
+ --color-secondary: #6366f1;
1766
+ --color-secondary-hover: #4f46e5;
1767
+ --color-secondary-active: #4338ca;
1768
+ --color-secondary-foreground: #ffffff;
1769
+ --color-accent: #f59e0b;
1770
+ --color-accent-hover: #d97706;
1771
+ --color-accent-active: #b45309;
1772
+ --color-accent-foreground: #000000;
1773
+ --color-success: #10b981;
1774
+ --color-success-foreground: #ffffff;
1775
+ --color-warning: #f59e0b;
1776
+ --color-warning-foreground: #000000;
1777
+ --color-danger: #ef4444;
1778
+ --color-danger-foreground: #ffffff;
1779
+ --color-info: #3b82f6;
1780
+ --color-info-foreground: #ffffff;
1781
+ --color-surface: #18181b;
1782
+ --color-border: #27272a;
1783
+ --color-muted: #71717a;
1784
+ --color-subtle: #3f3f46;
1785
+
1786
+ /* fonts */
1787
+ --font-sans: InterVariable, Inter, system-ui, sans-serif;
1788
+ --font-mono: JetBrains Mono, Fira Code, Consolas, monospace;
1789
+
1790
+ /* spacing */
1791
+ --spacing-1: 0.25rem;
1792
+ --spacing-2: 0.5rem;
1793
+ --spacing-3: 0.75rem;
1794
+ --spacing-4: 1rem;
1795
+ --spacing-5: 1.25rem;
1796
+ --spacing-6: 1.5rem;
1797
+ --spacing-8: 2rem;
1798
+ --spacing-10: 2.5rem;
1799
+ --spacing-12: 3rem;
1800
+ --spacing-16: 4rem;
1801
+
1802
+ /* breakpoints */
1803
+ --breakpoint-sm: 40rem;
1804
+ --breakpoint-md: 48rem;
1805
+ --breakpoint-lg: 64rem;
1806
+ --breakpoint-xl: 80rem;
1807
+ --breakpoint-2xl: 96rem;
1808
+
1809
+ /* border radius */
1810
+ --radius-sm: 0.25rem;
1811
+ --radius-md: 0.5rem;
1812
+ --radius-lg: 0.75rem;
1813
+ --radius-xl: 1rem;
1814
+ --radius-2xl: 1.5rem;
1815
+ --radius-full: 9999px;
1816
+
1817
+ /* animations */
1818
+ --animate-fade-in: fadeIn 0.2s ease-out;
1819
+ --animate-fade-out: fadeOut 0.2s ease-in;
1820
+ --animate-slide-up: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1821
+ --animate-slide-down: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1822
+ --animate-scale-in: scaleIn 0.2s ease-out;
1823
+ }
1824
+
1825
+ @keyframes fadeIn {
1826
+ from { opacity: 0; }
1827
+ to { opacity: 1; }
1828
+ }
1829
+ @keyframes fadeOut {
1830
+ from { opacity: 1; }
1831
+ to { opacity: 0; }
1832
+ }
1833
+ @keyframes slideUp {
1834
+ from { transform: translateY(8px); opacity: 0; }
1835
+ to { transform: translateY(0); opacity: 1; }
1836
+ }
1837
+ @keyframes slideDown {
1838
+ from { transform: translateY(-8px); opacity: 0; }
1839
+ to { transform: translateY(0); opacity: 1; }
1840
+ }
1841
+ @keyframes scaleIn {
1842
+ from { transform: scale(0.95); opacity: 0; }
1843
+ to { transform: scale(1); opacity: 1; }
1844
+ }
1845
+
1355
1846
  /* tailwind-styled-v4 \u2014 zero-config base styles */
1356
1847
  *, *::before, *::after {
1357
1848
  box-sizing: border-box;
@@ -1366,20 +1857,29 @@ html {
1366
1857
  body {
1367
1858
  margin: 0;
1368
1859
  font-family: var(--font-sans, system-ui, sans-serif);
1369
- background: var(--color-background, #09090b);
1860
+ background: var(--color-surface, #18181b);
1370
1861
  color: var(--color-foreground, #fafafa);
1371
1862
  }
1372
1863
  `;
1373
1864
  }
1374
1865
  });
1866
+
1867
+ // packages/plugin/src/index.ts
1868
+ var globalRegistry = {
1869
+ transforms: [],
1870
+ tokens: {}
1871
+ };
1872
+ function getGlobalRegistry() {
1873
+ return globalRegistry;
1874
+ }
1375
1875
  function mergeClassesStatic(classes) {
1376
- return twMerge(classes);
1876
+ return tailwindMerge.twMerge(classes);
1377
1877
  }
1378
1878
  function normalizeClasses(raw) {
1379
1879
  return raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
1380
1880
  }
1381
1881
 
1382
- // ../compiler/src/componentHoister.ts
1882
+ // packages/compiler/src/componentHoister.ts
1383
1883
  var INDENTED_TW_DECL_RE = /^([ \t]+)(const|let)\s+([A-Z]\w*)\s*=\s*tw\.[\w]+[`(]/gm;
1384
1884
  function hoistComponents(source) {
1385
1885
  const hoisted = [];
@@ -1466,7 +1966,7 @@ function findAfterImports(source) {
1466
1966
  return lines.slice(0, lastImportLine + 1).join("\n").length + 1;
1467
1967
  }
1468
1968
 
1469
- // ../compiler/src/rscAnalyzer.ts
1969
+ // packages/compiler/src/rscAnalyzer.ts
1470
1970
  var CSS_INTERACTIVE_OK = [
1471
1971
  /^hover:/,
1472
1972
  // CSS :hover — no JS needed
@@ -1578,10 +2078,9 @@ function analyzeVariantUsage(source, componentName, variantKeys) {
1578
2078
  return { resolved, dynamic };
1579
2079
  }
1580
2080
  function resolveServerVariant(base, table, defaults, resolved) {
1581
- var _a2;
1582
2081
  const parts = [base];
1583
2082
  for (const key in table) {
1584
- const val = (_a2 = resolved[key]) != null ? _a2 : defaults[key];
2083
+ const val = resolved[key] ?? defaults[key];
1585
2084
  if (val && table[key][val]) {
1586
2085
  parts.push(table[key][val]);
1587
2086
  }
@@ -1607,16 +2106,24 @@ function injectServerOnlyComment(code) {
1607
2106
  ${code}`;
1608
2107
  }
1609
2108
 
1610
- // ../compiler/src/twDetector.ts
1611
- var TEMPLATE_RE = /\btw\.(server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
1612
- var OBJECT_RE = /\btw\.(server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
1613
- var EXTEND_RE = /(\w+)\.extend`((?:[^`\\]|\\.)*)`/g;
2109
+ // packages/compiler/src/twDetector.ts
2110
+ init_nativeBridge();
1614
2111
  var IMPORT_RE = /from\s*["']tailwind-styled-v4["']/;
1615
2112
  var TRANSFORM_MARKER = "/* @tw-transformed */";
1616
2113
  function hasTwUsage(source) {
2114
+ const native = getNativeBridge();
2115
+ if (native?.hasTwUsageNative) {
2116
+ const result = native.hasTwUsageNative(source);
2117
+ if (result !== null && result !== void 0) return result;
2118
+ }
1617
2119
  return IMPORT_RE.test(source) || source.includes("tw.");
1618
2120
  }
1619
2121
  function isAlreadyTransformed(source) {
2122
+ const native = getNativeBridge();
2123
+ if (native?.isAlreadyTransformedNative) {
2124
+ const result = native.isAlreadyTransformedNative(source);
2125
+ if (result !== null && result !== void 0) return result;
2126
+ }
1620
2127
  return source.includes(TRANSFORM_MARKER);
1621
2128
  }
1622
2129
  function isDynamic(content) {
@@ -1631,7 +2138,7 @@ function hasInteractiveFeatures(content) {
1631
2138
  );
1632
2139
  }
1633
2140
 
1634
- // ../compiler/src/astParser.ts
2141
+ // packages/compiler/src/astParser.ts
1635
2142
  function oxcKey(node) {
1636
2143
  if (!node) return null;
1637
2144
  if (node.type === "Identifier") return node.name;
@@ -1639,22 +2146,17 @@ function oxcKey(node) {
1639
2146
  return null;
1640
2147
  }
1641
2148
  function oxcStringVal(node) {
1642
- var _a2;
1643
2149
  if (!node) return null;
1644
2150
  if (node.type === "Literal" && typeof node.value === "string") return node.value;
1645
- if (node.type === "TemplateLiteral" && ((_a2 = node.expressions) == null ? void 0 : _a2.length) === 0) {
1646
- return node.quasis.map((q) => {
1647
- var _a3, _b2, _c, _d;
1648
- return (_d = (_c = (_a3 = q.value) == null ? void 0 : _a3.cooked) != null ? _c : (_b2 = q.value) == null ? void 0 : _b2.raw) != null ? _d : "";
1649
- }).join("");
2151
+ if (node.type === "TemplateLiteral" && node.expressions?.length === 0) {
2152
+ return node.quasis.map((q) => q.value?.cooked ?? q.value?.raw ?? "").join("");
1650
2153
  }
1651
2154
  return null;
1652
2155
  }
1653
2156
  function oxcWalkObject(node) {
1654
- var _a2;
1655
2157
  const result = {};
1656
- if ((node == null ? void 0 : node.type) !== "ObjectExpression") return result;
1657
- for (const prop of (_a2 = node.properties) != null ? _a2 : []) {
2158
+ if (node?.type !== "ObjectExpression") return result;
2159
+ for (const prop of node.properties ?? []) {
1658
2160
  if (prop.type !== "Property") continue;
1659
2161
  const key = oxcKey(prop.key);
1660
2162
  if (!key) continue;
@@ -1662,30 +2164,29 @@ function oxcWalkObject(node) {
1662
2164
  const strVal = oxcStringVal(val);
1663
2165
  if (strVal !== null) {
1664
2166
  result[key] = strVal;
1665
- } else if ((val == null ? void 0 : val.type) === "ObjectExpression") {
2167
+ } else if (val?.type === "ObjectExpression") {
1666
2168
  result[key] = oxcWalkObject(val);
1667
- } else if ((val == null ? void 0 : val.type) === "ArrayExpression") {
1668
- result[key] = val.elements.filter((el) => (el == null ? void 0 : el.type) === "ObjectExpression").map((el) => oxcWalkObject(el));
2169
+ } else if (val?.type === "ArrayExpression") {
2170
+ result[key] = val.elements.filter((el) => el?.type === "ObjectExpression").map((el) => oxcWalkObject(el));
1669
2171
  }
1670
2172
  }
1671
2173
  return result;
1672
2174
  }
1673
2175
  function parseWithOxc(objectStr) {
1674
- var _a2, _b2, _c;
1675
2176
  let parseSync3;
1676
2177
  try {
1677
2178
  parseSync3 = (init_src_js(), __toCommonJS(src_js_exports)).parseSync;
1678
- } catch (e) {
2179
+ } catch {
1679
2180
  return null;
1680
2181
  }
1681
2182
  try {
1682
2183
  const source = `const __c = ${objectStr}`;
1683
2184
  const { program, errors } = parseSync3("config.ts", source, { sourceType: "script" });
1684
- if ((errors == null ? void 0 : errors.length) > 0 || !((_a2 = program == null ? void 0 : program.body) == null ? void 0 : _a2[0])) return null;
2185
+ if (errors?.length > 0 || !program?.body?.[0]) return null;
1685
2186
  const varDecl = program.body[0];
1686
2187
  if (varDecl.type !== "VariableDeclaration") return null;
1687
- const init = (_c = (_b2 = varDecl.declarations) == null ? void 0 : _b2[0]) == null ? void 0 : _c.init;
1688
- if ((init == null ? void 0 : init.type) !== "ObjectExpression") return null;
2188
+ const init = varDecl.declarations?.[0]?.init;
2189
+ if (init?.type !== "ObjectExpression") return null;
1689
2190
  const raw = oxcWalkObject(init);
1690
2191
  const base = typeof raw.base === "string" ? raw.base.trim() : "";
1691
2192
  const variants = {};
@@ -1717,7 +2218,7 @@ function parseWithOxc(objectStr) {
1717
2218
  }
1718
2219
  }
1719
2220
  return { base, variants, compounds, defaults };
1720
- } catch (e) {
2221
+ } catch {
1721
2222
  return null;
1722
2223
  }
1723
2224
  }
@@ -1799,41 +2300,40 @@ function tokenize(src) {
1799
2300
  return tokens;
1800
2301
  }
1801
2302
  function parseObject(tokens, startIdx) {
1802
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
1803
2303
  const obj = {};
1804
2304
  let i = startIdx;
1805
- if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbrace") return { obj, endIdx: i };
2305
+ if (tokens[i]?.type !== "lbrace") return { obj, endIdx: i };
1806
2306
  i++;
1807
- while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbrace") {
1808
- if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2307
+ while (i < tokens.length && tokens[i]?.type !== "rbrace") {
2308
+ if (tokens[i]?.type === "comma") {
1809
2309
  i++;
1810
2310
  continue;
1811
2311
  }
1812
2312
  let key = null;
1813
- if (((_d = tokens[i]) == null ? void 0 : _d.type) === "string") {
2313
+ if (tokens[i]?.type === "string") {
1814
2314
  key = tokens[i].value;
1815
2315
  i++;
1816
- } else if (((_e = tokens[i]) == null ? void 0 : _e.type) === "key") {
2316
+ } else if (tokens[i]?.type === "key") {
1817
2317
  key = tokens[i].value;
1818
2318
  i++;
1819
2319
  } else {
1820
2320
  i++;
1821
2321
  continue;
1822
2322
  }
1823
- if (((_f = tokens[i]) == null ? void 0 : _f.type) !== "colon") continue;
2323
+ if (tokens[i]?.type !== "colon") continue;
1824
2324
  i++;
1825
- if (((_g = tokens[i]) == null ? void 0 : _g.type) === "lbrace") {
2325
+ if (tokens[i]?.type === "lbrace") {
1826
2326
  const { obj: nested, endIdx } = parseObject(tokens, i);
1827
2327
  obj[key] = nested;
1828
2328
  i = endIdx + 1;
1829
- } else if (((_h = tokens[i]) == null ? void 0 : _h.type) === "lbracket") {
2329
+ } else if (tokens[i]?.type === "lbracket") {
1830
2330
  const { arr, endIdx } = parseArray(tokens, i);
1831
2331
  obj[key] = arr;
1832
2332
  i = endIdx + 1;
1833
- } else if (((_i = tokens[i]) == null ? void 0 : _i.type) === "string") {
2333
+ } else if (tokens[i]?.type === "string") {
1834
2334
  obj[key] = tokens[i].value;
1835
2335
  i++;
1836
- } else if (((_j = tokens[i]) == null ? void 0 : _j.type) === "key") {
2336
+ } else if (tokens[i]?.type === "key") {
1837
2337
  obj[key] = tokens[i].value;
1838
2338
  i++;
1839
2339
  } else {
@@ -1843,17 +2343,16 @@ function parseObject(tokens, startIdx) {
1843
2343
  return { obj, endIdx: i };
1844
2344
  }
1845
2345
  function parseArray(tokens, startIdx) {
1846
- var _a2, _b2, _c, _d;
1847
2346
  const arr = [];
1848
2347
  let i = startIdx;
1849
- if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbracket") return { arr, endIdx: i };
2348
+ if (tokens[i]?.type !== "lbracket") return { arr, endIdx: i };
1850
2349
  i++;
1851
- while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbracket") {
1852
- if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2350
+ while (i < tokens.length && tokens[i]?.type !== "rbracket") {
2351
+ if (tokens[i]?.type === "comma") {
1853
2352
  i++;
1854
2353
  continue;
1855
2354
  }
1856
- if (((_d = tokens[i]) == null ? void 0 : _d.type) === "lbrace") {
2355
+ if (tokens[i]?.type === "lbrace") {
1857
2356
  const { obj, endIdx } = parseObject(tokens, i);
1858
2357
  arr.push(obj);
1859
2358
  i = endIdx + 1;
@@ -1901,7 +2400,7 @@ function parseComponentConfig(objectStr) {
1901
2400
  return parseComponentConfigFallback(objectStr);
1902
2401
  }
1903
2402
 
1904
- // ../compiler/src/variantCompiler.ts
2403
+ // packages/compiler/src/variantCompiler.ts
1905
2404
  function compileVariants(base, variants, compounds = [], defaults = {}) {
1906
2405
  const table = {};
1907
2406
  for (const key in variants) {
@@ -1925,7 +2424,7 @@ function parseObjectConfig(objectStr) {
1925
2424
  return parseComponentConfig(objectStr);
1926
2425
  }
1927
2426
 
1928
- // ../compiler/src/astTransform.ts
2427
+ // packages/compiler/src/astTransform.ts
1929
2428
  var TEMPLATE_RE2 = /\btw\.(server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
1930
2429
  var OBJECT_RE2 = /\btw\.(server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
1931
2430
  var EXTEND_RE2 = /(\w+)\.extend`((?:[^`\\]|\\.)*)`/g;
@@ -1952,10 +2451,7 @@ function renderVariantComponent(tag, id, base, variantKeys, defaults, opts) {
1952
2451
  const vKeys = variantKeys.map((k) => `"${k}"`).join(", ");
1953
2452
  const destructure = variantKeys.length > 0 ? `var _vp = {}; [${vKeys}].forEach(function(k){ _vp[k] = props[k]; delete _rest[k]; });` : "";
1954
2453
  const variantLookup = variantKeys.length > 0 ? variantKeys.map(
1955
- (k) => {
1956
- var _a2;
1957
- return `(__vt_${id}["${k}"] && __vt_${id}["${k}"][_vp["${k}"] ?? ${JSON.stringify((_a2 = defaults[k]) != null ? _a2 : "")}] || "")`;
1958
- }
2454
+ (k) => `(__vt_${id}["${k}"] && __vt_${id}["${k}"][_vp["${k}"] ?? ${JSON.stringify(defaults[k] ?? "")}] || "")`
1959
2455
  ).join(", ") : "";
1960
2456
  const classParts = variantKeys.length > 0 ? `[${JSON.stringify(base)}, ${variantLookup}, _rest.className]` : `[${JSON.stringify(base)}, _rest.className]`;
1961
2457
  return `React.forwardRef(function ${fnName}(props, ref) {
@@ -1965,13 +2461,81 @@ function renderVariantComponent(tag, id, base, variantKeys, defaults, opts) {
1965
2461
  return React.createElement("${tag}", Object.assign({ ref }, _rest${dataAttr}, { className: ${classParts}.filter(Boolean).join(" ") }));
1966
2462
  })`;
1967
2463
  }
2464
+ var SUB_BLOCK_RE = /\b([a-z][a-zA-Z0-9_]*)\s*\{([^}]*)\}/g;
2465
+ function shortHash(input) {
2466
+ let h = 5381;
2467
+ for (let i = 0; i < input.length; i++) {
2468
+ h = Math.imul(h, 33) + input.charCodeAt(i) >>> 0;
2469
+ }
2470
+ return (h & 16777215).toString(16).padStart(6, "0");
2471
+ }
2472
+ function parseSubcomponentBlocks(template, componentName) {
2473
+ const subComponents = [];
2474
+ let stripped = template;
2475
+ SUB_BLOCK_RE.lastIndex = 0;
2476
+ let match;
2477
+ while ((match = SUB_BLOCK_RE.exec(template)) !== null) {
2478
+ const [fullMatch, subName, subClassesRaw] = match;
2479
+ const subClasses = subClassesRaw.trim();
2480
+ if (!subClasses) continue;
2481
+ const subTag = (() => {
2482
+ switch (subName) {
2483
+ case "label":
2484
+ return "label";
2485
+ case "input":
2486
+ return "input";
2487
+ case "img":
2488
+ case "image":
2489
+ return "img";
2490
+ case "header":
2491
+ return "header";
2492
+ case "footer":
2493
+ return "footer";
2494
+ default:
2495
+ return "span";
2496
+ }
2497
+ })();
2498
+ const hash = shortHash(`${componentName}_${subName}_${subClasses}`);
2499
+ const scopedClass = `${componentName}_${subName}_${hash}`;
2500
+ subComponents.push({ name: subName, tag: subTag, classes: subClasses, scopedClass });
2501
+ stripped = stripped.replace(fullMatch, "");
2502
+ }
2503
+ return { baseContent: stripped.trim(), subComponents };
2504
+ }
2505
+ function renderCompoundComponent(tag, baseClasses, componentName, subComponents, opts) {
2506
+ const fnName = `_Tw_${componentName}`;
2507
+ const dataAttr = opts.addDataAttr ? `, "data-tw": "${fnName}"` : "";
2508
+ const baseBody = `React.forwardRef(function ${fnName}(props, ref) {
2509
+ var _c = props.className;
2510
+ var _r = Object.assign({}, props);
2511
+ delete _r.className;
2512
+ return React.createElement("${tag}", Object.assign({ ref }, _r${dataAttr}, { className: [${JSON.stringify(baseClasses)}, _c].filter(Boolean).join(" ") }));
2513
+ })`;
2514
+ if (subComponents.length === 0) return baseBody;
2515
+ const subAssignments = subComponents.map((sub) => {
2516
+ const subFn = `_Tw_${componentName}_${sub.name}`;
2517
+ return ` _base.${sub.name} = React.forwardRef(function ${subFn}(props, ref) {
2518
+ var _c = props.className;
2519
+ var _r = Object.assign({}, props);
2520
+ delete _r.className;
2521
+ return React.createElement("${sub.tag}", Object.assign({ ref }, _r, { className: [${JSON.stringify(sub.scopedClass)}, _c].filter(Boolean).join(" ") }));
2522
+ });`;
2523
+ }).join("\n");
2524
+ return `(function() {
2525
+ var _base = ${baseBody};
2526
+ ${subAssignments}
2527
+ return _base;
2528
+ })()`;
2529
+ }
1968
2530
  function transformSource(source, opts = {}) {
1969
2531
  const {
1970
2532
  mode = "zero-runtime",
2533
+ // v5: always zero-runtime, parameter kept for backward compat
1971
2534
  autoClientBoundary = true,
1972
2535
  addDataAttr = false,
1973
2536
  hoist = true,
1974
- filename = ""
2537
+ filename = "",
2538
+ preserveImports = false
1975
2539
  } = opts;
1976
2540
  if (!hasTwUsage(source)) {
1977
2541
  return { code: source, classes: [], changed: false };
@@ -1979,8 +2543,10 @@ function transformSource(source, opts = {}) {
1979
2543
  if (isAlreadyTransformed(source)) {
1980
2544
  return { code: source, classes: [], changed: false };
1981
2545
  }
1982
- if (mode === "runtime" || mode === "extract-only") {
1983
- return { code: source, classes: [], changed: false };
2546
+ if (mode && mode !== "zero-runtime") {
2547
+ console.warn(
2548
+ "[tailwind-styled] Warning: mode option is deprecated in v5. Only zero-runtime is supported."
2549
+ );
1984
2550
  }
1985
2551
  const rscAnalysis = analyzeFile(source, filename);
1986
2552
  let code = source;
@@ -1999,31 +2565,92 @@ function transformSource(source, opts = {}) {
1999
2565
  const allClasses = [];
2000
2566
  const prelude = [];
2001
2567
  let needsReact = false;
2002
- code = code.replace(
2003
- TEMPLATE_RE2,
2004
- (match, serverMark, tag, content) => {
2005
- if (isDynamic(content)) return match;
2006
- const classes = normalizeClasses(content);
2007
- if (!classes) return match;
2568
+ {
2569
+ const snap = code;
2570
+ const replacements = [];
2571
+ const ASSIGN_RE = /(?:const|let|var)\s+(\w+)\s*=\s*tw\.(?:server\.)?(\w+)`/g;
2572
+ const assignMap = /* @__PURE__ */ new Map();
2573
+ let am;
2574
+ while ((am = ASSIGN_RE.exec(snap)) !== null) {
2575
+ const twPos = am.index + am[0].indexOf("tw.");
2576
+ assignMap.set(twPos, am[1]);
2577
+ }
2578
+ TEMPLATE_RE2.lastIndex = 0;
2579
+ let m;
2580
+ while ((m = TEMPLATE_RE2.exec(snap)) !== null) {
2581
+ const [fullMatch, serverMark, tag, content] = m;
2582
+ if (isDynamic(content)) continue;
2008
2583
  const isServerOnly = !!serverMark;
2009
- allClasses.push(...classes.split(/\s+/).filter(Boolean));
2584
+ const compName = assignMap.get(m.index) ?? null;
2585
+ const { baseContent, subComponents } = compName ? parseSubcomponentBlocks(content, compName) : { baseContent: content, subComponents: [] };
2586
+ const classes = normalizeClasses(baseContent);
2587
+ if (!classes && subComponents.length === 0) continue;
2588
+ allClasses.push(...(classes ?? "").split(/\s+/).filter(Boolean));
2589
+ for (const sub of subComponents) {
2590
+ allClasses.push(...sub.classes.split(/\s+/).filter(Boolean));
2591
+ }
2010
2592
  changed = true;
2011
2593
  needsReact = true;
2012
- const rendered = renderStaticComponent(tag, classes, {
2013
- addDataAttr,
2014
- isServer: rscAnalysis.isServer || isServerOnly
2594
+ let rendered;
2595
+ if (subComponents.length > 0 && compName) {
2596
+ rendered = renderCompoundComponent(tag, classes ?? "", compName, subComponents, {
2597
+ addDataAttr
2598
+ });
2599
+ } else {
2600
+ rendered = renderStaticComponent(tag, classes ?? "", {
2601
+ addDataAttr,
2602
+ isServer: rscAnalysis.isServer || isServerOnly,
2603
+ compName: compName ?? void 0
2604
+ });
2605
+ }
2606
+ replacements.push({
2607
+ match: fullMatch,
2608
+ replacement: isServerOnly ? `/* @server-only */ ${rendered}` : rendered
2015
2609
  });
2016
- return isServerOnly ? `/* @server-only */ ${rendered}` : rendered;
2017
2610
  }
2018
- );
2611
+ for (const { match, replacement } of replacements) {
2612
+ code = code.replace(match, replacement);
2613
+ }
2614
+ }
2019
2615
  code = code.replace(
2020
2616
  OBJECT_RE2,
2021
2617
  (match, serverMark, tag, objectStr) => {
2022
2618
  const { base, variants, compounds, defaults } = parseObjectConfig(objectStr);
2023
- if (!base && Object.keys(variants).length === 0) return match;
2619
+ let config = {
2620
+ base,
2621
+ variants,
2622
+ compoundVariants: compounds,
2623
+ defaultVariants: defaults
2624
+ };
2625
+ const registry = getGlobalRegistry();
2626
+ if (registry.transforms.length > 0) {
2627
+ const componentName = `Tw${tag}`;
2628
+ for (const transform of registry.transforms) {
2629
+ try {
2630
+ const transformed = transform(config, { componentName, tag });
2631
+ if (transformed && typeof transformed === "object") {
2632
+ config = {
2633
+ base: typeof transformed.base === "string" ? transformed.base : config.base,
2634
+ variants: isVariantRecord(transformed.variants) ? transformed.variants : config.variants,
2635
+ compoundVariants: isCompoundVariantsArray(transformed.compoundVariants) ? transformed.compoundVariants : config.compoundVariants,
2636
+ defaultVariants: isStringRecord(transformed.defaultVariants) ? transformed.defaultVariants : config.defaultVariants
2637
+ };
2638
+ }
2639
+ } catch (error) {
2640
+ if (process.env.NODE_ENV !== "production") {
2641
+ console.warn("[tailwind-styled] plugin transform error:", error);
2642
+ }
2643
+ }
2644
+ }
2645
+ }
2646
+ const nextBase = normalizeClasses(config.base) ?? "";
2647
+ const nextVariants = config.variants;
2648
+ const nextCompounds = config.compoundVariants;
2649
+ const nextDefaults = config.defaultVariants;
2650
+ if (!nextBase && Object.keys(nextVariants).length === 0) return match;
2024
2651
  const isServerOnly = !!serverMark;
2025
- allClasses.push(...base.split(/\s+/).filter(Boolean));
2026
- for (const vMap of Object.values(variants)) {
2652
+ allClasses.push(...nextBase.split(/\s+/).filter(Boolean));
2653
+ for (const vMap of Object.values(nextVariants)) {
2027
2654
  for (const cls of Object.values(vMap)) {
2028
2655
  allClasses.push(...cls.split(/\s+/).filter(Boolean));
2029
2656
  }
@@ -2031,10 +2658,10 @@ function transformSource(source, opts = {}) {
2031
2658
  changed = true;
2032
2659
  needsReact = true;
2033
2660
  const id = genId();
2034
- const compiled = compileVariants(base, variants, compounds, defaults);
2661
+ const compiled = compileVariants(nextBase, nextVariants, nextCompounds, nextDefaults);
2035
2662
  prelude.push(generateVariantCode(id, compiled));
2036
- const variantKeys = Object.keys(variants);
2037
- const rendered = renderVariantComponent(tag, id, base, variantKeys, defaults, {
2663
+ const variantKeys = Object.keys(nextVariants);
2664
+ const rendered = renderVariantComponent(tag, id, nextBase, variantKeys, nextDefaults, {
2038
2665
  addDataAttr,
2039
2666
  isServer: rscAnalysis.isServer || isServerOnly
2040
2667
  });
@@ -2081,12 +2708,14 @@ ${code}`;
2081
2708
  if (autoClientBoundary && rscAnalysis.needsClientDirective) {
2082
2709
  code = injectClientDirective(code);
2083
2710
  }
2084
- const stillUsesTw = /\btw\.(server\.)?\w+[`(]/.test(code) || /\btw\(\w+\)/.test(code);
2085
- if (!stillUsesTw) {
2086
- code = code.replace(
2087
- /import\s*\{[^}]*\btw\b[^}]*\}\s*from\s*["']tailwind-styled-v4["'];?\n?/g,
2088
- ""
2089
- );
2711
+ if (!preserveImports) {
2712
+ const stillUsesTw = /\btw\.(server\.)?\w+[`(]/.test(code) || /\btw\(\w+\)/.test(code);
2713
+ if (!stillUsesTw) {
2714
+ code = code.replace(
2715
+ /import\s*\{[^}]*\btw\b[^}]*\}\s*from\s*["']tailwind-styled-v4["'];?\n?/g,
2716
+ ""
2717
+ );
2718
+ }
2090
2719
  }
2091
2720
  code = `${TRANSFORM_MARKER}
2092
2721
  ${code}`;
@@ -2101,6 +2730,18 @@ ${code}`;
2101
2730
  changed: true
2102
2731
  };
2103
2732
  }
2733
+ function isObjectRecord(value) {
2734
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2735
+ }
2736
+ function isStringRecord(value) {
2737
+ return isObjectRecord(value) && Object.values(value).every((entry) => typeof entry === "string");
2738
+ }
2739
+ function isVariantRecord(value) {
2740
+ return isObjectRecord(value) && Object.values(value).every((entry) => isStringRecord(entry));
2741
+ }
2742
+ function isCompoundVariantsArray(value) {
2743
+ return Array.isArray(value) && value.every((entry) => isObjectRecord(entry) && typeof entry.class === "string");
2744
+ }
2104
2745
  function hasReactImport(source) {
2105
2746
  return source.includes("import React") || source.includes("from 'react'") || source.includes('from "react"');
2106
2747
  }
@@ -2118,40 +2759,24 @@ function findAfterImports2(source) {
2118
2759
  return lines.slice(0, lastImportIdx + 1).join("\n").length + 1;
2119
2760
  }
2120
2761
 
2121
- // ../compiler/src/index.ts
2122
- init_atomicCss();
2123
-
2124
- // ../compiler/src/classExtractor.ts
2125
- var VALID_CLASS_RE = /^[-a-z0-9:/[\]!.()+%]+$/;
2126
- function parseClasses(raw) {
2127
- return raw.split(/[\n\s]+/).map((c) => c.trim()).filter((c) => c.length > 0 && VALID_CLASS_RE.test(c));
2128
- }
2762
+ // packages/compiler/src/index.ts
2763
+ init_cssCompiler();
2129
2764
  function extractAllClasses(source) {
2130
- const classes = /* @__PURE__ */ new Set();
2131
- const add = (str) => {
2132
- for (const c of parseClasses(str)) classes.add(c);
2133
- };
2134
- let m;
2135
- const re1 = new RegExp(TEMPLATE_RE.source, "g");
2136
- while ((m = re1.exec(source)) !== null) {
2137
- add(m[3]);
2765
+ const { getNativeBridge: getNativeBridge2 } = (init_nativeBridge(), __toCommonJS(nativeBridge_exports));
2766
+ const native = getNativeBridge2();
2767
+ if (!native?.extractClassesFromSourceNative) {
2768
+ throw new Error(
2769
+ `[tailwind-styled/compiler v5] extractClassesFromSourceNative is required but not available.
2770
+ Please ensure the native module is properly built.`
2771
+ );
2138
2772
  }
2139
- const re2 = new RegExp(OBJECT_RE.source, "g");
2140
- while ((m = re2.exec(source)) !== null) {
2141
- const parsed = parseComponentConfig(m[3]);
2142
- if (parsed.base) add(parsed.base);
2143
- for (const vMap of Object.values(parsed.variants)) {
2144
- for (const cls of Object.values(vMap)) add(cls);
2145
- }
2146
- for (const compound of parsed.compounds) {
2147
- if (compound.class) add(compound.class);
2148
- }
2773
+ const result = native.extractClassesFromSourceNative(source);
2774
+ if (!result || result.length < 0) {
2775
+ throw new Error(
2776
+ `[tailwind-styled/compiler v5] extractClassesFromSourceNative returned invalid result.`
2777
+ );
2149
2778
  }
2150
- const re3 = new RegExp(EXTEND_RE.source, "g");
2151
- while ((m = re3.exec(source)) !== null) add(m[2]);
2152
- const classNameRe = /className\s*=\s*["']([^"']+)["']/g;
2153
- while ((m = classNameRe.exec(source)) !== null) add(m[1]);
2154
- return Array.from(classes).sort();
2779
+ return result.sort();
2155
2780
  }
2156
2781
  function extractComponentUsage(source) {
2157
2782
  const usage = {};
@@ -2179,11 +2804,11 @@ var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".next", "dist", ".git"
2179
2804
  function scanFiles(dir) {
2180
2805
  const files = [];
2181
2806
  function walk(current) {
2182
- if (!fs2.existsSync(current)) return;
2183
- const entries = fs2.readdirSync(current, { withFileTypes: true });
2807
+ if (!fs3__default.default.existsSync(current)) return;
2808
+ const entries = fs3__default.default.readdirSync(current, { withFileTypes: true });
2184
2809
  for (const entry of entries) {
2185
2810
  if (SKIP_DIRS.has(entry.name)) continue;
2186
- const fullPath = path4.join(current, entry.name);
2811
+ const fullPath = path7__default.default.join(current, entry.name);
2187
2812
  if (entry.isDirectory()) {
2188
2813
  walk(fullPath);
2189
2814
  } else if (SCAN_EXTENSIONS.some((ext) => entry.name.endsWith(ext))) {
@@ -2197,11 +2822,11 @@ function scanFiles(dir) {
2197
2822
  function scanProjectUsage(dirs, cwd = process.cwd()) {
2198
2823
  const combined = {};
2199
2824
  for (const dir of dirs) {
2200
- const absDir = path4.isAbsolute(dir) ? dir : path4.resolve(cwd, dir);
2825
+ const absDir = path7__default.default.isAbsolute(dir) ? dir : path7__default.default.resolve(cwd, dir);
2201
2826
  const files = scanFiles(absDir);
2202
2827
  for (const file of files) {
2203
2828
  try {
2204
- const source = fs2.readFileSync(file, "utf-8");
2829
+ const source = fs3__default.default.readFileSync(file, "utf-8");
2205
2830
  const usage = extractComponentUsage(source);
2206
2831
  for (const [comp, props] of Object.entries(usage)) {
2207
2832
  if (!combined[comp]) combined[comp] = {};
@@ -2210,27 +2835,26 @@ function scanProjectUsage(dirs, cwd = process.cwd()) {
2210
2835
  values.forEach((v) => combined[comp][prop].add(v));
2211
2836
  }
2212
2837
  }
2213
- } catch (e) {
2838
+ } catch {
2214
2839
  }
2215
2840
  }
2216
2841
  }
2217
2842
  return combined;
2218
2843
  }
2219
2844
  function findDeadVariants(registered, projectUsage) {
2220
- var _a2, _b2;
2221
2845
  const report = {
2222
2846
  unusedCount: 0,
2223
2847
  bytesSaved: 0,
2224
2848
  components: {}
2225
2849
  };
2226
2850
  for (const component of registered) {
2227
- const usage = (_a2 = projectUsage[component.name]) != null ? _a2 : {};
2851
+ const usage = projectUsage[component.name] ?? {};
2228
2852
  const usedVariants = {};
2229
2853
  const unusedVariants = {};
2230
2854
  for (const [variantKey, variantValues] of Object.entries(component.variants)) {
2231
2855
  usedVariants[variantKey] = [];
2232
2856
  unusedVariants[variantKey] = [];
2233
- const usedValueSet = (_b2 = usage[variantKey]) != null ? _b2 : /* @__PURE__ */ new Set();
2857
+ const usedValueSet = usage[variantKey] ?? /* @__PURE__ */ new Set();
2234
2858
  for (const [valueName, classes] of Object.entries(variantValues)) {
2235
2859
  if (usedValueSet.has(valueName)) {
2236
2860
  usedVariants[variantKey].push(valueName);
@@ -2341,21 +2965,24 @@ function runElimination(opts) {
2341
2965
  }
2342
2966
  return { css, report };
2343
2967
  }
2968
+
2969
+ // packages/compiler/src/incrementalEngine.ts
2970
+ init_src();
2344
2971
  var CACHE_DIR = ".tw-cache";
2345
- var HASH_CACHE_FILE = path4.join(CACHE_DIR, "file-hashes.json");
2346
- var GRAPH_CACHE_FILE = path4.join(CACHE_DIR, "dep-graph.json");
2972
+ var HASH_CACHE_FILE = path7__default.default.join(CACHE_DIR, "file-hashes.json");
2973
+ var GRAPH_CACHE_FILE = path7__default.default.join(CACHE_DIR, "dep-graph.json");
2347
2974
  function ensureCacheDir() {
2348
- if (!fs2.existsSync(CACHE_DIR)) {
2349
- fs2.mkdirSync(CACHE_DIR, { recursive: true });
2975
+ if (!fs3__default.default.existsSync(CACHE_DIR)) {
2976
+ fs3__default.default.mkdirSync(CACHE_DIR, { recursive: true });
2350
2977
  }
2351
2978
  }
2352
2979
  function loadHashCache() {
2353
2980
  try {
2354
- if (fs2.existsSync(HASH_CACHE_FILE)) {
2355
- const raw = fs2.readFileSync(HASH_CACHE_FILE, "utf-8");
2981
+ if (fs3__default.default.existsSync(HASH_CACHE_FILE)) {
2982
+ const raw = fs3__default.default.readFileSync(HASH_CACHE_FILE, "utf-8");
2356
2983
  return new Map(Object.entries(JSON.parse(raw)));
2357
2984
  }
2358
- } catch (e) {
2985
+ } catch {
2359
2986
  }
2360
2987
  return /* @__PURE__ */ new Map();
2361
2988
  }
@@ -2363,18 +2990,18 @@ function saveHashCache(cache) {
2363
2990
  try {
2364
2991
  ensureCacheDir();
2365
2992
  const obj = Object.fromEntries(cache);
2366
- fs2.writeFileSync(HASH_CACHE_FILE, JSON.stringify(obj, null, 2));
2367
- } catch (e) {
2993
+ fs3__default.default.writeFileSync(HASH_CACHE_FILE, JSON.stringify(obj, null, 2));
2994
+ } catch {
2368
2995
  }
2369
2996
  }
2370
2997
  function loadGraphCache() {
2371
2998
  try {
2372
- if (fs2.existsSync(GRAPH_CACHE_FILE)) {
2373
- const raw = fs2.readFileSync(GRAPH_CACHE_FILE, "utf-8");
2999
+ if (fs3__default.default.existsSync(GRAPH_CACHE_FILE)) {
3000
+ const raw = fs3__default.default.readFileSync(GRAPH_CACHE_FILE, "utf-8");
2374
3001
  const data = JSON.parse(raw);
2375
3002
  return new Map(Object.entries(data));
2376
3003
  }
2377
- } catch (e) {
3004
+ } catch {
2378
3005
  }
2379
3006
  return /* @__PURE__ */ new Map();
2380
3007
  }
@@ -2382,8 +3009,8 @@ function saveGraphCache(graph) {
2382
3009
  try {
2383
3010
  ensureCacheDir();
2384
3011
  const obj = Object.fromEntries(graph);
2385
- fs2.writeFileSync(GRAPH_CACHE_FILE, JSON.stringify(obj, null, 2));
2386
- } catch (e) {
3012
+ fs3__default.default.writeFileSync(GRAPH_CACHE_FILE, JSON.stringify(obj, null, 2));
3013
+ } catch {
2387
3014
  }
2388
3015
  }
2389
3016
  function fnv1a(str) {
@@ -2405,7 +3032,7 @@ function toBase36(n, len = 4) {
2405
3032
  return result;
2406
3033
  }
2407
3034
  function hashFileContent(content) {
2408
- return crypto.createHash("md5").update(content).digest("hex").slice(0, 8);
3035
+ return hashContent(content, "md5", 8);
2409
3036
  }
2410
3037
  function makeAtomicClass(declaration, modifier) {
2411
3038
  const key = modifier ? `${declaration}::${modifier}` : declaration;
@@ -2487,8 +3114,8 @@ var CssDiffWriter = class {
2487
3114
  }
2488
3115
  loadFromDisk() {
2489
3116
  try {
2490
- if (fs2.existsSync(this.outputPath)) {
2491
- const css = fs2.readFileSync(this.outputPath, "utf-8");
3117
+ if (fs3__default.default.existsSync(this.outputPath)) {
3118
+ const css = fs3__default.default.readFileSync(this.outputPath, "utf-8");
2492
3119
  const ruleRe = /(\.tw-[a-z0-9]+(?::[\w-]+)?)\{([^}]+)\}|(@[^{]+)\{(\.tw-[a-z0-9]+)\{([^}]+)\}\}/g;
2493
3120
  let m;
2494
3121
  while ((m = ruleRe.exec(css)) !== null) {
@@ -2498,7 +3125,7 @@ var CssDiffWriter = class {
2498
3125
  }
2499
3126
  }
2500
3127
  }
2501
- } catch (e) {
3128
+ } catch {
2502
3129
  }
2503
3130
  }
2504
3131
  /** Apply diff ke internal map */
@@ -2518,9 +3145,9 @@ var CssDiffWriter = class {
2518
3145
  try {
2519
3146
  ensureCacheDir();
2520
3147
  const css = Array.from(this.ruleMap.values()).join("\n");
2521
- await fs2.promises.writeFile(this.outputPath, css, "utf-8");
3148
+ await fs3__default.default.promises.writeFile(this.outputPath, css, "utf-8");
2522
3149
  this.dirty = false;
2523
- } catch (e) {
3150
+ } catch {
2524
3151
  }
2525
3152
  }
2526
3153
  /** Sync flush untuk build end */
@@ -2529,9 +3156,9 @@ var CssDiffWriter = class {
2529
3156
  try {
2530
3157
  ensureCacheDir();
2531
3158
  const css = Array.from(this.ruleMap.values()).join("\n");
2532
- fs2.writeFileSync(this.outputPath, css, "utf-8");
3159
+ fs3__default.default.writeFileSync(this.outputPath, css, "utf-8");
2533
3160
  this.dirty = false;
2534
- } catch (e) {
3161
+ } catch {
2535
3162
  }
2536
3163
  }
2537
3164
  size() {
@@ -2550,11 +3177,10 @@ var IncrementalEngine = class {
2550
3177
  buildTimeMs: 0
2551
3178
  };
2552
3179
  this.sessionStart = Date.now();
2553
- var _a2, _b2, _c;
2554
3180
  this.opts = {
2555
- outputPath: (_a2 = opts.outputPath) != null ? _a2 : path4.join(CACHE_DIR, "atomic.css"),
2556
- persistCache: (_b2 = opts.persistCache) != null ? _b2 : true,
2557
- verbose: (_c = opts.verbose) != null ? _c : false
3181
+ outputPath: opts.outputPath ?? path7__default.default.join(CACHE_DIR, "atomic.css"),
3182
+ persistCache: opts.persistCache ?? true,
3183
+ verbose: opts.verbose ?? false
2558
3184
  };
2559
3185
  this.hashCache = this.opts.persistCache ? loadHashCache() : /* @__PURE__ */ new Map();
2560
3186
  this.depGraph = this.opts.persistCache ? loadGraphCache() : /* @__PURE__ */ new Map();
@@ -2575,14 +3201,13 @@ var IncrementalEngine = class {
2575
3201
  * @returns ProcessResult dengan diff dan stats
2576
3202
  */
2577
3203
  processFile(filepath, source, extractedNodes) {
2578
- var _a2;
2579
3204
  const t0 = Date.now();
2580
3205
  this.stats.totalFiles++;
2581
3206
  const currentHash = hashFileContent(source);
2582
3207
  const cachedHash = this.hashCache.get(filepath);
2583
3208
  if (cachedHash === currentHash) {
2584
3209
  this.stats.skippedFiles++;
2585
- this.log(`[skip] ${path4.relative(process.cwd(), filepath)}`);
3210
+ this.log(`[skip] ${path7__default.default.relative(process.cwd(), filepath)}`);
2586
3211
  return {
2587
3212
  filepath,
2588
3213
  changed: false,
@@ -2592,8 +3217,8 @@ var IncrementalEngine = class {
2592
3217
  }
2593
3218
  this.hashCache.set(filepath, currentHash);
2594
3219
  this.stats.changedFiles++;
2595
- this.log(`[change] ${path4.relative(process.cwd(), filepath)}`);
2596
- const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
3220
+ this.log(`[change] ${path7__default.default.relative(process.cwd(), filepath)}`);
3221
+ const oldNodes = this.depGraph.get(filepath) ?? [];
2597
3222
  const diff = computeDiff(oldNodes, extractedNodes);
2598
3223
  this.depGraph.set(filepath, extractedNodes);
2599
3224
  const trulyRemoved = [];
@@ -2650,14 +3275,13 @@ var IncrementalEngine = class {
2650
3275
  * Invalidate satu file (untuk hot reload — file dihapus atau renamed).
2651
3276
  */
2652
3277
  invalidateFile(filepath) {
2653
- var _a2;
2654
- const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
3278
+ const oldNodes = this.depGraph.get(filepath) ?? [];
2655
3279
  for (const node of oldNodes) {
2656
3280
  this.globalReg.remove(filepath, node.atomicClass);
2657
3281
  }
2658
3282
  this.depGraph.delete(filepath);
2659
3283
  this.hashCache.delete(filepath);
2660
- this.log(`[invalidate] ${path4.relative(process.cwd(), filepath)}`);
3284
+ this.log(`[invalidate] ${path7__default.default.relative(process.cwd(), filepath)}`);
2661
3285
  }
2662
3286
  /** Get all active style nodes — untuk full CSS generation */
2663
3287
  getAllNodes() {
@@ -2665,7 +3289,7 @@ var IncrementalEngine = class {
2665
3289
  }
2666
3290
  /** Get stats untuk current build session */
2667
3291
  getStats() {
2668
- return __spreadProps(__spreadValues({}, this.stats), { buildTimeMs: Date.now() - this.sessionStart });
3292
+ return { ...this.stats, buildTimeMs: Date.now() - this.sessionStart };
2669
3293
  }
2670
3294
  /** Get output CSS path */
2671
3295
  getOutputPath() {
@@ -2723,7 +3347,6 @@ function parseOneClass(cls) {
2723
3347
  return { twClass: cls, declaration, modifier, atomicClass };
2724
3348
  }
2725
3349
  function resolveModifier(mod) {
2726
- var _a2, _b2;
2727
3350
  const pseudoMap = {
2728
3351
  hover: ":hover",
2729
3352
  focus: ":focus",
@@ -2745,10 +3368,9 @@ function resolveModifier(mod) {
2745
3368
  dark: "@media (prefers-color-scheme: dark)",
2746
3369
  print: "@media print"
2747
3370
  };
2748
- return (_b2 = (_a2 = pseudoMap[mod]) != null ? _a2 : mediaMap[mod]) != null ? _b2 : `:${mod}`;
3371
+ return pseudoMap[mod] ?? mediaMap[mod] ?? `:${mod}`;
2749
3372
  }
2750
3373
  function twToDeclaration(cls) {
2751
- var _a2;
2752
3374
  const sp = cls.match(/^(p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-([\d.]+)$/);
2753
3375
  if (sp) {
2754
3376
  const propMap = {
@@ -2827,10 +3449,9 @@ function twToDeclaration(cls) {
2827
3449
  truncate: "overflow: hidden; text-overflow: ellipsis; white-space: nowrap",
2828
3450
  transition: "transition-property: color,background-color,border-color,opacity,box-shadow,transform; transition-duration: 150ms"
2829
3451
  };
2830
- return (_a2 = map[cls]) != null ? _a2 : null;
3452
+ return map[cls] ?? null;
2831
3453
  }
2832
3454
  function sizeVal(v) {
2833
- var _a2;
2834
3455
  const num = parseFloat(v);
2835
3456
  if (!Number.isNaN(num)) return `${num * 0.25}rem`;
2836
3457
  const special = {
@@ -2841,7 +3462,7 @@ function sizeVal(v) {
2841
3462
  max: "max-content",
2842
3463
  fit: "fit-content"
2843
3464
  };
2844
- return (_a2 = special[v]) != null ? _a2 : v;
3465
+ return special[v] ?? v;
2845
3466
  }
2846
3467
  var _engine = null;
2847
3468
  function getIncrementalEngine(opts) {
@@ -2853,234 +3474,8 @@ function getIncrementalEngine(opts) {
2853
3474
  function resetIncrementalEngine() {
2854
3475
  _engine = null;
2855
3476
  }
2856
- var CONFIG_FILES = [
2857
- "tailwind.config.ts",
2858
- "tailwind.config.js",
2859
- "tailwind.config.mjs",
2860
- "tailwind.config.cjs"
2861
- ];
2862
- var _cachedConfig = null;
2863
- var _cachedCwd = "";
2864
- function loadTailwindConfig(cwd = process.cwd()) {
2865
- var _a2;
2866
- if (_cachedConfig && _cachedCwd === cwd) return _cachedConfig;
2867
- _cachedCwd = cwd;
2868
- for (const file of CONFIG_FILES) {
2869
- const fullPath = path4.join(cwd, file);
2870
- if (fs2.existsSync(fullPath)) {
2871
- try {
2872
- const mod = __require(fullPath);
2873
- const config = (_a2 = mod.default) != null ? _a2 : mod;
2874
- _cachedConfig = config;
2875
- console.log(`[tailwind-styled-v4] Using config: ${file}`);
2876
- return config;
2877
- } catch (e) {
2878
- }
2879
- }
2880
- }
2881
- console.log("[tailwind-styled-v4] No tailwind config found \u2192 using built-in preset");
2882
- const { defaultPreset: defaultPreset2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
2883
- _cachedConfig = defaultPreset2;
2884
- return defaultPreset2;
2885
- }
2886
- function getContentPaths(config, cwd = process.cwd()) {
2887
- var _a2;
2888
- const paths = [];
2889
- if (Array.isArray(config.content)) {
2890
- for (const item of config.content) {
2891
- if (typeof item === "string") paths.push(item);
2892
- else if (typeof item === "object" && item.raw) ;
2893
- }
2894
- return paths;
2895
- }
2896
- if ((_a2 = config.content) == null ? void 0 : _a2.files) {
2897
- return config.content.files.filter((f) => typeof f === "string");
2898
- }
2899
- return ["src", "app", "pages", "components"].filter((d) => fs2.existsSync(path4.join(cwd, d))).map((d) => `./${d}/**/*.{tsx,ts,jsx,js}`);
2900
- }
2901
- function invalidateConfigCache() {
2902
- _cachedConfig = null;
2903
- _cachedCwd = "";
2904
- }
2905
- function isZeroConfig(cwd = process.cwd()) {
2906
- return !CONFIG_FILES.some((f) => fs2.existsSync(path4.join(cwd, f)));
2907
- }
2908
- function bootstrapZeroConfig(cwd = process.cwd()) {
2909
- let generatedConfig = false;
2910
- let generatedCss = false;
2911
- generatedConfig = false;
2912
- const cssPaths = [
2913
- "src/app/globals.css",
2914
- "app/globals.css",
2915
- "src/index.css",
2916
- "src/styles/globals.css"
2917
- ];
2918
- const hasGlobalCss = cssPaths.some((p) => fs2.existsSync(path4.join(cwd, p)));
2919
- if (!hasGlobalCss) {
2920
- const { defaultGlobalCss: defaultGlobalCss2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
2921
- const appDir = fs2.existsSync(path4.join(cwd, "src/app")) ? "src/app" : fs2.existsSync(path4.join(cwd, "app")) ? "app" : "src";
2922
- const cssPath = path4.join(cwd, appDir, "globals.css");
2923
- if (fs2.existsSync(path4.dirname(cssPath))) {
2924
- fs2.writeFileSync(cssPath, defaultGlobalCss2);
2925
- generatedCss = true;
2926
- console.log(`[tailwind-styled-v4] Generated ${cssPath}`);
2927
- }
2928
- }
2929
- return { generatedConfig, generatedCss };
2930
- }
2931
3477
 
2932
- // ../compiler/src/routeCssCollector.ts
2933
- var _collector = {
2934
- files: /* @__PURE__ */ new Map(),
2935
- routes: /* @__PURE__ */ new Map(),
2936
- global: /* @__PURE__ */ new Set()
2937
- };
2938
- function registerFileClasses(filepath, classes) {
2939
- if (!_collector.files.has(filepath)) {
2940
- _collector.files.set(filepath, /* @__PURE__ */ new Set());
2941
- }
2942
- const fileSet = _collector.files.get(filepath);
2943
- classes.forEach((c) => fileSet.add(c));
2944
- const route = fileToRoute(filepath);
2945
- if (route) {
2946
- if (!_collector.routes.has(route)) {
2947
- _collector.routes.set(route, /* @__PURE__ */ new Set());
2948
- }
2949
- _collector.routes.get(route).add(filepath);
2950
- }
2951
- }
2952
- function registerGlobalClasses(classes) {
2953
- classes.forEach((c) => _collector.global.add(c));
2954
- }
2955
- function getRouteClasses(route) {
2956
- var _a2, _b2;
2957
- const result = new Set(_collector.global);
2958
- const routeFiles = (_a2 = _collector.routes.get(route)) != null ? _a2 : /* @__PURE__ */ new Set();
2959
- for (const filepath of routeFiles) {
2960
- const fileClasses = (_b2 = _collector.files.get(filepath)) != null ? _b2 : /* @__PURE__ */ new Set();
2961
- fileClasses.forEach((c) => result.add(c));
2962
- }
2963
- return result;
2964
- }
2965
- function getAllRoutes() {
2966
- return Array.from(_collector.routes.keys()).sort();
2967
- }
2968
- function getCollector() {
2969
- return _collector;
2970
- }
2971
- function resetCollector() {
2972
- _collector = {
2973
- files: /* @__PURE__ */ new Map(),
2974
- routes: /* @__PURE__ */ new Map(),
2975
- global: /* @__PURE__ */ new Set()
2976
- };
2977
- }
2978
- function fileToRoute(filepath) {
2979
- const normalized = filepath.replace(/\\/g, "/");
2980
- if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
2981
- return "__global";
2982
- }
2983
- const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2984
- if (pageMatch) return `/${pageMatch[1]}`;
2985
- const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2986
- if (rootPage) return "/";
2987
- const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
2988
- if (pagesMatch) {
2989
- const route = pagesMatch[1].replace(/\/index$/, "");
2990
- return `/${route}`;
2991
- }
2992
- if (normalized.includes("/components/") || normalized.includes("/ui/") || normalized.includes("/shared/")) {
2993
- return "__global";
2994
- }
2995
- return null;
2996
- }
2997
- function getCollectorSummary() {
2998
- const routes = getAllRoutes();
2999
- const totalFiles = _collector.files.size;
3000
- const totalGlobal = _collector.global.size;
3001
- const lines = [
3002
- `[tailwind-styled-v4] Route CSS Summary:`,
3003
- ` Files processed: ${totalFiles}`,
3004
- ` Global classes: ${totalGlobal}`,
3005
- ` Routes found: ${routes.length}`,
3006
- ...routes.map((r) => {
3007
- const cls = getRouteClasses(r).size;
3008
- return ` ${r} \u2192 ${cls} classes`;
3009
- })
3010
- ];
3011
- return lines.join("\n");
3012
- }
3013
- var SCAN_EXTENSIONS2 = [".tsx", ".ts", ".jsx", ".js"];
3014
- function scanDir(dir, files = []) {
3015
- if (!fs2.existsSync(dir)) return files;
3016
- const entries = fs2.readdirSync(dir, { withFileTypes: true });
3017
- for (const entry of entries) {
3018
- if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
3019
- const fullPath = path4.join(dir, entry.name);
3020
- if (entry.isDirectory()) {
3021
- scanDir(fullPath, files);
3022
- } else if (SCAN_EXTENSIONS2.some((ext) => entry.name.endsWith(ext))) {
3023
- files.push(fullPath);
3024
- }
3025
- }
3026
- return files;
3027
- }
3028
- function generateSafelist(scanDirs, outputPath = ".tailwind-styled-safelist.json", cwd = process.cwd()) {
3029
- const allClasses = /* @__PURE__ */ new Set();
3030
- for (const dir of scanDirs) {
3031
- const absDir = path4.isAbsolute(dir) ? dir : path4.resolve(cwd, dir);
3032
- const files = scanDir(absDir);
3033
- for (const file of files) {
3034
- try {
3035
- const source = fs2.readFileSync(file, "utf-8");
3036
- const classes = extractAllClasses(source);
3037
- classes.forEach((c) => allClasses.add(c));
3038
- } catch (e) {
3039
- }
3040
- }
3041
- }
3042
- const sorted = Array.from(allClasses).sort();
3043
- const absOutput = path4.isAbsolute(outputPath) ? outputPath : path4.resolve(cwd, outputPath);
3044
- fs2.writeFileSync(absOutput, JSON.stringify(sorted, null, 2));
3045
- console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
3046
- return sorted;
3047
- }
3048
- function loadSafelist(safelistPath) {
3049
- try {
3050
- const content = fs2.readFileSync(safelistPath, "utf-8");
3051
- return JSON.parse(content);
3052
- } catch (e) {
3053
- return [];
3054
- }
3055
- }
3056
- function generateSafelistCss(scanDirs, outputPath = "src/app/__tw-safelist.css", cwd = process.cwd()) {
3057
- const allClasses = /* @__PURE__ */ new Set();
3058
- for (const dir of scanDirs) {
3059
- const absDir = path4.isAbsolute(dir) ? dir : path4.resolve(cwd, dir);
3060
- const files = scanDir(absDir);
3061
- for (const file of files) {
3062
- try {
3063
- const source = fs2.readFileSync(file, "utf-8");
3064
- const classes = extractAllClasses(source);
3065
- classes.forEach((c) => allClasses.add(c));
3066
- } catch (e) {
3067
- }
3068
- }
3069
- }
3070
- const sorted = Array.from(allClasses).sort();
3071
- const absOutput = path4.isAbsolute(outputPath) ? outputPath : path4.resolve(cwd, outputPath);
3072
- fs2.mkdirSync(path4.dirname(absOutput), { recursive: true });
3073
- const css = sorted.length > 0 ? `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
3074
- @source inline("${sorted.join(" ")}");
3075
- ` : `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
3076
- /* No safelist classes found */
3077
- `;
3078
- fs2.writeFileSync(absOutput, css);
3079
- console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
3080
- return sorted;
3081
- }
3082
-
3083
- // ../compiler/src/styleBucketSystem.ts
3478
+ // packages/compiler/src/styleBucketSystem.ts
3084
3479
  var BUCKET_ORDER = [
3085
3480
  "reset",
3086
3481
  "layout",
@@ -3222,10 +3617,9 @@ var PROPERTY_BUCKET_MAP = {
3222
3617
  all: "reset"
3223
3618
  };
3224
3619
  function classifyNode(node) {
3225
- var _a2, _b2, _c;
3226
- if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) return "responsive";
3620
+ if (node.modifier?.startsWith("@")) return "responsive";
3227
3621
  const declarations = node.declaration.split(";").map((d) => d.trim()).filter(Boolean);
3228
- const firstProp = (_c = (_b2 = declarations[0]) == null ? void 0 : _b2.split(":")[0]) == null ? void 0 : _c.trim();
3622
+ const firstProp = declarations[0]?.split(":")[0]?.trim();
3229
3623
  if (!firstProp) return "unknown";
3230
3624
  if (PROPERTY_BUCKET_MAP[firstProp]) return PROPERTY_BUCKET_MAP[firstProp];
3231
3625
  for (const [prefix, bucket] of Object.entries(PROPERTY_BUCKET_MAP)) {
@@ -3356,14 +3750,13 @@ function nodeToCSS2(node) {
3356
3750
  return `.${atomicClass}${modifier}{${declaration}}`;
3357
3751
  }
3358
3752
  function detectConflicts(nodes) {
3359
- var _a2, _b2, _c;
3360
3753
  const seen = /* @__PURE__ */ new Map();
3361
3754
  const warnings = [];
3362
3755
  for (const node of nodes) {
3363
- if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) continue;
3364
- const firstProp = (_b2 = node.declaration.split(":")[0]) == null ? void 0 : _b2.trim();
3756
+ if (node.modifier?.startsWith("@")) continue;
3757
+ const firstProp = node.declaration.split(":")[0]?.trim();
3365
3758
  if (!firstProp) continue;
3366
- const key = `${firstProp}::${(_c = node.modifier) != null ? _c : ""}`;
3759
+ const key = `${firstProp}::${node.modifier ?? ""}`;
3367
3760
  const prev = seen.get(key);
3368
3761
  if (prev) {
3369
3762
  warnings.push({
@@ -3386,15 +3779,554 @@ function getBucketEngine() {
3386
3779
  function resetBucketEngine() {
3387
3780
  _bucketEngine = null;
3388
3781
  }
3782
+
3783
+ // packages/compiler/src/index.ts
3784
+ init_atomicCss();
3785
+
3786
+ // packages/compiler/src/context.ts
3787
+ var CompileContext = class {
3788
+ constructor(input) {
3789
+ this.filepath = input.filepath;
3790
+ this.source = input.source;
3791
+ this.options = input.options;
3792
+ this.result = null;
3793
+ this.done = false;
3794
+ this.engine = "none";
3795
+ }
3796
+ };
3797
+ init_nativeBridge();
3798
+
3799
+ // packages/compiler/src/pipeline.ts
3800
+ var Pipeline = class {
3801
+ constructor() {
3802
+ this.steps = [];
3803
+ }
3804
+ use(step) {
3805
+ this.steps.push(step);
3806
+ return this;
3807
+ }
3808
+ run(ctx) {
3809
+ for (const step of this.steps) {
3810
+ step(ctx);
3811
+ if (ctx.done) break;
3812
+ }
3813
+ return ctx;
3814
+ }
3815
+ };
3816
+
3817
+ // packages/compiler/src/coreCompiler.ts
3818
+ var MAX_CACHE_ENTRIES = 512;
3819
+ var compileCache = /* @__PURE__ */ new Map();
3820
+ function makeCacheKey(input) {
3821
+ const options = {
3822
+ mode: input.options.mode,
3823
+ autoClientBoundary: input.options.autoClientBoundary,
3824
+ addDataAttr: input.options.addDataAttr,
3825
+ hoist: input.options.hoist,
3826
+ filename: input.options.filename ?? input.filepath,
3827
+ deadStyleElimination: input.options.deadStyleElimination
3828
+ };
3829
+ return crypto.createHash("sha1").update(input.filepath).update("").update(input.source).update("").update(JSON.stringify(options)).digest("hex");
3830
+ }
3831
+ function cloneTransformResult(result) {
3832
+ return {
3833
+ code: result.code,
3834
+ classes: [...result.classes],
3835
+ changed: result.changed,
3836
+ rsc: result.rsc ? {
3837
+ isServer: result.rsc.isServer,
3838
+ needsClientDirective: result.rsc.needsClientDirective,
3839
+ clientReasons: [...result.rsc.clientReasons]
3840
+ } : void 0
3841
+ };
3842
+ }
3843
+ function cloneCoreCompileResult(result) {
3844
+ return {
3845
+ result: cloneTransformResult(result.result),
3846
+ engine: result.engine,
3847
+ cacheHit: result.cacheHit,
3848
+ metadata: result.metadata ? result.metadata.map((m) => ({ ...m })) : void 0,
3849
+ css: result.css
3850
+ };
3851
+ }
3852
+ function persistCache(key, value) {
3853
+ compileCache.set(key, { ...value, cacheHit: false });
3854
+ if (compileCache.size <= MAX_CACHE_ENTRIES) return;
3855
+ const oldestKey = compileCache.keys().next().value;
3856
+ if (oldestKey) compileCache.delete(oldestKey);
3857
+ }
3858
+ function createPassthrough(source) {
3859
+ return { code: source, classes: [], changed: false };
3860
+ }
3861
+ var CompilerCore = class {
3862
+ constructor() {
3863
+ this.pipeline = new Pipeline().use((ctx) => this.nativeStep(ctx));
3864
+ }
3865
+ compile(input) {
3866
+ const cacheKey = makeCacheKey(input);
3867
+ const cached = compileCache.get(cacheKey);
3868
+ if (cached) {
3869
+ const hit = cloneCoreCompileResult(cached);
3870
+ hit.cacheHit = true;
3871
+ return hit;
3872
+ }
3873
+ const ctx = new CompileContext(input);
3874
+ this.pipeline.run(ctx);
3875
+ const result = ctx.result ?? createPassthrough(input.source);
3876
+ let cssOutput;
3877
+ if (ctx.options.deadStyleElimination && result.classes.length > 0) {
3878
+ cssOutput = this.runDeadStyleElimination(result.classes, input.options);
3879
+ }
3880
+ const compiled = {
3881
+ result,
3882
+ engine: ctx.engine,
3883
+ cacheHit: false,
3884
+ metadata: ctx.metadata,
3885
+ css: cssOutput
3886
+ };
3887
+ persistCache(cacheKey, compiled);
3888
+ return cloneCoreCompileResult(compiled);
3889
+ }
3890
+ runDeadStyleElimination(classes, options) {
3891
+ if (classes.length === 0) return "";
3892
+ const native = getNativeBridge();
3893
+ if (native?.analyzeClassesNative) {
3894
+ try {
3895
+ const filesJson = JSON.stringify([{ file: "compiled", classes }]);
3896
+ const analysis = native.analyzeClassesNative(filesJson, process.cwd(), 0);
3897
+ if (analysis && analysis.safelist) {
3898
+ const deadClasses = /* @__PURE__ */ new Set();
3899
+ const safelistSet = new Set(analysis.safelist);
3900
+ for (const cls of classes) {
3901
+ if (!safelistSet.has(cls)) {
3902
+ deadClasses.add(cls);
3903
+ }
3904
+ }
3905
+ if (deadClasses.size > 0) {
3906
+ return "";
3907
+ }
3908
+ }
3909
+ } catch {
3910
+ }
3911
+ }
3912
+ return "";
3913
+ }
3914
+ /**
3915
+ * v5: Native step now THROWS if native binding is unavailable.
3916
+ * Previously returned early to allow JS fallback.
3917
+ */
3918
+ nativeStep(ctx) {
3919
+ const native = getNativeBridge();
3920
+ if (!native?.transformSourceNative) {
3921
+ throw new Error(
3922
+ `[tailwind-styled/compiler v5] transformSourceNative is required but not available.
3923
+ Please ensure the native module is properly built with transform support.`
3924
+ );
3925
+ }
3926
+ const opts = {};
3927
+ if (ctx.options.mode) opts.mode = ctx.options.mode;
3928
+ if (ctx.options.filename ?? ctx.filepath) opts.filename = ctx.options.filename ?? ctx.filepath;
3929
+ const raw = native.transformSourceNative(ctx.source, opts);
3930
+ if (raw === null) {
3931
+ throw new Error(
3932
+ `[tailwind-styled/compiler v5] Native transform returned null for: ${ctx.filepath}
3933
+ This indicates an issue with the native module.`
3934
+ );
3935
+ }
3936
+ const adapted = adaptNativeResult(raw);
3937
+ ctx.result = adapted;
3938
+ ctx.metadata = adapted.metadata;
3939
+ ctx.engine = "native";
3940
+ ctx.done = true;
3941
+ }
3942
+ /**
3943
+ * v5: JS pipeline has been removed.
3944
+ * Previously used as fallback when native was unavailable.
3945
+ *
3946
+ * @throws Error always - JS pipeline is no longer supported in v5
3947
+ * @deprecated JS pipeline was removed in v5
3948
+ */
3949
+ jsStep(ctx) {
3950
+ throw new Error(
3951
+ `[tailwind-styled/compiler v5] JS pipeline is no longer supported.
3952
+ The native binding is required for all transformations.`
3953
+ );
3954
+ }
3955
+ };
3956
+ var compilerCore = new CompilerCore();
3957
+ function compileWithCore(input) {
3958
+ return compilerCore.compile(input);
3959
+ }
3960
+ function resetCompileCache() {
3961
+ compileCache.clear();
3962
+ }
3963
+
3964
+ // packages/compiler/src/routeCssCollector.ts
3965
+ var _collector = {
3966
+ files: /* @__PURE__ */ new Map(),
3967
+ routes: /* @__PURE__ */ new Map(),
3968
+ global: /* @__PURE__ */ new Set()
3969
+ };
3970
+ function registerFileClasses(filepath, classes) {
3971
+ if (!_collector.files.has(filepath)) {
3972
+ _collector.files.set(filepath, /* @__PURE__ */ new Set());
3973
+ }
3974
+ const fileSet = _collector.files.get(filepath);
3975
+ classes.forEach((c) => fileSet.add(c));
3976
+ const route = fileToRoute(filepath);
3977
+ if (route) {
3978
+ if (!_collector.routes.has(route)) {
3979
+ _collector.routes.set(route, /* @__PURE__ */ new Set());
3980
+ }
3981
+ _collector.routes.get(route).add(filepath);
3982
+ }
3983
+ }
3984
+ function registerGlobalClasses(classes) {
3985
+ classes.forEach((c) => _collector.global.add(c));
3986
+ }
3987
+ function getRouteClasses(route) {
3988
+ const result = new Set(_collector.global);
3989
+ const routeFiles = _collector.routes.get(route) ?? /* @__PURE__ */ new Set();
3990
+ for (const filepath of routeFiles) {
3991
+ const fileClasses = _collector.files.get(filepath) ?? /* @__PURE__ */ new Set();
3992
+ fileClasses.forEach((c) => result.add(c));
3993
+ }
3994
+ return result;
3995
+ }
3996
+ function getAllRoutes() {
3997
+ return Array.from(_collector.routes.keys()).sort();
3998
+ }
3999
+ function getCollector() {
4000
+ return _collector;
4001
+ }
4002
+ function resetCollector() {
4003
+ _collector = {
4004
+ files: /* @__PURE__ */ new Map(),
4005
+ routes: /* @__PURE__ */ new Map(),
4006
+ global: /* @__PURE__ */ new Set()
4007
+ };
4008
+ }
4009
+ function fileToRoute(filepath) {
4010
+ const normalized = filepath.replace(/\\/g, "/");
4011
+ if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
4012
+ return "__global";
4013
+ }
4014
+ const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
4015
+ if (pageMatch) return `/${pageMatch[1]}`;
4016
+ const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
4017
+ if (rootPage) return "/";
4018
+ const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
4019
+ if (pagesMatch) {
4020
+ const route = pagesMatch[1].replace(/\/index$/, "");
4021
+ return `/${route}`;
4022
+ }
4023
+ if (normalized.includes("/components/") || normalized.includes("/ui/") || normalized.includes("/shared/")) {
4024
+ return "__global";
4025
+ }
4026
+ return null;
4027
+ }
4028
+ function getCollectorSummary() {
4029
+ const routes = getAllRoutes();
4030
+ const totalFiles = _collector.files.size;
4031
+ const totalGlobal = _collector.global.size;
4032
+ const lines = [
4033
+ `[tailwind-styled-v4] Route CSS Summary:`,
4034
+ ` Files processed: ${totalFiles}`,
4035
+ ` Global classes: ${totalGlobal}`,
4036
+ ` Routes found: ${routes.length}`,
4037
+ ...routes.map((r) => {
4038
+ const cls = getRouteClasses(r).size;
4039
+ return ` ${r} \u2192 ${cls} classes`;
4040
+ })
4041
+ ];
4042
+ return lines.join("\n");
4043
+ }
4044
+
4045
+ // packages/compiler/src/loaderCore.ts
4046
+ var SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
4047
+ function shouldSkipFile(filepath) {
4048
+ return SKIP_PATHS.some((p) => filepath.includes(p)) || !/\.[jt]sx?$/.test(filepath);
4049
+ }
4050
+ function runLoaderTransform(ctx) {
4051
+ const { filepath, source, options } = ctx;
4052
+ const passthrough = { code: source, changed: false, classes: [] };
4053
+ if (shouldSkipFile(filepath)) return passthrough;
4054
+ try {
4055
+ if (options.incremental !== false) {
4056
+ const engine = getIncrementalEngine({ verbose: options.verbose });
4057
+ const precheck = engine.processFile(filepath, source, []);
4058
+ if (!precheck.changed) return passthrough;
4059
+ }
4060
+ const compiled = compileWithCore({
4061
+ filepath,
4062
+ source,
4063
+ options: { ...options, filename: filepath }
4064
+ });
4065
+ if (!compiled.result.changed) return passthrough;
4066
+ return finalize(
4067
+ compiled.result,
4068
+ filepath,
4069
+ options,
4070
+ compiled.engine,
4071
+ compiled.cacheHit,
4072
+ compiled.metadata
4073
+ );
4074
+ } catch (err) {
4075
+ if (process.env.NODE_ENV !== "production") {
4076
+ const name = filepath.split(/[/\\]/).pop();
4077
+ console.warn(`[tailwind-styled] Transform failed for ${name}:`, err);
4078
+ }
4079
+ return passthrough;
4080
+ }
4081
+ }
4082
+ function finalize(result, filepath, options, engine, cacheHit, metadata) {
4083
+ if (!result.changed) {
4084
+ return { code: result.code, changed: false, classes: [] };
4085
+ }
4086
+ if (options.routeCss && result.classes.length > 0) {
4087
+ registerFileClasses(filepath, result.classes);
4088
+ }
4089
+ if (options.incremental !== false) {
4090
+ try {
4091
+ const engineInst = getIncrementalEngine({ verbose: options.verbose });
4092
+ const nodes = parseClassesToNodes(result.classes);
4093
+ const diff = engineInst.processFile(filepath, result.code, nodes);
4094
+ getBucketEngine().applyDiff(diff.diff);
4095
+ } catch {
4096
+ }
4097
+ }
4098
+ if (options.verbose) {
4099
+ const env = result.rsc?.isServer ? "server" : "client";
4100
+ const name = filepath.split(/[/\\]/).pop();
4101
+ const pathHint = result.rsc ? ` (${env})` : "";
4102
+ const cacheText = cacheHit ? " cache-hit" : "";
4103
+ const metaText = metadata?.length ? ` [${metadata.length} compound]` : "";
4104
+ console.log(
4105
+ `[tailwind-styled] ${name} -> ${result.classes.length} classes${pathHint} [${engine}${cacheText}]${metaText}`
4106
+ );
4107
+ }
4108
+ return {
4109
+ code: result.code,
4110
+ changed: result.changed,
4111
+ classes: result.classes,
4112
+ rsc: result.rsc,
4113
+ engine,
4114
+ cacheHit,
4115
+ metadata
4116
+ };
4117
+ }
4118
+ var CONFIG_FILES = [
4119
+ "tailwind.config.ts",
4120
+ "tailwind.config.js",
4121
+ "tailwind.config.mjs",
4122
+ "tailwind.config.cjs"
4123
+ ];
4124
+ var _cachedConfig = null;
4125
+ var _cachedCwd = "";
4126
+ function loadTailwindConfig(cwd = process.cwd()) {
4127
+ if (_cachedConfig && _cachedCwd === cwd) return _cachedConfig;
4128
+ _cachedCwd = cwd;
4129
+ for (const file of CONFIG_FILES) {
4130
+ const fullPath = path7__default.default.join(cwd, file);
4131
+ if (fs3__default.default.existsSync(fullPath)) {
4132
+ try {
4133
+ const mod = __require(fullPath);
4134
+ const config = mod.default ?? mod;
4135
+ _cachedConfig = config;
4136
+ console.log(`[tailwind-styled-v4] Using config: ${file}`);
4137
+ return config;
4138
+ } catch {
4139
+ }
4140
+ }
4141
+ }
4142
+ console.log("[tailwind-styled-v4] No tailwind config found \u2192 using built-in preset");
4143
+ const { defaultPreset: defaultPreset2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
4144
+ _cachedConfig = defaultPreset2;
4145
+ return defaultPreset2;
4146
+ }
4147
+ function getContentPaths(config, cwd = process.cwd()) {
4148
+ const paths = [];
4149
+ if (Array.isArray(config.content)) {
4150
+ for (const item of config.content) {
4151
+ if (typeof item === "string") paths.push(item);
4152
+ else if (typeof item === "object" && item.raw) ;
4153
+ }
4154
+ return paths;
4155
+ }
4156
+ if (config.content?.files) {
4157
+ return config.content.files.filter((f) => typeof f === "string");
4158
+ }
4159
+ return ["src", "app", "pages", "components"].filter((d) => fs3__default.default.existsSync(path7__default.default.join(cwd, d))).map((d) => `./${d}/**/*.{tsx,ts,jsx,js}`);
4160
+ }
4161
+ function invalidateConfigCache() {
4162
+ _cachedConfig = null;
4163
+ _cachedCwd = "";
4164
+ }
4165
+ function isZeroConfig(cwd = process.cwd()) {
4166
+ return !CONFIG_FILES.some((f) => fs3__default.default.existsSync(path7__default.default.join(cwd, f)));
4167
+ }
4168
+ function bootstrapZeroConfig(cwd = process.cwd()) {
4169
+ let generatedConfig = false;
4170
+ let generatedCss = false;
4171
+ generatedConfig = false;
4172
+ const cssPaths = [
4173
+ "src/app/globals.css",
4174
+ "app/globals.css",
4175
+ "src/index.css",
4176
+ "src/styles/globals.css"
4177
+ ];
4178
+ const hasGlobalCss = cssPaths.some((p) => fs3__default.default.existsSync(path7__default.default.join(cwd, p)));
4179
+ if (!hasGlobalCss) {
4180
+ const { defaultGlobalCss: defaultGlobalCss2 } = (init_defaultPreset(), __toCommonJS(defaultPreset_exports));
4181
+ const appDir = fs3__default.default.existsSync(path7__default.default.join(cwd, "src/app")) ? "src/app" : fs3__default.default.existsSync(path7__default.default.join(cwd, "app")) ? "app" : "src";
4182
+ const cssPath = path7__default.default.join(cwd, appDir, "globals.css");
4183
+ if (fs3__default.default.existsSync(path7__default.default.dirname(cssPath))) {
4184
+ fs3__default.default.writeFileSync(cssPath, defaultGlobalCss2);
4185
+ generatedCss = true;
4186
+ console.log(`[tailwind-styled-v4] Generated ${cssPath}`);
4187
+ }
4188
+ }
4189
+ return { generatedConfig, generatedCss };
4190
+ }
4191
+
4192
+ // packages/compiler/src/index.ts
4193
+ init_nativeBridge();
4194
+ var _binding2;
4195
+ function getBinding2() {
4196
+ if (_binding2 !== void 0) {
4197
+ if (_binding2 === null) {
4198
+ throw new Error(
4199
+ `[tailwind-styled/compiler v5] Native CSS binding is required but not available.
4200
+ Please ensure the native module is properly built.`
4201
+ );
4202
+ }
4203
+ return _binding2;
4204
+ }
4205
+ if (process.env.TWS_NO_NATIVE === "1") {
4206
+ _binding2 = null;
4207
+ throw new Error(
4208
+ `[tailwind-styled/compiler v5] Native binding is required.
4209
+ The TWS_NO_NATIVE environment variable is set, which disables native binding.`
4210
+ );
4211
+ }
4212
+ const req = typeof __require === "function" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
4213
+ const candidates = [
4214
+ path7__default.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
4215
+ path7__default.default.resolve(__dirname, "..", "..", "..", "native", "tailwind_styled_parser.node"),
4216
+ path7__default.default.resolve(__dirname, "..", "..", "..", "..", "native", "tailwind_styled_parser.node")
4217
+ ];
4218
+ for (const c of candidates) {
4219
+ try {
4220
+ const mod = req(c);
4221
+ if (mod?.compileCss) {
4222
+ _binding2 = mod;
4223
+ return _binding2;
4224
+ }
4225
+ } catch {
4226
+ }
4227
+ }
4228
+ _binding2 = null;
4229
+ throw new Error(
4230
+ `[tailwind-styled/compiler v5] Native CSS binding not found.
4231
+ Tried loading from:
4232
+ ` + candidates.map((c) => ` - ${c}`).join("\n") + `
4233
+
4234
+ Please build the native module.`
4235
+ );
4236
+ }
4237
+ function compileCssNative(classes, prefix = null) {
4238
+ const binding = getBinding2();
4239
+ const r = binding.compileCss(classes, prefix);
4240
+ return { ...r, engine: "rust" };
4241
+ }
4242
+ function astExtractClassesNative(source, filename) {
4243
+ const binding = getBinding2();
4244
+ const r = binding.astExtractClasses(source, filename);
4245
+ return { ...r, engine: "rust" };
4246
+ }
4247
+ var SCAN_EXTENSIONS2 = [".tsx", ".ts", ".jsx", ".js"];
4248
+ function scanDir(dir, files = []) {
4249
+ if (!fs3__default.default.existsSync(dir)) return files;
4250
+ const entries = fs3__default.default.readdirSync(dir, { withFileTypes: true });
4251
+ for (const entry of entries) {
4252
+ if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
4253
+ const fullPath = path7__default.default.join(dir, entry.name);
4254
+ if (entry.isDirectory()) {
4255
+ scanDir(fullPath, files);
4256
+ } else if (SCAN_EXTENSIONS2.some((ext) => entry.name.endsWith(ext))) {
4257
+ files.push(fullPath);
4258
+ }
4259
+ }
4260
+ return files;
4261
+ }
4262
+ function generateSafelist(scanDirs, outputPath = ".tailwind-styled-safelist.json", cwd = process.cwd()) {
4263
+ const allClasses = /* @__PURE__ */ new Set();
4264
+ for (const dir of scanDirs) {
4265
+ const absDir = path7__default.default.isAbsolute(dir) ? dir : path7__default.default.resolve(cwd, dir);
4266
+ const files = scanDir(absDir);
4267
+ for (const file of files) {
4268
+ try {
4269
+ const source = fs3__default.default.readFileSync(file, "utf-8");
4270
+ const classes = extractAllClasses(source);
4271
+ classes.forEach((c) => allClasses.add(c));
4272
+ } catch {
4273
+ }
4274
+ }
4275
+ }
4276
+ const sorted = Array.from(allClasses).sort();
4277
+ const absOutput = path7__default.default.isAbsolute(outputPath) ? outputPath : path7__default.default.resolve(cwd, outputPath);
4278
+ fs3__default.default.writeFileSync(absOutput, JSON.stringify(sorted, null, 2));
4279
+ console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
4280
+ return sorted;
4281
+ }
4282
+ function loadSafelist(safelistPath) {
4283
+ try {
4284
+ const content = fs3__default.default.readFileSync(safelistPath, "utf-8");
4285
+ return JSON.parse(content);
4286
+ } catch {
4287
+ return [];
4288
+ }
4289
+ }
4290
+ function generateSafelistCss(scanDirs, outputPath = "src/app/__tw-safelist.css", cwd = process.cwd()) {
4291
+ const allClasses = /* @__PURE__ */ new Set();
4292
+ for (const dir of scanDirs) {
4293
+ const absDir = path7__default.default.isAbsolute(dir) ? dir : path7__default.default.resolve(cwd, dir);
4294
+ const files = scanDir(absDir);
4295
+ for (const file of files) {
4296
+ try {
4297
+ const source = fs3__default.default.readFileSync(file, "utf-8");
4298
+ const classes = extractAllClasses(source);
4299
+ classes.forEach((c) => allClasses.add(c));
4300
+ } catch {
4301
+ }
4302
+ }
4303
+ }
4304
+ const sorted = Array.from(allClasses).sort();
4305
+ const absOutput = path7__default.default.isAbsolute(outputPath) ? outputPath : path7__default.default.resolve(cwd, outputPath);
4306
+ fs3__default.default.mkdirSync(path7__default.default.dirname(absOutput), { recursive: true });
4307
+ const css = sorted.length > 0 ? `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
4308
+ @source inline("${sorted.join(" ")}");
4309
+ ` : `/* Auto-generated by tailwind-styled-v4 \u2014 DO NOT EDIT */
4310
+ /* No safelist classes found */
4311
+ `;
4312
+ fs3__default.default.writeFileSync(absOutput, css);
4313
+ console.log(`[tailwind-styled-v4] Safelist: ${sorted.length} classes \u2192 ${absOutput}`);
4314
+ return sorted;
4315
+ }
3389
4316
  async function generateCssForClasses(classes, config, cwd = process.cwd()) {
3390
- const twConfig = config != null ? config : loadTailwindConfig(cwd);
3391
4317
  try {
3392
- return await generateViaTailwindV4(classes, twConfig, cwd);
3393
- } catch (e) {
4318
+ const { compileCssFromClasses: compileCssFromClasses2 } = (init_cssCompiler(), __toCommonJS(cssCompiler_exports));
4319
+ const result = compileCssFromClasses2(classes);
4320
+ if (result?.css && result.resolvedClasses.length > 0) {
4321
+ const resolveRate = result.resolvedClasses.length / classes.length;
4322
+ if (resolveRate >= 0.5) return result.css;
4323
+ }
4324
+ } catch {
3394
4325
  }
4326
+ const twConfig = config ?? loadTailwindConfig(cwd);
3395
4327
  try {
3396
- return await generateViaTailwindV3(classes, twConfig);
3397
- } catch (e) {
4328
+ return await generateViaTailwindV4(classes, twConfig, cwd);
4329
+ } catch {
3398
4330
  }
3399
4331
  return generateManualCss(classes);
3400
4332
  }
@@ -3412,26 +4344,10 @@ async function generateViaTailwindV4(classes, _config, cwd) {
3412
4344
  optimize: { minify: false }
3413
4345
  })
3414
4346
  ]).process(virtualCss, {
3415
- from: path4.join(cwd, "virtual.css")
4347
+ from: path7__default.default.join(cwd, "virtual.css")
3416
4348
  });
3417
4349
  return filterCssForClasses(result.css, classes);
3418
4350
  }
3419
- async function generateViaTailwindV3(classes, config) {
3420
- const postcss = __require("postcss");
3421
- const tailwindcss = __require("tailwindcss");
3422
- const virtualContent = classes.map((c) => `<div class="${c}">`).join("\n");
3423
- const twConfigWithContent = __spreadProps(__spreadValues({}, config), {
3424
- content: [{ raw: virtualContent, extension: "html" }],
3425
- safelist: classes
3426
- });
3427
- const inputCss = `@tailwind base;
3428
- @tailwind components;
3429
- @tailwind utilities;`;
3430
- const result = await postcss([tailwindcss(twConfigWithContent)]).process(inputCss, {
3431
- from: void 0
3432
- });
3433
- return result.css;
3434
- }
3435
4351
  function generateManualCss(classes) {
3436
4352
  const { generateAtomicCss: generateAtomicCss2, parseAtomicClass: parseAtomicClass2 } = (init_atomicCss(), __toCommonJS(atomicCss_exports));
3437
4353
  const rules = classes.map((c) => parseAtomicClass2(c)).filter(Boolean);
@@ -3481,7 +4397,7 @@ async function generateAllRouteCss(opts = {}) {
3481
4397
  const { cwd = process.cwd(), outputDir, config, minify = true } = opts;
3482
4398
  const results = [];
3483
4399
  const routes = getAllRoutes();
3484
- const twConfig = config != null ? config : loadTailwindConfig(cwd);
4400
+ const twConfig = config ?? loadTailwindConfig(cwd);
3485
4401
  for (const route of routes) {
3486
4402
  const classes = Array.from(getRouteClasses(route));
3487
4403
  if (classes.length === 0) continue;
@@ -3501,13 +4417,13 @@ async function generateAllRouteCss(opts = {}) {
3501
4417
  }
3502
4418
  }
3503
4419
  if (outputDir) {
3504
- const fs5 = __require("fs");
3505
- fs5.mkdirSync(outputDir, { recursive: true });
4420
+ const fs6 = __require("fs");
4421
+ fs6.mkdirSync(outputDir, { recursive: true });
3506
4422
  for (const result of results) {
3507
4423
  const filename = routeToFilename(result.route);
3508
- const filepath = path4.join(outputDir, filename);
3509
- fs5.mkdirSync(path4.dirname(filepath), { recursive: true });
3510
- fs5.writeFileSync(filepath, result.css);
4424
+ const filepath = path7__default.default.join(outputDir, filename);
4425
+ fs6.mkdirSync(path7__default.default.dirname(filepath), { recursive: true });
4426
+ fs6.writeFileSync(filepath, result.css);
3511
4427
  }
3512
4428
  const totalSize = results.reduce((sum, r) => sum + r.sizeBytes, 0);
3513
4429
  console.log(
@@ -3530,6 +4446,73 @@ function formatBytes(bytes) {
3530
4446
  return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
3531
4447
  }
3532
4448
 
3533
- export { BucketEngine, IncrementalEngine, analyzeFile, analyzeVariantUsage, bootstrapZeroConfig, bucketSort, classifyNode, clearAtomicRegistry, compileVariants, detectConflicts, extractAllClasses, extractComponentUsage, fileToRoute, generateAllRouteCss, generateAtomicCss, generateCssForClasses, generateSafelist, generateSafelistCss, getAllRoutes, getAtomicRegistry, getBucketEngine, getCollector, getCollectorSummary, getContentPaths, getIncrementalEngine, getRouteClasses, hasInteractiveFeatures, hasTwUsage, hoistComponents, injectClientDirective, injectServerOnlyComment, invalidateConfigCache, isDynamic, isServerComponent, isZeroConfig, loadSafelist, loadTailwindConfig, mergeClassesStatic, normalizeClasses, parseAtomicClass, parseClassesToNodes, registerFileClasses, registerGlobalClasses, resetBucketEngine, resetCollector, resetIncrementalEngine, resolveServerVariant, runElimination, scanProjectUsage, hasTwUsage as shouldProcess, toAtomicClasses, transformSource };
4449
+ exports.BucketEngine = BucketEngine;
4450
+ exports.CompileContext = CompileContext;
4451
+ exports.IncrementalEngine = IncrementalEngine;
4452
+ exports.Pipeline = Pipeline;
4453
+ exports.adaptNativeResult = adaptNativeResult;
4454
+ exports.analyzeFile = analyzeFile;
4455
+ exports.analyzeVariantUsage = analyzeVariantUsage;
4456
+ exports.astExtractClassesNative = astExtractClassesNative;
4457
+ exports.bootstrapZeroConfig = bootstrapZeroConfig;
4458
+ exports.bucketSort = bucketSort;
4459
+ exports.buildStyleTag = buildStyleTag;
4460
+ exports.classifyNode = classifyNode;
4461
+ exports.clearAtomicRegistry = clearAtomicRegistry;
4462
+ exports.compileCssFromClasses = compileCssFromClasses;
4463
+ exports.compileCssNative = compileCssNative;
4464
+ exports.compileVariants = compileVariants;
4465
+ exports.compileWithCore = compileWithCore;
4466
+ exports.detectConflicts = detectConflicts;
4467
+ exports.eliminateDeadCss = eliminateDeadCss;
4468
+ exports.extractAllClasses = extractAllClasses;
4469
+ exports.extractComponentUsage = extractComponentUsage;
4470
+ exports.fileToRoute = fileToRoute;
4471
+ exports.findDeadVariants = findDeadVariants;
4472
+ exports.generateAllRouteCss = generateAllRouteCss;
4473
+ exports.generateAtomicCss = generateAtomicCss;
4474
+ exports.generateCssForClasses = generateCssForClasses;
4475
+ exports.generateSafelist = generateSafelist;
4476
+ exports.generateSafelistCss = generateSafelistCss;
4477
+ exports.getAllRoutes = getAllRoutes;
4478
+ exports.getAtomicRegistry = getAtomicRegistry;
4479
+ exports.getBucketEngine = getBucketEngine;
4480
+ exports.getCollector = getCollector;
4481
+ exports.getCollectorSummary = getCollectorSummary;
4482
+ exports.getContentPaths = getContentPaths;
4483
+ exports.getIncrementalEngine = getIncrementalEngine;
4484
+ exports.getNativeBridge = getNativeBridge;
4485
+ exports.getRouteClasses = getRouteClasses;
4486
+ exports.hasInteractiveFeatures = hasInteractiveFeatures;
4487
+ exports.hasTwUsage = hasTwUsage;
4488
+ exports.hoistComponents = hoistComponents;
4489
+ exports.injectClientDirective = injectClientDirective;
4490
+ exports.injectServerOnlyComment = injectServerOnlyComment;
4491
+ exports.invalidateConfigCache = invalidateConfigCache;
4492
+ exports.isDynamic = isDynamic;
4493
+ exports.isServerComponent = isServerComponent;
4494
+ exports.isZeroConfig = isZeroConfig;
4495
+ exports.loadSafelist = loadSafelist;
4496
+ exports.loadTailwindConfig = loadTailwindConfig;
4497
+ exports.mergeClassesStatic = mergeClassesStatic;
4498
+ exports.normalizeClasses = normalizeClasses;
4499
+ exports.optimizeCss = optimizeCss;
4500
+ exports.parseAtomicClass = parseAtomicClass;
4501
+ exports.parseClassesToNodes = parseClassesToNodes;
4502
+ exports.registerFileClasses = registerFileClasses;
4503
+ exports.registerGlobalClasses = registerGlobalClasses;
4504
+ exports.resetBucketEngine = resetBucketEngine;
4505
+ exports.resetCollector = resetCollector;
4506
+ exports.resetCompileCache = resetCompileCache;
4507
+ exports.resetIncrementalEngine = resetIncrementalEngine;
4508
+ exports.resetNativeBridgeCache = resetNativeBridgeCache;
4509
+ exports.resolveServerVariant = resolveServerVariant;
4510
+ exports.runElimination = runElimination;
4511
+ exports.runLoaderTransform = runLoaderTransform;
4512
+ exports.scanProjectUsage = scanProjectUsage;
4513
+ exports.shouldProcess = hasTwUsage;
4514
+ exports.shouldSkipFile = shouldSkipFile;
4515
+ exports.toAtomicClasses = toAtomicClasses;
4516
+ exports.transformSource = transformSource;
3534
4517
  //# sourceMappingURL=compiler.js.map
3535
4518
  //# sourceMappingURL=compiler.js.map