tailwind-styled-v4 5.1.16 → 5.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atomic.js +16 -4
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +13 -2
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +80 -68
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +77 -66
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +84 -4
- package/dist/compiler.d.ts +84 -4
- package/dist/compiler.js +245 -15
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +240 -14
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +209 -167
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +200 -159
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +16 -0
- package/dist/next.d.ts +16 -0
- package/dist/next.js +458 -158
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +454 -154
- package/dist/next.mjs.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/shared.js +106 -64
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +101 -60
- package/dist/shared.mjs.map +1 -1
- package/dist/theme.js +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +94 -52
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +92 -51
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +80 -68
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +77 -66
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +172 -130
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +166 -125
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +28 -10
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +26 -9
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +1 -1
package/dist/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 path17 = first?.path?.join(".") ?? "(root)";
|
|
234
234
|
throw new Error(
|
|
235
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
235
|
+
`[${context}] Native binding returned unexpected data: ${path17}: ${first?.message ?? "validation failed"}`
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
return result.data;
|
|
@@ -667,11 +667,11 @@ function resolvePath(...segments) {
|
|
|
667
667
|
return segments.join("/").replace(/\/+/g, "/");
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
function existsSync(
|
|
670
|
+
function existsSync(path17) {
|
|
671
671
|
if (isBrowser2) return false;
|
|
672
672
|
try {
|
|
673
673
|
const nodeFs = require(NODE_FS);
|
|
674
|
-
return nodeFs.existsSync(
|
|
674
|
+
return nodeFs.existsSync(path17);
|
|
675
675
|
} catch {
|
|
676
676
|
return false;
|
|
677
677
|
}
|
|
@@ -1026,9 +1026,9 @@ var init_native_resolution = __esm({
|
|
|
1026
1026
|
// packages/domain/shared/src/observability.ts
|
|
1027
1027
|
function createObservabilityClient(opts = {}) {
|
|
1028
1028
|
const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
|
|
1029
|
-
async function fetchJson(
|
|
1029
|
+
async function fetchJson(path17) {
|
|
1030
1030
|
try {
|
|
1031
|
-
const res = await fetch(`${baseUrl}${
|
|
1031
|
+
const res = await fetch(`${baseUrl}${path17}`, {
|
|
1032
1032
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1033
1033
|
});
|
|
1034
1034
|
if (!res.ok) return null;
|
|
@@ -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 = (path17) => require(path17);
|
|
1073
1073
|
log = (...args) => {
|
|
1074
1074
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
1075
1075
|
console.log("[compiler:native]", ...args);
|
|
@@ -2895,6 +2895,17 @@ var init_watch = __esm({
|
|
|
2895
2895
|
}
|
|
2896
2896
|
});
|
|
2897
2897
|
|
|
2898
|
+
// packages/domain/compiler/src/routeGraph.ts
|
|
2899
|
+
var import_node_fs, import_node_path;
|
|
2900
|
+
var init_routeGraph = __esm({
|
|
2901
|
+
"packages/domain/compiler/src/routeGraph.ts"() {
|
|
2902
|
+
"use strict";
|
|
2903
|
+
init_cjs_shims();
|
|
2904
|
+
import_node_fs = __toESM(require("fs"), 1);
|
|
2905
|
+
import_node_path = __toESM(require("path"), 1);
|
|
2906
|
+
}
|
|
2907
|
+
});
|
|
2908
|
+
|
|
2898
2909
|
// packages/domain/compiler/src/index.ts
|
|
2899
2910
|
function _layoutClassesToCss(classes) {
|
|
2900
2911
|
const native = getNativeBridge();
|
|
@@ -2930,13 +2941,13 @@ function extractContainerCssFromSource(source) {
|
|
|
2930
2941
|
}
|
|
2931
2942
|
return rules.join("\n");
|
|
2932
2943
|
}
|
|
2933
|
-
var
|
|
2944
|
+
var import_node_fs2, import_node_path2, 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;
|
|
2934
2945
|
var init_src = __esm({
|
|
2935
2946
|
"packages/domain/compiler/src/index.ts"() {
|
|
2936
2947
|
"use strict";
|
|
2937
2948
|
init_cjs_shims();
|
|
2938
|
-
|
|
2939
|
-
|
|
2949
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
2950
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
2940
2951
|
import_node_module4 = require("module");
|
|
2941
2952
|
init_nativeBridge();
|
|
2942
2953
|
init_compiler();
|
|
@@ -2945,6 +2956,7 @@ var init_src = __esm({
|
|
|
2945
2956
|
init_cache();
|
|
2946
2957
|
init_redis();
|
|
2947
2958
|
init_watch();
|
|
2959
|
+
init_routeGraph();
|
|
2948
2960
|
_require2 = (0, import_node_module4.createRequire)(
|
|
2949
2961
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
2950
2962
|
);
|
|
@@ -3039,7 +3051,7 @@ var init_src = __esm({
|
|
|
3039
3051
|
};
|
|
3040
3052
|
scanProjectUsage = (dirs, cwd) => {
|
|
3041
3053
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
3042
|
-
const files = dirs.map((dir) =>
|
|
3054
|
+
const files = dirs.map((dir) => import_node_path2.default.resolve(cwd, dir));
|
|
3043
3055
|
const results = batchExtractClasses2(files) || [];
|
|
3044
3056
|
const combined = {};
|
|
3045
3057
|
for (const result of results) {
|
|
@@ -3056,13 +3068,13 @@ var init_src = __esm({
|
|
|
3056
3068
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3057
3069
|
const allClasses = Object.keys(classes).sort();
|
|
3058
3070
|
if (outputPath) {
|
|
3059
|
-
|
|
3071
|
+
import_node_fs2.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3060
3072
|
}
|
|
3061
3073
|
return allClasses;
|
|
3062
3074
|
};
|
|
3063
3075
|
loadSafelist = (safelistPath) => {
|
|
3064
3076
|
try {
|
|
3065
|
-
const content =
|
|
3077
|
+
const content = import_node_fs2.default.readFileSync(safelistPath, "utf-8");
|
|
3066
3078
|
return JSON.parse(content);
|
|
3067
3079
|
} catch {
|
|
3068
3080
|
return [];
|
|
@@ -3076,8 +3088,8 @@ var init_src = __esm({
|
|
|
3076
3088
|
"tailwind.config.cjs"
|
|
3077
3089
|
];
|
|
3078
3090
|
for (const file of configFiles) {
|
|
3079
|
-
const fullPath =
|
|
3080
|
-
if (
|
|
3091
|
+
const fullPath = import_node_path2.default.join(cwd, file);
|
|
3092
|
+
if (import_node_fs2.default.existsSync(fullPath)) {
|
|
3081
3093
|
const mod = require(fullPath);
|
|
3082
3094
|
return mod.default || mod;
|
|
3083
3095
|
}
|
|
@@ -3087,9 +3099,9 @@ var init_src = __esm({
|
|
|
3087
3099
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3088
3100
|
return {
|
|
3089
3101
|
content: [
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3102
|
+
import_node_path2.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3103
|
+
import_node_path2.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3104
|
+
import_node_path2.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3093
3105
|
]
|
|
3094
3106
|
};
|
|
3095
3107
|
};
|
|
@@ -3160,10 +3172,38 @@ var init_src = __esm({
|
|
|
3160
3172
|
}
|
|
3161
3173
|
return ["/", "__global"];
|
|
3162
3174
|
};
|
|
3163
|
-
|
|
3164
|
-
|
|
3175
|
+
_fileClassesMap = /* @__PURE__ */ new Map();
|
|
3176
|
+
_globalClasses = /* @__PURE__ */ new Set();
|
|
3177
|
+
getRouteClasses = (route) => {
|
|
3178
|
+
const result = /* @__PURE__ */ new Set();
|
|
3179
|
+
for (const [filepath, classes] of _fileClassesMap) {
|
|
3180
|
+
const fileRoute = fileToRoute(filepath) ?? "__global";
|
|
3181
|
+
if (fileRoute === route) {
|
|
3182
|
+
for (const cls of classes) result.add(cls);
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
return result;
|
|
3186
|
+
};
|
|
3187
|
+
getAllRegisteredClasses = () => {
|
|
3188
|
+
const result = new Set(_globalClasses);
|
|
3189
|
+
for (const classes of _fileClassesMap.values()) {
|
|
3190
|
+
for (const cls of classes) result.add(cls);
|
|
3191
|
+
}
|
|
3192
|
+
return result;
|
|
3193
|
+
};
|
|
3194
|
+
registerFileClasses = (filepath, classes) => {
|
|
3195
|
+
if (!classes || classes.length === 0) {
|
|
3196
|
+
_fileClassesMap.delete(filepath);
|
|
3197
|
+
return;
|
|
3198
|
+
}
|
|
3199
|
+
_fileClassesMap.set(filepath, new Set(classes));
|
|
3165
3200
|
};
|
|
3166
|
-
registerGlobalClasses = (
|
|
3201
|
+
registerGlobalClasses = (classes) => {
|
|
3202
|
+
for (const cls of classes) _globalClasses.add(cls);
|
|
3203
|
+
};
|
|
3204
|
+
resetRouteClassRegistry = () => {
|
|
3205
|
+
_fileClassesMap.clear();
|
|
3206
|
+
_globalClasses.clear();
|
|
3167
3207
|
};
|
|
3168
3208
|
_incrementalEngineInstance = null;
|
|
3169
3209
|
getIncrementalEngine = () => {
|
|
@@ -3354,6 +3394,7 @@ __export(internal_exports, {
|
|
|
3354
3394
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
3355
3395
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
3356
3396
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
3397
|
+
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
3357
3398
|
getAllRoutes: () => getAllRoutes,
|
|
3358
3399
|
getBucketEngine: () => getBucketEngine,
|
|
3359
3400
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
@@ -3456,6 +3497,7 @@ __export(internal_exports, {
|
|
|
3456
3497
|
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
3457
3498
|
resetMemoryStats: () => resetMemoryStats,
|
|
3458
3499
|
resetResolverPoolStats: () => resetResolverPoolStats,
|
|
3500
|
+
resetRouteClassRegistry: () => resetRouteClassRegistry,
|
|
3459
3501
|
resolveCascade: () => resolveCascade,
|
|
3460
3502
|
resolveClassNames: () => resolveClassNames,
|
|
3461
3503
|
resolveColorCached: () => resolveColorCached,
|
|
@@ -3546,17 +3588,17 @@ function getNative() {
|
|
|
3546
3588
|
function* walkSourceFiles(dir) {
|
|
3547
3589
|
let entries;
|
|
3548
3590
|
try {
|
|
3549
|
-
entries =
|
|
3591
|
+
entries = import_node_fs3.default.readdirSync(dir, { withFileTypes: true });
|
|
3550
3592
|
} catch {
|
|
3551
3593
|
return;
|
|
3552
3594
|
}
|
|
3553
3595
|
for (const entry of entries) {
|
|
3554
|
-
const fullPath =
|
|
3596
|
+
const fullPath = import_node_path3.default.join(dir, entry.name);
|
|
3555
3597
|
if (entry.isDirectory()) {
|
|
3556
3598
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3557
3599
|
yield* walkSourceFiles(fullPath);
|
|
3558
3600
|
} else if (entry.isFile()) {
|
|
3559
|
-
const ext =
|
|
3601
|
+
const ext = import_node_path3.default.extname(entry.name);
|
|
3560
3602
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3561
3603
|
}
|
|
3562
3604
|
}
|
|
@@ -3620,7 +3662,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3620
3662
|
allConfigs.push(...configs);
|
|
3621
3663
|
if (verbose) {
|
|
3622
3664
|
process.stderr.write(
|
|
3623
|
-
`[tw:static-state] ${
|
|
3665
|
+
`[tw:static-state] ${import_node_path3.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3624
3666
|
`
|
|
3625
3667
|
);
|
|
3626
3668
|
}
|
|
@@ -3631,7 +3673,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3631
3673
|
if (filesScanned >= maxFiles) break;
|
|
3632
3674
|
let source;
|
|
3633
3675
|
try {
|
|
3634
|
-
source =
|
|
3676
|
+
source = import_node_fs3.default.readFileSync(filePath, "utf-8");
|
|
3635
3677
|
} catch {
|
|
3636
3678
|
continue;
|
|
3637
3679
|
}
|
|
@@ -3644,7 +3686,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3644
3686
|
allConfigs.push(...configs);
|
|
3645
3687
|
if (verbose) {
|
|
3646
3688
|
process.stderr.write(
|
|
3647
|
-
`[tw:static-state] ${
|
|
3689
|
+
`[tw:static-state] ${import_node_path3.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3648
3690
|
`
|
|
3649
3691
|
);
|
|
3650
3692
|
}
|
|
@@ -3738,12 +3780,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3738
3780
|
resolvedCss: options.resolvedCss || ""
|
|
3739
3781
|
// ← ensure always passed
|
|
3740
3782
|
});
|
|
3741
|
-
const twClassesDir =
|
|
3742
|
-
|
|
3743
|
-
const stateFilePath =
|
|
3783
|
+
const twClassesDir = import_node_path3.default.join(import_node_path3.default.dirname(safelistPath), "tw-classes");
|
|
3784
|
+
import_node_fs3.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3785
|
+
const stateFilePath = import_node_path3.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3744
3786
|
if (result.rulesGenerated === 0) {
|
|
3745
3787
|
try {
|
|
3746
|
-
|
|
3788
|
+
import_node_fs3.default.writeFileSync(
|
|
3747
3789
|
stateFilePath,
|
|
3748
3790
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3749
3791
|
"utf-8"
|
|
@@ -3753,7 +3795,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3753
3795
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3754
3796
|
}
|
|
3755
3797
|
try {
|
|
3756
|
-
|
|
3798
|
+
import_node_fs3.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3757
3799
|
return [
|
|
3758
3800
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3759
3801
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3765,13 +3807,13 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3765
3807
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3766
3808
|
}
|
|
3767
3809
|
}
|
|
3768
|
-
var
|
|
3810
|
+
var import_node_fs3, import_node_path3, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3769
3811
|
var init_staticStateExtractor = __esm({
|
|
3770
3812
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3771
3813
|
"use strict";
|
|
3772
3814
|
init_cjs_shims();
|
|
3773
|
-
|
|
3774
|
-
|
|
3815
|
+
import_node_fs3 = __toESM(require("fs"));
|
|
3816
|
+
import_node_path3 = __toESM(require("path"));
|
|
3775
3817
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3776
3818
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3777
3819
|
_native = null;
|
|
@@ -3789,8 +3831,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3789
3831
|
_globalLogFile = filePath;
|
|
3790
3832
|
_logFileInitialized = false;
|
|
3791
3833
|
try {
|
|
3792
|
-
|
|
3793
|
-
|
|
3834
|
+
import_node_fs4.default.mkdirSync(import_node_path4.default.dirname(filePath), { recursive: true });
|
|
3835
|
+
import_node_fs4.default.writeFileSync(
|
|
3794
3836
|
filePath,
|
|
3795
3837
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3796
3838
|
`,
|
|
@@ -3803,7 +3845,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3803
3845
|
function writeToFile(line) {
|
|
3804
3846
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3805
3847
|
try {
|
|
3806
|
-
|
|
3848
|
+
import_node_fs4.default.appendFileSync(_globalLogFile, line);
|
|
3807
3849
|
} catch {
|
|
3808
3850
|
}
|
|
3809
3851
|
}
|
|
@@ -3830,13 +3872,13 @@ function createLogger(prefix, level) {
|
|
|
3830
3872
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3831
3873
|
};
|
|
3832
3874
|
}
|
|
3833
|
-
var
|
|
3875
|
+
var import_node_fs4, import_node_path4, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3834
3876
|
var init_logger = __esm({
|
|
3835
3877
|
"packages/domain/shared/src/logger.ts"() {
|
|
3836
3878
|
"use strict";
|
|
3837
3879
|
init_cjs_shims();
|
|
3838
|
-
|
|
3839
|
-
|
|
3880
|
+
import_node_fs4 = __toESM(require("fs"));
|
|
3881
|
+
import_node_path4 = __toESM(require("path"));
|
|
3840
3882
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3841
3883
|
_globalLogFile = null;
|
|
3842
3884
|
_logFileInitialized = false;
|
|
@@ -3945,9 +3987,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3945
3987
|
}
|
|
3946
3988
|
};
|
|
3947
3989
|
}
|
|
3948
|
-
function formatIssuePath(
|
|
3949
|
-
if (!
|
|
3950
|
-
return
|
|
3990
|
+
function formatIssuePath(path17) {
|
|
3991
|
+
if (!path17 || path17.length === 0) return "(root)";
|
|
3992
|
+
return path17.map(
|
|
3951
3993
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3952
3994
|
).join(".");
|
|
3953
3995
|
}
|
|
@@ -3961,9 +4003,9 @@ function loadNativeBinding(options) {
|
|
|
3961
4003
|
const { runtimeDir, candidates, isValid } = options;
|
|
3962
4004
|
const loadErrors = [];
|
|
3963
4005
|
for (const candidate of candidates) {
|
|
3964
|
-
const candidatePath =
|
|
4006
|
+
const candidatePath = import_node_path5.default.resolve(runtimeDir, candidate);
|
|
3965
4007
|
try {
|
|
3966
|
-
if (!
|
|
4008
|
+
if (!import_node_fs5.default.existsSync(candidatePath) && !import_node_fs5.default.existsSync(candidatePath + ".node")) {
|
|
3967
4009
|
continue;
|
|
3968
4010
|
}
|
|
3969
4011
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3995,9 +4037,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3995
4037
|
}
|
|
3996
4038
|
}
|
|
3997
4039
|
if (!includeDefaultCandidates) return candidates;
|
|
3998
|
-
if (
|
|
4040
|
+
if (import_node_fs5.default.existsSync(runtimeDir)) {
|
|
3999
4041
|
try {
|
|
4000
|
-
for (const entry of
|
|
4042
|
+
for (const entry of import_node_fs5.default.readdirSync(runtimeDir)) {
|
|
4001
4043
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
4002
4044
|
}
|
|
4003
4045
|
} catch {
|
|
@@ -4006,22 +4048,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
4006
4048
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
4007
4049
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
4008
4050
|
for (const bin of BINARY_NAMES) {
|
|
4009
|
-
candidates.push(
|
|
4010
|
-
candidates.push(
|
|
4011
|
-
candidates.push(
|
|
4012
|
-
candidates.push(
|
|
4013
|
-
candidates.push(
|
|
4014
|
-
candidates.push(
|
|
4015
|
-
candidates.push(
|
|
4016
|
-
candidates.push(
|
|
4017
|
-
candidates.push(
|
|
4051
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, `${bin}.node`));
|
|
4052
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
4053
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
4054
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4055
|
+
candidates.push(import_node_path5.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
4056
|
+
candidates.push(import_node_path5.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
4057
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
4058
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
4059
|
+
candidates.push(import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
4018
4060
|
}
|
|
4019
4061
|
return Array.from(new Set(candidates));
|
|
4020
4062
|
}
|
|
4021
4063
|
function resolveRuntimeDir(dir, importMetaUrl2) {
|
|
4022
|
-
if (dir) return
|
|
4064
|
+
if (dir) return import_node_path5.default.resolve(dir);
|
|
4023
4065
|
try {
|
|
4024
|
-
return
|
|
4066
|
+
return import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl2));
|
|
4025
4067
|
} catch {
|
|
4026
4068
|
return process.cwd();
|
|
4027
4069
|
}
|
|
@@ -4035,14 +4077,14 @@ function formatErrorMessage(error) {
|
|
|
4035
4077
|
if (error instanceof Error) return error.message;
|
|
4036
4078
|
return String(error);
|
|
4037
4079
|
}
|
|
4038
|
-
var import_node_crypto,
|
|
4080
|
+
var import_node_crypto, import_node_fs5, import_node_path5, import_node_url, import_node_module5, TwError, _require3, LRUCache;
|
|
4039
4081
|
var init_src2 = __esm({
|
|
4040
4082
|
"packages/domain/shared/src/index.ts"() {
|
|
4041
4083
|
"use strict";
|
|
4042
4084
|
init_cjs_shims();
|
|
4043
4085
|
import_node_crypto = require("crypto");
|
|
4044
|
-
|
|
4045
|
-
|
|
4086
|
+
import_node_fs5 = __toESM(require("fs"));
|
|
4087
|
+
import_node_path5 = __toESM(require("path"));
|
|
4046
4088
|
import_node_url = require("url");
|
|
4047
4089
|
import_node_module5 = require("module");
|
|
4048
4090
|
init_trace();
|
|
@@ -4091,8 +4133,8 @@ var init_src2 = __esm({
|
|
|
4091
4133
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
4092
4134
|
static fromZod(err) {
|
|
4093
4135
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
4094
|
-
const
|
|
4095
|
-
const message = first ? `${
|
|
4136
|
+
const path17 = formatIssuePath(first?.path);
|
|
4137
|
+
const message = first ? `${path17}: ${first.message}` : "Schema validation failed";
|
|
4096
4138
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
4097
4139
|
}
|
|
4098
4140
|
static wrap(source, code, err) {
|
|
@@ -4192,7 +4234,7 @@ function getDirname2() {
|
|
|
4192
4234
|
return __dirname;
|
|
4193
4235
|
}
|
|
4194
4236
|
if (typeof import_meta4 !== "undefined" && importMetaUrl) {
|
|
4195
|
-
return
|
|
4237
|
+
return import_node_path6.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
4196
4238
|
}
|
|
4197
4239
|
return process.cwd();
|
|
4198
4240
|
}
|
|
@@ -4404,12 +4446,12 @@ function hasNativeWatchBinding() {
|
|
|
4404
4446
|
return false;
|
|
4405
4447
|
}
|
|
4406
4448
|
}
|
|
4407
|
-
var
|
|
4449
|
+
var import_node_path6, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4408
4450
|
var init_native_bridge = __esm({
|
|
4409
4451
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4410
4452
|
"use strict";
|
|
4411
4453
|
init_cjs_shims();
|
|
4412
|
-
|
|
4454
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4413
4455
|
import_node_url2 = require("url");
|
|
4414
4456
|
init_src2();
|
|
4415
4457
|
import_meta4 = {};
|
|
@@ -4499,8 +4541,8 @@ var init_native_bridge = __esm({
|
|
|
4499
4541
|
|
|
4500
4542
|
// packages/domain/scanner/src/cache-native.ts
|
|
4501
4543
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4502
|
-
const dir = cacheDir ?
|
|
4503
|
-
return
|
|
4544
|
+
const dir = cacheDir ? import_node_path7.default.resolve(rootDir, cacheDir) : import_node_path7.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4545
|
+
return import_node_path7.default.join(dir, "scanner-cache.json");
|
|
4504
4546
|
}
|
|
4505
4547
|
function metaPathFor(cachePath) {
|
|
4506
4548
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4513,7 +4555,7 @@ function getBinaryFingerprint() {
|
|
|
4513
4555
|
_cachedFingerprint = null;
|
|
4514
4556
|
return null;
|
|
4515
4557
|
}
|
|
4516
|
-
const stat =
|
|
4558
|
+
const stat = import_node_fs6.default.statSync(loadedPath);
|
|
4517
4559
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4518
4560
|
} catch {
|
|
4519
4561
|
_cachedFingerprint = null;
|
|
@@ -4522,13 +4564,13 @@ function getBinaryFingerprint() {
|
|
|
4522
4564
|
}
|
|
4523
4565
|
function readCache(rootDir, cacheDir) {
|
|
4524
4566
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4525
|
-
|
|
4567
|
+
import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
|
|
4526
4568
|
const currentFingerprint = getBinaryFingerprint();
|
|
4527
4569
|
if (currentFingerprint !== null) {
|
|
4528
4570
|
const metaPath = metaPathFor(cachePath);
|
|
4529
4571
|
let storedFingerprint = null;
|
|
4530
4572
|
try {
|
|
4531
|
-
storedFingerprint = JSON.parse(
|
|
4573
|
+
storedFingerprint = JSON.parse(import_node_fs6.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4532
4574
|
} catch {
|
|
4533
4575
|
}
|
|
4534
4576
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4552,7 +4594,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4552
4594
|
}
|
|
4553
4595
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4554
4596
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4555
|
-
|
|
4597
|
+
import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(cachePath), { recursive: true });
|
|
4556
4598
|
const success = cacheWriteNative(cachePath, entries);
|
|
4557
4599
|
if (!success) {
|
|
4558
4600
|
throw new Error(
|
|
@@ -4562,7 +4604,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4562
4604
|
const currentFingerprint = getBinaryFingerprint();
|
|
4563
4605
|
if (currentFingerprint !== null) {
|
|
4564
4606
|
try {
|
|
4565
|
-
|
|
4607
|
+
import_node_fs6.default.writeFileSync(
|
|
4566
4608
|
metaPathFor(cachePath),
|
|
4567
4609
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4568
4610
|
"utf8"
|
|
@@ -4582,13 +4624,13 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4582
4624
|
nowMs
|
|
4583
4625
|
);
|
|
4584
4626
|
}
|
|
4585
|
-
var
|
|
4627
|
+
var import_node_fs6, import_node_path7, _cachedFingerprint, STALE_THRESHOLD_MS;
|
|
4586
4628
|
var init_cache_native = __esm({
|
|
4587
4629
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4588
4630
|
"use strict";
|
|
4589
4631
|
init_cjs_shims();
|
|
4590
|
-
|
|
4591
|
-
|
|
4632
|
+
import_node_fs6 = __toESM(require("fs"), 1);
|
|
4633
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
4592
4634
|
init_native_bridge();
|
|
4593
4635
|
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4594
4636
|
}
|
|
@@ -4635,7 +4677,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4635
4677
|
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
4636
4678
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4637
4679
|
} = options;
|
|
4638
|
-
const files = collectFiles2(
|
|
4680
|
+
const files = collectFiles2(import_node_path8.default.resolve(rootDir), extensions, ignoreDirs);
|
|
4639
4681
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4640
4682
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4641
4683
|
}
|
|
@@ -4651,13 +4693,13 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4651
4693
|
}
|
|
4652
4694
|
return mergeResults(allResults);
|
|
4653
4695
|
}
|
|
4654
|
-
var import_node_worker_threads,
|
|
4696
|
+
var import_node_worker_threads, import_node_path8, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4655
4697
|
var init_parallel_scanner = __esm({
|
|
4656
4698
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4657
4699
|
"use strict";
|
|
4658
4700
|
init_cjs_shims();
|
|
4659
4701
|
import_node_worker_threads = require("worker_threads");
|
|
4660
|
-
|
|
4702
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
4661
4703
|
import_node_os = require("os");
|
|
4662
4704
|
import_node_url3 = require("url");
|
|
4663
4705
|
init_src3();
|
|
@@ -4690,12 +4732,12 @@ var init_schemas = __esm({
|
|
|
4690
4732
|
init_cjs_shims();
|
|
4691
4733
|
import_zod3 = require("zod");
|
|
4692
4734
|
init_src2();
|
|
4693
|
-
formatIssuePath2 = (
|
|
4735
|
+
formatIssuePath2 = (path17) => path17.length > 0 ? path17.map(
|
|
4694
4736
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4695
4737
|
).join(".") : "<root>";
|
|
4696
4738
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4697
|
-
const
|
|
4698
|
-
return `${
|
|
4739
|
+
const path17 = formatIssuePath2(issue.path);
|
|
4740
|
+
return `${path17}: ${issue.message}`;
|
|
4699
4741
|
}).join("; ");
|
|
4700
4742
|
parseWithSchema = (schema, data, label) => {
|
|
4701
4743
|
const parsed = schema.safeParse(data);
|
|
@@ -4772,7 +4814,7 @@ function getRuntimeDir() {
|
|
|
4772
4814
|
return __dirname;
|
|
4773
4815
|
}
|
|
4774
4816
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4775
|
-
return
|
|
4817
|
+
return import_node_path9.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4776
4818
|
}
|
|
4777
4819
|
return process.cwd();
|
|
4778
4820
|
}
|
|
@@ -4782,17 +4824,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4782
4824
|
return __dirname;
|
|
4783
4825
|
}
|
|
4784
4826
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4785
|
-
return
|
|
4827
|
+
return import_node_path9.default.dirname((0, import_node_url4.fileURLToPath)(importMetaUrl));
|
|
4786
4828
|
}
|
|
4787
4829
|
return process.cwd();
|
|
4788
4830
|
})();
|
|
4789
4831
|
const candidates = [
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4832
|
+
import_node_path9.default.resolve(runtimeDir, "worker.cjs"),
|
|
4833
|
+
import_node_path9.default.resolve(runtimeDir, "worker.js"),
|
|
4834
|
+
import_node_path9.default.resolve(runtimeDir, "worker.ts")
|
|
4793
4835
|
];
|
|
4794
4836
|
for (const candidate of candidates) {
|
|
4795
|
-
if (
|
|
4837
|
+
if (import_node_fs7.default.existsSync(candidate)) return candidate;
|
|
4796
4838
|
}
|
|
4797
4839
|
return null;
|
|
4798
4840
|
}
|
|
@@ -4849,19 +4891,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4849
4891
|
if (!currentDir) continue;
|
|
4850
4892
|
const entries = (() => {
|
|
4851
4893
|
try {
|
|
4852
|
-
return
|
|
4894
|
+
return import_node_fs7.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4853
4895
|
} catch {
|
|
4854
4896
|
return [];
|
|
4855
4897
|
}
|
|
4856
4898
|
})();
|
|
4857
4899
|
for (const entry of entries) {
|
|
4858
|
-
const fullPath =
|
|
4900
|
+
const fullPath = import_node_path9.default.join(currentDir, entry.name);
|
|
4859
4901
|
if (entry.isDirectory()) {
|
|
4860
4902
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4861
4903
|
continue;
|
|
4862
4904
|
}
|
|
4863
4905
|
if (!entry.isFile()) continue;
|
|
4864
|
-
if (!extensionSet.has(
|
|
4906
|
+
if (!extensionSet.has(import_node_path9.default.extname(entry.name))) continue;
|
|
4865
4907
|
candidates.push(fullPath);
|
|
4866
4908
|
}
|
|
4867
4909
|
}
|
|
@@ -4888,7 +4930,7 @@ function scanSource(source) {
|
|
|
4888
4930
|
);
|
|
4889
4931
|
}
|
|
4890
4932
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4891
|
-
return includeExtensions.includes(
|
|
4933
|
+
return includeExtensions.includes(import_node_path9.default.extname(filePath));
|
|
4892
4934
|
}
|
|
4893
4935
|
function scanFile2(filePath) {
|
|
4894
4936
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4948,7 +4990,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4948
4990
|
for (const filePath of candidates) {
|
|
4949
4991
|
const stat = (() => {
|
|
4950
4992
|
try {
|
|
4951
|
-
return
|
|
4993
|
+
return import_node_fs7.default.statSync(filePath);
|
|
4952
4994
|
} catch {
|
|
4953
4995
|
return null;
|
|
4954
4996
|
}
|
|
@@ -4974,7 +5016,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4974
5016
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4975
5017
|
const content = (() => {
|
|
4976
5018
|
try {
|
|
4977
|
-
return
|
|
5019
|
+
return import_node_fs7.default.readFileSync(filePath, "utf8");
|
|
4978
5020
|
} catch {
|
|
4979
5021
|
return null;
|
|
4980
5022
|
}
|
|
@@ -5055,14 +5097,14 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
5055
5097
|
return scanWorkspace2(rootDir, normalizedOptions);
|
|
5056
5098
|
}
|
|
5057
5099
|
}
|
|
5058
|
-
var
|
|
5100
|
+
var import_node_fs7, import_node_module6, import_node_path9, import_node_url4, import_node_worker_threads2, import_meta5, log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
5059
5101
|
var init_src3 = __esm({
|
|
5060
5102
|
"packages/domain/scanner/src/index.ts"() {
|
|
5061
5103
|
"use strict";
|
|
5062
5104
|
init_cjs_shims();
|
|
5063
|
-
|
|
5105
|
+
import_node_fs7 = __toESM(require("fs"), 1);
|
|
5064
5106
|
import_node_module6 = require("module");
|
|
5065
|
-
|
|
5107
|
+
import_node_path9 = __toESM(require("path"), 1);
|
|
5066
5108
|
import_node_url4 = require("url");
|
|
5067
5109
|
import_node_worker_threads2 = require("worker_threads");
|
|
5068
5110
|
init_src2();
|
|
@@ -5086,7 +5128,7 @@ var init_src3 = __esm({
|
|
|
5086
5128
|
const loadNativeParserBinding = () => {
|
|
5087
5129
|
if (_state.binding !== void 0) return _state.binding;
|
|
5088
5130
|
const runtimeDir = getRuntimeDir();
|
|
5089
|
-
const req = (0, import_node_module6.createRequire)(
|
|
5131
|
+
const req = (0, import_node_module6.createRequire)(import_node_path9.default.join(runtimeDir, "noop.cjs"));
|
|
5090
5132
|
const _platform = process.platform;
|
|
5091
5133
|
const _arch = process.arch;
|
|
5092
5134
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -5094,27 +5136,27 @@ var init_src3 = __esm({
|
|
|
5094
5136
|
const candidates = [
|
|
5095
5137
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
5096
5138
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5139
|
+
import_node_path9.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
5140
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5141
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5100
5142
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
5101
5143
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5144
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
5145
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
5146
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5105
5147
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
5106
|
-
|
|
5107
|
-
|
|
5148
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5149
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5108
5150
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
5109
|
-
|
|
5110
|
-
|
|
5151
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
5152
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
5111
5153
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5154
|
+
import_node_path9.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5155
|
+
import_node_path9.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5156
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5157
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5158
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5159
|
+
import_node_path9.default.resolve(
|
|
5118
5160
|
runtimeDir,
|
|
5119
5161
|
"..",
|
|
5120
5162
|
"..",
|
|
@@ -5126,7 +5168,7 @@ var init_src3 = __esm({
|
|
|
5126
5168
|
)
|
|
5127
5169
|
];
|
|
5128
5170
|
for (const fullPath of candidates) {
|
|
5129
|
-
if (!
|
|
5171
|
+
if (!import_node_fs7.default.existsSync(fullPath)) continue;
|
|
5130
5172
|
try {
|
|
5131
5173
|
const required = req(fullPath);
|
|
5132
5174
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -5902,8 +5944,8 @@ init_cjs_shims();
|
|
|
5902
5944
|
|
|
5903
5945
|
// packages/domain/engine/src/index.ts
|
|
5904
5946
|
init_cjs_shims();
|
|
5905
|
-
var
|
|
5906
|
-
var
|
|
5947
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
5948
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
5907
5949
|
var import_node_url6 = require("url");
|
|
5908
5950
|
|
|
5909
5951
|
// packages/domain/analyzer/src/index.ts
|
|
@@ -5911,7 +5953,7 @@ init_cjs_shims();
|
|
|
5911
5953
|
|
|
5912
5954
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5913
5955
|
init_cjs_shims();
|
|
5914
|
-
var
|
|
5956
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
5915
5957
|
init_src3();
|
|
5916
5958
|
|
|
5917
5959
|
// packages/domain/analyzer/src/binding.ts
|
|
@@ -5920,7 +5962,7 @@ init_src2();
|
|
|
5920
5962
|
|
|
5921
5963
|
// packages/domain/analyzer/src/utils.ts
|
|
5922
5964
|
init_cjs_shims();
|
|
5923
|
-
var
|
|
5965
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
5924
5966
|
init_src2();
|
|
5925
5967
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5926
5968
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -5935,7 +5977,7 @@ function isRecord(value) {
|
|
|
5935
5977
|
}
|
|
5936
5978
|
async function pathExists(filePath) {
|
|
5937
5979
|
try {
|
|
5938
|
-
await
|
|
5980
|
+
await import_node_fs8.default.promises.access(filePath, import_node_fs8.default.constants.F_OK);
|
|
5939
5981
|
return true;
|
|
5940
5982
|
} catch {
|
|
5941
5983
|
return false;
|
|
@@ -6036,7 +6078,7 @@ async function requireNativeBinding() {
|
|
|
6036
6078
|
init_cjs_shims();
|
|
6037
6079
|
init_src2();
|
|
6038
6080
|
var import_zod4 = require("zod");
|
|
6039
|
-
var formatIssuePath3 = (
|
|
6081
|
+
var formatIssuePath3 = (path17) => path17.length > 0 ? path17.map(
|
|
6040
6082
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
6041
6083
|
).join(".") : "<root>";
|
|
6042
6084
|
var isPlainObject = (value) => {
|
|
@@ -6045,8 +6087,8 @@ var isPlainObject = (value) => {
|
|
|
6045
6087
|
return proto === Object.prototype || proto === null;
|
|
6046
6088
|
};
|
|
6047
6089
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
6048
|
-
const
|
|
6049
|
-
return `${
|
|
6090
|
+
const path17 = formatIssuePath3(issue.path);
|
|
6091
|
+
return `${path17}: ${issue.message}`;
|
|
6050
6092
|
}).join("; ");
|
|
6051
6093
|
var parseWithSchema2 = (schema, data, label) => {
|
|
6052
6094
|
const parsed = schema.safeParse(data);
|
|
@@ -6137,8 +6179,8 @@ var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report,
|
|
|
6137
6179
|
|
|
6138
6180
|
// packages/domain/analyzer/src/semantic.ts
|
|
6139
6181
|
init_cjs_shims();
|
|
6140
|
-
var
|
|
6141
|
-
var
|
|
6182
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
6183
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
6142
6184
|
var import_node_url5 = require("url");
|
|
6143
6185
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
6144
6186
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -6159,11 +6201,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
6159
6201
|
};
|
|
6160
6202
|
};
|
|
6161
6203
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
6162
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
6204
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path10.default.extname(configPath).toLowerCase());
|
|
6163
6205
|
};
|
|
6164
6206
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
6165
6207
|
if (explicitPath) {
|
|
6166
|
-
const resolved =
|
|
6208
|
+
const resolved = import_node_path10.default.resolve(root, explicitPath);
|
|
6167
6209
|
if (!await pathExists(resolved)) return null;
|
|
6168
6210
|
return resolved;
|
|
6169
6211
|
}
|
|
@@ -6174,7 +6216,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
6174
6216
|
"tailwind.config.mjs"
|
|
6175
6217
|
];
|
|
6176
6218
|
for (const candidate of candidates) {
|
|
6177
|
-
const fullPath =
|
|
6219
|
+
const fullPath = import_node_path10.default.resolve(root, candidate);
|
|
6178
6220
|
if (await pathExists(fullPath)) return fullPath;
|
|
6179
6221
|
}
|
|
6180
6222
|
return null;
|
|
@@ -6228,7 +6270,7 @@ var collectCustomUtilities = (config) => {
|
|
|
6228
6270
|
return out;
|
|
6229
6271
|
};
|
|
6230
6272
|
var collectSafelistFromSource = async (configPath) => {
|
|
6231
|
-
const source = await
|
|
6273
|
+
const source = await import_node_fs9.default.promises.readFile(configPath, "utf8");
|
|
6232
6274
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
6233
6275
|
const allTokens = extractClassesNative2(source);
|
|
6234
6276
|
const hasSafelist = source.includes("safelist");
|
|
@@ -6255,7 +6297,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
6255
6297
|
customUtilities: /* @__PURE__ */ new Set()
|
|
6256
6298
|
};
|
|
6257
6299
|
}
|
|
6258
|
-
const configStat = await
|
|
6300
|
+
const configStat = await import_node_fs9.default.promises.stat(configPath).catch(() => null);
|
|
6259
6301
|
if (configStat) {
|
|
6260
6302
|
const cached = tailwindConfigCache.get(configPath);
|
|
6261
6303
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -6414,7 +6456,7 @@ async function buildDistribution(usages, native) {
|
|
|
6414
6456
|
}
|
|
6415
6457
|
async function analyzeWorkspace(root, options = {}) {
|
|
6416
6458
|
const startedAtMs = Date.now();
|
|
6417
|
-
const resolvedRoot =
|
|
6459
|
+
const resolvedRoot = import_node_path11.default.resolve(root);
|
|
6418
6460
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
6419
6461
|
const scan = await (async () => {
|
|
6420
6462
|
const scanStartedAtMs = Date.now();
|
|
@@ -6524,8 +6566,8 @@ init_src2();
|
|
|
6524
6566
|
|
|
6525
6567
|
// packages/domain/engine/src/incremental.ts
|
|
6526
6568
|
init_cjs_shims();
|
|
6527
|
-
var
|
|
6528
|
-
var
|
|
6569
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
6570
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
6529
6571
|
init_src3();
|
|
6530
6572
|
init_src2();
|
|
6531
6573
|
init_native_bridge2();
|
|
@@ -6561,8 +6603,8 @@ function areClassSetsEqual(a, b) {
|
|
|
6561
6603
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
6562
6604
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
6563
6605
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
6564
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
6565
|
-
const normalizedPath =
|
|
6606
|
+
const byFile = new Map(previous.files.map((f) => [import_node_path12.default.resolve(f.file), f]));
|
|
6607
|
+
const normalizedPath = import_node_path12.default.resolve(filePath);
|
|
6566
6608
|
const native = getNativeEngineBinding();
|
|
6567
6609
|
if (!native?.processFileChange) {
|
|
6568
6610
|
throw new Error(
|
|
@@ -6578,7 +6620,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
6578
6620
|
}
|
|
6579
6621
|
log5.debug(`native change ${normalizedPath}`);
|
|
6580
6622
|
const scanned = scanFile2(normalizedPath);
|
|
6581
|
-
const content =
|
|
6623
|
+
const content = import_node_fs10.default.readFileSync(normalizedPath, "utf8");
|
|
6582
6624
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
6583
6625
|
const existing = byFile.get(normalizedPath);
|
|
6584
6626
|
if (diff && existing) {
|
|
@@ -6927,8 +6969,8 @@ var EngineMetricsCollector = class {
|
|
|
6927
6969
|
|
|
6928
6970
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6929
6971
|
init_cjs_shims();
|
|
6930
|
-
var
|
|
6931
|
-
var
|
|
6972
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
6973
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6932
6974
|
var import_node_perf_hooks = require("perf_hooks");
|
|
6933
6975
|
init_src2();
|
|
6934
6976
|
var _log = createLogger2("tw:metrics");
|
|
@@ -6936,8 +6978,8 @@ var METRICS_FILE_NAME = "metrics.json";
|
|
|
6936
6978
|
var CACHE_DIR = ".tw-cache";
|
|
6937
6979
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6938
6980
|
try {
|
|
6939
|
-
const cacheDir =
|
|
6940
|
-
|
|
6981
|
+
const cacheDir = import_node_path13.default.join(cwd, CACHE_DIR);
|
|
6982
|
+
import_node_fs11.default.mkdirSync(cacheDir, { recursive: true });
|
|
6941
6983
|
const mem = process.memoryUsage();
|
|
6942
6984
|
const data = {
|
|
6943
6985
|
...metrics,
|
|
@@ -6948,7 +6990,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6948
6990
|
},
|
|
6949
6991
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6950
6992
|
};
|
|
6951
|
-
|
|
6993
|
+
import_node_fs11.default.writeFileSync(import_node_path13.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6952
6994
|
} catch {
|
|
6953
6995
|
}
|
|
6954
6996
|
}
|
|
@@ -7219,7 +7261,7 @@ init_cssToIr();
|
|
|
7219
7261
|
// packages/domain/engine/src/watch-native.ts
|
|
7220
7262
|
init_cjs_shims();
|
|
7221
7263
|
var import_node_module7 = require("module");
|
|
7222
|
-
var
|
|
7264
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
7223
7265
|
init_src2();
|
|
7224
7266
|
var import_meta7 = {};
|
|
7225
7267
|
var watchBindingState = {
|
|
@@ -7242,22 +7284,22 @@ var getBinding = () => {
|
|
|
7242
7284
|
const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
|
|
7243
7285
|
const candidates = [
|
|
7244
7286
|
// new binary name: tailwind-styled-native
|
|
7245
|
-
|
|
7246
|
-
|
|
7287
|
+
import_node_path14.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
7288
|
+
import_node_path14.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
|
|
7247
7289
|
// npm install case: dist/../native/
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7290
|
+
import_node_path14.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
7291
|
+
import_node_path14.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
|
|
7292
|
+
import_node_path14.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7251
7293
|
// monorepo dev: 4-level up
|
|
7252
|
-
|
|
7253
|
-
|
|
7294
|
+
import_node_path14.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7295
|
+
import_node_path14.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
7254
7296
|
// 3-level fallback
|
|
7255
|
-
|
|
7297
|
+
import_node_path14.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7256
7298
|
// backward compat: tailwind_styled_parser
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7299
|
+
import_node_path14.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
|
|
7300
|
+
import_node_path14.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
7301
|
+
import_node_path14.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
7302
|
+
import_node_path14.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
|
|
7261
7303
|
];
|
|
7262
7304
|
for (const c of candidates) {
|
|
7263
7305
|
try {
|
|
@@ -7278,7 +7320,7 @@ var log6 = createLogger2("engine:watch-native");
|
|
|
7278
7320
|
function watchWorkspace2(rootDir, callback, options = {}) {
|
|
7279
7321
|
const binding = getBinding();
|
|
7280
7322
|
const pollMs = options.pollIntervalMs ?? 500;
|
|
7281
|
-
const resolvedRoot =
|
|
7323
|
+
const resolvedRoot = import_node_path14.default.resolve(rootDir);
|
|
7282
7324
|
const result = (() => {
|
|
7283
7325
|
try {
|
|
7284
7326
|
return binding.startWatch(resolvedRoot);
|
|
@@ -7315,7 +7357,7 @@ This package requires native Rust bindings.`
|
|
|
7315
7357
|
const deduped = /* @__PURE__ */ new Set();
|
|
7316
7358
|
const events = [];
|
|
7317
7359
|
for (const e of raw) {
|
|
7318
|
-
const absPath =
|
|
7360
|
+
const absPath = import_node_path14.default.isAbsolute(e.path) ? import_node_path14.default.normalize(e.path) : import_node_path14.default.resolve(resolvedRoot, e.path);
|
|
7319
7361
|
const kind = e.kind;
|
|
7320
7362
|
const key = `${kind}:${absPath}`;
|
|
7321
7363
|
if (deduped.has(key)) continue;
|
|
@@ -7355,8 +7397,8 @@ var configState = {
|
|
|
7355
7397
|
var log7 = createLogger2("engine");
|
|
7356
7398
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
7357
7399
|
if (!tailwindConfigPath) return void 0;
|
|
7358
|
-
const configPath =
|
|
7359
|
-
if (!
|
|
7400
|
+
const configPath = import_node_path15.default.resolve(root, tailwindConfigPath);
|
|
7401
|
+
if (!import_node_fs12.default.existsSync(configPath)) {
|
|
7360
7402
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
7361
7403
|
}
|
|
7362
7404
|
const imported = await import((0, import_node_url6.pathToFileURL)(configPath).href);
|
|
@@ -7422,11 +7464,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
7422
7464
|
};
|
|
7423
7465
|
}
|
|
7424
7466
|
function countWorkspacePackages(root) {
|
|
7425
|
-
const packagesDir =
|
|
7426
|
-
if (!
|
|
7467
|
+
const packagesDir = import_node_path15.default.join(root, "packages");
|
|
7468
|
+
if (!import_node_fs12.default.existsSync(packagesDir)) return 0;
|
|
7427
7469
|
try {
|
|
7428
|
-
return
|
|
7429
|
-
(entry) => entry.isDirectory() &&
|
|
7470
|
+
return import_node_fs12.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
7471
|
+
(entry) => entry.isDirectory() && import_node_fs12.default.existsSync(import_node_path15.default.join(packagesDir, entry.name, "package.json"))
|
|
7430
7472
|
).length;
|
|
7431
7473
|
} catch (err) {
|
|
7432
7474
|
log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -7463,7 +7505,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
7463
7505
|
async function createEngine(rawOptions = {}) {
|
|
7464
7506
|
const options = parseEngineOptions(rawOptions);
|
|
7465
7507
|
const root = options.root ?? process.cwd();
|
|
7466
|
-
const resolvedRoot =
|
|
7508
|
+
const resolvedRoot = import_node_path15.default.resolve(root);
|
|
7467
7509
|
const plugins = rawOptions.plugins ?? [];
|
|
7468
7510
|
const getTailwindConfig = async () => {
|
|
7469
7511
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -7610,7 +7652,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
7610
7652
|
const shouldForceFullRescan = (event) => {
|
|
7611
7653
|
if (event.type === "unlink") return false;
|
|
7612
7654
|
try {
|
|
7613
|
-
const stat =
|
|
7655
|
+
const stat = import_node_fs12.default.statSync(event.filePath);
|
|
7614
7656
|
if (stat.size > largeFileThreshold) {
|
|
7615
7657
|
metrics.markSkippedLargeFile();
|
|
7616
7658
|
return true;
|
|
@@ -7728,14 +7770,14 @@ async function createEngine(rawOptions = {}) {
|
|
|
7728
7770
|
};
|
|
7729
7771
|
}
|
|
7730
7772
|
async function scanWorkspace3(opts = {}) {
|
|
7731
|
-
const root =
|
|
7773
|
+
const root = import_node_path15.default.resolve(opts.root ?? process.cwd());
|
|
7732
7774
|
return scanWorkspaceAsync(root, {
|
|
7733
7775
|
includeExtensions: opts.extensions,
|
|
7734
7776
|
ignoreDirectories: opts.ignoreDirectories
|
|
7735
7777
|
});
|
|
7736
7778
|
}
|
|
7737
7779
|
async function analyzeWorkspace2(opts = {}) {
|
|
7738
|
-
const root =
|
|
7780
|
+
const root = import_node_path15.default.resolve(opts.root ?? process.cwd());
|
|
7739
7781
|
return analyzeWorkspace(root, {
|
|
7740
7782
|
classStats: { top: opts.top ?? 20 }
|
|
7741
7783
|
});
|