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.js
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 path17 = first?.path?.join(".") ?? "(root)";
|
|
234
234
|
throw new Error(
|
|
235
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
235
|
+
`[${context}] Native binding returned unexpected data: ${path17}: ${first?.message ?? "validation failed"}`
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
return result.data;
|
|
@@ -667,11 +667,11 @@ function resolvePath(...segments) {
|
|
|
667
667
|
return segments.join("/").replace(/\/+/g, "/");
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
function existsSync(
|
|
670
|
+
function existsSync(path17) {
|
|
671
671
|
if (isBrowser2) return false;
|
|
672
672
|
try {
|
|
673
673
|
const nodeFs = require(NODE_FS);
|
|
674
|
-
return nodeFs.existsSync(
|
|
674
|
+
return nodeFs.existsSync(path17);
|
|
675
675
|
} catch {
|
|
676
676
|
return false;
|
|
677
677
|
}
|
|
@@ -1026,9 +1026,9 @@ var init_native_resolution = __esm({
|
|
|
1026
1026
|
// packages/domain/shared/src/observability.ts
|
|
1027
1027
|
function createObservabilityClient(opts = {}) {
|
|
1028
1028
|
const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
|
|
1029
|
-
async function fetchJson(
|
|
1029
|
+
async function fetchJson(path17) {
|
|
1030
1030
|
try {
|
|
1031
|
-
const res = await fetch(`${baseUrl}${
|
|
1031
|
+
const res = await fetch(`${baseUrl}${path17}`, {
|
|
1032
1032
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1033
1033
|
});
|
|
1034
1034
|
if (!res.ok) return null;
|
|
@@ -2860,6 +2860,7 @@ __export(internal_exports, {
|
|
|
2860
2860
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2861
2861
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2862
2862
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
2863
|
+
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
2863
2864
|
getAllRoutes: () => getAllRoutes,
|
|
2864
2865
|
getBucketEngine: () => getBucketEngine,
|
|
2865
2866
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
@@ -2962,6 +2963,7 @@ __export(internal_exports, {
|
|
|
2962
2963
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
2963
2964
|
resetMemoryStats: () => resetMemoryStats,
|
|
2964
2965
|
resetResolverPoolStats: () => resetResolverPoolStats,
|
|
2966
|
+
resetRouteClassRegistry: () => resetRouteClassRegistry,
|
|
2965
2967
|
resolveCascade: () => resolveCascade,
|
|
2966
2968
|
resolveClassNames: () => resolveClassNames,
|
|
2967
2969
|
resolveColorCached: () => resolveColorCached,
|
|
@@ -3451,9 +3453,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3451
3453
|
}
|
|
3452
3454
|
};
|
|
3453
3455
|
}
|
|
3454
|
-
function formatIssuePath(
|
|
3455
|
-
if (!
|
|
3456
|
-
return
|
|
3456
|
+
function formatIssuePath(path17) {
|
|
3457
|
+
if (!path17 || path17.length === 0) return "(root)";
|
|
3458
|
+
return path17.map(
|
|
3457
3459
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3458
3460
|
).join(".");
|
|
3459
3461
|
}
|
|
@@ -3597,8 +3599,8 @@ var init_src = __esm({
|
|
|
3597
3599
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3598
3600
|
static fromZod(err) {
|
|
3599
3601
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3600
|
-
const
|
|
3601
|
-
const message = first ? `${
|
|
3602
|
+
const path17 = formatIssuePath(first?.path);
|
|
3603
|
+
const message = first ? `${path17}: ${first.message}` : "Schema validation failed";
|
|
3602
3604
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3603
3605
|
}
|
|
3604
3606
|
static wrap(source, code, err) {
|
|
@@ -3670,7 +3672,7 @@ var init_nativeBridge = __esm({
|
|
|
3670
3672
|
"use strict";
|
|
3671
3673
|
init_cjs_shims();
|
|
3672
3674
|
init_src();
|
|
3673
|
-
_loadNative = (
|
|
3675
|
+
_loadNative = (path17) => require(path17);
|
|
3674
3676
|
log = (...args) => {
|
|
3675
3677
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
3676
3678
|
console.log("[compiler:native]", ...args);
|
|
@@ -3773,6 +3775,17 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
3773
3775
|
}
|
|
3774
3776
|
});
|
|
3775
3777
|
|
|
3778
|
+
// packages/domain/compiler/src/routeGraph.ts
|
|
3779
|
+
var import_node_fs4, import_node_path4;
|
|
3780
|
+
var init_routeGraph = __esm({
|
|
3781
|
+
"packages/domain/compiler/src/routeGraph.ts"() {
|
|
3782
|
+
"use strict";
|
|
3783
|
+
init_cjs_shims();
|
|
3784
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
3785
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
|
|
3776
3789
|
// packages/domain/compiler/src/index.ts
|
|
3777
3790
|
function _layoutClassesToCss(classes) {
|
|
3778
3791
|
const native = getNativeBridge();
|
|
@@ -3808,13 +3821,13 @@ function extractContainerCssFromSource(source) {
|
|
|
3808
3821
|
}
|
|
3809
3822
|
return rules.join("\n");
|
|
3810
3823
|
}
|
|
3811
|
-
var
|
|
3824
|
+
var import_node_fs5, import_node_path5, import_node_module5, _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;
|
|
3812
3825
|
var init_src2 = __esm({
|
|
3813
3826
|
"packages/domain/compiler/src/index.ts"() {
|
|
3814
3827
|
"use strict";
|
|
3815
3828
|
init_cjs_shims();
|
|
3816
|
-
|
|
3817
|
-
|
|
3829
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
3830
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
3818
3831
|
import_node_module5 = require("module");
|
|
3819
3832
|
init_nativeBridge();
|
|
3820
3833
|
init_compiler();
|
|
@@ -3823,6 +3836,7 @@ var init_src2 = __esm({
|
|
|
3823
3836
|
init_cache();
|
|
3824
3837
|
init_redis();
|
|
3825
3838
|
init_watch();
|
|
3839
|
+
init_routeGraph();
|
|
3826
3840
|
_require3 = (0, import_node_module5.createRequire)(
|
|
3827
3841
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
3828
3842
|
);
|
|
@@ -3917,7 +3931,7 @@ var init_src2 = __esm({
|
|
|
3917
3931
|
};
|
|
3918
3932
|
scanProjectUsage = (dirs, cwd) => {
|
|
3919
3933
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
3920
|
-
const files = dirs.map((dir) =>
|
|
3934
|
+
const files = dirs.map((dir) => import_node_path5.default.resolve(cwd, dir));
|
|
3921
3935
|
const results = batchExtractClasses2(files) || [];
|
|
3922
3936
|
const combined = {};
|
|
3923
3937
|
for (const result of results) {
|
|
@@ -3934,13 +3948,13 @@ var init_src2 = __esm({
|
|
|
3934
3948
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3935
3949
|
const allClasses = Object.keys(classes).sort();
|
|
3936
3950
|
if (outputPath) {
|
|
3937
|
-
|
|
3951
|
+
import_node_fs5.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3938
3952
|
}
|
|
3939
3953
|
return allClasses;
|
|
3940
3954
|
};
|
|
3941
3955
|
loadSafelist = (safelistPath) => {
|
|
3942
3956
|
try {
|
|
3943
|
-
const content =
|
|
3957
|
+
const content = import_node_fs5.default.readFileSync(safelistPath, "utf-8");
|
|
3944
3958
|
return JSON.parse(content);
|
|
3945
3959
|
} catch {
|
|
3946
3960
|
return [];
|
|
@@ -3954,8 +3968,8 @@ var init_src2 = __esm({
|
|
|
3954
3968
|
"tailwind.config.cjs"
|
|
3955
3969
|
];
|
|
3956
3970
|
for (const file of configFiles) {
|
|
3957
|
-
const fullPath =
|
|
3958
|
-
if (
|
|
3971
|
+
const fullPath = import_node_path5.default.join(cwd, file);
|
|
3972
|
+
if (import_node_fs5.default.existsSync(fullPath)) {
|
|
3959
3973
|
const mod = require(fullPath);
|
|
3960
3974
|
return mod.default || mod;
|
|
3961
3975
|
}
|
|
@@ -3965,9 +3979,9 @@ var init_src2 = __esm({
|
|
|
3965
3979
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3966
3980
|
return {
|
|
3967
3981
|
content: [
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3982
|
+
import_node_path5.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3983
|
+
import_node_path5.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3984
|
+
import_node_path5.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3971
3985
|
]
|
|
3972
3986
|
};
|
|
3973
3987
|
};
|
|
@@ -4038,10 +4052,38 @@ var init_src2 = __esm({
|
|
|
4038
4052
|
}
|
|
4039
4053
|
return ["/", "__global"];
|
|
4040
4054
|
};
|
|
4041
|
-
|
|
4042
|
-
|
|
4055
|
+
_fileClassesMap = /* @__PURE__ */ new Map();
|
|
4056
|
+
_globalClasses = /* @__PURE__ */ new Set();
|
|
4057
|
+
getRouteClasses = (route) => {
|
|
4058
|
+
const result = /* @__PURE__ */ new Set();
|
|
4059
|
+
for (const [filepath, classes] of _fileClassesMap) {
|
|
4060
|
+
const fileRoute = fileToRoute(filepath) ?? "__global";
|
|
4061
|
+
if (fileRoute === route) {
|
|
4062
|
+
for (const cls of classes) result.add(cls);
|
|
4063
|
+
}
|
|
4064
|
+
}
|
|
4065
|
+
return result;
|
|
4066
|
+
};
|
|
4067
|
+
getAllRegisteredClasses = () => {
|
|
4068
|
+
const result = new Set(_globalClasses);
|
|
4069
|
+
for (const classes of _fileClassesMap.values()) {
|
|
4070
|
+
for (const cls of classes) result.add(cls);
|
|
4071
|
+
}
|
|
4072
|
+
return result;
|
|
4073
|
+
};
|
|
4074
|
+
registerFileClasses = (filepath, classes) => {
|
|
4075
|
+
if (!classes || classes.length === 0) {
|
|
4076
|
+
_fileClassesMap.delete(filepath);
|
|
4077
|
+
return;
|
|
4078
|
+
}
|
|
4079
|
+
_fileClassesMap.set(filepath, new Set(classes));
|
|
4043
4080
|
};
|
|
4044
|
-
registerGlobalClasses = (
|
|
4081
|
+
registerGlobalClasses = (classes) => {
|
|
4082
|
+
for (const cls of classes) _globalClasses.add(cls);
|
|
4083
|
+
};
|
|
4084
|
+
resetRouteClassRegistry = () => {
|
|
4085
|
+
_fileClassesMap.clear();
|
|
4086
|
+
_globalClasses.clear();
|
|
4045
4087
|
};
|
|
4046
4088
|
_incrementalEngineInstance = null;
|
|
4047
4089
|
getIncrementalEngine = () => {
|
|
@@ -4192,7 +4234,7 @@ function getDirname2() {
|
|
|
4192
4234
|
return __dirname;
|
|
4193
4235
|
}
|
|
4194
4236
|
if (typeof import_meta4 !== "undefined" && importMetaUrl) {
|
|
4195
|
-
return
|
|
4237
|
+
return import_node_path6.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
4196
4238
|
}
|
|
4197
4239
|
return process.cwd();
|
|
4198
4240
|
}
|
|
@@ -4404,12 +4446,12 @@ function hasNativeWatchBinding() {
|
|
|
4404
4446
|
return false;
|
|
4405
4447
|
}
|
|
4406
4448
|
}
|
|
4407
|
-
var
|
|
4449
|
+
var import_node_path6, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4408
4450
|
var init_native_bridge = __esm({
|
|
4409
4451
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4410
4452
|
"use strict";
|
|
4411
4453
|
init_cjs_shims();
|
|
4412
|
-
|
|
4454
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4413
4455
|
import_node_url2 = require("url");
|
|
4414
4456
|
init_src();
|
|
4415
4457
|
import_meta4 = {};
|
|
@@ -4499,8 +4541,8 @@ var init_native_bridge = __esm({
|
|
|
4499
4541
|
|
|
4500
4542
|
// packages/domain/scanner/src/cache-native.ts
|
|
4501
4543
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4502
|
-
const dir = cacheDir ?
|
|
4503
|
-
return
|
|
4544
|
+
const dir = cacheDir ? import_node_path7.default.resolve(rootDir, cacheDir) : import_node_path7.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4545
|
+
return import_node_path7.default.join(dir, "scanner-cache.json");
|
|
4504
4546
|
}
|
|
4505
4547
|
function metaPathFor(cachePath) {
|
|
4506
4548
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4513,7 +4555,7 @@ function getBinaryFingerprint() {
|
|
|
4513
4555
|
_cachedFingerprint = null;
|
|
4514
4556
|
return null;
|
|
4515
4557
|
}
|
|
4516
|
-
const stat =
|
|
4558
|
+
const stat = import_node_fs6.default.statSync(loadedPath);
|
|
4517
4559
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4518
4560
|
} catch {
|
|
4519
4561
|
_cachedFingerprint = null;
|
|
@@ -4522,13 +4564,13 @@ function getBinaryFingerprint() {
|
|
|
4522
4564
|
}
|
|
4523
4565
|
function readCache(rootDir, cacheDir) {
|
|
4524
4566
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4525
|
-
|
|
4567
|
+
import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
|
|
4526
4568
|
const currentFingerprint = getBinaryFingerprint();
|
|
4527
4569
|
if (currentFingerprint !== null) {
|
|
4528
4570
|
const metaPath = metaPathFor(cachePath);
|
|
4529
4571
|
let storedFingerprint = null;
|
|
4530
4572
|
try {
|
|
4531
|
-
storedFingerprint = JSON.parse(
|
|
4573
|
+
storedFingerprint = JSON.parse(import_node_fs6.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4532
4574
|
} catch {
|
|
4533
4575
|
}
|
|
4534
4576
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4552,7 +4594,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4552
4594
|
}
|
|
4553
4595
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4554
4596
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4555
|
-
|
|
4597
|
+
import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
|
|
4556
4598
|
const success = cacheWriteNative(cachePath, entries);
|
|
4557
4599
|
if (!success) {
|
|
4558
4600
|
throw new Error(
|
|
@@ -4562,7 +4604,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4562
4604
|
const currentFingerprint = getBinaryFingerprint();
|
|
4563
4605
|
if (currentFingerprint !== null) {
|
|
4564
4606
|
try {
|
|
4565
|
-
|
|
4607
|
+
import_node_fs6.default.writeFileSync(
|
|
4566
4608
|
metaPathFor(cachePath),
|
|
4567
4609
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4568
4610
|
"utf8"
|
|
@@ -4582,13 +4624,13 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4582
4624
|
nowMs
|
|
4583
4625
|
);
|
|
4584
4626
|
}
|
|
4585
|
-
var
|
|
4627
|
+
var import_node_fs6, import_node_path7, _cachedFingerprint, STALE_THRESHOLD_MS;
|
|
4586
4628
|
var init_cache_native = __esm({
|
|
4587
4629
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4588
4630
|
"use strict";
|
|
4589
4631
|
init_cjs_shims();
|
|
4590
|
-
|
|
4591
|
-
|
|
4632
|
+
import_node_fs6 = __toESM(require("fs"), 1);
|
|
4633
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
4592
4634
|
init_native_bridge();
|
|
4593
4635
|
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4594
4636
|
}
|
|
@@ -4635,7 +4677,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4635
4677
|
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
4636
4678
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4637
4679
|
} = options;
|
|
4638
|
-
const files = collectFiles2(
|
|
4680
|
+
const files = collectFiles2(import_node_path8.default.resolve(rootDir), extensions, ignoreDirs);
|
|
4639
4681
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4640
4682
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4641
4683
|
}
|
|
@@ -4651,13 +4693,13 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4651
4693
|
}
|
|
4652
4694
|
return mergeResults(allResults);
|
|
4653
4695
|
}
|
|
4654
|
-
var import_node_worker_threads,
|
|
4696
|
+
var import_node_worker_threads, import_node_path8, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4655
4697
|
var init_parallel_scanner = __esm({
|
|
4656
4698
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4657
4699
|
"use strict";
|
|
4658
4700
|
init_cjs_shims();
|
|
4659
4701
|
import_node_worker_threads = require("worker_threads");
|
|
4660
|
-
|
|
4702
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
4661
4703
|
import_node_os = require("os");
|
|
4662
4704
|
import_node_url3 = require("url");
|
|
4663
4705
|
init_src3();
|
|
@@ -4690,12 +4732,12 @@ var init_schemas = __esm({
|
|
|
4690
4732
|
init_cjs_shims();
|
|
4691
4733
|
import_zod3 = require("zod");
|
|
4692
4734
|
init_src();
|
|
4693
|
-
formatIssuePath2 = (
|
|
4735
|
+
formatIssuePath2 = (path17) => path17.length > 0 ? path17.map(
|
|
4694
4736
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4695
4737
|
).join(".") : "<root>";
|
|
4696
4738
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4697
|
-
const
|
|
4698
|
-
return `${
|
|
4739
|
+
const path17 = formatIssuePath2(issue.path);
|
|
4740
|
+
return `${path17}: ${issue.message}`;
|
|
4699
4741
|
}).join("; ");
|
|
4700
4742
|
parseWithSchema = (schema, data, label) => {
|
|
4701
4743
|
const parsed = schema.safeParse(data);
|
|
@@ -4772,7 +4814,7 @@ function getRuntimeDir() {
|
|
|
4772
4814
|
return __dirname;
|
|
4773
4815
|
}
|
|
4774
4816
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4775
|
-
return
|
|
4817
|
+
return import_node_path9.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4776
4818
|
}
|
|
4777
4819
|
return process.cwd();
|
|
4778
4820
|
}
|
|
@@ -4782,17 +4824,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4782
4824
|
return __dirname;
|
|
4783
4825
|
}
|
|
4784
4826
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4785
|
-
return
|
|
4827
|
+
return import_node_path9.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4786
4828
|
}
|
|
4787
4829
|
return process.cwd();
|
|
4788
4830
|
})();
|
|
4789
4831
|
const candidates = [
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4832
|
+
import_node_path9.default.resolve(runtimeDir, "worker.cjs"),
|
|
4833
|
+
import_node_path9.default.resolve(runtimeDir, "worker.js"),
|
|
4834
|
+
import_node_path9.default.resolve(runtimeDir, "worker.ts")
|
|
4793
4835
|
];
|
|
4794
4836
|
for (const candidate of candidates) {
|
|
4795
|
-
if (
|
|
4837
|
+
if (import_node_fs7.default.existsSync(candidate)) return candidate;
|
|
4796
4838
|
}
|
|
4797
4839
|
return null;
|
|
4798
4840
|
}
|
|
@@ -4849,19 +4891,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4849
4891
|
if (!currentDir) continue;
|
|
4850
4892
|
const entries = (() => {
|
|
4851
4893
|
try {
|
|
4852
|
-
return
|
|
4894
|
+
return import_node_fs7.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4853
4895
|
} catch {
|
|
4854
4896
|
return [];
|
|
4855
4897
|
}
|
|
4856
4898
|
})();
|
|
4857
4899
|
for (const entry of entries) {
|
|
4858
|
-
const fullPath =
|
|
4900
|
+
const fullPath = import_node_path9.default.join(currentDir, entry.name);
|
|
4859
4901
|
if (entry.isDirectory()) {
|
|
4860
4902
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4861
4903
|
continue;
|
|
4862
4904
|
}
|
|
4863
4905
|
if (!entry.isFile()) continue;
|
|
4864
|
-
if (!extensionSet.has(
|
|
4906
|
+
if (!extensionSet.has(import_node_path9.default.extname(entry.name))) continue;
|
|
4865
4907
|
candidates.push(fullPath);
|
|
4866
4908
|
}
|
|
4867
4909
|
}
|
|
@@ -4888,7 +4930,7 @@ function scanSource(source) {
|
|
|
4888
4930
|
);
|
|
4889
4931
|
}
|
|
4890
4932
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4891
|
-
return includeExtensions.includes(
|
|
4933
|
+
return includeExtensions.includes(import_node_path9.default.extname(filePath));
|
|
4892
4934
|
}
|
|
4893
4935
|
function scanFile2(filePath) {
|
|
4894
4936
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4948,7 +4990,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4948
4990
|
for (const filePath of candidates) {
|
|
4949
4991
|
const stat = (() => {
|
|
4950
4992
|
try {
|
|
4951
|
-
return
|
|
4993
|
+
return import_node_fs7.default.statSync(filePath);
|
|
4952
4994
|
} catch {
|
|
4953
4995
|
return null;
|
|
4954
4996
|
}
|
|
@@ -4974,7 +5016,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4974
5016
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4975
5017
|
const content = (() => {
|
|
4976
5018
|
try {
|
|
4977
|
-
return
|
|
5019
|
+
return import_node_fs7.default.readFileSync(filePath, "utf8");
|
|
4978
5020
|
} catch {
|
|
4979
5021
|
return null;
|
|
4980
5022
|
}
|
|
@@ -5055,14 +5097,14 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
5055
5097
|
return scanWorkspace2(rootDir, normalizedOptions);
|
|
5056
5098
|
}
|
|
5057
5099
|
}
|
|
5058
|
-
var
|
|
5100
|
+
var import_node_fs7, import_node_module6, import_node_path9, import_node_url4, import_node_worker_threads2, import_meta5, log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
5059
5101
|
var init_src3 = __esm({
|
|
5060
5102
|
"packages/domain/scanner/src/index.ts"() {
|
|
5061
5103
|
"use strict";
|
|
5062
5104
|
init_cjs_shims();
|
|
5063
|
-
|
|
5105
|
+
import_node_fs7 = __toESM(require("fs"), 1);
|
|
5064
5106
|
import_node_module6 = require("module");
|
|
5065
|
-
|
|
5107
|
+
import_node_path9 = __toESM(require("path"), 1);
|
|
5066
5108
|
import_node_url4 = require("url");
|
|
5067
5109
|
import_node_worker_threads2 = require("worker_threads");
|
|
5068
5110
|
init_src();
|
|
@@ -5086,7 +5128,7 @@ var init_src3 = __esm({
|
|
|
5086
5128
|
const loadNativeParserBinding = () => {
|
|
5087
5129
|
if (_state.binding !== void 0) return _state.binding;
|
|
5088
5130
|
const runtimeDir = getRuntimeDir();
|
|
5089
|
-
const req = (0, import_node_module6.createRequire)(
|
|
5131
|
+
const req = (0, import_node_module6.createRequire)(import_node_path9.default.join(runtimeDir, "noop.cjs"));
|
|
5090
5132
|
const _platform = process.platform;
|
|
5091
5133
|
const _arch = process.arch;
|
|
5092
5134
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -5094,27 +5136,27 @@ var init_src3 = __esm({
|
|
|
5094
5136
|
const candidates = [
|
|
5095
5137
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
5096
5138
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5139
|
+
import_node_path9.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
5140
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5141
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5100
5142
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
5101
5143
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5144
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
5145
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5146
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5105
5147
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
5106
|
-
|
|
5107
|
-
|
|
5148
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5149
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5108
5150
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
5109
|
-
|
|
5110
|
-
|
|
5151
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5152
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5111
5153
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5154
|
+
import_node_path9.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5155
|
+
import_node_path9.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5156
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5157
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5158
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5159
|
+
import_node_path9.default.resolve(
|
|
5118
5160
|
runtimeDir,
|
|
5119
5161
|
"..",
|
|
5120
5162
|
"..",
|
|
@@ -5126,7 +5168,7 @@ var init_src3 = __esm({
|
|
|
5126
5168
|
)
|
|
5127
5169
|
];
|
|
5128
5170
|
for (const fullPath of candidates) {
|
|
5129
|
-
if (!
|
|
5171
|
+
if (!import_node_fs7.default.existsSync(fullPath)) continue;
|
|
5130
5172
|
try {
|
|
5131
5173
|
const required = req(fullPath);
|
|
5132
5174
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -5264,14 +5306,14 @@ init_cjs_shims();
|
|
|
5264
5306
|
|
|
5265
5307
|
// packages/presentation/vite/src/plugin.ts
|
|
5266
5308
|
init_cjs_shims();
|
|
5267
|
-
var
|
|
5268
|
-
var
|
|
5309
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
5310
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
5269
5311
|
init_src2();
|
|
5270
5312
|
|
|
5271
5313
|
// packages/domain/engine/src/index.ts
|
|
5272
5314
|
init_cjs_shims();
|
|
5273
|
-
var
|
|
5274
|
-
var
|
|
5315
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
5316
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
5275
5317
|
var import_node_url6 = require("url");
|
|
5276
5318
|
|
|
5277
5319
|
// packages/domain/analyzer/src/index.ts
|
|
@@ -5279,7 +5321,7 @@ init_cjs_shims();
|
|
|
5279
5321
|
|
|
5280
5322
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5281
5323
|
init_cjs_shims();
|
|
5282
|
-
var
|
|
5324
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
5283
5325
|
init_src3();
|
|
5284
5326
|
|
|
5285
5327
|
// packages/domain/analyzer/src/binding.ts
|
|
@@ -5288,7 +5330,7 @@ init_src();
|
|
|
5288
5330
|
|
|
5289
5331
|
// packages/domain/analyzer/src/utils.ts
|
|
5290
5332
|
init_cjs_shims();
|
|
5291
|
-
var
|
|
5333
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
5292
5334
|
init_src();
|
|
5293
5335
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5294
5336
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -5303,7 +5345,7 @@ function isRecord(value) {
|
|
|
5303
5345
|
}
|
|
5304
5346
|
async function pathExists(filePath) {
|
|
5305
5347
|
try {
|
|
5306
|
-
await
|
|
5348
|
+
await import_node_fs8.default.promises.access(filePath, import_node_fs8.default.constants.F_OK);
|
|
5307
5349
|
return true;
|
|
5308
5350
|
} catch {
|
|
5309
5351
|
return false;
|
|
@@ -5404,7 +5446,7 @@ async function requireNativeBinding() {
|
|
|
5404
5446
|
init_cjs_shims();
|
|
5405
5447
|
init_src();
|
|
5406
5448
|
var import_zod4 = require("zod");
|
|
5407
|
-
var formatIssuePath3 = (
|
|
5449
|
+
var formatIssuePath3 = (path17) => path17.length > 0 ? path17.map(
|
|
5408
5450
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
5409
5451
|
).join(".") : "<root>";
|
|
5410
5452
|
var isPlainObject = (value) => {
|
|
@@ -5413,8 +5455,8 @@ var isPlainObject = (value) => {
|
|
|
5413
5455
|
return proto === Object.prototype || proto === null;
|
|
5414
5456
|
};
|
|
5415
5457
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
5416
|
-
const
|
|
5417
|
-
return `${
|
|
5458
|
+
const path17 = formatIssuePath3(issue.path);
|
|
5459
|
+
return `${path17}: ${issue.message}`;
|
|
5418
5460
|
}).join("; ");
|
|
5419
5461
|
var parseWithSchema2 = (schema, data, label) => {
|
|
5420
5462
|
const parsed = schema.safeParse(data);
|
|
@@ -5505,8 +5547,8 @@ var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report,
|
|
|
5505
5547
|
|
|
5506
5548
|
// packages/domain/analyzer/src/semantic.ts
|
|
5507
5549
|
init_cjs_shims();
|
|
5508
|
-
var
|
|
5509
|
-
var
|
|
5550
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
5551
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
5510
5552
|
var import_node_url5 = require("url");
|
|
5511
5553
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
5512
5554
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -5527,11 +5569,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
5527
5569
|
};
|
|
5528
5570
|
};
|
|
5529
5571
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
5530
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
5572
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path10.default.extname(configPath).toLowerCase());
|
|
5531
5573
|
};
|
|
5532
5574
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
5533
5575
|
if (explicitPath) {
|
|
5534
|
-
const resolved =
|
|
5576
|
+
const resolved = import_node_path10.default.resolve(root, explicitPath);
|
|
5535
5577
|
if (!await pathExists(resolved)) return null;
|
|
5536
5578
|
return resolved;
|
|
5537
5579
|
}
|
|
@@ -5542,7 +5584,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
5542
5584
|
"tailwind.config.mjs"
|
|
5543
5585
|
];
|
|
5544
5586
|
for (const candidate of candidates) {
|
|
5545
|
-
const fullPath =
|
|
5587
|
+
const fullPath = import_node_path10.default.resolve(root, candidate);
|
|
5546
5588
|
if (await pathExists(fullPath)) return fullPath;
|
|
5547
5589
|
}
|
|
5548
5590
|
return null;
|
|
@@ -5596,7 +5638,7 @@ var collectCustomUtilities = (config) => {
|
|
|
5596
5638
|
return out;
|
|
5597
5639
|
};
|
|
5598
5640
|
var collectSafelistFromSource = async (configPath) => {
|
|
5599
|
-
const source = await
|
|
5641
|
+
const source = await import_node_fs9.default.promises.readFile(configPath, "utf8");
|
|
5600
5642
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
5601
5643
|
const allTokens = extractClassesNative2(source);
|
|
5602
5644
|
const hasSafelist = source.includes("safelist");
|
|
@@ -5623,7 +5665,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5623
5665
|
customUtilities: /* @__PURE__ */ new Set()
|
|
5624
5666
|
};
|
|
5625
5667
|
}
|
|
5626
|
-
const configStat = await
|
|
5668
|
+
const configStat = await import_node_fs9.default.promises.stat(configPath).catch(() => null);
|
|
5627
5669
|
if (configStat) {
|
|
5628
5670
|
const cached = tailwindConfigCache.get(configPath);
|
|
5629
5671
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -5782,7 +5824,7 @@ async function buildDistribution(usages, native) {
|
|
|
5782
5824
|
}
|
|
5783
5825
|
async function analyzeWorkspace(root, options = {}) {
|
|
5784
5826
|
const startedAtMs = Date.now();
|
|
5785
|
-
const resolvedRoot =
|
|
5827
|
+
const resolvedRoot = import_node_path11.default.resolve(root);
|
|
5786
5828
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
5787
5829
|
const scan = await (async () => {
|
|
5788
5830
|
const scanStartedAtMs = Date.now();
|
|
@@ -5892,8 +5934,8 @@ init_src();
|
|
|
5892
5934
|
|
|
5893
5935
|
// packages/domain/engine/src/incremental.ts
|
|
5894
5936
|
init_cjs_shims();
|
|
5895
|
-
var
|
|
5896
|
-
var
|
|
5937
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
5938
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
5897
5939
|
init_src3();
|
|
5898
5940
|
init_src();
|
|
5899
5941
|
init_native_bridge2();
|
|
@@ -5929,8 +5971,8 @@ function areClassSetsEqual(a, b) {
|
|
|
5929
5971
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
5930
5972
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
5931
5973
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
5932
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
5933
|
-
const normalizedPath =
|
|
5974
|
+
const byFile = new Map(previous.files.map((f) => [import_node_path12.default.resolve(f.file), f]));
|
|
5975
|
+
const normalizedPath = import_node_path12.default.resolve(filePath);
|
|
5934
5976
|
const native = getNativeEngineBinding();
|
|
5935
5977
|
if (!native?.processFileChange) {
|
|
5936
5978
|
throw new Error(
|
|
@@ -5946,7 +5988,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
5946
5988
|
}
|
|
5947
5989
|
log5.debug(`native change ${normalizedPath}`);
|
|
5948
5990
|
const scanned = scanFile2(normalizedPath);
|
|
5949
|
-
const content =
|
|
5991
|
+
const content = import_node_fs10.default.readFileSync(normalizedPath, "utf8");
|
|
5950
5992
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
5951
5993
|
const existing = byFile.get(normalizedPath);
|
|
5952
5994
|
if (diff && existing) {
|
|
@@ -6012,8 +6054,8 @@ var EngineMetricsCollector = class {
|
|
|
6012
6054
|
|
|
6013
6055
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6014
6056
|
init_cjs_shims();
|
|
6015
|
-
var
|
|
6016
|
-
var
|
|
6057
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
6058
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6017
6059
|
var import_node_perf_hooks = require("perf_hooks");
|
|
6018
6060
|
init_src();
|
|
6019
6061
|
var _log = createLogger2("tw:metrics");
|
|
@@ -6021,8 +6063,8 @@ var METRICS_FILE_NAME = "metrics.json";
|
|
|
6021
6063
|
var CACHE_DIR = ".tw-cache";
|
|
6022
6064
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6023
6065
|
try {
|
|
6024
|
-
const cacheDir =
|
|
6025
|
-
|
|
6066
|
+
const cacheDir = import_node_path13.default.join(cwd, CACHE_DIR);
|
|
6067
|
+
import_node_fs11.default.mkdirSync(cacheDir, { recursive: true });
|
|
6026
6068
|
const mem = process.memoryUsage();
|
|
6027
6069
|
const data = {
|
|
6028
6070
|
...metrics,
|
|
@@ -6033,7 +6075,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6033
6075
|
},
|
|
6034
6076
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6035
6077
|
};
|
|
6036
|
-
|
|
6078
|
+
import_node_fs11.default.writeFileSync(import_node_path13.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6037
6079
|
} catch {
|
|
6038
6080
|
}
|
|
6039
6081
|
}
|
|
@@ -6238,8 +6280,8 @@ var configState = {
|
|
|
6238
6280
|
var log6 = createLogger2("engine");
|
|
6239
6281
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
6240
6282
|
if (!tailwindConfigPath) return void 0;
|
|
6241
|
-
const configPath =
|
|
6242
|
-
if (!
|
|
6283
|
+
const configPath = import_node_path14.default.resolve(root, tailwindConfigPath);
|
|
6284
|
+
if (!import_node_fs12.default.existsSync(configPath)) {
|
|
6243
6285
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
6244
6286
|
}
|
|
6245
6287
|
const imported = await import((0, import_node_url6.pathToFileURL)(configPath).href);
|
|
@@ -6305,11 +6347,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
6305
6347
|
};
|
|
6306
6348
|
}
|
|
6307
6349
|
function countWorkspacePackages(root) {
|
|
6308
|
-
const packagesDir =
|
|
6309
|
-
if (!
|
|
6350
|
+
const packagesDir = import_node_path14.default.join(root, "packages");
|
|
6351
|
+
if (!import_node_fs12.default.existsSync(packagesDir)) return 0;
|
|
6310
6352
|
try {
|
|
6311
|
-
return
|
|
6312
|
-
(entry) => entry.isDirectory() &&
|
|
6353
|
+
return import_node_fs12.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
6354
|
+
(entry) => entry.isDirectory() && import_node_fs12.default.existsSync(import_node_path14.default.join(packagesDir, entry.name, "package.json"))
|
|
6313
6355
|
).length;
|
|
6314
6356
|
} catch (err) {
|
|
6315
6357
|
log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -6346,7 +6388,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
6346
6388
|
async function createEngine(rawOptions = {}) {
|
|
6347
6389
|
const options = parseEngineOptions(rawOptions);
|
|
6348
6390
|
const root = options.root ?? process.cwd();
|
|
6349
|
-
const resolvedRoot =
|
|
6391
|
+
const resolvedRoot = import_node_path14.default.resolve(root);
|
|
6350
6392
|
const plugins = rawOptions.plugins ?? [];
|
|
6351
6393
|
const getTailwindConfig = async () => {
|
|
6352
6394
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -6493,7 +6535,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6493
6535
|
const shouldForceFullRescan = (event) => {
|
|
6494
6536
|
if (event.type === "unlink") return false;
|
|
6495
6537
|
try {
|
|
6496
|
-
const stat =
|
|
6538
|
+
const stat = import_node_fs12.default.statSync(event.filePath);
|
|
6497
6539
|
if (stat.size > largeFileThreshold) {
|
|
6498
6540
|
metrics.markSkippedLargeFile();
|
|
6499
6541
|
return true;
|
|
@@ -6615,7 +6657,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6615
6657
|
init_cjs_shims();
|
|
6616
6658
|
var import_zod6 = require("zod");
|
|
6617
6659
|
init_src();
|
|
6618
|
-
var formatIssuePath4 = (
|
|
6660
|
+
var formatIssuePath4 = (path17) => path17.length > 0 ? path17.map(
|
|
6619
6661
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
6620
6662
|
).join(".") : "<root>";
|
|
6621
6663
|
var formatIssues4 = (error) => error.issues.map((issue) => {
|
|
@@ -6661,14 +6703,14 @@ function warnDeprecated(options, key, message) {
|
|
|
6661
6703
|
}
|
|
6662
6704
|
}
|
|
6663
6705
|
function isInsideDirectory(filePath, directory) {
|
|
6664
|
-
const relative =
|
|
6665
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
6706
|
+
const relative = import_node_path15.default.relative(directory, filePath);
|
|
6707
|
+
return relative === "" || !relative.startsWith("..") && !import_node_path15.default.isAbsolute(relative);
|
|
6666
6708
|
}
|
|
6667
6709
|
function filterScanToDirs(scan, root, scanDirs) {
|
|
6668
|
-
const resolvedDirs = scanDirs.map((dir) =>
|
|
6710
|
+
const resolvedDirs = scanDirs.map((dir) => import_node_path15.default.resolve(root, dir));
|
|
6669
6711
|
if (resolvedDirs.length === 0) return scan;
|
|
6670
6712
|
const files = scan.files.filter((file) => {
|
|
6671
|
-
const absoluteFile =
|
|
6713
|
+
const absoluteFile = import_node_path15.default.resolve(file.file);
|
|
6672
6714
|
return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
|
|
6673
6715
|
});
|
|
6674
6716
|
const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
|
|
@@ -6679,9 +6721,9 @@ function filterScanToDirs(scan, root, scanDirs) {
|
|
|
6679
6721
|
};
|
|
6680
6722
|
}
|
|
6681
6723
|
function writeJsonArtifact(root, relativePath, value) {
|
|
6682
|
-
const outputPath =
|
|
6683
|
-
|
|
6684
|
-
|
|
6724
|
+
const outputPath = import_node_path15.default.resolve(root, relativePath);
|
|
6725
|
+
import_node_fs13.default.mkdirSync(import_node_path15.default.dirname(outputPath), { recursive: true });
|
|
6726
|
+
import_node_fs13.default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
|
|
6685
6727
|
`);
|
|
6686
6728
|
}
|
|
6687
6729
|
function tailwindStyledPlugin(opts = {}) {
|
|
@@ -6722,7 +6764,7 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6722
6764
|
return rules.join("\n");
|
|
6723
6765
|
}
|
|
6724
6766
|
function getStaticCssOutputPath(root, safelistOutputPath) {
|
|
6725
|
-
return
|
|
6767
|
+
return import_node_path15.default.resolve(root, import_node_path15.default.dirname(safelistOutputPath), "_tw-state-static.css");
|
|
6726
6768
|
}
|
|
6727
6769
|
function flushStaticCss(root) {
|
|
6728
6770
|
if (staticCssPerFile.size === 0) return;
|
|
@@ -6731,8 +6773,8 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6731
6773
|
if (!deduped.trim()) return;
|
|
6732
6774
|
const outPath = getStaticCssOutputPath(root, safelistOutput);
|
|
6733
6775
|
try {
|
|
6734
|
-
|
|
6735
|
-
|
|
6776
|
+
import_node_fs13.default.mkdirSync(import_node_path15.default.dirname(outPath), { recursive: true });
|
|
6777
|
+
import_node_fs13.default.writeFileSync(
|
|
6736
6778
|
outPath,
|
|
6737
6779
|
`/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
|
|
6738
6780
|
* Import this in globals.css: @import "./_tw-state-static.css";
|
|
@@ -6764,17 +6806,17 @@ ${deduped}
|
|
|
6764
6806
|
"src/style.css"
|
|
6765
6807
|
];
|
|
6766
6808
|
for (const candidate of CSS_CANDIDATES) {
|
|
6767
|
-
const candidatePath =
|
|
6768
|
-
if (!
|
|
6769
|
-
const content =
|
|
6809
|
+
const candidatePath = import_node_path15.default.resolve(config.root, candidate);
|
|
6810
|
+
if (!import_node_fs13.default.existsSync(candidatePath)) continue;
|
|
6811
|
+
const content = import_node_fs13.default.readFileSync(candidatePath, "utf-8");
|
|
6770
6812
|
if (content.includes("_tw-state-static.css")) break;
|
|
6771
|
-
const rel =
|
|
6813
|
+
const rel = import_node_path15.default.relative(import_node_path15.default.dirname(candidatePath), outPath).replace(/\\/g, "/");
|
|
6772
6814
|
const importLine = `@import "./${rel}";`;
|
|
6773
6815
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
6774
6816
|
const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
|
|
6775
6817
|
`) : `${importLine}
|
|
6776
6818
|
${content}`;
|
|
6777
|
-
|
|
6819
|
+
import_node_fs13.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
6778
6820
|
break;
|
|
6779
6821
|
}
|
|
6780
6822
|
} catch {
|