tailwind-styled-v4 5.1.22 → 5.1.24
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 +216 -0
- package/dist/atomic.js +34 -4
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +31 -2
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +132 -97
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +129 -95
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +195 -1
- package/dist/compiler.d.ts +195 -1
- package/dist/compiler.js +356 -12
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +340 -10
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +194 -164
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +184 -155
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +136 -14
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +45 -4
- package/dist/index.d.ts +45 -4
- package/dist/index.js +166 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -21
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +489 -158
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +483 -153
- package/dist/next.mjs.map +1 -1
- package/dist/runtime-css.js +1 -1
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +1 -1
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +17 -0
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +23 -0
- package/dist/runtime.mjs.map +1 -1
- package/dist/shared.js +91 -61
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -56
- package/dist/shared.mjs.map +1 -1
- package/dist/turbopackLoader.js +79 -49
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +76 -47
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +132 -97
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +129 -95
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +157 -127
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +150 -121
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +39 -9
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +36 -7
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -182
package/dist/engine.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 path19 = first?.path?.join(".") ?? "(root)";
|
|
234
234
|
throw new Error(
|
|
235
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
235
|
+
`[${context}] Native binding returned unexpected data: ${path19}: ${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(path19) {
|
|
670
670
|
if (isBrowser2) return false;
|
|
671
671
|
try {
|
|
672
672
|
const nodeFs = __require(NODE_FS);
|
|
673
|
-
return nodeFs.existsSync(
|
|
673
|
+
return nodeFs.existsSync(path19);
|
|
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(path19) {
|
|
1028
1028
|
try {
|
|
1029
|
-
const res = await fetch(`${baseUrl}${
|
|
1029
|
+
const res = await fetch(`${baseUrl}${path19}`, {
|
|
1030
1030
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1031
1031
|
});
|
|
1032
1032
|
if (!res.ok) return null;
|
|
@@ -1067,7 +1067,7 @@ var init_nativeBridge = __esm({
|
|
|
1067
1067
|
"use strict";
|
|
1068
1068
|
init_esm_shims();
|
|
1069
1069
|
init_src2();
|
|
1070
|
-
_loadNative = (
|
|
1070
|
+
_loadNative = (path19) => __require(path19);
|
|
1071
1071
|
log = (...args) => {
|
|
1072
1072
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
1073
1073
|
console.log("[compiler:native]", ...args);
|
|
@@ -2901,9 +2901,35 @@ var init_routeGraph = __esm({
|
|
|
2901
2901
|
}
|
|
2902
2902
|
});
|
|
2903
2903
|
|
|
2904
|
-
// packages/domain/compiler/src/
|
|
2904
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2905
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2906
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2907
|
+
"use strict";
|
|
2908
|
+
init_esm_shims();
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2911
|
+
|
|
2912
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2913
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2914
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2915
|
+
"use strict";
|
|
2916
|
+
init_esm_shims();
|
|
2917
|
+
}
|
|
2918
|
+
});
|
|
2919
|
+
|
|
2920
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2905
2921
|
import fs3 from "fs";
|
|
2906
2922
|
import path4 from "path";
|
|
2923
|
+
var init_typeGenerationPlugin = __esm({
|
|
2924
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2925
|
+
"use strict";
|
|
2926
|
+
init_esm_shims();
|
|
2927
|
+
}
|
|
2928
|
+
});
|
|
2929
|
+
|
|
2930
|
+
// packages/domain/compiler/src/index.ts
|
|
2931
|
+
import fs4 from "fs";
|
|
2932
|
+
import path5 from "path";
|
|
2907
2933
|
import { createRequire as createRequire4 } from "module";
|
|
2908
2934
|
function _layoutClassesToCss(classes) {
|
|
2909
2935
|
const native = getNativeBridge();
|
|
@@ -2952,6 +2978,9 @@ var init_src = __esm({
|
|
|
2952
2978
|
init_redis();
|
|
2953
2979
|
init_watch();
|
|
2954
2980
|
init_routeGraph();
|
|
2981
|
+
init_semanticComponentAnalyzer();
|
|
2982
|
+
init_typeGeneratorFromMetadata();
|
|
2983
|
+
init_typeGenerationPlugin();
|
|
2955
2984
|
_require2 = createRequire4(
|
|
2956
2985
|
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2957
2986
|
);
|
|
@@ -3046,7 +3075,7 @@ var init_src = __esm({
|
|
|
3046
3075
|
};
|
|
3047
3076
|
scanProjectUsage = (dirs, cwd) => {
|
|
3048
3077
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
3049
|
-
const files = dirs.map((dir) =>
|
|
3078
|
+
const files = dirs.map((dir) => path5.resolve(cwd, dir));
|
|
3050
3079
|
const results = batchExtractClasses2(files) || [];
|
|
3051
3080
|
const combined = {};
|
|
3052
3081
|
for (const result of results) {
|
|
@@ -3063,13 +3092,13 @@ var init_src = __esm({
|
|
|
3063
3092
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3064
3093
|
const allClasses = Object.keys(classes).sort();
|
|
3065
3094
|
if (outputPath) {
|
|
3066
|
-
|
|
3095
|
+
fs4.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3067
3096
|
}
|
|
3068
3097
|
return allClasses;
|
|
3069
3098
|
};
|
|
3070
3099
|
loadSafelist = (safelistPath) => {
|
|
3071
3100
|
try {
|
|
3072
|
-
const content =
|
|
3101
|
+
const content = fs4.readFileSync(safelistPath, "utf-8");
|
|
3073
3102
|
return JSON.parse(content);
|
|
3074
3103
|
} catch {
|
|
3075
3104
|
return [];
|
|
@@ -3083,8 +3112,8 @@ var init_src = __esm({
|
|
|
3083
3112
|
"tailwind.config.cjs"
|
|
3084
3113
|
];
|
|
3085
3114
|
for (const file of configFiles) {
|
|
3086
|
-
const fullPath =
|
|
3087
|
-
if (
|
|
3115
|
+
const fullPath = path5.join(cwd, file);
|
|
3116
|
+
if (fs4.existsSync(fullPath)) {
|
|
3088
3117
|
const mod = __require(fullPath);
|
|
3089
3118
|
return mod.default || mod;
|
|
3090
3119
|
}
|
|
@@ -3094,9 +3123,9 @@ var init_src = __esm({
|
|
|
3094
3123
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3095
3124
|
return {
|
|
3096
3125
|
content: [
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3126
|
+
path5.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3127
|
+
path5.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3128
|
+
path5.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3100
3129
|
]
|
|
3101
3130
|
};
|
|
3102
3131
|
};
|
|
@@ -3554,8 +3583,8 @@ var init_internal = __esm({
|
|
|
3554
3583
|
});
|
|
3555
3584
|
|
|
3556
3585
|
// packages/domain/shared/src/staticStateExtractor.ts
|
|
3557
|
-
import
|
|
3558
|
-
import
|
|
3586
|
+
import fs5 from "fs";
|
|
3587
|
+
import path6 from "path";
|
|
3559
3588
|
function getNative() {
|
|
3560
3589
|
if (_native) return _native;
|
|
3561
3590
|
try {
|
|
@@ -3585,17 +3614,17 @@ function getNative() {
|
|
|
3585
3614
|
function* walkSourceFiles(dir) {
|
|
3586
3615
|
let entries;
|
|
3587
3616
|
try {
|
|
3588
|
-
entries =
|
|
3617
|
+
entries = fs5.readdirSync(dir, { withFileTypes: true });
|
|
3589
3618
|
} catch {
|
|
3590
3619
|
return;
|
|
3591
3620
|
}
|
|
3592
3621
|
for (const entry of entries) {
|
|
3593
|
-
const fullPath =
|
|
3622
|
+
const fullPath = path6.join(dir, entry.name);
|
|
3594
3623
|
if (entry.isDirectory()) {
|
|
3595
3624
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3596
3625
|
yield* walkSourceFiles(fullPath);
|
|
3597
3626
|
} else if (entry.isFile()) {
|
|
3598
|
-
const ext =
|
|
3627
|
+
const ext = path6.extname(entry.name);
|
|
3599
3628
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3600
3629
|
}
|
|
3601
3630
|
}
|
|
@@ -3659,7 +3688,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3659
3688
|
allConfigs.push(...configs);
|
|
3660
3689
|
if (verbose) {
|
|
3661
3690
|
process.stderr.write(
|
|
3662
|
-
`[tw:static-state] ${
|
|
3691
|
+
`[tw:static-state] ${path6.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3663
3692
|
`
|
|
3664
3693
|
);
|
|
3665
3694
|
}
|
|
@@ -3670,7 +3699,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3670
3699
|
if (filesScanned >= maxFiles) break;
|
|
3671
3700
|
let source;
|
|
3672
3701
|
try {
|
|
3673
|
-
source =
|
|
3702
|
+
source = fs5.readFileSync(filePath, "utf-8");
|
|
3674
3703
|
} catch {
|
|
3675
3704
|
continue;
|
|
3676
3705
|
}
|
|
@@ -3683,7 +3712,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3683
3712
|
allConfigs.push(...configs);
|
|
3684
3713
|
if (verbose) {
|
|
3685
3714
|
process.stderr.write(
|
|
3686
|
-
`[tw:static-state] ${
|
|
3715
|
+
`[tw:static-state] ${path6.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3687
3716
|
`
|
|
3688
3717
|
);
|
|
3689
3718
|
}
|
|
@@ -3777,12 +3806,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3777
3806
|
resolvedCss: options.resolvedCss || ""
|
|
3778
3807
|
// ← ensure always passed
|
|
3779
3808
|
});
|
|
3780
|
-
const twClassesDir =
|
|
3781
|
-
|
|
3782
|
-
const stateFilePath =
|
|
3809
|
+
const twClassesDir = path6.join(path6.dirname(safelistPath), "tw-classes");
|
|
3810
|
+
fs5.mkdirSync(twClassesDir, { recursive: true });
|
|
3811
|
+
const stateFilePath = path6.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3783
3812
|
if (result.rulesGenerated === 0) {
|
|
3784
3813
|
try {
|
|
3785
|
-
|
|
3814
|
+
fs5.writeFileSync(
|
|
3786
3815
|
stateFilePath,
|
|
3787
3816
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3788
3817
|
"utf-8"
|
|
@@ -3792,7 +3821,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3792
3821
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3793
3822
|
}
|
|
3794
3823
|
try {
|
|
3795
|
-
|
|
3824
|
+
fs5.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3796
3825
|
return [
|
|
3797
3826
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3798
3827
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3817,8 +3846,8 @@ var init_staticStateExtractor = __esm({
|
|
|
3817
3846
|
});
|
|
3818
3847
|
|
|
3819
3848
|
// packages/domain/shared/src/logger.ts
|
|
3820
|
-
import
|
|
3821
|
-
import
|
|
3849
|
+
import fs6 from "fs";
|
|
3850
|
+
import path7 from "path";
|
|
3822
3851
|
function getEnvLevel() {
|
|
3823
3852
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3824
3853
|
if (env && env in LEVELS) return env;
|
|
@@ -3828,8 +3857,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3828
3857
|
_globalLogFile = filePath;
|
|
3829
3858
|
_logFileInitialized = false;
|
|
3830
3859
|
try {
|
|
3831
|
-
|
|
3832
|
-
|
|
3860
|
+
fs6.mkdirSync(path7.dirname(filePath), { recursive: true });
|
|
3861
|
+
fs6.writeFileSync(
|
|
3833
3862
|
filePath,
|
|
3834
3863
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3835
3864
|
`,
|
|
@@ -3842,7 +3871,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3842
3871
|
function writeToFile(line) {
|
|
3843
3872
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3844
3873
|
try {
|
|
3845
|
-
|
|
3874
|
+
fs6.appendFileSync(_globalLogFile, line);
|
|
3846
3875
|
} catch {
|
|
3847
3876
|
}
|
|
3848
3877
|
}
|
|
@@ -3954,8 +3983,8 @@ __export(src_exports, {
|
|
|
3954
3983
|
wrapUnknownError: () => wrapUnknownError
|
|
3955
3984
|
});
|
|
3956
3985
|
import { createHash } from "crypto";
|
|
3957
|
-
import
|
|
3958
|
-
import
|
|
3986
|
+
import fs7 from "fs";
|
|
3987
|
+
import path8 from "path";
|
|
3959
3988
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3960
3989
|
import { createRequire as createRequire5 } from "module";
|
|
3961
3990
|
function createLogger2(namespace) {
|
|
@@ -3987,9 +4016,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3987
4016
|
}
|
|
3988
4017
|
};
|
|
3989
4018
|
}
|
|
3990
|
-
function formatIssuePath(
|
|
3991
|
-
if (!
|
|
3992
|
-
return
|
|
4019
|
+
function formatIssuePath(path19) {
|
|
4020
|
+
if (!path19 || path19.length === 0) return "(root)";
|
|
4021
|
+
return path19.map(
|
|
3993
4022
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3994
4023
|
).join(".");
|
|
3995
4024
|
}
|
|
@@ -4003,9 +4032,9 @@ function loadNativeBinding(options) {
|
|
|
4003
4032
|
const { runtimeDir, candidates, isValid } = options;
|
|
4004
4033
|
const loadErrors = [];
|
|
4005
4034
|
for (const candidate of candidates) {
|
|
4006
|
-
const candidatePath =
|
|
4035
|
+
const candidatePath = path8.resolve(runtimeDir, candidate);
|
|
4007
4036
|
try {
|
|
4008
|
-
if (!
|
|
4037
|
+
if (!fs7.existsSync(candidatePath) && !fs7.existsSync(candidatePath + ".node")) {
|
|
4009
4038
|
continue;
|
|
4010
4039
|
}
|
|
4011
4040
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -4037,9 +4066,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
4037
4066
|
}
|
|
4038
4067
|
}
|
|
4039
4068
|
if (!includeDefaultCandidates) return candidates;
|
|
4040
|
-
if (
|
|
4069
|
+
if (fs7.existsSync(runtimeDir)) {
|
|
4041
4070
|
try {
|
|
4042
|
-
for (const entry of
|
|
4071
|
+
for (const entry of fs7.readdirSync(runtimeDir)) {
|
|
4043
4072
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
4044
4073
|
}
|
|
4045
4074
|
} catch {
|
|
@@ -4048,22 +4077,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
4048
4077
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
4049
4078
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
4050
4079
|
for (const bin of BINARY_NAMES) {
|
|
4051
|
-
candidates.push(
|
|
4052
|
-
candidates.push(
|
|
4053
|
-
candidates.push(
|
|
4054
|
-
candidates.push(
|
|
4055
|
-
candidates.push(
|
|
4056
|
-
candidates.push(
|
|
4057
|
-
candidates.push(
|
|
4058
|
-
candidates.push(
|
|
4059
|
-
candidates.push(
|
|
4080
|
+
candidates.push(path8.resolve(runtimeDir, `${bin}.node`));
|
|
4081
|
+
candidates.push(path8.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
4082
|
+
candidates.push(path8.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
4083
|
+
candidates.push(path8.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4084
|
+
candidates.push(path8.resolve(process.cwd(), "native", `${bin}.node`));
|
|
4085
|
+
candidates.push(path8.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
4086
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
4087
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4088
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
4060
4089
|
}
|
|
4061
4090
|
return Array.from(new Set(candidates));
|
|
4062
4091
|
}
|
|
4063
4092
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
4064
|
-
if (dir) return
|
|
4093
|
+
if (dir) return path8.resolve(dir);
|
|
4065
4094
|
try {
|
|
4066
|
-
return
|
|
4095
|
+
return path8.dirname(fileURLToPath2(importMetaUrl));
|
|
4067
4096
|
} catch {
|
|
4068
4097
|
return process.cwd();
|
|
4069
4098
|
}
|
|
@@ -4128,8 +4157,8 @@ var init_src2 = __esm({
|
|
|
4128
4157
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
4129
4158
|
static fromZod(err) {
|
|
4130
4159
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
4131
|
-
const
|
|
4132
|
-
const message = first ? `${
|
|
4160
|
+
const path19 = formatIssuePath(first?.path);
|
|
4161
|
+
const message = first ? `${path19}: ${first.message}` : "Schema validation failed";
|
|
4133
4162
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
4134
4163
|
}
|
|
4135
4164
|
static wrap(source, code, err) {
|
|
@@ -4224,14 +4253,14 @@ __export(native_bridge_exports, {
|
|
|
4224
4253
|
startWatchNative: () => startWatchNative,
|
|
4225
4254
|
stopWatchNative: () => stopWatchNative
|
|
4226
4255
|
});
|
|
4227
|
-
import
|
|
4256
|
+
import path9 from "path";
|
|
4228
4257
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4229
4258
|
function getDirname3() {
|
|
4230
4259
|
if (typeof __dirname !== "undefined") {
|
|
4231
4260
|
return __dirname;
|
|
4232
4261
|
}
|
|
4233
4262
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4234
|
-
return
|
|
4263
|
+
return path9.dirname(fileURLToPath3(import.meta.url));
|
|
4235
4264
|
}
|
|
4236
4265
|
return process.cwd();
|
|
4237
4266
|
}
|
|
@@ -4534,11 +4563,11 @@ var init_native_bridge = __esm({
|
|
|
4534
4563
|
});
|
|
4535
4564
|
|
|
4536
4565
|
// packages/domain/scanner/src/cache-native.ts
|
|
4537
|
-
import
|
|
4538
|
-
import
|
|
4566
|
+
import fs8 from "fs";
|
|
4567
|
+
import path10 from "path";
|
|
4539
4568
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4540
|
-
const dir = cacheDir ?
|
|
4541
|
-
return
|
|
4569
|
+
const dir = cacheDir ? path10.resolve(rootDir, cacheDir) : path10.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4570
|
+
return path10.join(dir, "scanner-cache.json");
|
|
4542
4571
|
}
|
|
4543
4572
|
function metaPathFor(cachePath) {
|
|
4544
4573
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4551,7 +4580,7 @@ function getBinaryFingerprint() {
|
|
|
4551
4580
|
_cachedFingerprint = null;
|
|
4552
4581
|
return null;
|
|
4553
4582
|
}
|
|
4554
|
-
const stat =
|
|
4583
|
+
const stat = fs8.statSync(loadedPath);
|
|
4555
4584
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4556
4585
|
} catch {
|
|
4557
4586
|
_cachedFingerprint = null;
|
|
@@ -4560,13 +4589,13 @@ function getBinaryFingerprint() {
|
|
|
4560
4589
|
}
|
|
4561
4590
|
function readCache(rootDir, cacheDir) {
|
|
4562
4591
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4563
|
-
|
|
4592
|
+
fs8.mkdirSync(path10.dirname(cachePath), { recursive: true });
|
|
4564
4593
|
const currentFingerprint = getBinaryFingerprint();
|
|
4565
4594
|
if (currentFingerprint !== null) {
|
|
4566
4595
|
const metaPath = metaPathFor(cachePath);
|
|
4567
4596
|
let storedFingerprint = null;
|
|
4568
4597
|
try {
|
|
4569
|
-
storedFingerprint = JSON.parse(
|
|
4598
|
+
storedFingerprint = JSON.parse(fs8.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4570
4599
|
} catch {
|
|
4571
4600
|
}
|
|
4572
4601
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4590,7 +4619,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4590
4619
|
}
|
|
4591
4620
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4592
4621
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4593
|
-
|
|
4622
|
+
fs8.mkdirSync(path10.dirname(cachePath), { recursive: true });
|
|
4594
4623
|
const success = cacheWriteNative(cachePath, entries);
|
|
4595
4624
|
if (!success) {
|
|
4596
4625
|
throw new Error(
|
|
@@ -4600,7 +4629,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4600
4629
|
const currentFingerprint = getBinaryFingerprint();
|
|
4601
4630
|
if (currentFingerprint !== null) {
|
|
4602
4631
|
try {
|
|
4603
|
-
|
|
4632
|
+
fs8.writeFileSync(
|
|
4604
4633
|
metaPathFor(cachePath),
|
|
4605
4634
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4606
4635
|
"utf8"
|
|
@@ -4632,7 +4661,7 @@ var init_cache_native = __esm({
|
|
|
4632
4661
|
|
|
4633
4662
|
// packages/domain/scanner/src/parallel-scanner.ts
|
|
4634
4663
|
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
4635
|
-
import
|
|
4664
|
+
import path11 from "path";
|
|
4636
4665
|
import { availableParallelism } from "os";
|
|
4637
4666
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4638
4667
|
function collectFiles2(rootDir, extensions, ignoreDirs) {
|
|
@@ -4675,7 +4704,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4675
4704
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
4676
4705
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4677
4706
|
} = options;
|
|
4678
|
-
const files = collectFiles2(
|
|
4707
|
+
const files = collectFiles2(path11.resolve(rootDir), extensions, ignoreDirs);
|
|
4679
4708
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4680
4709
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4681
4710
|
}
|
|
@@ -4726,12 +4755,12 @@ var init_schemas = __esm({
|
|
|
4726
4755
|
"use strict";
|
|
4727
4756
|
init_esm_shims();
|
|
4728
4757
|
init_src2();
|
|
4729
|
-
formatIssuePath2 = (
|
|
4758
|
+
formatIssuePath2 = (path19) => path19.length > 0 ? path19.map(
|
|
4730
4759
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4731
4760
|
).join(".") : "<root>";
|
|
4732
4761
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4733
|
-
const
|
|
4734
|
-
return `${
|
|
4762
|
+
const path19 = formatIssuePath2(issue.path);
|
|
4763
|
+
return `${path19}: ${issue.message}`;
|
|
4735
4764
|
}).join("; ");
|
|
4736
4765
|
parseWithSchema = (schema, data, label) => {
|
|
4737
4766
|
const parsed = schema.safeParse(data);
|
|
@@ -4803,9 +4832,9 @@ __export(src_exports2, {
|
|
|
4803
4832
|
scanWorkspace: () => scanWorkspace2,
|
|
4804
4833
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
4805
4834
|
});
|
|
4806
|
-
import
|
|
4835
|
+
import fs9 from "fs";
|
|
4807
4836
|
import { createRequire as createRequire6 } from "module";
|
|
4808
|
-
import
|
|
4837
|
+
import path12 from "path";
|
|
4809
4838
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
4810
4839
|
import { Worker as Worker2 } from "worker_threads";
|
|
4811
4840
|
function getRuntimeDir() {
|
|
@@ -4813,7 +4842,7 @@ function getRuntimeDir() {
|
|
|
4813
4842
|
return __dirname;
|
|
4814
4843
|
}
|
|
4815
4844
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4816
|
-
return
|
|
4845
|
+
return path12.dirname(fileURLToPath5(import.meta.url));
|
|
4817
4846
|
}
|
|
4818
4847
|
return process.cwd();
|
|
4819
4848
|
}
|
|
@@ -4823,17 +4852,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4823
4852
|
return __dirname;
|
|
4824
4853
|
}
|
|
4825
4854
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4826
|
-
return
|
|
4855
|
+
return path12.dirname(fileURLToPath5(import.meta.url));
|
|
4827
4856
|
}
|
|
4828
4857
|
return process.cwd();
|
|
4829
4858
|
})();
|
|
4830
4859
|
const candidates = [
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4860
|
+
path12.resolve(runtimeDir, "worker.cjs"),
|
|
4861
|
+
path12.resolve(runtimeDir, "worker.js"),
|
|
4862
|
+
path12.resolve(runtimeDir, "worker.ts")
|
|
4834
4863
|
];
|
|
4835
4864
|
for (const candidate of candidates) {
|
|
4836
|
-
if (
|
|
4865
|
+
if (fs9.existsSync(candidate)) return candidate;
|
|
4837
4866
|
}
|
|
4838
4867
|
return null;
|
|
4839
4868
|
}
|
|
@@ -4890,19 +4919,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4890
4919
|
if (!currentDir) continue;
|
|
4891
4920
|
const entries = (() => {
|
|
4892
4921
|
try {
|
|
4893
|
-
return
|
|
4922
|
+
return fs9.readdirSync(currentDir, { withFileTypes: true });
|
|
4894
4923
|
} catch {
|
|
4895
4924
|
return [];
|
|
4896
4925
|
}
|
|
4897
4926
|
})();
|
|
4898
4927
|
for (const entry of entries) {
|
|
4899
|
-
const fullPath =
|
|
4928
|
+
const fullPath = path12.join(currentDir, entry.name);
|
|
4900
4929
|
if (entry.isDirectory()) {
|
|
4901
4930
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4902
4931
|
continue;
|
|
4903
4932
|
}
|
|
4904
4933
|
if (!entry.isFile()) continue;
|
|
4905
|
-
if (!extensionSet.has(
|
|
4934
|
+
if (!extensionSet.has(path12.extname(entry.name))) continue;
|
|
4906
4935
|
candidates.push(fullPath);
|
|
4907
4936
|
}
|
|
4908
4937
|
}
|
|
@@ -4929,7 +4958,7 @@ function scanSource(source) {
|
|
|
4929
4958
|
);
|
|
4930
4959
|
}
|
|
4931
4960
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4932
|
-
return includeExtensions.includes(
|
|
4961
|
+
return includeExtensions.includes(path12.extname(filePath));
|
|
4933
4962
|
}
|
|
4934
4963
|
function scanFile2(filePath) {
|
|
4935
4964
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4989,7 +5018,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4989
5018
|
for (const filePath of candidates) {
|
|
4990
5019
|
const stat = (() => {
|
|
4991
5020
|
try {
|
|
4992
|
-
return
|
|
5021
|
+
return fs9.statSync(filePath);
|
|
4993
5022
|
} catch {
|
|
4994
5023
|
return null;
|
|
4995
5024
|
}
|
|
@@ -5015,7 +5044,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
5015
5044
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
5016
5045
|
const content = (() => {
|
|
5017
5046
|
try {
|
|
5018
|
-
return
|
|
5047
|
+
return fs9.readFileSync(filePath, "utf8");
|
|
5019
5048
|
} catch {
|
|
5020
5049
|
return null;
|
|
5021
5050
|
}
|
|
@@ -5121,7 +5150,7 @@ var init_src3 = __esm({
|
|
|
5121
5150
|
const loadNativeParserBinding = () => {
|
|
5122
5151
|
if (_state.binding !== void 0) return _state.binding;
|
|
5123
5152
|
const runtimeDir = getRuntimeDir();
|
|
5124
|
-
const req = createRequire6(
|
|
5153
|
+
const req = createRequire6(path12.join(runtimeDir, "noop.cjs"));
|
|
5125
5154
|
const _platform = process.platform;
|
|
5126
5155
|
const _arch = process.arch;
|
|
5127
5156
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -5129,27 +5158,27 @@ var init_src3 = __esm({
|
|
|
5129
5158
|
const candidates = [
|
|
5130
5159
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
5131
5160
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5161
|
+
path12.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
5162
|
+
path12.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5163
|
+
path12.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5135
5164
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
5136
5165
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5166
|
+
path12.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
5167
|
+
path12.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5168
|
+
path12.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5140
5169
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
5141
|
-
|
|
5142
|
-
|
|
5170
|
+
path12.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5171
|
+
path12.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5143
5172
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
5144
|
-
|
|
5145
|
-
|
|
5173
|
+
path12.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5174
|
+
path12.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5146
5175
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5176
|
+
path12.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5177
|
+
path12.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5178
|
+
path12.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5179
|
+
path12.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5180
|
+
path12.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5181
|
+
path12.resolve(
|
|
5153
5182
|
runtimeDir,
|
|
5154
5183
|
"..",
|
|
5155
5184
|
"..",
|
|
@@ -5161,7 +5190,7 @@ var init_src3 = __esm({
|
|
|
5161
5190
|
)
|
|
5162
5191
|
];
|
|
5163
5192
|
for (const fullPath of candidates) {
|
|
5164
|
-
if (!
|
|
5193
|
+
if (!fs9.existsSync(fullPath)) continue;
|
|
5165
5194
|
try {
|
|
5166
5195
|
const required = req(fullPath);
|
|
5167
5196
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -5886,8 +5915,8 @@ init_esm_shims();
|
|
|
5886
5915
|
|
|
5887
5916
|
// packages/domain/engine/src/index.ts
|
|
5888
5917
|
init_esm_shims();
|
|
5889
|
-
import
|
|
5890
|
-
import
|
|
5918
|
+
import fs14 from "fs";
|
|
5919
|
+
import path18 from "path";
|
|
5891
5920
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
5892
5921
|
|
|
5893
5922
|
// packages/domain/analyzer/src/index.ts
|
|
@@ -5896,7 +5925,7 @@ init_esm_shims();
|
|
|
5896
5925
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5897
5926
|
init_esm_shims();
|
|
5898
5927
|
init_src3();
|
|
5899
|
-
import
|
|
5928
|
+
import path14 from "path";
|
|
5900
5929
|
|
|
5901
5930
|
// packages/domain/analyzer/src/binding.ts
|
|
5902
5931
|
init_esm_shims();
|
|
@@ -5905,7 +5934,7 @@ init_src2();
|
|
|
5905
5934
|
// packages/domain/analyzer/src/utils.ts
|
|
5906
5935
|
init_esm_shims();
|
|
5907
5936
|
init_src2();
|
|
5908
|
-
import
|
|
5937
|
+
import fs10 from "fs";
|
|
5909
5938
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5910
5939
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
5911
5940
|
var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
|
|
@@ -5919,7 +5948,7 @@ function isRecord(value) {
|
|
|
5919
5948
|
}
|
|
5920
5949
|
async function pathExists(filePath) {
|
|
5921
5950
|
try {
|
|
5922
|
-
await
|
|
5951
|
+
await fs10.promises.access(filePath, fs10.constants.F_OK);
|
|
5923
5952
|
return true;
|
|
5924
5953
|
} catch {
|
|
5925
5954
|
return false;
|
|
@@ -6020,7 +6049,7 @@ async function requireNativeBinding() {
|
|
|
6020
6049
|
init_esm_shims();
|
|
6021
6050
|
init_src2();
|
|
6022
6051
|
import { z as z4 } from "zod";
|
|
6023
|
-
var formatIssuePath3 = (
|
|
6052
|
+
var formatIssuePath3 = (path19) => path19.length > 0 ? path19.map(
|
|
6024
6053
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
6025
6054
|
).join(".") : "<root>";
|
|
6026
6055
|
var isPlainObject = (value) => {
|
|
@@ -6029,8 +6058,8 @@ var isPlainObject = (value) => {
|
|
|
6029
6058
|
return proto === Object.prototype || proto === null;
|
|
6030
6059
|
};
|
|
6031
6060
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
6032
|
-
const
|
|
6033
|
-
return `${
|
|
6061
|
+
const path19 = formatIssuePath3(issue.path);
|
|
6062
|
+
return `${path19}: ${issue.message}`;
|
|
6034
6063
|
}).join("; ");
|
|
6035
6064
|
var parseWithSchema2 = (schema, data, label) => {
|
|
6036
6065
|
const parsed = schema.safeParse(data);
|
|
@@ -6121,8 +6150,8 @@ var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report,
|
|
|
6121
6150
|
|
|
6122
6151
|
// packages/domain/analyzer/src/semantic.ts
|
|
6123
6152
|
init_esm_shims();
|
|
6124
|
-
import
|
|
6125
|
-
import
|
|
6153
|
+
import fs11 from "fs";
|
|
6154
|
+
import path13 from "path";
|
|
6126
6155
|
import { pathToFileURL } from "url";
|
|
6127
6156
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
6128
6157
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -6143,11 +6172,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
6143
6172
|
};
|
|
6144
6173
|
};
|
|
6145
6174
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
6146
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
6175
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path13.extname(configPath).toLowerCase());
|
|
6147
6176
|
};
|
|
6148
6177
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
6149
6178
|
if (explicitPath) {
|
|
6150
|
-
const resolved =
|
|
6179
|
+
const resolved = path13.resolve(root, explicitPath);
|
|
6151
6180
|
if (!await pathExists(resolved)) return null;
|
|
6152
6181
|
return resolved;
|
|
6153
6182
|
}
|
|
@@ -6158,7 +6187,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
6158
6187
|
"tailwind.config.mjs"
|
|
6159
6188
|
];
|
|
6160
6189
|
for (const candidate of candidates) {
|
|
6161
|
-
const fullPath =
|
|
6190
|
+
const fullPath = path13.resolve(root, candidate);
|
|
6162
6191
|
if (await pathExists(fullPath)) return fullPath;
|
|
6163
6192
|
}
|
|
6164
6193
|
return null;
|
|
@@ -6212,7 +6241,7 @@ var collectCustomUtilities = (config) => {
|
|
|
6212
6241
|
return out;
|
|
6213
6242
|
};
|
|
6214
6243
|
var collectSafelistFromSource = async (configPath) => {
|
|
6215
|
-
const source = await
|
|
6244
|
+
const source = await fs11.promises.readFile(configPath, "utf8");
|
|
6216
6245
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
6217
6246
|
const allTokens = extractClassesNative2(source);
|
|
6218
6247
|
const hasSafelist = source.includes("safelist");
|
|
@@ -6239,7 +6268,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
6239
6268
|
customUtilities: /* @__PURE__ */ new Set()
|
|
6240
6269
|
};
|
|
6241
6270
|
}
|
|
6242
|
-
const configStat = await
|
|
6271
|
+
const configStat = await fs11.promises.stat(configPath).catch(() => null);
|
|
6243
6272
|
if (configStat) {
|
|
6244
6273
|
const cached = tailwindConfigCache.get(configPath);
|
|
6245
6274
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -6398,7 +6427,7 @@ async function buildDistribution(usages, native) {
|
|
|
6398
6427
|
}
|
|
6399
6428
|
async function analyzeWorkspace(root, options = {}) {
|
|
6400
6429
|
const startedAtMs = Date.now();
|
|
6401
|
-
const resolvedRoot =
|
|
6430
|
+
const resolvedRoot = path14.resolve(root);
|
|
6402
6431
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
6403
6432
|
const scan = await (async () => {
|
|
6404
6433
|
const scanStartedAtMs = Date.now();
|
|
@@ -6511,8 +6540,8 @@ init_esm_shims();
|
|
|
6511
6540
|
init_src3();
|
|
6512
6541
|
init_src2();
|
|
6513
6542
|
init_native_bridge2();
|
|
6514
|
-
import
|
|
6515
|
-
import
|
|
6543
|
+
import fs12 from "fs";
|
|
6544
|
+
import path15 from "path";
|
|
6516
6545
|
var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
6517
6546
|
var log5 = createLogger2("engine:incremental");
|
|
6518
6547
|
function rebuildWorkspaceResult2(byFile) {
|
|
@@ -6545,8 +6574,8 @@ function areClassSetsEqual(a, b) {
|
|
|
6545
6574
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
6546
6575
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
6547
6576
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
6548
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
6549
|
-
const normalizedPath =
|
|
6577
|
+
const byFile = new Map(previous.files.map((f) => [path15.resolve(f.file), f]));
|
|
6578
|
+
const normalizedPath = path15.resolve(filePath);
|
|
6550
6579
|
const native = getNativeEngineBinding();
|
|
6551
6580
|
if (!native?.processFileChange) {
|
|
6552
6581
|
throw new Error(
|
|
@@ -6562,7 +6591,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
6562
6591
|
}
|
|
6563
6592
|
log5.debug(`native change ${normalizedPath}`);
|
|
6564
6593
|
const scanned = scanFile2(normalizedPath);
|
|
6565
|
-
const content =
|
|
6594
|
+
const content = fs12.readFileSync(normalizedPath, "utf8");
|
|
6566
6595
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
6567
6596
|
const existing = byFile.get(normalizedPath);
|
|
6568
6597
|
if (diff && existing) {
|
|
@@ -6912,16 +6941,16 @@ var EngineMetricsCollector = class {
|
|
|
6912
6941
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6913
6942
|
init_esm_shims();
|
|
6914
6943
|
init_src2();
|
|
6915
|
-
import
|
|
6916
|
-
import
|
|
6944
|
+
import fs13 from "fs";
|
|
6945
|
+
import path16 from "path";
|
|
6917
6946
|
import { performance } from "perf_hooks";
|
|
6918
6947
|
var _log = createLogger2("tw:metrics");
|
|
6919
6948
|
var METRICS_FILE_NAME = "metrics.json";
|
|
6920
6949
|
var CACHE_DIR = ".tw-cache";
|
|
6921
6950
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6922
6951
|
try {
|
|
6923
|
-
const cacheDir =
|
|
6924
|
-
|
|
6952
|
+
const cacheDir = path16.join(cwd, CACHE_DIR);
|
|
6953
|
+
fs13.mkdirSync(cacheDir, { recursive: true });
|
|
6925
6954
|
const mem = process.memoryUsage();
|
|
6926
6955
|
const data = {
|
|
6927
6956
|
...metrics,
|
|
@@ -6932,7 +6961,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6932
6961
|
},
|
|
6933
6962
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6934
6963
|
};
|
|
6935
|
-
|
|
6964
|
+
fs13.writeFileSync(path16.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6936
6965
|
} catch {
|
|
6937
6966
|
}
|
|
6938
6967
|
}
|
|
@@ -7204,7 +7233,7 @@ init_cssToIr();
|
|
|
7204
7233
|
init_esm_shims();
|
|
7205
7234
|
init_src2();
|
|
7206
7235
|
import { createRequire as createRequire7 } from "module";
|
|
7207
|
-
import
|
|
7236
|
+
import path17 from "path";
|
|
7208
7237
|
var watchBindingState = {
|
|
7209
7238
|
binding: void 0
|
|
7210
7239
|
};
|
|
@@ -7225,22 +7254,22 @@ var getBinding = () => {
|
|
|
7225
7254
|
const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
|
|
7226
7255
|
const candidates = [
|
|
7227
7256
|
// new binary name: tailwind-styled-native
|
|
7228
|
-
|
|
7229
|
-
|
|
7257
|
+
path17.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
7258
|
+
path17.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
|
|
7230
7259
|
// npm install case: dist/../native/
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7260
|
+
path17.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
7261
|
+
path17.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
|
|
7262
|
+
path17.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7234
7263
|
// monorepo dev: 4-level up
|
|
7235
|
-
|
|
7236
|
-
|
|
7264
|
+
path17.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7265
|
+
path17.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7237
7266
|
// 3-level fallback
|
|
7238
|
-
|
|
7267
|
+
path17.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7239
7268
|
// backward compat: tailwind_styled_parser
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7269
|
+
path17.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
|
|
7270
|
+
path17.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
7271
|
+
path17.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
7272
|
+
path17.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
|
|
7244
7273
|
];
|
|
7245
7274
|
for (const c of candidates) {
|
|
7246
7275
|
try {
|
|
@@ -7261,7 +7290,7 @@ var log6 = createLogger2("engine:watch-native");
|
|
|
7261
7290
|
function watchWorkspace2(rootDir, callback, options = {}) {
|
|
7262
7291
|
const binding = getBinding();
|
|
7263
7292
|
const pollMs = options.pollIntervalMs ?? 500;
|
|
7264
|
-
const resolvedRoot =
|
|
7293
|
+
const resolvedRoot = path17.resolve(rootDir);
|
|
7265
7294
|
const result = (() => {
|
|
7266
7295
|
try {
|
|
7267
7296
|
return binding.startWatch(resolvedRoot);
|
|
@@ -7298,7 +7327,7 @@ This package requires native Rust bindings.`
|
|
|
7298
7327
|
const deduped = /* @__PURE__ */ new Set();
|
|
7299
7328
|
const events = [];
|
|
7300
7329
|
for (const e of raw) {
|
|
7301
|
-
const absPath =
|
|
7330
|
+
const absPath = path17.isAbsolute(e.path) ? path17.normalize(e.path) : path17.resolve(resolvedRoot, e.path);
|
|
7302
7331
|
const kind = e.kind;
|
|
7303
7332
|
const key = `${kind}:${absPath}`;
|
|
7304
7333
|
if (deduped.has(key)) continue;
|
|
@@ -7338,8 +7367,8 @@ var configState = {
|
|
|
7338
7367
|
var log7 = createLogger2("engine");
|
|
7339
7368
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
7340
7369
|
if (!tailwindConfigPath) return void 0;
|
|
7341
|
-
const configPath =
|
|
7342
|
-
if (!
|
|
7370
|
+
const configPath = path18.resolve(root, tailwindConfigPath);
|
|
7371
|
+
if (!fs14.existsSync(configPath)) {
|
|
7343
7372
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
7344
7373
|
}
|
|
7345
7374
|
const imported = await import(pathToFileURL2(configPath).href);
|
|
@@ -7405,11 +7434,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
7405
7434
|
};
|
|
7406
7435
|
}
|
|
7407
7436
|
function countWorkspacePackages(root) {
|
|
7408
|
-
const packagesDir =
|
|
7409
|
-
if (!
|
|
7437
|
+
const packagesDir = path18.join(root, "packages");
|
|
7438
|
+
if (!fs14.existsSync(packagesDir)) return 0;
|
|
7410
7439
|
try {
|
|
7411
|
-
return
|
|
7412
|
-
(entry) => entry.isDirectory() &&
|
|
7440
|
+
return fs14.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
7441
|
+
(entry) => entry.isDirectory() && fs14.existsSync(path18.join(packagesDir, entry.name, "package.json"))
|
|
7413
7442
|
).length;
|
|
7414
7443
|
} catch (err) {
|
|
7415
7444
|
log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -7446,7 +7475,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
7446
7475
|
async function createEngine(rawOptions = {}) {
|
|
7447
7476
|
const options = parseEngineOptions(rawOptions);
|
|
7448
7477
|
const root = options.root ?? process.cwd();
|
|
7449
|
-
const resolvedRoot =
|
|
7478
|
+
const resolvedRoot = path18.resolve(root);
|
|
7450
7479
|
const plugins = rawOptions.plugins ?? [];
|
|
7451
7480
|
const getTailwindConfig = async () => {
|
|
7452
7481
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -7593,7 +7622,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
7593
7622
|
const shouldForceFullRescan = (event) => {
|
|
7594
7623
|
if (event.type === "unlink") return false;
|
|
7595
7624
|
try {
|
|
7596
|
-
const stat =
|
|
7625
|
+
const stat = fs14.statSync(event.filePath);
|
|
7597
7626
|
if (stat.size > largeFileThreshold) {
|
|
7598
7627
|
metrics.markSkippedLargeFile();
|
|
7599
7628
|
return true;
|
|
@@ -7711,14 +7740,14 @@ async function createEngine(rawOptions = {}) {
|
|
|
7711
7740
|
};
|
|
7712
7741
|
}
|
|
7713
7742
|
async function scanWorkspace3(opts = {}) {
|
|
7714
|
-
const root =
|
|
7743
|
+
const root = path18.resolve(opts.root ?? process.cwd());
|
|
7715
7744
|
return scanWorkspaceAsync(root, {
|
|
7716
7745
|
includeExtensions: opts.extensions,
|
|
7717
7746
|
ignoreDirectories: opts.ignoreDirectories
|
|
7718
7747
|
});
|
|
7719
7748
|
}
|
|
7720
7749
|
async function analyzeWorkspace2(opts = {}) {
|
|
7721
|
-
const root =
|
|
7750
|
+
const root = path18.resolve(opts.root ?? process.cwd());
|
|
7722
7751
|
return analyzeWorkspace(root, {
|
|
7723
7752
|
classStats: { top: opts.top ?? 20 }
|
|
7724
7753
|
});
|