tailwind-styled-v4 5.0.12 → 5.0.13
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 +42 -0
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +42 -0
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +142 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +142 -0
- 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 +888 -922
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +873 -908
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +1637 -340
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +1636 -339
- package/dist/engine.mjs.map +1 -1
- package/dist/index.js +1636 -339
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1636 -339
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +1060 -970
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +1060 -970
- package/dist/next.mjs.map +1 -1
- package/dist/shared.js +1607 -310
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +1607 -310
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/turbopackLoader.js +1610 -313
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +1610 -313
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +142 -0
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +142 -0
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1622 -325
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1622 -325
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +66 -15
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +66 -15
- 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 +1 -1
package/dist/compiler.js
CHANGED
|
@@ -30,7 +30,9 @@ var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
|
30
30
|
|
|
31
31
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
32
32
|
var __defProp = Object.defineProperty;
|
|
33
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
33
34
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
35
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
34
36
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
35
37
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
36
38
|
}) : x)(function(x) {
|
|
@@ -44,6 +46,15 @@ var __export = (target, all) => {
|
|
|
44
46
|
for (var name in all)
|
|
45
47
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
46
48
|
};
|
|
49
|
+
var __copyProps = (to, from, except, desc) => {
|
|
50
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
+
for (let key of __getOwnPropNames(from))
|
|
52
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
53
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
54
|
+
}
|
|
55
|
+
return to;
|
|
56
|
+
};
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
47
58
|
function platformKey() {
|
|
48
59
|
if (isBrowser) return "browser";
|
|
49
60
|
return `${process.platform}-${process.arch}`;
|
|
@@ -232,271 +243,20 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
232
243
|
}
|
|
233
244
|
});
|
|
234
245
|
|
|
235
|
-
// packages/domain/compiler/src/
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
clearCache: () => clearCache,
|
|
239
|
-
generateRawCss: () => generateRawCss,
|
|
240
|
-
getCacheStats: () => getCacheStats,
|
|
241
|
-
processTailwindCssWithTargets: () => processTailwindCssWithTargets,
|
|
242
|
-
runCssPipeline: () => runCssPipeline,
|
|
243
|
-
runCssPipelineSync: () => runCssPipelineSync
|
|
244
|
-
});
|
|
245
|
-
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
246
|
-
const sorted = [...classes].sort().join(",");
|
|
247
|
-
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
248
|
-
return `${sorted}|${flags}`;
|
|
249
|
-
}
|
|
250
|
-
function _evictOldestIfNeeded() {
|
|
251
|
-
if (_cssCache.size >= MAX_CACHE_SIZE) {
|
|
252
|
-
const firstKey = _cssCache.keys().next().value;
|
|
253
|
-
if (firstKey !== void 0) {
|
|
254
|
-
_cssCache.delete(firstKey);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function getCacheStats() {
|
|
259
|
-
const total = _cacheHits + _cacheMisses;
|
|
260
|
-
return {
|
|
261
|
-
hits: _cacheHits,
|
|
262
|
-
misses: _cacheMisses,
|
|
263
|
-
hitRate: total > 0 ? _cacheHits / total : 0,
|
|
264
|
-
size: _cssCache.size,
|
|
265
|
-
maxSize: MAX_CACHE_SIZE
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
function clearCache() {
|
|
269
|
-
_cssCache.clear();
|
|
270
|
-
_cacheHits = 0;
|
|
271
|
-
_cacheMisses = 0;
|
|
272
|
-
}
|
|
273
|
-
function loadTailwindEngine() {
|
|
274
|
-
if (_twEngine) return _twEngine;
|
|
275
|
-
if (_twEngineError) throw _twEngineError;
|
|
276
|
-
try {
|
|
277
|
-
const tw = require2("tailwindcss");
|
|
278
|
-
if (typeof tw.compile !== "function") {
|
|
279
|
-
throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
|
|
280
|
-
}
|
|
281
|
-
_twEngine = tw;
|
|
282
|
-
return _twEngine;
|
|
283
|
-
} catch (e) {
|
|
284
|
-
_twEngineError = e instanceof Error ? e : new Error(String(e));
|
|
285
|
-
throw _twEngineError;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
async function generateRawCss(classes, cssEntryContent, root) {
|
|
289
|
-
if (classes.length === 0) return "";
|
|
290
|
-
const tw = loadTailwindEngine();
|
|
291
|
-
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
292
|
-
const { readFileSync, existsSync: existsSync2 } = await import('fs');
|
|
293
|
-
const { dirname, resolve: resolve2 } = await import('path');
|
|
294
|
-
const projectRoot = root ?? process.cwd();
|
|
295
|
-
const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
|
|
296
|
-
const loadStylesheet = async (id, base) => {
|
|
297
|
-
try {
|
|
298
|
-
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;
|
|
299
|
-
const pkgPath = req.resolve(cssId);
|
|
300
|
-
return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
|
|
301
|
-
} catch {
|
|
302
|
-
try {
|
|
303
|
-
const absPath = resolve2(base, id);
|
|
304
|
-
if (existsSync2(absPath)) {
|
|
305
|
-
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
306
|
-
}
|
|
307
|
-
} catch {
|
|
308
|
-
}
|
|
309
|
-
return { content: "", base };
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
313
|
-
return compiler.build(classes);
|
|
314
|
-
}
|
|
315
|
-
function getThemeConfig() {
|
|
316
|
-
return {
|
|
317
|
-
colors: {
|
|
318
|
-
slate: {
|
|
319
|
-
"50": "#f8fafc",
|
|
320
|
-
"100": "#f1f5f9",
|
|
321
|
-
"200": "#e2e8f0",
|
|
322
|
-
"300": "#cbd5e1",
|
|
323
|
-
"400": "#94a3b8",
|
|
324
|
-
"500": "#64748b",
|
|
325
|
-
"600": "#475569",
|
|
326
|
-
"700": "#334155",
|
|
327
|
-
"800": "#1e293b",
|
|
328
|
-
"900": "#0f172a"
|
|
329
|
-
},
|
|
330
|
-
gray: {
|
|
331
|
-
"50": "#f9fafb",
|
|
332
|
-
"100": "#f3f4f6",
|
|
333
|
-
"200": "#e5e7eb",
|
|
334
|
-
"300": "#d1d5db",
|
|
335
|
-
"400": "#9ca3af",
|
|
336
|
-
"500": "#6b7280",
|
|
337
|
-
"600": "#4b5563",
|
|
338
|
-
"700": "#374151",
|
|
339
|
-
"800": "#1f2937",
|
|
340
|
-
"900": "#111827"
|
|
341
|
-
},
|
|
342
|
-
white: "#ffffff",
|
|
343
|
-
black: "#000000",
|
|
344
|
-
red: {
|
|
345
|
-
"500": "#ef4444",
|
|
346
|
-
"600": "#dc2626"
|
|
347
|
-
},
|
|
348
|
-
blue: {
|
|
349
|
-
"500": "#3b82f6",
|
|
350
|
-
"600": "#1e40af"
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
spacing: {
|
|
354
|
-
"0": "0px",
|
|
355
|
-
"1": "0.25rem",
|
|
356
|
-
"2": "0.5rem",
|
|
357
|
-
"3": "0.75rem",
|
|
358
|
-
"4": "1rem",
|
|
359
|
-
"5": "1.25rem",
|
|
360
|
-
"6": "1.5rem",
|
|
361
|
-
"8": "2rem",
|
|
362
|
-
"10": "2.5rem",
|
|
363
|
-
"12": "3rem",
|
|
364
|
-
"16": "4rem",
|
|
365
|
-
"20": "5rem",
|
|
366
|
-
"24": "6rem"
|
|
367
|
-
},
|
|
368
|
-
breakpoints: {
|
|
369
|
-
"sm": "640px",
|
|
370
|
-
"md": "768px",
|
|
371
|
-
"lg": "1024px",
|
|
372
|
-
"xl": "1280px",
|
|
373
|
-
"2xl": "1536px"
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
function postProcessWithLightning(rawCss) {
|
|
378
|
-
if (!rawCss) return "";
|
|
246
|
+
// packages/domain/compiler/src/compiler/cssGeneratorNative.ts
|
|
247
|
+
async function generateCssNative(classes, options) {
|
|
248
|
+
const { theme } = options;
|
|
379
249
|
const native = exports.getNativeBridge();
|
|
380
|
-
if (!native?.
|
|
381
|
-
throw new Error(
|
|
382
|
-
|
|
383
|
-
const result = native.processTailwindCssLightning(rawCss);
|
|
384
|
-
if (!result?.css) {
|
|
385
|
-
throw new Error("FATAL: processTailwindCssLightning returned null");
|
|
386
|
-
}
|
|
387
|
-
return result.css;
|
|
388
|
-
}
|
|
389
|
-
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
390
|
-
const filtered = classes.filter(Boolean);
|
|
391
|
-
const uniqueMap = /* @__PURE__ */ new Map();
|
|
392
|
-
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
393
|
-
const unique = Array.from(uniqueMap.values());
|
|
394
|
-
if (unique.length === 0) {
|
|
395
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
396
|
-
}
|
|
397
|
-
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
|
|
398
|
-
const cached = _cssCache.get(cacheKey);
|
|
399
|
-
if (cached) {
|
|
400
|
-
_cacheHits++;
|
|
401
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
402
|
-
console.log(
|
|
403
|
-
`[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
|
|
404
|
-
);
|
|
405
|
-
}
|
|
406
|
-
return cached;
|
|
407
|
-
}
|
|
408
|
-
_cacheMisses++;
|
|
409
|
-
let rawCss;
|
|
410
|
-
let usedRustCompiler = false;
|
|
411
|
-
try {
|
|
412
|
-
const theme = getThemeConfig();
|
|
413
|
-
rawCss = await generateCssNative(unique, {
|
|
414
|
-
theme,
|
|
415
|
-
fallbackToJs: true,
|
|
416
|
-
logFallback: process.env.DEBUG?.includes("compiler") === true
|
|
417
|
-
});
|
|
418
|
-
usedRustCompiler = true;
|
|
419
|
-
} catch (error) {
|
|
420
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
421
|
-
console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
|
|
422
|
-
}
|
|
423
|
-
rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
424
|
-
}
|
|
425
|
-
const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
|
|
426
|
-
if (process.env.DEBUG?.includes("compiler")) {
|
|
427
|
-
console.log(
|
|
428
|
-
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
429
|
-
`Size: ${finalCss.length} bytes`
|
|
250
|
+
if (!native?.generateCssNative) {
|
|
251
|
+
throw new Error(
|
|
252
|
+
"FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
|
|
430
253
|
);
|
|
431
254
|
}
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
sizeBytes: finalCss.length,
|
|
436
|
-
optimized: minify
|
|
437
|
-
};
|
|
438
|
-
_evictOldestIfNeeded();
|
|
439
|
-
_cssCache.set(cacheKey, result);
|
|
440
|
-
return result;
|
|
441
|
-
}
|
|
442
|
-
function runCssPipelineSync(_classes) {
|
|
443
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
444
|
-
}
|
|
445
|
-
function processTailwindCssWithTargets(css, targets) {
|
|
446
|
-
const native = exports.getNativeBridge();
|
|
447
|
-
if (!native?.processTailwindCssWithTargets) {
|
|
448
|
-
throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
|
|
449
|
-
}
|
|
450
|
-
const result = native.processTailwindCssWithTargets(css, targets ?? null);
|
|
451
|
-
if (!result?.css) {
|
|
452
|
-
throw new Error("FATAL: processTailwindCssWithTargets returned null");
|
|
453
|
-
}
|
|
454
|
-
return result.css;
|
|
455
|
-
}
|
|
456
|
-
var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
|
|
457
|
-
var init_tailwindEngine = __esm({
|
|
458
|
-
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
459
|
-
init_nativeBridge();
|
|
460
|
-
init_cssGeneratorNative();
|
|
461
|
-
require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
|
|
462
|
-
_cssCache = /* @__PURE__ */ new Map();
|
|
463
|
-
_cacheHits = 0;
|
|
464
|
-
_cacheMisses = 0;
|
|
465
|
-
MAX_CACHE_SIZE = 100;
|
|
466
|
-
_twEngine = null;
|
|
467
|
-
_twEngineError = null;
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// packages/domain/compiler/src/cssGeneratorNative.ts
|
|
472
|
-
async function generateCssNative(classes, options) {
|
|
473
|
-
const {
|
|
474
|
-
theme,
|
|
475
|
-
fallbackToJs = true,
|
|
476
|
-
logFallback = false
|
|
477
|
-
} = options;
|
|
478
|
-
try {
|
|
479
|
-
const native = exports.getNativeBridge();
|
|
480
|
-
if (!native?.generateCssNative) {
|
|
481
|
-
throw new Error("generateCssNative not available in native binding");
|
|
482
|
-
}
|
|
483
|
-
const themeJson = JSON.stringify(theme);
|
|
484
|
-
const css = native.generateCssNative(classes, themeJson);
|
|
485
|
-
return css;
|
|
486
|
-
} catch (error) {
|
|
487
|
-
if (!fallbackToJs) {
|
|
488
|
-
throw error;
|
|
489
|
-
}
|
|
490
|
-
if (logFallback) {
|
|
491
|
-
console.warn(
|
|
492
|
-
"[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
|
|
493
|
-
error instanceof Error ? error.message : String(error)
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
return generateRawCss(classes);
|
|
497
|
-
}
|
|
255
|
+
const themeJson = JSON.stringify(theme);
|
|
256
|
+
const css = native.generateCssNative(classes, themeJson);
|
|
257
|
+
return css;
|
|
498
258
|
}
|
|
499
|
-
function
|
|
259
|
+
function getCacheStats() {
|
|
500
260
|
try {
|
|
501
261
|
const native = exports.getNativeBridge();
|
|
502
262
|
if (!native?.getCacheStats) {
|
|
@@ -519,169 +279,53 @@ function clearThemeCache() {
|
|
|
519
279
|
}
|
|
520
280
|
}
|
|
521
281
|
var init_cssGeneratorNative = __esm({
|
|
522
|
-
"packages/domain/compiler/src/cssGeneratorNative.ts"() {
|
|
282
|
+
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
523
283
|
init_nativeBridge();
|
|
524
|
-
init_tailwindEngine();
|
|
525
284
|
}
|
|
526
285
|
});
|
|
527
286
|
|
|
528
|
-
// packages/domain/compiler/src/
|
|
529
|
-
function
|
|
287
|
+
// packages/domain/compiler/src/compiler/compilationNative.ts
|
|
288
|
+
function compileCssNative2(classes, prefix) {
|
|
530
289
|
const native = exports.getNativeBridge();
|
|
531
|
-
if (!native?.
|
|
532
|
-
return native.
|
|
290
|
+
if (!native?.compileCss) throw new Error("compileCss not available");
|
|
291
|
+
return native.compileCss(classes, prefix);
|
|
533
292
|
}
|
|
534
|
-
function
|
|
293
|
+
function compileCssLightning(classes) {
|
|
535
294
|
const native = exports.getNativeBridge();
|
|
536
|
-
if (!native?.
|
|
537
|
-
return native.
|
|
295
|
+
if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
|
|
296
|
+
return native.compileCssLightning(classes);
|
|
538
297
|
}
|
|
539
|
-
function
|
|
298
|
+
function extractTwStateConfigsNative(source, filename) {
|
|
540
299
|
const native = exports.getNativeBridge();
|
|
541
|
-
if (!native?.
|
|
542
|
-
return native.
|
|
300
|
+
if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
|
|
301
|
+
return native.extractTwStateConfigs(source, filename);
|
|
543
302
|
}
|
|
544
|
-
function
|
|
303
|
+
function generateStaticStateCssNative(inputs, resolvedCss) {
|
|
545
304
|
const native = exports.getNativeBridge();
|
|
546
|
-
if (!native?.
|
|
547
|
-
return native.
|
|
305
|
+
if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
|
|
306
|
+
return native.generateStaticStateCss(inputs, resolvedCss ?? null);
|
|
548
307
|
}
|
|
549
|
-
function
|
|
308
|
+
function extractAndGenerateStateCssNative(source, filename) {
|
|
550
309
|
const native = exports.getNativeBridge();
|
|
551
|
-
if (!native?.
|
|
552
|
-
return native.
|
|
310
|
+
if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
|
|
311
|
+
return native.extractAndGenerateStateCss(source, filename);
|
|
553
312
|
}
|
|
554
|
-
function
|
|
313
|
+
function layoutClassesToCss(classes) {
|
|
555
314
|
const native = exports.getNativeBridge();
|
|
556
|
-
if (!native?.
|
|
557
|
-
return native.
|
|
315
|
+
if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
|
|
316
|
+
return native.layoutClassesToCss(classes);
|
|
558
317
|
}
|
|
559
|
-
function
|
|
318
|
+
function hashContent(input, algorithm = "sha256", length = 8) {
|
|
560
319
|
const native = exports.getNativeBridge();
|
|
561
|
-
if (!native?.
|
|
562
|
-
return native.
|
|
320
|
+
if (!native?.hashContent) throw new Error("hashContent not available");
|
|
321
|
+
return native.hashContent(input, algorithm, length);
|
|
563
322
|
}
|
|
564
|
-
function
|
|
323
|
+
function extractTwContainerConfigs(source) {
|
|
565
324
|
const native = exports.getNativeBridge();
|
|
566
|
-
if (!native?.
|
|
567
|
-
return native.
|
|
325
|
+
if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
|
|
326
|
+
return native.extractTwContainerConfigs(source);
|
|
568
327
|
}
|
|
569
|
-
|
|
570
|
-
"packages/domain/compiler/src/scannerNative.ts"() {
|
|
571
|
-
init_nativeBridge();
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
// packages/domain/compiler/src/analyzerNative.ts
|
|
576
|
-
function detectDeadCode(scanResultJson, css) {
|
|
577
|
-
const native = exports.getNativeBridge();
|
|
578
|
-
if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
|
|
579
|
-
return native.detectDeadCode(scanResultJson, css);
|
|
580
|
-
}
|
|
581
|
-
function analyzeClassUsageNative(classes, scanResultJson, css) {
|
|
582
|
-
const native = exports.getNativeBridge();
|
|
583
|
-
if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
|
|
584
|
-
return native.analyzeClassUsage(classes, scanResultJson, css);
|
|
585
|
-
}
|
|
586
|
-
function analyzeClassesNative(filesJson, cwd, flags) {
|
|
587
|
-
const native = exports.getNativeBridge();
|
|
588
|
-
if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
|
|
589
|
-
return native.analyzeClasses(filesJson, cwd, flags ?? 0);
|
|
590
|
-
}
|
|
591
|
-
function analyzeRscNative(source, filename) {
|
|
592
|
-
const native = exports.getNativeBridge();
|
|
593
|
-
if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
|
|
594
|
-
return native.analyzeRsc(source, filename);
|
|
595
|
-
}
|
|
596
|
-
function optimizeCssNative(css) {
|
|
597
|
-
const native = exports.getNativeBridge();
|
|
598
|
-
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
599
|
-
const result = native.processTailwindCssLightning(css);
|
|
600
|
-
return {
|
|
601
|
-
css: result.css,
|
|
602
|
-
originalSize: css.length,
|
|
603
|
-
optimizedSize: result.size_bytes,
|
|
604
|
-
reductionPercentage: (css.length - result.size_bytes) / css.length * 100
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
function processTailwindCssLightning(css) {
|
|
608
|
-
const native = exports.getNativeBridge();
|
|
609
|
-
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
610
|
-
return native.processTailwindCssLightning(css);
|
|
611
|
-
}
|
|
612
|
-
function eliminateDeadCssNative(css, deadClasses) {
|
|
613
|
-
const native = exports.getNativeBridge();
|
|
614
|
-
if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
|
|
615
|
-
return native.eliminateDeadCss(css, deadClasses);
|
|
616
|
-
}
|
|
617
|
-
function hoistComponentsNative(source) {
|
|
618
|
-
const native = exports.getNativeBridge();
|
|
619
|
-
if (!native?.hoistComponents) throw new Error("hoistComponents not available");
|
|
620
|
-
return native.hoistComponents(source);
|
|
621
|
-
}
|
|
622
|
-
function compileVariantTableNative(configJson) {
|
|
623
|
-
const native = exports.getNativeBridge();
|
|
624
|
-
if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
|
|
625
|
-
return native.compileVariantTable(configJson);
|
|
626
|
-
}
|
|
627
|
-
function classifyAndSortClassesNative(classes) {
|
|
628
|
-
const native = exports.getNativeBridge();
|
|
629
|
-
if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
|
|
630
|
-
return native.classifyAndSortClasses(classes);
|
|
631
|
-
}
|
|
632
|
-
function mergeCssDeclarationsNative(cssChunks) {
|
|
633
|
-
const native = exports.getNativeBridge();
|
|
634
|
-
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
635
|
-
return native.mergeCssDeclarations(cssChunks);
|
|
636
|
-
}
|
|
637
|
-
var init_analyzerNative = __esm({
|
|
638
|
-
"packages/domain/compiler/src/analyzerNative.ts"() {
|
|
639
|
-
init_nativeBridge();
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
// packages/domain/compiler/src/compilationNative.ts
|
|
644
|
-
function compileCssNative2(classes, prefix) {
|
|
645
|
-
const native = exports.getNativeBridge();
|
|
646
|
-
if (!native?.compileCss) throw new Error("compileCss not available");
|
|
647
|
-
return native.compileCss(classes, prefix);
|
|
648
|
-
}
|
|
649
|
-
function compileCssLightning(classes) {
|
|
650
|
-
const native = exports.getNativeBridge();
|
|
651
|
-
if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
|
|
652
|
-
return native.compileCssLightning(classes);
|
|
653
|
-
}
|
|
654
|
-
function extractTwStateConfigsNative(source, filename) {
|
|
655
|
-
const native = exports.getNativeBridge();
|
|
656
|
-
if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
|
|
657
|
-
return native.extractTwStateConfigs(source, filename);
|
|
658
|
-
}
|
|
659
|
-
function generateStaticStateCssNative(inputs, resolvedCss) {
|
|
660
|
-
const native = exports.getNativeBridge();
|
|
661
|
-
if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
|
|
662
|
-
return native.generateStaticStateCss(inputs, resolvedCss ?? null);
|
|
663
|
-
}
|
|
664
|
-
function extractAndGenerateStateCssNative(source, filename) {
|
|
665
|
-
const native = exports.getNativeBridge();
|
|
666
|
-
if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
|
|
667
|
-
return native.extractAndGenerateStateCss(source, filename);
|
|
668
|
-
}
|
|
669
|
-
function layoutClassesToCss(classes) {
|
|
670
|
-
const native = exports.getNativeBridge();
|
|
671
|
-
if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
|
|
672
|
-
return native.layoutClassesToCss(classes);
|
|
673
|
-
}
|
|
674
|
-
function hashContent(input, algorithm = "sha256", length = 8) {
|
|
675
|
-
const native = exports.getNativeBridge();
|
|
676
|
-
if (!native?.hashContent) throw new Error("hashContent not available");
|
|
677
|
-
return native.hashContent(input, algorithm, length);
|
|
678
|
-
}
|
|
679
|
-
function extractTwContainerConfigs(source) {
|
|
680
|
-
const native = exports.getNativeBridge();
|
|
681
|
-
if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
|
|
682
|
-
return native.extractTwContainerConfigs(source);
|
|
683
|
-
}
|
|
684
|
-
function parseAtomicClass(twClass) {
|
|
328
|
+
function parseAtomicClass(twClass) {
|
|
685
329
|
const native = exports.getNativeBridge();
|
|
686
330
|
if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
|
|
687
331
|
return native.parseAtomicClass(twClass);
|
|
@@ -707,245 +351,244 @@ function atomicRegistrySize() {
|
|
|
707
351
|
return native.atomicRegistrySize();
|
|
708
352
|
}
|
|
709
353
|
var init_compilationNative = __esm({
|
|
710
|
-
"packages/domain/compiler/src/compilationNative.ts"() {
|
|
354
|
+
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
711
355
|
init_nativeBridge();
|
|
712
356
|
}
|
|
713
357
|
});
|
|
714
358
|
|
|
715
|
-
// packages/domain/compiler/src/
|
|
716
|
-
function
|
|
359
|
+
// packages/domain/compiler/src/compiler/cssCompilationNative.ts
|
|
360
|
+
function compileClass(input) {
|
|
717
361
|
const native = exports.getNativeBridge();
|
|
718
|
-
if (!native?.
|
|
719
|
-
const
|
|
362
|
+
if (!native?.compile_class) throw new Error("compile_class not available");
|
|
363
|
+
const resultJson = native.compile_class(input);
|
|
720
364
|
try {
|
|
721
|
-
return JSON.parse(
|
|
365
|
+
return JSON.parse(resultJson);
|
|
722
366
|
} catch {
|
|
723
367
|
return {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
overall_hit_rate: 0,
|
|
729
|
-
total_memory_bytes: 0
|
|
368
|
+
selector: "",
|
|
369
|
+
declarations: "",
|
|
370
|
+
properties: [],
|
|
371
|
+
specificity: 0
|
|
730
372
|
};
|
|
731
373
|
}
|
|
732
374
|
}
|
|
733
|
-
function
|
|
375
|
+
function compileClasses(inputs) {
|
|
734
376
|
const native = exports.getNativeBridge();
|
|
735
|
-
if (!native?.
|
|
377
|
+
if (!native?.compile_classes) throw new Error("compile_classes not available");
|
|
378
|
+
const resultJson = native.compile_classes(inputs);
|
|
736
379
|
try {
|
|
737
|
-
|
|
380
|
+
return JSON.parse(resultJson);
|
|
738
381
|
} catch {
|
|
382
|
+
return {
|
|
383
|
+
css: "",
|
|
384
|
+
resolved_classes: [],
|
|
385
|
+
unknown_classes: [],
|
|
386
|
+
size_bytes: 0,
|
|
387
|
+
duration_ms: 0
|
|
388
|
+
};
|
|
739
389
|
}
|
|
740
390
|
}
|
|
741
|
-
function
|
|
391
|
+
function compileToCss(input, minify) {
|
|
742
392
|
const native = exports.getNativeBridge();
|
|
743
|
-
if (!native?.
|
|
744
|
-
|
|
745
|
-
native.clear_parse_cache();
|
|
746
|
-
} catch {
|
|
747
|
-
}
|
|
393
|
+
if (!native?.compile_to_css) throw new Error("compile_to_css not available");
|
|
394
|
+
return native.compile_to_css(input, minify ?? false);
|
|
748
395
|
}
|
|
749
|
-
function
|
|
396
|
+
function compileToCssBatch(inputs, minify) {
|
|
750
397
|
const native = exports.getNativeBridge();
|
|
751
|
-
if (!native?.
|
|
752
|
-
|
|
753
|
-
native.clear_resolve_cache();
|
|
754
|
-
} catch {
|
|
755
|
-
}
|
|
398
|
+
if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
|
|
399
|
+
return native.compile_to_css_batch(inputs, minify ?? false);
|
|
756
400
|
}
|
|
757
|
-
function
|
|
401
|
+
function minifyCss(css) {
|
|
758
402
|
const native = exports.getNativeBridge();
|
|
759
|
-
if (!native?.
|
|
760
|
-
|
|
761
|
-
native.clear_compile_cache();
|
|
762
|
-
} catch {
|
|
763
|
-
}
|
|
403
|
+
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
404
|
+
return native.minify_css(css);
|
|
764
405
|
}
|
|
765
|
-
function
|
|
406
|
+
function compileAnimation(animationName, from, to) {
|
|
766
407
|
const native = exports.getNativeBridge();
|
|
767
|
-
if (!native?.
|
|
408
|
+
if (!native?.compile_animation) throw new Error("compile_animation not available");
|
|
409
|
+
const resultJson = native.compile_animation(animationName, from, to);
|
|
768
410
|
try {
|
|
769
|
-
|
|
411
|
+
return JSON.parse(resultJson);
|
|
770
412
|
} catch {
|
|
413
|
+
return {
|
|
414
|
+
animation_id: "",
|
|
415
|
+
keyframes_css: "",
|
|
416
|
+
animation_rule: "",
|
|
417
|
+
duration_ms: 0
|
|
418
|
+
};
|
|
771
419
|
}
|
|
772
420
|
}
|
|
773
|
-
function
|
|
421
|
+
function compileKeyframes(name, stopsJson) {
|
|
774
422
|
const native = exports.getNativeBridge();
|
|
775
|
-
if (!native?.
|
|
776
|
-
|
|
777
|
-
const hintsJson = native.get_cache_optimization_hints(
|
|
778
|
-
Math.min(100, Math.max(0, hitRatePercent)),
|
|
779
|
-
Math.max(1, memoryUsedMb)
|
|
780
|
-
);
|
|
423
|
+
if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
|
|
424
|
+
const resultJson = native.compile_keyframes(name, stopsJson);
|
|
781
425
|
try {
|
|
782
|
-
return JSON.parse(
|
|
426
|
+
return JSON.parse(resultJson);
|
|
783
427
|
} catch {
|
|
784
428
|
return {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
notes: ["Unable to analyze cache statistics"]
|
|
429
|
+
animation_id: "",
|
|
430
|
+
keyframes_css: "",
|
|
431
|
+
animation_rule: "",
|
|
432
|
+
duration_ms: 0
|
|
790
433
|
};
|
|
791
434
|
}
|
|
792
435
|
}
|
|
793
|
-
function
|
|
436
|
+
function compileTheme(tokensJson, themeName, prefix) {
|
|
794
437
|
const native = exports.getNativeBridge();
|
|
795
|
-
if (!native?.
|
|
796
|
-
|
|
797
|
-
const configJson = native.estimate_optimal_cache_config_native(
|
|
798
|
-
Math.max(64, totalBudgetMb),
|
|
799
|
-
workloadType
|
|
800
|
-
);
|
|
438
|
+
if (!native?.compile_theme) throw new Error("compile_theme not available");
|
|
439
|
+
const resultJson = native.compile_theme(tokensJson, themeName, prefix);
|
|
801
440
|
try {
|
|
802
|
-
return JSON.parse(
|
|
441
|
+
return JSON.parse(resultJson);
|
|
803
442
|
} catch {
|
|
804
443
|
return {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
recommended_eviction_policy: "lru",
|
|
810
|
-
ttl_seconds: 3600,
|
|
811
|
-
expected_hit_rate_percent: 75
|
|
444
|
+
selector: ":root",
|
|
445
|
+
variables: [],
|
|
446
|
+
variables_css: "",
|
|
447
|
+
theme_name: themeName
|
|
812
448
|
};
|
|
813
449
|
}
|
|
814
450
|
}
|
|
815
|
-
function
|
|
451
|
+
function twMerge(classString) {
|
|
816
452
|
const native = exports.getNativeBridge();
|
|
817
|
-
if (!native?.
|
|
818
|
-
|
|
819
|
-
try {
|
|
820
|
-
return JSON.parse(result.entries_json || "[]");
|
|
821
|
-
} catch {
|
|
822
|
-
return [];
|
|
823
|
-
}
|
|
453
|
+
if (!native?.tw_merge) throw new Error("tw_merge not available");
|
|
454
|
+
return native.tw_merge(classString);
|
|
824
455
|
}
|
|
825
|
-
function
|
|
456
|
+
function twMergeMany(classStrings) {
|
|
826
457
|
const native = exports.getNativeBridge();
|
|
827
|
-
if (!native?.
|
|
828
|
-
|
|
829
|
-
const result = native.cache_write(
|
|
830
|
-
cachePath,
|
|
831
|
-
entries.map((e) => ({
|
|
832
|
-
file: e.file,
|
|
833
|
-
content_hash: e.contentHash,
|
|
834
|
-
classes: e.classes,
|
|
835
|
-
mtime_ms: e.mtimeMs,
|
|
836
|
-
size_bytes: e.sizeBytes
|
|
837
|
-
}))
|
|
838
|
-
);
|
|
839
|
-
return typeof result === "boolean" ? result : result === true;
|
|
840
|
-
} catch {
|
|
841
|
-
return false;
|
|
842
|
-
}
|
|
458
|
+
if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
|
|
459
|
+
return native.tw_merge_many(classStrings);
|
|
843
460
|
}
|
|
844
|
-
function
|
|
461
|
+
function twMergeWithSeparator(classString, options) {
|
|
845
462
|
const native = exports.getNativeBridge();
|
|
846
|
-
if (!native?.
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
463
|
+
if (!native?.tw_merge_with_separator)
|
|
464
|
+
throw new Error("tw_merge_with_separator not available");
|
|
465
|
+
const opts = {
|
|
466
|
+
separator: options.separator,
|
|
467
|
+
debug: options.debug
|
|
468
|
+
};
|
|
469
|
+
return native.tw_merge_with_separator(classString, opts);
|
|
470
|
+
}
|
|
471
|
+
function twMergeManyWithSeparator(classStrings, options) {
|
|
472
|
+
const native = exports.getNativeBridge();
|
|
473
|
+
if (!native?.tw_merge_many_with_separator)
|
|
474
|
+
throw new Error("tw_merge_many_with_separator not available");
|
|
475
|
+
const opts = {
|
|
476
|
+
separator: options.separator,
|
|
477
|
+
debug: options.debug
|
|
478
|
+
};
|
|
479
|
+
return native.tw_merge_many_with_separator(classStrings, opts);
|
|
480
|
+
}
|
|
481
|
+
function twMergeRaw(classLists) {
|
|
482
|
+
const native = exports.getNativeBridge();
|
|
483
|
+
if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
|
|
484
|
+
return native.tw_merge_raw(classLists);
|
|
485
|
+
}
|
|
486
|
+
var init_cssCompilationNative = __esm({
|
|
487
|
+
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
851
488
|
init_nativeBridge();
|
|
852
489
|
}
|
|
853
490
|
});
|
|
854
491
|
|
|
855
|
-
// packages/domain/compiler/src/
|
|
856
|
-
function
|
|
492
|
+
// packages/domain/compiler/src/compiler/idRegistryNative.ts
|
|
493
|
+
function idRegistryCreate() {
|
|
857
494
|
const native = exports.getNativeBridge();
|
|
858
|
-
if (!native?.
|
|
859
|
-
|
|
860
|
-
try {
|
|
861
|
-
return JSON.parse(resultJson);
|
|
862
|
-
} catch {
|
|
863
|
-
return {
|
|
864
|
-
variants: [],
|
|
865
|
-
supported: [],
|
|
866
|
-
deprecated: [],
|
|
867
|
-
conflicting: []
|
|
868
|
-
};
|
|
869
|
-
}
|
|
495
|
+
if (!native?.id_registry_create) throw new Error("id_registry_create not available");
|
|
496
|
+
return native.id_registry_create();
|
|
870
497
|
}
|
|
871
|
-
function
|
|
498
|
+
function idRegistryGenerate(handle, name) {
|
|
872
499
|
const native = exports.getNativeBridge();
|
|
873
|
-
if (!native?.
|
|
874
|
-
|
|
875
|
-
try {
|
|
876
|
-
return JSON.parse(resultJson);
|
|
877
|
-
} catch {
|
|
878
|
-
return {
|
|
879
|
-
is_valid: false,
|
|
880
|
-
errors: ["Unable to parse configuration"],
|
|
881
|
-
warnings: [],
|
|
882
|
-
suggestions: []
|
|
883
|
-
};
|
|
884
|
-
}
|
|
500
|
+
if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
|
|
501
|
+
return native.id_registry_generate(handle, name);
|
|
885
502
|
}
|
|
886
|
-
function
|
|
503
|
+
function idRegistryLookup(handle, name) {
|
|
887
504
|
const native = exports.getNativeBridge();
|
|
888
|
-
if (!native?.
|
|
889
|
-
|
|
890
|
-
try {
|
|
891
|
-
return JSON.parse(resultJson);
|
|
892
|
-
} catch {
|
|
893
|
-
return {
|
|
894
|
-
base_theme: {},
|
|
895
|
-
user_overrides: {},
|
|
896
|
-
merged_theme: {},
|
|
897
|
-
conflict_resolutions: []
|
|
898
|
-
};
|
|
899
|
-
}
|
|
505
|
+
if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
|
|
506
|
+
return native.id_registry_lookup(handle, name);
|
|
900
507
|
}
|
|
901
|
-
function
|
|
508
|
+
function idRegistryNext(handle) {
|
|
902
509
|
const native = exports.getNativeBridge();
|
|
903
|
-
if (!native?.
|
|
904
|
-
|
|
905
|
-
try {
|
|
906
|
-
return JSON.parse(resultJson);
|
|
907
|
-
} catch {
|
|
908
|
-
return [];
|
|
909
|
-
}
|
|
510
|
+
if (!native?.id_registry_next) throw new Error("id_registry_next not available");
|
|
511
|
+
return native.id_registry_next(handle);
|
|
910
512
|
}
|
|
911
|
-
function
|
|
513
|
+
function idRegistryDestroy(handle) {
|
|
912
514
|
const native = exports.getNativeBridge();
|
|
913
|
-
if (!native?.
|
|
914
|
-
|
|
915
|
-
|
|
515
|
+
if (!native?.id_registry_destroy) return;
|
|
516
|
+
native.id_registry_destroy(handle);
|
|
517
|
+
}
|
|
518
|
+
function idRegistryReset(handle) {
|
|
519
|
+
const native = exports.getNativeBridge();
|
|
520
|
+
if (!native?.id_registry_reset) return;
|
|
521
|
+
native.id_registry_reset(handle);
|
|
522
|
+
}
|
|
523
|
+
function idRegistrySnapshot(handle) {
|
|
524
|
+
const native = exports.getNativeBridge();
|
|
525
|
+
if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
|
|
526
|
+
const snapshotJson = native.id_registry_snapshot(handle);
|
|
916
527
|
try {
|
|
917
|
-
return JSON.parse(
|
|
528
|
+
return JSON.parse(snapshotJson);
|
|
918
529
|
} catch {
|
|
919
530
|
return {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
531
|
+
handle,
|
|
532
|
+
next_id: 0,
|
|
533
|
+
entries: [],
|
|
534
|
+
total_entries: 0
|
|
924
535
|
};
|
|
925
536
|
}
|
|
926
537
|
}
|
|
927
|
-
function
|
|
538
|
+
function idRegistryActiveCount() {
|
|
928
539
|
const native = exports.getNativeBridge();
|
|
929
|
-
if (!native?.
|
|
930
|
-
return native.
|
|
540
|
+
if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
|
|
541
|
+
return native.id_registry_active_count();
|
|
931
542
|
}
|
|
932
|
-
function
|
|
543
|
+
function registerPropertyName(propertyName) {
|
|
933
544
|
const native = exports.getNativeBridge();
|
|
934
|
-
if (!native?.
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
return JSON.parse(resultJson);
|
|
938
|
-
} catch {
|
|
939
|
-
return [];
|
|
940
|
-
}
|
|
545
|
+
if (!native?.register_property_name)
|
|
546
|
+
throw new Error("register_property_name not available");
|
|
547
|
+
return native.register_property_name(propertyName);
|
|
941
548
|
}
|
|
942
|
-
|
|
943
|
-
|
|
549
|
+
function registerValueName(valueName) {
|
|
550
|
+
const native = exports.getNativeBridge();
|
|
551
|
+
if (!native?.register_value_name) throw new Error("register_value_name not available");
|
|
552
|
+
return native.register_value_name(valueName);
|
|
553
|
+
}
|
|
554
|
+
function propertyIdToString(propertyId) {
|
|
555
|
+
const native = exports.getNativeBridge();
|
|
556
|
+
if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
|
|
557
|
+
return native.property_id_to_string(propertyId);
|
|
558
|
+
}
|
|
559
|
+
function valueIdToString(valueId) {
|
|
560
|
+
const native = exports.getNativeBridge();
|
|
561
|
+
if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
|
|
562
|
+
return native.value_id_to_string(valueId);
|
|
563
|
+
}
|
|
564
|
+
function reverseLookupProperty(propertyId) {
|
|
565
|
+
const native = exports.getNativeBridge();
|
|
566
|
+
if (!native?.reverse_lookup_property)
|
|
567
|
+
throw new Error("reverse_lookup_property not available");
|
|
568
|
+
return native.reverse_lookup_property(propertyId);
|
|
569
|
+
}
|
|
570
|
+
function reverseLookupValue(valueId) {
|
|
571
|
+
const native = exports.getNativeBridge();
|
|
572
|
+
if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
|
|
573
|
+
return native.reverse_lookup_value(valueId);
|
|
574
|
+
}
|
|
575
|
+
function idRegistryExport(handle) {
|
|
576
|
+
const native = exports.getNativeBridge();
|
|
577
|
+
if (!native?.id_registry_export) throw new Error("id_registry_export not available");
|
|
578
|
+
return native.id_registry_export(handle);
|
|
579
|
+
}
|
|
580
|
+
function idRegistryImport(importedData) {
|
|
581
|
+
const native = exports.getNativeBridge();
|
|
582
|
+
if (!native?.id_registry_import) throw new Error("id_registry_import not available");
|
|
583
|
+
return native.id_registry_import(importedData);
|
|
584
|
+
}
|
|
585
|
+
var init_idRegistryNative = __esm({
|
|
586
|
+
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
944
587
|
init_nativeBridge();
|
|
945
588
|
}
|
|
946
589
|
});
|
|
947
590
|
|
|
948
|
-
// packages/domain/compiler/src/streamingNative.ts
|
|
591
|
+
// packages/domain/compiler/src/compiler/streamingNative.ts
|
|
949
592
|
function processFileChange(fileChangeJson) {
|
|
950
593
|
const native = exports.getNativeBridge();
|
|
951
594
|
if (!native?.process_file_change) throw new Error("process_file_change not available");
|
|
@@ -1081,244 +724,663 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1081
724
|
}
|
|
1082
725
|
}
|
|
1083
726
|
var init_streamingNative = __esm({
|
|
1084
|
-
"packages/domain/compiler/src/streamingNative.ts"() {
|
|
727
|
+
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1085
728
|
init_nativeBridge();
|
|
1086
729
|
}
|
|
1087
730
|
});
|
|
1088
731
|
|
|
1089
|
-
// packages/domain/compiler/src/
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
732
|
+
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
733
|
+
var tailwindEngine_exports = {};
|
|
734
|
+
__export(tailwindEngine_exports, {
|
|
735
|
+
clearCache: () => clearCache,
|
|
736
|
+
getCacheStats: () => getCacheStats2,
|
|
737
|
+
processTailwindCssWithTargets: () => processTailwindCssWithTargets,
|
|
738
|
+
runCssPipeline: () => runCssPipeline,
|
|
739
|
+
runCssPipelineSync: () => runCssPipelineSync
|
|
740
|
+
});
|
|
741
|
+
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
742
|
+
const sorted = [...classes].sort().join(",");
|
|
743
|
+
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
744
|
+
return `${sorted}|${flags}`;
|
|
1104
745
|
}
|
|
1105
|
-
function
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
} catch {
|
|
1112
|
-
return {
|
|
1113
|
-
css: "",
|
|
1114
|
-
resolved_classes: [],
|
|
1115
|
-
unknown_classes: [],
|
|
1116
|
-
size_bytes: 0,
|
|
1117
|
-
duration_ms: 0
|
|
1118
|
-
};
|
|
746
|
+
function _evictOldestIfNeeded() {
|
|
747
|
+
if (_cssCache.size >= MAX_CACHE_SIZE) {
|
|
748
|
+
const firstKey = _cssCache.keys().next().value;
|
|
749
|
+
if (firstKey !== void 0) {
|
|
750
|
+
_cssCache.delete(firstKey);
|
|
751
|
+
}
|
|
1119
752
|
}
|
|
1120
753
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
function minifyCss(css) {
|
|
1132
|
-
const native = exports.getNativeBridge();
|
|
1133
|
-
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
1134
|
-
return native.minify_css(css);
|
|
754
|
+
function getCacheStats2() {
|
|
755
|
+
const total = _cacheHits + _cacheMisses;
|
|
756
|
+
return {
|
|
757
|
+
hits: _cacheHits,
|
|
758
|
+
misses: _cacheMisses,
|
|
759
|
+
hitRate: total > 0 ? _cacheHits / total : 0,
|
|
760
|
+
size: _cssCache.size,
|
|
761
|
+
maxSize: MAX_CACHE_SIZE
|
|
762
|
+
};
|
|
1135
763
|
}
|
|
1136
|
-
function
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
try {
|
|
1141
|
-
return JSON.parse(resultJson);
|
|
1142
|
-
} catch {
|
|
1143
|
-
return {
|
|
1144
|
-
animation_id: "",
|
|
1145
|
-
keyframes_css: "",
|
|
1146
|
-
animation_rule: "",
|
|
1147
|
-
duration_ms: 0
|
|
1148
|
-
};
|
|
1149
|
-
}
|
|
764
|
+
function clearCache() {
|
|
765
|
+
_cssCache.clear();
|
|
766
|
+
_cacheHits = 0;
|
|
767
|
+
_cacheMisses = 0;
|
|
1150
768
|
}
|
|
1151
|
-
function
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
769
|
+
function getThemeConfig() {
|
|
770
|
+
return {
|
|
771
|
+
colors: {
|
|
772
|
+
slate: {
|
|
773
|
+
"50": "#f8fafc",
|
|
774
|
+
"100": "#f1f5f9",
|
|
775
|
+
"200": "#e2e8f0",
|
|
776
|
+
"300": "#cbd5e1",
|
|
777
|
+
"400": "#94a3b8",
|
|
778
|
+
"500": "#64748b",
|
|
779
|
+
"600": "#475569",
|
|
780
|
+
"700": "#334155",
|
|
781
|
+
"800": "#1e293b",
|
|
782
|
+
"900": "#0f172a"
|
|
783
|
+
},
|
|
784
|
+
gray: {
|
|
785
|
+
"50": "#f9fafb",
|
|
786
|
+
"100": "#f3f4f6",
|
|
787
|
+
"200": "#e5e7eb",
|
|
788
|
+
"300": "#d1d5db",
|
|
789
|
+
"400": "#9ca3af",
|
|
790
|
+
"500": "#6b7280",
|
|
791
|
+
"600": "#4b5563",
|
|
792
|
+
"700": "#374151",
|
|
793
|
+
"800": "#1f2937",
|
|
794
|
+
"900": "#111827"
|
|
795
|
+
},
|
|
796
|
+
white: "#ffffff",
|
|
797
|
+
black: "#000000",
|
|
798
|
+
red: {
|
|
799
|
+
"500": "#ef4444",
|
|
800
|
+
"600": "#dc2626"
|
|
801
|
+
},
|
|
802
|
+
blue: {
|
|
803
|
+
"500": "#3b82f6",
|
|
804
|
+
"600": "#1e40af"
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
spacing: {
|
|
808
|
+
"0": "0px",
|
|
809
|
+
"1": "0.25rem",
|
|
810
|
+
"2": "0.5rem",
|
|
811
|
+
"3": "0.75rem",
|
|
812
|
+
"4": "1rem",
|
|
813
|
+
"5": "1.25rem",
|
|
814
|
+
"6": "1.5rem",
|
|
815
|
+
"8": "2rem",
|
|
816
|
+
"10": "2.5rem",
|
|
817
|
+
"12": "3rem",
|
|
818
|
+
"16": "4rem",
|
|
819
|
+
"20": "5rem",
|
|
820
|
+
"24": "6rem"
|
|
821
|
+
},
|
|
822
|
+
breakpoints: {
|
|
823
|
+
"sm": "640px",
|
|
824
|
+
"md": "768px",
|
|
825
|
+
"lg": "1024px",
|
|
826
|
+
"xl": "1280px",
|
|
827
|
+
"2xl": "1536px"
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
function postProcessWithLightning(rawCss) {
|
|
832
|
+
if (!rawCss) return "";
|
|
833
|
+
const native = exports.getNativeBridge();
|
|
834
|
+
if (!native?.processTailwindCssLightning) {
|
|
835
|
+
throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
|
|
836
|
+
}
|
|
837
|
+
const result = native.processTailwindCssLightning(rawCss);
|
|
838
|
+
if (!result?.css) {
|
|
839
|
+
throw new Error("FATAL: processTailwindCssLightning returned null");
|
|
840
|
+
}
|
|
841
|
+
return result.css;
|
|
842
|
+
}
|
|
843
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
844
|
+
const filtered = classes.filter(Boolean);
|
|
845
|
+
const uniqueMap = /* @__PURE__ */ new Map();
|
|
846
|
+
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
847
|
+
const unique = Array.from(uniqueMap.values());
|
|
848
|
+
if (unique.length === 0) {
|
|
849
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
850
|
+
}
|
|
851
|
+
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
|
|
852
|
+
const cached = _cssCache.get(cacheKey);
|
|
853
|
+
if (cached) {
|
|
854
|
+
_cacheHits++;
|
|
855
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
856
|
+
console.log(
|
|
857
|
+
`[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats2().hitRate * 100).toFixed(1)}%)`
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
return cached;
|
|
861
|
+
}
|
|
862
|
+
_cacheMisses++;
|
|
863
|
+
let rawCss;
|
|
864
|
+
let usedRustCompiler = false;
|
|
865
|
+
const theme = getThemeConfig();
|
|
866
|
+
rawCss = await generateCssNative(unique, { theme });
|
|
867
|
+
usedRustCompiler = true;
|
|
868
|
+
const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
|
|
869
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
870
|
+
console.log(
|
|
871
|
+
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
872
|
+
`Size: ${finalCss.length} bytes`
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
const result = {
|
|
876
|
+
css: finalCss,
|
|
877
|
+
classes: unique,
|
|
878
|
+
sizeBytes: finalCss.length,
|
|
879
|
+
optimized: minify
|
|
880
|
+
};
|
|
881
|
+
_evictOldestIfNeeded();
|
|
882
|
+
_cssCache.set(cacheKey, result);
|
|
883
|
+
return result;
|
|
884
|
+
}
|
|
885
|
+
function runCssPipelineSync(_classes) {
|
|
886
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
887
|
+
}
|
|
888
|
+
function processTailwindCssWithTargets(css, targets) {
|
|
889
|
+
const native = exports.getNativeBridge();
|
|
890
|
+
if (!native?.processTailwindCssWithTargets) {
|
|
891
|
+
throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
|
|
892
|
+
}
|
|
893
|
+
const result = native.processTailwindCssWithTargets(css, targets ?? null);
|
|
894
|
+
if (!result?.css) {
|
|
895
|
+
throw new Error("FATAL: processTailwindCssWithTargets returned null");
|
|
896
|
+
}
|
|
897
|
+
return result.css;
|
|
898
|
+
}
|
|
899
|
+
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
900
|
+
var init_tailwindEngine = __esm({
|
|
901
|
+
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
902
|
+
init_nativeBridge();
|
|
903
|
+
init_cssGeneratorNative();
|
|
904
|
+
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('compiler.js', document.baseURI).href)));
|
|
905
|
+
_cssCache = /* @__PURE__ */ new Map();
|
|
906
|
+
_cacheHits = 0;
|
|
907
|
+
_cacheMisses = 0;
|
|
908
|
+
MAX_CACHE_SIZE = 100;
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
// packages/domain/compiler/src/compiler/index.ts
|
|
913
|
+
var init_compiler = __esm({
|
|
914
|
+
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
915
|
+
init_cssGeneratorNative();
|
|
916
|
+
init_compilationNative();
|
|
917
|
+
init_cssCompilationNative();
|
|
918
|
+
init_idRegistryNative();
|
|
919
|
+
init_streamingNative();
|
|
920
|
+
init_tailwindEngine();
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
// packages/domain/compiler/src/parser/index.ts
|
|
925
|
+
var parser_exports = {};
|
|
926
|
+
__export(parser_exports, {
|
|
927
|
+
astExtractClasses: () => exports.astExtractClasses,
|
|
928
|
+
batchExtractClasses: () => exports.batchExtractClasses,
|
|
929
|
+
checkAgainstSafelist: () => exports.checkAgainstSafelist,
|
|
930
|
+
diffClassLists: () => exports.diffClassLists,
|
|
931
|
+
extractAllClasses: () => exports.extractAllClasses,
|
|
932
|
+
extractClassesFromSource: () => exports.extractClassesFromSource,
|
|
933
|
+
extractComponentUsage: () => exports.extractComponentUsage,
|
|
934
|
+
mergeClassesStatic: () => exports.mergeClassesStatic,
|
|
935
|
+
normalizeAndDedupClasses: () => exports.normalizeAndDedupClasses,
|
|
936
|
+
normalizeClasses: () => exports.normalizeClasses,
|
|
937
|
+
parseClasses: () => exports.parseClasses
|
|
938
|
+
});
|
|
939
|
+
exports.parseClasses = void 0; exports.extractAllClasses = void 0; exports.extractClassesFromSource = void 0; exports.astExtractClasses = void 0; exports.normalizeClasses = void 0; exports.mergeClassesStatic = void 0; exports.normalizeAndDedupClasses = void 0; exports.extractComponentUsage = void 0; exports.batchExtractClasses = void 0; exports.checkAgainstSafelist = void 0; exports.diffClassLists = void 0;
|
|
940
|
+
var init_parser = __esm({
|
|
941
|
+
"packages/domain/compiler/src/parser/index.ts"() {
|
|
942
|
+
init_nativeBridge();
|
|
943
|
+
exports.parseClasses = (raw) => {
|
|
944
|
+
const native = exports.getNativeBridge();
|
|
945
|
+
if (!native?.parseClasses) {
|
|
946
|
+
throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
|
|
947
|
+
}
|
|
948
|
+
return native.parseClasses(raw) || [];
|
|
949
|
+
};
|
|
950
|
+
exports.extractAllClasses = (source) => {
|
|
951
|
+
const native = exports.getNativeBridge();
|
|
952
|
+
if (!native?.extractAllClasses) {
|
|
953
|
+
throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
|
|
954
|
+
}
|
|
955
|
+
return native.extractAllClasses(source) || [];
|
|
956
|
+
};
|
|
957
|
+
exports.extractClassesFromSource = (source) => {
|
|
958
|
+
const native = exports.getNativeBridge();
|
|
959
|
+
if (!native?.extractClassesFromSource) {
|
|
960
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
961
|
+
}
|
|
962
|
+
const result = native.extractClassesFromSource(source);
|
|
963
|
+
return Array.isArray(result) ? result.join(" ") : String(result || "");
|
|
964
|
+
};
|
|
965
|
+
exports.astExtractClasses = (source, _filename) => {
|
|
966
|
+
const native = exports.getNativeBridge();
|
|
967
|
+
if (!native?.extractClassesFromSource) {
|
|
968
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
969
|
+
}
|
|
970
|
+
return native.extractClassesFromSource(source) || [];
|
|
971
|
+
};
|
|
972
|
+
exports.normalizeClasses = (raw) => {
|
|
973
|
+
const result = exports.normalizeAndDedupClasses(raw);
|
|
974
|
+
return result?.normalized || "";
|
|
975
|
+
};
|
|
976
|
+
exports.mergeClassesStatic = (classes) => {
|
|
977
|
+
const result = exports.normalizeAndDedupClasses(classes);
|
|
978
|
+
return result?.normalized || "";
|
|
979
|
+
};
|
|
980
|
+
exports.normalizeAndDedupClasses = (raw) => {
|
|
981
|
+
const native = exports.getNativeBridge();
|
|
982
|
+
if (!native?.normalizeAndDedupClasses) {
|
|
983
|
+
throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
|
|
984
|
+
}
|
|
985
|
+
const result = native.normalizeAndDedupClasses(raw);
|
|
986
|
+
return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
|
|
987
|
+
};
|
|
988
|
+
exports.extractComponentUsage = (source) => {
|
|
989
|
+
const native = exports.getNativeBridge();
|
|
990
|
+
if (!native?.extractComponentUsage) {
|
|
991
|
+
throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
|
|
992
|
+
}
|
|
993
|
+
return native.extractComponentUsage(source) || [];
|
|
994
|
+
};
|
|
995
|
+
exports.batchExtractClasses = (filePaths) => {
|
|
996
|
+
const native = exports.getNativeBridge();
|
|
997
|
+
if (!native?.batchExtractClasses) {
|
|
998
|
+
throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
|
|
999
|
+
}
|
|
1000
|
+
return native.batchExtractClasses(filePaths) || [];
|
|
1001
|
+
};
|
|
1002
|
+
exports.checkAgainstSafelist = (classes, safelist) => {
|
|
1003
|
+
const native = exports.getNativeBridge();
|
|
1004
|
+
if (!native?.checkAgainstSafelist) {
|
|
1005
|
+
throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
|
|
1006
|
+
}
|
|
1007
|
+
return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
|
|
1008
|
+
};
|
|
1009
|
+
exports.diffClassLists = (previous, current) => {
|
|
1010
|
+
const native = exports.getNativeBridge();
|
|
1011
|
+
if (!native?.diffClassLists) {
|
|
1012
|
+
throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
|
|
1013
|
+
}
|
|
1014
|
+
return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
// packages/domain/compiler/src/analyzer/analyzerNative.ts
|
|
1020
|
+
function detectDeadCode(scanResultJson, css) {
|
|
1021
|
+
const native = exports.getNativeBridge();
|
|
1022
|
+
if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
|
|
1023
|
+
return native.detectDeadCode(scanResultJson, css);
|
|
1024
|
+
}
|
|
1025
|
+
function analyzeClassUsageNative(classes, scanResultJson, css) {
|
|
1026
|
+
const native = exports.getNativeBridge();
|
|
1027
|
+
if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
|
|
1028
|
+
return native.analyzeClassUsage(classes, scanResultJson, css);
|
|
1029
|
+
}
|
|
1030
|
+
function analyzeClassesNative(filesJson, cwd, flags) {
|
|
1031
|
+
const native = exports.getNativeBridge();
|
|
1032
|
+
if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
|
|
1033
|
+
return native.analyzeClasses(filesJson, cwd, flags ?? 0);
|
|
1034
|
+
}
|
|
1035
|
+
function analyzeRscNative(source, filename) {
|
|
1036
|
+
const native = exports.getNativeBridge();
|
|
1037
|
+
if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
|
|
1038
|
+
return native.analyzeRsc(source, filename);
|
|
1039
|
+
}
|
|
1040
|
+
function optimizeCssNative(css) {
|
|
1041
|
+
const native = exports.getNativeBridge();
|
|
1042
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1043
|
+
const result = native.processTailwindCssLightning(css);
|
|
1044
|
+
return {
|
|
1045
|
+
css: result.css,
|
|
1046
|
+
originalSize: css.length,
|
|
1047
|
+
optimizedSize: result.size_bytes,
|
|
1048
|
+
reductionPercentage: (css.length - result.size_bytes) / css.length * 100
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
function processTailwindCssLightning(css) {
|
|
1052
|
+
const native = exports.getNativeBridge();
|
|
1053
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1054
|
+
return native.processTailwindCssLightning(css);
|
|
1055
|
+
}
|
|
1056
|
+
function eliminateDeadCssNative(css, deadClasses) {
|
|
1057
|
+
const native = exports.getNativeBridge();
|
|
1058
|
+
if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
|
|
1059
|
+
return native.eliminateDeadCss(css, deadClasses);
|
|
1060
|
+
}
|
|
1061
|
+
function hoistComponentsNative(source) {
|
|
1062
|
+
const native = exports.getNativeBridge();
|
|
1063
|
+
if (!native?.hoistComponents) throw new Error("hoistComponents not available");
|
|
1064
|
+
return native.hoistComponents(source);
|
|
1065
|
+
}
|
|
1066
|
+
function compileVariantTableNative(configJson) {
|
|
1067
|
+
const native = exports.getNativeBridge();
|
|
1068
|
+
if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
|
|
1069
|
+
return native.compileVariantTable(configJson);
|
|
1070
|
+
}
|
|
1071
|
+
function classifyAndSortClassesNative(classes) {
|
|
1072
|
+
const native = exports.getNativeBridge();
|
|
1073
|
+
if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
|
|
1074
|
+
return native.classifyAndSortClasses(classes);
|
|
1075
|
+
}
|
|
1076
|
+
function mergeCssDeclarationsNative(cssChunks) {
|
|
1077
|
+
const native = exports.getNativeBridge();
|
|
1078
|
+
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
1079
|
+
return native.mergeCssDeclarations(cssChunks);
|
|
1080
|
+
}
|
|
1081
|
+
var init_analyzerNative = __esm({
|
|
1082
|
+
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1083
|
+
init_nativeBridge();
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
// packages/domain/compiler/src/analyzer/themeResolutionNative.ts
|
|
1088
|
+
function resolveVariants(configJson) {
|
|
1089
|
+
const native = exports.getNativeBridge();
|
|
1090
|
+
if (!native?.resolve_variants) throw new Error("resolve_variants not available");
|
|
1091
|
+
const resultJson = native.resolve_variants(configJson);
|
|
1155
1092
|
try {
|
|
1156
1093
|
return JSON.parse(resultJson);
|
|
1157
1094
|
} catch {
|
|
1158
1095
|
return {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1096
|
+
variants: [],
|
|
1097
|
+
supported: [],
|
|
1098
|
+
deprecated: [],
|
|
1099
|
+
conflicting: []
|
|
1163
1100
|
};
|
|
1164
1101
|
}
|
|
1165
1102
|
}
|
|
1166
|
-
function
|
|
1103
|
+
function validateThemeConfig(configJson) {
|
|
1167
1104
|
const native = exports.getNativeBridge();
|
|
1168
|
-
if (!native?.
|
|
1169
|
-
const resultJson = native.
|
|
1105
|
+
if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
|
|
1106
|
+
const resultJson = native.validate_variant_config(configJson);
|
|
1170
1107
|
try {
|
|
1171
1108
|
return JSON.parse(resultJson);
|
|
1172
1109
|
} catch {
|
|
1173
1110
|
return {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1111
|
+
is_valid: false,
|
|
1112
|
+
errors: ["Unable to parse configuration"],
|
|
1113
|
+
warnings: [],
|
|
1114
|
+
suggestions: []
|
|
1178
1115
|
};
|
|
1179
1116
|
}
|
|
1180
1117
|
}
|
|
1181
|
-
function
|
|
1118
|
+
function resolveCascade(baseThemeJson, overridesJson) {
|
|
1182
1119
|
const native = exports.getNativeBridge();
|
|
1183
|
-
if (!native?.
|
|
1184
|
-
|
|
1120
|
+
if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
|
|
1121
|
+
const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
|
|
1122
|
+
try {
|
|
1123
|
+
return JSON.parse(resultJson);
|
|
1124
|
+
} catch {
|
|
1125
|
+
return {
|
|
1126
|
+
base_theme: {},
|
|
1127
|
+
user_overrides: {},
|
|
1128
|
+
merged_theme: {},
|
|
1129
|
+
conflict_resolutions: []
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1185
1132
|
}
|
|
1186
|
-
function
|
|
1133
|
+
function resolveClassNames(classNames, themeJson) {
|
|
1187
1134
|
const native = exports.getNativeBridge();
|
|
1188
|
-
if (!native?.
|
|
1189
|
-
|
|
1135
|
+
if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
|
|
1136
|
+
const resultJson = native.resolve_class_names(classNames, themeJson);
|
|
1137
|
+
try {
|
|
1138
|
+
return JSON.parse(resultJson);
|
|
1139
|
+
} catch {
|
|
1140
|
+
return [];
|
|
1141
|
+
}
|
|
1190
1142
|
}
|
|
1191
|
-
function
|
|
1143
|
+
function resolveConflictGroup(groupName, themeJson) {
|
|
1192
1144
|
const native = exports.getNativeBridge();
|
|
1193
|
-
if (!native?.
|
|
1194
|
-
throw new Error("
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1145
|
+
if (!native?.resolve_conflict_group)
|
|
1146
|
+
throw new Error("resolve_conflict_group not available");
|
|
1147
|
+
const resultJson = native.resolve_conflict_group(groupName, themeJson);
|
|
1148
|
+
try {
|
|
1149
|
+
return JSON.parse(resultJson);
|
|
1150
|
+
} catch {
|
|
1151
|
+
return {
|
|
1152
|
+
group_name: groupName,
|
|
1153
|
+
conflicting_classes: [],
|
|
1154
|
+
description: "",
|
|
1155
|
+
resolution_strategy: "last-wins"
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1200
1158
|
}
|
|
1201
|
-
function
|
|
1159
|
+
function resolveThemeValue(keyPath, themeJson) {
|
|
1202
1160
|
const native = exports.getNativeBridge();
|
|
1203
|
-
if (!native?.
|
|
1204
|
-
|
|
1205
|
-
const opts = {
|
|
1206
|
-
separator: options.separator,
|
|
1207
|
-
debug: options.debug
|
|
1208
|
-
};
|
|
1209
|
-
return native.tw_merge_many_with_separator(classStrings, opts);
|
|
1161
|
+
if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
|
|
1162
|
+
return native.resolve_theme_value(keyPath, themeJson);
|
|
1210
1163
|
}
|
|
1211
|
-
function
|
|
1164
|
+
function resolveSimpleVariants(configJson) {
|
|
1212
1165
|
const native = exports.getNativeBridge();
|
|
1213
|
-
if (!native?.
|
|
1214
|
-
|
|
1166
|
+
if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
|
|
1167
|
+
const resultJson = native.resolve_simple_variants(configJson);
|
|
1168
|
+
try {
|
|
1169
|
+
return JSON.parse(resultJson);
|
|
1170
|
+
} catch {
|
|
1171
|
+
return [];
|
|
1172
|
+
}
|
|
1215
1173
|
}
|
|
1216
|
-
var
|
|
1217
|
-
"packages/domain/compiler/src/
|
|
1174
|
+
var init_themeResolutionNative = __esm({
|
|
1175
|
+
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1218
1176
|
init_nativeBridge();
|
|
1219
1177
|
}
|
|
1220
1178
|
});
|
|
1221
1179
|
|
|
1222
|
-
// packages/domain/compiler/src/
|
|
1223
|
-
function
|
|
1180
|
+
// packages/domain/compiler/src/analyzer/scannerNative.ts
|
|
1181
|
+
function scanWorkspace(root, extensions) {
|
|
1224
1182
|
const native = exports.getNativeBridge();
|
|
1225
|
-
if (!native?.
|
|
1226
|
-
return native.
|
|
1183
|
+
if (!native?.scan_workspace) throw new Error("scan_workspace not available");
|
|
1184
|
+
return native.scan_workspace(root, extensions);
|
|
1227
1185
|
}
|
|
1228
|
-
function
|
|
1186
|
+
function extractClassesFromSourceNative(source) {
|
|
1229
1187
|
const native = exports.getNativeBridge();
|
|
1230
|
-
if (!native?.
|
|
1231
|
-
return native.
|
|
1188
|
+
if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
|
|
1189
|
+
return native.extract_classes_from_source(source);
|
|
1232
1190
|
}
|
|
1233
|
-
function
|
|
1191
|
+
function batchExtractClassesNative(filePaths) {
|
|
1234
1192
|
const native = exports.getNativeBridge();
|
|
1235
|
-
if (!native?.
|
|
1236
|
-
return native.
|
|
1193
|
+
if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
|
|
1194
|
+
return native.batch_extract_classes(filePaths);
|
|
1237
1195
|
}
|
|
1238
|
-
function
|
|
1196
|
+
function checkAgainstSafelistNative(classes, safelist) {
|
|
1239
1197
|
const native = exports.getNativeBridge();
|
|
1240
|
-
if (!native?.
|
|
1241
|
-
return native.
|
|
1198
|
+
if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
|
|
1199
|
+
return native.check_against_safelist(classes, safelist);
|
|
1242
1200
|
}
|
|
1243
|
-
function
|
|
1201
|
+
function scanFile(filePath) {
|
|
1244
1202
|
const native = exports.getNativeBridge();
|
|
1245
|
-
if (!native?.
|
|
1246
|
-
native.
|
|
1203
|
+
if (!native?.scan_file) throw new Error("scan_file not available");
|
|
1204
|
+
return native.scan_file(filePath);
|
|
1247
1205
|
}
|
|
1248
|
-
function
|
|
1206
|
+
function collectFiles(root, extensions) {
|
|
1249
1207
|
const native = exports.getNativeBridge();
|
|
1250
|
-
if (!native?.
|
|
1251
|
-
native.
|
|
1208
|
+
if (!native?.collect_files) throw new Error("collect_files not available");
|
|
1209
|
+
return native.collect_files(root, extensions);
|
|
1252
1210
|
}
|
|
1253
|
-
function
|
|
1211
|
+
function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
|
|
1254
1212
|
const native = exports.getNativeBridge();
|
|
1255
|
-
if (!native?.
|
|
1256
|
-
|
|
1213
|
+
if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
|
|
1214
|
+
return native.walk_and_prefilter_source_files(root, extensions);
|
|
1215
|
+
}
|
|
1216
|
+
function generateSubComponentTypes(root, outputPath) {
|
|
1217
|
+
const native = exports.getNativeBridge();
|
|
1218
|
+
if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
|
|
1219
|
+
return native.generate_sub_component_types(root, outputPath);
|
|
1220
|
+
}
|
|
1221
|
+
var init_scannerNative = __esm({
|
|
1222
|
+
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
1223
|
+
init_nativeBridge();
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
// packages/domain/compiler/src/analyzer/index.ts
|
|
1228
|
+
var init_analyzer = __esm({
|
|
1229
|
+
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
1230
|
+
init_analyzerNative();
|
|
1231
|
+
init_themeResolutionNative();
|
|
1232
|
+
init_scannerNative();
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
// packages/domain/compiler/src/cache/cacheNative.ts
|
|
1237
|
+
function getCacheStatistics() {
|
|
1238
|
+
const native = exports.getNativeBridge();
|
|
1239
|
+
if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
|
|
1240
|
+
const statsJson = native.get_cache_statistics();
|
|
1257
1241
|
try {
|
|
1258
|
-
return JSON.parse(
|
|
1242
|
+
return JSON.parse(statsJson);
|
|
1259
1243
|
} catch {
|
|
1260
1244
|
return {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1245
|
+
parse_cache: { hits: 0, misses: 0, size: 0 },
|
|
1246
|
+
resolve_cache: { hits: 0, misses: 0, size: 0 },
|
|
1247
|
+
compile_cache: { hits: 0, misses: 0, size: 0 },
|
|
1248
|
+
css_gen_cache: { hits: 0, misses: 0, size: 0 },
|
|
1249
|
+
overall_hit_rate: 0,
|
|
1250
|
+
total_memory_bytes: 0
|
|
1265
1251
|
};
|
|
1266
1252
|
}
|
|
1267
1253
|
}
|
|
1268
|
-
function
|
|
1254
|
+
function clearAllCaches() {
|
|
1269
1255
|
const native = exports.getNativeBridge();
|
|
1270
|
-
if (!native?.
|
|
1271
|
-
|
|
1256
|
+
if (!native?.clear_all_caches) return;
|
|
1257
|
+
try {
|
|
1258
|
+
native.clear_all_caches();
|
|
1259
|
+
} catch {
|
|
1260
|
+
}
|
|
1272
1261
|
}
|
|
1273
|
-
function
|
|
1262
|
+
function clearParseCache() {
|
|
1274
1263
|
const native = exports.getNativeBridge();
|
|
1275
|
-
if (!native?.
|
|
1276
|
-
|
|
1277
|
-
|
|
1264
|
+
if (!native?.clear_parse_cache) return;
|
|
1265
|
+
try {
|
|
1266
|
+
native.clear_parse_cache();
|
|
1267
|
+
} catch {
|
|
1268
|
+
}
|
|
1278
1269
|
}
|
|
1279
|
-
function
|
|
1270
|
+
function clearResolveCache() {
|
|
1280
1271
|
const native = exports.getNativeBridge();
|
|
1281
|
-
if (!native?.
|
|
1282
|
-
|
|
1272
|
+
if (!native?.clear_resolve_cache) return;
|
|
1273
|
+
try {
|
|
1274
|
+
native.clear_resolve_cache();
|
|
1275
|
+
} catch {
|
|
1276
|
+
}
|
|
1283
1277
|
}
|
|
1284
|
-
function
|
|
1278
|
+
function clearCompileCache() {
|
|
1285
1279
|
const native = exports.getNativeBridge();
|
|
1286
|
-
if (!native?.
|
|
1287
|
-
|
|
1280
|
+
if (!native?.clear_compile_cache) return;
|
|
1281
|
+
try {
|
|
1282
|
+
native.clear_compile_cache();
|
|
1283
|
+
} catch {
|
|
1284
|
+
}
|
|
1288
1285
|
}
|
|
1289
|
-
function
|
|
1286
|
+
function clearCssGenCache() {
|
|
1290
1287
|
const native = exports.getNativeBridge();
|
|
1291
|
-
if (!native?.
|
|
1292
|
-
|
|
1288
|
+
if (!native?.clear_css_gen_cache) return;
|
|
1289
|
+
try {
|
|
1290
|
+
native.clear_css_gen_cache();
|
|
1291
|
+
} catch {
|
|
1292
|
+
}
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
|
|
1295
1295
|
const native = exports.getNativeBridge();
|
|
1296
|
-
if (!native?.
|
|
1297
|
-
throw new Error("
|
|
1298
|
-
|
|
1296
|
+
if (!native?.get_cache_optimization_hints)
|
|
1297
|
+
throw new Error("get_cache_optimization_hints not available");
|
|
1298
|
+
const hintsJson = native.get_cache_optimization_hints(
|
|
1299
|
+
Math.min(100, Math.max(0, hitRatePercent)),
|
|
1300
|
+
Math.max(1, memoryUsedMb)
|
|
1301
|
+
);
|
|
1302
|
+
try {
|
|
1303
|
+
return JSON.parse(hintsJson);
|
|
1304
|
+
} catch {
|
|
1305
|
+
return {
|
|
1306
|
+
current_strategy: "unknown",
|
|
1307
|
+
recommended_strategy: "increase_size",
|
|
1308
|
+
estimated_improvement_percent: 0,
|
|
1309
|
+
suggested_memory_mb: 256,
|
|
1310
|
+
notes: ["Unable to analyze cache statistics"]
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
|
|
1315
|
+
const native = exports.getNativeBridge();
|
|
1316
|
+
if (!native?.estimate_optimal_cache_config_native)
|
|
1317
|
+
throw new Error("estimate_optimal_cache_config_native not available");
|
|
1318
|
+
const configJson = native.estimate_optimal_cache_config_native(
|
|
1319
|
+
Math.max(64, totalBudgetMb),
|
|
1320
|
+
workloadType
|
|
1321
|
+
);
|
|
1322
|
+
try {
|
|
1323
|
+
return JSON.parse(configJson);
|
|
1324
|
+
} catch {
|
|
1325
|
+
return {
|
|
1326
|
+
parse_cache_size: 128,
|
|
1327
|
+
resolve_cache_size: 64,
|
|
1328
|
+
compile_cache_size: 256,
|
|
1329
|
+
css_gen_cache_size: 128,
|
|
1330
|
+
recommended_eviction_policy: "lru",
|
|
1331
|
+
ttl_seconds: 3600,
|
|
1332
|
+
expected_hit_rate_percent: 75
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1299
1335
|
}
|
|
1300
|
-
function
|
|
1336
|
+
function cacheRead(cachePath) {
|
|
1301
1337
|
const native = exports.getNativeBridge();
|
|
1302
|
-
if (!native?.
|
|
1303
|
-
|
|
1338
|
+
if (!native?.cache_read) throw new Error("cache_read not available");
|
|
1339
|
+
const result = native.cache_read(cachePath);
|
|
1340
|
+
try {
|
|
1341
|
+
return JSON.parse(result.entries_json || "[]");
|
|
1342
|
+
} catch {
|
|
1343
|
+
return [];
|
|
1344
|
+
}
|
|
1304
1345
|
}
|
|
1305
|
-
function
|
|
1346
|
+
function cacheWrite(cachePath, entries) {
|
|
1306
1347
|
const native = exports.getNativeBridge();
|
|
1307
|
-
if (!native?.
|
|
1308
|
-
|
|
1348
|
+
if (!native?.cache_write) throw new Error("cache_write not available");
|
|
1349
|
+
try {
|
|
1350
|
+
const result = native.cache_write(
|
|
1351
|
+
cachePath,
|
|
1352
|
+
entries.map((e) => ({
|
|
1353
|
+
file: e.file,
|
|
1354
|
+
content_hash: e.contentHash,
|
|
1355
|
+
classes: e.classes,
|
|
1356
|
+
mtime_ms: e.mtimeMs,
|
|
1357
|
+
size_bytes: e.sizeBytes
|
|
1358
|
+
}))
|
|
1359
|
+
);
|
|
1360
|
+
return typeof result === "boolean" ? result : result === true;
|
|
1361
|
+
} catch {
|
|
1362
|
+
return false;
|
|
1363
|
+
}
|
|
1309
1364
|
}
|
|
1310
|
-
function
|
|
1365
|
+
function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
1311
1366
|
const native = exports.getNativeBridge();
|
|
1312
|
-
if (!native?.
|
|
1313
|
-
return native.
|
|
1367
|
+
if (!native?.cache_priority) throw new Error("cache_priority not available");
|
|
1368
|
+
return native.cache_priority(mtimeMs, sizeBytes, hitCount);
|
|
1314
1369
|
}
|
|
1315
|
-
var
|
|
1316
|
-
"packages/domain/compiler/src/
|
|
1370
|
+
var init_cacheNative = __esm({
|
|
1371
|
+
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
1317
1372
|
init_nativeBridge();
|
|
1318
1373
|
}
|
|
1319
1374
|
});
|
|
1320
1375
|
|
|
1321
|
-
// packages/domain/compiler/src/
|
|
1376
|
+
// packages/domain/compiler/src/cache/index.ts
|
|
1377
|
+
var init_cache = __esm({
|
|
1378
|
+
"packages/domain/compiler/src/cache/index.ts"() {
|
|
1379
|
+
init_cacheNative();
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
// packages/domain/compiler/src/redis/redisNative.ts
|
|
1322
1384
|
function redisPing() {
|
|
1323
1385
|
const native = exports.getNativeBridge();
|
|
1324
1386
|
if (!native?.redis_ping) throw new Error("redis_ping not available");
|
|
@@ -1561,12 +1623,19 @@ function redisDiagnose() {
|
|
|
1561
1623
|
return native.redis_diagnose();
|
|
1562
1624
|
}
|
|
1563
1625
|
var init_redisNative = __esm({
|
|
1564
|
-
"packages/domain/compiler/src/redisNative.ts"() {
|
|
1626
|
+
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
1565
1627
|
init_nativeBridge();
|
|
1566
1628
|
}
|
|
1567
1629
|
});
|
|
1568
1630
|
|
|
1569
|
-
// packages/domain/compiler/src/
|
|
1631
|
+
// packages/domain/compiler/src/redis/index.ts
|
|
1632
|
+
var init_redis = __esm({
|
|
1633
|
+
"packages/domain/compiler/src/redis/index.ts"() {
|
|
1634
|
+
init_redisNative();
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
|
|
1638
|
+
// packages/domain/compiler/src/watch/watchSystemNative.ts
|
|
1570
1639
|
function startWatch(root_path, patterns) {
|
|
1571
1640
|
const native = exports.getNativeBridge();
|
|
1572
1641
|
if (!native?.start_watch) throw new Error("start_watch not available");
|
|
@@ -1699,10 +1768,17 @@ function getCompilerDiagnostics() {
|
|
|
1699
1768
|
return native.get_compiler_diagnostics();
|
|
1700
1769
|
}
|
|
1701
1770
|
var init_watchSystemNative = __esm({
|
|
1702
|
-
"packages/domain/compiler/src/watchSystemNative.ts"() {
|
|
1771
|
+
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
1703
1772
|
init_nativeBridge();
|
|
1704
1773
|
}
|
|
1705
1774
|
});
|
|
1775
|
+
|
|
1776
|
+
// packages/domain/compiler/src/watch/index.ts
|
|
1777
|
+
var init_watch = __esm({
|
|
1778
|
+
"packages/domain/compiler/src/watch/index.ts"() {
|
|
1779
|
+
init_watchSystemNative();
|
|
1780
|
+
}
|
|
1781
|
+
});
|
|
1706
1782
|
function _layoutClassesToCss(classes) {
|
|
1707
1783
|
const native = exports.getNativeBridge();
|
|
1708
1784
|
if (!native?.layoutClassesToCss) {
|
|
@@ -1737,21 +1813,16 @@ function extractContainerCssFromSource(source) {
|
|
|
1737
1813
|
}
|
|
1738
1814
|
return rules.join("\n");
|
|
1739
1815
|
}
|
|
1740
|
-
exports.transformSource = void 0; exports.hasTwUsage = void 0; exports.isAlreadyTransformed = void 0; exports.shouldProcess = void 0; exports.compileCssFromClasses = void 0; exports.buildStyleTag = void 0; exports.
|
|
1816
|
+
exports.transformSource = void 0; exports.hasTwUsage = void 0; exports.isAlreadyTransformed = void 0; exports.shouldProcess = void 0; exports.compileCssFromClasses = void 0; exports.buildStyleTag = void 0; exports.generateCssForClasses = void 0; exports.eliminateDeadCss = void 0; exports.findDeadVariants = void 0; exports.runElimination = void 0; exports.scanProjectUsage = void 0; exports.generateSafelist = void 0; exports.loadSafelist = void 0; exports.loadTailwindConfig = void 0; exports.getContentPaths = void 0; var _CONTAINER_BREAKPOINTS; exports.runLoaderTransform = void 0; exports.shouldSkipFile = void 0; exports.fileToRoute = void 0; exports.getAllRoutes = void 0; exports.getRouteClasses = void 0; exports.registerFileClasses = void 0; exports.registerGlobalClasses = void 0; var _incrementalEngineInstance; exports.getIncrementalEngine = void 0; exports.resetIncrementalEngine = void 0; exports.IncrementalEngine = void 0; exports.getBucketEngine = void 0; exports.resetBucketEngine = void 0; exports.BucketEngine = void 0; exports.classifyNode = void 0; exports.detectConflicts = void 0; exports.bucketSort = void 0; exports.analyzeFile = void 0; exports.analyzeVariantUsage = void 0; exports.injectClientDirective = void 0; exports.injectServerOnlyComment = void 0; exports.analyzeClasses = void 0; exports.extractTwStateConfigs = void 0; exports.generateStaticStateCss = void 0; exports.extractAndGenerateStateCss = void 0;
|
|
1741
1817
|
var init_src2 = __esm({
|
|
1742
1818
|
"packages/domain/compiler/src/index.ts"() {
|
|
1743
1819
|
init_nativeBridge();
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
init_streamingNative();
|
|
1751
|
-
init_cssCompilationNative();
|
|
1752
|
-
init_idRegistryNative();
|
|
1753
|
-
init_redisNative();
|
|
1754
|
-
init_watchSystemNative();
|
|
1820
|
+
init_compiler();
|
|
1821
|
+
init_parser();
|
|
1822
|
+
init_analyzer();
|
|
1823
|
+
init_cache();
|
|
1824
|
+
init_redis();
|
|
1825
|
+
init_watch();
|
|
1755
1826
|
exports.transformSource = (source, opts) => {
|
|
1756
1827
|
const native = exports.getNativeBridge();
|
|
1757
1828
|
if (!native?.transformSource) {
|
|
@@ -1795,58 +1866,19 @@ var init_src2 = __esm({
|
|
|
1795
1866
|
const result = exports.compileCssFromClasses(classes);
|
|
1796
1867
|
return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
|
|
1797
1868
|
};
|
|
1798
|
-
exports.compileCssNative = (classes, prefix = null) => {
|
|
1799
|
-
return exports.compileCssFromClasses(classes, prefix);
|
|
1800
|
-
};
|
|
1801
1869
|
exports.generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
exports.extractClassesFromSource = (source) => {
|
|
1814
|
-
const native = exports.getNativeBridge();
|
|
1815
|
-
if (!native?.extractClassesFromSource) {
|
|
1816
|
-
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1817
|
-
}
|
|
1818
|
-
const result = native.extractClassesFromSource(source);
|
|
1819
|
-
return Array.isArray(result) ? result.join(" ") : String(result || "");
|
|
1820
|
-
};
|
|
1821
|
-
exports.astExtractClasses = (source, _filename) => {
|
|
1822
|
-
const native = exports.getNativeBridge();
|
|
1823
|
-
if (!native?.extractClassesFromSource) {
|
|
1824
|
-
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1825
|
-
}
|
|
1826
|
-
return native.extractClassesFromSource(source) || [];
|
|
1827
|
-
};
|
|
1828
|
-
exports.parseClasses = (raw) => {
|
|
1829
|
-
const native = exports.getNativeBridge();
|
|
1830
|
-
if (!native?.parseClasses) {
|
|
1831
|
-
throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
|
|
1832
|
-
}
|
|
1833
|
-
return native.parseClasses(raw) || [];
|
|
1834
|
-
};
|
|
1835
|
-
exports.normalizeClasses = (raw) => {
|
|
1836
|
-
const result = exports.normalizeAndDedupClasses(raw);
|
|
1837
|
-
return result?.normalized || "";
|
|
1838
|
-
};
|
|
1839
|
-
exports.mergeClassesStatic = (classes) => {
|
|
1840
|
-
const result = exports.normalizeAndDedupClasses(classes);
|
|
1841
|
-
return result?.normalized || "";
|
|
1842
|
-
};
|
|
1843
|
-
exports.normalizeAndDedupClasses = (raw) => {
|
|
1844
|
-
const native = exports.getNativeBridge();
|
|
1845
|
-
if (!native?.normalizeAndDedupClasses) {
|
|
1846
|
-
throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
|
|
1870
|
+
try {
|
|
1871
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
1872
|
+
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
1873
|
+
return result.css;
|
|
1874
|
+
} catch {
|
|
1875
|
+
const native = exports.getNativeBridge();
|
|
1876
|
+
if (!native?.transformSource) {
|
|
1877
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
1878
|
+
}
|
|
1879
|
+
const result = native.transformSource(classes.join(" "), {});
|
|
1880
|
+
return result?.code || "";
|
|
1847
1881
|
}
|
|
1848
|
-
const result = native.normalizeAndDedupClasses(raw);
|
|
1849
|
-
return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
|
|
1850
1882
|
};
|
|
1851
1883
|
exports.eliminateDeadCss = (css, deadClasses) => {
|
|
1852
1884
|
const native = exports.getNativeBridge();
|
|
@@ -1879,16 +1911,10 @@ var init_src2 = __esm({
|
|
|
1879
1911
|
const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
|
|
1880
1912
|
return exports.eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
|
|
1881
1913
|
};
|
|
1882
|
-
exports.optimizeCss = (css) => {
|
|
1883
|
-
const native = exports.getNativeBridge();
|
|
1884
|
-
if (!native?.optimizeCss) {
|
|
1885
|
-
throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
|
|
1886
|
-
}
|
|
1887
|
-
return native.optimizeCss(css);
|
|
1888
|
-
};
|
|
1889
1914
|
exports.scanProjectUsage = (dirs, cwd) => {
|
|
1915
|
+
const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
|
|
1890
1916
|
const files = dirs.map((dir) => path__namespace.default.resolve(cwd, dir));
|
|
1891
|
-
const results =
|
|
1917
|
+
const results = batchExtractClasses2(files) || [];
|
|
1892
1918
|
const combined = {};
|
|
1893
1919
|
for (const result of results) {
|
|
1894
1920
|
if (result.ok && result.classes) {
|
|
@@ -1900,109 +1926,6 @@ var init_src2 = __esm({
|
|
|
1900
1926
|
}
|
|
1901
1927
|
return combined;
|
|
1902
1928
|
};
|
|
1903
|
-
exports.extractComponentUsage = (source) => {
|
|
1904
|
-
const native = exports.getNativeBridge();
|
|
1905
|
-
if (!native?.extractComponentUsage) {
|
|
1906
|
-
throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
|
|
1907
|
-
}
|
|
1908
|
-
return native.extractComponentUsage(source) || [];
|
|
1909
|
-
};
|
|
1910
|
-
exports.diffClassLists = (previous, current) => {
|
|
1911
|
-
const native = exports.getNativeBridge();
|
|
1912
|
-
if (!native?.diffClassLists) {
|
|
1913
|
-
throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
|
|
1914
|
-
}
|
|
1915
|
-
return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
|
|
1916
|
-
};
|
|
1917
|
-
exports.batchExtractClasses = (filePaths) => {
|
|
1918
|
-
const native = exports.getNativeBridge();
|
|
1919
|
-
if (!native?.batchExtractClasses) {
|
|
1920
|
-
throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
|
|
1921
|
-
}
|
|
1922
|
-
return native.batchExtractClasses(filePaths) || [];
|
|
1923
|
-
};
|
|
1924
|
-
exports.checkAgainstSafelist = (classes, safelist) => {
|
|
1925
|
-
const native = exports.getNativeBridge();
|
|
1926
|
-
if (!native?.checkAgainstSafelist) {
|
|
1927
|
-
throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
|
|
1928
|
-
}
|
|
1929
|
-
return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
|
|
1930
|
-
};
|
|
1931
|
-
exports.hoistComponents = (source) => {
|
|
1932
|
-
const native = exports.getNativeBridge();
|
|
1933
|
-
if (!native?.hoistComponents) {
|
|
1934
|
-
throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
|
|
1935
|
-
}
|
|
1936
|
-
return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
|
|
1937
|
-
};
|
|
1938
|
-
exports.compileVariantTable = (configJson) => {
|
|
1939
|
-
const native = exports.getNativeBridge();
|
|
1940
|
-
if (!native?.compileVariantTable) {
|
|
1941
|
-
throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
|
|
1942
|
-
}
|
|
1943
|
-
return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
|
|
1944
|
-
};
|
|
1945
|
-
exports.compileVariants = (componentId, config) => {
|
|
1946
|
-
return exports.compileVariantTable(JSON.stringify({ componentId, ...config }));
|
|
1947
|
-
};
|
|
1948
|
-
exports.classifyAndSortClasses = (classes) => {
|
|
1949
|
-
const native = exports.getNativeBridge();
|
|
1950
|
-
if (!native?.classifyAndSortClasses) {
|
|
1951
|
-
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
1952
|
-
}
|
|
1953
|
-
return native.classifyAndSortClasses(classes) || [];
|
|
1954
|
-
};
|
|
1955
|
-
exports.mergeCssDeclarations = (cssChunks) => {
|
|
1956
|
-
const native = exports.getNativeBridge();
|
|
1957
|
-
if (!native?.mergeCssDeclarations) {
|
|
1958
|
-
throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
|
|
1959
|
-
}
|
|
1960
|
-
return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
|
|
1961
|
-
};
|
|
1962
|
-
exports.analyzeClassUsage = (classes, scanResultJson, css) => {
|
|
1963
|
-
const native = exports.getNativeBridge();
|
|
1964
|
-
if (!native?.analyzeClassUsage) {
|
|
1965
|
-
throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
|
|
1966
|
-
}
|
|
1967
|
-
return native.analyzeClassUsage(classes, scanResultJson, css) || [];
|
|
1968
|
-
};
|
|
1969
|
-
exports.analyzeRsc = (source, filename) => {
|
|
1970
|
-
const native = exports.getNativeBridge();
|
|
1971
|
-
if (!native?.analyzeRsc) {
|
|
1972
|
-
throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
|
|
1973
|
-
}
|
|
1974
|
-
return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
|
|
1975
|
-
};
|
|
1976
|
-
exports.analyzeFile = (source, filename) => {
|
|
1977
|
-
const rsc = exports.analyzeRsc(source, filename);
|
|
1978
|
-
return {
|
|
1979
|
-
isServer: rsc?.isServer ?? true,
|
|
1980
|
-
needsClientDirective: rsc?.needsClientDirective ?? false,
|
|
1981
|
-
clientReasons: rsc?.clientReasons ?? [],
|
|
1982
|
-
interactiveClasses: [],
|
|
1983
|
-
canStaticResolveVariants: true
|
|
1984
|
-
};
|
|
1985
|
-
};
|
|
1986
|
-
exports.analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
|
|
1987
|
-
return { resolved: {}, dynamic: [] };
|
|
1988
|
-
};
|
|
1989
|
-
exports.injectClientDirective = (source) => {
|
|
1990
|
-
if (!source.includes('"use client"') && !source.includes("'use client'")) {
|
|
1991
|
-
return '"use client";\n' + source;
|
|
1992
|
-
}
|
|
1993
|
-
return source;
|
|
1994
|
-
};
|
|
1995
|
-
exports.injectServerOnlyComment = (source) => {
|
|
1996
|
-
return `/* @server-only */
|
|
1997
|
-
${source}`;
|
|
1998
|
-
};
|
|
1999
|
-
exports.analyzeClasses = (filesJson, cwd, flags) => {
|
|
2000
|
-
const native = exports.getNativeBridge();
|
|
2001
|
-
if (!native?.analyzeClasses) {
|
|
2002
|
-
throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
|
|
2003
|
-
}
|
|
2004
|
-
return native.analyzeClasses(filesJson, cwd, flags);
|
|
2005
|
-
};
|
|
2006
1929
|
exports.generateSafelist = (scanDirs, outputPath, cwd) => {
|
|
2007
1930
|
const classes = exports.scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2008
1931
|
const allClasses = Object.keys(classes).sort();
|
|
@@ -2066,7 +1989,8 @@ ${source}`;
|
|
|
2066
1989
|
if (containerCss) cssChunks.push(containerCss);
|
|
2067
1990
|
const combined = cssChunks.join("\n").trim();
|
|
2068
1991
|
if (combined) staticCss = combined;
|
|
2069
|
-
} catch {
|
|
1992
|
+
} catch (err) {
|
|
1993
|
+
console.debug("Static CSS extraction warning:", err);
|
|
2070
1994
|
}
|
|
2071
1995
|
return {
|
|
2072
1996
|
code: result?.code || "",
|
|
@@ -2156,7 +2080,46 @@ ${source}`;
|
|
|
2156
2080
|
return [];
|
|
2157
2081
|
};
|
|
2158
2082
|
exports.bucketSort = (classes) => {
|
|
2159
|
-
|
|
2083
|
+
const native = exports.getNativeBridge();
|
|
2084
|
+
if (!native?.classifyAndSortClasses) {
|
|
2085
|
+
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2086
|
+
}
|
|
2087
|
+
const sorted = native.classifyAndSortClasses(classes);
|
|
2088
|
+
return sorted.map((c) => c.raw ?? c);
|
|
2089
|
+
};
|
|
2090
|
+
exports.analyzeFile = (source, filename) => {
|
|
2091
|
+
const native = exports.getNativeBridge();
|
|
2092
|
+
if (!native?.analyzeRsc) {
|
|
2093
|
+
throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
|
|
2094
|
+
}
|
|
2095
|
+
const rsc = native.analyzeRsc(source, filename);
|
|
2096
|
+
return {
|
|
2097
|
+
isServer: rsc?.isServer ?? true,
|
|
2098
|
+
needsClientDirective: rsc?.needsClientDirective ?? false,
|
|
2099
|
+
clientReasons: rsc?.clientReasons ?? [],
|
|
2100
|
+
interactiveClasses: [],
|
|
2101
|
+
canStaticResolveVariants: true
|
|
2102
|
+
};
|
|
2103
|
+
};
|
|
2104
|
+
exports.analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
|
|
2105
|
+
return { resolved: {}, dynamic: [] };
|
|
2106
|
+
};
|
|
2107
|
+
exports.injectClientDirective = (source) => {
|
|
2108
|
+
if (!source.includes('"use client"') && !source.includes("'use client'")) {
|
|
2109
|
+
return '"use client";\n' + source;
|
|
2110
|
+
}
|
|
2111
|
+
return source;
|
|
2112
|
+
};
|
|
2113
|
+
exports.injectServerOnlyComment = (source) => {
|
|
2114
|
+
return `/* @server-only */
|
|
2115
|
+
${source}`;
|
|
2116
|
+
};
|
|
2117
|
+
exports.analyzeClasses = (filesJson, cwd, flags) => {
|
|
2118
|
+
const native = exports.getNativeBridge();
|
|
2119
|
+
if (!native?.analyzeClasses) {
|
|
2120
|
+
throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
|
|
2121
|
+
}
|
|
2122
|
+
return native.analyzeClasses(filesJson, cwd, flags);
|
|
2160
2123
|
};
|
|
2161
2124
|
exports.extractTwStateConfigs = (source, filename) => {
|
|
2162
2125
|
const native = exports.getNativeBridge();
|
|
@@ -2165,23 +2128,25 @@ ${source}`;
|
|
|
2165
2128
|
}
|
|
2166
2129
|
return native.extractTwStateConfigs(source, filename);
|
|
2167
2130
|
};
|
|
2168
|
-
exports.generateStaticStateCss = (
|
|
2169
|
-
const
|
|
2170
|
-
|
|
2171
|
-
|
|
2131
|
+
exports.generateStaticStateCss = (entries, _themeConfig) => {
|
|
2132
|
+
const rules = [];
|
|
2133
|
+
for (const entry of entries) {
|
|
2134
|
+
const stateConfig = JSON.parse(entry.statesJson);
|
|
2135
|
+
for (const [stateName, classes] of Object.entries(stateConfig)) {
|
|
2136
|
+
rules.push({
|
|
2137
|
+
selector: `.${entry.componentName}[data-state="${stateName}"]`,
|
|
2138
|
+
declarations: classes,
|
|
2139
|
+
cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
|
|
2140
|
+
componentName: entry.componentName,
|
|
2141
|
+
stateName
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2172
2144
|
}
|
|
2173
|
-
return
|
|
2145
|
+
return rules;
|
|
2174
2146
|
};
|
|
2175
2147
|
exports.extractAndGenerateStateCss = (source, filename) => {
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
const configs = exports.extractTwStateConfigs(source, filename);
|
|
2179
|
-
if (configs.length === 0) return [];
|
|
2180
|
-
return exports.generateStaticStateCss(
|
|
2181
|
-
configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
|
|
2182
|
-
);
|
|
2183
|
-
}
|
|
2184
|
-
return native.extractAndGenerateStateCss(source, filename);
|
|
2148
|
+
const entries = exports.extractTwStateConfigs(source, filename);
|
|
2149
|
+
return exports.generateStaticStateCss(entries);
|
|
2185
2150
|
};
|
|
2186
2151
|
}
|
|
2187
2152
|
});
|
|
@@ -2234,7 +2199,7 @@ exports.generateStaticStateCssNative = generateStaticStateCssNative;
|
|
|
2234
2199
|
exports.generateSubComponentTypes = generateSubComponentTypes;
|
|
2235
2200
|
exports.getCacheOptimizationHints = getCacheOptimizationHints;
|
|
2236
2201
|
exports.getCacheStatistics = getCacheStatistics;
|
|
2237
|
-
exports.getCacheStats =
|
|
2202
|
+
exports.getCacheStats = getCacheStats;
|
|
2238
2203
|
exports.getCompilationMetrics = getCompilationMetrics;
|
|
2239
2204
|
exports.getCompilerDiagnostics = getCompilerDiagnostics;
|
|
2240
2205
|
exports.getPluginHooks = getPluginHooks;
|
|
@@ -2314,6 +2279,7 @@ exports.resolveThemeValue = resolveThemeValue;
|
|
|
2314
2279
|
exports.resolveVariants = resolveVariants;
|
|
2315
2280
|
exports.reverseLookupProperty = reverseLookupProperty;
|
|
2316
2281
|
exports.reverseLookupValue = reverseLookupValue;
|
|
2282
|
+
exports.runCssPipeline = runCssPipeline;
|
|
2317
2283
|
exports.scanCacheOptimizations = scanCacheOptimizations;
|
|
2318
2284
|
exports.scanFile = scanFile;
|
|
2319
2285
|
exports.scanFileNative = scanFileNative;
|