tailwind-styled-v4 5.0.12 → 5.0.14
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.
- package/README.md +100 -4
- package/dist/animate.d.mts +4 -0
- package/dist/animate.d.ts +4 -0
- package/dist/animate.js +22 -0
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +22 -0
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +56 -14
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +56 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +156 -14
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +156 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +1045 -991
- package/dist/compiler.d.ts +1045 -991
- package/dist/compiler.js +891 -925
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +890 -925
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +1651 -354
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +1650 -353
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +3 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +1682 -365
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1682 -365
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +1076 -986
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +1076 -986
- package/dist/next.mjs.map +1 -1
- package/dist/shared.d.mts +3 -2
- package/dist/shared.d.ts +3 -2
- package/dist/shared.js +1595 -298
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +1595 -298
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +42 -24
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +42 -24
- package/dist/svelte.mjs.map +1 -1
- package/dist/turbopackLoader.js +1606 -309
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +1606 -309
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +156 -14
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +156 -14
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1636 -339
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1636 -339
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +42 -24
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +42 -24
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +80 -29
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +80 -29
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
- package/package.json +3 -2
- package/native/index.node +0 -0
package/dist/next.mjs
CHANGED
|
@@ -145,27 +145,15 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
145
145
|
}
|
|
146
146
|
tried.push(`env:${envPath} (not found)`);
|
|
147
147
|
}
|
|
148
|
-
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
149
|
-
for (const pkg of prebuiltPkgs) {
|
|
150
|
-
try {
|
|
151
|
-
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
152
|
-
if (fs9.existsSync(candidate)) {
|
|
153
|
-
return { path: candidate, source: "prebuilt", platform, tried };
|
|
154
|
-
}
|
|
155
|
-
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
156
|
-
} catch {
|
|
157
|
-
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
148
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
161
|
-
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
149
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
|
|
162
150
|
if (runtimeDir) {
|
|
163
151
|
for (const depth of ["..", path10.join("..", ".."), path10.join("..", "..", "..")]) {
|
|
164
152
|
const pkgRoot = path10.resolve(runtimeDir, depth);
|
|
165
153
|
for (const bin of BINARY_NAMES_SELF) {
|
|
166
154
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
167
155
|
const candidate = path10.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
168
|
-
tried.push(`
|
|
156
|
+
tried.push(`native:${candidate}`);
|
|
169
157
|
if (fs9.existsSync(candidate)) {
|
|
170
158
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
171
159
|
}
|
|
@@ -173,6 +161,18 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
173
161
|
}
|
|
174
162
|
}
|
|
175
163
|
}
|
|
164
|
+
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
165
|
+
for (const pkg of prebuiltPkgs) {
|
|
166
|
+
try {
|
|
167
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
168
|
+
if (fs9.existsSync(candidate)) {
|
|
169
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
170
|
+
}
|
|
171
|
+
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
172
|
+
} catch {
|
|
173
|
+
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
176
|
const cwd = process.cwd();
|
|
177
177
|
const base = runtimeDir ?? cwd;
|
|
178
178
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
@@ -300,271 +300,20 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
// packages/domain/compiler/src/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
clearCache: () => clearCache,
|
|
307
|
-
generateRawCss: () => generateRawCss,
|
|
308
|
-
getCacheStats: () => getCacheStats,
|
|
309
|
-
processTailwindCssWithTargets: () => processTailwindCssWithTargets,
|
|
310
|
-
runCssPipeline: () => runCssPipeline,
|
|
311
|
-
runCssPipelineSync: () => runCssPipelineSync
|
|
312
|
-
});
|
|
313
|
-
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
314
|
-
const sorted = [...classes].sort().join(",");
|
|
315
|
-
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
316
|
-
return `${sorted}|${flags}`;
|
|
317
|
-
}
|
|
318
|
-
function _evictOldestIfNeeded() {
|
|
319
|
-
if (_cssCache.size >= MAX_CACHE_SIZE) {
|
|
320
|
-
const firstKey = _cssCache.keys().next().value;
|
|
321
|
-
if (firstKey !== void 0) {
|
|
322
|
-
_cssCache.delete(firstKey);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function getCacheStats() {
|
|
327
|
-
const total = _cacheHits + _cacheMisses;
|
|
328
|
-
return {
|
|
329
|
-
hits: _cacheHits,
|
|
330
|
-
misses: _cacheMisses,
|
|
331
|
-
hitRate: total > 0 ? _cacheHits / total : 0,
|
|
332
|
-
size: _cssCache.size,
|
|
333
|
-
maxSize: MAX_CACHE_SIZE
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function clearCache() {
|
|
337
|
-
_cssCache.clear();
|
|
338
|
-
_cacheHits = 0;
|
|
339
|
-
_cacheMisses = 0;
|
|
340
|
-
}
|
|
341
|
-
function loadTailwindEngine() {
|
|
342
|
-
if (_twEngine) return _twEngine;
|
|
343
|
-
if (_twEngineError) throw _twEngineError;
|
|
344
|
-
try {
|
|
345
|
-
const tw = require2("tailwindcss");
|
|
346
|
-
if (typeof tw.compile !== "function") {
|
|
347
|
-
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
348
|
-
}
|
|
349
|
-
_twEngine = tw;
|
|
350
|
-
return _twEngine;
|
|
351
|
-
} catch (e) {
|
|
352
|
-
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
353
|
-
throw _twEngineError;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
async function generateRawCss(classes, cssEntryContent, root) {
|
|
357
|
-
if (classes.length === 0) return "";
|
|
358
|
-
const tw = loadTailwindEngine();
|
|
359
|
-
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
360
|
-
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
361
|
-
const { dirname, resolve: resolve2 } = await import('path');
|
|
362
|
-
const projectRoot = root ?? process.cwd();
|
|
363
|
-
const req = createRequire(resolve2(projectRoot, "package.json"));
|
|
364
|
-
const loadStylesheet = async (id, base) => {
|
|
365
|
-
try {
|
|
366
|
-
const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
|
|
367
|
-
const pkgPath = req.resolve(cssId);
|
|
368
|
-
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
369
|
-
} catch {
|
|
370
|
-
try {
|
|
371
|
-
const absPath = resolve2(base, id);
|
|
372
|
-
if (existsSync3(absPath)) {
|
|
373
|
-
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
374
|
-
}
|
|
375
|
-
} catch {
|
|
376
|
-
}
|
|
377
|
-
return { content: "", base };
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
381
|
-
return compiler.build(classes);
|
|
382
|
-
}
|
|
383
|
-
function getThemeConfig() {
|
|
384
|
-
return {
|
|
385
|
-
colors: {
|
|
386
|
-
slate: {
|
|
387
|
-
"50": "#f8fafc",
|
|
388
|
-
"100": "#f1f5f9",
|
|
389
|
-
"200": "#e2e8f0",
|
|
390
|
-
"300": "#cbd5e1",
|
|
391
|
-
"400": "#94a3b8",
|
|
392
|
-
"500": "#64748b",
|
|
393
|
-
"600": "#475569",
|
|
394
|
-
"700": "#334155",
|
|
395
|
-
"800": "#1e293b",
|
|
396
|
-
"900": "#0f172a"
|
|
397
|
-
},
|
|
398
|
-
gray: {
|
|
399
|
-
"50": "#f9fafb",
|
|
400
|
-
"100": "#f3f4f6",
|
|
401
|
-
"200": "#e5e7eb",
|
|
402
|
-
"300": "#d1d5db",
|
|
403
|
-
"400": "#9ca3af",
|
|
404
|
-
"500": "#6b7280",
|
|
405
|
-
"600": "#4b5563",
|
|
406
|
-
"700": "#374151",
|
|
407
|
-
"800": "#1f2937",
|
|
408
|
-
"900": "#111827"
|
|
409
|
-
},
|
|
410
|
-
white: "#ffffff",
|
|
411
|
-
black: "#000000",
|
|
412
|
-
red: {
|
|
413
|
-
"500": "#ef4444",
|
|
414
|
-
"600": "#dc2626"
|
|
415
|
-
},
|
|
416
|
-
blue: {
|
|
417
|
-
"500": "#3b82f6",
|
|
418
|
-
"600": "#1e40af"
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
spacing: {
|
|
422
|
-
"0": "0px",
|
|
423
|
-
"1": "0.25rem",
|
|
424
|
-
"2": "0.5rem",
|
|
425
|
-
"3": "0.75rem",
|
|
426
|
-
"4": "1rem",
|
|
427
|
-
"5": "1.25rem",
|
|
428
|
-
"6": "1.5rem",
|
|
429
|
-
"8": "2rem",
|
|
430
|
-
"10": "2.5rem",
|
|
431
|
-
"12": "3rem",
|
|
432
|
-
"16": "4rem",
|
|
433
|
-
"20": "5rem",
|
|
434
|
-
"24": "6rem"
|
|
435
|
-
},
|
|
436
|
-
breakpoints: {
|
|
437
|
-
"sm": "640px",
|
|
438
|
-
"md": "768px",
|
|
439
|
-
"lg": "1024px",
|
|
440
|
-
"xl": "1280px",
|
|
441
|
-
"2xl": "1536px"
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
function postProcessWithLightning(rawCss) {
|
|
446
|
-
if (!rawCss) return "";
|
|
303
|
+
// packages/domain/compiler/src/compiler/cssGeneratorNative.ts
|
|
304
|
+
async function generateCssNative(classes, options) {
|
|
305
|
+
const { theme } = options;
|
|
447
306
|
const native = getNativeBridge();
|
|
448
|
-
if (!native?.
|
|
449
|
-
throw new Error(
|
|
450
|
-
|
|
451
|
-
const result = native.processTailwindCssLightning(rawCss);
|
|
452
|
-
if (!result?.css) {
|
|
453
|
-
throw new Error("FATAL: processTailwindCssLightning returned null");
|
|
454
|
-
}
|
|
455
|
-
return result.css;
|
|
456
|
-
}
|
|
457
|
-
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
458
|
-
const filtered = classes.filter(Boolean);
|
|
459
|
-
const uniqueMap = /* @__PURE__ */ new Map();
|
|
460
|
-
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
461
|
-
const unique = Array.from(uniqueMap.values());
|
|
462
|
-
if (unique.length === 0) {
|
|
463
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
464
|
-
}
|
|
465
|
-
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
|
|
466
|
-
const cached = _cssCache.get(cacheKey);
|
|
467
|
-
if (cached) {
|
|
468
|
-
_cacheHits++;
|
|
469
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
470
|
-
console.log(
|
|
471
|
-
`[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
return cached;
|
|
475
|
-
}
|
|
476
|
-
_cacheMisses++;
|
|
477
|
-
let rawCss;
|
|
478
|
-
let usedRustCompiler = false;
|
|
479
|
-
try {
|
|
480
|
-
const theme = getThemeConfig();
|
|
481
|
-
rawCss = await generateCssNative(unique, {
|
|
482
|
-
theme,
|
|
483
|
-
fallbackToJs: true,
|
|
484
|
-
logFallback: process.env.DEBUG?.includes("compiler") === true
|
|
485
|
-
});
|
|
486
|
-
usedRustCompiler = true;
|
|
487
|
-
} catch (error) {
|
|
488
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
489
|
-
console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
|
|
490
|
-
}
|
|
491
|
-
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
492
|
-
}
|
|
493
|
-
const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
|
|
494
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
495
|
-
console.log(
|
|
496
|
-
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
497
|
-
`Size: ${finalCss.length} bytes`
|
|
307
|
+
if (!native?.generateCssNative) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
"FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
|
|
498
310
|
);
|
|
499
311
|
}
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
sizeBytes: finalCss.length,
|
|
504
|
-
optimized: minify
|
|
505
|
-
};
|
|
506
|
-
_evictOldestIfNeeded();
|
|
507
|
-
_cssCache.set(cacheKey, result);
|
|
508
|
-
return result;
|
|
509
|
-
}
|
|
510
|
-
function runCssPipelineSync(_classes) {
|
|
511
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
512
|
-
}
|
|
513
|
-
function processTailwindCssWithTargets(css, targets) {
|
|
514
|
-
const native = getNativeBridge();
|
|
515
|
-
if (!native?.processTailwindCssWithTargets) {
|
|
516
|
-
throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
|
|
517
|
-
}
|
|
518
|
-
const result = native.processTailwindCssWithTargets(css, targets ?? null);
|
|
519
|
-
if (!result?.css) {
|
|
520
|
-
throw new Error("FATAL: processTailwindCssWithTargets returned null");
|
|
521
|
-
}
|
|
522
|
-
return result.css;
|
|
523
|
-
}
|
|
524
|
-
var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
|
|
525
|
-
var init_tailwindEngine = __esm({
|
|
526
|
-
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
527
|
-
init_nativeBridge();
|
|
528
|
-
init_cssGeneratorNative();
|
|
529
|
-
require2 = createRequire(import.meta.url);
|
|
530
|
-
_cssCache = /* @__PURE__ */ new Map();
|
|
531
|
-
_cacheHits = 0;
|
|
532
|
-
_cacheMisses = 0;
|
|
533
|
-
MAX_CACHE_SIZE = 100;
|
|
534
|
-
_twEngine = null;
|
|
535
|
-
_twEngineError = null;
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
// packages/domain/compiler/src/cssGeneratorNative.ts
|
|
540
|
-
async function generateCssNative(classes, options) {
|
|
541
|
-
const {
|
|
542
|
-
theme,
|
|
543
|
-
fallbackToJs = true,
|
|
544
|
-
logFallback = false
|
|
545
|
-
} = options;
|
|
546
|
-
try {
|
|
547
|
-
const native = getNativeBridge();
|
|
548
|
-
if (!native?.generateCssNative) {
|
|
549
|
-
throw new Error("generateCssNative not available in native binding");
|
|
550
|
-
}
|
|
551
|
-
const themeJson = JSON.stringify(theme);
|
|
552
|
-
const css = native.generateCssNative(classes, themeJson);
|
|
553
|
-
return css;
|
|
554
|
-
} catch (error) {
|
|
555
|
-
if (!fallbackToJs) {
|
|
556
|
-
throw error;
|
|
557
|
-
}
|
|
558
|
-
if (logFallback) {
|
|
559
|
-
console.warn(
|
|
560
|
-
"[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
|
|
561
|
-
error instanceof Error ? error.message : String(error)
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
return generateRawCss(classes);
|
|
565
|
-
}
|
|
312
|
+
const themeJson = JSON.stringify(theme);
|
|
313
|
+
const css = native.generateCssNative(classes, themeJson);
|
|
314
|
+
return css;
|
|
566
315
|
}
|
|
567
|
-
function
|
|
316
|
+
function getCacheStats() {
|
|
568
317
|
try {
|
|
569
318
|
const native = getNativeBridge();
|
|
570
319
|
if (!native?.getCacheStats) {
|
|
@@ -587,152 +336,36 @@ function clearThemeCache() {
|
|
|
587
336
|
}
|
|
588
337
|
}
|
|
589
338
|
var init_cssGeneratorNative = __esm({
|
|
590
|
-
"packages/domain/compiler/src/cssGeneratorNative.ts"() {
|
|
339
|
+
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
591
340
|
init_nativeBridge();
|
|
592
|
-
init_tailwindEngine();
|
|
593
341
|
}
|
|
594
342
|
});
|
|
595
343
|
|
|
596
|
-
// packages/domain/compiler/src/
|
|
597
|
-
function
|
|
344
|
+
// packages/domain/compiler/src/compiler/compilationNative.ts
|
|
345
|
+
function compileCssNative2(classes, prefix) {
|
|
598
346
|
const native = getNativeBridge();
|
|
599
|
-
if (!native?.
|
|
600
|
-
return native.
|
|
347
|
+
if (!native?.compileCss) throw new Error("compileCss not available");
|
|
348
|
+
return native.compileCss(classes, prefix);
|
|
601
349
|
}
|
|
602
|
-
function
|
|
350
|
+
function compileCssLightning(classes) {
|
|
603
351
|
const native = getNativeBridge();
|
|
604
|
-
if (!native?.
|
|
605
|
-
return native.
|
|
352
|
+
if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
|
|
353
|
+
return native.compileCssLightning(classes);
|
|
606
354
|
}
|
|
607
|
-
function
|
|
355
|
+
function extractTwStateConfigsNative(source, filename) {
|
|
608
356
|
const native = getNativeBridge();
|
|
609
|
-
if (!native?.
|
|
610
|
-
return native.
|
|
357
|
+
if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
|
|
358
|
+
return native.extractTwStateConfigs(source, filename);
|
|
611
359
|
}
|
|
612
|
-
function
|
|
360
|
+
function generateStaticStateCssNative(inputs, resolvedCss) {
|
|
613
361
|
const native = getNativeBridge();
|
|
614
|
-
if (!native?.
|
|
615
|
-
return native.
|
|
362
|
+
if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
|
|
363
|
+
return native.generateStaticStateCss(inputs, resolvedCss ?? null);
|
|
616
364
|
}
|
|
617
|
-
function
|
|
365
|
+
function extractAndGenerateStateCssNative(source, filename) {
|
|
618
366
|
const native = getNativeBridge();
|
|
619
|
-
if (!native?.
|
|
620
|
-
return native.
|
|
621
|
-
}
|
|
622
|
-
function collectFiles(root, extensions) {
|
|
623
|
-
const native = getNativeBridge();
|
|
624
|
-
if (!native?.collect_files) throw new Error("collect_files not available");
|
|
625
|
-
return native.collect_files(root, extensions);
|
|
626
|
-
}
|
|
627
|
-
function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
|
|
628
|
-
const native = getNativeBridge();
|
|
629
|
-
if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
|
|
630
|
-
return native.walk_and_prefilter_source_files(root, extensions);
|
|
631
|
-
}
|
|
632
|
-
function generateSubComponentTypes(root, outputPath) {
|
|
633
|
-
const native = getNativeBridge();
|
|
634
|
-
if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
|
|
635
|
-
return native.generate_sub_component_types(root, outputPath);
|
|
636
|
-
}
|
|
637
|
-
var init_scannerNative = __esm({
|
|
638
|
-
"packages/domain/compiler/src/scannerNative.ts"() {
|
|
639
|
-
init_nativeBridge();
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
// packages/domain/compiler/src/analyzerNative.ts
|
|
644
|
-
function detectDeadCode(scanResultJson, css) {
|
|
645
|
-
const native = getNativeBridge();
|
|
646
|
-
if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
|
|
647
|
-
return native.detectDeadCode(scanResultJson, css);
|
|
648
|
-
}
|
|
649
|
-
function analyzeClassUsageNative(classes, scanResultJson, css) {
|
|
650
|
-
const native = getNativeBridge();
|
|
651
|
-
if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
|
|
652
|
-
return native.analyzeClassUsage(classes, scanResultJson, css);
|
|
653
|
-
}
|
|
654
|
-
function analyzeClassesNative(filesJson, cwd, flags) {
|
|
655
|
-
const native = getNativeBridge();
|
|
656
|
-
if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
|
|
657
|
-
return native.analyzeClasses(filesJson, cwd, flags ?? 0);
|
|
658
|
-
}
|
|
659
|
-
function analyzeRscNative(source, filename) {
|
|
660
|
-
const native = getNativeBridge();
|
|
661
|
-
if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
|
|
662
|
-
return native.analyzeRsc(source, filename);
|
|
663
|
-
}
|
|
664
|
-
function optimizeCssNative(css) {
|
|
665
|
-
const native = getNativeBridge();
|
|
666
|
-
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
667
|
-
const result = native.processTailwindCssLightning(css);
|
|
668
|
-
return {
|
|
669
|
-
css: result.css,
|
|
670
|
-
originalSize: css.length,
|
|
671
|
-
optimizedSize: result.size_bytes,
|
|
672
|
-
reductionPercentage: (css.length - result.size_bytes) / css.length * 100
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
function processTailwindCssLightning(css) {
|
|
676
|
-
const native = getNativeBridge();
|
|
677
|
-
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
678
|
-
return native.processTailwindCssLightning(css);
|
|
679
|
-
}
|
|
680
|
-
function eliminateDeadCssNative(css, deadClasses) {
|
|
681
|
-
const native = getNativeBridge();
|
|
682
|
-
if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
|
|
683
|
-
return native.eliminateDeadCss(css, deadClasses);
|
|
684
|
-
}
|
|
685
|
-
function hoistComponentsNative(source) {
|
|
686
|
-
const native = getNativeBridge();
|
|
687
|
-
if (!native?.hoistComponents) throw new Error("hoistComponents not available");
|
|
688
|
-
return native.hoistComponents(source);
|
|
689
|
-
}
|
|
690
|
-
function compileVariantTableNative(configJson) {
|
|
691
|
-
const native = getNativeBridge();
|
|
692
|
-
if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
|
|
693
|
-
return native.compileVariantTable(configJson);
|
|
694
|
-
}
|
|
695
|
-
function classifyAndSortClassesNative(classes) {
|
|
696
|
-
const native = getNativeBridge();
|
|
697
|
-
if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
|
|
698
|
-
return native.classifyAndSortClasses(classes);
|
|
699
|
-
}
|
|
700
|
-
function mergeCssDeclarationsNative(cssChunks) {
|
|
701
|
-
const native = getNativeBridge();
|
|
702
|
-
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
703
|
-
return native.mergeCssDeclarations(cssChunks);
|
|
704
|
-
}
|
|
705
|
-
var init_analyzerNative = __esm({
|
|
706
|
-
"packages/domain/compiler/src/analyzerNative.ts"() {
|
|
707
|
-
init_nativeBridge();
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
// packages/domain/compiler/src/compilationNative.ts
|
|
712
|
-
function compileCssNative2(classes, prefix) {
|
|
713
|
-
const native = getNativeBridge();
|
|
714
|
-
if (!native?.compileCss) throw new Error("compileCss not available");
|
|
715
|
-
return native.compileCss(classes, prefix);
|
|
716
|
-
}
|
|
717
|
-
function compileCssLightning(classes) {
|
|
718
|
-
const native = getNativeBridge();
|
|
719
|
-
if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
|
|
720
|
-
return native.compileCssLightning(classes);
|
|
721
|
-
}
|
|
722
|
-
function extractTwStateConfigsNative(source, filename) {
|
|
723
|
-
const native = getNativeBridge();
|
|
724
|
-
if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
|
|
725
|
-
return native.extractTwStateConfigs(source, filename);
|
|
726
|
-
}
|
|
727
|
-
function generateStaticStateCssNative(inputs, resolvedCss) {
|
|
728
|
-
const native = getNativeBridge();
|
|
729
|
-
if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
|
|
730
|
-
return native.generateStaticStateCss(inputs, resolvedCss ?? null);
|
|
731
|
-
}
|
|
732
|
-
function extractAndGenerateStateCssNative(source, filename) {
|
|
733
|
-
const native = getNativeBridge();
|
|
734
|
-
if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
|
|
735
|
-
return native.extractAndGenerateStateCss(source, filename);
|
|
367
|
+
if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
|
|
368
|
+
return native.extractAndGenerateStateCss(source, filename);
|
|
736
369
|
}
|
|
737
370
|
function layoutClassesToCss(classes) {
|
|
738
371
|
const native = getNativeBridge();
|
|
@@ -775,245 +408,244 @@ function atomicRegistrySize() {
|
|
|
775
408
|
return native.atomicRegistrySize();
|
|
776
409
|
}
|
|
777
410
|
var init_compilationNative = __esm({
|
|
778
|
-
"packages/domain/compiler/src/compilationNative.ts"() {
|
|
411
|
+
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
779
412
|
init_nativeBridge();
|
|
780
413
|
}
|
|
781
414
|
});
|
|
782
415
|
|
|
783
|
-
// packages/domain/compiler/src/
|
|
784
|
-
function
|
|
416
|
+
// packages/domain/compiler/src/compiler/cssCompilationNative.ts
|
|
417
|
+
function compileClass(input) {
|
|
785
418
|
const native = getNativeBridge();
|
|
786
|
-
if (!native?.
|
|
787
|
-
const
|
|
419
|
+
if (!native?.compile_class) throw new Error("compile_class not available");
|
|
420
|
+
const resultJson = native.compile_class(input);
|
|
788
421
|
try {
|
|
789
|
-
return JSON.parse(
|
|
422
|
+
return JSON.parse(resultJson);
|
|
790
423
|
} catch {
|
|
791
424
|
return {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
overall_hit_rate: 0,
|
|
797
|
-
total_memory_bytes: 0
|
|
425
|
+
selector: "",
|
|
426
|
+
declarations: "",
|
|
427
|
+
properties: [],
|
|
428
|
+
specificity: 0
|
|
798
429
|
};
|
|
799
430
|
}
|
|
800
431
|
}
|
|
801
|
-
function
|
|
432
|
+
function compileClasses(inputs) {
|
|
802
433
|
const native = getNativeBridge();
|
|
803
|
-
if (!native?.
|
|
434
|
+
if (!native?.compile_classes) throw new Error("compile_classes not available");
|
|
435
|
+
const resultJson = native.compile_classes(inputs);
|
|
804
436
|
try {
|
|
805
|
-
|
|
437
|
+
return JSON.parse(resultJson);
|
|
806
438
|
} catch {
|
|
439
|
+
return {
|
|
440
|
+
css: "",
|
|
441
|
+
resolved_classes: [],
|
|
442
|
+
unknown_classes: [],
|
|
443
|
+
size_bytes: 0,
|
|
444
|
+
duration_ms: 0
|
|
445
|
+
};
|
|
807
446
|
}
|
|
808
447
|
}
|
|
809
|
-
function
|
|
448
|
+
function compileToCss(input, minify) {
|
|
810
449
|
const native = getNativeBridge();
|
|
811
|
-
if (!native?.
|
|
812
|
-
|
|
813
|
-
native.clear_parse_cache();
|
|
814
|
-
} catch {
|
|
815
|
-
}
|
|
450
|
+
if (!native?.compile_to_css) throw new Error("compile_to_css not available");
|
|
451
|
+
return native.compile_to_css(input, minify ?? false);
|
|
816
452
|
}
|
|
817
|
-
function
|
|
453
|
+
function compileToCssBatch(inputs, minify) {
|
|
818
454
|
const native = getNativeBridge();
|
|
819
|
-
if (!native?.
|
|
820
|
-
|
|
821
|
-
native.clear_resolve_cache();
|
|
822
|
-
} catch {
|
|
823
|
-
}
|
|
455
|
+
if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
|
|
456
|
+
return native.compile_to_css_batch(inputs, minify ?? false);
|
|
824
457
|
}
|
|
825
|
-
function
|
|
458
|
+
function minifyCss(css) {
|
|
826
459
|
const native = getNativeBridge();
|
|
827
|
-
if (!native?.
|
|
828
|
-
|
|
829
|
-
native.clear_compile_cache();
|
|
830
|
-
} catch {
|
|
831
|
-
}
|
|
460
|
+
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
461
|
+
return native.minify_css(css);
|
|
832
462
|
}
|
|
833
|
-
function
|
|
463
|
+
function compileAnimation(animationName, from, to) {
|
|
834
464
|
const native = getNativeBridge();
|
|
835
|
-
if (!native?.
|
|
465
|
+
if (!native?.compile_animation) throw new Error("compile_animation not available");
|
|
466
|
+
const resultJson = native.compile_animation(animationName, from, to);
|
|
836
467
|
try {
|
|
837
|
-
|
|
468
|
+
return JSON.parse(resultJson);
|
|
838
469
|
} catch {
|
|
470
|
+
return {
|
|
471
|
+
animation_id: "",
|
|
472
|
+
keyframes_css: "",
|
|
473
|
+
animation_rule: "",
|
|
474
|
+
duration_ms: 0
|
|
475
|
+
};
|
|
839
476
|
}
|
|
840
477
|
}
|
|
841
|
-
function
|
|
478
|
+
function compileKeyframes(name, stopsJson) {
|
|
842
479
|
const native = getNativeBridge();
|
|
843
|
-
if (!native?.
|
|
844
|
-
|
|
845
|
-
const hintsJson = native.get_cache_optimization_hints(
|
|
846
|
-
Math.min(100, Math.max(0, hitRatePercent)),
|
|
847
|
-
Math.max(1, memoryUsedMb)
|
|
848
|
-
);
|
|
480
|
+
if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
|
|
481
|
+
const resultJson = native.compile_keyframes(name, stopsJson);
|
|
849
482
|
try {
|
|
850
|
-
return JSON.parse(
|
|
483
|
+
return JSON.parse(resultJson);
|
|
851
484
|
} catch {
|
|
852
485
|
return {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
notes: ["Unable to analyze cache statistics"]
|
|
486
|
+
animation_id: "",
|
|
487
|
+
keyframes_css: "",
|
|
488
|
+
animation_rule: "",
|
|
489
|
+
duration_ms: 0
|
|
858
490
|
};
|
|
859
491
|
}
|
|
860
492
|
}
|
|
861
|
-
function
|
|
493
|
+
function compileTheme(tokensJson, themeName, prefix) {
|
|
862
494
|
const native = getNativeBridge();
|
|
863
|
-
if (!native?.
|
|
864
|
-
|
|
865
|
-
const configJson = native.estimate_optimal_cache_config_native(
|
|
866
|
-
Math.max(64, totalBudgetMb),
|
|
867
|
-
workloadType
|
|
868
|
-
);
|
|
495
|
+
if (!native?.compile_theme) throw new Error("compile_theme not available");
|
|
496
|
+
const resultJson = native.compile_theme(tokensJson, themeName, prefix);
|
|
869
497
|
try {
|
|
870
|
-
return JSON.parse(
|
|
498
|
+
return JSON.parse(resultJson);
|
|
871
499
|
} catch {
|
|
872
500
|
return {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
recommended_eviction_policy: "lru",
|
|
878
|
-
ttl_seconds: 3600,
|
|
879
|
-
expected_hit_rate_percent: 75
|
|
501
|
+
selector: ":root",
|
|
502
|
+
variables: [],
|
|
503
|
+
variables_css: "",
|
|
504
|
+
theme_name: themeName
|
|
880
505
|
};
|
|
881
506
|
}
|
|
882
507
|
}
|
|
883
|
-
function
|
|
508
|
+
function twMerge(classString) {
|
|
884
509
|
const native = getNativeBridge();
|
|
885
|
-
if (!native?.
|
|
886
|
-
|
|
887
|
-
try {
|
|
888
|
-
return JSON.parse(result.entries_json || "[]");
|
|
889
|
-
} catch {
|
|
890
|
-
return [];
|
|
891
|
-
}
|
|
510
|
+
if (!native?.tw_merge) throw new Error("tw_merge not available");
|
|
511
|
+
return native.tw_merge(classString);
|
|
892
512
|
}
|
|
893
|
-
function
|
|
513
|
+
function twMergeMany(classStrings) {
|
|
894
514
|
const native = getNativeBridge();
|
|
895
|
-
if (!native?.
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
entries.map((e) => ({
|
|
900
|
-
file: e.file,
|
|
901
|
-
content_hash: e.contentHash,
|
|
902
|
-
classes: e.classes,
|
|
903
|
-
mtime_ms: e.mtimeMs,
|
|
904
|
-
size_bytes: e.sizeBytes
|
|
905
|
-
}))
|
|
906
|
-
);
|
|
907
|
-
return typeof result === "boolean" ? result : result === true;
|
|
908
|
-
} catch {
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
515
|
+
if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
|
|
516
|
+
return native.tw_merge_many(classStrings);
|
|
517
|
+
}
|
|
518
|
+
function twMergeWithSeparator(classString, options) {
|
|
913
519
|
const native = getNativeBridge();
|
|
914
|
-
if (!native?.
|
|
915
|
-
|
|
520
|
+
if (!native?.tw_merge_with_separator)
|
|
521
|
+
throw new Error("tw_merge_with_separator not available");
|
|
522
|
+
const opts = {
|
|
523
|
+
separator: options.separator,
|
|
524
|
+
debug: options.debug
|
|
525
|
+
};
|
|
526
|
+
return native.tw_merge_with_separator(classString, opts);
|
|
916
527
|
}
|
|
917
|
-
|
|
918
|
-
|
|
528
|
+
function twMergeManyWithSeparator(classStrings, options) {
|
|
529
|
+
const native = getNativeBridge();
|
|
530
|
+
if (!native?.tw_merge_many_with_separator)
|
|
531
|
+
throw new Error("tw_merge_many_with_separator not available");
|
|
532
|
+
const opts = {
|
|
533
|
+
separator: options.separator,
|
|
534
|
+
debug: options.debug
|
|
535
|
+
};
|
|
536
|
+
return native.tw_merge_many_with_separator(classStrings, opts);
|
|
537
|
+
}
|
|
538
|
+
function twMergeRaw(classLists) {
|
|
539
|
+
const native = getNativeBridge();
|
|
540
|
+
if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
|
|
541
|
+
return native.tw_merge_raw(classLists);
|
|
542
|
+
}
|
|
543
|
+
var init_cssCompilationNative = __esm({
|
|
544
|
+
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
919
545
|
init_nativeBridge();
|
|
920
546
|
}
|
|
921
547
|
});
|
|
922
548
|
|
|
923
|
-
// packages/domain/compiler/src/
|
|
924
|
-
function
|
|
549
|
+
// packages/domain/compiler/src/compiler/idRegistryNative.ts
|
|
550
|
+
function idRegistryCreate() {
|
|
925
551
|
const native = getNativeBridge();
|
|
926
|
-
if (!native?.
|
|
927
|
-
|
|
928
|
-
try {
|
|
929
|
-
return JSON.parse(resultJson);
|
|
930
|
-
} catch {
|
|
931
|
-
return {
|
|
932
|
-
variants: [],
|
|
933
|
-
supported: [],
|
|
934
|
-
deprecated: [],
|
|
935
|
-
conflicting: []
|
|
936
|
-
};
|
|
937
|
-
}
|
|
552
|
+
if (!native?.id_registry_create) throw new Error("id_registry_create not available");
|
|
553
|
+
return native.id_registry_create();
|
|
938
554
|
}
|
|
939
|
-
function
|
|
555
|
+
function idRegistryGenerate(handle, name) {
|
|
940
556
|
const native = getNativeBridge();
|
|
941
|
-
if (!native?.
|
|
942
|
-
|
|
943
|
-
try {
|
|
944
|
-
return JSON.parse(resultJson);
|
|
945
|
-
} catch {
|
|
946
|
-
return {
|
|
947
|
-
is_valid: false,
|
|
948
|
-
errors: ["Unable to parse configuration"],
|
|
949
|
-
warnings: [],
|
|
950
|
-
suggestions: []
|
|
951
|
-
};
|
|
952
|
-
}
|
|
557
|
+
if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
|
|
558
|
+
return native.id_registry_generate(handle, name);
|
|
953
559
|
}
|
|
954
|
-
function
|
|
560
|
+
function idRegistryLookup(handle, name) {
|
|
955
561
|
const native = getNativeBridge();
|
|
956
|
-
if (!native?.
|
|
957
|
-
|
|
958
|
-
try {
|
|
959
|
-
return JSON.parse(resultJson);
|
|
960
|
-
} catch {
|
|
961
|
-
return {
|
|
962
|
-
base_theme: {},
|
|
963
|
-
user_overrides: {},
|
|
964
|
-
merged_theme: {},
|
|
965
|
-
conflict_resolutions: []
|
|
966
|
-
};
|
|
967
|
-
}
|
|
562
|
+
if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
|
|
563
|
+
return native.id_registry_lookup(handle, name);
|
|
968
564
|
}
|
|
969
|
-
function
|
|
565
|
+
function idRegistryNext(handle) {
|
|
970
566
|
const native = getNativeBridge();
|
|
971
|
-
if (!native?.
|
|
972
|
-
|
|
973
|
-
try {
|
|
974
|
-
return JSON.parse(resultJson);
|
|
975
|
-
} catch {
|
|
976
|
-
return [];
|
|
977
|
-
}
|
|
567
|
+
if (!native?.id_registry_next) throw new Error("id_registry_next not available");
|
|
568
|
+
return native.id_registry_next(handle);
|
|
978
569
|
}
|
|
979
|
-
function
|
|
570
|
+
function idRegistryDestroy(handle) {
|
|
980
571
|
const native = getNativeBridge();
|
|
981
|
-
if (!native?.
|
|
982
|
-
|
|
983
|
-
|
|
572
|
+
if (!native?.id_registry_destroy) return;
|
|
573
|
+
native.id_registry_destroy(handle);
|
|
574
|
+
}
|
|
575
|
+
function idRegistryReset(handle) {
|
|
576
|
+
const native = getNativeBridge();
|
|
577
|
+
if (!native?.id_registry_reset) return;
|
|
578
|
+
native.id_registry_reset(handle);
|
|
579
|
+
}
|
|
580
|
+
function idRegistrySnapshot(handle) {
|
|
581
|
+
const native = getNativeBridge();
|
|
582
|
+
if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
|
|
583
|
+
const snapshotJson = native.id_registry_snapshot(handle);
|
|
984
584
|
try {
|
|
985
|
-
return JSON.parse(
|
|
585
|
+
return JSON.parse(snapshotJson);
|
|
986
586
|
} catch {
|
|
987
587
|
return {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
588
|
+
handle,
|
|
589
|
+
next_id: 0,
|
|
590
|
+
entries: [],
|
|
591
|
+
total_entries: 0
|
|
992
592
|
};
|
|
993
593
|
}
|
|
994
594
|
}
|
|
995
|
-
function
|
|
595
|
+
function idRegistryActiveCount() {
|
|
996
596
|
const native = getNativeBridge();
|
|
997
|
-
if (!native?.
|
|
998
|
-
return native.
|
|
597
|
+
if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
|
|
598
|
+
return native.id_registry_active_count();
|
|
999
599
|
}
|
|
1000
|
-
function
|
|
600
|
+
function registerPropertyName(propertyName) {
|
|
1001
601
|
const native = getNativeBridge();
|
|
1002
|
-
if (!native?.
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
return JSON.parse(resultJson);
|
|
1006
|
-
} catch {
|
|
1007
|
-
return [];
|
|
1008
|
-
}
|
|
602
|
+
if (!native?.register_property_name)
|
|
603
|
+
throw new Error("register_property_name not available");
|
|
604
|
+
return native.register_property_name(propertyName);
|
|
1009
605
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
606
|
+
function registerValueName(valueName) {
|
|
607
|
+
const native = getNativeBridge();
|
|
608
|
+
if (!native?.register_value_name) throw new Error("register_value_name not available");
|
|
609
|
+
return native.register_value_name(valueName);
|
|
610
|
+
}
|
|
611
|
+
function propertyIdToString(propertyId) {
|
|
612
|
+
const native = getNativeBridge();
|
|
613
|
+
if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
|
|
614
|
+
return native.property_id_to_string(propertyId);
|
|
615
|
+
}
|
|
616
|
+
function valueIdToString(valueId) {
|
|
617
|
+
const native = getNativeBridge();
|
|
618
|
+
if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
|
|
619
|
+
return native.value_id_to_string(valueId);
|
|
620
|
+
}
|
|
621
|
+
function reverseLookupProperty(propertyId) {
|
|
622
|
+
const native = getNativeBridge();
|
|
623
|
+
if (!native?.reverse_lookup_property)
|
|
624
|
+
throw new Error("reverse_lookup_property not available");
|
|
625
|
+
return native.reverse_lookup_property(propertyId);
|
|
626
|
+
}
|
|
627
|
+
function reverseLookupValue(valueId) {
|
|
628
|
+
const native = getNativeBridge();
|
|
629
|
+
if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
|
|
630
|
+
return native.reverse_lookup_value(valueId);
|
|
631
|
+
}
|
|
632
|
+
function idRegistryExport(handle) {
|
|
633
|
+
const native = getNativeBridge();
|
|
634
|
+
if (!native?.id_registry_export) throw new Error("id_registry_export not available");
|
|
635
|
+
return native.id_registry_export(handle);
|
|
636
|
+
}
|
|
637
|
+
function idRegistryImport(importedData) {
|
|
638
|
+
const native = getNativeBridge();
|
|
639
|
+
if (!native?.id_registry_import) throw new Error("id_registry_import not available");
|
|
640
|
+
return native.id_registry_import(importedData);
|
|
641
|
+
}
|
|
642
|
+
var init_idRegistryNative = __esm({
|
|
643
|
+
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1012
644
|
init_nativeBridge();
|
|
1013
645
|
}
|
|
1014
646
|
});
|
|
1015
647
|
|
|
1016
|
-
// packages/domain/compiler/src/streamingNative.ts
|
|
648
|
+
// packages/domain/compiler/src/compiler/streamingNative.ts
|
|
1017
649
|
function processFileChange(fileChangeJson) {
|
|
1018
650
|
const native = getNativeBridge();
|
|
1019
651
|
if (!native?.process_file_change) throw new Error("process_file_change not available");
|
|
@@ -1149,244 +781,663 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1149
781
|
}
|
|
1150
782
|
}
|
|
1151
783
|
var init_streamingNative = __esm({
|
|
1152
|
-
"packages/domain/compiler/src/streamingNative.ts"() {
|
|
784
|
+
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1153
785
|
init_nativeBridge();
|
|
1154
786
|
}
|
|
1155
787
|
});
|
|
1156
788
|
|
|
1157
|
-
// packages/domain/compiler/src/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
};
|
|
1171
|
-
}
|
|
789
|
+
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
790
|
+
var tailwindEngine_exports = {};
|
|
791
|
+
__export(tailwindEngine_exports, {
|
|
792
|
+
clearCache: () => clearCache,
|
|
793
|
+
getCacheStats: () => getCacheStats2,
|
|
794
|
+
processTailwindCssWithTargets: () => processTailwindCssWithTargets,
|
|
795
|
+
runCssPipeline: () => runCssPipeline,
|
|
796
|
+
runCssPipelineSync: () => runCssPipelineSync
|
|
797
|
+
});
|
|
798
|
+
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
799
|
+
const sorted = [...classes].sort().join(",");
|
|
800
|
+
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
801
|
+
return `${sorted}|${flags}`;
|
|
1172
802
|
}
|
|
1173
|
-
function
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
} catch {
|
|
1180
|
-
return {
|
|
1181
|
-
css: "",
|
|
1182
|
-
resolved_classes: [],
|
|
1183
|
-
unknown_classes: [],
|
|
1184
|
-
size_bytes: 0,
|
|
1185
|
-
duration_ms: 0
|
|
1186
|
-
};
|
|
803
|
+
function _evictOldestIfNeeded() {
|
|
804
|
+
if (_cssCache.size >= MAX_CACHE_SIZE) {
|
|
805
|
+
const firstKey = _cssCache.keys().next().value;
|
|
806
|
+
if (firstKey !== void 0) {
|
|
807
|
+
_cssCache.delete(firstKey);
|
|
808
|
+
}
|
|
1187
809
|
}
|
|
1188
810
|
}
|
|
1189
|
-
function
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
811
|
+
function getCacheStats2() {
|
|
812
|
+
const total = _cacheHits + _cacheMisses;
|
|
813
|
+
return {
|
|
814
|
+
hits: _cacheHits,
|
|
815
|
+
misses: _cacheMisses,
|
|
816
|
+
hitRate: total > 0 ? _cacheHits / total : 0,
|
|
817
|
+
size: _cssCache.size,
|
|
818
|
+
maxSize: MAX_CACHE_SIZE
|
|
819
|
+
};
|
|
1198
820
|
}
|
|
1199
|
-
function
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
821
|
+
function clearCache() {
|
|
822
|
+
_cssCache.clear();
|
|
823
|
+
_cacheHits = 0;
|
|
824
|
+
_cacheMisses = 0;
|
|
1203
825
|
}
|
|
1204
|
-
function
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
826
|
+
function getThemeConfig() {
|
|
827
|
+
return {
|
|
828
|
+
colors: {
|
|
829
|
+
slate: {
|
|
830
|
+
"50": "#f8fafc",
|
|
831
|
+
"100": "#f1f5f9",
|
|
832
|
+
"200": "#e2e8f0",
|
|
833
|
+
"300": "#cbd5e1",
|
|
834
|
+
"400": "#94a3b8",
|
|
835
|
+
"500": "#64748b",
|
|
836
|
+
"600": "#475569",
|
|
837
|
+
"700": "#334155",
|
|
838
|
+
"800": "#1e293b",
|
|
839
|
+
"900": "#0f172a"
|
|
840
|
+
},
|
|
841
|
+
gray: {
|
|
842
|
+
"50": "#f9fafb",
|
|
843
|
+
"100": "#f3f4f6",
|
|
844
|
+
"200": "#e5e7eb",
|
|
845
|
+
"300": "#d1d5db",
|
|
846
|
+
"400": "#9ca3af",
|
|
847
|
+
"500": "#6b7280",
|
|
848
|
+
"600": "#4b5563",
|
|
849
|
+
"700": "#374151",
|
|
850
|
+
"800": "#1f2937",
|
|
851
|
+
"900": "#111827"
|
|
852
|
+
},
|
|
853
|
+
white: "#ffffff",
|
|
854
|
+
black: "#000000",
|
|
855
|
+
red: {
|
|
856
|
+
"500": "#ef4444",
|
|
857
|
+
"600": "#dc2626"
|
|
858
|
+
},
|
|
859
|
+
blue: {
|
|
860
|
+
"500": "#3b82f6",
|
|
861
|
+
"600": "#1e40af"
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
spacing: {
|
|
865
|
+
"0": "0px",
|
|
866
|
+
"1": "0.25rem",
|
|
867
|
+
"2": "0.5rem",
|
|
868
|
+
"3": "0.75rem",
|
|
869
|
+
"4": "1rem",
|
|
870
|
+
"5": "1.25rem",
|
|
871
|
+
"6": "1.5rem",
|
|
872
|
+
"8": "2rem",
|
|
873
|
+
"10": "2.5rem",
|
|
874
|
+
"12": "3rem",
|
|
875
|
+
"16": "4rem",
|
|
876
|
+
"20": "5rem",
|
|
877
|
+
"24": "6rem"
|
|
878
|
+
},
|
|
879
|
+
breakpoints: {
|
|
880
|
+
"sm": "640px",
|
|
881
|
+
"md": "768px",
|
|
882
|
+
"lg": "1024px",
|
|
883
|
+
"xl": "1280px",
|
|
884
|
+
"2xl": "1536px"
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function postProcessWithLightning(rawCss) {
|
|
889
|
+
if (!rawCss) return "";
|
|
890
|
+
const native = getNativeBridge();
|
|
891
|
+
if (!native?.processTailwindCssLightning) {
|
|
892
|
+
throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
|
|
893
|
+
}
|
|
894
|
+
const result = native.processTailwindCssLightning(rawCss);
|
|
895
|
+
if (!result?.css) {
|
|
896
|
+
throw new Error("FATAL: processTailwindCssLightning returned null");
|
|
897
|
+
}
|
|
898
|
+
return result.css;
|
|
899
|
+
}
|
|
900
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
901
|
+
const filtered = classes.filter(Boolean);
|
|
902
|
+
const uniqueMap = /* @__PURE__ */ new Map();
|
|
903
|
+
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
904
|
+
const unique = Array.from(uniqueMap.values());
|
|
905
|
+
if (unique.length === 0) {
|
|
906
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
907
|
+
}
|
|
908
|
+
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
|
|
909
|
+
const cached = _cssCache.get(cacheKey);
|
|
910
|
+
if (cached) {
|
|
911
|
+
_cacheHits++;
|
|
912
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
913
|
+
console.log(
|
|
914
|
+
`[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats2().hitRate * 100).toFixed(1)}%)`
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
return cached;
|
|
918
|
+
}
|
|
919
|
+
_cacheMisses++;
|
|
920
|
+
let rawCss;
|
|
921
|
+
let usedRustCompiler = false;
|
|
922
|
+
const theme = getThemeConfig();
|
|
923
|
+
rawCss = await generateCssNative(unique, { theme });
|
|
924
|
+
usedRustCompiler = true;
|
|
925
|
+
const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
|
|
926
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
927
|
+
console.log(
|
|
928
|
+
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
929
|
+
`Size: ${finalCss.length} bytes`
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
const result = {
|
|
933
|
+
css: finalCss,
|
|
934
|
+
classes: unique,
|
|
935
|
+
sizeBytes: finalCss.length,
|
|
936
|
+
optimized: minify
|
|
937
|
+
};
|
|
938
|
+
_evictOldestIfNeeded();
|
|
939
|
+
_cssCache.set(cacheKey, result);
|
|
940
|
+
return result;
|
|
941
|
+
}
|
|
942
|
+
function runCssPipelineSync(_classes) {
|
|
943
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
944
|
+
}
|
|
945
|
+
function processTailwindCssWithTargets(css, targets) {
|
|
946
|
+
const native = getNativeBridge();
|
|
947
|
+
if (!native?.processTailwindCssWithTargets) {
|
|
948
|
+
throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
|
|
949
|
+
}
|
|
950
|
+
const result = native.processTailwindCssWithTargets(css, targets ?? null);
|
|
951
|
+
if (!result?.css) {
|
|
952
|
+
throw new Error("FATAL: processTailwindCssWithTargets returned null");
|
|
953
|
+
}
|
|
954
|
+
return result.css;
|
|
955
|
+
}
|
|
956
|
+
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
957
|
+
var init_tailwindEngine = __esm({
|
|
958
|
+
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
959
|
+
init_nativeBridge();
|
|
960
|
+
init_cssGeneratorNative();
|
|
961
|
+
createRequire(import.meta.url);
|
|
962
|
+
_cssCache = /* @__PURE__ */ new Map();
|
|
963
|
+
_cacheHits = 0;
|
|
964
|
+
_cacheMisses = 0;
|
|
965
|
+
MAX_CACHE_SIZE = 100;
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
// packages/domain/compiler/src/compiler/index.ts
|
|
970
|
+
var init_compiler = __esm({
|
|
971
|
+
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
972
|
+
init_cssGeneratorNative();
|
|
973
|
+
init_compilationNative();
|
|
974
|
+
init_cssCompilationNative();
|
|
975
|
+
init_idRegistryNative();
|
|
976
|
+
init_streamingNative();
|
|
977
|
+
init_tailwindEngine();
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
// packages/domain/compiler/src/parser/index.ts
|
|
982
|
+
var parser_exports = {};
|
|
983
|
+
__export(parser_exports, {
|
|
984
|
+
astExtractClasses: () => astExtractClasses,
|
|
985
|
+
batchExtractClasses: () => batchExtractClasses,
|
|
986
|
+
checkAgainstSafelist: () => checkAgainstSafelist,
|
|
987
|
+
diffClassLists: () => diffClassLists,
|
|
988
|
+
extractAllClasses: () => extractAllClasses,
|
|
989
|
+
extractClassesFromSource: () => extractClassesFromSource,
|
|
990
|
+
extractComponentUsage: () => extractComponentUsage,
|
|
991
|
+
mergeClassesStatic: () => mergeClassesStatic,
|
|
992
|
+
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
993
|
+
normalizeClasses: () => normalizeClasses,
|
|
994
|
+
parseClasses: () => parseClasses
|
|
995
|
+
});
|
|
996
|
+
var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
997
|
+
var init_parser = __esm({
|
|
998
|
+
"packages/domain/compiler/src/parser/index.ts"() {
|
|
999
|
+
init_nativeBridge();
|
|
1000
|
+
parseClasses = (raw) => {
|
|
1001
|
+
const native = getNativeBridge();
|
|
1002
|
+
if (!native?.parseClasses) {
|
|
1003
|
+
throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
|
|
1004
|
+
}
|
|
1005
|
+
return native.parseClasses(raw) || [];
|
|
1006
|
+
};
|
|
1007
|
+
extractAllClasses = (source) => {
|
|
1008
|
+
const native = getNativeBridge();
|
|
1009
|
+
if (!native?.extractAllClasses) {
|
|
1010
|
+
throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
|
|
1011
|
+
}
|
|
1012
|
+
return native.extractAllClasses(source) || [];
|
|
1013
|
+
};
|
|
1014
|
+
extractClassesFromSource = (source) => {
|
|
1015
|
+
const native = getNativeBridge();
|
|
1016
|
+
if (!native?.extractClassesFromSource) {
|
|
1017
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1018
|
+
}
|
|
1019
|
+
const result = native.extractClassesFromSource(source);
|
|
1020
|
+
return Array.isArray(result) ? result.join(" ") : String(result || "");
|
|
1021
|
+
};
|
|
1022
|
+
astExtractClasses = (source, _filename) => {
|
|
1023
|
+
const native = getNativeBridge();
|
|
1024
|
+
if (!native?.extractClassesFromSource) {
|
|
1025
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1026
|
+
}
|
|
1027
|
+
return native.extractClassesFromSource(source) || [];
|
|
1028
|
+
};
|
|
1029
|
+
normalizeClasses = (raw) => {
|
|
1030
|
+
const result = normalizeAndDedupClasses(raw);
|
|
1031
|
+
return result?.normalized || "";
|
|
1032
|
+
};
|
|
1033
|
+
mergeClassesStatic = (classes) => {
|
|
1034
|
+
const result = normalizeAndDedupClasses(classes);
|
|
1035
|
+
return result?.normalized || "";
|
|
1036
|
+
};
|
|
1037
|
+
normalizeAndDedupClasses = (raw) => {
|
|
1038
|
+
const native = getNativeBridge();
|
|
1039
|
+
if (!native?.normalizeAndDedupClasses) {
|
|
1040
|
+
throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
|
|
1041
|
+
}
|
|
1042
|
+
const result = native.normalizeAndDedupClasses(raw);
|
|
1043
|
+
return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
|
|
1044
|
+
};
|
|
1045
|
+
extractComponentUsage = (source) => {
|
|
1046
|
+
const native = getNativeBridge();
|
|
1047
|
+
if (!native?.extractComponentUsage) {
|
|
1048
|
+
throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
|
|
1049
|
+
}
|
|
1050
|
+
return native.extractComponentUsage(source) || [];
|
|
1051
|
+
};
|
|
1052
|
+
batchExtractClasses = (filePaths) => {
|
|
1053
|
+
const native = getNativeBridge();
|
|
1054
|
+
if (!native?.batchExtractClasses) {
|
|
1055
|
+
throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
|
|
1056
|
+
}
|
|
1057
|
+
return native.batchExtractClasses(filePaths) || [];
|
|
1058
|
+
};
|
|
1059
|
+
checkAgainstSafelist = (classes, safelist) => {
|
|
1060
|
+
const native = getNativeBridge();
|
|
1061
|
+
if (!native?.checkAgainstSafelist) {
|
|
1062
|
+
throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
|
|
1063
|
+
}
|
|
1064
|
+
return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
|
|
1065
|
+
};
|
|
1066
|
+
diffClassLists = (previous, current) => {
|
|
1067
|
+
const native = getNativeBridge();
|
|
1068
|
+
if (!native?.diffClassLists) {
|
|
1069
|
+
throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
|
|
1070
|
+
}
|
|
1071
|
+
return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
|
|
1216
1072
|
};
|
|
1217
1073
|
}
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
// packages/domain/compiler/src/analyzer/analyzerNative.ts
|
|
1077
|
+
function detectDeadCode(scanResultJson, css) {
|
|
1078
|
+
const native = getNativeBridge();
|
|
1079
|
+
if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
|
|
1080
|
+
return native.detectDeadCode(scanResultJson, css);
|
|
1081
|
+
}
|
|
1082
|
+
function analyzeClassUsageNative(classes, scanResultJson, css) {
|
|
1083
|
+
const native = getNativeBridge();
|
|
1084
|
+
if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
|
|
1085
|
+
return native.analyzeClassUsage(classes, scanResultJson, css);
|
|
1086
|
+
}
|
|
1087
|
+
function analyzeClassesNative(filesJson, cwd, flags) {
|
|
1088
|
+
const native = getNativeBridge();
|
|
1089
|
+
if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
|
|
1090
|
+
return native.analyzeClasses(filesJson, cwd, flags ?? 0);
|
|
1091
|
+
}
|
|
1092
|
+
function analyzeRscNative(source, filename) {
|
|
1093
|
+
const native = getNativeBridge();
|
|
1094
|
+
if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
|
|
1095
|
+
return native.analyzeRsc(source, filename);
|
|
1096
|
+
}
|
|
1097
|
+
function optimizeCssNative(css) {
|
|
1098
|
+
const native = getNativeBridge();
|
|
1099
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1100
|
+
const result = native.processTailwindCssLightning(css);
|
|
1101
|
+
return {
|
|
1102
|
+
css: result.css,
|
|
1103
|
+
originalSize: css.length,
|
|
1104
|
+
optimizedSize: result.size_bytes,
|
|
1105
|
+
reductionPercentage: (css.length - result.size_bytes) / css.length * 100
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
function processTailwindCssLightning(css) {
|
|
1109
|
+
const native = getNativeBridge();
|
|
1110
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1111
|
+
return native.processTailwindCssLightning(css);
|
|
1112
|
+
}
|
|
1113
|
+
function eliminateDeadCssNative(css, deadClasses) {
|
|
1114
|
+
const native = getNativeBridge();
|
|
1115
|
+
if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
|
|
1116
|
+
return native.eliminateDeadCss(css, deadClasses);
|
|
1117
|
+
}
|
|
1118
|
+
function hoistComponentsNative(source) {
|
|
1119
|
+
const native = getNativeBridge();
|
|
1120
|
+
if (!native?.hoistComponents) throw new Error("hoistComponents not available");
|
|
1121
|
+
return native.hoistComponents(source);
|
|
1218
1122
|
}
|
|
1219
|
-
function
|
|
1123
|
+
function compileVariantTableNative(configJson) {
|
|
1220
1124
|
const native = getNativeBridge();
|
|
1221
|
-
if (!native?.
|
|
1222
|
-
|
|
1125
|
+
if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
|
|
1126
|
+
return native.compileVariantTable(configJson);
|
|
1127
|
+
}
|
|
1128
|
+
function classifyAndSortClassesNative(classes) {
|
|
1129
|
+
const native = getNativeBridge();
|
|
1130
|
+
if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
|
|
1131
|
+
return native.classifyAndSortClasses(classes);
|
|
1132
|
+
}
|
|
1133
|
+
function mergeCssDeclarationsNative(cssChunks) {
|
|
1134
|
+
const native = getNativeBridge();
|
|
1135
|
+
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
1136
|
+
return native.mergeCssDeclarations(cssChunks);
|
|
1137
|
+
}
|
|
1138
|
+
var init_analyzerNative = __esm({
|
|
1139
|
+
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1140
|
+
init_nativeBridge();
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// packages/domain/compiler/src/analyzer/themeResolutionNative.ts
|
|
1145
|
+
function resolveVariants(configJson) {
|
|
1146
|
+
const native = getNativeBridge();
|
|
1147
|
+
if (!native?.resolve_variants) throw new Error("resolve_variants not available");
|
|
1148
|
+
const resultJson = native.resolve_variants(configJson);
|
|
1223
1149
|
try {
|
|
1224
1150
|
return JSON.parse(resultJson);
|
|
1225
1151
|
} catch {
|
|
1226
1152
|
return {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1153
|
+
variants: [],
|
|
1154
|
+
supported: [],
|
|
1155
|
+
deprecated: [],
|
|
1156
|
+
conflicting: []
|
|
1231
1157
|
};
|
|
1232
1158
|
}
|
|
1233
1159
|
}
|
|
1234
|
-
function
|
|
1160
|
+
function validateThemeConfig(configJson) {
|
|
1235
1161
|
const native = getNativeBridge();
|
|
1236
|
-
if (!native?.
|
|
1237
|
-
const resultJson = native.
|
|
1162
|
+
if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
|
|
1163
|
+
const resultJson = native.validate_variant_config(configJson);
|
|
1238
1164
|
try {
|
|
1239
1165
|
return JSON.parse(resultJson);
|
|
1240
1166
|
} catch {
|
|
1241
1167
|
return {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1168
|
+
is_valid: false,
|
|
1169
|
+
errors: ["Unable to parse configuration"],
|
|
1170
|
+
warnings: [],
|
|
1171
|
+
suggestions: []
|
|
1246
1172
|
};
|
|
1247
1173
|
}
|
|
1248
1174
|
}
|
|
1249
|
-
function
|
|
1175
|
+
function resolveCascade(baseThemeJson, overridesJson) {
|
|
1250
1176
|
const native = getNativeBridge();
|
|
1251
|
-
if (!native?.
|
|
1252
|
-
|
|
1177
|
+
if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
|
|
1178
|
+
const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
|
|
1179
|
+
try {
|
|
1180
|
+
return JSON.parse(resultJson);
|
|
1181
|
+
} catch {
|
|
1182
|
+
return {
|
|
1183
|
+
base_theme: {},
|
|
1184
|
+
user_overrides: {},
|
|
1185
|
+
merged_theme: {},
|
|
1186
|
+
conflict_resolutions: []
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1253
1189
|
}
|
|
1254
|
-
function
|
|
1190
|
+
function resolveClassNames(classNames, themeJson) {
|
|
1255
1191
|
const native = getNativeBridge();
|
|
1256
|
-
if (!native?.
|
|
1257
|
-
|
|
1192
|
+
if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
|
|
1193
|
+
const resultJson = native.resolve_class_names(classNames, themeJson);
|
|
1194
|
+
try {
|
|
1195
|
+
return JSON.parse(resultJson);
|
|
1196
|
+
} catch {
|
|
1197
|
+
return [];
|
|
1198
|
+
}
|
|
1258
1199
|
}
|
|
1259
|
-
function
|
|
1200
|
+
function resolveConflictGroup(groupName, themeJson) {
|
|
1260
1201
|
const native = getNativeBridge();
|
|
1261
|
-
if (!native?.
|
|
1262
|
-
throw new Error("
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1202
|
+
if (!native?.resolve_conflict_group)
|
|
1203
|
+
throw new Error("resolve_conflict_group not available");
|
|
1204
|
+
const resultJson = native.resolve_conflict_group(groupName, themeJson);
|
|
1205
|
+
try {
|
|
1206
|
+
return JSON.parse(resultJson);
|
|
1207
|
+
} catch {
|
|
1208
|
+
return {
|
|
1209
|
+
group_name: groupName,
|
|
1210
|
+
conflicting_classes: [],
|
|
1211
|
+
description: "",
|
|
1212
|
+
resolution_strategy: "last-wins"
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1268
1215
|
}
|
|
1269
|
-
function
|
|
1216
|
+
function resolveThemeValue(keyPath, themeJson) {
|
|
1270
1217
|
const native = getNativeBridge();
|
|
1271
|
-
if (!native?.
|
|
1272
|
-
|
|
1273
|
-
const opts = {
|
|
1274
|
-
separator: options.separator,
|
|
1275
|
-
debug: options.debug
|
|
1276
|
-
};
|
|
1277
|
-
return native.tw_merge_many_with_separator(classStrings, opts);
|
|
1218
|
+
if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
|
|
1219
|
+
return native.resolve_theme_value(keyPath, themeJson);
|
|
1278
1220
|
}
|
|
1279
|
-
function
|
|
1221
|
+
function resolveSimpleVariants(configJson) {
|
|
1280
1222
|
const native = getNativeBridge();
|
|
1281
|
-
if (!native?.
|
|
1282
|
-
|
|
1223
|
+
if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
|
|
1224
|
+
const resultJson = native.resolve_simple_variants(configJson);
|
|
1225
|
+
try {
|
|
1226
|
+
return JSON.parse(resultJson);
|
|
1227
|
+
} catch {
|
|
1228
|
+
return [];
|
|
1229
|
+
}
|
|
1283
1230
|
}
|
|
1284
|
-
var
|
|
1285
|
-
"packages/domain/compiler/src/
|
|
1231
|
+
var init_themeResolutionNative = __esm({
|
|
1232
|
+
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1286
1233
|
init_nativeBridge();
|
|
1287
1234
|
}
|
|
1288
1235
|
});
|
|
1289
1236
|
|
|
1290
|
-
// packages/domain/compiler/src/
|
|
1291
|
-
function
|
|
1237
|
+
// packages/domain/compiler/src/analyzer/scannerNative.ts
|
|
1238
|
+
function scanWorkspace(root, extensions) {
|
|
1292
1239
|
const native = getNativeBridge();
|
|
1293
|
-
if (!native?.
|
|
1294
|
-
return native.
|
|
1240
|
+
if (!native?.scan_workspace) throw new Error("scan_workspace not available");
|
|
1241
|
+
return native.scan_workspace(root, extensions);
|
|
1295
1242
|
}
|
|
1296
|
-
function
|
|
1243
|
+
function extractClassesFromSourceNative(source) {
|
|
1297
1244
|
const native = getNativeBridge();
|
|
1298
|
-
if (!native?.
|
|
1299
|
-
return native.
|
|
1245
|
+
if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
|
|
1246
|
+
return native.extract_classes_from_source(source);
|
|
1300
1247
|
}
|
|
1301
|
-
function
|
|
1248
|
+
function batchExtractClassesNative(filePaths) {
|
|
1302
1249
|
const native = getNativeBridge();
|
|
1303
|
-
if (!native?.
|
|
1304
|
-
return native.
|
|
1250
|
+
if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
|
|
1251
|
+
return native.batch_extract_classes(filePaths);
|
|
1305
1252
|
}
|
|
1306
|
-
function
|
|
1253
|
+
function checkAgainstSafelistNative(classes, safelist) {
|
|
1307
1254
|
const native = getNativeBridge();
|
|
1308
|
-
if (!native?.
|
|
1309
|
-
return native.
|
|
1255
|
+
if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
|
|
1256
|
+
return native.check_against_safelist(classes, safelist);
|
|
1310
1257
|
}
|
|
1311
|
-
function
|
|
1258
|
+
function scanFile(filePath) {
|
|
1312
1259
|
const native = getNativeBridge();
|
|
1313
|
-
if (!native?.
|
|
1314
|
-
native.
|
|
1260
|
+
if (!native?.scan_file) throw new Error("scan_file not available");
|
|
1261
|
+
return native.scan_file(filePath);
|
|
1315
1262
|
}
|
|
1316
|
-
function
|
|
1263
|
+
function collectFiles(root, extensions) {
|
|
1317
1264
|
const native = getNativeBridge();
|
|
1318
|
-
if (!native?.
|
|
1319
|
-
native.
|
|
1265
|
+
if (!native?.collect_files) throw new Error("collect_files not available");
|
|
1266
|
+
return native.collect_files(root, extensions);
|
|
1320
1267
|
}
|
|
1321
|
-
function
|
|
1268
|
+
function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
|
|
1322
1269
|
const native = getNativeBridge();
|
|
1323
|
-
if (!native?.
|
|
1324
|
-
|
|
1270
|
+
if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
|
|
1271
|
+
return native.walk_and_prefilter_source_files(root, extensions);
|
|
1272
|
+
}
|
|
1273
|
+
function generateSubComponentTypes(root, outputPath) {
|
|
1274
|
+
const native = getNativeBridge();
|
|
1275
|
+
if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
|
|
1276
|
+
return native.generate_sub_component_types(root, outputPath);
|
|
1277
|
+
}
|
|
1278
|
+
var init_scannerNative = __esm({
|
|
1279
|
+
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
1280
|
+
init_nativeBridge();
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
// packages/domain/compiler/src/analyzer/index.ts
|
|
1285
|
+
var init_analyzer = __esm({
|
|
1286
|
+
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
1287
|
+
init_analyzerNative();
|
|
1288
|
+
init_themeResolutionNative();
|
|
1289
|
+
init_scannerNative();
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1293
|
+
// packages/domain/compiler/src/cache/cacheNative.ts
|
|
1294
|
+
function getCacheStatistics() {
|
|
1295
|
+
const native = getNativeBridge();
|
|
1296
|
+
if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
|
|
1297
|
+
const statsJson = native.get_cache_statistics();
|
|
1325
1298
|
try {
|
|
1326
|
-
return JSON.parse(
|
|
1299
|
+
return JSON.parse(statsJson);
|
|
1327
1300
|
} catch {
|
|
1328
1301
|
return {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1302
|
+
parse_cache: { hits: 0, misses: 0, size: 0 },
|
|
1303
|
+
resolve_cache: { hits: 0, misses: 0, size: 0 },
|
|
1304
|
+
compile_cache: { hits: 0, misses: 0, size: 0 },
|
|
1305
|
+
css_gen_cache: { hits: 0, misses: 0, size: 0 },
|
|
1306
|
+
overall_hit_rate: 0,
|
|
1307
|
+
total_memory_bytes: 0
|
|
1333
1308
|
};
|
|
1334
1309
|
}
|
|
1335
1310
|
}
|
|
1336
|
-
function
|
|
1311
|
+
function clearAllCaches() {
|
|
1337
1312
|
const native = getNativeBridge();
|
|
1338
|
-
if (!native?.
|
|
1339
|
-
|
|
1313
|
+
if (!native?.clear_all_caches) return;
|
|
1314
|
+
try {
|
|
1315
|
+
native.clear_all_caches();
|
|
1316
|
+
} catch {
|
|
1317
|
+
}
|
|
1340
1318
|
}
|
|
1341
|
-
function
|
|
1319
|
+
function clearParseCache() {
|
|
1342
1320
|
const native = getNativeBridge();
|
|
1343
|
-
if (!native?.
|
|
1344
|
-
|
|
1345
|
-
|
|
1321
|
+
if (!native?.clear_parse_cache) return;
|
|
1322
|
+
try {
|
|
1323
|
+
native.clear_parse_cache();
|
|
1324
|
+
} catch {
|
|
1325
|
+
}
|
|
1346
1326
|
}
|
|
1347
|
-
function
|
|
1327
|
+
function clearResolveCache() {
|
|
1348
1328
|
const native = getNativeBridge();
|
|
1349
|
-
if (!native?.
|
|
1350
|
-
|
|
1329
|
+
if (!native?.clear_resolve_cache) return;
|
|
1330
|
+
try {
|
|
1331
|
+
native.clear_resolve_cache();
|
|
1332
|
+
} catch {
|
|
1333
|
+
}
|
|
1351
1334
|
}
|
|
1352
|
-
function
|
|
1335
|
+
function clearCompileCache() {
|
|
1353
1336
|
const native = getNativeBridge();
|
|
1354
|
-
if (!native?.
|
|
1355
|
-
|
|
1337
|
+
if (!native?.clear_compile_cache) return;
|
|
1338
|
+
try {
|
|
1339
|
+
native.clear_compile_cache();
|
|
1340
|
+
} catch {
|
|
1341
|
+
}
|
|
1356
1342
|
}
|
|
1357
|
-
function
|
|
1343
|
+
function clearCssGenCache() {
|
|
1358
1344
|
const native = getNativeBridge();
|
|
1359
|
-
if (!native?.
|
|
1360
|
-
|
|
1345
|
+
if (!native?.clear_css_gen_cache) return;
|
|
1346
|
+
try {
|
|
1347
|
+
native.clear_css_gen_cache();
|
|
1348
|
+
} catch {
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
|
|
1352
|
+
const native = getNativeBridge();
|
|
1353
|
+
if (!native?.get_cache_optimization_hints)
|
|
1354
|
+
throw new Error("get_cache_optimization_hints not available");
|
|
1355
|
+
const hintsJson = native.get_cache_optimization_hints(
|
|
1356
|
+
Math.min(100, Math.max(0, hitRatePercent)),
|
|
1357
|
+
Math.max(1, memoryUsedMb)
|
|
1358
|
+
);
|
|
1359
|
+
try {
|
|
1360
|
+
return JSON.parse(hintsJson);
|
|
1361
|
+
} catch {
|
|
1362
|
+
return {
|
|
1363
|
+
current_strategy: "unknown",
|
|
1364
|
+
recommended_strategy: "increase_size",
|
|
1365
|
+
estimated_improvement_percent: 0,
|
|
1366
|
+
suggested_memory_mb: 256,
|
|
1367
|
+
notes: ["Unable to analyze cache statistics"]
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1361
1370
|
}
|
|
1362
|
-
function
|
|
1371
|
+
function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
|
|
1363
1372
|
const native = getNativeBridge();
|
|
1364
|
-
if (!native?.
|
|
1365
|
-
throw new Error("
|
|
1366
|
-
|
|
1373
|
+
if (!native?.estimate_optimal_cache_config_native)
|
|
1374
|
+
throw new Error("estimate_optimal_cache_config_native not available");
|
|
1375
|
+
const configJson = native.estimate_optimal_cache_config_native(
|
|
1376
|
+
Math.max(64, totalBudgetMb),
|
|
1377
|
+
workloadType
|
|
1378
|
+
);
|
|
1379
|
+
try {
|
|
1380
|
+
return JSON.parse(configJson);
|
|
1381
|
+
} catch {
|
|
1382
|
+
return {
|
|
1383
|
+
parse_cache_size: 128,
|
|
1384
|
+
resolve_cache_size: 64,
|
|
1385
|
+
compile_cache_size: 256,
|
|
1386
|
+
css_gen_cache_size: 128,
|
|
1387
|
+
recommended_eviction_policy: "lru",
|
|
1388
|
+
ttl_seconds: 3600,
|
|
1389
|
+
expected_hit_rate_percent: 75
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1367
1392
|
}
|
|
1368
|
-
function
|
|
1393
|
+
function cacheRead(cachePath) {
|
|
1369
1394
|
const native = getNativeBridge();
|
|
1370
|
-
if (!native?.
|
|
1371
|
-
|
|
1395
|
+
if (!native?.cache_read) throw new Error("cache_read not available");
|
|
1396
|
+
const result = native.cache_read(cachePath);
|
|
1397
|
+
try {
|
|
1398
|
+
return JSON.parse(result.entries_json || "[]");
|
|
1399
|
+
} catch {
|
|
1400
|
+
return [];
|
|
1401
|
+
}
|
|
1372
1402
|
}
|
|
1373
|
-
function
|
|
1403
|
+
function cacheWrite(cachePath, entries) {
|
|
1374
1404
|
const native = getNativeBridge();
|
|
1375
|
-
if (!native?.
|
|
1376
|
-
|
|
1405
|
+
if (!native?.cache_write) throw new Error("cache_write not available");
|
|
1406
|
+
try {
|
|
1407
|
+
const result = native.cache_write(
|
|
1408
|
+
cachePath,
|
|
1409
|
+
entries.map((e) => ({
|
|
1410
|
+
file: e.file,
|
|
1411
|
+
content_hash: e.contentHash,
|
|
1412
|
+
classes: e.classes,
|
|
1413
|
+
mtime_ms: e.mtimeMs,
|
|
1414
|
+
size_bytes: e.sizeBytes
|
|
1415
|
+
}))
|
|
1416
|
+
);
|
|
1417
|
+
return typeof result === "boolean" ? result : result === true;
|
|
1418
|
+
} catch {
|
|
1419
|
+
return false;
|
|
1420
|
+
}
|
|
1377
1421
|
}
|
|
1378
|
-
function
|
|
1422
|
+
function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
1379
1423
|
const native = getNativeBridge();
|
|
1380
|
-
if (!native?.
|
|
1381
|
-
return native.
|
|
1424
|
+
if (!native?.cache_priority) throw new Error("cache_priority not available");
|
|
1425
|
+
return native.cache_priority(mtimeMs, sizeBytes, hitCount);
|
|
1382
1426
|
}
|
|
1383
|
-
var
|
|
1384
|
-
"packages/domain/compiler/src/
|
|
1427
|
+
var init_cacheNative = __esm({
|
|
1428
|
+
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
1385
1429
|
init_nativeBridge();
|
|
1386
1430
|
}
|
|
1387
1431
|
});
|
|
1388
1432
|
|
|
1389
|
-
// packages/domain/compiler/src/
|
|
1433
|
+
// packages/domain/compiler/src/cache/index.ts
|
|
1434
|
+
var init_cache = __esm({
|
|
1435
|
+
"packages/domain/compiler/src/cache/index.ts"() {
|
|
1436
|
+
init_cacheNative();
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
// packages/domain/compiler/src/redis/redisNative.ts
|
|
1390
1441
|
function redisPing() {
|
|
1391
1442
|
const native = getNativeBridge();
|
|
1392
1443
|
if (!native?.redis_ping) throw new Error("redis_ping not available");
|
|
@@ -1629,12 +1680,19 @@ function redisDiagnose() {
|
|
|
1629
1680
|
return native.redis_diagnose();
|
|
1630
1681
|
}
|
|
1631
1682
|
var init_redisNative = __esm({
|
|
1632
|
-
"packages/domain/compiler/src/redisNative.ts"() {
|
|
1683
|
+
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
1633
1684
|
init_nativeBridge();
|
|
1634
1685
|
}
|
|
1635
1686
|
});
|
|
1636
1687
|
|
|
1637
|
-
// packages/domain/compiler/src/
|
|
1688
|
+
// packages/domain/compiler/src/redis/index.ts
|
|
1689
|
+
var init_redis = __esm({
|
|
1690
|
+
"packages/domain/compiler/src/redis/index.ts"() {
|
|
1691
|
+
init_redisNative();
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
|
|
1695
|
+
// packages/domain/compiler/src/watch/watchSystemNative.ts
|
|
1638
1696
|
function startWatch(root_path, patterns) {
|
|
1639
1697
|
const native = getNativeBridge();
|
|
1640
1698
|
if (!native?.start_watch) throw new Error("start_watch not available");
|
|
@@ -1767,23 +1825,28 @@ function getCompilerDiagnostics() {
|
|
|
1767
1825
|
return native.get_compiler_diagnostics();
|
|
1768
1826
|
}
|
|
1769
1827
|
var init_watchSystemNative = __esm({
|
|
1770
|
-
"packages/domain/compiler/src/watchSystemNative.ts"() {
|
|
1828
|
+
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
1771
1829
|
init_nativeBridge();
|
|
1772
1830
|
}
|
|
1773
1831
|
});
|
|
1774
1832
|
|
|
1833
|
+
// packages/domain/compiler/src/watch/index.ts
|
|
1834
|
+
var init_watch = __esm({
|
|
1835
|
+
"packages/domain/compiler/src/watch/index.ts"() {
|
|
1836
|
+
init_watchSystemNative();
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
|
|
1775
1840
|
// packages/domain/compiler/src/index.ts
|
|
1776
1841
|
var src_exports = {};
|
|
1777
1842
|
__export(src_exports, {
|
|
1778
1843
|
BucketEngine: () => BucketEngine,
|
|
1779
1844
|
IncrementalEngine: () => IncrementalEngine,
|
|
1780
1845
|
adaptNativeResult: () => adaptNativeResult,
|
|
1781
|
-
analyzeClassUsage: () => analyzeClassUsage,
|
|
1782
1846
|
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
1783
1847
|
analyzeClasses: () => analyzeClasses,
|
|
1784
1848
|
analyzeClassesNative: () => analyzeClassesNative,
|
|
1785
1849
|
analyzeFile: () => analyzeFile,
|
|
1786
|
-
analyzeRsc: () => analyzeRsc,
|
|
1787
1850
|
analyzeRscNative: () => analyzeRscNative,
|
|
1788
1851
|
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
1789
1852
|
astExtractClasses: () => astExtractClasses,
|
|
@@ -1797,7 +1860,6 @@ __export(src_exports, {
|
|
|
1797
1860
|
cacheWrite: () => cacheWrite,
|
|
1798
1861
|
checkAgainstSafelist: () => checkAgainstSafelist,
|
|
1799
1862
|
checkAgainstSafelistNative: () => checkAgainstSafelistNative,
|
|
1800
|
-
classifyAndSortClasses: () => classifyAndSortClasses,
|
|
1801
1863
|
classifyAndSortClassesNative: () => classifyAndSortClassesNative,
|
|
1802
1864
|
classifyNode: () => classifyNode,
|
|
1803
1865
|
clearAllCaches: () => clearAllCaches,
|
|
@@ -1813,15 +1875,12 @@ __export(src_exports, {
|
|
|
1813
1875
|
compileClasses: () => compileClasses,
|
|
1814
1876
|
compileCssFromClasses: () => compileCssFromClasses,
|
|
1815
1877
|
compileCssLightning: () => compileCssLightning,
|
|
1816
|
-
compileCssNative: () => compileCssNative,
|
|
1817
1878
|
compileCssNative2: () => compileCssNative2,
|
|
1818
1879
|
compileKeyframes: () => compileKeyframes,
|
|
1819
1880
|
compileTheme: () => compileTheme,
|
|
1820
1881
|
compileToCss: () => compileToCss,
|
|
1821
1882
|
compileToCssBatch: () => compileToCssBatch,
|
|
1822
|
-
compileVariantTable: () => compileVariantTable,
|
|
1823
1883
|
compileVariantTableNative: () => compileVariantTableNative,
|
|
1824
|
-
compileVariants: () => compileVariants,
|
|
1825
1884
|
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
1826
1885
|
createFingerprint: () => createFingerprint,
|
|
1827
1886
|
detectConflicts: () => detectConflicts,
|
|
@@ -1854,7 +1913,7 @@ __export(src_exports, {
|
|
|
1854
1913
|
getBucketEngine: () => getBucketEngine,
|
|
1855
1914
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
1856
1915
|
getCacheStatistics: () => getCacheStatistics,
|
|
1857
|
-
getCacheStats: () =>
|
|
1916
|
+
getCacheStats: () => getCacheStats,
|
|
1858
1917
|
getCompilationMetrics: () => getCompilationMetrics,
|
|
1859
1918
|
getCompilerDiagnostics: () => getCompilerDiagnostics,
|
|
1860
1919
|
getContentPaths: () => getContentPaths,
|
|
@@ -1865,7 +1924,6 @@ __export(src_exports, {
|
|
|
1865
1924
|
getWatchStats: () => getWatchStats,
|
|
1866
1925
|
hasTwUsage: () => hasTwUsage,
|
|
1867
1926
|
hashContent: () => hashContent,
|
|
1868
|
-
hoistComponents: () => hoistComponents,
|
|
1869
1927
|
hoistComponentsNative: () => hoistComponentsNative,
|
|
1870
1928
|
idRegistryActiveCount: () => idRegistryActiveCount,
|
|
1871
1929
|
idRegistryCreate: () => idRegistryCreate,
|
|
@@ -1886,12 +1944,10 @@ __export(src_exports, {
|
|
|
1886
1944
|
loadSafelist: () => loadSafelist,
|
|
1887
1945
|
loadTailwindConfig: () => loadTailwindConfig,
|
|
1888
1946
|
mergeClassesStatic: () => mergeClassesStatic,
|
|
1889
|
-
mergeCssDeclarations: () => mergeCssDeclarations,
|
|
1890
1947
|
mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
|
|
1891
1948
|
minifyCss: () => minifyCss,
|
|
1892
1949
|
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
1893
1950
|
normalizeClasses: () => normalizeClasses,
|
|
1894
|
-
optimizeCss: () => optimizeCss,
|
|
1895
1951
|
optimizeCssNative: () => optimizeCssNative,
|
|
1896
1952
|
parseAtomicClass: () => parseAtomicClass,
|
|
1897
1953
|
parseClasses: () => parseClasses,
|
|
@@ -1956,6 +2012,7 @@ __export(src_exports, {
|
|
|
1956
2012
|
resolveVariants: () => resolveVariants,
|
|
1957
2013
|
reverseLookupProperty: () => reverseLookupProperty,
|
|
1958
2014
|
reverseLookupValue: () => reverseLookupValue,
|
|
2015
|
+
runCssPipeline: () => runCssPipeline,
|
|
1959
2016
|
runElimination: () => runElimination,
|
|
1960
2017
|
runLoaderTransform: () => runLoaderTransform,
|
|
1961
2018
|
scanCacheOptimizations: () => scanCacheOptimizations,
|
|
@@ -2022,21 +2079,16 @@ function extractContainerCssFromSource(source) {
|
|
|
2022
2079
|
}
|
|
2023
2080
|
return rules.join("\n");
|
|
2024
2081
|
}
|
|
2025
|
-
var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag,
|
|
2082
|
+
var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2026
2083
|
var init_src = __esm({
|
|
2027
2084
|
"packages/domain/compiler/src/index.ts"() {
|
|
2028
2085
|
init_nativeBridge();
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
init_streamingNative();
|
|
2036
|
-
init_cssCompilationNative();
|
|
2037
|
-
init_idRegistryNative();
|
|
2038
|
-
init_redisNative();
|
|
2039
|
-
init_watchSystemNative();
|
|
2086
|
+
init_compiler();
|
|
2087
|
+
init_parser();
|
|
2088
|
+
init_analyzer();
|
|
2089
|
+
init_cache();
|
|
2090
|
+
init_redis();
|
|
2091
|
+
init_watch();
|
|
2040
2092
|
transformSource = (source, opts) => {
|
|
2041
2093
|
const native = getNativeBridge();
|
|
2042
2094
|
if (!native?.transformSource) {
|
|
@@ -2076,217 +2128,69 @@ var init_src = __esm({
|
|
|
2076
2128
|
}
|
|
2077
2129
|
return result;
|
|
2078
2130
|
};
|
|
2079
|
-
buildStyleTag = (classes) => {
|
|
2080
|
-
const result = compileCssFromClasses(classes);
|
|
2081
|
-
return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
|
|
2082
|
-
};
|
|
2083
|
-
compileCssNative = (classes, prefix = null) => {
|
|
2084
|
-
return compileCssFromClasses(classes, prefix);
|
|
2085
|
-
};
|
|
2086
|
-
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2087
|
-
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
2088
|
-
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2089
|
-
return result.css;
|
|
2090
|
-
};
|
|
2091
|
-
extractAllClasses = (source) => {
|
|
2092
|
-
const native = getNativeBridge();
|
|
2093
|
-
if (!native?.extractAllClasses) {
|
|
2094
|
-
throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
|
|
2095
|
-
}
|
|
2096
|
-
return native.extractAllClasses(source) || [];
|
|
2097
|
-
};
|
|
2098
|
-
extractClassesFromSource = (source) => {
|
|
2099
|
-
const native = getNativeBridge();
|
|
2100
|
-
if (!native?.extractClassesFromSource) {
|
|
2101
|
-
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
2102
|
-
}
|
|
2103
|
-
const result = native.extractClassesFromSource(source);
|
|
2104
|
-
return Array.isArray(result) ? result.join(" ") : String(result || "");
|
|
2105
|
-
};
|
|
2106
|
-
astExtractClasses = (source, _filename) => {
|
|
2107
|
-
const native = getNativeBridge();
|
|
2108
|
-
if (!native?.extractClassesFromSource) {
|
|
2109
|
-
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
2110
|
-
}
|
|
2111
|
-
return native.extractClassesFromSource(source) || [];
|
|
2112
|
-
};
|
|
2113
|
-
parseClasses = (raw) => {
|
|
2114
|
-
const native = getNativeBridge();
|
|
2115
|
-
if (!native?.parseClasses) {
|
|
2116
|
-
throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
|
|
2117
|
-
}
|
|
2118
|
-
return native.parseClasses(raw) || [];
|
|
2119
|
-
};
|
|
2120
|
-
normalizeClasses = (raw) => {
|
|
2121
|
-
const result = normalizeAndDedupClasses(raw);
|
|
2122
|
-
return result?.normalized || "";
|
|
2123
|
-
};
|
|
2124
|
-
mergeClassesStatic = (classes) => {
|
|
2125
|
-
const result = normalizeAndDedupClasses(classes);
|
|
2126
|
-
return result?.normalized || "";
|
|
2127
|
-
};
|
|
2128
|
-
normalizeAndDedupClasses = (raw) => {
|
|
2129
|
-
const native = getNativeBridge();
|
|
2130
|
-
if (!native?.normalizeAndDedupClasses) {
|
|
2131
|
-
throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
|
|
2132
|
-
}
|
|
2133
|
-
const result = native.normalizeAndDedupClasses(raw);
|
|
2134
|
-
return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
|
|
2135
|
-
};
|
|
2136
|
-
eliminateDeadCss = (css, deadClasses) => {
|
|
2137
|
-
const native = getNativeBridge();
|
|
2138
|
-
if (!native?.eliminateDeadCss) {
|
|
2139
|
-
throw new Error("FATAL: Native binding 'eliminateDeadCss' is required but not available.");
|
|
2140
|
-
}
|
|
2141
|
-
return native.eliminateDeadCss(css, Array.from(deadClasses));
|
|
2142
|
-
};
|
|
2143
|
-
findDeadVariants = (variantConfig, usage) => {
|
|
2144
|
-
const unused = [];
|
|
2145
|
-
const configs = Array.isArray(variantConfig) ? variantConfig : [{ name: "__root__", variants: variantConfig }];
|
|
2146
|
-
for (const component of configs) {
|
|
2147
|
-
const componentUsage = usage[component.name] ?? /* @__PURE__ */ new Set();
|
|
2148
|
-
const variants = component.variants;
|
|
2149
|
-
for (const [key, values] of Object.entries(variants)) {
|
|
2150
|
-
for (const [value] of Object.entries(values)) {
|
|
2151
|
-
if (!componentUsage.has(`${key}:${value}`)) {
|
|
2152
|
-
unused.push(`${component.name !== "__root__" ? `${component.name}/` : ""}${key}:${value}`);
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
return { unusedCount: unused.length, unused };
|
|
2158
|
-
};
|
|
2159
|
-
runElimination = (css, scanResult) => {
|
|
2160
|
-
const native = getNativeBridge();
|
|
2161
|
-
if (!native?.detectDeadCode) {
|
|
2162
|
-
throw new Error("FATAL: Native binding 'detectDeadCode' is required but not available.");
|
|
2163
|
-
}
|
|
2164
|
-
const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
|
|
2165
|
-
return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
|
|
2166
|
-
};
|
|
2167
|
-
optimizeCss = (css) => {
|
|
2168
|
-
const native = getNativeBridge();
|
|
2169
|
-
if (!native?.optimizeCss) {
|
|
2170
|
-
throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
|
|
2171
|
-
}
|
|
2172
|
-
return native.optimizeCss(css);
|
|
2173
|
-
};
|
|
2174
|
-
scanProjectUsage = (dirs, cwd) => {
|
|
2175
|
-
const files = dirs.map((dir) => path10__default.resolve(cwd, dir));
|
|
2176
|
-
const results = batchExtractClasses(files) || [];
|
|
2177
|
-
const combined = {};
|
|
2178
|
-
for (const result of results) {
|
|
2179
|
-
if (result.ok && result.classes) {
|
|
2180
|
-
for (const cls of result.classes) {
|
|
2181
|
-
if (!combined[cls]) combined[cls] = {};
|
|
2182
|
-
combined[cls][result.file] = /* @__PURE__ */ new Set([cls]);
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
return combined;
|
|
2187
|
-
};
|
|
2188
|
-
extractComponentUsage = (source) => {
|
|
2189
|
-
const native = getNativeBridge();
|
|
2190
|
-
if (!native?.extractComponentUsage) {
|
|
2191
|
-
throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
|
|
2192
|
-
}
|
|
2193
|
-
return native.extractComponentUsage(source) || [];
|
|
2194
|
-
};
|
|
2195
|
-
diffClassLists = (previous, current) => {
|
|
2196
|
-
const native = getNativeBridge();
|
|
2197
|
-
if (!native?.diffClassLists) {
|
|
2198
|
-
throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
|
|
2199
|
-
}
|
|
2200
|
-
return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
|
|
2201
|
-
};
|
|
2202
|
-
batchExtractClasses = (filePaths) => {
|
|
2203
|
-
const native = getNativeBridge();
|
|
2204
|
-
if (!native?.batchExtractClasses) {
|
|
2205
|
-
throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
|
|
2206
|
-
}
|
|
2207
|
-
return native.batchExtractClasses(filePaths) || [];
|
|
2208
|
-
};
|
|
2209
|
-
checkAgainstSafelist = (classes, safelist) => {
|
|
2210
|
-
const native = getNativeBridge();
|
|
2211
|
-
if (!native?.checkAgainstSafelist) {
|
|
2212
|
-
throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
|
|
2213
|
-
}
|
|
2214
|
-
return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
|
|
2215
|
-
};
|
|
2216
|
-
hoistComponents = (source) => {
|
|
2217
|
-
const native = getNativeBridge();
|
|
2218
|
-
if (!native?.hoistComponents) {
|
|
2219
|
-
throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
|
|
2220
|
-
}
|
|
2221
|
-
return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
|
|
2222
|
-
};
|
|
2223
|
-
compileVariantTable = (configJson) => {
|
|
2224
|
-
const native = getNativeBridge();
|
|
2225
|
-
if (!native?.compileVariantTable) {
|
|
2226
|
-
throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
|
|
2227
|
-
}
|
|
2228
|
-
return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
|
|
2229
|
-
};
|
|
2230
|
-
compileVariants = (componentId, config) => {
|
|
2231
|
-
return compileVariantTable(JSON.stringify({ componentId, ...config }));
|
|
2232
|
-
};
|
|
2233
|
-
classifyAndSortClasses = (classes) => {
|
|
2234
|
-
const native = getNativeBridge();
|
|
2235
|
-
if (!native?.classifyAndSortClasses) {
|
|
2236
|
-
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2237
|
-
}
|
|
2238
|
-
return native.classifyAndSortClasses(classes) || [];
|
|
2239
|
-
};
|
|
2240
|
-
mergeCssDeclarations = (cssChunks) => {
|
|
2241
|
-
const native = getNativeBridge();
|
|
2242
|
-
if (!native?.mergeCssDeclarations) {
|
|
2243
|
-
throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
|
|
2244
|
-
}
|
|
2245
|
-
return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
|
|
2246
|
-
};
|
|
2247
|
-
analyzeClassUsage = (classes, scanResultJson, css) => {
|
|
2248
|
-
const native = getNativeBridge();
|
|
2249
|
-
if (!native?.analyzeClassUsage) {
|
|
2250
|
-
throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
|
|
2251
|
-
}
|
|
2252
|
-
return native.analyzeClassUsage(classes, scanResultJson, css) || [];
|
|
2253
|
-
};
|
|
2254
|
-
analyzeRsc = (source, filename) => {
|
|
2255
|
-
const native = getNativeBridge();
|
|
2256
|
-
if (!native?.analyzeRsc) {
|
|
2257
|
-
throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
|
|
2258
|
-
}
|
|
2259
|
-
return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
|
|
2260
|
-
};
|
|
2261
|
-
analyzeFile = (source, filename) => {
|
|
2262
|
-
const rsc = analyzeRsc(source, filename);
|
|
2263
|
-
return {
|
|
2264
|
-
isServer: rsc?.isServer ?? true,
|
|
2265
|
-
needsClientDirective: rsc?.needsClientDirective ?? false,
|
|
2266
|
-
clientReasons: rsc?.clientReasons ?? [],
|
|
2267
|
-
interactiveClasses: [],
|
|
2268
|
-
canStaticResolveVariants: true
|
|
2269
|
-
};
|
|
2131
|
+
buildStyleTag = (classes) => {
|
|
2132
|
+
const result = compileCssFromClasses(classes);
|
|
2133
|
+
return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
|
|
2270
2134
|
};
|
|
2271
|
-
|
|
2272
|
-
|
|
2135
|
+
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2136
|
+
try {
|
|
2137
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
2138
|
+
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2139
|
+
return result.css;
|
|
2140
|
+
} catch {
|
|
2141
|
+
const native = getNativeBridge();
|
|
2142
|
+
if (!native?.transformSource) {
|
|
2143
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
2144
|
+
}
|
|
2145
|
+
const result = native.transformSource(classes.join(" "), {});
|
|
2146
|
+
return result?.code || "";
|
|
2147
|
+
}
|
|
2273
2148
|
};
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2149
|
+
eliminateDeadCss = (css, deadClasses) => {
|
|
2150
|
+
const native = getNativeBridge();
|
|
2151
|
+
if (!native?.eliminateDeadCss) {
|
|
2152
|
+
throw new Error("FATAL: Native binding 'eliminateDeadCss' is required but not available.");
|
|
2277
2153
|
}
|
|
2278
|
-
return
|
|
2154
|
+
return native.eliminateDeadCss(css, Array.from(deadClasses));
|
|
2279
2155
|
};
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2156
|
+
findDeadVariants = (variantConfig, usage) => {
|
|
2157
|
+
const unused = [];
|
|
2158
|
+
const configs = Array.isArray(variantConfig) ? variantConfig : [{ name: "__root__", variants: variantConfig }];
|
|
2159
|
+
for (const component of configs) {
|
|
2160
|
+
const componentUsage = usage[component.name] ?? /* @__PURE__ */ new Set();
|
|
2161
|
+
const variants = component.variants;
|
|
2162
|
+
for (const [key, values] of Object.entries(variants)) {
|
|
2163
|
+
for (const [value] of Object.entries(values)) {
|
|
2164
|
+
if (!componentUsage.has(`${key}:${value}`)) {
|
|
2165
|
+
unused.push(`${component.name !== "__root__" ? `${component.name}/` : ""}${key}:${value}`);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
return { unusedCount: unused.length, unused };
|
|
2283
2171
|
};
|
|
2284
|
-
|
|
2172
|
+
runElimination = (css, scanResult) => {
|
|
2285
2173
|
const native = getNativeBridge();
|
|
2286
|
-
if (!native?.
|
|
2287
|
-
throw new Error("FATAL: Native binding '
|
|
2174
|
+
if (!native?.detectDeadCode) {
|
|
2175
|
+
throw new Error("FATAL: Native binding 'detectDeadCode' is required but not available.");
|
|
2288
2176
|
}
|
|
2289
|
-
|
|
2177
|
+
const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
|
|
2178
|
+
return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
|
|
2179
|
+
};
|
|
2180
|
+
scanProjectUsage = (dirs, cwd) => {
|
|
2181
|
+
const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
|
|
2182
|
+
const files = dirs.map((dir) => path10__default.resolve(cwd, dir));
|
|
2183
|
+
const results = batchExtractClasses2(files) || [];
|
|
2184
|
+
const combined = {};
|
|
2185
|
+
for (const result of results) {
|
|
2186
|
+
if (result.ok && result.classes) {
|
|
2187
|
+
for (const cls of result.classes) {
|
|
2188
|
+
if (!combined[cls]) combined[cls] = {};
|
|
2189
|
+
combined[cls][result.file] = /* @__PURE__ */ new Set([cls]);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
return combined;
|
|
2290
2194
|
};
|
|
2291
2195
|
generateSafelist = (scanDirs, outputPath, cwd) => {
|
|
2292
2196
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
@@ -2351,7 +2255,8 @@ ${source}`;
|
|
|
2351
2255
|
if (containerCss) cssChunks.push(containerCss);
|
|
2352
2256
|
const combined = cssChunks.join("\n").trim();
|
|
2353
2257
|
if (combined) staticCss = combined;
|
|
2354
|
-
} catch {
|
|
2258
|
+
} catch (err) {
|
|
2259
|
+
console.debug("Static CSS extraction warning:", err);
|
|
2355
2260
|
}
|
|
2356
2261
|
return {
|
|
2357
2262
|
code: result?.code || "",
|
|
@@ -2441,7 +2346,46 @@ ${source}`;
|
|
|
2441
2346
|
return [];
|
|
2442
2347
|
};
|
|
2443
2348
|
bucketSort = (classes) => {
|
|
2444
|
-
|
|
2349
|
+
const native = getNativeBridge();
|
|
2350
|
+
if (!native?.classifyAndSortClasses) {
|
|
2351
|
+
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2352
|
+
}
|
|
2353
|
+
const sorted = native.classifyAndSortClasses(classes);
|
|
2354
|
+
return sorted.map((c) => c.raw ?? c);
|
|
2355
|
+
};
|
|
2356
|
+
analyzeFile = (source, filename) => {
|
|
2357
|
+
const native = getNativeBridge();
|
|
2358
|
+
if (!native?.analyzeRsc) {
|
|
2359
|
+
throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
|
|
2360
|
+
}
|
|
2361
|
+
const rsc = native.analyzeRsc(source, filename);
|
|
2362
|
+
return {
|
|
2363
|
+
isServer: rsc?.isServer ?? true,
|
|
2364
|
+
needsClientDirective: rsc?.needsClientDirective ?? false,
|
|
2365
|
+
clientReasons: rsc?.clientReasons ?? [],
|
|
2366
|
+
interactiveClasses: [],
|
|
2367
|
+
canStaticResolveVariants: true
|
|
2368
|
+
};
|
|
2369
|
+
};
|
|
2370
|
+
analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
|
|
2371
|
+
return { resolved: {}, dynamic: [] };
|
|
2372
|
+
};
|
|
2373
|
+
injectClientDirective = (source) => {
|
|
2374
|
+
if (!source.includes('"use client"') && !source.includes("'use client'")) {
|
|
2375
|
+
return '"use client";\n' + source;
|
|
2376
|
+
}
|
|
2377
|
+
return source;
|
|
2378
|
+
};
|
|
2379
|
+
injectServerOnlyComment = (source) => {
|
|
2380
|
+
return `/* @server-only */
|
|
2381
|
+
${source}`;
|
|
2382
|
+
};
|
|
2383
|
+
analyzeClasses = (filesJson, cwd, flags) => {
|
|
2384
|
+
const native = getNativeBridge();
|
|
2385
|
+
if (!native?.analyzeClasses) {
|
|
2386
|
+
throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
|
|
2387
|
+
}
|
|
2388
|
+
return native.analyzeClasses(filesJson, cwd, flags);
|
|
2445
2389
|
};
|
|
2446
2390
|
extractTwStateConfigs = (source, filename) => {
|
|
2447
2391
|
const native = getNativeBridge();
|
|
@@ -2450,23 +2394,25 @@ ${source}`;
|
|
|
2450
2394
|
}
|
|
2451
2395
|
return native.extractTwStateConfigs(source, filename);
|
|
2452
2396
|
};
|
|
2453
|
-
generateStaticStateCss = (
|
|
2454
|
-
const
|
|
2455
|
-
|
|
2456
|
-
|
|
2397
|
+
generateStaticStateCss = (entries, _themeConfig) => {
|
|
2398
|
+
const rules = [];
|
|
2399
|
+
for (const entry of entries) {
|
|
2400
|
+
const stateConfig = JSON.parse(entry.statesJson);
|
|
2401
|
+
for (const [stateName, classes] of Object.entries(stateConfig)) {
|
|
2402
|
+
rules.push({
|
|
2403
|
+
selector: `.${entry.componentName}[data-state="${stateName}"]`,
|
|
2404
|
+
declarations: classes,
|
|
2405
|
+
cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
|
|
2406
|
+
componentName: entry.componentName,
|
|
2407
|
+
stateName
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2457
2410
|
}
|
|
2458
|
-
return
|
|
2411
|
+
return rules;
|
|
2459
2412
|
};
|
|
2460
2413
|
extractAndGenerateStateCss = (source, filename) => {
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
const configs = extractTwStateConfigs(source, filename);
|
|
2464
|
-
if (configs.length === 0) return [];
|
|
2465
|
-
return generateStaticStateCss(
|
|
2466
|
-
configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
|
|
2467
|
-
);
|
|
2468
|
-
}
|
|
2469
|
-
return native.extractAndGenerateStateCss(source, filename);
|
|
2414
|
+
const entries = extractTwStateConfigs(source, filename);
|
|
2415
|
+
return generateStaticStateCss(entries);
|
|
2470
2416
|
};
|
|
2471
2417
|
}
|
|
2472
2418
|
});
|
|
@@ -2475,75 +2421,219 @@ ${source}`;
|
|
|
2475
2421
|
var internal_exports = {};
|
|
2476
2422
|
__export(internal_exports, {
|
|
2477
2423
|
adaptNativeResult: () => adaptNativeResult,
|
|
2478
|
-
|
|
2424
|
+
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
2479
2425
|
analyzeClasses: () => analyzeClasses,
|
|
2426
|
+
analyzeClassesNative: () => analyzeClassesNative,
|
|
2480
2427
|
analyzeFile: () => analyzeFile,
|
|
2481
|
-
|
|
2428
|
+
analyzeRscNative: () => analyzeRscNative,
|
|
2482
2429
|
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
2483
2430
|
astExtractClasses: () => astExtractClasses,
|
|
2431
|
+
atomicRegistrySize: () => atomicRegistrySize,
|
|
2484
2432
|
batchExtractClasses: () => batchExtractClasses,
|
|
2433
|
+
batchExtractClassesNative: () => batchExtractClassesNative,
|
|
2485
2434
|
bucketSort: () => bucketSort,
|
|
2486
2435
|
buildStyleTag: () => buildStyleTag,
|
|
2436
|
+
cachePriority: () => cachePriority,
|
|
2437
|
+
cacheRead: () => cacheRead,
|
|
2438
|
+
cacheWrite: () => cacheWrite,
|
|
2487
2439
|
checkAgainstSafelist: () => checkAgainstSafelist,
|
|
2488
|
-
|
|
2440
|
+
checkAgainstSafelistNative: () => checkAgainstSafelistNative,
|
|
2441
|
+
classifyAndSortClassesNative: () => classifyAndSortClassesNative,
|
|
2489
2442
|
classifyNode: () => classifyNode,
|
|
2443
|
+
clearAllCaches: () => clearAllCaches,
|
|
2444
|
+
clearAtomicRegistry: () => clearAtomicRegistry,
|
|
2490
2445
|
clearCache: () => clearCache,
|
|
2446
|
+
clearCompileCache: () => clearCompileCache,
|
|
2447
|
+
clearCssGenCache: () => clearCssGenCache,
|
|
2448
|
+
clearParseCache: () => clearParseCache,
|
|
2449
|
+
clearResolveCache: () => clearResolveCache,
|
|
2450
|
+
clearThemeCache: () => clearThemeCache,
|
|
2451
|
+
collectFiles: () => collectFiles,
|
|
2452
|
+
compileAnimation: () => compileAnimation,
|
|
2453
|
+
compileClass: () => compileClass,
|
|
2454
|
+
compileClasses: () => compileClasses,
|
|
2491
2455
|
compileCssFromClasses: () => compileCssFromClasses,
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2456
|
+
compileCssLightning: () => compileCssLightning,
|
|
2457
|
+
compileCssNative2: () => compileCssNative2,
|
|
2458
|
+
compileKeyframes: () => compileKeyframes,
|
|
2459
|
+
compileTheme: () => compileTheme,
|
|
2460
|
+
compileToCss: () => compileToCss,
|
|
2461
|
+
compileToCssBatch: () => compileToCssBatch,
|
|
2462
|
+
compileVariantTableNative: () => compileVariantTableNative,
|
|
2463
|
+
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
2464
|
+
createFingerprint: () => createFingerprint,
|
|
2495
2465
|
detectConflicts: () => detectConflicts,
|
|
2466
|
+
detectDeadCode: () => detectDeadCode,
|
|
2496
2467
|
diffClassLists: () => diffClassLists,
|
|
2497
2468
|
eliminateDeadCss: () => eliminateDeadCss,
|
|
2469
|
+
eliminateDeadCssNative: () => eliminateDeadCssNative,
|
|
2470
|
+
emitPluginHook: () => emitPluginHook,
|
|
2471
|
+
estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
|
|
2498
2472
|
extractAllClasses: () => extractAllClasses,
|
|
2499
2473
|
extractAndGenerateStateCss: () => extractAndGenerateStateCss,
|
|
2474
|
+
extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
|
|
2500
2475
|
extractClassesFromSource: () => extractClassesFromSource,
|
|
2476
|
+
extractClassesFromSourceNative: () => extractClassesFromSourceNative,
|
|
2501
2477
|
extractComponentUsage: () => extractComponentUsage,
|
|
2502
2478
|
extractContainerCssFromSource: () => extractContainerCssFromSource,
|
|
2479
|
+
extractTwContainerConfigs: () => extractTwContainerConfigs,
|
|
2503
2480
|
extractTwStateConfigs: () => extractTwStateConfigs,
|
|
2481
|
+
extractTwStateConfigsNative: () => extractTwStateConfigsNative,
|
|
2504
2482
|
fileToRoute: () => fileToRoute,
|
|
2505
2483
|
findDeadVariants: () => findDeadVariants,
|
|
2484
|
+
generateAtomicCss: () => generateAtomicCss,
|
|
2506
2485
|
generateCssForClasses: () => generateCssForClasses,
|
|
2507
|
-
|
|
2486
|
+
generateCssNative: () => generateCssNative,
|
|
2508
2487
|
generateSafelist: () => generateSafelist,
|
|
2509
2488
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2489
|
+
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2490
|
+
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
2510
2491
|
getAllRoutes: () => getAllRoutes,
|
|
2511
2492
|
getBucketEngine: () => getBucketEngine,
|
|
2512
|
-
|
|
2493
|
+
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
2494
|
+
getCacheStatistics: () => getCacheStatistics,
|
|
2495
|
+
getCacheStats: () => getCacheStats2,
|
|
2496
|
+
getCompilationMetrics: () => getCompilationMetrics,
|
|
2497
|
+
getCompilerDiagnostics: () => getCompilerDiagnostics,
|
|
2513
2498
|
getContentPaths: () => getContentPaths,
|
|
2514
2499
|
getIncrementalEngine: () => getIncrementalEngine,
|
|
2515
2500
|
getNativeBridge: () => getNativeBridge,
|
|
2501
|
+
getPluginHooks: () => getPluginHooks,
|
|
2516
2502
|
getRouteClasses: () => getRouteClasses,
|
|
2503
|
+
getWatchStats: () => getWatchStats,
|
|
2517
2504
|
hasTwUsage: () => hasTwUsage,
|
|
2518
|
-
|
|
2505
|
+
hashContent: () => hashContent,
|
|
2506
|
+
hoistComponentsNative: () => hoistComponentsNative,
|
|
2507
|
+
idRegistryActiveCount: () => idRegistryActiveCount,
|
|
2508
|
+
idRegistryCreate: () => idRegistryCreate,
|
|
2509
|
+
idRegistryDestroy: () => idRegistryDestroy,
|
|
2510
|
+
idRegistryExport: () => idRegistryExport,
|
|
2511
|
+
idRegistryGenerate: () => idRegistryGenerate,
|
|
2512
|
+
idRegistryImport: () => idRegistryImport,
|
|
2513
|
+
idRegistryLookup: () => idRegistryLookup,
|
|
2514
|
+
idRegistryNext: () => idRegistryNext,
|
|
2515
|
+
idRegistryReset: () => idRegistryReset,
|
|
2516
|
+
idRegistrySnapshot: () => idRegistrySnapshot,
|
|
2519
2517
|
injectClientDirective: () => injectClientDirective,
|
|
2520
2518
|
injectServerOnlyComment: () => injectServerOnlyComment,
|
|
2519
|
+
injectStateHash: () => injectStateHash,
|
|
2521
2520
|
isAlreadyTransformed: () => isAlreadyTransformed,
|
|
2521
|
+
isWatchRunning: () => isWatchRunning,
|
|
2522
|
+
layoutClassesToCss: () => layoutClassesToCss,
|
|
2522
2523
|
loadSafelist: () => loadSafelist,
|
|
2523
2524
|
loadTailwindConfig: () => loadTailwindConfig,
|
|
2524
2525
|
mergeClassesStatic: () => mergeClassesStatic,
|
|
2525
|
-
|
|
2526
|
+
mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
|
|
2527
|
+
minifyCss: () => minifyCss,
|
|
2526
2528
|
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
2527
2529
|
normalizeClasses: () => normalizeClasses,
|
|
2528
|
-
|
|
2530
|
+
optimizeCssNative: () => optimizeCssNative,
|
|
2531
|
+
parseAtomicClass: () => parseAtomicClass,
|
|
2529
2532
|
parseClasses: () => parseClasses,
|
|
2533
|
+
pollWatchEvents: () => pollWatchEvents,
|
|
2534
|
+
processFileChange: () => processFileChange,
|
|
2535
|
+
processTailwindCssLightning: () => processTailwindCssLightning,
|
|
2536
|
+
propertyIdToString: () => propertyIdToString,
|
|
2537
|
+
pruneStaleCacheEntries: () => pruneStaleCacheEntries,
|
|
2538
|
+
rebuildWorkspaceResult: () => rebuildWorkspaceResult,
|
|
2539
|
+
redisCacheClear: () => redisCacheClear,
|
|
2540
|
+
redisCacheHitRate: () => redisCacheHitRate,
|
|
2541
|
+
redisCacheKeyCount: () => redisCacheKeyCount,
|
|
2542
|
+
redisCacheSize: () => redisCacheSize,
|
|
2543
|
+
redisCacheSync: () => redisCacheSync,
|
|
2544
|
+
redisClusterStatus: () => redisClusterStatus,
|
|
2545
|
+
redisDelete: () => redisDelete,
|
|
2546
|
+
redisDiagnose: () => redisDiagnose,
|
|
2547
|
+
redisDisableCacheWarming: () => redisDisableCacheWarming,
|
|
2548
|
+
redisDisableCluster: () => redisDisableCluster,
|
|
2549
|
+
redisDisablePersistence: () => redisDisablePersistence,
|
|
2550
|
+
redisEnableCacheWarming: () => redisEnableCacheWarming,
|
|
2551
|
+
redisEnableCluster: () => redisEnableCluster,
|
|
2552
|
+
redisEnablePersistence: () => redisEnablePersistence,
|
|
2553
|
+
redisExists: () => redisExists,
|
|
2554
|
+
redisExpirationGet: () => redisExpirationGet,
|
|
2555
|
+
redisExpirationSet: () => redisExpirationSet,
|
|
2556
|
+
redisFlushAll: () => redisFlushAll,
|
|
2557
|
+
redisFlushDb: () => redisFlushDb,
|
|
2558
|
+
redisGet: () => redisGet,
|
|
2559
|
+
redisGetEvictionPolicy: () => redisGetEvictionPolicy,
|
|
2560
|
+
redisInfo: () => redisInfo,
|
|
2561
|
+
redisMemoryStats: () => redisMemoryStats,
|
|
2562
|
+
redisMget: () => redisMget,
|
|
2563
|
+
redisMonitor: () => redisMonitor,
|
|
2564
|
+
redisMset: () => redisMset,
|
|
2565
|
+
redisOptimizeMemory: () => redisOptimizeMemory,
|
|
2566
|
+
redisPing: () => redisPing,
|
|
2567
|
+
redisPoolConnect: () => redisPoolConnect,
|
|
2568
|
+
redisPoolReconnect: () => redisPoolReconnect,
|
|
2569
|
+
redisPoolStats: () => redisPoolStats,
|
|
2570
|
+
redisPublish: () => redisPublish,
|
|
2571
|
+
redisReplicate: () => redisReplicate,
|
|
2572
|
+
redisReplicationStatus: () => redisReplicationStatus,
|
|
2573
|
+
redisSet: () => redisSet,
|
|
2574
|
+
redisSetEvictionPolicy: () => redisSetEvictionPolicy,
|
|
2575
|
+
redisSnapshot: () => redisSnapshot,
|
|
2576
|
+
redisSubscribe: () => redisSubscribe,
|
|
2530
2577
|
registerFileClasses: () => registerFileClasses,
|
|
2531
2578
|
registerGlobalClasses: () => registerGlobalClasses,
|
|
2579
|
+
registerPluginHook: () => registerPluginHook,
|
|
2580
|
+
registerPropertyName: () => registerPropertyName,
|
|
2581
|
+
registerValueName: () => registerValueName,
|
|
2532
2582
|
resetBucketEngine: () => resetBucketEngine,
|
|
2583
|
+
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
2533
2584
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
2585
|
+
resolveCascade: () => resolveCascade,
|
|
2586
|
+
resolveClassNames: () => resolveClassNames,
|
|
2587
|
+
resolveConflictGroup: () => resolveConflictGroup,
|
|
2588
|
+
resolveSimpleVariants: () => resolveSimpleVariants,
|
|
2589
|
+
resolveThemeValue: () => resolveThemeValue,
|
|
2590
|
+
resolveVariants: () => resolveVariants,
|
|
2591
|
+
reverseLookupProperty: () => reverseLookupProperty,
|
|
2592
|
+
reverseLookupValue: () => reverseLookupValue,
|
|
2534
2593
|
runCssPipeline: () => runCssPipeline,
|
|
2535
2594
|
runCssPipelineSync: () => runCssPipelineSync,
|
|
2536
2595
|
runElimination: () => runElimination,
|
|
2537
2596
|
runLoaderTransform: () => runLoaderTransform,
|
|
2597
|
+
scanCacheOptimizations: () => scanCacheOptimizations,
|
|
2598
|
+
scanFile: () => scanFile,
|
|
2599
|
+
scanFileNative: () => scanFileNative,
|
|
2600
|
+
scanFilesBatchNative: () => scanFilesBatchNative,
|
|
2538
2601
|
scanProjectUsage: () => scanProjectUsage,
|
|
2602
|
+
scanWorkspace: () => scanWorkspace,
|
|
2539
2603
|
shouldProcess: () => shouldProcess,
|
|
2540
2604
|
shouldSkipFile: () => shouldSkipFile,
|
|
2541
|
-
|
|
2605
|
+
startWatch: () => startWatch,
|
|
2606
|
+
stopWatch: () => stopWatch,
|
|
2607
|
+
toAtomicClasses: () => toAtomicClasses,
|
|
2608
|
+
transformSource: () => transformSource,
|
|
2609
|
+
twMerge: () => twMerge,
|
|
2610
|
+
twMergeMany: () => twMergeMany,
|
|
2611
|
+
twMergeManyWithSeparator: () => twMergeManyWithSeparator,
|
|
2612
|
+
twMergeRaw: () => twMergeRaw,
|
|
2613
|
+
twMergeWithSeparator: () => twMergeWithSeparator,
|
|
2614
|
+
unregisterPluginHook: () => unregisterPluginHook,
|
|
2615
|
+
validateCssOutput: () => validateCssOutput,
|
|
2616
|
+
validateThemeConfig: () => validateThemeConfig,
|
|
2617
|
+
valueIdToString: () => valueIdToString,
|
|
2618
|
+
walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
|
|
2619
|
+
watchAddPattern: () => watchAddPattern,
|
|
2620
|
+
watchClearAll: () => watchClearAll,
|
|
2621
|
+
watchEventTypeToString: () => watchEventTypeToString,
|
|
2622
|
+
watchGetActiveHandles: () => watchGetActiveHandles,
|
|
2623
|
+
watchPause: () => watchPause,
|
|
2624
|
+
watchRemovePattern: () => watchRemovePattern,
|
|
2625
|
+
watchResume: () => watchResume
|
|
2542
2626
|
});
|
|
2543
2627
|
var init_internal = __esm({
|
|
2544
2628
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2545
2629
|
init_src();
|
|
2546
2630
|
init_tailwindEngine();
|
|
2631
|
+
init_compiler();
|
|
2632
|
+
init_parser();
|
|
2633
|
+
init_analyzer();
|
|
2634
|
+
init_cache();
|
|
2635
|
+
init_redis();
|
|
2636
|
+
init_watch();
|
|
2547
2637
|
}
|
|
2548
2638
|
});
|
|
2549
2639
|
function getNative() {
|