tailwind-styled-v4 5.0.37 → 5.0.39
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/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +121 -83
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +31 -15
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +107 -67
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +47 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +601 -428
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +504 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +833 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +298 -30
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +72 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.js +335 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +28 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +719 -506
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +520 -318
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +145 -319
- package/dist/index.d.ts +145 -319
- package/dist/index.js +1337 -7442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -7386
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +327 -242
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +272 -184
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +94 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +68 -40
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +14 -10
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js +102 -53
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +30 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +48 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +108 -53
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +50 -18
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +63 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +98 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.js +164 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +70 -40
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +0 -12
- package/dist/shared.d.ts +0 -12
- package/dist/shared.js +481 -299
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +304 -133
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +40 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.js +95 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +69 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +56 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.js +133 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +45 -14
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +156 -115
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +135 -82
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +584 -423
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +498 -311
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +599 -450
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +484 -332
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +102 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +39 -15
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +112 -77
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -18
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
package/dist/analyzer.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require('crypto');
|
|
4
|
-
var fs3 = require('fs');
|
|
5
|
-
var path5 = require('path');
|
|
6
|
-
var url = require('url');
|
|
7
|
-
var module$1 = require('module');
|
|
8
|
-
var worker_threads = require('worker_threads');
|
|
9
|
-
var os = require('os');
|
|
10
|
-
var zod = require('zod');
|
|
11
|
-
|
|
12
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var fs3__default = /*#__PURE__*/_interopDefault(fs3);
|
|
16
|
-
var path5__default = /*#__PURE__*/_interopDefault(path5);
|
|
17
|
-
|
|
1
|
+
const __importMetaUrl = typeof __filename !== "undefined" ? require("node:url").pathToFileURL(__filename).href : "file://unknown";
|
|
18
2
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
19
5
|
var __defProp = Object.defineProperty;
|
|
20
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
22
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
10
|
var __esm = (fn, res) => function __init() {
|
|
24
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -35,7 +22,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
35
22
|
}
|
|
36
23
|
return to;
|
|
37
24
|
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
38
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
|
+
|
|
35
|
+
// packages/domain/shared/src/index.ts
|
|
39
36
|
function createLogger(namespace) {
|
|
40
37
|
const prefix = `[${namespace}]`;
|
|
41
38
|
return {
|
|
@@ -75,9 +72,9 @@ function loadNativeBinding(options) {
|
|
|
75
72
|
const { runtimeDir, candidates, isValid } = options;
|
|
76
73
|
const loadErrors = [];
|
|
77
74
|
for (const candidate of candidates) {
|
|
78
|
-
const candidatePath =
|
|
75
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
79
76
|
try {
|
|
80
|
-
if (!
|
|
77
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
81
78
|
continue;
|
|
82
79
|
}
|
|
83
80
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -109,9 +106,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
if (!includeDefaultCandidates) return candidates;
|
|
112
|
-
if (
|
|
109
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
113
110
|
try {
|
|
114
|
-
for (const entry of
|
|
111
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
115
112
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
116
113
|
}
|
|
117
114
|
} catch {
|
|
@@ -120,29 +117,35 @@ function resolveNativeBindingCandidates(options) {
|
|
|
120
117
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
121
118
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
122
119
|
for (const bin of BINARY_NAMES) {
|
|
123
|
-
candidates.push(
|
|
124
|
-
candidates.push(
|
|
125
|
-
candidates.push(
|
|
126
|
-
candidates.push(
|
|
127
|
-
candidates.push(
|
|
128
|
-
candidates.push(
|
|
129
|
-
candidates.push(
|
|
130
|
-
candidates.push(
|
|
131
|
-
candidates.push(
|
|
120
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
121
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
122
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
123
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
124
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
125
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
126
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
127
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
128
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
132
129
|
}
|
|
133
130
|
return Array.from(new Set(candidates));
|
|
134
131
|
}
|
|
135
132
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
136
|
-
if (dir) return
|
|
133
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
137
134
|
try {
|
|
138
|
-
return
|
|
135
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
139
136
|
} catch {
|
|
140
137
|
return process.cwd();
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
|
-
var TwError, _require;
|
|
140
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module, TwError, _require;
|
|
144
141
|
var init_src = __esm({
|
|
145
142
|
"packages/domain/shared/src/index.ts"() {
|
|
143
|
+
"use strict";
|
|
144
|
+
import_node_crypto = require("crypto");
|
|
145
|
+
import_node_fs = __toESM(require("fs"));
|
|
146
|
+
import_node_path = __toESM(require("path"));
|
|
147
|
+
import_node_url = require("url");
|
|
148
|
+
import_node_module = require("module");
|
|
146
149
|
TwError = class _TwError extends Error {
|
|
147
150
|
/** @deprecated Gunakan source */
|
|
148
151
|
domain;
|
|
@@ -195,7 +198,9 @@ var init_src = __esm({
|
|
|
195
198
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
196
199
|
}
|
|
197
200
|
};
|
|
198
|
-
_require =
|
|
201
|
+
_require = (0, import_node_module.createRequire)(
|
|
202
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : __importMetaUrl ?? "file://unknown"
|
|
203
|
+
);
|
|
199
204
|
}
|
|
200
205
|
});
|
|
201
206
|
|
|
@@ -232,8 +237,8 @@ function getDirname() {
|
|
|
232
237
|
if (typeof __dirname !== "undefined") {
|
|
233
238
|
return __dirname;
|
|
234
239
|
}
|
|
235
|
-
if (typeof
|
|
236
|
-
return
|
|
240
|
+
if (typeof import_meta !== "undefined" && __importMetaUrl) {
|
|
241
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
|
|
237
242
|
}
|
|
238
243
|
return process.cwd();
|
|
239
244
|
}
|
|
@@ -438,13 +443,17 @@ function hasNativeWatchBinding() {
|
|
|
438
443
|
return false;
|
|
439
444
|
}
|
|
440
445
|
}
|
|
441
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
446
|
+
var import_node_path2, import_node_url2, import_meta, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
442
447
|
var init_native_bridge = __esm({
|
|
443
448
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
449
|
+
"use strict";
|
|
450
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
451
|
+
import_node_url2 = require("url");
|
|
444
452
|
init_src();
|
|
453
|
+
import_meta = {};
|
|
445
454
|
log = createDebugLogger("scanner:native");
|
|
446
|
-
isValidScannerBinding = (
|
|
447
|
-
const candidate =
|
|
455
|
+
isValidScannerBinding = (module2) => {
|
|
456
|
+
const candidate = module2;
|
|
448
457
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
449
458
|
};
|
|
450
459
|
createScannerBridgeLoader = () => {
|
|
@@ -521,13 +530,15 @@ var init_native_bridge = __esm({
|
|
|
521
530
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
522
531
|
}
|
|
523
532
|
});
|
|
533
|
+
|
|
534
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
524
535
|
function defaultCachePath(rootDir, cacheDir) {
|
|
525
|
-
const dir = cacheDir ?
|
|
526
|
-
return
|
|
536
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
537
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
527
538
|
}
|
|
528
539
|
function readCache(rootDir, cacheDir) {
|
|
529
540
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
530
|
-
|
|
541
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
531
542
|
const result = cacheReadNative(cachePath);
|
|
532
543
|
if (!result) return [];
|
|
533
544
|
return result.entries.map((e) => ({
|
|
@@ -542,7 +553,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
542
553
|
}
|
|
543
554
|
function writeCache(rootDir, entries, cacheDir) {
|
|
544
555
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
545
|
-
|
|
556
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
546
557
|
const success = cacheWriteNative(cachePath, entries);
|
|
547
558
|
if (!success) {
|
|
548
559
|
throw new Error(
|
|
@@ -561,11 +572,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
561
572
|
nowMs
|
|
562
573
|
);
|
|
563
574
|
}
|
|
575
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
564
576
|
var init_cache_native = __esm({
|
|
565
577
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
578
|
+
"use strict";
|
|
579
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
580
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
566
581
|
init_native_bridge();
|
|
582
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
567
583
|
}
|
|
568
584
|
});
|
|
585
|
+
|
|
586
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
569
587
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
570
588
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
571
589
|
if (native !== null) return native;
|
|
@@ -583,7 +601,7 @@ function mergeResults(batchResults) {
|
|
|
583
601
|
}
|
|
584
602
|
function runChunkInWorker(filePaths) {
|
|
585
603
|
return new Promise((resolve, reject) => {
|
|
586
|
-
const worker = new
|
|
604
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
587
605
|
workerData: { filePaths }
|
|
588
606
|
});
|
|
589
607
|
worker.once("message", (payload) => {
|
|
@@ -603,10 +621,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
603
621
|
const {
|
|
604
622
|
extensions = DEFAULT_EXTENSIONS,
|
|
605
623
|
ignoreDirs = DEFAULT_IGNORES,
|
|
606
|
-
maxWorkers = Math.max(1,
|
|
624
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
607
625
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
608
626
|
} = options;
|
|
609
|
-
const files = collectFiles(
|
|
627
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
610
628
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
611
629
|
return mergeResults(batchExtractClassesNative(files));
|
|
612
630
|
}
|
|
@@ -622,33 +640,42 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
622
640
|
}
|
|
623
641
|
return mergeResults(allResults);
|
|
624
642
|
}
|
|
625
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
643
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
626
644
|
var init_parallel_scanner = __esm({
|
|
627
645
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
646
|
+
"use strict";
|
|
647
|
+
import_node_worker_threads = require("worker_threads");
|
|
648
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
649
|
+
import_node_os = require("os");
|
|
650
|
+
import_node_url3 = require("url");
|
|
628
651
|
init_src2();
|
|
629
652
|
init_native_bridge();
|
|
630
653
|
PARALLEL_THRESHOLD = 50;
|
|
631
654
|
DEFAULT_CHUNK_SIZE = 150;
|
|
632
|
-
if (!
|
|
633
|
-
const { filePaths } =
|
|
655
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
656
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
634
657
|
try {
|
|
635
658
|
const results = batchExtractClassesNative(filePaths);
|
|
636
659
|
const msg = { ok: true, results };
|
|
637
|
-
|
|
660
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
638
661
|
} catch (error) {
|
|
639
662
|
const msg = {
|
|
640
663
|
ok: false,
|
|
641
664
|
error: error instanceof Error ? error.message : String(error)
|
|
642
665
|
};
|
|
643
|
-
|
|
666
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
644
667
|
}
|
|
645
668
|
}
|
|
646
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
669
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(__importMetaUrl);
|
|
647
670
|
}
|
|
648
671
|
});
|
|
649
|
-
|
|
672
|
+
|
|
673
|
+
// packages/domain/scanner/src/schemas.ts
|
|
674
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
650
675
|
var init_schemas = __esm({
|
|
651
676
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
677
|
+
"use strict";
|
|
678
|
+
import_zod = require("zod");
|
|
652
679
|
init_src();
|
|
653
680
|
formatIssuePath2 = (path8) => path8.length > 0 ? path8.map(
|
|
654
681
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -668,40 +695,40 @@ var init_schemas = __esm({
|
|
|
668
695
|
parsed.error
|
|
669
696
|
);
|
|
670
697
|
};
|
|
671
|
-
NonNegativeIntegerSchema =
|
|
672
|
-
ScanWorkspaceOptionsSchema =
|
|
673
|
-
includeExtensions:
|
|
674
|
-
ignoreDirectories:
|
|
675
|
-
useCache:
|
|
676
|
-
cacheDir:
|
|
677
|
-
smartInvalidation:
|
|
698
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
699
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
700
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
701
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
702
|
+
useCache: import_zod.z.boolean().optional(),
|
|
703
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
704
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
678
705
|
});
|
|
679
|
-
ScanFileResultSchema =
|
|
680
|
-
file:
|
|
681
|
-
classes:
|
|
682
|
-
hash:
|
|
706
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
707
|
+
file: import_zod.z.string(),
|
|
708
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
709
|
+
hash: import_zod.z.string().optional()
|
|
683
710
|
});
|
|
684
|
-
ScanWorkspaceResultSchema =
|
|
685
|
-
files:
|
|
711
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
712
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
686
713
|
totalFiles: NonNegativeIntegerSchema,
|
|
687
|
-
uniqueClasses:
|
|
714
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
688
715
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
689
716
|
message: "scan result totalFiles must match files.length",
|
|
690
717
|
path: ["totalFiles"]
|
|
691
718
|
});
|
|
692
|
-
|
|
693
|
-
rootDir:
|
|
719
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
720
|
+
rootDir: import_zod.z.string().min(1),
|
|
694
721
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
695
722
|
});
|
|
696
|
-
ScannerWorkerSuccessMessageSchema =
|
|
697
|
-
ok:
|
|
723
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
724
|
+
ok: import_zod.z.literal(true),
|
|
698
725
|
result: ScanWorkspaceResultSchema
|
|
699
726
|
});
|
|
700
|
-
ScannerWorkerErrorMessageSchema =
|
|
701
|
-
ok:
|
|
702
|
-
error:
|
|
727
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
728
|
+
ok: import_zod.z.literal(false),
|
|
729
|
+
error: import_zod.z.string().optional()
|
|
703
730
|
});
|
|
704
|
-
ScannerWorkerMessageSchema =
|
|
731
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
705
732
|
ScannerWorkerSuccessMessageSchema,
|
|
706
733
|
ScannerWorkerErrorMessageSchema
|
|
707
734
|
]);
|
|
@@ -731,8 +758,8 @@ function getRuntimeDir() {
|
|
|
731
758
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
732
759
|
return __dirname;
|
|
733
760
|
}
|
|
734
|
-
if (typeof
|
|
735
|
-
return
|
|
761
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
762
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
736
763
|
}
|
|
737
764
|
return process.cwd();
|
|
738
765
|
}
|
|
@@ -741,18 +768,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
741
768
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
742
769
|
return __dirname;
|
|
743
770
|
}
|
|
744
|
-
if (typeof
|
|
745
|
-
return
|
|
771
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
772
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
746
773
|
}
|
|
747
774
|
return process.cwd();
|
|
748
775
|
})();
|
|
749
776
|
const candidates = [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
777
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
778
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
779
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
753
780
|
];
|
|
754
781
|
for (const candidate of candidates) {
|
|
755
|
-
if (
|
|
782
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
756
783
|
}
|
|
757
784
|
return null;
|
|
758
785
|
}
|
|
@@ -764,7 +791,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
764
791
|
}
|
|
765
792
|
return new Promise((resolve, reject) => {
|
|
766
793
|
const settleState = { settled: false };
|
|
767
|
-
const worker = new
|
|
794
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
768
795
|
const timeout = setTimeout(() => {
|
|
769
796
|
if (!settleState.settled) {
|
|
770
797
|
settleState.settled = true;
|
|
@@ -809,19 +836,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
809
836
|
if (!currentDir) continue;
|
|
810
837
|
const entries = (() => {
|
|
811
838
|
try {
|
|
812
|
-
return
|
|
839
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
813
840
|
} catch {
|
|
814
841
|
return [];
|
|
815
842
|
}
|
|
816
843
|
})();
|
|
817
844
|
for (const entry of entries) {
|
|
818
|
-
const fullPath =
|
|
845
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
819
846
|
if (entry.isDirectory()) {
|
|
820
847
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
821
848
|
continue;
|
|
822
849
|
}
|
|
823
850
|
if (!entry.isFile()) continue;
|
|
824
|
-
if (!extensionSet.has(
|
|
851
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
825
852
|
candidates.push(fullPath);
|
|
826
853
|
}
|
|
827
854
|
}
|
|
@@ -848,7 +875,7 @@ function scanSource(source) {
|
|
|
848
875
|
);
|
|
849
876
|
}
|
|
850
877
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
851
|
-
return includeExtensions.includes(
|
|
878
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
852
879
|
}
|
|
853
880
|
function scanFile(filePath) {
|
|
854
881
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -868,7 +895,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
868
895
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
869
896
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
870
897
|
const useCache = normalizedOptions.useCache ?? true;
|
|
871
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
898
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
872
899
|
const files = [];
|
|
873
900
|
const unique = /* @__PURE__ */ new Set();
|
|
874
901
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -908,7 +935,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
908
935
|
for (const filePath of candidates) {
|
|
909
936
|
const stat = (() => {
|
|
910
937
|
try {
|
|
911
|
-
return
|
|
938
|
+
return import_node_fs3.default.statSync(filePath);
|
|
912
939
|
} catch {
|
|
913
940
|
return null;
|
|
914
941
|
}
|
|
@@ -934,7 +961,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
934
961
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
935
962
|
const content = (() => {
|
|
936
963
|
try {
|
|
937
|
-
return
|
|
964
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
938
965
|
} catch {
|
|
939
966
|
return null;
|
|
940
967
|
}
|
|
@@ -1015,9 +1042,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
1015
1042
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
1016
1043
|
}
|
|
1017
1044
|
}
|
|
1018
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1045
|
+
var import_node_fs3, import_node_module2, import_node_path5, import_node_url4, import_node_worker_threads2, import_meta2, log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1019
1046
|
var init_src2 = __esm({
|
|
1020
1047
|
"packages/domain/scanner/src/index.ts"() {
|
|
1048
|
+
"use strict";
|
|
1049
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
1050
|
+
import_node_module2 = require("module");
|
|
1051
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
1052
|
+
import_node_url4 = require("url");
|
|
1053
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
1021
1054
|
init_src();
|
|
1022
1055
|
init_cache_native();
|
|
1023
1056
|
init_native_bridge();
|
|
@@ -1025,6 +1058,7 @@ var init_src2 = __esm({
|
|
|
1025
1058
|
init_schemas();
|
|
1026
1059
|
init_schemas();
|
|
1027
1060
|
init_native_bridge();
|
|
1061
|
+
import_meta2 = {};
|
|
1028
1062
|
log2 = createLogger("scanner");
|
|
1029
1063
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
1030
1064
|
createNativeParserLoader = () => {
|
|
@@ -1038,7 +1072,7 @@ var init_src2 = __esm({
|
|
|
1038
1072
|
const loadNativeParserBinding = () => {
|
|
1039
1073
|
if (_state.binding !== void 0) return _state.binding;
|
|
1040
1074
|
const runtimeDir = getRuntimeDir();
|
|
1041
|
-
const req =
|
|
1075
|
+
const req = (0, import_node_module2.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
1042
1076
|
const _platform = process.platform;
|
|
1043
1077
|
const _arch = process.arch;
|
|
1044
1078
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -1046,27 +1080,27 @@ var init_src2 = __esm({
|
|
|
1046
1080
|
const candidates = [
|
|
1047
1081
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
1048
1082
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1083
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
1084
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1085
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1052
1086
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
1053
1087
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1088
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
1089
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1090
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1057
1091
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
1058
|
-
|
|
1059
|
-
|
|
1092
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1093
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1060
1094
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
1061
|
-
|
|
1062
|
-
|
|
1095
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1096
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1063
1097
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1098
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
1099
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
1100
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
1101
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
1102
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
1103
|
+
import_node_path5.default.resolve(
|
|
1070
1104
|
runtimeDir,
|
|
1071
1105
|
"..",
|
|
1072
1106
|
"..",
|
|
@@ -1078,7 +1112,7 @@ var init_src2 = __esm({
|
|
|
1078
1112
|
)
|
|
1079
1113
|
];
|
|
1080
1114
|
for (const fullPath of candidates) {
|
|
1081
|
-
if (!
|
|
1115
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
1082
1116
|
try {
|
|
1083
1117
|
const required = req(fullPath);
|
|
1084
1118
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -1111,13 +1145,24 @@ var init_src2 = __esm({
|
|
|
1111
1145
|
}
|
|
1112
1146
|
});
|
|
1113
1147
|
|
|
1148
|
+
// src/umbrella/analyzer.ts
|
|
1149
|
+
var analyzer_exports = {};
|
|
1150
|
+
__export(analyzer_exports, {
|
|
1151
|
+
__internal: () => __internal,
|
|
1152
|
+
analyzeWorkspace: () => analyzeWorkspace,
|
|
1153
|
+
classToCss: () => classToCss
|
|
1154
|
+
});
|
|
1155
|
+
module.exports = __toCommonJS(analyzer_exports);
|
|
1156
|
+
|
|
1114
1157
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
1158
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
1115
1159
|
init_src2();
|
|
1116
1160
|
|
|
1117
1161
|
// packages/domain/analyzer/src/binding.ts
|
|
1118
1162
|
init_src();
|
|
1119
1163
|
|
|
1120
1164
|
// packages/domain/analyzer/src/utils.ts
|
|
1165
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
1121
1166
|
init_src();
|
|
1122
1167
|
var DEFAULT_TOP_LIMIT = 10;
|
|
1123
1168
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -1132,7 +1177,7 @@ function isRecord(value) {
|
|
|
1132
1177
|
}
|
|
1133
1178
|
async function pathExists(filePath) {
|
|
1134
1179
|
try {
|
|
1135
|
-
await
|
|
1180
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
1136
1181
|
return true;
|
|
1137
1182
|
} catch {
|
|
1138
1183
|
return false;
|
|
@@ -1149,8 +1194,8 @@ function sanitizeFrequentThreshold(value) {
|
|
|
1149
1194
|
}
|
|
1150
1195
|
|
|
1151
1196
|
// packages/domain/analyzer/src/binding.ts
|
|
1152
|
-
var isAnalyzerModule = (
|
|
1153
|
-
const candidate =
|
|
1197
|
+
var isAnalyzerModule = (module2) => {
|
|
1198
|
+
const candidate = module2;
|
|
1154
1199
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
1155
1200
|
};
|
|
1156
1201
|
var createAnalyzerBindingLoader = () => {
|
|
@@ -1160,7 +1205,7 @@ var createAnalyzerBindingLoader = () => {
|
|
|
1160
1205
|
_state.bindingPromise = (async () => {
|
|
1161
1206
|
const runtimeDir = resolveRuntimeDir(
|
|
1162
1207
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
1163
|
-
|
|
1208
|
+
__importMetaUrl
|
|
1164
1209
|
);
|
|
1165
1210
|
const candidates = resolveNativeBindingCandidates({
|
|
1166
1211
|
runtimeDir,
|
|
@@ -1203,7 +1248,7 @@ async function requireNativeBinding() {
|
|
|
1203
1248
|
if (binding?.analyzeClasses) return binding;
|
|
1204
1249
|
const runtimeDir = resolveRuntimeDir(
|
|
1205
1250
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
1206
|
-
|
|
1251
|
+
__importMetaUrl
|
|
1207
1252
|
);
|
|
1208
1253
|
const candidates = resolveNativeBindingCandidates({
|
|
1209
1254
|
runtimeDir,
|
|
@@ -1236,6 +1281,7 @@ async function requireNativeCssCompiler() {
|
|
|
1236
1281
|
|
|
1237
1282
|
// packages/domain/analyzer/src/schemas.ts
|
|
1238
1283
|
init_src();
|
|
1284
|
+
var import_zod2 = require("zod");
|
|
1239
1285
|
var formatIssuePath3 = (path8) => path8.length > 0 ? path8.map(
|
|
1240
1286
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
1241
1287
|
).join(".") : "<root>";
|
|
@@ -1259,76 +1305,76 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
1259
1305
|
parsed.error
|
|
1260
1306
|
);
|
|
1261
1307
|
};
|
|
1262
|
-
var CountSchema =
|
|
1263
|
-
|
|
1264
|
-
name:
|
|
1308
|
+
var CountSchema = import_zod2.z.number().int().min(0);
|
|
1309
|
+
var ClassUsageSchema = import_zod2.z.object({
|
|
1310
|
+
name: import_zod2.z.string(),
|
|
1265
1311
|
count: CountSchema,
|
|
1266
|
-
isUnused:
|
|
1267
|
-
isConflict:
|
|
1312
|
+
isUnused: import_zod2.z.boolean().optional(),
|
|
1313
|
+
isConflict: import_zod2.z.boolean().optional()
|
|
1268
1314
|
});
|
|
1269
|
-
|
|
1270
|
-
className:
|
|
1271
|
-
variants:
|
|
1272
|
-
classes:
|
|
1273
|
-
message:
|
|
1315
|
+
var ClassConflictSchema = import_zod2.z.object({
|
|
1316
|
+
className: import_zod2.z.string(),
|
|
1317
|
+
variants: import_zod2.z.array(import_zod2.z.string()),
|
|
1318
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
1319
|
+
message: import_zod2.z.string()
|
|
1274
1320
|
});
|
|
1275
|
-
var ClassCountSchema =
|
|
1276
|
-
name:
|
|
1321
|
+
var ClassCountSchema = import_zod2.z.object({
|
|
1322
|
+
name: import_zod2.z.string(),
|
|
1277
1323
|
count: CountSchema
|
|
1278
1324
|
});
|
|
1279
|
-
var NativeReportSchema =
|
|
1280
|
-
root:
|
|
1325
|
+
var NativeReportSchema = import_zod2.z.object({
|
|
1326
|
+
root: import_zod2.z.string(),
|
|
1281
1327
|
totalFiles: CountSchema,
|
|
1282
1328
|
uniqueClassCount: CountSchema,
|
|
1283
1329
|
totalClassOccurrences: CountSchema,
|
|
1284
|
-
topClasses:
|
|
1285
|
-
duplicateCandidates:
|
|
1286
|
-
safelist:
|
|
1330
|
+
topClasses: import_zod2.z.array(ClassCountSchema),
|
|
1331
|
+
duplicateCandidates: import_zod2.z.array(ClassCountSchema),
|
|
1332
|
+
safelist: import_zod2.z.array(import_zod2.z.string())
|
|
1287
1333
|
});
|
|
1288
|
-
var NativeCssCompileResultSchema =
|
|
1289
|
-
css:
|
|
1290
|
-
resolvedClasses:
|
|
1291
|
-
unknownClasses:
|
|
1334
|
+
var NativeCssCompileResultSchema = import_zod2.z.object({
|
|
1335
|
+
css: import_zod2.z.string(),
|
|
1336
|
+
resolvedClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
1337
|
+
unknownClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
1292
1338
|
sizeBytes: CountSchema
|
|
1293
1339
|
});
|
|
1294
|
-
var AnalyzerClassStatsSchema =
|
|
1295
|
-
top:
|
|
1340
|
+
var AnalyzerClassStatsSchema = import_zod2.z.object({
|
|
1341
|
+
top: import_zod2.z.number({
|
|
1296
1342
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
1297
1343
|
}).finite().optional(),
|
|
1298
|
-
frequentThreshold:
|
|
1344
|
+
frequentThreshold: import_zod2.z.number({
|
|
1299
1345
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
1300
1346
|
}).finite().optional()
|
|
1301
1347
|
});
|
|
1302
|
-
var AnalyzerSemanticOptionsSchema =
|
|
1303
|
-
tailwindConfigPath:
|
|
1348
|
+
var AnalyzerSemanticOptionsSchema = import_zod2.z.object({
|
|
1349
|
+
tailwindConfigPath: import_zod2.z.string({
|
|
1304
1350
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1305
1351
|
}).min(
|
|
1306
1352
|
1,
|
|
1307
1353
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1308
1354
|
).optional()
|
|
1309
1355
|
});
|
|
1310
|
-
var AnalyzerOptionsSchema =
|
|
1311
|
-
scanner:
|
|
1356
|
+
var AnalyzerOptionsSchema = import_zod2.z.object({
|
|
1357
|
+
scanner: import_zod2.z.custom(
|
|
1312
1358
|
(value) => isPlainObject(value),
|
|
1313
1359
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
1314
1360
|
).optional(),
|
|
1315
1361
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
1316
|
-
semantic:
|
|
1317
|
-
|
|
1362
|
+
semantic: import_zod2.z.union([
|
|
1363
|
+
import_zod2.z.boolean({
|
|
1318
1364
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
1319
1365
|
}),
|
|
1320
1366
|
AnalyzerSemanticOptionsSchema
|
|
1321
1367
|
]).optional(),
|
|
1322
|
-
includeClass:
|
|
1368
|
+
includeClass: import_zod2.z.custom(
|
|
1323
1369
|
(value) => typeof value === "function",
|
|
1324
1370
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
1325
1371
|
).optional()
|
|
1326
1372
|
});
|
|
1327
|
-
var ClassToCssOptionsSchema =
|
|
1328
|
-
prefix:
|
|
1373
|
+
var ClassToCssOptionsSchema = import_zod2.z.object({
|
|
1374
|
+
prefix: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.null()], {
|
|
1329
1375
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
1330
1376
|
}).optional(),
|
|
1331
|
-
strict:
|
|
1377
|
+
strict: import_zod2.z.boolean({
|
|
1332
1378
|
error: "classToCss options.strict must be a boolean when provided."
|
|
1333
1379
|
}).optional()
|
|
1334
1380
|
});
|
|
@@ -1340,6 +1386,11 @@ var parseNativeCssCompileResult = (result, className) => parseWithSchema2(
|
|
|
1340
1386
|
className ? `Native CSS compile result is invalid for class "${className}"` : "Native CSS compile result is invalid"
|
|
1341
1387
|
);
|
|
1342
1388
|
var parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
1389
|
+
|
|
1390
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
1391
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
1392
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
1393
|
+
var import_node_url5 = require("url");
|
|
1343
1394
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
1344
1395
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
1345
1396
|
var splitVariantAndBase = (className) => {
|
|
@@ -1373,11 +1424,11 @@ var detectConflicts = async (usages) => {
|
|
|
1373
1424
|
};
|
|
1374
1425
|
};
|
|
1375
1426
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
1376
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
1427
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path6.default.extname(configPath).toLowerCase());
|
|
1377
1428
|
};
|
|
1378
1429
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
1379
1430
|
if (explicitPath) {
|
|
1380
|
-
const resolved =
|
|
1431
|
+
const resolved = import_node_path6.default.resolve(root, explicitPath);
|
|
1381
1432
|
if (!await pathExists(resolved)) return null;
|
|
1382
1433
|
return resolved;
|
|
1383
1434
|
}
|
|
@@ -1388,7 +1439,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
1388
1439
|
"tailwind.config.mjs"
|
|
1389
1440
|
];
|
|
1390
1441
|
for (const candidate of candidates) {
|
|
1391
|
-
const fullPath =
|
|
1442
|
+
const fullPath = import_node_path6.default.resolve(root, candidate);
|
|
1392
1443
|
if (await pathExists(fullPath)) return fullPath;
|
|
1393
1444
|
}
|
|
1394
1445
|
return null;
|
|
@@ -1442,7 +1493,7 @@ var collectCustomUtilities = (config) => {
|
|
|
1442
1493
|
return out;
|
|
1443
1494
|
};
|
|
1444
1495
|
var collectSafelistFromSource = async (configPath) => {
|
|
1445
|
-
const source = await
|
|
1496
|
+
const source = await import_node_fs5.default.promises.readFile(configPath, "utf8");
|
|
1446
1497
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
1447
1498
|
const allTokens = extractClassesNative2(source);
|
|
1448
1499
|
const hasSafelist = source.includes("safelist");
|
|
@@ -1469,7 +1520,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
1469
1520
|
customUtilities: /* @__PURE__ */ new Set()
|
|
1470
1521
|
};
|
|
1471
1522
|
}
|
|
1472
|
-
const configStat = await
|
|
1523
|
+
const configStat = await import_node_fs5.default.promises.stat(configPath).catch(() => null);
|
|
1473
1524
|
if (configStat) {
|
|
1474
1525
|
const cached = tailwindConfigCache.get(configPath);
|
|
1475
1526
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -1482,7 +1533,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
1482
1533
|
const result = await (async () => {
|
|
1483
1534
|
try {
|
|
1484
1535
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
1485
|
-
const imported = await import(`${
|
|
1536
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
1486
1537
|
const candidate = imported.default ?? imported;
|
|
1487
1538
|
if (isRecord(candidate)) {
|
|
1488
1539
|
return { config: candidate, warning: void 0 };
|
|
@@ -1647,7 +1698,7 @@ async function buildDistribution(usages, native) {
|
|
|
1647
1698
|
}
|
|
1648
1699
|
async function analyzeWorkspace(root, options = {}) {
|
|
1649
1700
|
const startedAtMs = Date.now();
|
|
1650
|
-
const resolvedRoot =
|
|
1701
|
+
const resolvedRoot = import_node_path7.default.resolve(root);
|
|
1651
1702
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
1652
1703
|
const scan = await (async () => {
|
|
1653
1704
|
const scanStartedAtMs = Date.now();
|
|
@@ -1869,9 +1920,10 @@ var __internal = {
|
|
|
1869
1920
|
parseNativeReport,
|
|
1870
1921
|
parseNativeCssCompileResult
|
|
1871
1922
|
};
|
|
1872
|
-
|
|
1873
|
-
exports
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1923
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1924
|
+
0 && (module.exports = {
|
|
1925
|
+
__internal,
|
|
1926
|
+
analyzeWorkspace,
|
|
1927
|
+
classToCss
|
|
1928
|
+
});
|
|
1877
1929
|
//# sourceMappingURL=analyzer.js.map
|