tailwind-styled-v4 5.0.10 → 5.0.11
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/README.md +245 -373
- package/dist/analyzer.js +75 -22
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +74 -21
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +4 -2
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +4 -2
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +20 -5
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +20 -5
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +174 -67
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +171 -64
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +7 -1
- package/dist/compiler.d.ts +7 -1
- package/dist/compiler.js +53 -27
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +53 -27
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +159 -61
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +159 -61
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +1512 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.d.mts +94 -12
- package/dist/index.d.ts +94 -12
- package/dist/index.js +436 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -106
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +1946 -47
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +1929 -44
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +23 -10
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +23 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs.map +1 -1
- package/dist/scanner.js +72 -19
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +71 -18
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.js +32 -15
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +32 -15
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +38 -12
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -12
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +17 -5
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +17 -5
- package/dist/syntax.mjs.map +1 -1
- package/dist/theme.js +4 -2
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +4 -2
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +87 -33
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +87 -33
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +174 -67
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +171 -64
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +145 -63
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +145 -63
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +38 -12
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -12
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +20 -5
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +20 -5
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +29 -24
package/dist/analyzer.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'crypto';
|
|
2
|
-
import
|
|
2
|
+
import fs4 from 'fs';
|
|
3
3
|
import path5 from 'path';
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
5
|
import { createRequire } from 'module';
|
|
@@ -69,7 +69,7 @@ function loadNativeBinding(options) {
|
|
|
69
69
|
for (const candidate of candidates) {
|
|
70
70
|
const candidatePath = path5.resolve(runtimeDir, candidate);
|
|
71
71
|
try {
|
|
72
|
-
if (!
|
|
72
|
+
if (!fs4.existsSync(candidatePath) && !fs4.existsSync(candidatePath + ".node")) {
|
|
73
73
|
continue;
|
|
74
74
|
}
|
|
75
75
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -101,9 +101,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
if (!includeDefaultCandidates) return candidates;
|
|
104
|
-
if (
|
|
104
|
+
if (fs4.existsSync(runtimeDir)) {
|
|
105
105
|
try {
|
|
106
|
-
for (const entry of
|
|
106
|
+
for (const entry of fs4.readdirSync(runtimeDir)) {
|
|
107
107
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
108
108
|
}
|
|
109
109
|
} catch {
|
|
@@ -114,11 +114,13 @@ function resolveNativeBindingCandidates(options) {
|
|
|
114
114
|
for (const bin of BINARY_NAMES) {
|
|
115
115
|
candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
|
|
116
116
|
candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
117
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
118
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
119
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
120
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
117
121
|
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
118
122
|
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
119
123
|
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
120
|
-
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
121
|
-
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
122
124
|
}
|
|
123
125
|
return Array.from(new Set(candidates));
|
|
124
126
|
}
|
|
@@ -201,8 +203,10 @@ __export(native_bridge_exports, {
|
|
|
201
203
|
extractClassesNative: () => extractClassesNative,
|
|
202
204
|
generateSubComponentTypesNative: () => generateSubComponentTypesNative,
|
|
203
205
|
hasNativeScannerBinding: () => hasNativeScannerBinding,
|
|
206
|
+
hasNativeWatchBinding: () => hasNativeWatchBinding,
|
|
204
207
|
hashContentNative: () => hashContentNative,
|
|
205
208
|
isRustCacheAvailable: () => isRustCacheAvailable,
|
|
209
|
+
pollWatchEventsNative: () => pollWatchEventsNative,
|
|
206
210
|
pruneStaleEntriesNative: () => pruneStaleEntriesNative,
|
|
207
211
|
rebuildWorkspaceResultNative: () => rebuildWorkspaceResultNative,
|
|
208
212
|
resetScannerBridgeCache: () => resetScannerBridgeCache,
|
|
@@ -212,7 +216,9 @@ __export(native_bridge_exports, {
|
|
|
212
216
|
scanCacheStats: () => scanCacheStats,
|
|
213
217
|
scanFileNative: () => scanFileNative,
|
|
214
218
|
scanFilesBatchNative: () => scanFilesBatchNative,
|
|
215
|
-
scanWorkspaceNative: () => scanWorkspaceNative
|
|
219
|
+
scanWorkspaceNative: () => scanWorkspaceNative,
|
|
220
|
+
startWatchNative: () => startWatchNative,
|
|
221
|
+
stopWatchNative: () => stopWatchNative
|
|
216
222
|
});
|
|
217
223
|
function getDirname() {
|
|
218
224
|
if (typeof __dirname !== "undefined") {
|
|
@@ -389,6 +395,41 @@ function computeCacheStatsNative(filesClasses, sizes, top) {
|
|
|
389
395
|
if (!binding.computeCacheStats) return null;
|
|
390
396
|
return binding.computeCacheStats(filesClasses, sizes, top ?? null);
|
|
391
397
|
}
|
|
398
|
+
function startWatchNative(rootDir) {
|
|
399
|
+
try {
|
|
400
|
+
const binding = scannerGetBinding();
|
|
401
|
+
if (!binding.startWatch) return null;
|
|
402
|
+
return binding.startWatch(rootDir);
|
|
403
|
+
} catch {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function pollWatchEventsNative(handleId) {
|
|
408
|
+
try {
|
|
409
|
+
const binding = scannerGetBinding();
|
|
410
|
+
if (!binding.pollWatchEvents) return [];
|
|
411
|
+
return binding.pollWatchEvents(handleId);
|
|
412
|
+
} catch {
|
|
413
|
+
return [];
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function stopWatchNative(handleId) {
|
|
417
|
+
try {
|
|
418
|
+
const binding = scannerGetBinding();
|
|
419
|
+
if (!binding.stopWatch) return false;
|
|
420
|
+
return binding.stopWatch(handleId);
|
|
421
|
+
} catch {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function hasNativeWatchBinding() {
|
|
426
|
+
try {
|
|
427
|
+
const binding = scannerGetBinding();
|
|
428
|
+
return !!(binding.startWatch && binding.pollWatchEvents && binding.stopWatch);
|
|
429
|
+
} catch {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
392
433
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
393
434
|
var init_native_bridge = __esm({
|
|
394
435
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
@@ -478,6 +519,7 @@ function defaultCachePath(rootDir, cacheDir) {
|
|
|
478
519
|
}
|
|
479
520
|
function readCache(rootDir, cacheDir) {
|
|
480
521
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
522
|
+
fs4.mkdirSync(path5.dirname(cachePath), { recursive: true });
|
|
481
523
|
const result = cacheReadNative(cachePath);
|
|
482
524
|
if (!result) return [];
|
|
483
525
|
return result.entries.map((e) => ({
|
|
@@ -492,6 +534,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
492
534
|
}
|
|
493
535
|
function writeCache(rootDir, entries, cacheDir) {
|
|
494
536
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
537
|
+
fs4.mkdirSync(path5.dirname(cachePath), { recursive: true });
|
|
495
538
|
const success = cacheWriteNative(cachePath, entries);
|
|
496
539
|
if (!success) {
|
|
497
540
|
throw new Error(
|
|
@@ -522,7 +565,7 @@ function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
|
522
565
|
function walk(dir) {
|
|
523
566
|
let entries;
|
|
524
567
|
try {
|
|
525
|
-
entries =
|
|
568
|
+
entries = fs4.readdirSync(dir, { withFileTypes: true });
|
|
526
569
|
} catch {
|
|
527
570
|
return;
|
|
528
571
|
}
|
|
@@ -722,7 +765,7 @@ function resolveScannerWorkerModulePath() {
|
|
|
722
765
|
path5.resolve(runtimeDir, "worker.ts")
|
|
723
766
|
];
|
|
724
767
|
for (const candidate of candidates) {
|
|
725
|
-
if (
|
|
768
|
+
if (fs4.existsSync(candidate)) return candidate;
|
|
726
769
|
}
|
|
727
770
|
return null;
|
|
728
771
|
}
|
|
@@ -779,7 +822,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
779
822
|
if (!currentDir) continue;
|
|
780
823
|
const entries = (() => {
|
|
781
824
|
try {
|
|
782
|
-
return
|
|
825
|
+
return fs4.readdirSync(currentDir, { withFileTypes: true });
|
|
783
826
|
} catch {
|
|
784
827
|
return [];
|
|
785
828
|
}
|
|
@@ -878,7 +921,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
878
921
|
for (const filePath of candidates) {
|
|
879
922
|
const stat = (() => {
|
|
880
923
|
try {
|
|
881
|
-
return
|
|
924
|
+
return fs4.statSync(filePath);
|
|
882
925
|
} catch {
|
|
883
926
|
return null;
|
|
884
927
|
}
|
|
@@ -904,7 +947,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
904
947
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
905
948
|
const content = (() => {
|
|
906
949
|
try {
|
|
907
|
-
return
|
|
950
|
+
return fs4.readFileSync(filePath, "utf8");
|
|
908
951
|
} catch {
|
|
909
952
|
return null;
|
|
910
953
|
}
|
|
@@ -1009,21 +1052,31 @@ var init_src2 = __esm({
|
|
|
1009
1052
|
if (_state.binding !== void 0) return _state.binding;
|
|
1010
1053
|
const runtimeDir = getRuntimeDir();
|
|
1011
1054
|
const req = createRequire(path5.join(runtimeDir, "noop.cjs"));
|
|
1055
|
+
const _platform = process.platform;
|
|
1056
|
+
const _arch = process.arch;
|
|
1057
|
+
const _platformArch = `${_platform}-${_arch}`;
|
|
1058
|
+
const _platformArchGnu = _platformArch === "linux-x64" ? "linux-x64-gnu" : _platformArch === "linux-arm64" ? "linux-arm64-gnu" : _platformArch;
|
|
1012
1059
|
const candidates = [
|
|
1013
1060
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
1014
1061
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
1015
1062
|
path5.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
1016
|
-
path5.resolve(process.cwd(), "native", `tailwind-styled-native.${
|
|
1017
|
-
path5.resolve(process.cwd(), "native", `tailwind-styled-native.${
|
|
1018
|
-
// runtimeDir = dist/ → naik
|
|
1063
|
+
path5.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1064
|
+
path5.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1065
|
+
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
1066
|
+
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
1067
|
+
path5.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
1068
|
+
path5.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
1069
|
+
path5.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1070
|
+
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
1019
1071
|
path5.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1020
|
-
path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${
|
|
1072
|
+
path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1021
1073
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
1022
1074
|
path5.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
1023
|
-
path5.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${
|
|
1075
|
+
path5.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
1024
1076
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
1025
1077
|
path5.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
1026
1078
|
path5.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
1079
|
+
path5.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
1027
1080
|
path5.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
1028
1081
|
path5.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
1029
1082
|
path5.resolve(
|
|
@@ -1038,7 +1091,7 @@ var init_src2 = __esm({
|
|
|
1038
1091
|
)
|
|
1039
1092
|
];
|
|
1040
1093
|
for (const fullPath of candidates) {
|
|
1041
|
-
if (!
|
|
1094
|
+
if (!fs4.existsSync(fullPath)) continue;
|
|
1042
1095
|
try {
|
|
1043
1096
|
const required = req(fullPath);
|
|
1044
1097
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -1092,7 +1145,7 @@ function isRecord(value) {
|
|
|
1092
1145
|
}
|
|
1093
1146
|
async function pathExists(filePath) {
|
|
1094
1147
|
try {
|
|
1095
|
-
await
|
|
1148
|
+
await fs4.promises.access(filePath, fs4.constants.F_OK);
|
|
1096
1149
|
return true;
|
|
1097
1150
|
} catch {
|
|
1098
1151
|
return false;
|
|
@@ -1416,7 +1469,7 @@ var collectCustomUtilities = (config) => {
|
|
|
1416
1469
|
return out;
|
|
1417
1470
|
};
|
|
1418
1471
|
var collectSafelistFromSource = async (configPath) => {
|
|
1419
|
-
const source = await
|
|
1472
|
+
const source = await fs4.promises.readFile(configPath, "utf8");
|
|
1420
1473
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
1421
1474
|
const allTokens = extractClassesNative2(source);
|
|
1422
1475
|
const hasSafelist = source.includes("safelist");
|
|
@@ -1443,7 +1496,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
1443
1496
|
customUtilities: /* @__PURE__ */ new Set()
|
|
1444
1497
|
};
|
|
1445
1498
|
}
|
|
1446
|
-
const configStat = await
|
|
1499
|
+
const configStat = await fs4.promises.stat(configPath).catch(() => null);
|
|
1447
1500
|
if (configStat) {
|
|
1448
1501
|
const cached = tailwindConfigCache.get(configPath);
|
|
1449
1502
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|