tailwind-styled-v4 5.0.36 → 5.0.38
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.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +118 -82
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +28 -14
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +105 -68
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +40 -13
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +577 -426
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +466 -304
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- package/dist/compiler.js +826 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +287 -29
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +71 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- package/dist/devtools.js +333 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +26 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- package/dist/engine.js +679 -502
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +467 -307
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +180 -127
- package/dist/index.d.ts +180 -127
- package/dist/index.js +1329 -7441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1266 -7385
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +318 -243
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +256 -181
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- package/dist/plugin-api.js +93 -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 +103 -62
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +53 -35
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +115 -50
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +44 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +47 -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 +82 -50
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +20 -12
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +62 -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.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- package/dist/runtime.js +97 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- package/dist/scanner.js +163 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +67 -39
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- package/dist/shared.js +441 -295
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +253 -122
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- package/dist/storybook-addon.js +39 -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.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/svelte.js +88 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -13
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +68 -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 +55 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- package/dist/theme.js +131 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +42 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +150 -116
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +124 -81
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +560 -421
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +460 -302
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +561 -446
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +433 -321
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +4 -1
- package/dist/vue.d.ts +4 -1
- package/dist/vue.js +95 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +30 -14
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +110 -78
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -17
- 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/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/analyzer.js
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
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
|
-
|
|
18
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
19
4
|
var __defProp = Object.defineProperty;
|
|
20
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
22
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
9
|
var __esm = (fn, res) => function __init() {
|
|
24
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -35,7 +21,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
35
21
|
}
|
|
36
22
|
return to;
|
|
37
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
38
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
|
|
34
|
+
// packages/domain/shared/src/index.ts
|
|
39
35
|
function createLogger(namespace) {
|
|
40
36
|
const prefix = `[${namespace}]`;
|
|
41
37
|
return {
|
|
@@ -75,9 +71,9 @@ function loadNativeBinding(options) {
|
|
|
75
71
|
const { runtimeDir, candidates, isValid } = options;
|
|
76
72
|
const loadErrors = [];
|
|
77
73
|
for (const candidate of candidates) {
|
|
78
|
-
const candidatePath =
|
|
74
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
79
75
|
try {
|
|
80
|
-
if (!
|
|
76
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
81
77
|
continue;
|
|
82
78
|
}
|
|
83
79
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -109,9 +105,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
107
|
if (!includeDefaultCandidates) return candidates;
|
|
112
|
-
if (
|
|
108
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
113
109
|
try {
|
|
114
|
-
for (const entry of
|
|
110
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
115
111
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
116
112
|
}
|
|
117
113
|
} catch {
|
|
@@ -120,29 +116,36 @@ function resolveNativeBindingCandidates(options) {
|
|
|
120
116
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
121
117
|
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
118
|
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(
|
|
119
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
120
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
121
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
122
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
123
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
124
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
125
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
126
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
127
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
132
128
|
}
|
|
133
129
|
return Array.from(new Set(candidates));
|
|
134
130
|
}
|
|
135
131
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
136
|
-
if (dir) return
|
|
132
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
137
133
|
try {
|
|
138
|
-
return
|
|
134
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
139
135
|
} catch {
|
|
140
136
|
return process.cwd();
|
|
141
137
|
}
|
|
142
138
|
}
|
|
143
|
-
var TwError, _require;
|
|
139
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module, import_meta, TwError, _require;
|
|
144
140
|
var init_src = __esm({
|
|
145
141
|
"packages/domain/shared/src/index.ts"() {
|
|
142
|
+
"use strict";
|
|
143
|
+
import_node_crypto = require("crypto");
|
|
144
|
+
import_node_fs = __toESM(require("fs"));
|
|
145
|
+
import_node_path = __toESM(require("path"));
|
|
146
|
+
import_node_url = require("url");
|
|
147
|
+
import_node_module = require("module");
|
|
148
|
+
import_meta = {};
|
|
146
149
|
TwError = class _TwError extends Error {
|
|
147
150
|
/** @deprecated Gunakan source */
|
|
148
151
|
domain;
|
|
@@ -195,7 +198,7 @@ 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)(import_meta.url);
|
|
199
202
|
}
|
|
200
203
|
});
|
|
201
204
|
|
|
@@ -232,8 +235,8 @@ function getDirname() {
|
|
|
232
235
|
if (typeof __dirname !== "undefined") {
|
|
233
236
|
return __dirname;
|
|
234
237
|
}
|
|
235
|
-
if (typeof
|
|
236
|
-
return
|
|
238
|
+
if (typeof import_meta2 !== "undefined" && import_meta2.url) {
|
|
239
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url));
|
|
237
240
|
}
|
|
238
241
|
return process.cwd();
|
|
239
242
|
}
|
|
@@ -438,13 +441,17 @@ function hasNativeWatchBinding() {
|
|
|
438
441
|
return false;
|
|
439
442
|
}
|
|
440
443
|
}
|
|
441
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
444
|
+
var import_node_path2, import_node_url2, import_meta2, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
442
445
|
var init_native_bridge = __esm({
|
|
443
446
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
447
|
+
"use strict";
|
|
448
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
449
|
+
import_node_url2 = require("url");
|
|
444
450
|
init_src();
|
|
451
|
+
import_meta2 = {};
|
|
445
452
|
log = createDebugLogger("scanner:native");
|
|
446
|
-
isValidScannerBinding = (
|
|
447
|
-
const candidate =
|
|
453
|
+
isValidScannerBinding = (module2) => {
|
|
454
|
+
const candidate = module2;
|
|
448
455
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
449
456
|
};
|
|
450
457
|
createScannerBridgeLoader = () => {
|
|
@@ -521,13 +528,15 @@ var init_native_bridge = __esm({
|
|
|
521
528
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
522
529
|
}
|
|
523
530
|
});
|
|
531
|
+
|
|
532
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
524
533
|
function defaultCachePath(rootDir, cacheDir) {
|
|
525
|
-
const dir = cacheDir ?
|
|
526
|
-
return
|
|
534
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
535
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
527
536
|
}
|
|
528
537
|
function readCache(rootDir, cacheDir) {
|
|
529
538
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
530
|
-
|
|
539
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
531
540
|
const result = cacheReadNative(cachePath);
|
|
532
541
|
if (!result) return [];
|
|
533
542
|
return result.entries.map((e) => ({
|
|
@@ -542,7 +551,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
542
551
|
}
|
|
543
552
|
function writeCache(rootDir, entries, cacheDir) {
|
|
544
553
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
545
|
-
|
|
554
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
546
555
|
const success = cacheWriteNative(cachePath, entries);
|
|
547
556
|
if (!success) {
|
|
548
557
|
throw new Error(
|
|
@@ -561,11 +570,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
561
570
|
nowMs
|
|
562
571
|
);
|
|
563
572
|
}
|
|
573
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
564
574
|
var init_cache_native = __esm({
|
|
565
575
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
576
|
+
"use strict";
|
|
577
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
578
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
566
579
|
init_native_bridge();
|
|
580
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
567
581
|
}
|
|
568
582
|
});
|
|
583
|
+
|
|
584
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
569
585
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
570
586
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
571
587
|
if (native !== null) return native;
|
|
@@ -583,7 +599,7 @@ function mergeResults(batchResults) {
|
|
|
583
599
|
}
|
|
584
600
|
function runChunkInWorker(filePaths) {
|
|
585
601
|
return new Promise((resolve, reject) => {
|
|
586
|
-
const worker = new
|
|
602
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
587
603
|
workerData: { filePaths }
|
|
588
604
|
});
|
|
589
605
|
worker.once("message", (payload) => {
|
|
@@ -603,10 +619,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
603
619
|
const {
|
|
604
620
|
extensions = DEFAULT_EXTENSIONS,
|
|
605
621
|
ignoreDirs = DEFAULT_IGNORES,
|
|
606
|
-
maxWorkers = Math.max(1,
|
|
622
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
607
623
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
608
624
|
} = options;
|
|
609
|
-
const files = collectFiles(
|
|
625
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
610
626
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
611
627
|
return mergeResults(batchExtractClassesNative(files));
|
|
612
628
|
}
|
|
@@ -622,33 +638,43 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
622
638
|
}
|
|
623
639
|
return mergeResults(allResults);
|
|
624
640
|
}
|
|
625
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
641
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, import_meta3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
626
642
|
var init_parallel_scanner = __esm({
|
|
627
643
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
644
|
+
"use strict";
|
|
645
|
+
import_node_worker_threads = require("worker_threads");
|
|
646
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
647
|
+
import_node_os = require("os");
|
|
648
|
+
import_node_url3 = require("url");
|
|
628
649
|
init_src2();
|
|
629
650
|
init_native_bridge();
|
|
651
|
+
import_meta3 = {};
|
|
630
652
|
PARALLEL_THRESHOLD = 50;
|
|
631
653
|
DEFAULT_CHUNK_SIZE = 150;
|
|
632
|
-
if (!
|
|
633
|
-
const { filePaths } =
|
|
654
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
655
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
634
656
|
try {
|
|
635
657
|
const results = batchExtractClassesNative(filePaths);
|
|
636
658
|
const msg = { ok: true, results };
|
|
637
|
-
|
|
659
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
638
660
|
} catch (error) {
|
|
639
661
|
const msg = {
|
|
640
662
|
ok: false,
|
|
641
663
|
error: error instanceof Error ? error.message : String(error)
|
|
642
664
|
};
|
|
643
|
-
|
|
665
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
644
666
|
}
|
|
645
667
|
}
|
|
646
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
668
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(import_meta3.url);
|
|
647
669
|
}
|
|
648
670
|
});
|
|
649
|
-
|
|
671
|
+
|
|
672
|
+
// packages/domain/scanner/src/schemas.ts
|
|
673
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
650
674
|
var init_schemas = __esm({
|
|
651
675
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
676
|
+
"use strict";
|
|
677
|
+
import_zod = require("zod");
|
|
652
678
|
init_src();
|
|
653
679
|
formatIssuePath2 = (path8) => path8.length > 0 ? path8.map(
|
|
654
680
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -668,40 +694,40 @@ var init_schemas = __esm({
|
|
|
668
694
|
parsed.error
|
|
669
695
|
);
|
|
670
696
|
};
|
|
671
|
-
NonNegativeIntegerSchema =
|
|
672
|
-
ScanWorkspaceOptionsSchema =
|
|
673
|
-
includeExtensions:
|
|
674
|
-
ignoreDirectories:
|
|
675
|
-
useCache:
|
|
676
|
-
cacheDir:
|
|
677
|
-
smartInvalidation:
|
|
697
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
698
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
699
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
700
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
701
|
+
useCache: import_zod.z.boolean().optional(),
|
|
702
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
703
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
678
704
|
});
|
|
679
|
-
ScanFileResultSchema =
|
|
680
|
-
file:
|
|
681
|
-
classes:
|
|
682
|
-
hash:
|
|
705
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
706
|
+
file: import_zod.z.string(),
|
|
707
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
708
|
+
hash: import_zod.z.string().optional()
|
|
683
709
|
});
|
|
684
|
-
ScanWorkspaceResultSchema =
|
|
685
|
-
files:
|
|
710
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
711
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
686
712
|
totalFiles: NonNegativeIntegerSchema,
|
|
687
|
-
uniqueClasses:
|
|
713
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
688
714
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
689
715
|
message: "scan result totalFiles must match files.length",
|
|
690
716
|
path: ["totalFiles"]
|
|
691
717
|
});
|
|
692
|
-
|
|
693
|
-
rootDir:
|
|
718
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
719
|
+
rootDir: import_zod.z.string().min(1),
|
|
694
720
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
695
721
|
});
|
|
696
|
-
ScannerWorkerSuccessMessageSchema =
|
|
697
|
-
ok:
|
|
722
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
723
|
+
ok: import_zod.z.literal(true),
|
|
698
724
|
result: ScanWorkspaceResultSchema
|
|
699
725
|
});
|
|
700
|
-
ScannerWorkerErrorMessageSchema =
|
|
701
|
-
ok:
|
|
702
|
-
error:
|
|
726
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
727
|
+
ok: import_zod.z.literal(false),
|
|
728
|
+
error: import_zod.z.string().optional()
|
|
703
729
|
});
|
|
704
|
-
ScannerWorkerMessageSchema =
|
|
730
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
705
731
|
ScannerWorkerSuccessMessageSchema,
|
|
706
732
|
ScannerWorkerErrorMessageSchema
|
|
707
733
|
]);
|
|
@@ -731,8 +757,8 @@ function getRuntimeDir() {
|
|
|
731
757
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
732
758
|
return __dirname;
|
|
733
759
|
}
|
|
734
|
-
if (typeof
|
|
735
|
-
return
|
|
760
|
+
if (typeof import_meta4 !== "undefined" && import_meta4.url) {
|
|
761
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta4.url));
|
|
736
762
|
}
|
|
737
763
|
return process.cwd();
|
|
738
764
|
}
|
|
@@ -741,18 +767,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
741
767
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
742
768
|
return __dirname;
|
|
743
769
|
}
|
|
744
|
-
if (typeof
|
|
745
|
-
return
|
|
770
|
+
if (typeof import_meta4 !== "undefined" && import_meta4.url) {
|
|
771
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta4.url));
|
|
746
772
|
}
|
|
747
773
|
return process.cwd();
|
|
748
774
|
})();
|
|
749
775
|
const candidates = [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
776
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
777
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
778
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
753
779
|
];
|
|
754
780
|
for (const candidate of candidates) {
|
|
755
|
-
if (
|
|
781
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
756
782
|
}
|
|
757
783
|
return null;
|
|
758
784
|
}
|
|
@@ -764,7 +790,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
764
790
|
}
|
|
765
791
|
return new Promise((resolve, reject) => {
|
|
766
792
|
const settleState = { settled: false };
|
|
767
|
-
const worker = new
|
|
793
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
768
794
|
const timeout = setTimeout(() => {
|
|
769
795
|
if (!settleState.settled) {
|
|
770
796
|
settleState.settled = true;
|
|
@@ -809,19 +835,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
809
835
|
if (!currentDir) continue;
|
|
810
836
|
const entries = (() => {
|
|
811
837
|
try {
|
|
812
|
-
return
|
|
838
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
813
839
|
} catch {
|
|
814
840
|
return [];
|
|
815
841
|
}
|
|
816
842
|
})();
|
|
817
843
|
for (const entry of entries) {
|
|
818
|
-
const fullPath =
|
|
844
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
819
845
|
if (entry.isDirectory()) {
|
|
820
846
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
821
847
|
continue;
|
|
822
848
|
}
|
|
823
849
|
if (!entry.isFile()) continue;
|
|
824
|
-
if (!extensionSet.has(
|
|
850
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
825
851
|
candidates.push(fullPath);
|
|
826
852
|
}
|
|
827
853
|
}
|
|
@@ -848,7 +874,7 @@ function scanSource(source) {
|
|
|
848
874
|
);
|
|
849
875
|
}
|
|
850
876
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
851
|
-
return includeExtensions.includes(
|
|
877
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
852
878
|
}
|
|
853
879
|
function scanFile(filePath) {
|
|
854
880
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -868,7 +894,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
868
894
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
869
895
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
870
896
|
const useCache = normalizedOptions.useCache ?? true;
|
|
871
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
897
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
872
898
|
const files = [];
|
|
873
899
|
const unique = /* @__PURE__ */ new Set();
|
|
874
900
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -908,7 +934,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
908
934
|
for (const filePath of candidates) {
|
|
909
935
|
const stat = (() => {
|
|
910
936
|
try {
|
|
911
|
-
return
|
|
937
|
+
return import_node_fs3.default.statSync(filePath);
|
|
912
938
|
} catch {
|
|
913
939
|
return null;
|
|
914
940
|
}
|
|
@@ -934,7 +960,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
934
960
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
935
961
|
const content = (() => {
|
|
936
962
|
try {
|
|
937
|
-
return
|
|
963
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
938
964
|
} catch {
|
|
939
965
|
return null;
|
|
940
966
|
}
|
|
@@ -1015,9 +1041,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
1015
1041
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
1016
1042
|
}
|
|
1017
1043
|
}
|
|
1018
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1044
|
+
var import_node_fs3, import_node_module2, import_node_path5, import_node_url4, import_node_worker_threads2, import_meta4, log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1019
1045
|
var init_src2 = __esm({
|
|
1020
1046
|
"packages/domain/scanner/src/index.ts"() {
|
|
1047
|
+
"use strict";
|
|
1048
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
1049
|
+
import_node_module2 = require("module");
|
|
1050
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
1051
|
+
import_node_url4 = require("url");
|
|
1052
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
1021
1053
|
init_src();
|
|
1022
1054
|
init_cache_native();
|
|
1023
1055
|
init_native_bridge();
|
|
@@ -1025,6 +1057,7 @@ var init_src2 = __esm({
|
|
|
1025
1057
|
init_schemas();
|
|
1026
1058
|
init_schemas();
|
|
1027
1059
|
init_native_bridge();
|
|
1060
|
+
import_meta4 = {};
|
|
1028
1061
|
log2 = createLogger("scanner");
|
|
1029
1062
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
1030
1063
|
createNativeParserLoader = () => {
|
|
@@ -1038,7 +1071,7 @@ var init_src2 = __esm({
|
|
|
1038
1071
|
const loadNativeParserBinding = () => {
|
|
1039
1072
|
if (_state.binding !== void 0) return _state.binding;
|
|
1040
1073
|
const runtimeDir = getRuntimeDir();
|
|
1041
|
-
const req =
|
|
1074
|
+
const req = (0, import_node_module2.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
1042
1075
|
const _platform = process.platform;
|
|
1043
1076
|
const _arch = process.arch;
|
|
1044
1077
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -1046,27 +1079,27 @@ var init_src2 = __esm({
|
|
|
1046
1079
|
const candidates = [
|
|
1047
1080
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
1048
1081
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1082
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
1083
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1084
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1052
1085
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
1053
1086
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1087
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
1088
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1089
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1057
1090
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
1058
|
-
|
|
1059
|
-
|
|
1091
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1092
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1060
1093
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
1061
|
-
|
|
1062
|
-
|
|
1094
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1095
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1063
1096
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1097
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
1098
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
1099
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "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(
|
|
1070
1103
|
runtimeDir,
|
|
1071
1104
|
"..",
|
|
1072
1105
|
"..",
|
|
@@ -1078,7 +1111,7 @@ var init_src2 = __esm({
|
|
|
1078
1111
|
)
|
|
1079
1112
|
];
|
|
1080
1113
|
for (const fullPath of candidates) {
|
|
1081
|
-
if (!
|
|
1114
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
1082
1115
|
try {
|
|
1083
1116
|
const required = req(fullPath);
|
|
1084
1117
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -1111,13 +1144,24 @@ var init_src2 = __esm({
|
|
|
1111
1144
|
}
|
|
1112
1145
|
});
|
|
1113
1146
|
|
|
1147
|
+
// src/umbrella/analyzer.ts
|
|
1148
|
+
var analyzer_exports = {};
|
|
1149
|
+
__export(analyzer_exports, {
|
|
1150
|
+
__internal: () => __internal,
|
|
1151
|
+
analyzeWorkspace: () => analyzeWorkspace,
|
|
1152
|
+
classToCss: () => classToCss
|
|
1153
|
+
});
|
|
1154
|
+
module.exports = __toCommonJS(analyzer_exports);
|
|
1155
|
+
|
|
1114
1156
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
1157
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
1115
1158
|
init_src2();
|
|
1116
1159
|
|
|
1117
1160
|
// packages/domain/analyzer/src/binding.ts
|
|
1118
1161
|
init_src();
|
|
1119
1162
|
|
|
1120
1163
|
// packages/domain/analyzer/src/utils.ts
|
|
1164
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
1121
1165
|
init_src();
|
|
1122
1166
|
var DEFAULT_TOP_LIMIT = 10;
|
|
1123
1167
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -1132,7 +1176,7 @@ function isRecord(value) {
|
|
|
1132
1176
|
}
|
|
1133
1177
|
async function pathExists(filePath) {
|
|
1134
1178
|
try {
|
|
1135
|
-
await
|
|
1179
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
1136
1180
|
return true;
|
|
1137
1181
|
} catch {
|
|
1138
1182
|
return false;
|
|
@@ -1149,8 +1193,9 @@ function sanitizeFrequentThreshold(value) {
|
|
|
1149
1193
|
}
|
|
1150
1194
|
|
|
1151
1195
|
// packages/domain/analyzer/src/binding.ts
|
|
1152
|
-
var
|
|
1153
|
-
|
|
1196
|
+
var import_meta5 = {};
|
|
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
|
+
import_meta5.url
|
|
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
|
+
import_meta5.url
|
|
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
|