@tailwind-styled/next 2.0.0

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.
@@ -0,0 +1,2711 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __typeError = (msg) => {
13
+ throw TypeError(msg);
14
+ };
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __spreadValues = (a, b) => {
17
+ for (var prop in b || (b = {}))
18
+ if (__hasOwnProp.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ if (__getOwnPropSymbols)
21
+ for (var prop of __getOwnPropSymbols(b)) {
22
+ if (__propIsEnum.call(b, prop))
23
+ __defNormalProp(a, prop, b[prop]);
24
+ }
25
+ return a;
26
+ };
27
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
+ var __esm = (fn, res) => function __init() {
29
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
30
+ };
31
+ var __export = (target, all) => {
32
+ for (var name in all)
33
+ __defProp(target, name, { get: all[name], enumerable: true });
34
+ };
35
+ var __copyProps = (to, from, except, desc) => {
36
+ if (from && typeof from === "object" || typeof from === "function") {
37
+ for (let key of __getOwnPropNames(from))
38
+ if (!__hasOwnProp.call(to, key) && key !== except)
39
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
40
+ }
41
+ return to;
42
+ };
43
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
44
+ // If the importer is in node compatibility mode or this is not an ESM
45
+ // file that has been converted to a CommonJS file using a Babel-
46
+ // compatible transform (i.e. "__esModule" has not been set), then set
47
+ // "default" to the CommonJS "module.exports" for node compatibility.
48
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
49
+ mod
50
+ ));
51
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
52
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
53
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
54
+ 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);
55
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
56
+
57
+ // ../../node_modules/oxc-parser/src-js/bindings.js
58
+ function requireNative() {
59
+ var _a2, _b2, _c, _d;
60
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
61
+ try {
62
+ return require2(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
63
+ } catch (err) {
64
+ loadErrors.push(err);
65
+ }
66
+ } else if (process.platform === "android") {
67
+ if (process.arch === "arm64") {
68
+ try {
69
+ return require2("./parser.android-arm64.node");
70
+ } catch (e) {
71
+ loadErrors.push(e);
72
+ }
73
+ try {
74
+ const binding = require2("@oxc-parser/binding-android-arm64");
75
+ 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.`);
78
+ }
79
+ return binding;
80
+ } catch (e) {
81
+ loadErrors.push(e);
82
+ }
83
+ } else if (process.arch === "arm") {
84
+ try {
85
+ return require2("./parser.android-arm-eabi.node");
86
+ } catch (e) {
87
+ loadErrors.push(e);
88
+ }
89
+ try {
90
+ const binding = require2("@oxc-parser/binding-android-arm-eabi");
91
+ 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.`);
94
+ }
95
+ return binding;
96
+ } catch (e) {
97
+ loadErrors.push(e);
98
+ }
99
+ } else {
100
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
101
+ }
102
+ } else if (process.platform === "win32") {
103
+ 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") {
105
+ try {
106
+ return require2("./parser.win32-x64-gnu.node");
107
+ } catch (e) {
108
+ loadErrors.push(e);
109
+ }
110
+ try {
111
+ const binding = require2("@oxc-parser/binding-win32-x64-gnu");
112
+ 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.`);
115
+ }
116
+ return binding;
117
+ } catch (e) {
118
+ loadErrors.push(e);
119
+ }
120
+ } else {
121
+ try {
122
+ return require2("./parser.win32-x64-msvc.node");
123
+ } catch (e) {
124
+ loadErrors.push(e);
125
+ }
126
+ try {
127
+ const binding = require2("@oxc-parser/binding-win32-x64-msvc");
128
+ 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.`);
131
+ }
132
+ return binding;
133
+ } catch (e) {
134
+ loadErrors.push(e);
135
+ }
136
+ }
137
+ } else if (process.arch === "ia32") {
138
+ try {
139
+ return require2("./parser.win32-ia32-msvc.node");
140
+ } catch (e) {
141
+ loadErrors.push(e);
142
+ }
143
+ try {
144
+ const binding = require2("@oxc-parser/binding-win32-ia32-msvc");
145
+ 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.`);
148
+ }
149
+ return binding;
150
+ } catch (e) {
151
+ loadErrors.push(e);
152
+ }
153
+ } else if (process.arch === "arm64") {
154
+ try {
155
+ return require2("./parser.win32-arm64-msvc.node");
156
+ } catch (e) {
157
+ loadErrors.push(e);
158
+ }
159
+ try {
160
+ const binding = require2("@oxc-parser/binding-win32-arm64-msvc");
161
+ 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.`);
164
+ }
165
+ return binding;
166
+ } catch (e) {
167
+ loadErrors.push(e);
168
+ }
169
+ } else {
170
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
171
+ }
172
+ } else if (process.platform === "darwin") {
173
+ try {
174
+ return require2("./parser.darwin-universal.node");
175
+ } catch (e) {
176
+ loadErrors.push(e);
177
+ }
178
+ try {
179
+ const binding = require2("@oxc-parser/binding-darwin-universal");
180
+ 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.`);
183
+ }
184
+ return binding;
185
+ } catch (e) {
186
+ loadErrors.push(e);
187
+ }
188
+ if (process.arch === "x64") {
189
+ try {
190
+ return require2("./parser.darwin-x64.node");
191
+ } catch (e) {
192
+ loadErrors.push(e);
193
+ }
194
+ try {
195
+ const binding = require2("@oxc-parser/binding-darwin-x64");
196
+ 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.`);
199
+ }
200
+ return binding;
201
+ } catch (e) {
202
+ loadErrors.push(e);
203
+ }
204
+ } else if (process.arch === "arm64") {
205
+ try {
206
+ return require2("./parser.darwin-arm64.node");
207
+ } catch (e) {
208
+ loadErrors.push(e);
209
+ }
210
+ try {
211
+ const binding = require2("@oxc-parser/binding-darwin-arm64");
212
+ 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.`);
215
+ }
216
+ return binding;
217
+ } catch (e) {
218
+ loadErrors.push(e);
219
+ }
220
+ } else {
221
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
222
+ }
223
+ } else if (process.platform === "freebsd") {
224
+ if (process.arch === "x64") {
225
+ try {
226
+ return require2("./parser.freebsd-x64.node");
227
+ } catch (e) {
228
+ loadErrors.push(e);
229
+ }
230
+ try {
231
+ const binding = require2("@oxc-parser/binding-freebsd-x64");
232
+ 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.`);
235
+ }
236
+ return binding;
237
+ } catch (e) {
238
+ loadErrors.push(e);
239
+ }
240
+ } else if (process.arch === "arm64") {
241
+ try {
242
+ return require2("./parser.freebsd-arm64.node");
243
+ } catch (e) {
244
+ loadErrors.push(e);
245
+ }
246
+ try {
247
+ const binding = require2("@oxc-parser/binding-freebsd-arm64");
248
+ 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.`);
251
+ }
252
+ return binding;
253
+ } catch (e) {
254
+ loadErrors.push(e);
255
+ }
256
+ } else {
257
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
258
+ }
259
+ } else if (process.platform === "linux") {
260
+ if (process.arch === "x64") {
261
+ if (isMusl()) {
262
+ try {
263
+ return require2("./parser.linux-x64-musl.node");
264
+ } catch (e) {
265
+ loadErrors.push(e);
266
+ }
267
+ try {
268
+ const binding = require2("@oxc-parser/binding-linux-x64-musl");
269
+ 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.`);
272
+ }
273
+ return binding;
274
+ } catch (e) {
275
+ loadErrors.push(e);
276
+ }
277
+ } else {
278
+ try {
279
+ return require2("./parser.linux-x64-gnu.node");
280
+ } catch (e) {
281
+ loadErrors.push(e);
282
+ }
283
+ try {
284
+ const binding = require2("@oxc-parser/binding-linux-x64-gnu");
285
+ 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.`);
288
+ }
289
+ return binding;
290
+ } catch (e) {
291
+ loadErrors.push(e);
292
+ }
293
+ }
294
+ } else if (process.arch === "arm64") {
295
+ if (isMusl()) {
296
+ try {
297
+ return require2("./parser.linux-arm64-musl.node");
298
+ } catch (e) {
299
+ loadErrors.push(e);
300
+ }
301
+ try {
302
+ const binding = require2("@oxc-parser/binding-linux-arm64-musl");
303
+ 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.`);
306
+ }
307
+ return binding;
308
+ } catch (e) {
309
+ loadErrors.push(e);
310
+ }
311
+ } else {
312
+ try {
313
+ return require2("./parser.linux-arm64-gnu.node");
314
+ } catch (e) {
315
+ loadErrors.push(e);
316
+ }
317
+ try {
318
+ const binding = require2("@oxc-parser/binding-linux-arm64-gnu");
319
+ 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.`);
322
+ }
323
+ return binding;
324
+ } catch (e) {
325
+ loadErrors.push(e);
326
+ }
327
+ }
328
+ } else if (process.arch === "arm") {
329
+ if (isMusl()) {
330
+ try {
331
+ return require2("./parser.linux-arm-musleabihf.node");
332
+ } catch (e) {
333
+ loadErrors.push(e);
334
+ }
335
+ try {
336
+ const binding = require2("@oxc-parser/binding-linux-arm-musleabihf");
337
+ 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.`);
340
+ }
341
+ return binding;
342
+ } catch (e) {
343
+ loadErrors.push(e);
344
+ }
345
+ } else {
346
+ try {
347
+ return require2("./parser.linux-arm-gnueabihf.node");
348
+ } catch (e) {
349
+ loadErrors.push(e);
350
+ }
351
+ try {
352
+ const binding = require2("@oxc-parser/binding-linux-arm-gnueabihf");
353
+ 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.`);
356
+ }
357
+ return binding;
358
+ } catch (e) {
359
+ loadErrors.push(e);
360
+ }
361
+ }
362
+ } else if (process.arch === "loong64") {
363
+ if (isMusl()) {
364
+ try {
365
+ return require2("./parser.linux-loong64-musl.node");
366
+ } catch (e) {
367
+ loadErrors.push(e);
368
+ }
369
+ try {
370
+ const binding = require2("@oxc-parser/binding-linux-loong64-musl");
371
+ 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.`);
374
+ }
375
+ return binding;
376
+ } catch (e) {
377
+ loadErrors.push(e);
378
+ }
379
+ } else {
380
+ try {
381
+ return require2("./parser.linux-loong64-gnu.node");
382
+ } catch (e) {
383
+ loadErrors.push(e);
384
+ }
385
+ try {
386
+ const binding = require2("@oxc-parser/binding-linux-loong64-gnu");
387
+ 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.`);
390
+ }
391
+ return binding;
392
+ } catch (e) {
393
+ loadErrors.push(e);
394
+ }
395
+ }
396
+ } else if (process.arch === "riscv64") {
397
+ if (isMusl()) {
398
+ try {
399
+ return require2("./parser.linux-riscv64-musl.node");
400
+ } catch (e) {
401
+ loadErrors.push(e);
402
+ }
403
+ try {
404
+ const binding = require2("@oxc-parser/binding-linux-riscv64-musl");
405
+ 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.`);
408
+ }
409
+ return binding;
410
+ } catch (e) {
411
+ loadErrors.push(e);
412
+ }
413
+ } else {
414
+ try {
415
+ return require2("./parser.linux-riscv64-gnu.node");
416
+ } catch (e) {
417
+ loadErrors.push(e);
418
+ }
419
+ try {
420
+ const binding = require2("@oxc-parser/binding-linux-riscv64-gnu");
421
+ 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.`);
424
+ }
425
+ return binding;
426
+ } catch (e) {
427
+ loadErrors.push(e);
428
+ }
429
+ }
430
+ } else if (process.arch === "ppc64") {
431
+ try {
432
+ return require2("./parser.linux-ppc64-gnu.node");
433
+ } catch (e) {
434
+ loadErrors.push(e);
435
+ }
436
+ try {
437
+ const binding = require2("@oxc-parser/binding-linux-ppc64-gnu");
438
+ 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.`);
441
+ }
442
+ return binding;
443
+ } catch (e) {
444
+ loadErrors.push(e);
445
+ }
446
+ } else if (process.arch === "s390x") {
447
+ try {
448
+ return require2("./parser.linux-s390x-gnu.node");
449
+ } catch (e) {
450
+ loadErrors.push(e);
451
+ }
452
+ try {
453
+ const binding = require2("@oxc-parser/binding-linux-s390x-gnu");
454
+ 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.`);
457
+ }
458
+ return binding;
459
+ } catch (e) {
460
+ loadErrors.push(e);
461
+ }
462
+ } else {
463
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
464
+ }
465
+ } else if (process.platform === "openharmony") {
466
+ if (process.arch === "arm64") {
467
+ try {
468
+ return require2("./parser.openharmony-arm64.node");
469
+ } catch (e) {
470
+ loadErrors.push(e);
471
+ }
472
+ try {
473
+ const binding = require2("@oxc-parser/binding-openharmony-arm64");
474
+ 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.`);
477
+ }
478
+ return binding;
479
+ } catch (e) {
480
+ loadErrors.push(e);
481
+ }
482
+ } else if (process.arch === "x64") {
483
+ try {
484
+ return require2("./parser.openharmony-x64.node");
485
+ } catch (e) {
486
+ loadErrors.push(e);
487
+ }
488
+ try {
489
+ const binding = require2("@oxc-parser/binding-openharmony-x64");
490
+ 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.`);
493
+ }
494
+ return binding;
495
+ } catch (e) {
496
+ loadErrors.push(e);
497
+ }
498
+ } else if (process.arch === "arm") {
499
+ try {
500
+ return require2("./parser.openharmony-arm.node");
501
+ } catch (e) {
502
+ loadErrors.push(e);
503
+ }
504
+ try {
505
+ const binding = require2("@oxc-parser/binding-openharmony-arm");
506
+ 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.`);
509
+ }
510
+ return binding;
511
+ } catch (e) {
512
+ loadErrors.push(e);
513
+ }
514
+ } else {
515
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
516
+ }
517
+ } else {
518
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
519
+ }
520
+ }
521
+ var import_node_module, import_meta, require2, __dirname, readFileSync, nativeBinding, loadErrors, isMusl, isFileMusl, isMuslFromFilesystem, isMuslFromReport, isMuslFromChildProcess, _a, _b, Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse, parseSync, rawTransferSupported, getBufferOffset, parseRaw, parseRawSync;
522
+ var init_bindings = __esm({
523
+ "../../node_modules/oxc-parser/src-js/bindings.js"() {
524
+ "use strict";
525
+ import_node_module = require("module");
526
+ import_meta = {};
527
+ require2 = (0, import_node_module.createRequire)(import_meta.url);
528
+ __dirname = new URL(".", import_meta.url).pathname;
529
+ ({ readFileSync } = require2("node:fs"));
530
+ nativeBinding = null;
531
+ loadErrors = [];
532
+ isMusl = () => {
533
+ let musl = false;
534
+ if (process.platform === "linux") {
535
+ musl = isMuslFromFilesystem();
536
+ if (musl === null) {
537
+ musl = isMuslFromReport();
538
+ }
539
+ if (musl === null) {
540
+ musl = isMuslFromChildProcess();
541
+ }
542
+ }
543
+ return musl;
544
+ };
545
+ isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
546
+ isMuslFromFilesystem = () => {
547
+ try {
548
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
549
+ } catch (e) {
550
+ return null;
551
+ }
552
+ };
553
+ isMuslFromReport = () => {
554
+ var _a2;
555
+ let report = null;
556
+ if (typeof ((_a2 = process.report) == null ? void 0 : _a2.getReport) === "function") {
557
+ process.report.excludeNetwork = true;
558
+ report = process.report.getReport();
559
+ }
560
+ if (!report) {
561
+ return null;
562
+ }
563
+ if (report.header && report.header.glibcVersionRuntime) {
564
+ return false;
565
+ }
566
+ if (Array.isArray(report.sharedObjects)) {
567
+ if (report.sharedObjects.some(isFileMusl)) {
568
+ return true;
569
+ }
570
+ }
571
+ return false;
572
+ };
573
+ isMuslFromChildProcess = () => {
574
+ try {
575
+ return require2("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
576
+ } catch (e) {
577
+ return false;
578
+ }
579
+ };
580
+ nativeBinding = requireNative();
581
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
582
+ let wasiBinding = null;
583
+ let wasiBindingError = null;
584
+ try {
585
+ wasiBinding = require2("./parser.wasi.cjs");
586
+ nativeBinding = wasiBinding;
587
+ } catch (err) {
588
+ if (process.env.NAPI_RS_FORCE_WASI) {
589
+ wasiBindingError = err;
590
+ }
591
+ }
592
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
593
+ try {
594
+ wasiBinding = require2("@oxc-parser/binding-wasm32-wasi");
595
+ nativeBinding = wasiBinding;
596
+ } catch (err) {
597
+ if (process.env.NAPI_RS_FORCE_WASI) {
598
+ if (!wasiBindingError) {
599
+ wasiBindingError = err;
600
+ } else {
601
+ wasiBindingError.cause = err;
602
+ }
603
+ loadErrors.push(err);
604
+ }
605
+ }
606
+ }
607
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
608
+ const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
609
+ error.cause = wasiBindingError;
610
+ throw error;
611
+ }
612
+ }
613
+ if (!nativeBinding && ((_b = (_a = globalThis.process) == null ? void 0 : _a.versions) == null ? void 0 : _b["webcontainer"])) {
614
+ try {
615
+ nativeBinding = require2("./webcontainer-fallback.cjs");
616
+ } catch (err) {
617
+ loadErrors.push(err);
618
+ }
619
+ }
620
+ if (!nativeBinding) {
621
+ if (loadErrors.length > 0) {
622
+ throw new Error(
623
+ `Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try \`npm i\` again after removing both package-lock.json and node_modules directory.`,
624
+ {
625
+ cause: loadErrors.reduce((err, cur) => {
626
+ cur.cause = err;
627
+ return cur;
628
+ })
629
+ }
630
+ );
631
+ }
632
+ throw new Error(`Failed to load native binding`);
633
+ }
634
+ ({ Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse, parseSync, rawTransferSupported } = nativeBinding);
635
+ ({ getBufferOffset, parseRaw, parseRawSync } = nativeBinding);
636
+ }
637
+ });
638
+
639
+ // ../../node_modules/oxc-parser/src-js/wrap.js
640
+ function wrap(result) {
641
+ let program, module2, comments, errors;
642
+ return {
643
+ get program() {
644
+ if (!program) program = jsonParseAst(result.program);
645
+ return program;
646
+ },
647
+ get module() {
648
+ if (!module2) module2 = result.module;
649
+ return module2;
650
+ },
651
+ get comments() {
652
+ if (!comments) comments = result.comments;
653
+ return comments;
654
+ },
655
+ get errors() {
656
+ if (!errors) errors = result.errors;
657
+ return errors;
658
+ }
659
+ };
660
+ }
661
+ function jsonParseAst(programJson) {
662
+ const { node: program, fixes } = JSON.parse(programJson);
663
+ for (const fixPath of fixes) {
664
+ applyFix(program, fixPath);
665
+ }
666
+ return program;
667
+ }
668
+ function applyFix(program, fixPath) {
669
+ let node = program;
670
+ for (const key of fixPath) {
671
+ node = node[key];
672
+ }
673
+ if (node.bigint) {
674
+ node.value = BigInt(node.bigint);
675
+ } else {
676
+ try {
677
+ node.value = RegExp(node.regex.pattern, node.regex.flags);
678
+ } catch (e) {
679
+ }
680
+ }
681
+ }
682
+ var init_wrap = __esm({
683
+ "../../node_modules/oxc-parser/src-js/wrap.js"() {
684
+ "use strict";
685
+ }
686
+ });
687
+
688
+ // ../../node_modules/oxc-parser/src-js/generated/visit/keys.js
689
+ 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;
690
+ var init_keys = __esm({
691
+ "../../node_modules/oxc-parser/src-js/generated/visit/keys.js"() {
692
+ "use strict";
693
+ ({ freeze } = Object);
694
+ $EMPTY = freeze([]);
695
+ DECORATORS__KEY__TYPE_ANNOTATION__VALUE = freeze([
696
+ "decorators",
697
+ "key",
698
+ "typeAnnotation",
699
+ "value"
700
+ ]);
701
+ LEFT__RIGHT = freeze(["left", "right"]);
702
+ ARGUMENT = freeze(["argument"]);
703
+ BODY = freeze(["body"]);
704
+ LABEL = freeze(["label"]);
705
+ CALLEE__TYPE_ARGUMENTS__ARGUMENTS = freeze(["callee", "typeArguments", "arguments"]);
706
+ EXPRESSION = freeze(["expression"]);
707
+ DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY = freeze([
708
+ "decorators",
709
+ "id",
710
+ "typeParameters",
711
+ "superClass",
712
+ "superTypeArguments",
713
+ "implements",
714
+ "body"
715
+ ]);
716
+ TEST__CONSEQUENT__ALTERNATE = freeze(["test", "consequent", "alternate"]);
717
+ LEFT__RIGHT__BODY = freeze(["left", "right", "body"]);
718
+ ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY = freeze([
719
+ "id",
720
+ "typeParameters",
721
+ "params",
722
+ "returnType",
723
+ "body"
724
+ ]);
725
+ KEY__VALUE = freeze(["key", "value"]);
726
+ LOCAL = freeze(["local"]);
727
+ OBJECT__PROPERTY = freeze(["object", "property"]);
728
+ DECORATORS__KEY__TYPE_ANNOTATION = freeze(["decorators", "key", "typeAnnotation"]);
729
+ EXPRESSION__TYPE_ANNOTATION = freeze(["expression", "typeAnnotation"]);
730
+ TYPE_PARAMETERS__PARAMS__RETURN_TYPE = freeze(["typeParameters", "params", "returnType"]);
731
+ EXPRESSION__TYPE_ARGUMENTS = freeze(["expression", "typeArguments"]);
732
+ MEMBERS = freeze(["members"]);
733
+ ID__BODY = freeze(["id", "body"]);
734
+ TYPES = freeze(["types"]);
735
+ TYPE_ANNOTATION = freeze(["typeAnnotation"]);
736
+ PARAMS = freeze(["params"]);
737
+ keys_default = freeze({
738
+ // Leaf nodes
739
+ DebuggerStatement: $EMPTY,
740
+ EmptyStatement: $EMPTY,
741
+ Literal: $EMPTY,
742
+ PrivateIdentifier: $EMPTY,
743
+ Super: $EMPTY,
744
+ TemplateElement: $EMPTY,
745
+ ThisExpression: $EMPTY,
746
+ JSXClosingFragment: $EMPTY,
747
+ JSXEmptyExpression: $EMPTY,
748
+ JSXIdentifier: $EMPTY,
749
+ JSXOpeningFragment: $EMPTY,
750
+ JSXText: $EMPTY,
751
+ TSAnyKeyword: $EMPTY,
752
+ TSBigIntKeyword: $EMPTY,
753
+ TSBooleanKeyword: $EMPTY,
754
+ TSIntrinsicKeyword: $EMPTY,
755
+ TSJSDocUnknownType: $EMPTY,
756
+ TSNeverKeyword: $EMPTY,
757
+ TSNullKeyword: $EMPTY,
758
+ TSNumberKeyword: $EMPTY,
759
+ TSObjectKeyword: $EMPTY,
760
+ TSStringKeyword: $EMPTY,
761
+ TSSymbolKeyword: $EMPTY,
762
+ TSThisType: $EMPTY,
763
+ TSUndefinedKeyword: $EMPTY,
764
+ TSUnknownKeyword: $EMPTY,
765
+ TSVoidKeyword: $EMPTY,
766
+ // Non-leaf nodes
767
+ AccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
768
+ ArrayExpression: freeze(["elements"]),
769
+ ArrayPattern: freeze(["decorators", "elements", "typeAnnotation"]),
770
+ ArrowFunctionExpression: freeze(["typeParameters", "params", "returnType", "body"]),
771
+ AssignmentExpression: LEFT__RIGHT,
772
+ AssignmentPattern: freeze(["decorators", "left", "right", "typeAnnotation"]),
773
+ AwaitExpression: ARGUMENT,
774
+ BinaryExpression: LEFT__RIGHT,
775
+ BlockStatement: BODY,
776
+ BreakStatement: LABEL,
777
+ CallExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
778
+ CatchClause: freeze(["param", "body"]),
779
+ ChainExpression: EXPRESSION,
780
+ ClassBody: BODY,
781
+ ClassDeclaration: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
782
+ ClassExpression: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
783
+ ConditionalExpression: TEST__CONSEQUENT__ALTERNATE,
784
+ ContinueStatement: LABEL,
785
+ Decorator: EXPRESSION,
786
+ DoWhileStatement: freeze(["body", "test"]),
787
+ ExportAllDeclaration: freeze(["exported", "source", "attributes"]),
788
+ ExportDefaultDeclaration: freeze(["declaration"]),
789
+ ExportNamedDeclaration: freeze(["declaration", "specifiers", "source", "attributes"]),
790
+ ExportSpecifier: freeze(["local", "exported"]),
791
+ ExpressionStatement: EXPRESSION,
792
+ ForInStatement: LEFT__RIGHT__BODY,
793
+ ForOfStatement: LEFT__RIGHT__BODY,
794
+ ForStatement: freeze(["init", "test", "update", "body"]),
795
+ FunctionDeclaration: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
796
+ FunctionExpression: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
797
+ Identifier: freeze(["decorators", "typeAnnotation"]),
798
+ IfStatement: TEST__CONSEQUENT__ALTERNATE,
799
+ ImportAttribute: KEY__VALUE,
800
+ ImportDeclaration: freeze(["specifiers", "source", "attributes"]),
801
+ ImportDefaultSpecifier: LOCAL,
802
+ ImportExpression: freeze(["source", "options"]),
803
+ ImportNamespaceSpecifier: LOCAL,
804
+ ImportSpecifier: freeze(["imported", "local"]),
805
+ LabeledStatement: freeze(["label", "body"]),
806
+ LogicalExpression: LEFT__RIGHT,
807
+ MemberExpression: OBJECT__PROPERTY,
808
+ MetaProperty: freeze(["meta", "property"]),
809
+ MethodDefinition: freeze(["decorators", "key", "value"]),
810
+ NewExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
811
+ ObjectExpression: freeze(["properties"]),
812
+ ObjectPattern: freeze(["decorators", "properties", "typeAnnotation"]),
813
+ ParenthesizedExpression: EXPRESSION,
814
+ Program: BODY,
815
+ Property: KEY__VALUE,
816
+ PropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
817
+ RestElement: freeze(["decorators", "argument", "typeAnnotation"]),
818
+ ReturnStatement: ARGUMENT,
819
+ SequenceExpression: freeze(["expressions"]),
820
+ SpreadElement: ARGUMENT,
821
+ StaticBlock: BODY,
822
+ SwitchCase: freeze(["test", "consequent"]),
823
+ SwitchStatement: freeze(["discriminant", "cases"]),
824
+ TaggedTemplateExpression: freeze(["tag", "typeArguments", "quasi"]),
825
+ TemplateLiteral: freeze(["quasis", "expressions"]),
826
+ ThrowStatement: ARGUMENT,
827
+ TryStatement: freeze(["block", "handler", "finalizer"]),
828
+ UnaryExpression: ARGUMENT,
829
+ UpdateExpression: ARGUMENT,
830
+ V8IntrinsicExpression: freeze(["name", "arguments"]),
831
+ VariableDeclaration: freeze(["declarations"]),
832
+ VariableDeclarator: freeze(["id", "init"]),
833
+ WhileStatement: freeze(["test", "body"]),
834
+ WithStatement: freeze(["object", "body"]),
835
+ YieldExpression: ARGUMENT,
836
+ JSXAttribute: freeze(["name", "value"]),
837
+ JSXClosingElement: freeze(["name"]),
838
+ JSXElement: freeze(["openingElement", "children", "closingElement"]),
839
+ JSXExpressionContainer: EXPRESSION,
840
+ JSXFragment: freeze(["openingFragment", "children", "closingFragment"]),
841
+ JSXMemberExpression: OBJECT__PROPERTY,
842
+ JSXNamespacedName: freeze(["namespace", "name"]),
843
+ JSXOpeningElement: freeze(["name", "typeArguments", "attributes"]),
844
+ JSXSpreadAttribute: ARGUMENT,
845
+ JSXSpreadChild: EXPRESSION,
846
+ TSAbstractAccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION,
847
+ TSAbstractMethodDefinition: KEY__VALUE,
848
+ TSAbstractPropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION,
849
+ TSArrayType: freeze(["elementType"]),
850
+ TSAsExpression: EXPRESSION__TYPE_ANNOTATION,
851
+ TSCallSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
852
+ TSClassImplements: EXPRESSION__TYPE_ARGUMENTS,
853
+ TSConditionalType: freeze(["checkType", "extendsType", "trueType", "falseType"]),
854
+ TSConstructSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
855
+ TSConstructorType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
856
+ TSDeclareFunction: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
857
+ TSEmptyBodyFunctionExpression: freeze(["id", "typeParameters", "params", "returnType"]),
858
+ TSEnumBody: MEMBERS,
859
+ TSEnumDeclaration: ID__BODY,
860
+ TSEnumMember: freeze(["id", "initializer"]),
861
+ TSExportAssignment: EXPRESSION,
862
+ TSExternalModuleReference: EXPRESSION,
863
+ TSFunctionType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
864
+ TSImportEqualsDeclaration: freeze(["id", "moduleReference"]),
865
+ TSImportType: freeze(["source", "options", "qualifier", "typeArguments"]),
866
+ TSIndexSignature: freeze(["parameters", "typeAnnotation"]),
867
+ TSIndexedAccessType: freeze(["objectType", "indexType"]),
868
+ TSInferType: freeze(["typeParameter"]),
869
+ TSInstantiationExpression: EXPRESSION__TYPE_ARGUMENTS,
870
+ TSInterfaceBody: BODY,
871
+ TSInterfaceDeclaration: freeze(["id", "typeParameters", "extends", "body"]),
872
+ TSInterfaceHeritage: EXPRESSION__TYPE_ARGUMENTS,
873
+ TSIntersectionType: TYPES,
874
+ TSJSDocNonNullableType: TYPE_ANNOTATION,
875
+ TSJSDocNullableType: TYPE_ANNOTATION,
876
+ TSLiteralType: freeze(["literal"]),
877
+ TSMappedType: freeze(["key", "constraint", "nameType", "typeAnnotation"]),
878
+ TSMethodSignature: freeze(["key", "typeParameters", "params", "returnType"]),
879
+ TSModuleBlock: BODY,
880
+ TSModuleDeclaration: ID__BODY,
881
+ TSNamedTupleMember: freeze(["label", "elementType"]),
882
+ TSNamespaceExportDeclaration: freeze(["id"]),
883
+ TSNonNullExpression: EXPRESSION,
884
+ TSOptionalType: TYPE_ANNOTATION,
885
+ TSParameterProperty: freeze(["decorators", "parameter"]),
886
+ TSParenthesizedType: TYPE_ANNOTATION,
887
+ TSPropertySignature: freeze(["key", "typeAnnotation"]),
888
+ TSQualifiedName: LEFT__RIGHT,
889
+ TSRestType: TYPE_ANNOTATION,
890
+ TSSatisfiesExpression: EXPRESSION__TYPE_ANNOTATION,
891
+ TSTemplateLiteralType: freeze(["quasis", "types"]),
892
+ TSTupleType: freeze(["elementTypes"]),
893
+ TSTypeAliasDeclaration: freeze(["id", "typeParameters", "typeAnnotation"]),
894
+ TSTypeAnnotation: TYPE_ANNOTATION,
895
+ TSTypeAssertion: freeze(["typeAnnotation", "expression"]),
896
+ TSTypeLiteral: MEMBERS,
897
+ TSTypeOperator: TYPE_ANNOTATION,
898
+ TSTypeParameter: freeze(["name", "constraint", "default"]),
899
+ TSTypeParameterDeclaration: PARAMS,
900
+ TSTypeParameterInstantiation: PARAMS,
901
+ TSTypePredicate: freeze(["parameterName", "typeAnnotation"]),
902
+ TSTypeQuery: freeze(["exprName", "typeArguments"]),
903
+ TSTypeReference: freeze(["typeName", "typeArguments"]),
904
+ TSUnionType: TYPES
905
+ });
906
+ }
907
+ });
908
+
909
+ // ../../node_modules/oxc-parser/src-js/visit/index.js
910
+ var import_node_module2, import_meta2, walkProgram, addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor, _compiledVisitor, Visitor;
911
+ var init_visit = __esm({
912
+ "../../node_modules/oxc-parser/src-js/visit/index.js"() {
913
+ "use strict";
914
+ import_node_module2 = require("module");
915
+ import_meta2 = {};
916
+ walkProgram = null;
917
+ Visitor = class {
918
+ constructor(visitor) {
919
+ __privateAdd(this, _compiledVisitor, null);
920
+ if (walkProgram === null) {
921
+ const require4 = (0, import_node_module2.createRequire)(import_meta2.url);
922
+ ({ walkProgram } = require4("../generated/visit/walk.js"));
923
+ ({
924
+ addVisitorToCompiled,
925
+ createCompiledVisitor,
926
+ finalizeCompiledVisitor
927
+ } = require4("./visitor.js"));
928
+ }
929
+ const compiledVisitor = createCompiledVisitor();
930
+ addVisitorToCompiled(visitor);
931
+ const needsVisit = finalizeCompiledVisitor();
932
+ if (needsVisit) __privateSet(this, _compiledVisitor, compiledVisitor);
933
+ }
934
+ /**
935
+ * Visit AST.
936
+ * @param program - The AST to visit.
937
+ * @returns {undefined}
938
+ */
939
+ visit(program) {
940
+ const compiledVisitor = __privateGet(this, _compiledVisitor);
941
+ if (compiledVisitor !== null) walkProgram(program, compiledVisitor);
942
+ }
943
+ };
944
+ _compiledVisitor = new WeakMap();
945
+ }
946
+ });
947
+
948
+ // ../../node_modules/oxc-parser/src-js/raw-transfer/supported.js
949
+ function rawTransferSupported2() {
950
+ if (rawTransferIsSupported === null) {
951
+ rawTransferIsSupported = rawTransferRuntimeSupported() && rawTransferSupported();
952
+ }
953
+ return rawTransferIsSupported;
954
+ }
955
+ function rawTransferRuntimeSupported() {
956
+ var _a2, _b2, _c, _d, _e, _f, _g;
957
+ let global;
958
+ try {
959
+ global = globalThis;
960
+ } catch (e) {
961
+ return false;
962
+ }
963
+ const isBun = !!global.Bun || !!((_b2 = (_a2 = global.process) == null ? void 0 : _a2.versions) == null ? void 0 : _b2.bun);
964
+ if (isBun) return false;
965
+ const isDeno = !!global.Deno;
966
+ if (isDeno) {
967
+ const match2 = (_d = (_c = Deno.version) == null ? void 0 : _c.deno) == null ? void 0 : _d.match(/^(\d+)\./);
968
+ return !!match2 && match2[1] * 1 >= 2;
969
+ }
970
+ const isNode = ((_f = (_e = global.process) == null ? void 0 : _e.release) == null ? void 0 : _f.name) === "node";
971
+ if (!isNode) return false;
972
+ const match = (_g = process.version) == null ? void 0 : _g.match(/^v(\d+)\./);
973
+ return !!match && match[1] * 1 >= 22;
974
+ }
975
+ var rawTransferIsSupported;
976
+ var init_supported = __esm({
977
+ "../../node_modules/oxc-parser/src-js/raw-transfer/supported.js"() {
978
+ "use strict";
979
+ init_bindings();
980
+ rawTransferIsSupported = null;
981
+ }
982
+ });
983
+
984
+ // ../../node_modules/oxc-parser/src-js/index.js
985
+ var src_js_exports = {};
986
+ __export(src_js_exports, {
987
+ ExportExportNameKind: () => ExportExportNameKind,
988
+ ExportImportNameKind: () => ExportImportNameKind,
989
+ ExportLocalNameKind: () => ExportLocalNameKind,
990
+ ImportNameKind: () => ImportNameKind,
991
+ ParseResult: () => ParseResult,
992
+ Severity: () => Severity,
993
+ Visitor: () => Visitor,
994
+ experimentalGetLazyVisitor: () => experimentalGetLazyVisitor,
995
+ parse: () => parse2,
996
+ parseSync: () => parseSync2,
997
+ rawTransferSupported: () => rawTransferSupported2,
998
+ visitorKeys: () => keys_default
999
+ });
1000
+ function loadRawTransfer() {
1001
+ if (parseSyncRaw === null) {
1002
+ ({ parseSyncRaw, parse: parseRaw2 } = require3("./raw-transfer/eager.js"));
1003
+ }
1004
+ }
1005
+ function loadRawTransferLazy() {
1006
+ if (parseSyncLazy === null) {
1007
+ ({ parseSyncLazy, parse: parseLazy, Visitor: LazyVisitor } = require3("./raw-transfer/lazy.js"));
1008
+ }
1009
+ }
1010
+ function parseSync2(filename, sourceText, options) {
1011
+ if (options == null ? void 0 : options.experimentalRawTransfer) {
1012
+ loadRawTransfer();
1013
+ return parseSyncRaw(filename, sourceText, options);
1014
+ }
1015
+ if (options == null ? void 0 : options.experimentalLazy) {
1016
+ loadRawTransferLazy();
1017
+ return parseSyncLazy(filename, sourceText, options);
1018
+ }
1019
+ return wrap(parseSync(filename, sourceText, options));
1020
+ }
1021
+ async function parse2(filename, sourceText, options) {
1022
+ if (options == null ? void 0 : options.experimentalRawTransfer) {
1023
+ loadRawTransfer();
1024
+ return await parseRaw2(filename, sourceText, options);
1025
+ }
1026
+ if (options == null ? void 0 : options.experimentalLazy) {
1027
+ loadRawTransferLazy();
1028
+ return await parseLazy(filename, sourceText, options);
1029
+ }
1030
+ return wrap(await parse(filename, sourceText, options));
1031
+ }
1032
+ function experimentalGetLazyVisitor() {
1033
+ loadRawTransferLazy();
1034
+ return LazyVisitor;
1035
+ }
1036
+ var import_node_module3, import_meta3, require3, parseSyncRaw, parseRaw2, parseSyncLazy, parseLazy, LazyVisitor;
1037
+ var init_src_js = __esm({
1038
+ "../../node_modules/oxc-parser/src-js/index.js"() {
1039
+ "use strict";
1040
+ import_node_module3 = require("module");
1041
+ init_bindings();
1042
+ init_wrap();
1043
+ init_keys();
1044
+ init_visit();
1045
+ init_bindings();
1046
+ init_supported();
1047
+ import_meta3 = {};
1048
+ require3 = (0, import_node_module3.createRequire)(import_meta3.url);
1049
+ parseSyncRaw = null;
1050
+ parseSyncLazy = null;
1051
+ }
1052
+ });
1053
+
1054
+ // ../compiler/src/incrementalEngine.ts
1055
+ var incrementalEngine_exports = {};
1056
+ __export(incrementalEngine_exports, {
1057
+ IncrementalEngine: () => IncrementalEngine,
1058
+ getIncrementalEngine: () => getIncrementalEngine,
1059
+ parseClassesToNodes: () => parseClassesToNodes,
1060
+ resetIncrementalEngine: () => resetIncrementalEngine
1061
+ });
1062
+ function ensureCacheDir() {
1063
+ if (!import_node_fs.default.existsSync(CACHE_DIR)) {
1064
+ import_node_fs.default.mkdirSync(CACHE_DIR, { recursive: true });
1065
+ }
1066
+ }
1067
+ function loadHashCache() {
1068
+ try {
1069
+ if (import_node_fs.default.existsSync(HASH_CACHE_FILE)) {
1070
+ const raw = import_node_fs.default.readFileSync(HASH_CACHE_FILE, "utf-8");
1071
+ return new Map(Object.entries(JSON.parse(raw)));
1072
+ }
1073
+ } catch (e) {
1074
+ }
1075
+ return /* @__PURE__ */ new Map();
1076
+ }
1077
+ function saveHashCache(cache) {
1078
+ try {
1079
+ ensureCacheDir();
1080
+ const obj = Object.fromEntries(cache);
1081
+ import_node_fs.default.writeFileSync(HASH_CACHE_FILE, JSON.stringify(obj, null, 2));
1082
+ } catch (e) {
1083
+ }
1084
+ }
1085
+ function loadGraphCache() {
1086
+ try {
1087
+ if (import_node_fs.default.existsSync(GRAPH_CACHE_FILE)) {
1088
+ const raw = import_node_fs.default.readFileSync(GRAPH_CACHE_FILE, "utf-8");
1089
+ const data = JSON.parse(raw);
1090
+ return new Map(Object.entries(data));
1091
+ }
1092
+ } catch (e) {
1093
+ }
1094
+ return /* @__PURE__ */ new Map();
1095
+ }
1096
+ function saveGraphCache(graph) {
1097
+ try {
1098
+ ensureCacheDir();
1099
+ const obj = Object.fromEntries(graph);
1100
+ import_node_fs.default.writeFileSync(GRAPH_CACHE_FILE, JSON.stringify(obj, null, 2));
1101
+ } catch (e) {
1102
+ }
1103
+ }
1104
+ function fnv1a(str) {
1105
+ let h = 2166136261;
1106
+ for (let i = 0; i < str.length; i++) {
1107
+ h ^= str.charCodeAt(i);
1108
+ h = h * 16777619 >>> 0;
1109
+ }
1110
+ return h;
1111
+ }
1112
+ function toBase36(n, len = 4) {
1113
+ const chars = "0123456789abcdefghijklmnopqrstuvwxyz";
1114
+ let result = "";
1115
+ let num = n;
1116
+ for (let i = 0; i < len; i++) {
1117
+ result = chars[num % 36] + result;
1118
+ num = Math.floor(num / 36);
1119
+ }
1120
+ return result;
1121
+ }
1122
+ function hashFileContent(content) {
1123
+ return import_node_crypto.default.createHash("md5").update(content).digest("hex").slice(0, 8);
1124
+ }
1125
+ function makeAtomicClass(declaration, modifier) {
1126
+ const key = modifier ? `${declaration}::${modifier}` : declaration;
1127
+ return `tw-${toBase36(fnv1a(key))}`;
1128
+ }
1129
+ function computeDiff(oldNodes, newNodes) {
1130
+ const oldMap = new Map(oldNodes.map((n) => [n.atomicClass, n]));
1131
+ const newMap = new Map(newNodes.map((n) => [n.atomicClass, n]));
1132
+ const added = [];
1133
+ const removed = [];
1134
+ for (const [cls, node] of newMap) {
1135
+ if (!oldMap.has(cls)) added.push(node);
1136
+ }
1137
+ for (const cls of oldMap.keys()) {
1138
+ if (!newMap.has(cls)) removed.push(cls);
1139
+ }
1140
+ return {
1141
+ added,
1142
+ removed,
1143
+ noChange: added.length === 0 && removed.length === 0
1144
+ };
1145
+ }
1146
+ function nodeToCSS(node) {
1147
+ const { atomicClass, declaration, modifier } = node;
1148
+ if (!modifier) {
1149
+ return `.${atomicClass}{${declaration}}`;
1150
+ }
1151
+ if (modifier.startsWith("@")) {
1152
+ return `${modifier}{.${atomicClass}{${declaration}}}`;
1153
+ }
1154
+ return `.${atomicClass}${modifier}{${declaration}}`;
1155
+ }
1156
+ function parseClassesToNodes(classes) {
1157
+ const nodes = [];
1158
+ for (const cls of classes) {
1159
+ const node = parseOneClass(cls);
1160
+ if (node) nodes.push(node);
1161
+ }
1162
+ return nodes;
1163
+ }
1164
+ function parseOneClass(cls) {
1165
+ const colonIdx = cls.lastIndexOf(":");
1166
+ let modifier;
1167
+ let utility;
1168
+ if (colonIdx > 0) {
1169
+ const modStr = cls.slice(0, colonIdx);
1170
+ utility = cls.slice(colonIdx + 1);
1171
+ modifier = resolveModifier(modStr);
1172
+ } else {
1173
+ utility = cls;
1174
+ }
1175
+ const declaration = twToDeclaration(utility);
1176
+ if (!declaration) return null;
1177
+ const atomicClass = makeAtomicClass(declaration, modifier);
1178
+ return { twClass: cls, declaration, modifier, atomicClass };
1179
+ }
1180
+ function resolveModifier(mod) {
1181
+ var _a2, _b2;
1182
+ const pseudoMap = {
1183
+ hover: ":hover",
1184
+ focus: ":focus",
1185
+ active: ":active",
1186
+ disabled: ":disabled",
1187
+ visited: ":visited",
1188
+ checked: ":checked",
1189
+ first: ":first-child",
1190
+ last: ":last-child",
1191
+ odd: ":nth-child(odd)",
1192
+ even: ":nth-child(even)"
1193
+ };
1194
+ const mediaMap = {
1195
+ sm: "@media (min-width: 640px)",
1196
+ md: "@media (min-width: 768px)",
1197
+ lg: "@media (min-width: 1024px)",
1198
+ xl: "@media (min-width: 1280px)",
1199
+ "2xl": "@media (min-width: 1536px)",
1200
+ dark: "@media (prefers-color-scheme: dark)",
1201
+ print: "@media print"
1202
+ };
1203
+ return (_b2 = (_a2 = pseudoMap[mod]) != null ? _a2 : mediaMap[mod]) != null ? _b2 : `:${mod}`;
1204
+ }
1205
+ function twToDeclaration(cls) {
1206
+ var _a2;
1207
+ const sp = cls.match(/^(p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-([\d.]+)$/);
1208
+ if (sp) {
1209
+ const propMap = {
1210
+ p: "padding",
1211
+ px: "padding-inline",
1212
+ py: "padding-block",
1213
+ pt: "padding-top",
1214
+ pb: "padding-bottom",
1215
+ pl: "padding-left",
1216
+ pr: "padding-right",
1217
+ m: "margin",
1218
+ mx: "margin-inline",
1219
+ my: "margin-block",
1220
+ mt: "margin-top",
1221
+ mb: "margin-bottom",
1222
+ ml: "margin-left",
1223
+ mr: "margin-right",
1224
+ gap: "gap"
1225
+ };
1226
+ return `${propMap[sp[1]]}: ${parseFloat(sp[2]) * 0.25}rem`;
1227
+ }
1228
+ const w = cls.match(/^w-(.+)$/);
1229
+ if (w) return `width: ${sizeVal(w[1])}`;
1230
+ const h = cls.match(/^h-(.+)$/);
1231
+ if (h) return `height: ${sizeVal(h[1])}`;
1232
+ const op = cls.match(/^opacity-(\d+)$/);
1233
+ if (op) return `opacity: ${parseInt(op[1], 10) / 100}`;
1234
+ const z = cls.match(/^z-(\d+)$/);
1235
+ if (z) return `z-index: ${z[1]}`;
1236
+ const map = {
1237
+ block: "display: block",
1238
+ "inline-block": "display: inline-block",
1239
+ flex: "display: flex",
1240
+ "inline-flex": "display: inline-flex",
1241
+ grid: "display: grid",
1242
+ hidden: "display: none",
1243
+ relative: "position: relative",
1244
+ absolute: "position: absolute",
1245
+ fixed: "position: fixed",
1246
+ sticky: "position: sticky",
1247
+ "flex-row": "flex-direction: row",
1248
+ "flex-col": "flex-direction: column",
1249
+ "items-center": "align-items: center",
1250
+ "items-start": "align-items: flex-start",
1251
+ "items-end": "align-items: flex-end",
1252
+ "justify-center": "justify-content: center",
1253
+ "justify-between": "justify-content: space-between",
1254
+ "justify-start": "justify-content: flex-start",
1255
+ "justify-end": "justify-content: flex-end",
1256
+ "font-thin": "font-weight: 100",
1257
+ "font-light": "font-weight: 300",
1258
+ "font-normal": "font-weight: 400",
1259
+ "font-medium": "font-weight: 500",
1260
+ "font-semibold": "font-weight: 600",
1261
+ "font-bold": "font-weight: 700",
1262
+ "font-extrabold": "font-weight: 800",
1263
+ "text-xs": "font-size: 0.75rem",
1264
+ "text-sm": "font-size: 0.875rem",
1265
+ "text-base": "font-size: 1rem",
1266
+ "text-lg": "font-size: 1.125rem",
1267
+ "text-xl": "font-size: 1.25rem",
1268
+ "text-2xl": "font-size: 1.5rem",
1269
+ "text-3xl": "font-size: 1.875rem",
1270
+ "text-4xl": "font-size: 2.25rem",
1271
+ rounded: "border-radius: 0.25rem",
1272
+ "rounded-md": "border-radius: 0.375rem",
1273
+ "rounded-lg": "border-radius: 0.5rem",
1274
+ "rounded-xl": "border-radius: 0.75rem",
1275
+ "rounded-full": "border-radius: 9999px",
1276
+ "overflow-hidden": "overflow: hidden",
1277
+ "overflow-auto": "overflow: auto",
1278
+ "cursor-pointer": "cursor: pointer",
1279
+ "cursor-default": "cursor: default",
1280
+ "select-none": "user-select: none",
1281
+ "pointer-events-none": "pointer-events: none",
1282
+ truncate: "overflow: hidden; text-overflow: ellipsis; white-space: nowrap",
1283
+ transition: "transition-property: color,background-color,border-color,opacity,box-shadow,transform; transition-duration: 150ms"
1284
+ };
1285
+ return (_a2 = map[cls]) != null ? _a2 : null;
1286
+ }
1287
+ function sizeVal(v) {
1288
+ var _a2;
1289
+ const num = parseFloat(v);
1290
+ if (!Number.isNaN(num)) return `${num * 0.25}rem`;
1291
+ const special = {
1292
+ full: "100%",
1293
+ screen: "100vw",
1294
+ auto: "auto",
1295
+ min: "min-content",
1296
+ max: "max-content",
1297
+ fit: "fit-content"
1298
+ };
1299
+ return (_a2 = special[v]) != null ? _a2 : v;
1300
+ }
1301
+ function getIncrementalEngine(opts) {
1302
+ if (!_engine) {
1303
+ _engine = new IncrementalEngine(opts);
1304
+ }
1305
+ return _engine;
1306
+ }
1307
+ function resetIncrementalEngine() {
1308
+ _engine = null;
1309
+ }
1310
+ var import_node_crypto, import_node_fs, import_node_path, CACHE_DIR, HASH_CACHE_FILE, GRAPH_CACHE_FILE, GlobalAtomicRegistry, CssDiffWriter, IncrementalEngine, _engine;
1311
+ var init_incrementalEngine = __esm({
1312
+ "../compiler/src/incrementalEngine.ts"() {
1313
+ "use strict";
1314
+ import_node_crypto = __toESM(require("crypto"), 1);
1315
+ import_node_fs = __toESM(require("fs"), 1);
1316
+ import_node_path = __toESM(require("path"), 1);
1317
+ CACHE_DIR = ".tw-cache";
1318
+ HASH_CACHE_FILE = import_node_path.default.join(CACHE_DIR, "file-hashes.json");
1319
+ GRAPH_CACHE_FILE = import_node_path.default.join(CACHE_DIR, "dep-graph.json");
1320
+ GlobalAtomicRegistry = class {
1321
+ constructor() {
1322
+ this.entries = /* @__PURE__ */ new Map();
1323
+ }
1324
+ /** Tambah node dari file tertentu */
1325
+ add(filepath, node) {
1326
+ const existing = this.entries.get(node.atomicClass);
1327
+ if (existing) {
1328
+ existing.sources.add(filepath);
1329
+ } else {
1330
+ this.entries.set(node.atomicClass, {
1331
+ node,
1332
+ sources: /* @__PURE__ */ new Set([filepath])
1333
+ });
1334
+ }
1335
+ }
1336
+ /** Hapus referensi dari file tertentu; jika tidak ada source lain, rule dihapus */
1337
+ remove(filepath, atomicClass) {
1338
+ const entry = this.entries.get(atomicClass);
1339
+ if (!entry) return false;
1340
+ entry.sources.delete(filepath);
1341
+ if (entry.sources.size === 0) {
1342
+ this.entries.delete(atomicClass);
1343
+ return true;
1344
+ }
1345
+ return false;
1346
+ }
1347
+ /** Cek apakah rule ada di registry global */
1348
+ has(atomicClass) {
1349
+ return this.entries.has(atomicClass);
1350
+ }
1351
+ /** Semua entries untuk CSS generation */
1352
+ all() {
1353
+ return Array.from(this.entries.values()).map((e) => e.node);
1354
+ }
1355
+ /** Total unique rules */
1356
+ size() {
1357
+ return this.entries.size;
1358
+ }
1359
+ };
1360
+ CssDiffWriter = class {
1361
+ constructor(outputPath) {
1362
+ this.ruleMap = /* @__PURE__ */ new Map();
1363
+ this.dirty = false;
1364
+ this.outputPath = outputPath;
1365
+ this.loadFromDisk();
1366
+ }
1367
+ loadFromDisk() {
1368
+ try {
1369
+ if (import_node_fs.default.existsSync(this.outputPath)) {
1370
+ const css = import_node_fs.default.readFileSync(this.outputPath, "utf-8");
1371
+ const ruleRe = /(\.tw-[a-z0-9]+(?::[\w-]+)?)\{([^}]+)\}|(@[^{]+)\{(\.tw-[a-z0-9]+)\{([^}]+)\}\}/g;
1372
+ let m;
1373
+ while ((m = ruleRe.exec(css)) !== null) {
1374
+ if (m[1]) {
1375
+ const cls = m[1].replace(/\.[^:]+:.*/, (match) => match.split(".")[1].split(":")[0]);
1376
+ this.ruleMap.set(cls, m[0]);
1377
+ }
1378
+ }
1379
+ }
1380
+ } catch (e) {
1381
+ }
1382
+ }
1383
+ /** Apply diff ke internal map */
1384
+ applyDiff(diff) {
1385
+ if (diff.noChange) return;
1386
+ for (const node of diff.added) {
1387
+ this.ruleMap.set(node.atomicClass, nodeToCSS(node));
1388
+ }
1389
+ for (const cls of diff.removed) {
1390
+ this.ruleMap.delete(cls);
1391
+ }
1392
+ this.dirty = true;
1393
+ }
1394
+ /** Write ke disk jika ada perubahan. Async untuk tidak block loader. */
1395
+ async flush() {
1396
+ if (!this.dirty) return;
1397
+ try {
1398
+ ensureCacheDir();
1399
+ const css = Array.from(this.ruleMap.values()).join("\n");
1400
+ await import_node_fs.default.promises.writeFile(this.outputPath, css, "utf-8");
1401
+ this.dirty = false;
1402
+ } catch (e) {
1403
+ }
1404
+ }
1405
+ /** Sync flush untuk build end */
1406
+ flushSync() {
1407
+ if (!this.dirty) return;
1408
+ try {
1409
+ ensureCacheDir();
1410
+ const css = Array.from(this.ruleMap.values()).join("\n");
1411
+ import_node_fs.default.writeFileSync(this.outputPath, css, "utf-8");
1412
+ this.dirty = false;
1413
+ } catch (e) {
1414
+ }
1415
+ }
1416
+ size() {
1417
+ return this.ruleMap.size;
1418
+ }
1419
+ };
1420
+ IncrementalEngine = class {
1421
+ constructor(opts = {}) {
1422
+ // Stats untuk current build session
1423
+ this.stats = {
1424
+ totalFiles: 0,
1425
+ changedFiles: 0,
1426
+ skippedFiles: 0,
1427
+ addedRules: 0,
1428
+ removedRules: 0,
1429
+ buildTimeMs: 0
1430
+ };
1431
+ this.sessionStart = Date.now();
1432
+ var _a2, _b2, _c;
1433
+ this.opts = {
1434
+ outputPath: (_a2 = opts.outputPath) != null ? _a2 : import_node_path.default.join(CACHE_DIR, "atomic.css"),
1435
+ persistCache: (_b2 = opts.persistCache) != null ? _b2 : true,
1436
+ verbose: (_c = opts.verbose) != null ? _c : false
1437
+ };
1438
+ this.hashCache = this.opts.persistCache ? loadHashCache() : /* @__PURE__ */ new Map();
1439
+ this.depGraph = this.opts.persistCache ? loadGraphCache() : /* @__PURE__ */ new Map();
1440
+ this.globalReg = new GlobalAtomicRegistry();
1441
+ this.cssWriter = new CssDiffWriter(this.opts.outputPath);
1442
+ for (const [filepath, nodes] of this.depGraph) {
1443
+ for (const node of nodes) {
1444
+ this.globalReg.add(filepath, node);
1445
+ }
1446
+ }
1447
+ }
1448
+ /**
1449
+ * Proses satu file. Core method dipanggil oleh webpack/turbopack loader.
1450
+ *
1451
+ * @param filepath - Absolute path ke file
1452
+ * @param source - Source code file (untuk hashing)
1453
+ * @param extractedNodes - Style nodes yang di-extract compiler dari file ini
1454
+ * @returns ProcessResult dengan diff dan stats
1455
+ */
1456
+ processFile(filepath, source, extractedNodes) {
1457
+ var _a2;
1458
+ const t0 = Date.now();
1459
+ this.stats.totalFiles++;
1460
+ const currentHash = hashFileContent(source);
1461
+ const cachedHash = this.hashCache.get(filepath);
1462
+ if (cachedHash === currentHash) {
1463
+ this.stats.skippedFiles++;
1464
+ this.log(`[skip] ${import_node_path.default.relative(process.cwd(), filepath)}`);
1465
+ return {
1466
+ filepath,
1467
+ changed: false,
1468
+ diff: { added: [], removed: [], noChange: true },
1469
+ durationMs: Date.now() - t0
1470
+ };
1471
+ }
1472
+ this.hashCache.set(filepath, currentHash);
1473
+ this.stats.changedFiles++;
1474
+ this.log(`[change] ${import_node_path.default.relative(process.cwd(), filepath)}`);
1475
+ const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
1476
+ const diff = computeDiff(oldNodes, extractedNodes);
1477
+ this.depGraph.set(filepath, extractedNodes);
1478
+ const trulyRemoved = [];
1479
+ for (const cls of diff.removed) {
1480
+ const wasRemoved = this.globalReg.remove(filepath, cls);
1481
+ if (wasRemoved) trulyRemoved.push(cls);
1482
+ }
1483
+ const trulyAdded = [];
1484
+ for (const node of diff.added) {
1485
+ if (!this.globalReg.has(node.atomicClass)) {
1486
+ trulyAdded.push(node);
1487
+ }
1488
+ this.globalReg.add(filepath, node);
1489
+ }
1490
+ const finalDiff = {
1491
+ added: trulyAdded,
1492
+ removed: trulyRemoved,
1493
+ noChange: trulyAdded.length === 0 && trulyRemoved.length === 0
1494
+ };
1495
+ this.cssWriter.applyDiff(finalDiff);
1496
+ this.stats.addedRules += trulyAdded.length;
1497
+ this.stats.removedRules += trulyRemoved.length;
1498
+ return {
1499
+ filepath,
1500
+ changed: true,
1501
+ diff: finalDiff,
1502
+ durationMs: Date.now() - t0
1503
+ };
1504
+ }
1505
+ /**
1506
+ * Dipanggil di akhir build. Flush CSS ke disk, persist cache.
1507
+ */
1508
+ async buildEnd() {
1509
+ this.stats.buildTimeMs = Date.now() - this.sessionStart;
1510
+ await this.cssWriter.flush();
1511
+ if (this.opts.persistCache) {
1512
+ saveHashCache(this.hashCache);
1513
+ saveGraphCache(this.depGraph);
1514
+ }
1515
+ this.log(
1516
+ `[build] done in ${this.stats.buildTimeMs}ms | changed: ${this.stats.changedFiles}/${this.stats.totalFiles} files | +${this.stats.addedRules} -${this.stats.removedRules} rules | total rules: ${this.cssWriter.size()}`
1517
+ );
1518
+ }
1519
+ /** Sync version untuk webpack buildEnd hook */
1520
+ buildEndSync() {
1521
+ this.stats.buildTimeMs = Date.now() - this.sessionStart;
1522
+ this.cssWriter.flushSync();
1523
+ if (this.opts.persistCache) {
1524
+ saveHashCache(this.hashCache);
1525
+ saveGraphCache(this.depGraph);
1526
+ }
1527
+ }
1528
+ /**
1529
+ * Invalidate satu file (untuk hot reload — file dihapus atau renamed).
1530
+ */
1531
+ invalidateFile(filepath) {
1532
+ var _a2;
1533
+ const oldNodes = (_a2 = this.depGraph.get(filepath)) != null ? _a2 : [];
1534
+ for (const node of oldNodes) {
1535
+ this.globalReg.remove(filepath, node.atomicClass);
1536
+ }
1537
+ this.depGraph.delete(filepath);
1538
+ this.hashCache.delete(filepath);
1539
+ this.log(`[invalidate] ${import_node_path.default.relative(process.cwd(), filepath)}`);
1540
+ }
1541
+ /** Get all active style nodes — untuk full CSS generation */
1542
+ getAllNodes() {
1543
+ return this.globalReg.all();
1544
+ }
1545
+ /** Get stats untuk current build session */
1546
+ getStats() {
1547
+ return __spreadProps(__spreadValues({}, this.stats), { buildTimeMs: Date.now() - this.sessionStart });
1548
+ }
1549
+ /** Get output CSS path */
1550
+ getOutputPath() {
1551
+ return this.opts.outputPath;
1552
+ }
1553
+ /** Reset stats untuk build session baru */
1554
+ resetStats() {
1555
+ this.stats = {
1556
+ totalFiles: 0,
1557
+ changedFiles: 0,
1558
+ skippedFiles: 0,
1559
+ addedRules: 0,
1560
+ removedRules: 0,
1561
+ buildTimeMs: 0
1562
+ };
1563
+ this.sessionStart = Date.now();
1564
+ }
1565
+ /** Reset semua cache — untuk clean build */
1566
+ reset() {
1567
+ this.hashCache.clear();
1568
+ this.depGraph.clear();
1569
+ this.globalReg = new GlobalAtomicRegistry();
1570
+ this.cssWriter = new CssDiffWriter(this.opts.outputPath);
1571
+ this.resetStats();
1572
+ this.log("[reset] incremental cache cleared");
1573
+ }
1574
+ log(msg) {
1575
+ if (this.opts.verbose) {
1576
+ console.log(`[tailwind-styled/incremental] ${msg}`);
1577
+ }
1578
+ }
1579
+ };
1580
+ _engine = null;
1581
+ }
1582
+ });
1583
+
1584
+ // ../compiler/src/styleBucketSystem.ts
1585
+ var styleBucketSystem_exports = {};
1586
+ __export(styleBucketSystem_exports, {
1587
+ BucketEngine: () => BucketEngine,
1588
+ bucketSort: () => bucketSort,
1589
+ classifyNode: () => classifyNode,
1590
+ detectConflicts: () => detectConflicts,
1591
+ getBucketEngine: () => getBucketEngine,
1592
+ resetBucketEngine: () => resetBucketEngine
1593
+ });
1594
+ function classifyNode(node) {
1595
+ var _a2, _b2, _c;
1596
+ if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) return "responsive";
1597
+ const declarations = node.declaration.split(";").map((d) => d.trim()).filter(Boolean);
1598
+ const firstProp = (_c = (_b2 = declarations[0]) == null ? void 0 : _b2.split(":")[0]) == null ? void 0 : _c.trim();
1599
+ if (!firstProp) return "unknown";
1600
+ if (PROPERTY_BUCKET_MAP[firstProp]) return PROPERTY_BUCKET_MAP[firstProp];
1601
+ for (const [prefix, bucket] of Object.entries(PROPERTY_BUCKET_MAP)) {
1602
+ if (firstProp.startsWith(prefix)) return bucket;
1603
+ }
1604
+ return "unknown";
1605
+ }
1606
+ function bucketSort(nodes) {
1607
+ const bucketIndex = Object.fromEntries(BUCKET_ORDER.map((b, i) => [b, i]));
1608
+ return [...nodes].sort((a, b) => {
1609
+ const ai = bucketIndex[classifyNode(a)];
1610
+ const bi = bucketIndex[classifyNode(b)];
1611
+ return ai - bi;
1612
+ });
1613
+ }
1614
+ function nodeToCSS2(node) {
1615
+ const { atomicClass, declaration, modifier } = node;
1616
+ if (!modifier) {
1617
+ return `.${atomicClass}{${declaration}}`;
1618
+ }
1619
+ if (modifier.startsWith("@")) {
1620
+ return `${modifier}{.${atomicClass}{${declaration}}}`;
1621
+ }
1622
+ return `.${atomicClass}${modifier}{${declaration}}`;
1623
+ }
1624
+ function detectConflicts(nodes) {
1625
+ var _a2, _b2, _c;
1626
+ const seen = /* @__PURE__ */ new Map();
1627
+ const warnings = [];
1628
+ for (const node of nodes) {
1629
+ if ((_a2 = node.modifier) == null ? void 0 : _a2.startsWith("@")) continue;
1630
+ const firstProp = (_b2 = node.declaration.split(":")[0]) == null ? void 0 : _b2.trim();
1631
+ if (!firstProp) continue;
1632
+ const key = `${firstProp}::${(_c = node.modifier) != null ? _c : ""}`;
1633
+ const prev = seen.get(key);
1634
+ if (prev) {
1635
+ warnings.push({
1636
+ property: firstProp,
1637
+ classes: [prev.twClass, node.twClass],
1638
+ bucket: classifyNode(node),
1639
+ message: `Possible conflict: "${prev.twClass}" and "${node.twClass}" both set "${firstProp}"`
1640
+ });
1641
+ } else {
1642
+ seen.set(key, node);
1643
+ }
1644
+ }
1645
+ return warnings;
1646
+ }
1647
+ function getBucketEngine() {
1648
+ if (!_bucketEngine) _bucketEngine = new BucketEngine();
1649
+ return _bucketEngine;
1650
+ }
1651
+ function resetBucketEngine() {
1652
+ _bucketEngine = null;
1653
+ }
1654
+ var BUCKET_ORDER, PROPERTY_BUCKET_MAP, BucketEngine, _bucketEngine;
1655
+ var init_styleBucketSystem = __esm({
1656
+ "../compiler/src/styleBucketSystem.ts"() {
1657
+ "use strict";
1658
+ BUCKET_ORDER = [
1659
+ "reset",
1660
+ "layout",
1661
+ "spacing",
1662
+ "sizing",
1663
+ "typography",
1664
+ "visual",
1665
+ "interaction",
1666
+ "responsive",
1667
+ "unknown"
1668
+ ];
1669
+ PROPERTY_BUCKET_MAP = {
1670
+ // Layout
1671
+ display: "layout",
1672
+ position: "layout",
1673
+ flex: "layout",
1674
+ "flex-direction": "layout",
1675
+ "flex-wrap": "layout",
1676
+ "flex-grow": "layout",
1677
+ "flex-shrink": "layout",
1678
+ "flex-basis": "layout",
1679
+ grid: "layout",
1680
+ "grid-template": "layout",
1681
+ "grid-column": "layout",
1682
+ "grid-row": "layout",
1683
+ "align-items": "layout",
1684
+ "align-self": "layout",
1685
+ "align-content": "layout",
1686
+ "justify-content": "layout",
1687
+ "justify-items": "layout",
1688
+ "justify-self": "layout",
1689
+ "place-items": "layout",
1690
+ "place-content": "layout",
1691
+ overflow: "layout",
1692
+ "overflow-x": "layout",
1693
+ "overflow-y": "layout",
1694
+ "z-index": "layout",
1695
+ float: "layout",
1696
+ clear: "layout",
1697
+ visibility: "layout",
1698
+ // Spacing
1699
+ padding: "spacing",
1700
+ "padding-top": "spacing",
1701
+ "padding-bottom": "spacing",
1702
+ "padding-left": "spacing",
1703
+ "padding-right": "spacing",
1704
+ "padding-inline": "spacing",
1705
+ "padding-block": "spacing",
1706
+ margin: "spacing",
1707
+ "margin-top": "spacing",
1708
+ "margin-bottom": "spacing",
1709
+ "margin-left": "spacing",
1710
+ "margin-right": "spacing",
1711
+ "margin-inline": "spacing",
1712
+ "margin-block": "spacing",
1713
+ gap: "spacing",
1714
+ "column-gap": "spacing",
1715
+ "row-gap": "spacing",
1716
+ inset: "spacing",
1717
+ "inset-inline": "spacing",
1718
+ "inset-block": "spacing",
1719
+ top: "spacing",
1720
+ bottom: "spacing",
1721
+ left: "spacing",
1722
+ right: "spacing",
1723
+ // Sizing
1724
+ width: "sizing",
1725
+ height: "sizing",
1726
+ "max-width": "sizing",
1727
+ "min-width": "sizing",
1728
+ "max-height": "sizing",
1729
+ "min-height": "sizing",
1730
+ "aspect-ratio": "sizing",
1731
+ // Typography
1732
+ "font-size": "typography",
1733
+ "font-weight": "typography",
1734
+ "font-family": "typography",
1735
+ "font-style": "typography",
1736
+ "line-height": "typography",
1737
+ "letter-spacing": "typography",
1738
+ "text-align": "typography",
1739
+ "text-decoration": "typography",
1740
+ "text-transform": "typography",
1741
+ "text-overflow": "typography",
1742
+ "white-space": "typography",
1743
+ "word-break": "typography",
1744
+ "word-wrap": "typography",
1745
+ "vertical-align": "typography",
1746
+ // Visual
1747
+ color: "visual",
1748
+ background: "visual",
1749
+ "background-color": "visual",
1750
+ "background-image": "visual",
1751
+ "background-size": "visual",
1752
+ "background-position": "visual",
1753
+ "background-repeat": "visual",
1754
+ border: "visual",
1755
+ "border-top": "visual",
1756
+ "border-bottom": "visual",
1757
+ "border-left": "visual",
1758
+ "border-right": "visual",
1759
+ "border-inline": "visual",
1760
+ "border-block": "visual",
1761
+ "border-color": "visual",
1762
+ "border-width": "visual",
1763
+ "border-style": "visual",
1764
+ "border-radius": "visual",
1765
+ "box-shadow": "visual",
1766
+ opacity: "visual",
1767
+ outline: "visual",
1768
+ "outline-color": "visual",
1769
+ "outline-width": "visual",
1770
+ fill: "visual",
1771
+ stroke: "visual",
1772
+ "text-shadow": "visual",
1773
+ "mix-blend-mode": "visual",
1774
+ "object-fit": "visual",
1775
+ "object-position": "visual",
1776
+ // Interaction
1777
+ cursor: "interaction",
1778
+ "pointer-events": "interaction",
1779
+ "user-select": "interaction",
1780
+ transition: "interaction",
1781
+ "transition-property": "interaction",
1782
+ "transition-duration": "interaction",
1783
+ "transition-timing-function": "interaction",
1784
+ "transition-delay": "interaction",
1785
+ transform: "interaction",
1786
+ translate: "interaction",
1787
+ rotate: "interaction",
1788
+ scale: "interaction",
1789
+ animation: "interaction",
1790
+ "will-change": "interaction",
1791
+ "scroll-behavior": "interaction",
1792
+ "scroll-snap-type": "interaction",
1793
+ // Reset (jarang dipakai langsung tapi handle untuk completeness)
1794
+ "box-sizing": "reset",
1795
+ appearance: "reset",
1796
+ all: "reset"
1797
+ };
1798
+ BucketEngine = class {
1799
+ constructor() {
1800
+ this.buckets = /* @__PURE__ */ new Map();
1801
+ for (const b of BUCKET_ORDER) {
1802
+ this.buckets.set(b, /* @__PURE__ */ new Map());
1803
+ }
1804
+ }
1805
+ /**
1806
+ * Tambah StyleNode ke bucket yang tepat.
1807
+ * Idempotent — atomic class yang sama tidak akan duplikat.
1808
+ */
1809
+ add(node) {
1810
+ const bucket = classifyNode(node);
1811
+ this.buckets.get(bucket).set(node.atomicClass, node);
1812
+ }
1813
+ /**
1814
+ * Hapus node dari bucket (untuk incremental update).
1815
+ */
1816
+ remove(atomicClass) {
1817
+ for (const bucket of this.buckets.values()) {
1818
+ if (bucket.delete(atomicClass)) break;
1819
+ }
1820
+ }
1821
+ /**
1822
+ * Apply CssDiff dari incremental engine.
1823
+ */
1824
+ applyDiff(diff) {
1825
+ for (const node of diff.added) this.add(node);
1826
+ for (const cls of diff.removed) this.remove(cls);
1827
+ }
1828
+ /**
1829
+ * Emit seluruh CSS dalam urutan bucket yang deterministic.
1830
+ *
1831
+ * @param comments - Tambahkan komentar section per bucket. Default: true
1832
+ * @returns CSS string yang siap di-write ke file
1833
+ */
1834
+ emit(comments = true) {
1835
+ const sections = [];
1836
+ for (const bucketName of BUCKET_ORDER) {
1837
+ const nodes = this.buckets.get(bucketName);
1838
+ if (nodes.size === 0) continue;
1839
+ const rules = [];
1840
+ for (const node of nodes.values()) {
1841
+ rules.push(nodeToCSS2(node));
1842
+ }
1843
+ if (rules.length === 0) continue;
1844
+ if (comments) {
1845
+ sections.push(`/* \u2500\u2500 ${bucketName} \u2500\u2500 */`);
1846
+ }
1847
+ sections.push(...rules);
1848
+ }
1849
+ return sections.join("\n");
1850
+ }
1851
+ /**
1852
+ * Emit dengan @layer CSS untuk native browser layering.
1853
+ * Lebih powerful — browser respects layer order untuk specificity.
1854
+ *
1855
+ * @example output:
1856
+ * @layer tw-layout, tw-spacing, tw-visual, tw-responsive;
1857
+ * @layer tw-layout { .tw-a1 { display: flex } }
1858
+ */
1859
+ emitLayered() {
1860
+ const layerNames = BUCKET_ORDER.filter(
1861
+ (b) => b !== "unknown" && this.buckets.get(b).size > 0
1862
+ ).map((b) => `tw-${b}`);
1863
+ if (layerNames.length === 0) return "";
1864
+ const parts = [`@layer ${layerNames.join(", ")};`, ""];
1865
+ for (const bucketName of BUCKET_ORDER) {
1866
+ const nodes = this.buckets.get(bucketName);
1867
+ if (nodes.size === 0) continue;
1868
+ const rules = Array.from(nodes.values()).map(nodeToCSS2).join("\n ");
1869
+ parts.push(`@layer tw-${bucketName} {
1870
+ ${rules}
1871
+ }`);
1872
+ }
1873
+ return parts.join("\n");
1874
+ }
1875
+ /** Semua nodes dari semua bucket (untuk full registry access) */
1876
+ allNodes() {
1877
+ const all = [];
1878
+ for (const bucket of this.buckets.values()) {
1879
+ for (const node of bucket.values()) {
1880
+ all.push(node);
1881
+ }
1882
+ }
1883
+ return all;
1884
+ }
1885
+ /** Stats per bucket */
1886
+ stats() {
1887
+ const perBucket = {};
1888
+ let total = 0;
1889
+ for (const [name, nodes] of this.buckets) {
1890
+ perBucket[name] = nodes.size;
1891
+ total += nodes.size;
1892
+ }
1893
+ return { totalNodes: total, perBucket };
1894
+ }
1895
+ /** Clear semua bucket */
1896
+ clear() {
1897
+ for (const bucket of this.buckets.values()) {
1898
+ bucket.clear();
1899
+ }
1900
+ }
1901
+ };
1902
+ _bucketEngine = null;
1903
+ }
1904
+ });
1905
+
1906
+ // src/turbopackLoader.ts
1907
+ var turbopackLoader_exports = {};
1908
+ __export(turbopackLoader_exports, {
1909
+ default: () => turbopackLoader
1910
+ });
1911
+ module.exports = __toCommonJS(turbopackLoader_exports);
1912
+
1913
+ // ../compiler/src/classMerger.ts
1914
+ function normalizeClasses(raw) {
1915
+ return raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
1916
+ }
1917
+
1918
+ // ../compiler/src/componentHoister.ts
1919
+ var INDENTED_TW_DECL_RE = /^([ \t]+)(const|let)\s+([A-Z]\w*)\s*=\s*tw\.[\w]+[`(]/gm;
1920
+ function hoistComponents(source) {
1921
+ const hoisted = [];
1922
+ const warnings = [];
1923
+ const indentedDecls = [];
1924
+ let m;
1925
+ const re = new RegExp(INDENTED_TW_DECL_RE.source, "gm");
1926
+ while ((m = re.exec(source)) !== null) {
1927
+ const indent = m[1];
1928
+ const keyword = m[2];
1929
+ const name = m[3];
1930
+ if (!/^[A-Z]/.test(name)) continue;
1931
+ if (indent.length === 0) continue;
1932
+ indentedDecls.push({
1933
+ fullMatch: m[0],
1934
+ indent,
1935
+ keyword,
1936
+ name,
1937
+ startIndex: m.index
1938
+ });
1939
+ }
1940
+ if (indentedDecls.length === 0) {
1941
+ return { code: source, hoisted: [], warnings: [] };
1942
+ }
1943
+ let code = source;
1944
+ const hoistedDecls = [];
1945
+ for (const decl of [...indentedDecls].reverse()) {
1946
+ const { startIndex, indent, name } = decl;
1947
+ const lineStart = code.lastIndexOf("\n", startIndex) + 1;
1948
+ const restFromDecl = code.slice(lineStart);
1949
+ const fullStmt = extractFullStatement(restFromDecl);
1950
+ if (!fullStmt) continue;
1951
+ const dedented = fullStmt.split("\n").map((line) => line.startsWith(indent) ? line.slice(indent.length) : line).join("\n").trim();
1952
+ code = code.slice(0, lineStart) + code.slice(lineStart + fullStmt.length);
1953
+ hoistedDecls.unshift(dedented);
1954
+ hoisted.push(name);
1955
+ warnings.push(
1956
+ `[tw-hoist] '${name}' moved to module scope for better performance. Avoid defining tw components inside render functions.`
1957
+ );
1958
+ }
1959
+ if (hoistedDecls.length > 0) {
1960
+ const insertPoint = findAfterImports(code);
1961
+ const hoistBlock = `
1962
+ ${hoistedDecls.join("\n\n")}
1963
+ `;
1964
+ code = code.slice(0, insertPoint) + hoistBlock + code.slice(insertPoint);
1965
+ }
1966
+ return { code, hoisted, warnings };
1967
+ }
1968
+ function extractFullStatement(source) {
1969
+ const templateRe = /^[ \t]*(const|let)\s+\w+\s*=\s*tw\.\w+`[^`]*`.*\n?/;
1970
+ const templateMatch = source.match(templateRe);
1971
+ if (templateMatch) return templateMatch[0];
1972
+ const objStart = source.indexOf("tw.");
1973
+ if (objStart === -1) return null;
1974
+ const parenStart = source.indexOf("(", objStart);
1975
+ if (parenStart === -1) return null;
1976
+ let depth = 0;
1977
+ let i = parenStart;
1978
+ while (i < source.length) {
1979
+ if (source[i] === "(") depth++;
1980
+ if (source[i] === ")") {
1981
+ depth--;
1982
+ if (depth === 0) {
1983
+ const end = source.indexOf("\n", i);
1984
+ return source.slice(0, end === -1 ? i + 1 : end + 1);
1985
+ }
1986
+ }
1987
+ i++;
1988
+ }
1989
+ return null;
1990
+ }
1991
+ function findAfterImports(source) {
1992
+ const lines = source.split("\n");
1993
+ let lastImportLine = 0;
1994
+ for (let i = 0; i < lines.length; i++) {
1995
+ const line = lines[i].trim();
1996
+ if (line.startsWith("import ") || line.startsWith("'use client'") || line.startsWith('"use client"')) {
1997
+ lastImportLine = i;
1998
+ } else if (line && !line.startsWith("//") && !line.startsWith("/*") && lastImportLine > 0) {
1999
+ break;
2000
+ }
2001
+ }
2002
+ return lines.slice(0, lastImportLine + 1).join("\n").length + 1;
2003
+ }
2004
+
2005
+ // ../compiler/src/rscAnalyzer.ts
2006
+ var CSS_INTERACTIVE_OK = [
2007
+ /^hover:/,
2008
+ // CSS :hover — no JS needed
2009
+ /^focus:/,
2010
+ // CSS :focus — no JS needed
2011
+ /^focus-within:/,
2012
+ // CSS :focus-within
2013
+ /^focus-visible:/,
2014
+ // CSS :focus-visible
2015
+ /^active:/,
2016
+ // CSS :active
2017
+ /^group-hover:/,
2018
+ // Tailwind group variant — CSS only
2019
+ /^group-focus:/,
2020
+ // CSS only
2021
+ /^peer-/,
2022
+ // Tailwind peer — CSS only
2023
+ /^first:/,
2024
+ // CSS :first-child
2025
+ /^last:/,
2026
+ // CSS :last-child
2027
+ /^odd:/,
2028
+ // CSS :nth-child(odd)
2029
+ /^even:/,
2030
+ // CSS :nth-child(even)
2031
+ /^disabled:/,
2032
+ // CSS :disabled
2033
+ /^placeholder:/,
2034
+ // CSS ::placeholder
2035
+ /^dark:/,
2036
+ // CSS @media prefers-color-scheme
2037
+ /^print:/,
2038
+ // CSS @media print
2039
+ /^md:|^sm:|^lg:|^xl:|^2xl:/
2040
+ // Responsive breakpoints — CSS only
2041
+ ];
2042
+ var REQUIRES_JS_PATTERNS = [
2043
+ // React hooks
2044
+ /\buseState\b/,
2045
+ /\buseEffect\b/,
2046
+ /\buseRef\b/,
2047
+ /\buseCallback\b/,
2048
+ /\buseMemo\b/,
2049
+ /\buseReducer\b/,
2050
+ /\buseContext\b/,
2051
+ // Event handlers
2052
+ /\bon[A-Z][a-zA-Z]+\s*[=:]/,
2053
+ // onClick=, onMouseEnter:, etc.
2054
+ // Browser APIs
2055
+ /\bwindow\./,
2056
+ /\bdocument\./,
2057
+ /\blocalStorage\b/,
2058
+ /\bsessionStorage\b/,
2059
+ // Dynamic imports
2060
+ /import\s*\(/
2061
+ ];
2062
+ function analyzeFile(source, _filename = "") {
2063
+ const clientReasons = [];
2064
+ const interactiveClasses = [];
2065
+ const hasClientDirective = source.trimStart().startsWith('"use client"') || source.trimStart().startsWith("'use client'");
2066
+ if (hasClientDirective) {
2067
+ clientReasons.push("explicit 'use client' directive");
2068
+ }
2069
+ for (const pattern of REQUIRES_JS_PATTERNS) {
2070
+ if (pattern.test(source)) {
2071
+ const match = source.match(pattern);
2072
+ if (match) clientReasons.push(`uses ${match[0].trim()}`);
2073
+ }
2074
+ }
2075
+ const hasServerMarker = source.includes("tw.server.");
2076
+ const templateRe = /\btw\.(?:server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
2077
+ const _objectRe = /\btw\.(?:server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
2078
+ let m;
2079
+ while ((m = templateRe.exec(source)) !== null) {
2080
+ const classes = m[2];
2081
+ const parts = classes.split(/\s+/).filter(Boolean);
2082
+ for (const cls of parts) {
2083
+ const isOk = CSS_INTERACTIVE_OK.some((re) => re.test(cls));
2084
+ if (!isOk && /^[a-z-]+:/.test(cls)) {
2085
+ interactiveClasses.push(cls);
2086
+ clientReasons.push(`uses JS-interactive class: ${cls}`);
2087
+ }
2088
+ }
2089
+ }
2090
+ const needsClientDirective = !hasServerMarker && (hasClientDirective || clientReasons.length > 0);
2091
+ const isServer = !needsClientDirective || hasServerMarker;
2092
+ return {
2093
+ isServer,
2094
+ needsClientDirective,
2095
+ clientReasons: [...new Set(clientReasons)],
2096
+ interactiveClasses: [...new Set(interactiveClasses)],
2097
+ canStaticResolveVariants: isServer
2098
+ };
2099
+ }
2100
+ function injectClientDirective(code) {
2101
+ if (code.startsWith('"use client"') || code.startsWith("'use client'")) {
2102
+ return code;
2103
+ }
2104
+ return `"use client";
2105
+ ${code}`;
2106
+ }
2107
+
2108
+ // ../compiler/src/twDetector.ts
2109
+ var IMPORT_RE = /from\s*["']tailwind-styled-v4["']/;
2110
+ var TRANSFORM_MARKER = "/* @tw-transformed */";
2111
+ function hasTwUsage(source) {
2112
+ return IMPORT_RE.test(source) || source.includes("tw.");
2113
+ }
2114
+ function isAlreadyTransformed(source) {
2115
+ return source.includes(TRANSFORM_MARKER);
2116
+ }
2117
+ function isDynamic(content) {
2118
+ return content.includes("${");
2119
+ }
2120
+
2121
+ // ../compiler/src/astParser.ts
2122
+ function oxcKey(node) {
2123
+ if (!node) return null;
2124
+ if (node.type === "Identifier") return node.name;
2125
+ if (node.type === "Literal" && typeof node.value === "string") return node.value;
2126
+ return null;
2127
+ }
2128
+ function oxcStringVal(node) {
2129
+ var _a2;
2130
+ if (!node) return null;
2131
+ if (node.type === "Literal" && typeof node.value === "string") return node.value;
2132
+ if (node.type === "TemplateLiteral" && ((_a2 = node.expressions) == null ? void 0 : _a2.length) === 0) {
2133
+ return node.quasis.map((q) => {
2134
+ var _a3, _b2, _c, _d;
2135
+ return (_d = (_c = (_a3 = q.value) == null ? void 0 : _a3.cooked) != null ? _c : (_b2 = q.value) == null ? void 0 : _b2.raw) != null ? _d : "";
2136
+ }).join("");
2137
+ }
2138
+ return null;
2139
+ }
2140
+ function oxcWalkObject(node) {
2141
+ var _a2;
2142
+ const result = {};
2143
+ if ((node == null ? void 0 : node.type) !== "ObjectExpression") return result;
2144
+ for (const prop of (_a2 = node.properties) != null ? _a2 : []) {
2145
+ if (prop.type !== "Property") continue;
2146
+ const key = oxcKey(prop.key);
2147
+ if (!key) continue;
2148
+ const val = prop.value;
2149
+ const strVal = oxcStringVal(val);
2150
+ if (strVal !== null) {
2151
+ result[key] = strVal;
2152
+ } else if ((val == null ? void 0 : val.type) === "ObjectExpression") {
2153
+ result[key] = oxcWalkObject(val);
2154
+ } else if ((val == null ? void 0 : val.type) === "ArrayExpression") {
2155
+ result[key] = val.elements.filter((el) => (el == null ? void 0 : el.type) === "ObjectExpression").map((el) => oxcWalkObject(el));
2156
+ }
2157
+ }
2158
+ return result;
2159
+ }
2160
+ function parseWithOxc(objectStr) {
2161
+ var _a2, _b2, _c;
2162
+ let parseSync3;
2163
+ try {
2164
+ parseSync3 = (init_src_js(), __toCommonJS(src_js_exports)).parseSync;
2165
+ } catch (e) {
2166
+ return null;
2167
+ }
2168
+ try {
2169
+ const source = `const __c = ${objectStr}`;
2170
+ const { program, errors } = parseSync3("config.ts", source, { sourceType: "script" });
2171
+ if ((errors == null ? void 0 : errors.length) > 0 || !((_a2 = program == null ? void 0 : program.body) == null ? void 0 : _a2[0])) return null;
2172
+ const varDecl = program.body[0];
2173
+ if (varDecl.type !== "VariableDeclaration") return null;
2174
+ const init = (_c = (_b2 = varDecl.declarations) == null ? void 0 : _b2[0]) == null ? void 0 : _c.init;
2175
+ if ((init == null ? void 0 : init.type) !== "ObjectExpression") return null;
2176
+ const raw = oxcWalkObject(init);
2177
+ const base = typeof raw.base === "string" ? raw.base.trim() : "";
2178
+ const variants = {};
2179
+ const rawVariants = raw.variants;
2180
+ if (rawVariants && typeof rawVariants === "object" && !Array.isArray(rawVariants)) {
2181
+ for (const [vName, vMap] of Object.entries(rawVariants)) {
2182
+ if (vMap && typeof vMap === "object" && !Array.isArray(vMap)) {
2183
+ variants[vName] = {};
2184
+ for (const [vVal, cls] of Object.entries(vMap)) {
2185
+ if (typeof cls === "string") variants[vName][vVal] = cls.trim();
2186
+ }
2187
+ }
2188
+ }
2189
+ }
2190
+ const compounds = [];
2191
+ const rawCompounds = raw.compoundVariants;
2192
+ if (Array.isArray(rawCompounds)) {
2193
+ for (const item of rawCompounds) {
2194
+ if (item && typeof item.class === "string") {
2195
+ compounds.push(item);
2196
+ }
2197
+ }
2198
+ }
2199
+ const defaults = {};
2200
+ const rawDefaults = raw.defaultVariants;
2201
+ if (rawDefaults && typeof rawDefaults === "object" && !Array.isArray(rawDefaults)) {
2202
+ for (const [k, v] of Object.entries(rawDefaults)) {
2203
+ if (typeof v === "string") defaults[k] = v;
2204
+ }
2205
+ }
2206
+ return { base, variants, compounds, defaults };
2207
+ } catch (e) {
2208
+ return null;
2209
+ }
2210
+ }
2211
+ function tokenize(src) {
2212
+ const tokens = [];
2213
+ let i = 0;
2214
+ while (i < src.length) {
2215
+ const ch = src[i];
2216
+ if (/\s/.test(ch)) {
2217
+ i++;
2218
+ continue;
2219
+ }
2220
+ if (ch === '"' || ch === "'" || ch === "`") {
2221
+ const quote = ch;
2222
+ let j = i + 1;
2223
+ let str = ch;
2224
+ while (j < src.length) {
2225
+ if (src[j] === "\\" && quote !== "`") {
2226
+ str += src[j] + src[j + 1];
2227
+ j += 2;
2228
+ continue;
2229
+ }
2230
+ if (src[j] === "\\" && quote === "`") {
2231
+ str += src[j] + src[j + 1];
2232
+ j += 2;
2233
+ continue;
2234
+ }
2235
+ str += src[j];
2236
+ if (src[j] === quote) {
2237
+ j++;
2238
+ break;
2239
+ }
2240
+ j++;
2241
+ }
2242
+ tokens.push({ type: "string", value: str.slice(1, -1), pos: i });
2243
+ i = j;
2244
+ continue;
2245
+ }
2246
+ if (ch === ":") {
2247
+ tokens.push({ type: "colon", value: ":", pos: i });
2248
+ i++;
2249
+ continue;
2250
+ }
2251
+ if (ch === ",") {
2252
+ tokens.push({ type: "comma", value: ",", pos: i });
2253
+ i++;
2254
+ continue;
2255
+ }
2256
+ if (ch === "{") {
2257
+ tokens.push({ type: "lbrace", value: "{", pos: i });
2258
+ i++;
2259
+ continue;
2260
+ }
2261
+ if (ch === "}") {
2262
+ tokens.push({ type: "rbrace", value: "}", pos: i });
2263
+ i++;
2264
+ continue;
2265
+ }
2266
+ if (ch === "[") {
2267
+ tokens.push({ type: "lbracket", value: "[", pos: i });
2268
+ i++;
2269
+ continue;
2270
+ }
2271
+ if (ch === "]") {
2272
+ tokens.push({ type: "rbracket", value: "]", pos: i });
2273
+ i++;
2274
+ continue;
2275
+ }
2276
+ if (/[\w$]/.test(ch)) {
2277
+ let j = i;
2278
+ while (j < src.length && /[\w$]/.test(src[j])) j++;
2279
+ tokens.push({ type: "key", value: src.slice(i, j), pos: i });
2280
+ i = j;
2281
+ continue;
2282
+ }
2283
+ tokens.push({ type: "other", value: ch, pos: i });
2284
+ i++;
2285
+ }
2286
+ return tokens;
2287
+ }
2288
+ function parseObject(tokens, startIdx) {
2289
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
2290
+ const obj = {};
2291
+ let i = startIdx;
2292
+ if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbrace") return { obj, endIdx: i };
2293
+ i++;
2294
+ while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbrace") {
2295
+ if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2296
+ i++;
2297
+ continue;
2298
+ }
2299
+ let key = null;
2300
+ if (((_d = tokens[i]) == null ? void 0 : _d.type) === "string") {
2301
+ key = tokens[i].value;
2302
+ i++;
2303
+ } else if (((_e = tokens[i]) == null ? void 0 : _e.type) === "key") {
2304
+ key = tokens[i].value;
2305
+ i++;
2306
+ } else {
2307
+ i++;
2308
+ continue;
2309
+ }
2310
+ if (((_f = tokens[i]) == null ? void 0 : _f.type) !== "colon") continue;
2311
+ i++;
2312
+ if (((_g = tokens[i]) == null ? void 0 : _g.type) === "lbrace") {
2313
+ const { obj: nested, endIdx } = parseObject(tokens, i);
2314
+ obj[key] = nested;
2315
+ i = endIdx + 1;
2316
+ } else if (((_h = tokens[i]) == null ? void 0 : _h.type) === "lbracket") {
2317
+ const { arr, endIdx } = parseArray(tokens, i);
2318
+ obj[key] = arr;
2319
+ i = endIdx + 1;
2320
+ } else if (((_i = tokens[i]) == null ? void 0 : _i.type) === "string") {
2321
+ obj[key] = tokens[i].value;
2322
+ i++;
2323
+ } else if (((_j = tokens[i]) == null ? void 0 : _j.type) === "key") {
2324
+ obj[key] = tokens[i].value;
2325
+ i++;
2326
+ } else {
2327
+ i++;
2328
+ }
2329
+ }
2330
+ return { obj, endIdx: i };
2331
+ }
2332
+ function parseArray(tokens, startIdx) {
2333
+ var _a2, _b2, _c, _d;
2334
+ const arr = [];
2335
+ let i = startIdx;
2336
+ if (((_a2 = tokens[i]) == null ? void 0 : _a2.type) !== "lbracket") return { arr, endIdx: i };
2337
+ i++;
2338
+ while (i < tokens.length && ((_b2 = tokens[i]) == null ? void 0 : _b2.type) !== "rbracket") {
2339
+ if (((_c = tokens[i]) == null ? void 0 : _c.type) === "comma") {
2340
+ i++;
2341
+ continue;
2342
+ }
2343
+ if (((_d = tokens[i]) == null ? void 0 : _d.type) === "lbrace") {
2344
+ const { obj, endIdx } = parseObject(tokens, i);
2345
+ arr.push(obj);
2346
+ i = endIdx + 1;
2347
+ } else {
2348
+ i++;
2349
+ }
2350
+ }
2351
+ return { arr, endIdx: i };
2352
+ }
2353
+ function parseComponentConfigFallback(objectStr) {
2354
+ const tokens = tokenize(objectStr);
2355
+ const { obj } = parseObject(tokens, 0);
2356
+ const base = typeof obj.base === "string" ? obj.base.trim() : "";
2357
+ const variants = {};
2358
+ const rawVariants = obj.variants;
2359
+ if (rawVariants && typeof rawVariants === "object" && !Array.isArray(rawVariants)) {
2360
+ for (const [variantName, variantValues] of Object.entries(rawVariants)) {
2361
+ if (typeof variantValues === "object" && !Array.isArray(variantValues)) {
2362
+ variants[variantName] = {};
2363
+ for (const [valueName, cls] of Object.entries(variantValues)) {
2364
+ if (typeof cls === "string") variants[variantName][valueName] = cls.trim();
2365
+ }
2366
+ }
2367
+ }
2368
+ }
2369
+ const compounds = [];
2370
+ const rawCompounds = obj.compoundVariants;
2371
+ if (Array.isArray(rawCompounds)) {
2372
+ for (const item of rawCompounds) {
2373
+ if (item && typeof item.class === "string") compounds.push(item);
2374
+ }
2375
+ }
2376
+ const defaults = {};
2377
+ const rawDefaults = obj.defaultVariants;
2378
+ if (rawDefaults && typeof rawDefaults === "object" && !Array.isArray(rawDefaults)) {
2379
+ for (const [k, v] of Object.entries(rawDefaults)) {
2380
+ if (typeof v === "string") defaults[k] = v;
2381
+ }
2382
+ }
2383
+ return { base, variants, compounds, defaults };
2384
+ }
2385
+ function parseComponentConfig(objectStr) {
2386
+ const oxcResult = parseWithOxc(objectStr);
2387
+ if (oxcResult !== null) return oxcResult;
2388
+ return parseComponentConfigFallback(objectStr);
2389
+ }
2390
+
2391
+ // ../compiler/src/variantCompiler.ts
2392
+ function compileVariants(base, variants, compounds = [], defaults = {}) {
2393
+ const table = {};
2394
+ for (const key in variants) {
2395
+ table[key] = {};
2396
+ for (const val in variants[key]) {
2397
+ table[key][val] = normalizeClasses(variants[key][val]);
2398
+ }
2399
+ }
2400
+ return { base, table, compounds, defaults };
2401
+ }
2402
+ function generateVariantCode(id, compiled) {
2403
+ const { table, compounds, defaults } = compiled;
2404
+ const tableJson = JSON.stringify(table, null, 2);
2405
+ const compoundsJson = JSON.stringify(compounds, null, 2);
2406
+ const defaultsJson = JSON.stringify(defaults, null, 2);
2407
+ return `const __vt_${id} = ${tableJson};
2408
+ const __vc_${id} = ${compoundsJson};
2409
+ const __vd_${id} = ${defaultsJson};`;
2410
+ }
2411
+ function parseObjectConfig(objectStr) {
2412
+ return parseComponentConfig(objectStr);
2413
+ }
2414
+
2415
+ // ../compiler/src/astTransform.ts
2416
+ var TEMPLATE_RE = /\btw\.(server\.)?(\w+)`((?:[^`\\]|\\.)*)`/g;
2417
+ var OBJECT_RE = /\btw\.(server\.)?(\w+)\(\s*(\{[\s\S]*?\})\s*\)/g;
2418
+ var EXTEND_RE = /(\w+)\.extend`((?:[^`\\]|\\.)*)`/g;
2419
+ var WRAP_RE = /\btw\((\w+)\)`((?:[^`\\]|\\.)*)`/g;
2420
+ var _idCounter = 0;
2421
+ function genId() {
2422
+ return `c${(++_idCounter).toString(36)}`;
2423
+ }
2424
+ function renderStaticComponent(tag, classes, opts) {
2425
+ const { addDataAttr, compName } = opts;
2426
+ const fnName = compName ? `_Tw_${compName}` : `_Tw_${tag}`;
2427
+ const dataAttr = addDataAttr ? `, "data-tw": "${fnName}:${classes.split(" ").slice(0, 3).join(" ")}${classes.split(" ").length > 3 ? "..." : ""}"` : "";
2428
+ return `React.forwardRef(function ${fnName}(props, ref) {
2429
+ var _c = props.className;
2430
+ var _r = Object.assign({}, props);
2431
+ delete _r.className;
2432
+ return React.createElement("${tag}", Object.assign({ ref }, _r${dataAttr}, { className: [${JSON.stringify(classes)}, _c].filter(Boolean).join(" ") }));
2433
+ })`;
2434
+ }
2435
+ function renderVariantComponent(tag, id, base, variantKeys, defaults, opts) {
2436
+ const { addDataAttr } = opts;
2437
+ const fnName = `_TwV_${tag}_${id}`;
2438
+ const dataAttr = addDataAttr ? `, "data-tw": "${fnName}"` : "";
2439
+ const vKeys = variantKeys.map((k) => `"${k}"`).join(", ");
2440
+ const destructure = variantKeys.length > 0 ? `var _vp = {}; [${vKeys}].forEach(function(k){ _vp[k] = props[k]; delete _rest[k]; });` : "";
2441
+ const variantLookup = variantKeys.length > 0 ? variantKeys.map(
2442
+ (k) => {
2443
+ var _a2;
2444
+ return `(__vt_${id}["${k}"] && __vt_${id}["${k}"][_vp["${k}"] ?? ${JSON.stringify((_a2 = defaults[k]) != null ? _a2 : "")}] || "")`;
2445
+ }
2446
+ ).join(", ") : "";
2447
+ const classParts = variantKeys.length > 0 ? `[${JSON.stringify(base)}, ${variantLookup}, _rest.className]` : `[${JSON.stringify(base)}, _rest.className]`;
2448
+ return `React.forwardRef(function ${fnName}(props, ref) {
2449
+ var _rest = Object.assign({}, props);
2450
+ delete _rest.className;
2451
+ ${destructure}
2452
+ return React.createElement("${tag}", Object.assign({ ref }, _rest${dataAttr}, { className: ${classParts}.filter(Boolean).join(" ") }));
2453
+ })`;
2454
+ }
2455
+ function transformSource(source, opts = {}) {
2456
+ const {
2457
+ mode = "zero-runtime",
2458
+ autoClientBoundary = true,
2459
+ addDataAttr = false,
2460
+ hoist = true,
2461
+ filename = ""
2462
+ } = opts;
2463
+ if (!hasTwUsage(source)) {
2464
+ return { code: source, classes: [], changed: false };
2465
+ }
2466
+ if (isAlreadyTransformed(source)) {
2467
+ return { code: source, classes: [], changed: false };
2468
+ }
2469
+ if (mode === "runtime" || mode === "extract-only") {
2470
+ return { code: source, classes: [], changed: false };
2471
+ }
2472
+ const rscAnalysis = analyzeFile(source, filename);
2473
+ let code = source;
2474
+ if (hoist) {
2475
+ const hoistResult = hoistComponents(source);
2476
+ if (hoistResult.hoisted.length > 0) {
2477
+ code = hoistResult.code;
2478
+ if (process.env.NODE_ENV !== "production") {
2479
+ for (const w of hoistResult.warnings) {
2480
+ console.warn(w);
2481
+ }
2482
+ }
2483
+ }
2484
+ }
2485
+ let changed = false;
2486
+ const allClasses = [];
2487
+ const prelude = [];
2488
+ let needsReact = false;
2489
+ code = code.replace(
2490
+ TEMPLATE_RE,
2491
+ (match, serverMark, tag, content) => {
2492
+ if (isDynamic(content)) return match;
2493
+ const classes = normalizeClasses(content);
2494
+ if (!classes) return match;
2495
+ const isServerOnly = !!serverMark;
2496
+ allClasses.push(...classes.split(/\s+/).filter(Boolean));
2497
+ changed = true;
2498
+ needsReact = true;
2499
+ const rendered = renderStaticComponent(tag, classes, {
2500
+ addDataAttr,
2501
+ isServer: rscAnalysis.isServer || isServerOnly
2502
+ });
2503
+ return isServerOnly ? `/* @server-only */ ${rendered}` : rendered;
2504
+ }
2505
+ );
2506
+ code = code.replace(
2507
+ OBJECT_RE,
2508
+ (match, serverMark, tag, objectStr) => {
2509
+ const { base, variants, compounds, defaults } = parseObjectConfig(objectStr);
2510
+ if (!base && Object.keys(variants).length === 0) return match;
2511
+ const isServerOnly = !!serverMark;
2512
+ allClasses.push(...base.split(/\s+/).filter(Boolean));
2513
+ for (const vMap of Object.values(variants)) {
2514
+ for (const cls of Object.values(vMap)) {
2515
+ allClasses.push(...cls.split(/\s+/).filter(Boolean));
2516
+ }
2517
+ }
2518
+ changed = true;
2519
+ needsReact = true;
2520
+ const id = genId();
2521
+ const compiled = compileVariants(base, variants, compounds, defaults);
2522
+ prelude.push(generateVariantCode(id, compiled));
2523
+ const variantKeys = Object.keys(variants);
2524
+ const rendered = renderVariantComponent(tag, id, base, variantKeys, defaults, {
2525
+ addDataAttr,
2526
+ isServer: rscAnalysis.isServer || isServerOnly
2527
+ });
2528
+ return isServerOnly ? `/* @server-only */ ${rendered}` : rendered;
2529
+ }
2530
+ );
2531
+ code = code.replace(WRAP_RE, (match, compName, content) => {
2532
+ if (isDynamic(content)) return match;
2533
+ const classes = normalizeClasses(content);
2534
+ if (!classes) return match;
2535
+ allClasses.push(...classes.split(/\s+/).filter(Boolean));
2536
+ changed = true;
2537
+ needsReact = true;
2538
+ return `React.forwardRef(function _TwWrap_${compName}(props, ref) {
2539
+ var _c = [${JSON.stringify(classes)}, props.className].filter(Boolean).join(" ");
2540
+ return React.createElement(${compName}, Object.assign({}, props, { ref, className: _c }));
2541
+ })`;
2542
+ });
2543
+ code = code.replace(EXTEND_RE, (match, compName, content) => {
2544
+ if (isDynamic(content)) return match;
2545
+ const extra = normalizeClasses(content);
2546
+ if (!extra) return match;
2547
+ allClasses.push(...extra.split(/\s+/).filter(Boolean));
2548
+ changed = true;
2549
+ needsReact = true;
2550
+ return `React.forwardRef(function _TwExt_${compName}(props, ref) {
2551
+ var _c = [${JSON.stringify(extra)}, props.className].filter(Boolean).join(" ");
2552
+ return React.createElement(${compName}, Object.assign({}, props, { ref, className: _c }));
2553
+ })`;
2554
+ });
2555
+ if (!changed) {
2556
+ return { code: source, classes: [], rsc: rscAnalysis, changed: false };
2557
+ }
2558
+ if (prelude.length > 0) {
2559
+ const importEnd = findAfterImports2(code);
2560
+ code = `${code.slice(0, importEnd)}
2561
+ ${prelude.join("\n")}
2562
+ ${code.slice(importEnd)}`;
2563
+ }
2564
+ if (needsReact && !hasReactImport(source)) {
2565
+ code = `import React from "react";
2566
+ ${code}`;
2567
+ }
2568
+ if (autoClientBoundary && rscAnalysis.needsClientDirective) {
2569
+ code = injectClientDirective(code);
2570
+ }
2571
+ const stillUsesTw = /\btw\.(server\.)?\w+[`(]/.test(code) || /\btw\(\w+\)/.test(code);
2572
+ if (!stillUsesTw) {
2573
+ code = code.replace(
2574
+ /import\s*\{[^}]*\btw\b[^}]*\}\s*from\s*["']tailwind-styled-v4["'];?\n?/g,
2575
+ ""
2576
+ );
2577
+ }
2578
+ code = `${TRANSFORM_MARKER}
2579
+ ${code}`;
2580
+ return {
2581
+ code,
2582
+ classes: Array.from(new Set(allClasses)),
2583
+ rsc: {
2584
+ isServer: rscAnalysis.isServer,
2585
+ needsClientDirective: rscAnalysis.needsClientDirective,
2586
+ clientReasons: rscAnalysis.clientReasons
2587
+ },
2588
+ changed: true
2589
+ };
2590
+ }
2591
+ function hasReactImport(source) {
2592
+ return source.includes("import React") || source.includes("from 'react'") || source.includes('from "react"');
2593
+ }
2594
+ function findAfterImports2(source) {
2595
+ const lines = source.split("\n");
2596
+ let lastImportIdx = 0;
2597
+ for (let i = 0; i < lines.length; i++) {
2598
+ const line = lines[i].trim();
2599
+ if (line.startsWith("import ") || line.startsWith('"use client"') || line.startsWith("'use client'") || line.startsWith(TRANSFORM_MARKER) || line === "") {
2600
+ lastImportIdx = i;
2601
+ } else if (line && !line.startsWith("//") && !line.startsWith("/*")) {
2602
+ break;
2603
+ }
2604
+ }
2605
+ return lines.slice(0, lastImportIdx + 1).join("\n").length + 1;
2606
+ }
2607
+
2608
+ // ../compiler/src/routeCssCollector.ts
2609
+ var _collector = {
2610
+ files: /* @__PURE__ */ new Map(),
2611
+ routes: /* @__PURE__ */ new Map(),
2612
+ global: /* @__PURE__ */ new Set()
2613
+ };
2614
+ function registerFileClasses(filepath, classes) {
2615
+ if (!_collector.files.has(filepath)) {
2616
+ _collector.files.set(filepath, /* @__PURE__ */ new Set());
2617
+ }
2618
+ const fileSet = _collector.files.get(filepath);
2619
+ classes.forEach((c) => fileSet.add(c));
2620
+ const route = fileToRoute(filepath);
2621
+ if (route) {
2622
+ if (!_collector.routes.has(route)) {
2623
+ _collector.routes.set(route, /* @__PURE__ */ new Set());
2624
+ }
2625
+ _collector.routes.get(route).add(filepath);
2626
+ }
2627
+ }
2628
+ function fileToRoute(filepath) {
2629
+ const normalized = filepath.replace(/\\/g, "/");
2630
+ if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
2631
+ return "__global";
2632
+ }
2633
+ const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2634
+ if (pageMatch) return `/${pageMatch[1]}`;
2635
+ const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2636
+ if (rootPage) return "/";
2637
+ const pagesMatch = normalized.match(/\/pages\/(.+?)\.[tj]sx?$/);
2638
+ if (pagesMatch) {
2639
+ const route = pagesMatch[1].replace(/\/index$/, "");
2640
+ return `/${route}`;
2641
+ }
2642
+ if (normalized.includes("/components/") || normalized.includes("/ui/") || normalized.includes("/shared/")) {
2643
+ return "__global";
2644
+ }
2645
+ return null;
2646
+ }
2647
+
2648
+ // src/turbopackLoader.ts
2649
+ function turbopackLoader(source, options = {}) {
2650
+ const filepath = this.resourcePath;
2651
+ if (filepath.includes("node_modules") || filepath.includes(".next")) {
2652
+ return source;
2653
+ }
2654
+ if (!/\.(tsx|ts|jsx|js)$/.test(filepath)) {
2655
+ return source;
2656
+ }
2657
+ if (isAlreadyTransformed(source)) {
2658
+ return source;
2659
+ }
2660
+ if (options.incremental !== false) {
2661
+ const { getIncrementalEngine: getIncrementalEngine2, parseClassesToNodes: parseClassesToNodes2 } = (init_incrementalEngine(), __toCommonJS(incrementalEngine_exports));
2662
+ const engine = getIncrementalEngine2({ verbose: options.verbose });
2663
+ const quickResult = engine.processFile(filepath, source, []);
2664
+ if (!quickResult.changed) {
2665
+ return source;
2666
+ }
2667
+ let result;
2668
+ try {
2669
+ result = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
2670
+ } catch (err) {
2671
+ if (process.env.NODE_ENV !== "production") {
2672
+ console.warn(`[tailwind-styled-v4] Transform failed for ${filepath}:`, err);
2673
+ }
2674
+ return source;
2675
+ }
2676
+ if (options.routeCss && result.changed && result.classes.length > 0) {
2677
+ registerFileClasses(filepath, result.classes);
2678
+ }
2679
+ const nodes = parseClassesToNodes2(result.classes);
2680
+ const diff = engine.processFile(filepath, source, nodes);
2681
+ const { getBucketEngine: getBucketEngine2 } = (init_styleBucketSystem(), __toCommonJS(styleBucketSystem_exports));
2682
+ getBucketEngine2().applyDiff(diff.diff);
2683
+ if (options.verbose && result.changed && process.env.NODE_ENV !== "production") {
2684
+ const rsc = result.rsc;
2685
+ const env = (rsc == null ? void 0 : rsc.isServer) ? "server" : "client";
2686
+ console.log(
2687
+ `[tailwind-styled-v4] ${filepath.split("/").pop()} \u2192 ${result.classes.length} classes, ${env} component` + ((rsc == null ? void 0 : rsc.needsClientDirective) ? " (auto use-client)" : "")
2688
+ );
2689
+ }
2690
+ return result.code;
2691
+ }
2692
+ try {
2693
+ const result = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
2694
+ if (options.routeCss && result.changed && result.classes.length > 0) {
2695
+ registerFileClasses(filepath, result.classes);
2696
+ }
2697
+ if (options.verbose && result.changed && process.env.NODE_ENV !== "production") {
2698
+ const rsc = result.rsc;
2699
+ const env = (rsc == null ? void 0 : rsc.isServer) ? "server" : "client";
2700
+ console.log(
2701
+ `[tailwind-styled-v4] ${filepath.split("/").pop()} \u2192 ${result.classes.length} classes, ${env} component` + ((rsc == null ? void 0 : rsc.needsClientDirective) ? " (auto use-client)" : "")
2702
+ );
2703
+ }
2704
+ return result.code;
2705
+ } catch (err) {
2706
+ if (process.env.NODE_ENV !== "production") {
2707
+ console.warn(`[tailwind-styled-v4] Transform failed for ${filepath}:`, err);
2708
+ }
2709
+ return source;
2710
+ }
2711
+ }