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.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 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;
|
|
@@ -667,11 +667,11 @@ function resolvePath(...segments) {
|
|
|
667
667
|
return segments.join("/").replace(/\/+/g, "/");
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
function existsSync(
|
|
670
|
+
function existsSync(path18) {
|
|
671
671
|
if (isBrowser2) return false;
|
|
672
672
|
try {
|
|
673
673
|
const nodeFs = require(NODE_FS);
|
|
674
|
-
return nodeFs.existsSync(
|
|
674
|
+
return nodeFs.existsSync(path18);
|
|
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(path18) {
|
|
1030
1030
|
try {
|
|
1031
|
-
const res = await fetch(`${baseUrl}${
|
|
1031
|
+
const res = await fetch(`${baseUrl}${path18}`, {
|
|
1032
1032
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1033
1033
|
});
|
|
1034
1034
|
if (!res.ok) return null;
|
|
@@ -1069,7 +1069,7 @@ var init_nativeBridge = __esm({
|
|
|
1069
1069
|
"use strict";
|
|
1070
1070
|
init_cjs_shims();
|
|
1071
1071
|
init_src2();
|
|
1072
|
-
_loadNative = (
|
|
1072
|
+
_loadNative = (path18) => require(path18);
|
|
1073
1073
|
log = (...args) => {
|
|
1074
1074
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
1075
1075
|
console.log("[compiler:native]", ...args);
|
|
@@ -2906,6 +2906,33 @@ var init_routeGraph = __esm({
|
|
|
2906
2906
|
}
|
|
2907
2907
|
});
|
|
2908
2908
|
|
|
2909
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2910
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2911
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2912
|
+
"use strict";
|
|
2913
|
+
init_cjs_shims();
|
|
2914
|
+
}
|
|
2915
|
+
});
|
|
2916
|
+
|
|
2917
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2918
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2919
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2920
|
+
"use strict";
|
|
2921
|
+
init_cjs_shims();
|
|
2922
|
+
}
|
|
2923
|
+
});
|
|
2924
|
+
|
|
2925
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2926
|
+
var import_node_fs2, import_node_path2;
|
|
2927
|
+
var init_typeGenerationPlugin = __esm({
|
|
2928
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2929
|
+
"use strict";
|
|
2930
|
+
init_cjs_shims();
|
|
2931
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
2932
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
2933
|
+
}
|
|
2934
|
+
});
|
|
2935
|
+
|
|
2909
2936
|
// packages/domain/compiler/src/index.ts
|
|
2910
2937
|
function _layoutClassesToCss(classes) {
|
|
2911
2938
|
const native = getNativeBridge();
|
|
@@ -2941,13 +2968,13 @@ function extractContainerCssFromSource(source) {
|
|
|
2941
2968
|
}
|
|
2942
2969
|
return rules.join("\n");
|
|
2943
2970
|
}
|
|
2944
|
-
var
|
|
2971
|
+
var import_node_fs3, import_node_path3, import_node_module4, _require2, 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;
|
|
2945
2972
|
var init_src = __esm({
|
|
2946
2973
|
"packages/domain/compiler/src/index.ts"() {
|
|
2947
2974
|
"use strict";
|
|
2948
2975
|
init_cjs_shims();
|
|
2949
|
-
|
|
2950
|
-
|
|
2976
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
2977
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
2951
2978
|
import_node_module4 = require("module");
|
|
2952
2979
|
init_nativeBridge();
|
|
2953
2980
|
init_compiler();
|
|
@@ -2957,6 +2984,9 @@ var init_src = __esm({
|
|
|
2957
2984
|
init_redis();
|
|
2958
2985
|
init_watch();
|
|
2959
2986
|
init_routeGraph();
|
|
2987
|
+
init_semanticComponentAnalyzer();
|
|
2988
|
+
init_typeGeneratorFromMetadata();
|
|
2989
|
+
init_typeGenerationPlugin();
|
|
2960
2990
|
_require2 = (0, import_node_module4.createRequire)(
|
|
2961
2991
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
2962
2992
|
);
|
|
@@ -3051,7 +3081,7 @@ var init_src = __esm({
|
|
|
3051
3081
|
};
|
|
3052
3082
|
scanProjectUsage = (dirs, cwd) => {
|
|
3053
3083
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
3054
|
-
const files = dirs.map((dir) =>
|
|
3084
|
+
const files = dirs.map((dir) => import_node_path3.default.resolve(cwd, dir));
|
|
3055
3085
|
const results = batchExtractClasses2(files) || [];
|
|
3056
3086
|
const combined = {};
|
|
3057
3087
|
for (const result of results) {
|
|
@@ -3068,13 +3098,13 @@ var init_src = __esm({
|
|
|
3068
3098
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3069
3099
|
const allClasses = Object.keys(classes).sort();
|
|
3070
3100
|
if (outputPath) {
|
|
3071
|
-
|
|
3101
|
+
import_node_fs3.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3072
3102
|
}
|
|
3073
3103
|
return allClasses;
|
|
3074
3104
|
};
|
|
3075
3105
|
loadSafelist = (safelistPath) => {
|
|
3076
3106
|
try {
|
|
3077
|
-
const content =
|
|
3107
|
+
const content = import_node_fs3.default.readFileSync(safelistPath, "utf-8");
|
|
3078
3108
|
return JSON.parse(content);
|
|
3079
3109
|
} catch {
|
|
3080
3110
|
return [];
|
|
@@ -3088,8 +3118,8 @@ var init_src = __esm({
|
|
|
3088
3118
|
"tailwind.config.cjs"
|
|
3089
3119
|
];
|
|
3090
3120
|
for (const file of configFiles) {
|
|
3091
|
-
const fullPath =
|
|
3092
|
-
if (
|
|
3121
|
+
const fullPath = import_node_path3.default.join(cwd, file);
|
|
3122
|
+
if (import_node_fs3.default.existsSync(fullPath)) {
|
|
3093
3123
|
const mod = require(fullPath);
|
|
3094
3124
|
return mod.default || mod;
|
|
3095
3125
|
}
|
|
@@ -3099,9 +3129,9 @@ var init_src = __esm({
|
|
|
3099
3129
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3100
3130
|
return {
|
|
3101
3131
|
content: [
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3132
|
+
import_node_path3.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3133
|
+
import_node_path3.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3134
|
+
import_node_path3.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3105
3135
|
]
|
|
3106
3136
|
};
|
|
3107
3137
|
};
|
|
@@ -3588,17 +3618,17 @@ function getNative() {
|
|
|
3588
3618
|
function* walkSourceFiles(dir) {
|
|
3589
3619
|
let entries;
|
|
3590
3620
|
try {
|
|
3591
|
-
entries =
|
|
3621
|
+
entries = import_node_fs4.default.readdirSync(dir, { withFileTypes: true });
|
|
3592
3622
|
} catch {
|
|
3593
3623
|
return;
|
|
3594
3624
|
}
|
|
3595
3625
|
for (const entry of entries) {
|
|
3596
|
-
const fullPath =
|
|
3626
|
+
const fullPath = import_node_path4.default.join(dir, entry.name);
|
|
3597
3627
|
if (entry.isDirectory()) {
|
|
3598
3628
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3599
3629
|
yield* walkSourceFiles(fullPath);
|
|
3600
3630
|
} else if (entry.isFile()) {
|
|
3601
|
-
const ext =
|
|
3631
|
+
const ext = import_node_path4.default.extname(entry.name);
|
|
3602
3632
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3603
3633
|
}
|
|
3604
3634
|
}
|
|
@@ -3662,7 +3692,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3662
3692
|
allConfigs.push(...configs);
|
|
3663
3693
|
if (verbose) {
|
|
3664
3694
|
process.stderr.write(
|
|
3665
|
-
`[tw:static-state] ${
|
|
3695
|
+
`[tw:static-state] ${import_node_path4.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3666
3696
|
`
|
|
3667
3697
|
);
|
|
3668
3698
|
}
|
|
@@ -3673,7 +3703,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3673
3703
|
if (filesScanned >= maxFiles) break;
|
|
3674
3704
|
let source;
|
|
3675
3705
|
try {
|
|
3676
|
-
source =
|
|
3706
|
+
source = import_node_fs4.default.readFileSync(filePath, "utf-8");
|
|
3677
3707
|
} catch {
|
|
3678
3708
|
continue;
|
|
3679
3709
|
}
|
|
@@ -3686,7 +3716,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3686
3716
|
allConfigs.push(...configs);
|
|
3687
3717
|
if (verbose) {
|
|
3688
3718
|
process.stderr.write(
|
|
3689
|
-
`[tw:static-state] ${
|
|
3719
|
+
`[tw:static-state] ${import_node_path4.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3690
3720
|
`
|
|
3691
3721
|
);
|
|
3692
3722
|
}
|
|
@@ -3780,12 +3810,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3780
3810
|
resolvedCss: options.resolvedCss || ""
|
|
3781
3811
|
// ← ensure always passed
|
|
3782
3812
|
});
|
|
3783
|
-
const twClassesDir =
|
|
3784
|
-
|
|
3785
|
-
const stateFilePath =
|
|
3813
|
+
const twClassesDir = import_node_path4.default.join(import_node_path4.default.dirname(safelistPath), "tw-classes");
|
|
3814
|
+
import_node_fs4.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3815
|
+
const stateFilePath = import_node_path4.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3786
3816
|
if (result.rulesGenerated === 0) {
|
|
3787
3817
|
try {
|
|
3788
|
-
|
|
3818
|
+
import_node_fs4.default.writeFileSync(
|
|
3789
3819
|
stateFilePath,
|
|
3790
3820
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3791
3821
|
"utf-8"
|
|
@@ -3795,7 +3825,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3795
3825
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3796
3826
|
}
|
|
3797
3827
|
try {
|
|
3798
|
-
|
|
3828
|
+
import_node_fs4.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3799
3829
|
return [
|
|
3800
3830
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3801
3831
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3807,13 +3837,13 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3807
3837
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3808
3838
|
}
|
|
3809
3839
|
}
|
|
3810
|
-
var
|
|
3840
|
+
var import_node_fs4, import_node_path4, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3811
3841
|
var init_staticStateExtractor = __esm({
|
|
3812
3842
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3813
3843
|
"use strict";
|
|
3814
3844
|
init_cjs_shims();
|
|
3815
|
-
|
|
3816
|
-
|
|
3845
|
+
import_node_fs4 = __toESM(require("fs"));
|
|
3846
|
+
import_node_path4 = __toESM(require("path"));
|
|
3817
3847
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3818
3848
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3819
3849
|
_native = null;
|
|
@@ -3831,8 +3861,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3831
3861
|
_globalLogFile = filePath;
|
|
3832
3862
|
_logFileInitialized = false;
|
|
3833
3863
|
try {
|
|
3834
|
-
|
|
3835
|
-
|
|
3864
|
+
import_node_fs5.default.mkdirSync(import_node_path5.default.dirname(filePath), { recursive: true });
|
|
3865
|
+
import_node_fs5.default.writeFileSync(
|
|
3836
3866
|
filePath,
|
|
3837
3867
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3838
3868
|
`,
|
|
@@ -3845,7 +3875,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3845
3875
|
function writeToFile(line) {
|
|
3846
3876
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3847
3877
|
try {
|
|
3848
|
-
|
|
3878
|
+
import_node_fs5.default.appendFileSync(_globalLogFile, line);
|
|
3849
3879
|
} catch {
|
|
3850
3880
|
}
|
|
3851
3881
|
}
|
|
@@ -3872,13 +3902,13 @@ function createLogger(prefix, level) {
|
|
|
3872
3902
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3873
3903
|
};
|
|
3874
3904
|
}
|
|
3875
|
-
var
|
|
3905
|
+
var import_node_fs5, import_node_path5, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3876
3906
|
var init_logger = __esm({
|
|
3877
3907
|
"packages/domain/shared/src/logger.ts"() {
|
|
3878
3908
|
"use strict";
|
|
3879
3909
|
init_cjs_shims();
|
|
3880
|
-
|
|
3881
|
-
|
|
3910
|
+
import_node_fs5 = __toESM(require("fs"));
|
|
3911
|
+
import_node_path5 = __toESM(require("path"));
|
|
3882
3912
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3883
3913
|
_globalLogFile = null;
|
|
3884
3914
|
_logFileInitialized = false;
|
|
@@ -3987,9 +4017,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3987
4017
|
}
|
|
3988
4018
|
};
|
|
3989
4019
|
}
|
|
3990
|
-
function formatIssuePath(
|
|
3991
|
-
if (!
|
|
3992
|
-
return
|
|
4020
|
+
function formatIssuePath(path18) {
|
|
4021
|
+
if (!path18 || path18.length === 0) return "(root)";
|
|
4022
|
+
return path18.map(
|
|
3993
4023
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3994
4024
|
).join(".");
|
|
3995
4025
|
}
|
|
@@ -4003,9 +4033,9 @@ function loadNativeBinding(options) {
|
|
|
4003
4033
|
const { runtimeDir, candidates, isValid } = options;
|
|
4004
4034
|
const loadErrors = [];
|
|
4005
4035
|
for (const candidate of candidates) {
|
|
4006
|
-
const candidatePath =
|
|
4036
|
+
const candidatePath = import_node_path6.default.resolve(runtimeDir, candidate);
|
|
4007
4037
|
try {
|
|
4008
|
-
if (!
|
|
4038
|
+
if (!import_node_fs6.default.existsSync(candidatePath) && !import_node_fs6.default.existsSync(candidatePath + ".node")) {
|
|
4009
4039
|
continue;
|
|
4010
4040
|
}
|
|
4011
4041
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -4037,9 +4067,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
4037
4067
|
}
|
|
4038
4068
|
}
|
|
4039
4069
|
if (!includeDefaultCandidates) return candidates;
|
|
4040
|
-
if (
|
|
4070
|
+
if (import_node_fs6.default.existsSync(runtimeDir)) {
|
|
4041
4071
|
try {
|
|
4042
|
-
for (const entry of
|
|
4072
|
+
for (const entry of import_node_fs6.default.readdirSync(runtimeDir)) {
|
|
4043
4073
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
4044
4074
|
}
|
|
4045
4075
|
} catch {
|
|
@@ -4048,22 +4078,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
4048
4078
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
4049
4079
|
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
4080
|
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(
|
|
4081
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, `${bin}.node`));
|
|
4082
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
4083
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
4084
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4085
|
+
candidates.push(import_node_path6.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
4086
|
+
candidates.push(import_node_path6.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
4087
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
4088
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4089
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
4060
4090
|
}
|
|
4061
4091
|
return Array.from(new Set(candidates));
|
|
4062
4092
|
}
|
|
4063
4093
|
function resolveRuntimeDir(dir, importMetaUrl2) {
|
|
4064
|
-
if (dir) return
|
|
4094
|
+
if (dir) return import_node_path6.default.resolve(dir);
|
|
4065
4095
|
try {
|
|
4066
|
-
return
|
|
4096
|
+
return import_node_path6.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl2));
|
|
4067
4097
|
} catch {
|
|
4068
4098
|
return process.cwd();
|
|
4069
4099
|
}
|
|
@@ -4077,14 +4107,14 @@ function formatErrorMessage(error) {
|
|
|
4077
4107
|
if (error instanceof Error) return error.message;
|
|
4078
4108
|
return String(error);
|
|
4079
4109
|
}
|
|
4080
|
-
var import_node_crypto,
|
|
4110
|
+
var import_node_crypto, import_node_fs6, import_node_path6, import_node_url, import_node_module5, TwError, _require3, LRUCache;
|
|
4081
4111
|
var init_src2 = __esm({
|
|
4082
4112
|
"packages/domain/shared/src/index.ts"() {
|
|
4083
4113
|
"use strict";
|
|
4084
4114
|
init_cjs_shims();
|
|
4085
4115
|
import_node_crypto = require("crypto");
|
|
4086
|
-
|
|
4087
|
-
|
|
4116
|
+
import_node_fs6 = __toESM(require("fs"));
|
|
4117
|
+
import_node_path6 = __toESM(require("path"));
|
|
4088
4118
|
import_node_url = require("url");
|
|
4089
4119
|
import_node_module5 = require("module");
|
|
4090
4120
|
init_trace();
|
|
@@ -4133,8 +4163,8 @@ var init_src2 = __esm({
|
|
|
4133
4163
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
4134
4164
|
static fromZod(err) {
|
|
4135
4165
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
4136
|
-
const
|
|
4137
|
-
const message = first ? `${
|
|
4166
|
+
const path18 = formatIssuePath(first?.path);
|
|
4167
|
+
const message = first ? `${path18}: ${first.message}` : "Schema validation failed";
|
|
4138
4168
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
4139
4169
|
}
|
|
4140
4170
|
static wrap(source, code, err) {
|
|
@@ -4234,7 +4264,7 @@ function getDirname2() {
|
|
|
4234
4264
|
return __dirname;
|
|
4235
4265
|
}
|
|
4236
4266
|
if (typeof import_meta4 !== "undefined" && importMetaUrl) {
|
|
4237
|
-
return
|
|
4267
|
+
return import_node_path7.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
4238
4268
|
}
|
|
4239
4269
|
return process.cwd();
|
|
4240
4270
|
}
|
|
@@ -4446,12 +4476,12 @@ function hasNativeWatchBinding() {
|
|
|
4446
4476
|
return false;
|
|
4447
4477
|
}
|
|
4448
4478
|
}
|
|
4449
|
-
var
|
|
4479
|
+
var import_node_path7, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4450
4480
|
var init_native_bridge = __esm({
|
|
4451
4481
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4452
4482
|
"use strict";
|
|
4453
4483
|
init_cjs_shims();
|
|
4454
|
-
|
|
4484
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
4455
4485
|
import_node_url2 = require("url");
|
|
4456
4486
|
init_src2();
|
|
4457
4487
|
import_meta4 = {};
|
|
@@ -4541,8 +4571,8 @@ var init_native_bridge = __esm({
|
|
|
4541
4571
|
|
|
4542
4572
|
// packages/domain/scanner/src/cache-native.ts
|
|
4543
4573
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4544
|
-
const dir = cacheDir ?
|
|
4545
|
-
return
|
|
4574
|
+
const dir = cacheDir ? import_node_path8.default.resolve(rootDir, cacheDir) : import_node_path8.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4575
|
+
return import_node_path8.default.join(dir, "scanner-cache.json");
|
|
4546
4576
|
}
|
|
4547
4577
|
function metaPathFor(cachePath) {
|
|
4548
4578
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4555,7 +4585,7 @@ function getBinaryFingerprint() {
|
|
|
4555
4585
|
_cachedFingerprint = null;
|
|
4556
4586
|
return null;
|
|
4557
4587
|
}
|
|
4558
|
-
const stat =
|
|
4588
|
+
const stat = import_node_fs7.default.statSync(loadedPath);
|
|
4559
4589
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4560
4590
|
} catch {
|
|
4561
4591
|
_cachedFingerprint = null;
|
|
@@ -4564,13 +4594,13 @@ function getBinaryFingerprint() {
|
|
|
4564
4594
|
}
|
|
4565
4595
|
function readCache(rootDir, cacheDir) {
|
|
4566
4596
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4567
|
-
|
|
4597
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(cachePath), { recursive: true });
|
|
4568
4598
|
const currentFingerprint = getBinaryFingerprint();
|
|
4569
4599
|
if (currentFingerprint !== null) {
|
|
4570
4600
|
const metaPath = metaPathFor(cachePath);
|
|
4571
4601
|
let storedFingerprint = null;
|
|
4572
4602
|
try {
|
|
4573
|
-
storedFingerprint = JSON.parse(
|
|
4603
|
+
storedFingerprint = JSON.parse(import_node_fs7.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4574
4604
|
} catch {
|
|
4575
4605
|
}
|
|
4576
4606
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4594,7 +4624,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4594
4624
|
}
|
|
4595
4625
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4596
4626
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4597
|
-
|
|
4627
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(cachePath), { recursive: true });
|
|
4598
4628
|
const success = cacheWriteNative(cachePath, entries);
|
|
4599
4629
|
if (!success) {
|
|
4600
4630
|
throw new Error(
|
|
@@ -4604,7 +4634,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4604
4634
|
const currentFingerprint = getBinaryFingerprint();
|
|
4605
4635
|
if (currentFingerprint !== null) {
|
|
4606
4636
|
try {
|
|
4607
|
-
|
|
4637
|
+
import_node_fs7.default.writeFileSync(
|
|
4608
4638
|
metaPathFor(cachePath),
|
|
4609
4639
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4610
4640
|
"utf8"
|
|
@@ -4624,13 +4654,13 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4624
4654
|
nowMs
|
|
4625
4655
|
);
|
|
4626
4656
|
}
|
|
4627
|
-
var
|
|
4657
|
+
var import_node_fs7, import_node_path8, _cachedFingerprint, STALE_THRESHOLD_MS;
|
|
4628
4658
|
var init_cache_native = __esm({
|
|
4629
4659
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4630
4660
|
"use strict";
|
|
4631
4661
|
init_cjs_shims();
|
|
4632
|
-
|
|
4633
|
-
|
|
4662
|
+
import_node_fs7 = __toESM(require("fs"), 1);
|
|
4663
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
4634
4664
|
init_native_bridge();
|
|
4635
4665
|
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4636
4666
|
}
|
|
@@ -4677,7 +4707,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4677
4707
|
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
4678
4708
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4679
4709
|
} = options;
|
|
4680
|
-
const files = collectFiles2(
|
|
4710
|
+
const files = collectFiles2(import_node_path9.default.resolve(rootDir), extensions, ignoreDirs);
|
|
4681
4711
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4682
4712
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4683
4713
|
}
|
|
@@ -4693,13 +4723,13 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4693
4723
|
}
|
|
4694
4724
|
return mergeResults(allResults);
|
|
4695
4725
|
}
|
|
4696
|
-
var import_node_worker_threads,
|
|
4726
|
+
var import_node_worker_threads, import_node_path9, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4697
4727
|
var init_parallel_scanner = __esm({
|
|
4698
4728
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4699
4729
|
"use strict";
|
|
4700
4730
|
init_cjs_shims();
|
|
4701
4731
|
import_node_worker_threads = require("worker_threads");
|
|
4702
|
-
|
|
4732
|
+
import_node_path9 = __toESM(require("path"), 1);
|
|
4703
4733
|
import_node_os = require("os");
|
|
4704
4734
|
import_node_url3 = require("url");
|
|
4705
4735
|
init_src3();
|
|
@@ -4732,12 +4762,12 @@ var init_schemas = __esm({
|
|
|
4732
4762
|
init_cjs_shims();
|
|
4733
4763
|
import_zod3 = require("zod");
|
|
4734
4764
|
init_src2();
|
|
4735
|
-
formatIssuePath2 = (
|
|
4765
|
+
formatIssuePath2 = (path18) => path18.length > 0 ? path18.map(
|
|
4736
4766
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4737
4767
|
).join(".") : "<root>";
|
|
4738
4768
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4739
|
-
const
|
|
4740
|
-
return `${
|
|
4769
|
+
const path18 = formatIssuePath2(issue.path);
|
|
4770
|
+
return `${path18}: ${issue.message}`;
|
|
4741
4771
|
}).join("; ");
|
|
4742
4772
|
parseWithSchema = (schema, data, label) => {
|
|
4743
4773
|
const parsed = schema.safeParse(data);
|
|
@@ -4814,7 +4844,7 @@ function getRuntimeDir() {
|
|
|
4814
4844
|
return __dirname;
|
|
4815
4845
|
}
|
|
4816
4846
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4817
|
-
return
|
|
4847
|
+
return import_node_path10.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4818
4848
|
}
|
|
4819
4849
|
return process.cwd();
|
|
4820
4850
|
}
|
|
@@ -4824,17 +4854,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4824
4854
|
return __dirname;
|
|
4825
4855
|
}
|
|
4826
4856
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4827
|
-
return
|
|
4857
|
+
return import_node_path10.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4828
4858
|
}
|
|
4829
4859
|
return process.cwd();
|
|
4830
4860
|
})();
|
|
4831
4861
|
const candidates = [
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4862
|
+
import_node_path10.default.resolve(runtimeDir, "worker.cjs"),
|
|
4863
|
+
import_node_path10.default.resolve(runtimeDir, "worker.js"),
|
|
4864
|
+
import_node_path10.default.resolve(runtimeDir, "worker.ts")
|
|
4835
4865
|
];
|
|
4836
4866
|
for (const candidate of candidates) {
|
|
4837
|
-
if (
|
|
4867
|
+
if (import_node_fs8.default.existsSync(candidate)) return candidate;
|
|
4838
4868
|
}
|
|
4839
4869
|
return null;
|
|
4840
4870
|
}
|
|
@@ -4891,19 +4921,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4891
4921
|
if (!currentDir) continue;
|
|
4892
4922
|
const entries = (() => {
|
|
4893
4923
|
try {
|
|
4894
|
-
return
|
|
4924
|
+
return import_node_fs8.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4895
4925
|
} catch {
|
|
4896
4926
|
return [];
|
|
4897
4927
|
}
|
|
4898
4928
|
})();
|
|
4899
4929
|
for (const entry of entries) {
|
|
4900
|
-
const fullPath =
|
|
4930
|
+
const fullPath = import_node_path10.default.join(currentDir, entry.name);
|
|
4901
4931
|
if (entry.isDirectory()) {
|
|
4902
4932
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4903
4933
|
continue;
|
|
4904
4934
|
}
|
|
4905
4935
|
if (!entry.isFile()) continue;
|
|
4906
|
-
if (!extensionSet.has(
|
|
4936
|
+
if (!extensionSet.has(import_node_path10.default.extname(entry.name))) continue;
|
|
4907
4937
|
candidates.push(fullPath);
|
|
4908
4938
|
}
|
|
4909
4939
|
}
|
|
@@ -4930,7 +4960,7 @@ function scanSource(source) {
|
|
|
4930
4960
|
);
|
|
4931
4961
|
}
|
|
4932
4962
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4933
|
-
return includeExtensions.includes(
|
|
4963
|
+
return includeExtensions.includes(import_node_path10.default.extname(filePath));
|
|
4934
4964
|
}
|
|
4935
4965
|
function scanFile2(filePath) {
|
|
4936
4966
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4990,7 +5020,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4990
5020
|
for (const filePath of candidates) {
|
|
4991
5021
|
const stat = (() => {
|
|
4992
5022
|
try {
|
|
4993
|
-
return
|
|
5023
|
+
return import_node_fs8.default.statSync(filePath);
|
|
4994
5024
|
} catch {
|
|
4995
5025
|
return null;
|
|
4996
5026
|
}
|
|
@@ -5016,7 +5046,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
5016
5046
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
5017
5047
|
const content = (() => {
|
|
5018
5048
|
try {
|
|
5019
|
-
return
|
|
5049
|
+
return import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
5020
5050
|
} catch {
|
|
5021
5051
|
return null;
|
|
5022
5052
|
}
|
|
@@ -5097,14 +5127,14 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
5097
5127
|
return scanWorkspace2(rootDir, normalizedOptions);
|
|
5098
5128
|
}
|
|
5099
5129
|
}
|
|
5100
|
-
var
|
|
5130
|
+
var import_node_fs8, import_node_module6, import_node_path10, import_node_url4, import_node_worker_threads2, import_meta5, log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
5101
5131
|
var init_src3 = __esm({
|
|
5102
5132
|
"packages/domain/scanner/src/index.ts"() {
|
|
5103
5133
|
"use strict";
|
|
5104
5134
|
init_cjs_shims();
|
|
5105
|
-
|
|
5135
|
+
import_node_fs8 = __toESM(require("fs"), 1);
|
|
5106
5136
|
import_node_module6 = require("module");
|
|
5107
|
-
|
|
5137
|
+
import_node_path10 = __toESM(require("path"), 1);
|
|
5108
5138
|
import_node_url4 = require("url");
|
|
5109
5139
|
import_node_worker_threads2 = require("worker_threads");
|
|
5110
5140
|
init_src2();
|
|
@@ -5128,7 +5158,7 @@ var init_src3 = __esm({
|
|
|
5128
5158
|
const loadNativeParserBinding = () => {
|
|
5129
5159
|
if (_state.binding !== void 0) return _state.binding;
|
|
5130
5160
|
const runtimeDir = getRuntimeDir();
|
|
5131
|
-
const req = (0, import_node_module6.createRequire)(
|
|
5161
|
+
const req = (0, import_node_module6.createRequire)(import_node_path10.default.join(runtimeDir, "noop.cjs"));
|
|
5132
5162
|
const _platform = process.platform;
|
|
5133
5163
|
const _arch = process.arch;
|
|
5134
5164
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -5136,27 +5166,27 @@ var init_src3 = __esm({
|
|
|
5136
5166
|
const candidates = [
|
|
5137
5167
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
5138
5168
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5169
|
+
import_node_path10.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
5170
|
+
import_node_path10.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5171
|
+
import_node_path10.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5142
5172
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
5143
5173
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5174
|
+
import_node_path10.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
5175
|
+
import_node_path10.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5176
|
+
import_node_path10.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5147
5177
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
5148
|
-
|
|
5149
|
-
|
|
5178
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5179
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5150
5180
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
5151
|
-
|
|
5152
|
-
|
|
5181
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5182
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5153
5183
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5184
|
+
import_node_path10.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5185
|
+
import_node_path10.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5186
|
+
import_node_path10.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5187
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5188
|
+
import_node_path10.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5189
|
+
import_node_path10.default.resolve(
|
|
5160
5190
|
runtimeDir,
|
|
5161
5191
|
"..",
|
|
5162
5192
|
"..",
|
|
@@ -5168,7 +5198,7 @@ var init_src3 = __esm({
|
|
|
5168
5198
|
)
|
|
5169
5199
|
];
|
|
5170
5200
|
for (const fullPath of candidates) {
|
|
5171
|
-
if (!
|
|
5201
|
+
if (!import_node_fs8.default.existsSync(fullPath)) continue;
|
|
5172
5202
|
try {
|
|
5173
5203
|
const required = req(fullPath);
|
|
5174
5204
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -5944,8 +5974,8 @@ init_cjs_shims();
|
|
|
5944
5974
|
|
|
5945
5975
|
// packages/domain/engine/src/index.ts
|
|
5946
5976
|
init_cjs_shims();
|
|
5947
|
-
var
|
|
5948
|
-
var
|
|
5977
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
5978
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
5949
5979
|
var import_node_url6 = require("url");
|
|
5950
5980
|
|
|
5951
5981
|
// packages/domain/analyzer/src/index.ts
|
|
@@ -5953,7 +5983,7 @@ init_cjs_shims();
|
|
|
5953
5983
|
|
|
5954
5984
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5955
5985
|
init_cjs_shims();
|
|
5956
|
-
var
|
|
5986
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
5957
5987
|
init_src3();
|
|
5958
5988
|
|
|
5959
5989
|
// packages/domain/analyzer/src/binding.ts
|
|
@@ -5962,7 +5992,7 @@ init_src2();
|
|
|
5962
5992
|
|
|
5963
5993
|
// packages/domain/analyzer/src/utils.ts
|
|
5964
5994
|
init_cjs_shims();
|
|
5965
|
-
var
|
|
5995
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
5966
5996
|
init_src2();
|
|
5967
5997
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5968
5998
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -5977,7 +6007,7 @@ function isRecord(value) {
|
|
|
5977
6007
|
}
|
|
5978
6008
|
async function pathExists(filePath) {
|
|
5979
6009
|
try {
|
|
5980
|
-
await
|
|
6010
|
+
await import_node_fs9.default.promises.access(filePath, import_node_fs9.default.constants.F_OK);
|
|
5981
6011
|
return true;
|
|
5982
6012
|
} catch {
|
|
5983
6013
|
return false;
|
|
@@ -6078,7 +6108,7 @@ async function requireNativeBinding() {
|
|
|
6078
6108
|
init_cjs_shims();
|
|
6079
6109
|
init_src2();
|
|
6080
6110
|
var import_zod4 = require("zod");
|
|
6081
|
-
var formatIssuePath3 = (
|
|
6111
|
+
var formatIssuePath3 = (path18) => path18.length > 0 ? path18.map(
|
|
6082
6112
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
6083
6113
|
).join(".") : "<root>";
|
|
6084
6114
|
var isPlainObject = (value) => {
|
|
@@ -6087,8 +6117,8 @@ var isPlainObject = (value) => {
|
|
|
6087
6117
|
return proto === Object.prototype || proto === null;
|
|
6088
6118
|
};
|
|
6089
6119
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
6090
|
-
const
|
|
6091
|
-
return `${
|
|
6120
|
+
const path18 = formatIssuePath3(issue.path);
|
|
6121
|
+
return `${path18}: ${issue.message}`;
|
|
6092
6122
|
}).join("; ");
|
|
6093
6123
|
var parseWithSchema2 = (schema, data, label) => {
|
|
6094
6124
|
const parsed = schema.safeParse(data);
|
|
@@ -6179,8 +6209,8 @@ var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report,
|
|
|
6179
6209
|
|
|
6180
6210
|
// packages/domain/analyzer/src/semantic.ts
|
|
6181
6211
|
init_cjs_shims();
|
|
6182
|
-
var
|
|
6183
|
-
var
|
|
6212
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
6213
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
6184
6214
|
var import_node_url5 = require("url");
|
|
6185
6215
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
6186
6216
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -6201,11 +6231,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
6201
6231
|
};
|
|
6202
6232
|
};
|
|
6203
6233
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
6204
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
6234
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path11.default.extname(configPath).toLowerCase());
|
|
6205
6235
|
};
|
|
6206
6236
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
6207
6237
|
if (explicitPath) {
|
|
6208
|
-
const resolved =
|
|
6238
|
+
const resolved = import_node_path11.default.resolve(root, explicitPath);
|
|
6209
6239
|
if (!await pathExists(resolved)) return null;
|
|
6210
6240
|
return resolved;
|
|
6211
6241
|
}
|
|
@@ -6216,7 +6246,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
6216
6246
|
"tailwind.config.mjs"
|
|
6217
6247
|
];
|
|
6218
6248
|
for (const candidate of candidates) {
|
|
6219
|
-
const fullPath =
|
|
6249
|
+
const fullPath = import_node_path11.default.resolve(root, candidate);
|
|
6220
6250
|
if (await pathExists(fullPath)) return fullPath;
|
|
6221
6251
|
}
|
|
6222
6252
|
return null;
|
|
@@ -6270,7 +6300,7 @@ var collectCustomUtilities = (config) => {
|
|
|
6270
6300
|
return out;
|
|
6271
6301
|
};
|
|
6272
6302
|
var collectSafelistFromSource = async (configPath) => {
|
|
6273
|
-
const source = await
|
|
6303
|
+
const source = await import_node_fs10.default.promises.readFile(configPath, "utf8");
|
|
6274
6304
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
6275
6305
|
const allTokens = extractClassesNative2(source);
|
|
6276
6306
|
const hasSafelist = source.includes("safelist");
|
|
@@ -6297,7 +6327,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
6297
6327
|
customUtilities: /* @__PURE__ */ new Set()
|
|
6298
6328
|
};
|
|
6299
6329
|
}
|
|
6300
|
-
const configStat = await
|
|
6330
|
+
const configStat = await import_node_fs10.default.promises.stat(configPath).catch(() => null);
|
|
6301
6331
|
if (configStat) {
|
|
6302
6332
|
const cached = tailwindConfigCache.get(configPath);
|
|
6303
6333
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -6456,7 +6486,7 @@ async function buildDistribution(usages, native) {
|
|
|
6456
6486
|
}
|
|
6457
6487
|
async function analyzeWorkspace(root, options = {}) {
|
|
6458
6488
|
const startedAtMs = Date.now();
|
|
6459
|
-
const resolvedRoot =
|
|
6489
|
+
const resolvedRoot = import_node_path12.default.resolve(root);
|
|
6460
6490
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
6461
6491
|
const scan = await (async () => {
|
|
6462
6492
|
const scanStartedAtMs = Date.now();
|
|
@@ -6566,8 +6596,8 @@ init_src2();
|
|
|
6566
6596
|
|
|
6567
6597
|
// packages/domain/engine/src/incremental.ts
|
|
6568
6598
|
init_cjs_shims();
|
|
6569
|
-
var
|
|
6570
|
-
var
|
|
6599
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
6600
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6571
6601
|
init_src3();
|
|
6572
6602
|
init_src2();
|
|
6573
6603
|
init_native_bridge2();
|
|
@@ -6603,8 +6633,8 @@ function areClassSetsEqual(a, b) {
|
|
|
6603
6633
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
6604
6634
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
6605
6635
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
6606
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
6607
|
-
const normalizedPath =
|
|
6636
|
+
const byFile = new Map(previous.files.map((f) => [import_node_path13.default.resolve(f.file), f]));
|
|
6637
|
+
const normalizedPath = import_node_path13.default.resolve(filePath);
|
|
6608
6638
|
const native = getNativeEngineBinding();
|
|
6609
6639
|
if (!native?.processFileChange) {
|
|
6610
6640
|
throw new Error(
|
|
@@ -6620,7 +6650,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
6620
6650
|
}
|
|
6621
6651
|
log5.debug(`native change ${normalizedPath}`);
|
|
6622
6652
|
const scanned = scanFile2(normalizedPath);
|
|
6623
|
-
const content =
|
|
6653
|
+
const content = import_node_fs11.default.readFileSync(normalizedPath, "utf8");
|
|
6624
6654
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
6625
6655
|
const existing = byFile.get(normalizedPath);
|
|
6626
6656
|
if (diff && existing) {
|
|
@@ -6969,8 +6999,8 @@ var EngineMetricsCollector = class {
|
|
|
6969
6999
|
|
|
6970
7000
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6971
7001
|
init_cjs_shims();
|
|
6972
|
-
var
|
|
6973
|
-
var
|
|
7002
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
7003
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
6974
7004
|
var import_node_perf_hooks = require("perf_hooks");
|
|
6975
7005
|
init_src2();
|
|
6976
7006
|
var _log = createLogger2("tw:metrics");
|
|
@@ -6978,8 +7008,8 @@ var METRICS_FILE_NAME = "metrics.json";
|
|
|
6978
7008
|
var CACHE_DIR = ".tw-cache";
|
|
6979
7009
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6980
7010
|
try {
|
|
6981
|
-
const cacheDir =
|
|
6982
|
-
|
|
7011
|
+
const cacheDir = import_node_path14.default.join(cwd, CACHE_DIR);
|
|
7012
|
+
import_node_fs12.default.mkdirSync(cacheDir, { recursive: true });
|
|
6983
7013
|
const mem = process.memoryUsage();
|
|
6984
7014
|
const data = {
|
|
6985
7015
|
...metrics,
|
|
@@ -6990,7 +7020,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6990
7020
|
},
|
|
6991
7021
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6992
7022
|
};
|
|
6993
|
-
|
|
7023
|
+
import_node_fs12.default.writeFileSync(import_node_path14.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6994
7024
|
} catch {
|
|
6995
7025
|
}
|
|
6996
7026
|
}
|
|
@@ -7261,7 +7291,7 @@ init_cssToIr();
|
|
|
7261
7291
|
// packages/domain/engine/src/watch-native.ts
|
|
7262
7292
|
init_cjs_shims();
|
|
7263
7293
|
var import_node_module7 = require("module");
|
|
7264
|
-
var
|
|
7294
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
7265
7295
|
init_src2();
|
|
7266
7296
|
var import_meta7 = {};
|
|
7267
7297
|
var watchBindingState = {
|
|
@@ -7284,22 +7314,22 @@ var getBinding = () => {
|
|
|
7284
7314
|
const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
|
|
7285
7315
|
const candidates = [
|
|
7286
7316
|
// new binary name: tailwind-styled-native
|
|
7287
|
-
|
|
7288
|
-
|
|
7317
|
+
import_node_path15.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
7318
|
+
import_node_path15.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
|
|
7289
7319
|
// npm install case: dist/../native/
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7320
|
+
import_node_path15.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
7321
|
+
import_node_path15.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
|
|
7322
|
+
import_node_path15.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7293
7323
|
// monorepo dev: 4-level up
|
|
7294
|
-
|
|
7295
|
-
|
|
7324
|
+
import_node_path15.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7325
|
+
import_node_path15.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7296
7326
|
// 3-level fallback
|
|
7297
|
-
|
|
7327
|
+
import_node_path15.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7298
7328
|
// backward compat: tailwind_styled_parser
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7329
|
+
import_node_path15.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
|
|
7330
|
+
import_node_path15.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
7331
|
+
import_node_path15.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
7332
|
+
import_node_path15.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
|
|
7303
7333
|
];
|
|
7304
7334
|
for (const c of candidates) {
|
|
7305
7335
|
try {
|
|
@@ -7320,7 +7350,7 @@ var log6 = createLogger2("engine:watch-native");
|
|
|
7320
7350
|
function watchWorkspace2(rootDir, callback, options = {}) {
|
|
7321
7351
|
const binding = getBinding();
|
|
7322
7352
|
const pollMs = options.pollIntervalMs ?? 500;
|
|
7323
|
-
const resolvedRoot =
|
|
7353
|
+
const resolvedRoot = import_node_path15.default.resolve(rootDir);
|
|
7324
7354
|
const result = (() => {
|
|
7325
7355
|
try {
|
|
7326
7356
|
return binding.startWatch(resolvedRoot);
|
|
@@ -7357,7 +7387,7 @@ This package requires native Rust bindings.`
|
|
|
7357
7387
|
const deduped = /* @__PURE__ */ new Set();
|
|
7358
7388
|
const events = [];
|
|
7359
7389
|
for (const e of raw) {
|
|
7360
|
-
const absPath =
|
|
7390
|
+
const absPath = import_node_path15.default.isAbsolute(e.path) ? import_node_path15.default.normalize(e.path) : import_node_path15.default.resolve(resolvedRoot, e.path);
|
|
7361
7391
|
const kind = e.kind;
|
|
7362
7392
|
const key = `${kind}:${absPath}`;
|
|
7363
7393
|
if (deduped.has(key)) continue;
|
|
@@ -7397,8 +7427,8 @@ var configState = {
|
|
|
7397
7427
|
var log7 = createLogger2("engine");
|
|
7398
7428
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
7399
7429
|
if (!tailwindConfigPath) return void 0;
|
|
7400
|
-
const configPath =
|
|
7401
|
-
if (!
|
|
7430
|
+
const configPath = import_node_path16.default.resolve(root, tailwindConfigPath);
|
|
7431
|
+
if (!import_node_fs13.default.existsSync(configPath)) {
|
|
7402
7432
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
7403
7433
|
}
|
|
7404
7434
|
const imported = await import((0, import_node_url6.pathToFileURL)(configPath).href);
|
|
@@ -7464,11 +7494,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
7464
7494
|
};
|
|
7465
7495
|
}
|
|
7466
7496
|
function countWorkspacePackages(root) {
|
|
7467
|
-
const packagesDir =
|
|
7468
|
-
if (!
|
|
7497
|
+
const packagesDir = import_node_path16.default.join(root, "packages");
|
|
7498
|
+
if (!import_node_fs13.default.existsSync(packagesDir)) return 0;
|
|
7469
7499
|
try {
|
|
7470
|
-
return
|
|
7471
|
-
(entry) => entry.isDirectory() &&
|
|
7500
|
+
return import_node_fs13.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
7501
|
+
(entry) => entry.isDirectory() && import_node_fs13.default.existsSync(import_node_path16.default.join(packagesDir, entry.name, "package.json"))
|
|
7472
7502
|
).length;
|
|
7473
7503
|
} catch (err) {
|
|
7474
7504
|
log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -7505,7 +7535,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
7505
7535
|
async function createEngine(rawOptions = {}) {
|
|
7506
7536
|
const options = parseEngineOptions(rawOptions);
|
|
7507
7537
|
const root = options.root ?? process.cwd();
|
|
7508
|
-
const resolvedRoot =
|
|
7538
|
+
const resolvedRoot = import_node_path16.default.resolve(root);
|
|
7509
7539
|
const plugins = rawOptions.plugins ?? [];
|
|
7510
7540
|
const getTailwindConfig = async () => {
|
|
7511
7541
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -7652,7 +7682,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
7652
7682
|
const shouldForceFullRescan = (event) => {
|
|
7653
7683
|
if (event.type === "unlink") return false;
|
|
7654
7684
|
try {
|
|
7655
|
-
const stat =
|
|
7685
|
+
const stat = import_node_fs13.default.statSync(event.filePath);
|
|
7656
7686
|
if (stat.size > largeFileThreshold) {
|
|
7657
7687
|
metrics.markSkippedLargeFile();
|
|
7658
7688
|
return true;
|
|
@@ -7770,14 +7800,14 @@ async function createEngine(rawOptions = {}) {
|
|
|
7770
7800
|
};
|
|
7771
7801
|
}
|
|
7772
7802
|
async function scanWorkspace3(opts = {}) {
|
|
7773
|
-
const root =
|
|
7803
|
+
const root = import_node_path16.default.resolve(opts.root ?? process.cwd());
|
|
7774
7804
|
return scanWorkspaceAsync(root, {
|
|
7775
7805
|
includeExtensions: opts.extensions,
|
|
7776
7806
|
ignoreDirectories: opts.ignoreDirectories
|
|
7777
7807
|
});
|
|
7778
7808
|
}
|
|
7779
7809
|
async function analyzeWorkspace2(opts = {}) {
|
|
7780
|
-
const root =
|
|
7810
|
+
const root = import_node_path16.default.resolve(opts.root ?? process.cwd());
|
|
7781
7811
|
return analyzeWorkspace(root, {
|
|
7782
7812
|
classStats: { top: opts.top ?? 20 }
|
|
7783
7813
|
});
|