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.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;
|
|
@@ -187,7 +186,9 @@ var init_src = __esm({
|
|
|
187
186
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
|
-
_require = createRequire(
|
|
189
|
+
_require = createRequire(
|
|
190
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
|
|
191
|
+
);
|
|
191
192
|
}
|
|
192
193
|
});
|
|
193
194
|
|
|
@@ -220,12 +221,14 @@ __export(native_bridge_exports, {
|
|
|
220
221
|
startWatchNative: () => startWatchNative,
|
|
221
222
|
stopWatchNative: () => stopWatchNative
|
|
222
223
|
});
|
|
224
|
+
import path2 from "path";
|
|
225
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
223
226
|
function getDirname() {
|
|
224
227
|
if (typeof __dirname !== "undefined") {
|
|
225
228
|
return __dirname;
|
|
226
229
|
}
|
|
227
230
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
228
|
-
return
|
|
231
|
+
return path2.dirname(fileURLToPath2(import.meta.url));
|
|
229
232
|
}
|
|
230
233
|
return process.cwd();
|
|
231
234
|
}
|
|
@@ -433,6 +436,7 @@ function hasNativeWatchBinding() {
|
|
|
433
436
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
434
437
|
var init_native_bridge = __esm({
|
|
435
438
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
439
|
+
"use strict";
|
|
436
440
|
init_src();
|
|
437
441
|
log = createDebugLogger("scanner:native");
|
|
438
442
|
isValidScannerBinding = (module) => {
|
|
@@ -513,13 +517,17 @@ var init_native_bridge = __esm({
|
|
|
513
517
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
514
518
|
}
|
|
515
519
|
});
|
|
520
|
+
|
|
521
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
522
|
+
import fs2 from "fs";
|
|
523
|
+
import path3 from "path";
|
|
516
524
|
function defaultCachePath(rootDir, cacheDir) {
|
|
517
|
-
const dir = cacheDir ?
|
|
518
|
-
return
|
|
525
|
+
const dir = cacheDir ? path3.resolve(rootDir, cacheDir) : path3.join(process.cwd(), ".cache", "tailwind-styled");
|
|
526
|
+
return path3.join(dir, "scanner-cache.json");
|
|
519
527
|
}
|
|
520
528
|
function readCache(rootDir, cacheDir) {
|
|
521
529
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
522
|
-
|
|
530
|
+
fs2.mkdirSync(path3.dirname(cachePath), { recursive: true });
|
|
523
531
|
const result = cacheReadNative(cachePath);
|
|
524
532
|
if (!result) return [];
|
|
525
533
|
return result.entries.map((e) => ({
|
|
@@ -534,7 +542,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
534
542
|
}
|
|
535
543
|
function writeCache(rootDir, entries, cacheDir) {
|
|
536
544
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
537
|
-
|
|
545
|
+
fs2.mkdirSync(path3.dirname(cachePath), { recursive: true });
|
|
538
546
|
const success = cacheWriteNative(cachePath, entries);
|
|
539
547
|
if (!success) {
|
|
540
548
|
throw new Error(
|
|
@@ -553,11 +561,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
553
561
|
nowMs
|
|
554
562
|
);
|
|
555
563
|
}
|
|
564
|
+
var STALE_THRESHOLD_MS;
|
|
556
565
|
var init_cache_native = __esm({
|
|
557
566
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
567
|
+
"use strict";
|
|
558
568
|
init_native_bridge();
|
|
569
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
559
570
|
}
|
|
560
571
|
});
|
|
572
|
+
|
|
573
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
574
|
+
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
575
|
+
import path4 from "path";
|
|
576
|
+
import { availableParallelism } from "os";
|
|
577
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
561
578
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
562
579
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
563
580
|
if (native !== null) return native;
|
|
@@ -598,7 +615,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
598
615
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
599
616
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
600
617
|
} = options;
|
|
601
|
-
const files = collectFiles(
|
|
618
|
+
const files = collectFiles(path4.resolve(rootDir), extensions, ignoreDirs);
|
|
602
619
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
603
620
|
return mergeResults(batchExtractClassesNative(files));
|
|
604
621
|
}
|
|
@@ -617,6 +634,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
617
634
|
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
618
635
|
var init_parallel_scanner = __esm({
|
|
619
636
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
637
|
+
"use strict";
|
|
620
638
|
init_src2();
|
|
621
639
|
init_native_bridge();
|
|
622
640
|
PARALLEL_THRESHOLD = 50;
|
|
@@ -635,12 +653,16 @@ var init_parallel_scanner = __esm({
|
|
|
635
653
|
parentPort.postMessage(msg);
|
|
636
654
|
}
|
|
637
655
|
}
|
|
638
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
656
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
|
|
639
657
|
}
|
|
640
658
|
});
|
|
641
|
-
|
|
659
|
+
|
|
660
|
+
// packages/domain/scanner/src/schemas.ts
|
|
661
|
+
import { z } from "zod";
|
|
662
|
+
var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
642
663
|
var init_schemas = __esm({
|
|
643
664
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
665
|
+
"use strict";
|
|
644
666
|
init_src();
|
|
645
667
|
formatIssuePath2 = (path8) => path8.length > 0 ? path8.map(
|
|
646
668
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -681,7 +703,7 @@ var init_schemas = __esm({
|
|
|
681
703
|
message: "scan result totalFiles must match files.length",
|
|
682
704
|
path: ["totalFiles"]
|
|
683
705
|
});
|
|
684
|
-
z.object({
|
|
706
|
+
ScannerWorkerRequestSchema = z.object({
|
|
685
707
|
rootDir: z.string().min(1),
|
|
686
708
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
687
709
|
});
|
|
@@ -719,12 +741,17 @@ __export(src_exports, {
|
|
|
719
741
|
scanWorkspace: () => scanWorkspace,
|
|
720
742
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
721
743
|
});
|
|
744
|
+
import fs3 from "fs";
|
|
745
|
+
import { createRequire as createRequire2 } from "module";
|
|
746
|
+
import path5 from "path";
|
|
747
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
748
|
+
import { Worker as Worker2 } from "worker_threads";
|
|
722
749
|
function getRuntimeDir() {
|
|
723
750
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
724
751
|
return __dirname;
|
|
725
752
|
}
|
|
726
753
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
727
|
-
return path5.dirname(
|
|
754
|
+
return path5.dirname(fileURLToPath4(import.meta.url));
|
|
728
755
|
}
|
|
729
756
|
return process.cwd();
|
|
730
757
|
}
|
|
@@ -734,7 +761,7 @@ function resolveScannerWorkerModulePath() {
|
|
|
734
761
|
return __dirname;
|
|
735
762
|
}
|
|
736
763
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
737
|
-
return path5.dirname(
|
|
764
|
+
return path5.dirname(fileURLToPath4(import.meta.url));
|
|
738
765
|
}
|
|
739
766
|
return process.cwd();
|
|
740
767
|
})();
|
|
@@ -756,7 +783,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
756
783
|
}
|
|
757
784
|
return new Promise((resolve, reject) => {
|
|
758
785
|
const settleState = { settled: false };
|
|
759
|
-
const worker = new
|
|
786
|
+
const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
760
787
|
const timeout = setTimeout(() => {
|
|
761
788
|
if (!settleState.settled) {
|
|
762
789
|
settleState.settled = true;
|
|
@@ -860,7 +887,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
860
887
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
861
888
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
862
889
|
const useCache = normalizedOptions.useCache ?? true;
|
|
863
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
890
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
864
891
|
const files = [];
|
|
865
892
|
const unique = /* @__PURE__ */ new Set();
|
|
866
893
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -1010,6 +1037,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
1010
1037
|
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
1011
1038
|
var init_src2 = __esm({
|
|
1012
1039
|
"packages/domain/scanner/src/index.ts"() {
|
|
1040
|
+
"use strict";
|
|
1013
1041
|
init_src();
|
|
1014
1042
|
init_cache_native();
|
|
1015
1043
|
init_native_bridge();
|
|
@@ -1030,7 +1058,7 @@ var init_src2 = __esm({
|
|
|
1030
1058
|
const loadNativeParserBinding = () => {
|
|
1031
1059
|
if (_state.binding !== void 0) return _state.binding;
|
|
1032
1060
|
const runtimeDir = getRuntimeDir();
|
|
1033
|
-
const req =
|
|
1061
|
+
const req = createRequire2(path5.join(runtimeDir, "noop.cjs"));
|
|
1034
1062
|
const _platform = process.platform;
|
|
1035
1063
|
const _arch = process.arch;
|
|
1036
1064
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -1105,12 +1133,14 @@ var init_src2 = __esm({
|
|
|
1105
1133
|
|
|
1106
1134
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
1107
1135
|
init_src2();
|
|
1136
|
+
import path7 from "path";
|
|
1108
1137
|
|
|
1109
1138
|
// packages/domain/analyzer/src/binding.ts
|
|
1110
1139
|
init_src();
|
|
1111
1140
|
|
|
1112
1141
|
// packages/domain/analyzer/src/utils.ts
|
|
1113
1142
|
init_src();
|
|
1143
|
+
import fs4 from "fs";
|
|
1114
1144
|
var DEFAULT_TOP_LIMIT = 10;
|
|
1115
1145
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
1116
1146
|
var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
|
|
@@ -1124,7 +1154,7 @@ function isRecord(value) {
|
|
|
1124
1154
|
}
|
|
1125
1155
|
async function pathExists(filePath) {
|
|
1126
1156
|
try {
|
|
1127
|
-
await
|
|
1157
|
+
await fs4.promises.access(filePath, fs4.constants.F_OK);
|
|
1128
1158
|
return true;
|
|
1129
1159
|
} catch {
|
|
1130
1160
|
return false;
|
|
@@ -1228,6 +1258,7 @@ async function requireNativeCssCompiler() {
|
|
|
1228
1258
|
|
|
1229
1259
|
// packages/domain/analyzer/src/schemas.ts
|
|
1230
1260
|
init_src();
|
|
1261
|
+
import { z as z2 } from "zod";
|
|
1231
1262
|
var formatIssuePath3 = (path8) => path8.length > 0 ? path8.map(
|
|
1232
1263
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
1233
1264
|
).join(".") : "<root>";
|
|
@@ -1251,76 +1282,76 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
1251
1282
|
parsed.error
|
|
1252
1283
|
);
|
|
1253
1284
|
};
|
|
1254
|
-
var CountSchema =
|
|
1255
|
-
|
|
1256
|
-
name:
|
|
1285
|
+
var CountSchema = z2.number().int().min(0);
|
|
1286
|
+
var ClassUsageSchema = z2.object({
|
|
1287
|
+
name: z2.string(),
|
|
1257
1288
|
count: CountSchema,
|
|
1258
|
-
isUnused:
|
|
1259
|
-
isConflict:
|
|
1289
|
+
isUnused: z2.boolean().optional(),
|
|
1290
|
+
isConflict: z2.boolean().optional()
|
|
1260
1291
|
});
|
|
1261
|
-
|
|
1262
|
-
className:
|
|
1263
|
-
variants:
|
|
1264
|
-
classes:
|
|
1265
|
-
message:
|
|
1292
|
+
var ClassConflictSchema = z2.object({
|
|
1293
|
+
className: z2.string(),
|
|
1294
|
+
variants: z2.array(z2.string()),
|
|
1295
|
+
classes: z2.array(z2.string()),
|
|
1296
|
+
message: z2.string()
|
|
1266
1297
|
});
|
|
1267
|
-
var ClassCountSchema =
|
|
1268
|
-
name:
|
|
1298
|
+
var ClassCountSchema = z2.object({
|
|
1299
|
+
name: z2.string(),
|
|
1269
1300
|
count: CountSchema
|
|
1270
1301
|
});
|
|
1271
|
-
var NativeReportSchema =
|
|
1272
|
-
root:
|
|
1302
|
+
var NativeReportSchema = z2.object({
|
|
1303
|
+
root: z2.string(),
|
|
1273
1304
|
totalFiles: CountSchema,
|
|
1274
1305
|
uniqueClassCount: CountSchema,
|
|
1275
1306
|
totalClassOccurrences: CountSchema,
|
|
1276
|
-
topClasses:
|
|
1277
|
-
duplicateCandidates:
|
|
1278
|
-
safelist:
|
|
1307
|
+
topClasses: z2.array(ClassCountSchema),
|
|
1308
|
+
duplicateCandidates: z2.array(ClassCountSchema),
|
|
1309
|
+
safelist: z2.array(z2.string())
|
|
1279
1310
|
});
|
|
1280
|
-
var NativeCssCompileResultSchema =
|
|
1281
|
-
css:
|
|
1282
|
-
resolvedClasses:
|
|
1283
|
-
unknownClasses:
|
|
1311
|
+
var NativeCssCompileResultSchema = z2.object({
|
|
1312
|
+
css: z2.string(),
|
|
1313
|
+
resolvedClasses: z2.array(z2.string()),
|
|
1314
|
+
unknownClasses: z2.array(z2.string()),
|
|
1284
1315
|
sizeBytes: CountSchema
|
|
1285
1316
|
});
|
|
1286
|
-
var AnalyzerClassStatsSchema =
|
|
1287
|
-
top:
|
|
1317
|
+
var AnalyzerClassStatsSchema = z2.object({
|
|
1318
|
+
top: z2.number({
|
|
1288
1319
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
1289
1320
|
}).finite().optional(),
|
|
1290
|
-
frequentThreshold:
|
|
1321
|
+
frequentThreshold: z2.number({
|
|
1291
1322
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
1292
1323
|
}).finite().optional()
|
|
1293
1324
|
});
|
|
1294
|
-
var AnalyzerSemanticOptionsSchema =
|
|
1295
|
-
tailwindConfigPath:
|
|
1325
|
+
var AnalyzerSemanticOptionsSchema = z2.object({
|
|
1326
|
+
tailwindConfigPath: z2.string({
|
|
1296
1327
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1297
1328
|
}).min(
|
|
1298
1329
|
1,
|
|
1299
1330
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
1300
1331
|
).optional()
|
|
1301
1332
|
});
|
|
1302
|
-
var AnalyzerOptionsSchema =
|
|
1303
|
-
scanner:
|
|
1333
|
+
var AnalyzerOptionsSchema = z2.object({
|
|
1334
|
+
scanner: z2.custom(
|
|
1304
1335
|
(value) => isPlainObject(value),
|
|
1305
1336
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
1306
1337
|
).optional(),
|
|
1307
1338
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
1308
|
-
semantic:
|
|
1309
|
-
|
|
1339
|
+
semantic: z2.union([
|
|
1340
|
+
z2.boolean({
|
|
1310
1341
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
1311
1342
|
}),
|
|
1312
1343
|
AnalyzerSemanticOptionsSchema
|
|
1313
1344
|
]).optional(),
|
|
1314
|
-
includeClass:
|
|
1345
|
+
includeClass: z2.custom(
|
|
1315
1346
|
(value) => typeof value === "function",
|
|
1316
1347
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
1317
1348
|
).optional()
|
|
1318
1349
|
});
|
|
1319
|
-
var ClassToCssOptionsSchema =
|
|
1320
|
-
prefix:
|
|
1350
|
+
var ClassToCssOptionsSchema = z2.object({
|
|
1351
|
+
prefix: z2.union([z2.string(), z2.null()], {
|
|
1321
1352
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
1322
1353
|
}).optional(),
|
|
1323
|
-
strict:
|
|
1354
|
+
strict: z2.boolean({
|
|
1324
1355
|
error: "classToCss options.strict must be a boolean when provided."
|
|
1325
1356
|
}).optional()
|
|
1326
1357
|
});
|
|
@@ -1332,6 +1363,11 @@ var parseNativeCssCompileResult = (result, className) => parseWithSchema2(
|
|
|
1332
1363
|
className ? `Native CSS compile result is invalid for class "${className}"` : "Native CSS compile result is invalid"
|
|
1333
1364
|
);
|
|
1334
1365
|
var parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
1366
|
+
|
|
1367
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
1368
|
+
import fs5 from "fs";
|
|
1369
|
+
import path6 from "path";
|
|
1370
|
+
import { pathToFileURL } from "url";
|
|
1335
1371
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
1336
1372
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
1337
1373
|
var splitVariantAndBase = (className) => {
|
|
@@ -1365,11 +1401,11 @@ var detectConflicts = async (usages) => {
|
|
|
1365
1401
|
};
|
|
1366
1402
|
};
|
|
1367
1403
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
1368
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
1404
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path6.extname(configPath).toLowerCase());
|
|
1369
1405
|
};
|
|
1370
1406
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
1371
1407
|
if (explicitPath) {
|
|
1372
|
-
const resolved =
|
|
1408
|
+
const resolved = path6.resolve(root, explicitPath);
|
|
1373
1409
|
if (!await pathExists(resolved)) return null;
|
|
1374
1410
|
return resolved;
|
|
1375
1411
|
}
|
|
@@ -1380,7 +1416,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
1380
1416
|
"tailwind.config.mjs"
|
|
1381
1417
|
];
|
|
1382
1418
|
for (const candidate of candidates) {
|
|
1383
|
-
const fullPath =
|
|
1419
|
+
const fullPath = path6.resolve(root, candidate);
|
|
1384
1420
|
if (await pathExists(fullPath)) return fullPath;
|
|
1385
1421
|
}
|
|
1386
1422
|
return null;
|
|
@@ -1434,7 +1470,7 @@ var collectCustomUtilities = (config) => {
|
|
|
1434
1470
|
return out;
|
|
1435
1471
|
};
|
|
1436
1472
|
var collectSafelistFromSource = async (configPath) => {
|
|
1437
|
-
const source = await
|
|
1473
|
+
const source = await fs5.promises.readFile(configPath, "utf8");
|
|
1438
1474
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
1439
1475
|
const allTokens = extractClassesNative2(source);
|
|
1440
1476
|
const hasSafelist = source.includes("safelist");
|
|
@@ -1461,7 +1497,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
1461
1497
|
customUtilities: /* @__PURE__ */ new Set()
|
|
1462
1498
|
};
|
|
1463
1499
|
}
|
|
1464
|
-
const configStat = await
|
|
1500
|
+
const configStat = await fs5.promises.stat(configPath).catch(() => null);
|
|
1465
1501
|
if (configStat) {
|
|
1466
1502
|
const cached = tailwindConfigCache.get(configPath);
|
|
1467
1503
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -1639,7 +1675,7 @@ async function buildDistribution(usages, native) {
|
|
|
1639
1675
|
}
|
|
1640
1676
|
async function analyzeWorkspace(root, options = {}) {
|
|
1641
1677
|
const startedAtMs = Date.now();
|
|
1642
|
-
const resolvedRoot =
|
|
1678
|
+
const resolvedRoot = path7.resolve(root);
|
|
1643
1679
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
1644
1680
|
const scan = await (async () => {
|
|
1645
1681
|
const scanStartedAtMs = Date.now();
|
|
@@ -1861,7 +1897,9 @@ var __internal = {
|
|
|
1861
1897
|
parseNativeReport,
|
|
1862
1898
|
parseNativeCssCompileResult
|
|
1863
1899
|
};
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1900
|
+
export {
|
|
1901
|
+
__internal,
|
|
1902
|
+
analyzeWorkspace,
|
|
1903
|
+
classToCss
|
|
1904
|
+
};
|
|
1867
1905
|
//# sourceMappingURL=analyzer.mjs.map
|