tailwind-styled-v4 5.1.16 → 5.1.17
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/dist/atomic.js +16 -4
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +13 -2
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +80 -68
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +77 -66
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +84 -4
- package/dist/compiler.d.ts +84 -4
- package/dist/compiler.js +245 -15
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +240 -14
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +209 -167
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +200 -159
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +16 -0
- package/dist/next.d.ts +16 -0
- package/dist/next.js +458 -158
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +454 -154
- package/dist/next.mjs.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/shared.js +106 -64
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +101 -60
- package/dist/shared.mjs.map +1 -1
- package/dist/theme.js +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +94 -52
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +92 -51
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +80 -68
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +77 -66
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +172 -130
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +166 -125
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +28 -10
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +26 -9
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +1 -1
package/dist/vite.mjs
CHANGED
|
@@ -230,9 +230,9 @@ function parseNative(schema, data, context) {
|
|
|
230
230
|
const result = schema.safeParse(data);
|
|
231
231
|
if (!result.success) {
|
|
232
232
|
const first = result.error.issues[0];
|
|
233
|
-
const
|
|
233
|
+
const path18 = first?.path?.join(".") ?? "(root)";
|
|
234
234
|
throw new Error(
|
|
235
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
235
|
+
`[${context}] Native binding returned unexpected data: ${path18}: ${first?.message ?? "validation failed"}`
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
return result.data;
|
|
@@ -666,11 +666,11 @@ function resolvePath(...segments) {
|
|
|
666
666
|
return segments.join("/").replace(/\/+/g, "/");
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
function existsSync(
|
|
669
|
+
function existsSync(path18) {
|
|
670
670
|
if (isBrowser2) return false;
|
|
671
671
|
try {
|
|
672
672
|
const nodeFs = __require(NODE_FS);
|
|
673
|
-
return nodeFs.existsSync(
|
|
673
|
+
return nodeFs.existsSync(path18);
|
|
674
674
|
} catch {
|
|
675
675
|
return false;
|
|
676
676
|
}
|
|
@@ -1024,9 +1024,9 @@ var init_native_resolution = __esm({
|
|
|
1024
1024
|
// packages/domain/shared/src/observability.ts
|
|
1025
1025
|
function createObservabilityClient(opts = {}) {
|
|
1026
1026
|
const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
|
|
1027
|
-
async function fetchJson(
|
|
1027
|
+
async function fetchJson(path18) {
|
|
1028
1028
|
try {
|
|
1029
|
-
const res = await fetch(`${baseUrl}${
|
|
1029
|
+
const res = await fetch(`${baseUrl}${path18}`, {
|
|
1030
1030
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1031
1031
|
});
|
|
1032
1032
|
if (!res.ok) return null;
|
|
@@ -2856,6 +2856,7 @@ __export(internal_exports, {
|
|
|
2856
2856
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2857
2857
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2858
2858
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
2859
|
+
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
2859
2860
|
getAllRoutes: () => getAllRoutes,
|
|
2860
2861
|
getBucketEngine: () => getBucketEngine,
|
|
2861
2862
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
@@ -2958,6 +2959,7 @@ __export(internal_exports, {
|
|
|
2958
2959
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
2959
2960
|
resetMemoryStats: () => resetMemoryStats,
|
|
2960
2961
|
resetResolverPoolStats: () => resetResolverPoolStats,
|
|
2962
|
+
resetRouteClassRegistry: () => resetRouteClassRegistry,
|
|
2961
2963
|
resolveCascade: () => resolveCascade,
|
|
2962
2964
|
resolveClassNames: () => resolveClassNames,
|
|
2963
2965
|
resolveColorCached: () => resolveColorCached,
|
|
@@ -3452,9 +3454,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3452
3454
|
}
|
|
3453
3455
|
};
|
|
3454
3456
|
}
|
|
3455
|
-
function formatIssuePath(
|
|
3456
|
-
if (!
|
|
3457
|
-
return
|
|
3457
|
+
function formatIssuePath(path18) {
|
|
3458
|
+
if (!path18 || path18.length === 0) return "(root)";
|
|
3459
|
+
return path18.map(
|
|
3458
3460
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3459
3461
|
).join(".");
|
|
3460
3462
|
}
|
|
@@ -3593,8 +3595,8 @@ var init_src = __esm({
|
|
|
3593
3595
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3594
3596
|
static fromZod(err) {
|
|
3595
3597
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3596
|
-
const
|
|
3597
|
-
const message = first ? `${
|
|
3598
|
+
const path18 = formatIssuePath(first?.path);
|
|
3599
|
+
const message = first ? `${path18}: ${first.message}` : "Schema validation failed";
|
|
3598
3600
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3599
3601
|
}
|
|
3600
3602
|
static wrap(source, code, err) {
|
|
@@ -3666,7 +3668,7 @@ var init_nativeBridge = __esm({
|
|
|
3666
3668
|
"use strict";
|
|
3667
3669
|
init_esm_shims();
|
|
3668
3670
|
init_src();
|
|
3669
|
-
_loadNative = (
|
|
3671
|
+
_loadNative = (path18) => __require(path18);
|
|
3670
3672
|
log = (...args) => {
|
|
3671
3673
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
3672
3674
|
console.log("[compiler:native]", ...args);
|
|
@@ -3769,9 +3771,19 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
3769
3771
|
}
|
|
3770
3772
|
});
|
|
3771
3773
|
|
|
3772
|
-
// packages/domain/compiler/src/
|
|
3774
|
+
// packages/domain/compiler/src/routeGraph.ts
|
|
3773
3775
|
import fs5 from "fs";
|
|
3774
3776
|
import path6 from "path";
|
|
3777
|
+
var init_routeGraph = __esm({
|
|
3778
|
+
"packages/domain/compiler/src/routeGraph.ts"() {
|
|
3779
|
+
"use strict";
|
|
3780
|
+
init_esm_shims();
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3783
|
+
|
|
3784
|
+
// packages/domain/compiler/src/index.ts
|
|
3785
|
+
import fs6 from "fs";
|
|
3786
|
+
import path7 from "path";
|
|
3775
3787
|
import { createRequire as createRequire5 } from "module";
|
|
3776
3788
|
function _layoutClassesToCss(classes) {
|
|
3777
3789
|
const native = getNativeBridge();
|
|
@@ -3807,7 +3819,7 @@ function extractContainerCssFromSource(source) {
|
|
|
3807
3819
|
}
|
|
3808
3820
|
return rules.join("\n");
|
|
3809
3821
|
}
|
|
3810
|
-
var _require3, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
3822
|
+
var _require3, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, _fileClassesMap, _globalClasses, getRouteClasses, getAllRegisteredClasses, registerFileClasses, registerGlobalClasses, resetRouteClassRegistry, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
3811
3823
|
var init_src2 = __esm({
|
|
3812
3824
|
"packages/domain/compiler/src/index.ts"() {
|
|
3813
3825
|
"use strict";
|
|
@@ -3819,6 +3831,7 @@ var init_src2 = __esm({
|
|
|
3819
3831
|
init_cache();
|
|
3820
3832
|
init_redis();
|
|
3821
3833
|
init_watch();
|
|
3834
|
+
init_routeGraph();
|
|
3822
3835
|
_require3 = createRequire5(
|
|
3823
3836
|
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
3824
3837
|
);
|
|
@@ -3913,7 +3926,7 @@ var init_src2 = __esm({
|
|
|
3913
3926
|
};
|
|
3914
3927
|
scanProjectUsage = (dirs, cwd) => {
|
|
3915
3928
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
3916
|
-
const files = dirs.map((dir) =>
|
|
3929
|
+
const files = dirs.map((dir) => path7.resolve(cwd, dir));
|
|
3917
3930
|
const results = batchExtractClasses2(files) || [];
|
|
3918
3931
|
const combined = {};
|
|
3919
3932
|
for (const result of results) {
|
|
@@ -3930,13 +3943,13 @@ var init_src2 = __esm({
|
|
|
3930
3943
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3931
3944
|
const allClasses = Object.keys(classes).sort();
|
|
3932
3945
|
if (outputPath) {
|
|
3933
|
-
|
|
3946
|
+
fs6.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3934
3947
|
}
|
|
3935
3948
|
return allClasses;
|
|
3936
3949
|
};
|
|
3937
3950
|
loadSafelist = (safelistPath) => {
|
|
3938
3951
|
try {
|
|
3939
|
-
const content =
|
|
3952
|
+
const content = fs6.readFileSync(safelistPath, "utf-8");
|
|
3940
3953
|
return JSON.parse(content);
|
|
3941
3954
|
} catch {
|
|
3942
3955
|
return [];
|
|
@@ -3950,8 +3963,8 @@ var init_src2 = __esm({
|
|
|
3950
3963
|
"tailwind.config.cjs"
|
|
3951
3964
|
];
|
|
3952
3965
|
for (const file of configFiles) {
|
|
3953
|
-
const fullPath =
|
|
3954
|
-
if (
|
|
3966
|
+
const fullPath = path7.join(cwd, file);
|
|
3967
|
+
if (fs6.existsSync(fullPath)) {
|
|
3955
3968
|
const mod = __require(fullPath);
|
|
3956
3969
|
return mod.default || mod;
|
|
3957
3970
|
}
|
|
@@ -3961,9 +3974,9 @@ var init_src2 = __esm({
|
|
|
3961
3974
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3962
3975
|
return {
|
|
3963
3976
|
content: [
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3977
|
+
path7.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3978
|
+
path7.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3979
|
+
path7.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3967
3980
|
]
|
|
3968
3981
|
};
|
|
3969
3982
|
};
|
|
@@ -4034,10 +4047,38 @@ var init_src2 = __esm({
|
|
|
4034
4047
|
}
|
|
4035
4048
|
return ["/", "__global"];
|
|
4036
4049
|
};
|
|
4037
|
-
|
|
4038
|
-
|
|
4050
|
+
_fileClassesMap = /* @__PURE__ */ new Map();
|
|
4051
|
+
_globalClasses = /* @__PURE__ */ new Set();
|
|
4052
|
+
getRouteClasses = (route) => {
|
|
4053
|
+
const result = /* @__PURE__ */ new Set();
|
|
4054
|
+
for (const [filepath, classes] of _fileClassesMap) {
|
|
4055
|
+
const fileRoute = fileToRoute(filepath) ?? "__global";
|
|
4056
|
+
if (fileRoute === route) {
|
|
4057
|
+
for (const cls of classes) result.add(cls);
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
return result;
|
|
4061
|
+
};
|
|
4062
|
+
getAllRegisteredClasses = () => {
|
|
4063
|
+
const result = new Set(_globalClasses);
|
|
4064
|
+
for (const classes of _fileClassesMap.values()) {
|
|
4065
|
+
for (const cls of classes) result.add(cls);
|
|
4066
|
+
}
|
|
4067
|
+
return result;
|
|
4068
|
+
};
|
|
4069
|
+
registerFileClasses = (filepath, classes) => {
|
|
4070
|
+
if (!classes || classes.length === 0) {
|
|
4071
|
+
_fileClassesMap.delete(filepath);
|
|
4072
|
+
return;
|
|
4073
|
+
}
|
|
4074
|
+
_fileClassesMap.set(filepath, new Set(classes));
|
|
4039
4075
|
};
|
|
4040
|
-
registerGlobalClasses = (
|
|
4076
|
+
registerGlobalClasses = (classes) => {
|
|
4077
|
+
for (const cls of classes) _globalClasses.add(cls);
|
|
4078
|
+
};
|
|
4079
|
+
resetRouteClassRegistry = () => {
|
|
4080
|
+
_fileClassesMap.clear();
|
|
4081
|
+
_globalClasses.clear();
|
|
4041
4082
|
};
|
|
4042
4083
|
_incrementalEngineInstance = null;
|
|
4043
4084
|
getIncrementalEngine = () => {
|
|
@@ -4183,14 +4224,14 @@ __export(native_bridge_exports, {
|
|
|
4183
4224
|
startWatchNative: () => startWatchNative,
|
|
4184
4225
|
stopWatchNative: () => stopWatchNative
|
|
4185
4226
|
});
|
|
4186
|
-
import
|
|
4227
|
+
import path8 from "path";
|
|
4187
4228
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4188
4229
|
function getDirname3() {
|
|
4189
4230
|
if (typeof __dirname !== "undefined") {
|
|
4190
4231
|
return __dirname;
|
|
4191
4232
|
}
|
|
4192
4233
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4193
|
-
return
|
|
4234
|
+
return path8.dirname(fileURLToPath3(import.meta.url));
|
|
4194
4235
|
}
|
|
4195
4236
|
return process.cwd();
|
|
4196
4237
|
}
|
|
@@ -4493,11 +4534,11 @@ var init_native_bridge = __esm({
|
|
|
4493
4534
|
});
|
|
4494
4535
|
|
|
4495
4536
|
// packages/domain/scanner/src/cache-native.ts
|
|
4496
|
-
import
|
|
4497
|
-
import
|
|
4537
|
+
import fs7 from "fs";
|
|
4538
|
+
import path9 from "path";
|
|
4498
4539
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4499
|
-
const dir = cacheDir ?
|
|
4500
|
-
return
|
|
4540
|
+
const dir = cacheDir ? path9.resolve(rootDir, cacheDir) : path9.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4541
|
+
return path9.join(dir, "scanner-cache.json");
|
|
4501
4542
|
}
|
|
4502
4543
|
function metaPathFor(cachePath) {
|
|
4503
4544
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4510,7 +4551,7 @@ function getBinaryFingerprint() {
|
|
|
4510
4551
|
_cachedFingerprint = null;
|
|
4511
4552
|
return null;
|
|
4512
4553
|
}
|
|
4513
|
-
const stat =
|
|
4554
|
+
const stat = fs7.statSync(loadedPath);
|
|
4514
4555
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4515
4556
|
} catch {
|
|
4516
4557
|
_cachedFingerprint = null;
|
|
@@ -4519,13 +4560,13 @@ function getBinaryFingerprint() {
|
|
|
4519
4560
|
}
|
|
4520
4561
|
function readCache(rootDir, cacheDir) {
|
|
4521
4562
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4522
|
-
|
|
4563
|
+
fs7.mkdirSync(path9.dirname(cachePath), { recursive: true });
|
|
4523
4564
|
const currentFingerprint = getBinaryFingerprint();
|
|
4524
4565
|
if (currentFingerprint !== null) {
|
|
4525
4566
|
const metaPath = metaPathFor(cachePath);
|
|
4526
4567
|
let storedFingerprint = null;
|
|
4527
4568
|
try {
|
|
4528
|
-
storedFingerprint = JSON.parse(
|
|
4569
|
+
storedFingerprint = JSON.parse(fs7.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4529
4570
|
} catch {
|
|
4530
4571
|
}
|
|
4531
4572
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4549,7 +4590,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4549
4590
|
}
|
|
4550
4591
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4551
4592
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4552
|
-
|
|
4593
|
+
fs7.mkdirSync(path9.dirname(cachePath), { recursive: true });
|
|
4553
4594
|
const success = cacheWriteNative(cachePath, entries);
|
|
4554
4595
|
if (!success) {
|
|
4555
4596
|
throw new Error(
|
|
@@ -4559,7 +4600,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4559
4600
|
const currentFingerprint = getBinaryFingerprint();
|
|
4560
4601
|
if (currentFingerprint !== null) {
|
|
4561
4602
|
try {
|
|
4562
|
-
|
|
4603
|
+
fs7.writeFileSync(
|
|
4563
4604
|
metaPathFor(cachePath),
|
|
4564
4605
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4565
4606
|
"utf8"
|
|
@@ -4591,7 +4632,7 @@ var init_cache_native = __esm({
|
|
|
4591
4632
|
|
|
4592
4633
|
// packages/domain/scanner/src/parallel-scanner.ts
|
|
4593
4634
|
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
4594
|
-
import
|
|
4635
|
+
import path10 from "path";
|
|
4595
4636
|
import { availableParallelism } from "os";
|
|
4596
4637
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4597
4638
|
function collectFiles2(rootDir, extensions, ignoreDirs) {
|
|
@@ -4634,7 +4675,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4634
4675
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
4635
4676
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4636
4677
|
} = options;
|
|
4637
|
-
const files = collectFiles2(
|
|
4678
|
+
const files = collectFiles2(path10.resolve(rootDir), extensions, ignoreDirs);
|
|
4638
4679
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4639
4680
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4640
4681
|
}
|
|
@@ -4685,12 +4726,12 @@ var init_schemas = __esm({
|
|
|
4685
4726
|
"use strict";
|
|
4686
4727
|
init_esm_shims();
|
|
4687
4728
|
init_src();
|
|
4688
|
-
formatIssuePath2 = (
|
|
4729
|
+
formatIssuePath2 = (path18) => path18.length > 0 ? path18.map(
|
|
4689
4730
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4690
4731
|
).join(".") : "<root>";
|
|
4691
4732
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4692
|
-
const
|
|
4693
|
-
return `${
|
|
4733
|
+
const path18 = formatIssuePath2(issue.path);
|
|
4734
|
+
return `${path18}: ${issue.message}`;
|
|
4694
4735
|
}).join("; ");
|
|
4695
4736
|
parseWithSchema = (schema, data, label) => {
|
|
4696
4737
|
const parsed = schema.safeParse(data);
|
|
@@ -4762,9 +4803,9 @@ __export(src_exports2, {
|
|
|
4762
4803
|
scanWorkspace: () => scanWorkspace2,
|
|
4763
4804
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
4764
4805
|
});
|
|
4765
|
-
import
|
|
4806
|
+
import fs8 from "fs";
|
|
4766
4807
|
import { createRequire as createRequire6 } from "module";
|
|
4767
|
-
import
|
|
4808
|
+
import path11 from "path";
|
|
4768
4809
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
4769
4810
|
import { Worker as Worker2 } from "worker_threads";
|
|
4770
4811
|
function getRuntimeDir() {
|
|
@@ -4772,7 +4813,7 @@ function getRuntimeDir() {
|
|
|
4772
4813
|
return __dirname;
|
|
4773
4814
|
}
|
|
4774
4815
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4775
|
-
return
|
|
4816
|
+
return path11.dirname(fileURLToPath5(import.meta.url));
|
|
4776
4817
|
}
|
|
4777
4818
|
return process.cwd();
|
|
4778
4819
|
}
|
|
@@ -4782,17 +4823,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4782
4823
|
return __dirname;
|
|
4783
4824
|
}
|
|
4784
4825
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4785
|
-
return
|
|
4826
|
+
return path11.dirname(fileURLToPath5(import.meta.url));
|
|
4786
4827
|
}
|
|
4787
4828
|
return process.cwd();
|
|
4788
4829
|
})();
|
|
4789
4830
|
const candidates = [
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4831
|
+
path11.resolve(runtimeDir, "worker.cjs"),
|
|
4832
|
+
path11.resolve(runtimeDir, "worker.js"),
|
|
4833
|
+
path11.resolve(runtimeDir, "worker.ts")
|
|
4793
4834
|
];
|
|
4794
4835
|
for (const candidate of candidates) {
|
|
4795
|
-
if (
|
|
4836
|
+
if (fs8.existsSync(candidate)) return candidate;
|
|
4796
4837
|
}
|
|
4797
4838
|
return null;
|
|
4798
4839
|
}
|
|
@@ -4849,19 +4890,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4849
4890
|
if (!currentDir) continue;
|
|
4850
4891
|
const entries = (() => {
|
|
4851
4892
|
try {
|
|
4852
|
-
return
|
|
4893
|
+
return fs8.readdirSync(currentDir, { withFileTypes: true });
|
|
4853
4894
|
} catch {
|
|
4854
4895
|
return [];
|
|
4855
4896
|
}
|
|
4856
4897
|
})();
|
|
4857
4898
|
for (const entry of entries) {
|
|
4858
|
-
const fullPath =
|
|
4899
|
+
const fullPath = path11.join(currentDir, entry.name);
|
|
4859
4900
|
if (entry.isDirectory()) {
|
|
4860
4901
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4861
4902
|
continue;
|
|
4862
4903
|
}
|
|
4863
4904
|
if (!entry.isFile()) continue;
|
|
4864
|
-
if (!extensionSet.has(
|
|
4905
|
+
if (!extensionSet.has(path11.extname(entry.name))) continue;
|
|
4865
4906
|
candidates.push(fullPath);
|
|
4866
4907
|
}
|
|
4867
4908
|
}
|
|
@@ -4888,7 +4929,7 @@ function scanSource(source) {
|
|
|
4888
4929
|
);
|
|
4889
4930
|
}
|
|
4890
4931
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4891
|
-
return includeExtensions.includes(
|
|
4932
|
+
return includeExtensions.includes(path11.extname(filePath));
|
|
4892
4933
|
}
|
|
4893
4934
|
function scanFile2(filePath) {
|
|
4894
4935
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4948,7 +4989,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4948
4989
|
for (const filePath of candidates) {
|
|
4949
4990
|
const stat = (() => {
|
|
4950
4991
|
try {
|
|
4951
|
-
return
|
|
4992
|
+
return fs8.statSync(filePath);
|
|
4952
4993
|
} catch {
|
|
4953
4994
|
return null;
|
|
4954
4995
|
}
|
|
@@ -4974,7 +5015,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4974
5015
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4975
5016
|
const content = (() => {
|
|
4976
5017
|
try {
|
|
4977
|
-
return
|
|
5018
|
+
return fs8.readFileSync(filePath, "utf8");
|
|
4978
5019
|
} catch {
|
|
4979
5020
|
return null;
|
|
4980
5021
|
}
|
|
@@ -5080,7 +5121,7 @@ var init_src3 = __esm({
|
|
|
5080
5121
|
const loadNativeParserBinding = () => {
|
|
5081
5122
|
if (_state.binding !== void 0) return _state.binding;
|
|
5082
5123
|
const runtimeDir = getRuntimeDir();
|
|
5083
|
-
const req = createRequire6(
|
|
5124
|
+
const req = createRequire6(path11.join(runtimeDir, "noop.cjs"));
|
|
5084
5125
|
const _platform = process.platform;
|
|
5085
5126
|
const _arch = process.arch;
|
|
5086
5127
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -5088,27 +5129,27 @@ var init_src3 = __esm({
|
|
|
5088
5129
|
const candidates = [
|
|
5089
5130
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
5090
5131
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5132
|
+
path11.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
5133
|
+
path11.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5134
|
+
path11.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5094
5135
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
5095
5136
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5137
|
+
path11.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
5138
|
+
path11.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5139
|
+
path11.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5099
5140
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
5100
|
-
|
|
5101
|
-
|
|
5141
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5142
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5102
5143
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
5103
|
-
|
|
5104
|
-
|
|
5144
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5145
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5105
5146
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5147
|
+
path11.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5148
|
+
path11.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5149
|
+
path11.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5150
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5151
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5152
|
+
path11.resolve(
|
|
5112
5153
|
runtimeDir,
|
|
5113
5154
|
"..",
|
|
5114
5155
|
"..",
|
|
@@ -5120,7 +5161,7 @@ var init_src3 = __esm({
|
|
|
5120
5161
|
)
|
|
5121
5162
|
];
|
|
5122
5163
|
for (const fullPath of candidates) {
|
|
5123
|
-
if (!
|
|
5164
|
+
if (!fs8.existsSync(fullPath)) continue;
|
|
5124
5165
|
try {
|
|
5125
5166
|
const required = req(fullPath);
|
|
5126
5167
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -5253,13 +5294,13 @@ init_esm_shims();
|
|
|
5253
5294
|
// packages/presentation/vite/src/plugin.ts
|
|
5254
5295
|
init_esm_shims();
|
|
5255
5296
|
init_src2();
|
|
5256
|
-
import
|
|
5257
|
-
import
|
|
5297
|
+
import fs14 from "fs";
|
|
5298
|
+
import path17 from "path";
|
|
5258
5299
|
|
|
5259
5300
|
// packages/domain/engine/src/index.ts
|
|
5260
5301
|
init_esm_shims();
|
|
5261
|
-
import
|
|
5262
|
-
import
|
|
5302
|
+
import fs13 from "fs";
|
|
5303
|
+
import path16 from "path";
|
|
5263
5304
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
5264
5305
|
|
|
5265
5306
|
// packages/domain/analyzer/src/index.ts
|
|
@@ -5268,7 +5309,7 @@ init_esm_shims();
|
|
|
5268
5309
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5269
5310
|
init_esm_shims();
|
|
5270
5311
|
init_src3();
|
|
5271
|
-
import
|
|
5312
|
+
import path13 from "path";
|
|
5272
5313
|
|
|
5273
5314
|
// packages/domain/analyzer/src/binding.ts
|
|
5274
5315
|
init_esm_shims();
|
|
@@ -5277,7 +5318,7 @@ init_src();
|
|
|
5277
5318
|
// packages/domain/analyzer/src/utils.ts
|
|
5278
5319
|
init_esm_shims();
|
|
5279
5320
|
init_src();
|
|
5280
|
-
import
|
|
5321
|
+
import fs9 from "fs";
|
|
5281
5322
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5282
5323
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
5283
5324
|
var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
|
|
@@ -5291,7 +5332,7 @@ function isRecord(value) {
|
|
|
5291
5332
|
}
|
|
5292
5333
|
async function pathExists(filePath) {
|
|
5293
5334
|
try {
|
|
5294
|
-
await
|
|
5335
|
+
await fs9.promises.access(filePath, fs9.constants.F_OK);
|
|
5295
5336
|
return true;
|
|
5296
5337
|
} catch {
|
|
5297
5338
|
return false;
|
|
@@ -5392,7 +5433,7 @@ async function requireNativeBinding() {
|
|
|
5392
5433
|
init_esm_shims();
|
|
5393
5434
|
init_src();
|
|
5394
5435
|
import { z as z4 } from "zod";
|
|
5395
|
-
var formatIssuePath3 = (
|
|
5436
|
+
var formatIssuePath3 = (path18) => path18.length > 0 ? path18.map(
|
|
5396
5437
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
5397
5438
|
).join(".") : "<root>";
|
|
5398
5439
|
var isPlainObject = (value) => {
|
|
@@ -5401,8 +5442,8 @@ var isPlainObject = (value) => {
|
|
|
5401
5442
|
return proto === Object.prototype || proto === null;
|
|
5402
5443
|
};
|
|
5403
5444
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
5404
|
-
const
|
|
5405
|
-
return `${
|
|
5445
|
+
const path18 = formatIssuePath3(issue.path);
|
|
5446
|
+
return `${path18}: ${issue.message}`;
|
|
5406
5447
|
}).join("; ");
|
|
5407
5448
|
var parseWithSchema2 = (schema, data, label) => {
|
|
5408
5449
|
const parsed = schema.safeParse(data);
|
|
@@ -5493,8 +5534,8 @@ var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report,
|
|
|
5493
5534
|
|
|
5494
5535
|
// packages/domain/analyzer/src/semantic.ts
|
|
5495
5536
|
init_esm_shims();
|
|
5496
|
-
import
|
|
5497
|
-
import
|
|
5537
|
+
import fs10 from "fs";
|
|
5538
|
+
import path12 from "path";
|
|
5498
5539
|
import { pathToFileURL } from "url";
|
|
5499
5540
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
5500
5541
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -5515,11 +5556,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
5515
5556
|
};
|
|
5516
5557
|
};
|
|
5517
5558
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
5518
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
5559
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path12.extname(configPath).toLowerCase());
|
|
5519
5560
|
};
|
|
5520
5561
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
5521
5562
|
if (explicitPath) {
|
|
5522
|
-
const resolved =
|
|
5563
|
+
const resolved = path12.resolve(root, explicitPath);
|
|
5523
5564
|
if (!await pathExists(resolved)) return null;
|
|
5524
5565
|
return resolved;
|
|
5525
5566
|
}
|
|
@@ -5530,7 +5571,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
5530
5571
|
"tailwind.config.mjs"
|
|
5531
5572
|
];
|
|
5532
5573
|
for (const candidate of candidates) {
|
|
5533
|
-
const fullPath =
|
|
5574
|
+
const fullPath = path12.resolve(root, candidate);
|
|
5534
5575
|
if (await pathExists(fullPath)) return fullPath;
|
|
5535
5576
|
}
|
|
5536
5577
|
return null;
|
|
@@ -5584,7 +5625,7 @@ var collectCustomUtilities = (config) => {
|
|
|
5584
5625
|
return out;
|
|
5585
5626
|
};
|
|
5586
5627
|
var collectSafelistFromSource = async (configPath) => {
|
|
5587
|
-
const source = await
|
|
5628
|
+
const source = await fs10.promises.readFile(configPath, "utf8");
|
|
5588
5629
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
5589
5630
|
const allTokens = extractClassesNative2(source);
|
|
5590
5631
|
const hasSafelist = source.includes("safelist");
|
|
@@ -5611,7 +5652,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5611
5652
|
customUtilities: /* @__PURE__ */ new Set()
|
|
5612
5653
|
};
|
|
5613
5654
|
}
|
|
5614
|
-
const configStat = await
|
|
5655
|
+
const configStat = await fs10.promises.stat(configPath).catch(() => null);
|
|
5615
5656
|
if (configStat) {
|
|
5616
5657
|
const cached = tailwindConfigCache.get(configPath);
|
|
5617
5658
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -5770,7 +5811,7 @@ async function buildDistribution(usages, native) {
|
|
|
5770
5811
|
}
|
|
5771
5812
|
async function analyzeWorkspace(root, options = {}) {
|
|
5772
5813
|
const startedAtMs = Date.now();
|
|
5773
|
-
const resolvedRoot =
|
|
5814
|
+
const resolvedRoot = path13.resolve(root);
|
|
5774
5815
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
5775
5816
|
const scan = await (async () => {
|
|
5776
5817
|
const scanStartedAtMs = Date.now();
|
|
@@ -5883,8 +5924,8 @@ init_esm_shims();
|
|
|
5883
5924
|
init_src3();
|
|
5884
5925
|
init_src();
|
|
5885
5926
|
init_native_bridge2();
|
|
5886
|
-
import
|
|
5887
|
-
import
|
|
5927
|
+
import fs11 from "fs";
|
|
5928
|
+
import path14 from "path";
|
|
5888
5929
|
var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
5889
5930
|
var log5 = createLogger2("engine:incremental");
|
|
5890
5931
|
function rebuildWorkspaceResult2(byFile) {
|
|
@@ -5917,8 +5958,8 @@ function areClassSetsEqual(a, b) {
|
|
|
5917
5958
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
5918
5959
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
5919
5960
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
5920
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
5921
|
-
const normalizedPath =
|
|
5961
|
+
const byFile = new Map(previous.files.map((f) => [path14.resolve(f.file), f]));
|
|
5962
|
+
const normalizedPath = path14.resolve(filePath);
|
|
5922
5963
|
const native = getNativeEngineBinding();
|
|
5923
5964
|
if (!native?.processFileChange) {
|
|
5924
5965
|
throw new Error(
|
|
@@ -5934,7 +5975,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
5934
5975
|
}
|
|
5935
5976
|
log5.debug(`native change ${normalizedPath}`);
|
|
5936
5977
|
const scanned = scanFile2(normalizedPath);
|
|
5937
|
-
const content =
|
|
5978
|
+
const content = fs11.readFileSync(normalizedPath, "utf8");
|
|
5938
5979
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
5939
5980
|
const existing = byFile.get(normalizedPath);
|
|
5940
5981
|
if (diff && existing) {
|
|
@@ -6001,16 +6042,16 @@ var EngineMetricsCollector = class {
|
|
|
6001
6042
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6002
6043
|
init_esm_shims();
|
|
6003
6044
|
init_src();
|
|
6004
|
-
import
|
|
6005
|
-
import
|
|
6045
|
+
import fs12 from "fs";
|
|
6046
|
+
import path15 from "path";
|
|
6006
6047
|
import { performance } from "perf_hooks";
|
|
6007
6048
|
var _log = createLogger2("tw:metrics");
|
|
6008
6049
|
var METRICS_FILE_NAME = "metrics.json";
|
|
6009
6050
|
var CACHE_DIR = ".tw-cache";
|
|
6010
6051
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6011
6052
|
try {
|
|
6012
|
-
const cacheDir =
|
|
6013
|
-
|
|
6053
|
+
const cacheDir = path15.join(cwd, CACHE_DIR);
|
|
6054
|
+
fs12.mkdirSync(cacheDir, { recursive: true });
|
|
6014
6055
|
const mem = process.memoryUsage();
|
|
6015
6056
|
const data = {
|
|
6016
6057
|
...metrics,
|
|
@@ -6021,7 +6062,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6021
6062
|
},
|
|
6022
6063
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6023
6064
|
};
|
|
6024
|
-
|
|
6065
|
+
fs12.writeFileSync(path15.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6025
6066
|
} catch {
|
|
6026
6067
|
}
|
|
6027
6068
|
}
|
|
@@ -6226,8 +6267,8 @@ var configState = {
|
|
|
6226
6267
|
var log6 = createLogger2("engine");
|
|
6227
6268
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
6228
6269
|
if (!tailwindConfigPath) return void 0;
|
|
6229
|
-
const configPath =
|
|
6230
|
-
if (!
|
|
6270
|
+
const configPath = path16.resolve(root, tailwindConfigPath);
|
|
6271
|
+
if (!fs13.existsSync(configPath)) {
|
|
6231
6272
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
6232
6273
|
}
|
|
6233
6274
|
const imported = await import(pathToFileURL2(configPath).href);
|
|
@@ -6293,11 +6334,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
6293
6334
|
};
|
|
6294
6335
|
}
|
|
6295
6336
|
function countWorkspacePackages(root) {
|
|
6296
|
-
const packagesDir =
|
|
6297
|
-
if (!
|
|
6337
|
+
const packagesDir = path16.join(root, "packages");
|
|
6338
|
+
if (!fs13.existsSync(packagesDir)) return 0;
|
|
6298
6339
|
try {
|
|
6299
|
-
return
|
|
6300
|
-
(entry) => entry.isDirectory() &&
|
|
6340
|
+
return fs13.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
6341
|
+
(entry) => entry.isDirectory() && fs13.existsSync(path16.join(packagesDir, entry.name, "package.json"))
|
|
6301
6342
|
).length;
|
|
6302
6343
|
} catch (err) {
|
|
6303
6344
|
log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -6334,7 +6375,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
6334
6375
|
async function createEngine(rawOptions = {}) {
|
|
6335
6376
|
const options = parseEngineOptions(rawOptions);
|
|
6336
6377
|
const root = options.root ?? process.cwd();
|
|
6337
|
-
const resolvedRoot =
|
|
6378
|
+
const resolvedRoot = path16.resolve(root);
|
|
6338
6379
|
const plugins = rawOptions.plugins ?? [];
|
|
6339
6380
|
const getTailwindConfig = async () => {
|
|
6340
6381
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -6481,7 +6522,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6481
6522
|
const shouldForceFullRescan = (event) => {
|
|
6482
6523
|
if (event.type === "unlink") return false;
|
|
6483
6524
|
try {
|
|
6484
|
-
const stat =
|
|
6525
|
+
const stat = fs13.statSync(event.filePath);
|
|
6485
6526
|
if (stat.size > largeFileThreshold) {
|
|
6486
6527
|
metrics.markSkippedLargeFile();
|
|
6487
6528
|
return true;
|
|
@@ -6603,7 +6644,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6603
6644
|
init_esm_shims();
|
|
6604
6645
|
init_src();
|
|
6605
6646
|
import { z as z6 } from "zod";
|
|
6606
|
-
var formatIssuePath4 = (
|
|
6647
|
+
var formatIssuePath4 = (path18) => path18.length > 0 ? path18.map(
|
|
6607
6648
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
6608
6649
|
).join(".") : "<root>";
|
|
6609
6650
|
var formatIssues4 = (error) => error.issues.map((issue) => {
|
|
@@ -6649,14 +6690,14 @@ function warnDeprecated(options, key, message) {
|
|
|
6649
6690
|
}
|
|
6650
6691
|
}
|
|
6651
6692
|
function isInsideDirectory(filePath, directory) {
|
|
6652
|
-
const relative =
|
|
6653
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
6693
|
+
const relative = path17.relative(directory, filePath);
|
|
6694
|
+
return relative === "" || !relative.startsWith("..") && !path17.isAbsolute(relative);
|
|
6654
6695
|
}
|
|
6655
6696
|
function filterScanToDirs(scan, root, scanDirs) {
|
|
6656
|
-
const resolvedDirs = scanDirs.map((dir) =>
|
|
6697
|
+
const resolvedDirs = scanDirs.map((dir) => path17.resolve(root, dir));
|
|
6657
6698
|
if (resolvedDirs.length === 0) return scan;
|
|
6658
6699
|
const files = scan.files.filter((file) => {
|
|
6659
|
-
const absoluteFile =
|
|
6700
|
+
const absoluteFile = path17.resolve(file.file);
|
|
6660
6701
|
return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
|
|
6661
6702
|
});
|
|
6662
6703
|
const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
|
|
@@ -6667,9 +6708,9 @@ function filterScanToDirs(scan, root, scanDirs) {
|
|
|
6667
6708
|
};
|
|
6668
6709
|
}
|
|
6669
6710
|
function writeJsonArtifact(root, relativePath, value) {
|
|
6670
|
-
const outputPath =
|
|
6671
|
-
|
|
6672
|
-
|
|
6711
|
+
const outputPath = path17.resolve(root, relativePath);
|
|
6712
|
+
fs14.mkdirSync(path17.dirname(outputPath), { recursive: true });
|
|
6713
|
+
fs14.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
|
|
6673
6714
|
`);
|
|
6674
6715
|
}
|
|
6675
6716
|
function tailwindStyledPlugin(opts = {}) {
|
|
@@ -6710,7 +6751,7 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6710
6751
|
return rules.join("\n");
|
|
6711
6752
|
}
|
|
6712
6753
|
function getStaticCssOutputPath(root, safelistOutputPath) {
|
|
6713
|
-
return
|
|
6754
|
+
return path17.resolve(root, path17.dirname(safelistOutputPath), "_tw-state-static.css");
|
|
6714
6755
|
}
|
|
6715
6756
|
function flushStaticCss(root) {
|
|
6716
6757
|
if (staticCssPerFile.size === 0) return;
|
|
@@ -6719,8 +6760,8 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6719
6760
|
if (!deduped.trim()) return;
|
|
6720
6761
|
const outPath = getStaticCssOutputPath(root, safelistOutput);
|
|
6721
6762
|
try {
|
|
6722
|
-
|
|
6723
|
-
|
|
6763
|
+
fs14.mkdirSync(path17.dirname(outPath), { recursive: true });
|
|
6764
|
+
fs14.writeFileSync(
|
|
6724
6765
|
outPath,
|
|
6725
6766
|
`/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
|
|
6726
6767
|
* Import this in globals.css: @import "./_tw-state-static.css";
|
|
@@ -6752,17 +6793,17 @@ ${deduped}
|
|
|
6752
6793
|
"src/style.css"
|
|
6753
6794
|
];
|
|
6754
6795
|
for (const candidate of CSS_CANDIDATES) {
|
|
6755
|
-
const candidatePath =
|
|
6756
|
-
if (!
|
|
6757
|
-
const content =
|
|
6796
|
+
const candidatePath = path17.resolve(config.root, candidate);
|
|
6797
|
+
if (!fs14.existsSync(candidatePath)) continue;
|
|
6798
|
+
const content = fs14.readFileSync(candidatePath, "utf-8");
|
|
6758
6799
|
if (content.includes("_tw-state-static.css")) break;
|
|
6759
|
-
const rel =
|
|
6800
|
+
const rel = path17.relative(path17.dirname(candidatePath), outPath).replace(/\\/g, "/");
|
|
6760
6801
|
const importLine = `@import "./${rel}";`;
|
|
6761
6802
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
6762
6803
|
const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
|
|
6763
6804
|
`) : `${importLine}
|
|
6764
6805
|
${content}`;
|
|
6765
|
-
|
|
6806
|
+
fs14.writeFileSync(candidatePath, updated, "utf-8");
|
|
6766
6807
|
break;
|
|
6767
6808
|
}
|
|
6768
6809
|
} catch {
|