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/engine.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
var module$1 = require('module');
|
|
5
|
-
var
|
|
5
|
+
var fs5 = require('fs');
|
|
6
6
|
var path6 = require('path');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
8
|
var url = require('url');
|
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
return Object.freeze(n);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var fs5__namespace = /*#__PURE__*/_interopNamespace(fs5);
|
|
33
33
|
var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
|
|
34
34
|
|
|
35
35
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
@@ -876,7 +876,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
876
876
|
}
|
|
877
877
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
878
878
|
if (envPath) {
|
|
879
|
-
if (
|
|
879
|
+
if (fs5__namespace.existsSync(envPath)) {
|
|
880
880
|
return { path: envPath, source: "env", platform, tried };
|
|
881
881
|
}
|
|
882
882
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -885,7 +885,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
885
885
|
for (const pkg of prebuiltPkgs) {
|
|
886
886
|
try {
|
|
887
887
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
888
|
-
if (
|
|
888
|
+
if (fs5__namespace.existsSync(candidate)) {
|
|
889
889
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
890
890
|
}
|
|
891
891
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -893,9 +893,24 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
893
893
|
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
897
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
898
|
+
if (runtimeDir) {
|
|
899
|
+
for (const depth of ["..", path6__namespace.join("..", ".."), path6__namespace.join("..", "..", "..")]) {
|
|
900
|
+
const pkgRoot = path6__namespace.resolve(runtimeDir, depth);
|
|
901
|
+
for (const bin of BINARY_NAMES_SELF) {
|
|
902
|
+
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
903
|
+
const candidate = path6__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
904
|
+
tried.push(`self-bundled:${candidate}`);
|
|
905
|
+
if (fs5__namespace.existsSync(candidate)) {
|
|
906
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
896
912
|
const cwd = process.cwd();
|
|
897
913
|
const base = runtimeDir ?? cwd;
|
|
898
|
-
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
899
914
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
900
915
|
const localCandidates = [];
|
|
901
916
|
for (const bin of BINARY_NAMES) {
|
|
@@ -921,7 +936,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
921
936
|
}
|
|
922
937
|
for (const candidate of localCandidates) {
|
|
923
938
|
tried.push(`local:${candidate}`);
|
|
924
|
-
if (
|
|
939
|
+
if (fs5__namespace.existsSync(candidate)) {
|
|
925
940
|
return { path: candidate, source: "local", platform, tried };
|
|
926
941
|
}
|
|
927
942
|
}
|
|
@@ -947,12 +962,12 @@ var init_native_resolution = __esm({
|
|
|
947
962
|
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
948
963
|
_require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
|
|
949
964
|
PLATFORM_MAP = {
|
|
950
|
-
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
951
|
-
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
965
|
+
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
966
|
+
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
952
967
|
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
953
968
|
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
954
|
-
"win32-x64": ["@tailwind-styled/native-win32-x64"],
|
|
955
|
-
"win32-arm64": ["@tailwind-styled/native-win32-arm64"]
|
|
969
|
+
"win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
|
|
970
|
+
"win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
|
|
956
971
|
};
|
|
957
972
|
}
|
|
958
973
|
});
|
|
@@ -1109,7 +1124,7 @@ function loadNativeBinding(options) {
|
|
|
1109
1124
|
for (const candidate of candidates) {
|
|
1110
1125
|
const candidatePath = path6__namespace.default.resolve(runtimeDir, candidate);
|
|
1111
1126
|
try {
|
|
1112
|
-
if (!
|
|
1127
|
+
if (!fs5__namespace.default.existsSync(candidatePath) && !fs5__namespace.default.existsSync(candidatePath + ".node")) {
|
|
1113
1128
|
continue;
|
|
1114
1129
|
}
|
|
1115
1130
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -1141,9 +1156,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
1141
1156
|
}
|
|
1142
1157
|
}
|
|
1143
1158
|
if (!includeDefaultCandidates) return candidates;
|
|
1144
|
-
if (
|
|
1159
|
+
if (fs5__namespace.default.existsSync(runtimeDir)) {
|
|
1145
1160
|
try {
|
|
1146
|
-
for (const entry of
|
|
1161
|
+
for (const entry of fs5__namespace.default.readdirSync(runtimeDir)) {
|
|
1147
1162
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
1148
1163
|
}
|
|
1149
1164
|
} catch {
|
|
@@ -1154,11 +1169,13 @@ function resolveNativeBindingCandidates(options) {
|
|
|
1154
1169
|
for (const bin of BINARY_NAMES) {
|
|
1155
1170
|
candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.node`));
|
|
1156
1171
|
candidates.push(path6__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
1172
|
+
candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
1173
|
+
candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
1174
|
+
candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
1175
|
+
candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
1157
1176
|
candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
1158
1177
|
candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
1159
1178
|
candidates.push(path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
1160
|
-
candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
1161
|
-
candidates.push(path6__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
1162
1179
|
}
|
|
1163
1180
|
return Array.from(new Set(candidates));
|
|
1164
1181
|
}
|
|
@@ -1302,8 +1319,10 @@ __export(native_bridge_exports, {
|
|
|
1302
1319
|
extractClassesNative: () => extractClassesNative,
|
|
1303
1320
|
generateSubComponentTypesNative: () => generateSubComponentTypesNative,
|
|
1304
1321
|
hasNativeScannerBinding: () => hasNativeScannerBinding,
|
|
1322
|
+
hasNativeWatchBinding: () => hasNativeWatchBinding,
|
|
1305
1323
|
hashContentNative: () => hashContentNative,
|
|
1306
1324
|
isRustCacheAvailable: () => isRustCacheAvailable,
|
|
1325
|
+
pollWatchEventsNative: () => pollWatchEventsNative,
|
|
1307
1326
|
pruneStaleEntriesNative: () => pruneStaleEntriesNative,
|
|
1308
1327
|
rebuildWorkspaceResultNative: () => rebuildWorkspaceResultNative,
|
|
1309
1328
|
resetScannerBridgeCache: () => resetScannerBridgeCache,
|
|
@@ -1313,7 +1332,9 @@ __export(native_bridge_exports, {
|
|
|
1313
1332
|
scanCacheStats: () => scanCacheStats,
|
|
1314
1333
|
scanFileNative: () => scanFileNative,
|
|
1315
1334
|
scanFilesBatchNative: () => scanFilesBatchNative,
|
|
1316
|
-
scanWorkspaceNative: () => scanWorkspaceNative
|
|
1335
|
+
scanWorkspaceNative: () => scanWorkspaceNative,
|
|
1336
|
+
startWatchNative: () => startWatchNative,
|
|
1337
|
+
stopWatchNative: () => stopWatchNative
|
|
1317
1338
|
});
|
|
1318
1339
|
function getDirname2() {
|
|
1319
1340
|
if (typeof __dirname !== "undefined") {
|
|
@@ -1490,6 +1511,41 @@ function computeCacheStatsNative(filesClasses, sizes, top) {
|
|
|
1490
1511
|
if (!binding.computeCacheStats) return null;
|
|
1491
1512
|
return binding.computeCacheStats(filesClasses, sizes, top ?? null);
|
|
1492
1513
|
}
|
|
1514
|
+
function startWatchNative(rootDir) {
|
|
1515
|
+
try {
|
|
1516
|
+
const binding = scannerGetBinding();
|
|
1517
|
+
if (!binding.startWatch) return null;
|
|
1518
|
+
return binding.startWatch(rootDir);
|
|
1519
|
+
} catch {
|
|
1520
|
+
return null;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
function pollWatchEventsNative(handleId) {
|
|
1524
|
+
try {
|
|
1525
|
+
const binding = scannerGetBinding();
|
|
1526
|
+
if (!binding.pollWatchEvents) return [];
|
|
1527
|
+
return binding.pollWatchEvents(handleId);
|
|
1528
|
+
} catch {
|
|
1529
|
+
return [];
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
function stopWatchNative(handleId) {
|
|
1533
|
+
try {
|
|
1534
|
+
const binding = scannerGetBinding();
|
|
1535
|
+
if (!binding.stopWatch) return false;
|
|
1536
|
+
return binding.stopWatch(handleId);
|
|
1537
|
+
} catch {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function hasNativeWatchBinding() {
|
|
1542
|
+
try {
|
|
1543
|
+
const binding = scannerGetBinding();
|
|
1544
|
+
return !!(binding.startWatch && binding.pollWatchEvents && binding.stopWatch);
|
|
1545
|
+
} catch {
|
|
1546
|
+
return false;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1493
1549
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
1494
1550
|
var init_native_bridge = __esm({
|
|
1495
1551
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
@@ -1579,6 +1635,7 @@ function defaultCachePath(rootDir, cacheDir) {
|
|
|
1579
1635
|
}
|
|
1580
1636
|
function readCache(rootDir, cacheDir) {
|
|
1581
1637
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
1638
|
+
fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
|
|
1582
1639
|
const result = cacheReadNative(cachePath);
|
|
1583
1640
|
if (!result) return [];
|
|
1584
1641
|
return result.entries.map((e) => ({
|
|
@@ -1593,6 +1650,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
1593
1650
|
}
|
|
1594
1651
|
function writeCache(rootDir, entries, cacheDir) {
|
|
1595
1652
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
1653
|
+
fs5__namespace.default.mkdirSync(path6__namespace.default.dirname(cachePath), { recursive: true });
|
|
1596
1654
|
const success = cacheWriteNative(cachePath, entries);
|
|
1597
1655
|
if (!success) {
|
|
1598
1656
|
throw new Error(
|
|
@@ -1623,7 +1681,7 @@ function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
|
1623
1681
|
function walk(dir) {
|
|
1624
1682
|
let entries;
|
|
1625
1683
|
try {
|
|
1626
|
-
entries =
|
|
1684
|
+
entries = fs5__namespace.default.readdirSync(dir, { withFileTypes: true });
|
|
1627
1685
|
} catch {
|
|
1628
1686
|
return;
|
|
1629
1687
|
}
|
|
@@ -1823,7 +1881,7 @@ function resolveScannerWorkerModulePath() {
|
|
|
1823
1881
|
path6__namespace.default.resolve(runtimeDir, "worker.ts")
|
|
1824
1882
|
];
|
|
1825
1883
|
for (const candidate of candidates) {
|
|
1826
|
-
if (
|
|
1884
|
+
if (fs5__namespace.default.existsSync(candidate)) return candidate;
|
|
1827
1885
|
}
|
|
1828
1886
|
return null;
|
|
1829
1887
|
}
|
|
@@ -1880,7 +1938,7 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
1880
1938
|
if (!currentDir) continue;
|
|
1881
1939
|
const entries = (() => {
|
|
1882
1940
|
try {
|
|
1883
|
-
return
|
|
1941
|
+
return fs5__namespace.default.readdirSync(currentDir, { withFileTypes: true });
|
|
1884
1942
|
} catch {
|
|
1885
1943
|
return [];
|
|
1886
1944
|
}
|
|
@@ -1979,7 +2037,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
1979
2037
|
for (const filePath of candidates) {
|
|
1980
2038
|
const stat = (() => {
|
|
1981
2039
|
try {
|
|
1982
|
-
return
|
|
2040
|
+
return fs5__namespace.default.statSync(filePath);
|
|
1983
2041
|
} catch {
|
|
1984
2042
|
return null;
|
|
1985
2043
|
}
|
|
@@ -2005,7 +2063,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
2005
2063
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
2006
2064
|
const content = (() => {
|
|
2007
2065
|
try {
|
|
2008
|
-
return
|
|
2066
|
+
return fs5__namespace.default.readFileSync(filePath, "utf8");
|
|
2009
2067
|
} catch {
|
|
2010
2068
|
return null;
|
|
2011
2069
|
}
|
|
@@ -2110,21 +2168,31 @@ var init_src2 = __esm({
|
|
|
2110
2168
|
if (_state.binding !== void 0) return _state.binding;
|
|
2111
2169
|
const runtimeDir = getRuntimeDir();
|
|
2112
2170
|
const req = module$1.createRequire(path6__namespace.default.join(runtimeDir, "noop.cjs"));
|
|
2171
|
+
const _platform = process.platform;
|
|
2172
|
+
const _arch = process.arch;
|
|
2173
|
+
const _platformArch = `${_platform}-${_arch}`;
|
|
2174
|
+
const _platformArchGnu = _platformArch === "linux-x64" ? "linux-x64-gnu" : _platformArch === "linux-arm64" ? "linux-arm64-gnu" : _platformArch;
|
|
2113
2175
|
const candidates = [
|
|
2114
2176
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
2115
2177
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
2116
2178
|
path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
2117
|
-
path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${
|
|
2118
|
-
path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${
|
|
2119
|
-
// runtimeDir = dist/ → naik
|
|
2179
|
+
path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
2180
|
+
path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
2181
|
+
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
2182
|
+
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
2183
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
2184
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
2185
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
2186
|
+
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
2120
2187
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
2121
|
-
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${
|
|
2188
|
+
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
2122
2189
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
2123
2190
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
2124
|
-
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${
|
|
2191
|
+
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
2125
2192
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
2126
2193
|
path6__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
2127
2194
|
path6__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
2195
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
2128
2196
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
2129
2197
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
2130
2198
|
path6__namespace.default.resolve(
|
|
@@ -2139,7 +2207,7 @@ var init_src2 = __esm({
|
|
|
2139
2207
|
)
|
|
2140
2208
|
];
|
|
2141
2209
|
for (const fullPath of candidates) {
|
|
2142
|
-
if (!
|
|
2210
|
+
if (!fs5__namespace.default.existsSync(fullPath)) continue;
|
|
2143
2211
|
try {
|
|
2144
2212
|
const required = req(fullPath);
|
|
2145
2213
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -2258,10 +2326,34 @@ function loadTailwindEngine() {
|
|
|
2258
2326
|
throw _twEngineError;
|
|
2259
2327
|
}
|
|
2260
2328
|
}
|
|
2261
|
-
function generateRawCss(classes) {
|
|
2329
|
+
async function generateRawCss(classes, cssEntryContent, root) {
|
|
2262
2330
|
if (classes.length === 0) return "";
|
|
2263
2331
|
const tw = loadTailwindEngine();
|
|
2264
|
-
const
|
|
2332
|
+
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
2333
|
+
const { readFileSync, existsSync: existsSync3 } = await import('fs');
|
|
2334
|
+
const { dirname, resolve: resolve2 } = await import('path');
|
|
2335
|
+
const projectRoot = root ?? process.cwd();
|
|
2336
|
+
const req = module$1.createRequire(resolve2(projectRoot, "package.json"));
|
|
2337
|
+
const loadStylesheet = async (id, base) => {
|
|
2338
|
+
try {
|
|
2339
|
+
const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
|
|
2340
|
+
const pkgPath = req.resolve(cssId);
|
|
2341
|
+
return {
|
|
2342
|
+
content: readFileSync(pkgPath, "utf-8"),
|
|
2343
|
+
base: dirname(pkgPath)
|
|
2344
|
+
};
|
|
2345
|
+
} catch {
|
|
2346
|
+
try {
|
|
2347
|
+
const absPath = resolve2(base, id);
|
|
2348
|
+
if (existsSync3(absPath)) {
|
|
2349
|
+
return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
|
|
2350
|
+
}
|
|
2351
|
+
} catch {
|
|
2352
|
+
}
|
|
2353
|
+
return { content: "", base };
|
|
2354
|
+
}
|
|
2355
|
+
};
|
|
2356
|
+
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
2265
2357
|
return compiler.build(classes);
|
|
2266
2358
|
}
|
|
2267
2359
|
function postProcessWithLightning(rawCss) {
|
|
@@ -2273,14 +2365,14 @@ function postProcessWithLightning(rawCss) {
|
|
|
2273
2365
|
const result = native.processTailwindCssLightning(rawCss);
|
|
2274
2366
|
return result?.css ?? rawCss;
|
|
2275
2367
|
}
|
|
2276
|
-
async function runCssPipeline(classes) {
|
|
2368
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
2277
2369
|
const unique = [...new Set(classes.filter(Boolean))];
|
|
2278
2370
|
if (unique.length === 0) {
|
|
2279
2371
|
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
2280
2372
|
}
|
|
2281
|
-
const rawCss = generateRawCss(unique);
|
|
2373
|
+
const rawCss = await generateRawCss(unique, cssEntryContent, root);
|
|
2282
2374
|
const native = getNativeBridge();
|
|
2283
|
-
const hasLightning = typeof native.processTailwindCssLightning === "function";
|
|
2375
|
+
const hasLightning = minify && typeof native.processTailwindCssLightning === "function";
|
|
2284
2376
|
const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
|
|
2285
2377
|
return {
|
|
2286
2378
|
css: finalCss,
|
|
@@ -2289,21 +2381,8 @@ async function runCssPipeline(classes) {
|
|
|
2289
2381
|
optimized: hasLightning
|
|
2290
2382
|
};
|
|
2291
2383
|
}
|
|
2292
|
-
function runCssPipelineSync(
|
|
2293
|
-
|
|
2294
|
-
if (unique.length === 0) {
|
|
2295
|
-
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
2296
|
-
}
|
|
2297
|
-
const rawCss = generateRawCss(unique);
|
|
2298
|
-
const native = getNativeBridge();
|
|
2299
|
-
const hasLightning = typeof native.processTailwindCssLightning === "function";
|
|
2300
|
-
const finalCss = hasLightning ? postProcessWithLightning(rawCss) : rawCss;
|
|
2301
|
-
return {
|
|
2302
|
-
css: finalCss,
|
|
2303
|
-
classes: unique,
|
|
2304
|
-
sizeBytes: finalCss.length,
|
|
2305
|
-
optimized: hasLightning
|
|
2306
|
-
};
|
|
2384
|
+
function runCssPipelineSync(_classes) {
|
|
2385
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
2307
2386
|
}
|
|
2308
2387
|
function processTailwindCssWithTargets(css, targets) {
|
|
2309
2388
|
const native = getNativeBridge();
|
|
@@ -2979,7 +3058,7 @@ function isRecord(value) {
|
|
|
2979
3058
|
}
|
|
2980
3059
|
async function pathExists(filePath) {
|
|
2981
3060
|
try {
|
|
2982
|
-
await
|
|
3061
|
+
await fs5__namespace.default.promises.access(filePath, fs5__namespace.default.constants.F_OK);
|
|
2983
3062
|
return true;
|
|
2984
3063
|
} catch {
|
|
2985
3064
|
return false;
|
|
@@ -3264,7 +3343,7 @@ var collectCustomUtilities = (config) => {
|
|
|
3264
3343
|
return out;
|
|
3265
3344
|
};
|
|
3266
3345
|
var collectSafelistFromSource = async (configPath) => {
|
|
3267
|
-
const source = await
|
|
3346
|
+
const source = await fs5__namespace.default.promises.readFile(configPath, "utf8");
|
|
3268
3347
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
3269
3348
|
const allTokens = extractClassesNative2(source);
|
|
3270
3349
|
const hasSafelist = source.includes("safelist");
|
|
@@ -3291,7 +3370,7 @@ var loadTailwindConfig = async (root, semanticOption) => {
|
|
|
3291
3370
|
customUtilities: /* @__PURE__ */ new Set()
|
|
3292
3371
|
};
|
|
3293
3372
|
}
|
|
3294
|
-
const configStat = await
|
|
3373
|
+
const configStat = await fs5__namespace.default.promises.stat(configPath).catch(() => null);
|
|
3295
3374
|
if (configStat) {
|
|
3296
3375
|
const cached = tailwindConfigCache.get(configPath);
|
|
3297
3376
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -3554,9 +3633,9 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
3554
3633
|
|
|
3555
3634
|
// packages/domain/compiler/src/index.ts
|
|
3556
3635
|
init_nativeBridge();
|
|
3557
|
-
var generateCssForClasses = async (classes, _tailwindConfig,
|
|
3636
|
+
var generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
3558
3637
|
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
3559
|
-
const result = await runCssPipeline2(classes);
|
|
3638
|
+
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
3560
3639
|
return result.css;
|
|
3561
3640
|
};
|
|
3562
3641
|
var mergeClassesStatic = (classes) => {
|
|
@@ -3629,7 +3708,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
3629
3708
|
}
|
|
3630
3709
|
log5.debug(`native change ${normalizedPath}`);
|
|
3631
3710
|
const scanned = scanFile(normalizedPath);
|
|
3632
|
-
const content =
|
|
3711
|
+
const content = fs5__namespace.default.readFileSync(normalizedPath, "utf8");
|
|
3633
3712
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
3634
3713
|
const existing = byFile.get(normalizedPath);
|
|
3635
3714
|
if (diff && existing) {
|
|
@@ -3980,7 +4059,7 @@ var CACHE_DIR = ".tw-cache";
|
|
|
3980
4059
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
3981
4060
|
try {
|
|
3982
4061
|
const cacheDir = path6__namespace.default.join(cwd, CACHE_DIR);
|
|
3983
|
-
|
|
4062
|
+
fs5__namespace.default.mkdirSync(cacheDir, { recursive: true });
|
|
3984
4063
|
const mem = process.memoryUsage();
|
|
3985
4064
|
const data = {
|
|
3986
4065
|
...metrics,
|
|
@@ -3991,7 +4070,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
3991
4070
|
},
|
|
3992
4071
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3993
4072
|
};
|
|
3994
|
-
|
|
4073
|
+
fs5__namespace.default.writeFileSync(path6__namespace.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
3995
4074
|
} catch {
|
|
3996
4075
|
}
|
|
3997
4076
|
}
|
|
@@ -4267,8 +4346,24 @@ var getBinding = () => {
|
|
|
4267
4346
|
}
|
|
4268
4347
|
const runtimeDir = typeof __dirname === "string" ? __dirname : process.cwd();
|
|
4269
4348
|
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('engine.js', document.baseURI).href)));
|
|
4349
|
+
const _pa = `${process.platform}-${process.arch}`;
|
|
4350
|
+
const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
|
|
4270
4351
|
const candidates = [
|
|
4352
|
+
// new binary name: tailwind-styled-native
|
|
4353
|
+
path6__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4354
|
+
path6__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
|
|
4355
|
+
// npm install case: dist/../native/
|
|
4356
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4357
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
|
|
4358
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
4359
|
+
// monorepo dev: 4-level up
|
|
4360
|
+
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4361
|
+
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
4362
|
+
// 3-level fallback
|
|
4363
|
+
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4364
|
+
// backward compat: tailwind_styled_parser
|
|
4271
4365
|
path6__namespace.default.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
|
|
4366
|
+
path6__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4272
4367
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4273
4368
|
path6__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
|
|
4274
4369
|
];
|
|
@@ -4369,7 +4464,7 @@ var log7 = createLogger("engine");
|
|
|
4369
4464
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
4370
4465
|
if (!tailwindConfigPath) return void 0;
|
|
4371
4466
|
const configPath = path6__namespace.default.resolve(root, tailwindConfigPath);
|
|
4372
|
-
if (!
|
|
4467
|
+
if (!fs5__namespace.default.existsSync(configPath)) {
|
|
4373
4468
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
4374
4469
|
}
|
|
4375
4470
|
const imported = await import(url.pathToFileURL(configPath).href);
|
|
@@ -4412,7 +4507,10 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
4412
4507
|
const transformedClasses = await runTransformClasses(plugins, scan.uniqueClasses, context);
|
|
4413
4508
|
const mergedClassList = mergeClassesStatic(transformedClasses.join(" "));
|
|
4414
4509
|
const css = options.compileCss !== false && mergedClassList.length > 0 ? await generateCssForClasses(
|
|
4415
|
-
mergedClassList.split(/\s+/).filter(Boolean)
|
|
4510
|
+
mergedClassList.split(/\s+/).filter(Boolean),
|
|
4511
|
+
tailwindConfig,
|
|
4512
|
+
root
|
|
4513
|
+
) : "";
|
|
4416
4514
|
const compileMs = Date.now() - compileStartedAt;
|
|
4417
4515
|
const analyzeStartedAt = Date.now();
|
|
4418
4516
|
const analysis = options.analyze ? await tryRunAnalyzer(root, options) : void 0;
|
|
@@ -4433,10 +4531,10 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
4433
4531
|
}
|
|
4434
4532
|
function countWorkspacePackages(root) {
|
|
4435
4533
|
const packagesDir = path6__namespace.default.join(root, "packages");
|
|
4436
|
-
if (!
|
|
4534
|
+
if (!fs5__namespace.default.existsSync(packagesDir)) return 0;
|
|
4437
4535
|
try {
|
|
4438
|
-
return
|
|
4439
|
-
(entry) => entry.isDirectory() &&
|
|
4536
|
+
return fs5__namespace.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
4537
|
+
(entry) => entry.isDirectory() && fs5__namespace.default.existsSync(path6__namespace.default.join(packagesDir, entry.name, "package.json"))
|
|
4440
4538
|
).length;
|
|
4441
4539
|
} catch {
|
|
4442
4540
|
return 0;
|
|
@@ -4619,7 +4717,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
4619
4717
|
const shouldForceFullRescan = (event) => {
|
|
4620
4718
|
if (event.type === "unlink") return false;
|
|
4621
4719
|
try {
|
|
4622
|
-
const stat =
|
|
4720
|
+
const stat = fs5__namespace.default.statSync(event.filePath);
|
|
4623
4721
|
if (stat.size > largeFileThreshold) {
|
|
4624
4722
|
metrics.markSkippedLargeFile();
|
|
4625
4723
|
return true;
|