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.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import 'crypto';
|
|
2
|
-
import fs3 from 'fs';
|
|
3
|
-
import path5 from 'path';
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
-
import { createRequire } from 'module';
|
|
6
|
-
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
|
|
7
|
-
import { availableParallelism } from 'os';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
|
|
10
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
11
2
|
var __defProp = Object.defineProperty;
|
|
12
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -28,6 +19,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
28
19
|
return to;
|
|
29
20
|
};
|
|
30
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
|
|
23
|
+
// packages/domain/shared/src/index.ts
|
|
24
|
+
import { createHash } from "crypto";
|
|
25
|
+
import fs from "fs";
|
|
26
|
+
import path from "path";
|
|
27
|
+
import { fileURLToPath } from "url";
|
|
28
|
+
import { createRequire } from "module";
|
|
31
29
|
function createLogger(namespace) {
|
|
32
30
|
const prefix = `[${namespace}]`;
|
|
33
31
|
return {
|
|
@@ -67,9 +65,9 @@ function loadNativeBinding(options) {
|
|
|
67
65
|
const { runtimeDir, candidates, isValid } = options;
|
|
68
66
|
const loadErrors = [];
|
|
69
67
|
for (const candidate of candidates) {
|
|
70
|
-
const candidatePath =
|
|
68
|
+
const candidatePath = path.resolve(runtimeDir, candidate);
|
|
71
69
|
try {
|
|
72
|
-
if (!
|
|
70
|
+
if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + ".node")) {
|
|
73
71
|
continue;
|
|
74
72
|
}
|
|
75
73
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -101,9 +99,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
if (!includeDefaultCandidates) return candidates;
|
|
104
|
-
if (
|
|
102
|
+
if (fs.existsSync(runtimeDir)) {
|
|
105
103
|
try {
|
|
106
|
-
for (const entry of
|
|
104
|
+
for (const entry of fs.readdirSync(runtimeDir)) {
|
|
107
105
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
108
106
|
}
|
|
109
107
|
} catch {
|
|
@@ -112,22 +110,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
112
110
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
113
111
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
114
112
|
for (const bin of BINARY_NAMES) {
|
|
115
|
-
candidates.push(
|
|
116
|
-
candidates.push(
|
|
117
|
-
candidates.push(
|
|
118
|
-
candidates.push(
|
|
119
|
-
candidates.push(
|
|
120
|
-
candidates.push(
|
|
121
|
-
candidates.push(
|
|
122
|
-
candidates.push(
|
|
123
|
-
candidates.push(
|
|
113
|
+
candidates.push(path.resolve(runtimeDir, `${bin}.node`));
|
|
114
|
+
candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
115
|
+
candidates.push(path.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
116
|
+
candidates.push(path.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
117
|
+
candidates.push(path.resolve(process.cwd(), "native", `${bin}.node`));
|
|
118
|
+
candidates.push(path.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
119
|
+
candidates.push(path.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
120
|
+
candidates.push(path.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
121
|
+
candidates.push(path.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
124
122
|
}
|
|
125
123
|
return Array.from(new Set(candidates));
|
|
126
124
|
}
|
|
127
125
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
128
|
-
if (dir) return
|
|
126
|
+
if (dir) return path.resolve(dir);
|
|
129
127
|
try {
|
|
130
|
-
return
|
|
128
|
+
return path.dirname(fileURLToPath(importMetaUrl));
|
|
131
129
|
} catch {
|
|
132
130
|
return process.cwd();
|
|
133
131
|
}
|
|
@@ -135,6 +133,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
135
133
|
var TwError, _require;
|
|
136
134
|
var init_src = __esm({
|
|
137
135
|
"packages/domain/shared/src/index.ts"() {
|
|
136
|
+
"use strict";
|
|
138
137
|
TwError = class _TwError extends Error {
|
|
139
138
|
/** @deprecated Gunakan source */
|
|
140
139
|
domain;
|
|
@@ -220,12 +219,14 @@ __export(native_bridge_exports, {
|
|
|
220
219
|
startWatchNative: () => startWatchNative,
|
|
221
220
|
stopWatchNative: () => stopWatchNative
|
|
222
221
|
});
|
|
222
|
+
import path2 from "path";
|
|
223
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
223
224
|
function getDirname() {
|
|
224
225
|
if (typeof __dirname !== "undefined") {
|
|
225
226
|
return __dirname;
|
|
226
227
|
}
|
|
227
228
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
228
|
-
return
|
|
229
|
+
return path2.dirname(fileURLToPath2(import.meta.url));
|
|
229
230
|
}
|
|
230
231
|
return process.cwd();
|
|
231
232
|
}
|
|
@@ -433,6 +434,7 @@ function hasNativeWatchBinding() {
|
|
|
433
434
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
434
435
|
var init_native_bridge = __esm({
|
|
435
436
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
437
|
+
"use strict";
|
|
436
438
|
init_src();
|
|
437
439
|
log = createDebugLogger("scanner:native");
|
|
438
440
|
isValidScannerBinding = (module) => {
|
|
@@ -513,13 +515,17 @@ var init_native_bridge = __esm({
|
|
|
513
515
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
514
516
|
}
|
|
515
517
|
});
|
|
518
|
+
|
|
519
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
520
|
+
import fs2 from "fs";
|
|
521
|
+
import path3 from "path";
|
|
516
522
|
function defaultCachePath(rootDir, cacheDir) {
|
|
517
|
-
const dir = cacheDir ?
|
|
518
|
-
return
|
|
523
|
+
const dir = cacheDir ? path3.resolve(rootDir, cacheDir) : path3.join(process.cwd(), ".cache", "tailwind-styled");
|
|
524
|
+
return path3.join(dir, "scanner-cache.json");
|
|
519
525
|
}
|
|
520
526
|
function readCache(rootDir, cacheDir) {
|
|
521
527
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
522
|
-
|
|
528
|
+
fs2.mkdirSync(path3.dirname(cachePath), { recursive: true });
|
|
523
529
|
const result = cacheReadNative(cachePath);
|
|
524
530
|
if (!result) return [];
|
|
525
531
|
return result.entries.map((e) => ({
|
|
@@ -534,7 +540,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
534
540
|
}
|
|
535
541
|
function writeCache(rootDir, entries, cacheDir) {
|
|
536
542
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
537
|
-
|
|
543
|
+
fs2.mkdirSync(path3.dirname(cachePath), { recursive: true });
|
|
538
544
|
const success = cacheWriteNative(cachePath, entries);
|
|
539
545
|
if (!success) {
|
|
540
546
|
throw new Error(
|
|
@@ -553,11 +559,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
553
559
|
nowMs
|
|
554
560
|
);
|
|
555
561
|
}
|
|
562
|
+
var STALE_THRESHOLD_MS;
|
|
556
563
|
var init_cache_native = __esm({
|
|
557
564
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
565
|
+
"use strict";
|
|
558
566
|
init_native_bridge();
|
|
567
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
559
568
|
}
|
|
560
569
|
});
|
|
570
|
+
|
|
571
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
572
|
+
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
573
|
+
import path4 from "path";
|
|
574
|
+
import { availableParallelism } from "os";
|
|
575
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
561
576
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
562
577
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
563
578
|
if (native !== null) return native;
|
|
@@ -598,7 +613,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
598
613
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
599
614
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
600
615
|
} = options;
|
|
601
|
-
const files = collectFiles(
|
|
616
|
+
const files = collectFiles(path4.resolve(rootDir), extensions, ignoreDirs);
|
|
602
617
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
603
618
|
return mergeResults(batchExtractClassesNative(files));
|
|
604
619
|
}
|
|
@@ -617,6 +632,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
617
632
|
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
618
633
|
var init_parallel_scanner = __esm({
|
|
619
634
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
635
|
+
"use strict";
|
|
620
636
|
init_src2();
|
|
621
637
|
init_native_bridge();
|
|
622
638
|
PARALLEL_THRESHOLD = 50;
|
|
@@ -635,12 +651,16 @@ var init_parallel_scanner = __esm({
|
|
|
635
651
|
parentPort.postMessage(msg);
|
|
636
652
|
}
|
|
637
653
|
}
|
|
638
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
654
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
|
|
639
655
|
}
|
|
640
656
|
});
|
|
641
|
-
|
|
657
|
+
|
|
658
|
+
// packages/domain/scanner/src/schemas.ts
|
|
659
|
+
import { z } from "zod";
|
|
660
|
+
var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
642
661
|
var init_schemas = __esm({
|
|
643
662
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
663
|
+
"use strict";
|
|
644
664
|
init_src();
|
|
645
665
|
formatIssuePath2 = (path8) => path8.length > 0 ? path8.map(
|
|
646
666
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -681,7 +701,7 @@ var init_schemas = __esm({
|
|
|
681
701
|
message: "scan result totalFiles must match files.length",
|
|
682
702
|
path: ["totalFiles"]
|
|
683
703
|
});
|
|
684
|
-
z.object({
|
|
704
|
+
ScannerWorkerRequestSchema = z.object({
|
|
685
705
|
rootDir: z.string().min(1),
|
|
686
706
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
687
707
|
});
|
|
@@ -719,12 +739,17 @@ __export(src_exports, {
|
|
|
719
739
|
scanWorkspace: () => scanWorkspace,
|
|
720
740
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
721
741
|
});
|
|
742
|
+
import fs3 from "fs";
|
|
743
|
+
import { createRequire as createRequire2 } from "module";
|
|
744
|
+
import path5 from "path";
|
|
745
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
746
|
+
import { Worker as Worker2 } from "worker_threads";
|
|
722
747
|
function getRuntimeDir() {
|
|
723
748
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
724
749
|
return __dirname;
|
|
725
750
|
}
|
|
726
751
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
727
|
-
return path5.dirname(
|
|
752
|
+
return path5.dirname(fileURLToPath4(import.meta.url));
|
|
728
753
|
}
|
|
729
754
|
return process.cwd();
|
|
730
755
|
}
|
|
@@ -734,7 +759,7 @@ function resolveScannerWorkerModulePath() {
|
|
|
734
759
|
return __dirname;
|
|
735
760
|
}
|
|
736
761
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
737
|
-
return path5.dirname(
|
|
762
|
+
return path5.dirname(fileURLToPath4(import.meta.url));
|
|
738
763
|
}
|
|
739
764
|
return process.cwd();
|
|
740
765
|
})();
|
|
@@ -756,7 +781,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
756
781
|
}
|
|
757
782
|
return new Promise((resolve, reject) => {
|
|
758
783
|
const settleState = { settled: false };
|
|
759
|
-
const worker = new
|
|
784
|
+
const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
760
785
|
const timeout = setTimeout(() => {
|
|
761
786
|
if (!settleState.settled) {
|
|
762
787
|
settleState.settled = true;
|
|
@@ -860,7 +885,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
860
885
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
861
886
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
862
887
|
const useCache = normalizedOptions.useCache ?? true;
|
|
863
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
888
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
864
889
|
const files = [];
|
|
865
890
|
const unique = /* @__PURE__ */ new Set();
|
|
866
891
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -1010,6 +1035,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
1010
1035
|
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1011
1036
|
var init_src2 = __esm({
|
|
1012
1037
|
"packages/domain/scanner/src/index.ts"() {
|
|
1038
|
+
"use strict";
|
|
1013
1039
|
init_src();
|
|
1014
1040
|
init_cache_native();
|
|
1015
1041
|
init_native_bridge();
|
|
@@ -1030,7 +1056,7 @@ var init_src2 = __esm({
|
|
|
1030
1056
|
const loadNativeParserBinding = () => {
|
|
1031
1057
|
if (_state.binding !== void 0) return _state.binding;
|
|
1032
1058
|
const runtimeDir = getRuntimeDir();
|
|
1033
|
-
const req =
|
|
1059
|
+
const req = createRequire2(path5.join(runtimeDir, "noop.cjs"));
|
|
1034
1060
|
const _platform = process.platform;
|
|
1035
1061
|
const _arch = process.arch;
|
|
1036
1062
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -1105,12 +1131,14 @@ var init_src2 = __esm({
|
|
|
1105
1131
|
|
|
1106
1132
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
1107
1133
|
init_src2();
|
|
1134
|
+
import path7 from "path";
|
|
1108
1135
|
|
|
1109
1136
|
// packages/domain/analyzer/src/binding.ts
|
|
1110
1137
|
init_src();
|
|
1111
1138
|
|
|
1112
1139
|
// packages/domain/analyzer/src/utils.ts
|
|
1113
1140
|
init_src();
|
|
1141
|
+
import fs4 from "fs";
|
|
1114
1142
|
var DEFAULT_TOP_LIMIT = 10;
|
|
1115
1143
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
1116
1144
|
var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
|
|
@@ -1124,7 +1152,7 @@ function isRecord(value) {
|
|
|
1124
1152
|
}
|
|
1125
1153
|
async function pathExists(filePath) {
|
|
1126
1154
|
try {
|
|
1127
|
-
await
|
|
1155
|
+
await fs4.promises.access(filePath, fs4.constants.F_OK);
|
|
1128
1156
|
return true;
|
|
1129
1157
|
} catch {
|
|
1130
1158
|
return false;
|
|
@@ -1228,6 +1256,7 @@ async function requireNativeCssCompiler() {
|
|
|
1228
1256
|
|
|
1229
1257
|
// packages/domain/analyzer/src/schemas.ts
|
|
1230
1258
|
init_src();
|
|
1259
|
+
import { z as z2 } from "zod";
|
|
1231
1260
|
var formatIssuePath3 = (path8) => path8.length > 0 ? path8.map(
|
|
1232
1261
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
1233
1262
|
).join(".") : "<root>";
|
|
@@ -1251,76 +1280,76 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
1251
1280
|
parsed.error
|
|
1252
1281
|
);
|
|
1253
1282
|
};
|
|
1254
|
-
var CountSchema =
|
|
1255
|
-
|
|
1256
|
-
name:
|
|
1283
|
+
var CountSchema = z2.number().int().min(0);
|
|
1284
|
+
var ClassUsageSchema = z2.object({
|
|
1285
|
+
name: z2.string(),
|
|
1257
1286
|
count: CountSchema,
|
|
1258
|
-
isUnused:
|
|
1259
|
-
isConflict:
|
|
1287
|
+
isUnused: z2.boolean().optional(),
|
|
1288
|
+
isConflict: z2.boolean().optional()
|
|
1260
1289
|
});
|
|
1261
|
-
|
|
1262
|
-
className:
|
|
1263
|
-
variants:
|
|
1264
|
-
classes:
|
|
1265
|
-
message:
|
|
1290
|
+
var ClassConflictSchema = z2.object({
|
|
1291
|
+
className: z2.string(),
|
|
1292
|
+
variants: z2.array(z2.string()),
|
|
1293
|
+
classes: z2.array(z2.string()),
|
|
1294
|
+
message: z2.string()
|
|
1266
1295
|
});
|
|
1267
|
-
var ClassCountSchema =
|
|
1268
|
-
name:
|
|
1296
|
+
var ClassCountSchema = z2.object({
|
|
1297
|
+
name: z2.string(),
|
|
1269
1298
|
count: CountSchema
|
|
1270
1299
|
});
|
|
1271
|
-
var NativeReportSchema =
|
|
1272
|
-
root:
|
|
1300
|
+
var NativeReportSchema = z2.object({
|
|
1301
|
+
root: z2.string(),
|
|
1273
1302
|
totalFiles: CountSchema,
|
|
1274
1303
|
uniqueClassCount: CountSchema,
|
|
1275
1304
|
totalClassOccurrences: CountSchema,
|
|
1276
|
-
topClasses:
|
|
1277
|
-
duplicateCandidates:
|
|
1278
|
-
safelist:
|
|
1305
|
+
topClasses: z2.array(ClassCountSchema),
|
|
1306
|
+
duplicateCandidates: z2.array(ClassCountSchema),
|
|
1307
|
+
safelist: z2.array(z2.string())
|
|
1279
1308
|
});
|
|
1280
|
-
var NativeCssCompileResultSchema =
|
|
1281
|
-
css:
|
|
1282
|
-
resolvedClasses:
|
|
1283
|
-
unknownClasses:
|
|
1309
|
+
var NativeCssCompileResultSchema = z2.object({
|
|
1310
|
+
css: z2.string(),
|
|
1311
|
+
resolvedClasses: z2.array(z2.string()),
|
|
1312
|
+
unknownClasses: z2.array(z2.string()),
|
|
1284
1313
|
sizeBytes: CountSchema
|
|
1285
1314
|
});
|
|
1286
|
-
var AnalyzerClassStatsSchema =
|
|
1287
|
-
top:
|
|
1315
|
+
var AnalyzerClassStatsSchema = z2.object({
|
|
1316
|
+
top: z2.number({
|
|
1288
1317
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
1289
1318
|
}).finite().optional(),
|
|
1290
|
-
frequentThreshold:
|
|
1319
|
+
frequentThreshold: z2.number({
|
|
1291
1320
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
1292
1321
|
}).finite().optional()
|
|
1293
1322
|
});
|
|
1294
|
-
var AnalyzerSemanticOptionsSchema =
|
|
1295
|
-
tailwindConfigPath:
|
|
1323
|
+
var AnalyzerSemanticOptionsSchema = z2.object({
|
|
1324
|
+
tailwindConfigPath: z2.string({
|
|
1296
1325
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1297
1326
|
}).min(
|
|
1298
1327
|
1,
|
|
1299
1328
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1300
1329
|
).optional()
|
|
1301
1330
|
});
|
|
1302
|
-
var AnalyzerOptionsSchema =
|
|
1303
|
-
scanner:
|
|
1331
|
+
var AnalyzerOptionsSchema = z2.object({
|
|
1332
|
+
scanner: z2.custom(
|
|
1304
1333
|
(value) => isPlainObject(value),
|
|
1305
1334
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
1306
1335
|
).optional(),
|
|
1307
1336
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
1308
|
-
semantic:
|
|
1309
|
-
|
|
1337
|
+
semantic: z2.union([
|
|
1338
|
+
z2.boolean({
|
|
1310
1339
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
1311
1340
|
}),
|
|
1312
1341
|
AnalyzerSemanticOptionsSchema
|
|
1313
1342
|
]).optional(),
|
|
1314
|
-
includeClass:
|
|
1343
|
+
includeClass: z2.custom(
|
|
1315
1344
|
(value) => typeof value === "function",
|
|
1316
1345
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
1317
1346
|
).optional()
|
|
1318
1347
|
});
|
|
1319
|
-
var ClassToCssOptionsSchema =
|
|
1320
|
-
prefix:
|
|
1348
|
+
var ClassToCssOptionsSchema = z2.object({
|
|
1349
|
+
prefix: z2.union([z2.string(), z2.null()], {
|
|
1321
1350
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
1322
1351
|
}).optional(),
|
|
1323
|
-
strict:
|
|
1352
|
+
strict: z2.boolean({
|
|
1324
1353
|
error: "classToCss options.strict must be a boolean when provided."
|
|
1325
1354
|
}).optional()
|
|
1326
1355
|
});
|
|
@@ -1332,6 +1361,11 @@ var parseNativeCssCompileResult = (result, className) => parseWithSchema2(
|
|
|
1332
1361
|
className ? `Native CSS compile result is invalid for class "${className}"` : "Native CSS compile result is invalid"
|
|
1333
1362
|
);
|
|
1334
1363
|
var parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
1364
|
+
|
|
1365
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
1366
|
+
import fs5 from "fs";
|
|
1367
|
+
import path6 from "path";
|
|
1368
|
+
import { pathToFileURL } from "url";
|
|
1335
1369
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
1336
1370
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
1337
1371
|
var splitVariantAndBase = (className) => {
|
|
@@ -1365,11 +1399,11 @@ var detectConflicts = async (usages) => {
|
|
|
1365
1399
|
};
|
|
1366
1400
|
};
|
|
1367
1401
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
1368
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
1402
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path6.extname(configPath).toLowerCase());
|
|
1369
1403
|
};
|
|
1370
1404
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
1371
1405
|
if (explicitPath) {
|
|
1372
|
-
const resolved =
|
|
1406
|
+
const resolved = path6.resolve(root, explicitPath);
|
|
1373
1407
|
if (!await pathExists(resolved)) return null;
|
|
1374
1408
|
return resolved;
|
|
1375
1409
|
}
|
|
@@ -1380,7 +1414,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
1380
1414
|
"tailwind.config.mjs"
|
|
1381
1415
|
];
|
|
1382
1416
|
for (const candidate of candidates) {
|
|
1383
|
-
const fullPath =
|
|
1417
|
+
const fullPath = path6.resolve(root, candidate);
|
|
1384
1418
|
if (await pathExists(fullPath)) return fullPath;
|
|
1385
1419
|
}
|
|
1386
1420
|
return null;
|
|
@@ -1434,7 +1468,7 @@ var collectCustomUtilities = (config) => {
|
|
|
1434
1468
|
return out;
|
|
1435
1469
|
};
|
|
1436
1470
|
var collectSafelistFromSource = async (configPath) => {
|
|
1437
|
-
const source = await
|
|
1471
|
+
const source = await fs5.promises.readFile(configPath, "utf8");
|
|
1438
1472
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
1439
1473
|
const allTokens = extractClassesNative2(source);
|
|
1440
1474
|
const hasSafelist = source.includes("safelist");
|
|
@@ -1461,7 +1495,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
1461
1495
|
customUtilities: /* @__PURE__ */ new Set()
|
|
1462
1496
|
};
|
|
1463
1497
|
}
|
|
1464
|
-
const configStat = await
|
|
1498
|
+
const configStat = await fs5.promises.stat(configPath).catch(() => null);
|
|
1465
1499
|
if (configStat) {
|
|
1466
1500
|
const cached = tailwindConfigCache.get(configPath);
|
|
1467
1501
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -1639,7 +1673,7 @@ async function buildDistribution(usages, native) {
|
|
|
1639
1673
|
}
|
|
1640
1674
|
async function analyzeWorkspace(root, options = {}) {
|
|
1641
1675
|
const startedAtMs = Date.now();
|
|
1642
|
-
const resolvedRoot =
|
|
1676
|
+
const resolvedRoot = path7.resolve(root);
|
|
1643
1677
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
1644
1678
|
const scan = await (async () => {
|
|
1645
1679
|
const scanStartedAtMs = Date.now();
|
|
@@ -1861,7 +1895,9 @@ var __internal = {
|
|
|
1861
1895
|
parseNativeReport,
|
|
1862
1896
|
parseNativeCssCompileResult
|
|
1863
1897
|
};
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1898
|
+
export {
|
|
1899
|
+
__internal,
|
|
1900
|
+
analyzeWorkspace,
|
|
1901
|
+
classToCss
|
|
1902
|
+
};
|
|
1867
1903
|
//# sourceMappingURL=analyzer.mjs.map
|