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/scanner.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require('crypto');
|
|
4
|
-
var fs3 = require('fs');
|
|
5
|
-
var path5 = require('path');
|
|
6
|
-
var url = require('url');
|
|
7
|
-
var module$1 = require('module');
|
|
8
|
-
var worker_threads = require('worker_threads');
|
|
9
|
-
var os = require('os');
|
|
10
|
-
var zod = require('zod');
|
|
11
|
-
|
|
12
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var fs3__default = /*#__PURE__*/_interopDefault(fs3);
|
|
16
|
-
var path5__default = /*#__PURE__*/_interopDefault(path5);
|
|
17
|
-
|
|
1
|
+
const __importMetaUrl = typeof __filename !== "undefined" ? require("node:url").pathToFileURL(__filename).href : "file://unknown";
|
|
18
2
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
19
5
|
var __defProp = Object.defineProperty;
|
|
20
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
22
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
10
|
var __esm = (fn, res) => function __init() {
|
|
24
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -35,7 +22,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
35
22
|
}
|
|
36
23
|
return to;
|
|
37
24
|
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
38
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
|
+
|
|
35
|
+
// packages/domain/shared/src/index.ts
|
|
39
36
|
function createLogger(namespace) {
|
|
40
37
|
const prefix = `[${namespace}]`;
|
|
41
38
|
return {
|
|
@@ -58,7 +55,7 @@ function createLogger(namespace) {
|
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
57
|
function createDebugLogger(namespace, label) {
|
|
61
|
-
const prefix = `[${namespace}]`;
|
|
58
|
+
const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`;
|
|
62
59
|
return (msg) => {
|
|
63
60
|
if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {
|
|
64
61
|
console.debug(prefix, msg);
|
|
@@ -75,9 +72,9 @@ function loadNativeBinding(options) {
|
|
|
75
72
|
const { runtimeDir, candidates, isValid } = options;
|
|
76
73
|
const loadErrors = [];
|
|
77
74
|
for (const candidate of candidates) {
|
|
78
|
-
const candidatePath =
|
|
75
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
79
76
|
try {
|
|
80
|
-
if (!
|
|
77
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
81
78
|
continue;
|
|
82
79
|
}
|
|
83
80
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -109,9 +106,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
if (!includeDefaultCandidates) return candidates;
|
|
112
|
-
if (
|
|
109
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
113
110
|
try {
|
|
114
|
-
for (const entry of
|
|
111
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
115
112
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
116
113
|
}
|
|
117
114
|
} catch {
|
|
@@ -120,21 +117,27 @@ function resolveNativeBindingCandidates(options) {
|
|
|
120
117
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
121
118
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
122
119
|
for (const bin of BINARY_NAMES) {
|
|
123
|
-
candidates.push(
|
|
124
|
-
candidates.push(
|
|
125
|
-
candidates.push(
|
|
126
|
-
candidates.push(
|
|
127
|
-
candidates.push(
|
|
128
|
-
candidates.push(
|
|
129
|
-
candidates.push(
|
|
130
|
-
candidates.push(
|
|
131
|
-
candidates.push(
|
|
120
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
121
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
122
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
123
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
124
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
125
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
126
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
127
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
128
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
132
129
|
}
|
|
133
130
|
return Array.from(new Set(candidates));
|
|
134
131
|
}
|
|
135
|
-
var TwError, _require;
|
|
132
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module, TwError, _require;
|
|
136
133
|
var init_src = __esm({
|
|
137
134
|
"packages/domain/shared/src/index.ts"() {
|
|
135
|
+
"use strict";
|
|
136
|
+
import_node_crypto = require("crypto");
|
|
137
|
+
import_node_fs = __toESM(require("fs"));
|
|
138
|
+
import_node_path = __toESM(require("path"));
|
|
139
|
+
import_node_url = require("url");
|
|
140
|
+
import_node_module = require("module");
|
|
138
141
|
TwError = class _TwError extends Error {
|
|
139
142
|
/** @deprecated Gunakan source */
|
|
140
143
|
domain;
|
|
@@ -187,7 +190,9 @@ var init_src = __esm({
|
|
|
187
190
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
188
191
|
}
|
|
189
192
|
};
|
|
190
|
-
_require =
|
|
193
|
+
_require = (0, import_node_module.createRequire)(
|
|
194
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : __importMetaUrl ?? "file://unknown"
|
|
195
|
+
);
|
|
191
196
|
}
|
|
192
197
|
});
|
|
193
198
|
|
|
@@ -224,8 +229,8 @@ function getDirname() {
|
|
|
224
229
|
if (typeof __dirname !== "undefined") {
|
|
225
230
|
return __dirname;
|
|
226
231
|
}
|
|
227
|
-
if (typeof
|
|
228
|
-
return
|
|
232
|
+
if (typeof import_meta !== "undefined" && __importMetaUrl) {
|
|
233
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
|
|
229
234
|
}
|
|
230
235
|
return process.cwd();
|
|
231
236
|
}
|
|
@@ -430,13 +435,17 @@ function hasNativeWatchBinding() {
|
|
|
430
435
|
return false;
|
|
431
436
|
}
|
|
432
437
|
}
|
|
433
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
438
|
+
var import_node_path2, import_node_url2, import_meta, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
434
439
|
var init_native_bridge = __esm({
|
|
435
440
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
441
|
+
"use strict";
|
|
442
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
443
|
+
import_node_url2 = require("url");
|
|
436
444
|
init_src();
|
|
445
|
+
import_meta = {};
|
|
437
446
|
log = createDebugLogger("scanner:native");
|
|
438
|
-
isValidScannerBinding = (
|
|
439
|
-
const candidate =
|
|
447
|
+
isValidScannerBinding = (module2) => {
|
|
448
|
+
const candidate = module2;
|
|
440
449
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
441
450
|
};
|
|
442
451
|
createScannerBridgeLoader = () => {
|
|
@@ -514,18 +523,44 @@ var init_native_bridge = __esm({
|
|
|
514
523
|
}
|
|
515
524
|
});
|
|
516
525
|
|
|
526
|
+
// src/umbrella/scanner.ts
|
|
527
|
+
var scanner_exports = {};
|
|
528
|
+
__export(scanner_exports, {
|
|
529
|
+
DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
|
|
530
|
+
DEFAULT_IGNORES: () => DEFAULT_IGNORES,
|
|
531
|
+
batchExtractClassesNative: () => batchExtractClassesNative,
|
|
532
|
+
extractClassesNative: () => extractClassesNative,
|
|
533
|
+
isScannableFile: () => isScannableFile2,
|
|
534
|
+
parseScanWorkspaceOptions: () => parseScanWorkspaceOptions,
|
|
535
|
+
parseScanWorkspaceResult: () => parseScanWorkspaceResult,
|
|
536
|
+
parseScannerWorkerMessage: () => parseScannerWorkerMessage,
|
|
537
|
+
scanFile: () => scanFile,
|
|
538
|
+
scanSource: () => scanSource,
|
|
539
|
+
scanWorkspace: () => scanWorkspace,
|
|
540
|
+
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
541
|
+
});
|
|
542
|
+
module.exports = __toCommonJS(scanner_exports);
|
|
543
|
+
|
|
517
544
|
// packages/domain/scanner/src/index.ts
|
|
545
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
546
|
+
var import_node_module2 = require("module");
|
|
547
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
548
|
+
var import_node_url4 = require("url");
|
|
549
|
+
var import_node_worker_threads2 = require("worker_threads");
|
|
518
550
|
init_src();
|
|
519
551
|
|
|
520
552
|
// packages/domain/scanner/src/cache-native.ts
|
|
553
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
554
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
521
555
|
init_native_bridge();
|
|
522
556
|
function defaultCachePath(rootDir, cacheDir) {
|
|
523
|
-
const dir = cacheDir ?
|
|
524
|
-
return
|
|
557
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
558
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
525
559
|
}
|
|
560
|
+
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
526
561
|
function readCache(rootDir, cacheDir) {
|
|
527
562
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
528
|
-
|
|
563
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
529
564
|
const result = cacheReadNative(cachePath);
|
|
530
565
|
if (!result) return [];
|
|
531
566
|
return result.entries.map((e) => ({
|
|
@@ -540,7 +575,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
540
575
|
}
|
|
541
576
|
function writeCache(rootDir, entries, cacheDir) {
|
|
542
577
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
543
|
-
|
|
578
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
544
579
|
const success = cacheWriteNative(cachePath, entries);
|
|
545
580
|
if (!success) {
|
|
546
581
|
throw new Error(
|
|
@@ -562,6 +597,12 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
562
597
|
|
|
563
598
|
// packages/domain/scanner/src/index.ts
|
|
564
599
|
init_native_bridge();
|
|
600
|
+
|
|
601
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
602
|
+
var import_node_worker_threads = require("worker_threads");
|
|
603
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
604
|
+
var import_node_os = require("os");
|
|
605
|
+
var import_node_url3 = require("url");
|
|
565
606
|
init_native_bridge();
|
|
566
607
|
var PARALLEL_THRESHOLD = 50;
|
|
567
608
|
var DEFAULT_CHUNK_SIZE = 150;
|
|
@@ -580,24 +621,24 @@ function mergeResults(batchResults) {
|
|
|
580
621
|
if (native) return native;
|
|
581
622
|
throw new Error("FATAL: Native binding 'rebuildWorkspaceResult' is required but not available.");
|
|
582
623
|
}
|
|
583
|
-
if (!
|
|
584
|
-
const { filePaths } =
|
|
624
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
625
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
585
626
|
try {
|
|
586
627
|
const results = batchExtractClassesNative(filePaths);
|
|
587
628
|
const msg = { ok: true, results };
|
|
588
|
-
|
|
629
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
589
630
|
} catch (error) {
|
|
590
631
|
const msg = {
|
|
591
632
|
ok: false,
|
|
592
633
|
error: error instanceof Error ? error.message : String(error)
|
|
593
634
|
};
|
|
594
|
-
|
|
635
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
595
636
|
}
|
|
596
637
|
}
|
|
597
|
-
var _workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
638
|
+
var _workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(__importMetaUrl);
|
|
598
639
|
function runChunkInWorker(filePaths) {
|
|
599
640
|
return new Promise((resolve, reject) => {
|
|
600
|
-
const worker = new
|
|
641
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
601
642
|
workerData: { filePaths }
|
|
602
643
|
});
|
|
603
644
|
worker.once("message", (payload) => {
|
|
@@ -617,10 +658,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
617
658
|
const {
|
|
618
659
|
extensions = DEFAULT_EXTENSIONS,
|
|
619
660
|
ignoreDirs = DEFAULT_IGNORES,
|
|
620
|
-
maxWorkers = Math.max(1,
|
|
661
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
621
662
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
622
663
|
} = options;
|
|
623
|
-
const files = collectFiles(
|
|
664
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
624
665
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
625
666
|
return mergeResults(batchExtractClassesNative(files));
|
|
626
667
|
}
|
|
@@ -638,6 +679,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
638
679
|
}
|
|
639
680
|
|
|
640
681
|
// packages/domain/scanner/src/schemas.ts
|
|
682
|
+
var import_zod = require("zod");
|
|
641
683
|
init_src();
|
|
642
684
|
var formatIssuePath2 = (path6) => path6.length > 0 ? path6.map(
|
|
643
685
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -657,40 +699,40 @@ var parseWithSchema = (schema, data, label) => {
|
|
|
657
699
|
parsed.error
|
|
658
700
|
);
|
|
659
701
|
};
|
|
660
|
-
var NonNegativeIntegerSchema =
|
|
661
|
-
var ScanWorkspaceOptionsSchema =
|
|
662
|
-
includeExtensions:
|
|
663
|
-
ignoreDirectories:
|
|
664
|
-
useCache:
|
|
665
|
-
cacheDir:
|
|
666
|
-
smartInvalidation:
|
|
702
|
+
var NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
703
|
+
var ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
704
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
705
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
706
|
+
useCache: import_zod.z.boolean().optional(),
|
|
707
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
708
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
667
709
|
});
|
|
668
|
-
var ScanFileResultSchema =
|
|
669
|
-
file:
|
|
670
|
-
classes:
|
|
671
|
-
hash:
|
|
710
|
+
var ScanFileResultSchema = import_zod.z.object({
|
|
711
|
+
file: import_zod.z.string(),
|
|
712
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
713
|
+
hash: import_zod.z.string().optional()
|
|
672
714
|
});
|
|
673
|
-
var ScanWorkspaceResultSchema =
|
|
674
|
-
files:
|
|
715
|
+
var ScanWorkspaceResultSchema = import_zod.z.object({
|
|
716
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
675
717
|
totalFiles: NonNegativeIntegerSchema,
|
|
676
|
-
uniqueClasses:
|
|
718
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
677
719
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
678
720
|
message: "scan result totalFiles must match files.length",
|
|
679
721
|
path: ["totalFiles"]
|
|
680
722
|
});
|
|
681
|
-
|
|
682
|
-
rootDir:
|
|
723
|
+
var ScannerWorkerRequestSchema = import_zod.z.object({
|
|
724
|
+
rootDir: import_zod.z.string().min(1),
|
|
683
725
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
684
726
|
});
|
|
685
|
-
var ScannerWorkerSuccessMessageSchema =
|
|
686
|
-
ok:
|
|
727
|
+
var ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
728
|
+
ok: import_zod.z.literal(true),
|
|
687
729
|
result: ScanWorkspaceResultSchema
|
|
688
730
|
});
|
|
689
|
-
var ScannerWorkerErrorMessageSchema =
|
|
690
|
-
ok:
|
|
691
|
-
error:
|
|
731
|
+
var ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
732
|
+
ok: import_zod.z.literal(false),
|
|
733
|
+
error: import_zod.z.string().optional()
|
|
692
734
|
});
|
|
693
|
-
var ScannerWorkerMessageSchema =
|
|
735
|
+
var ScannerWorkerMessageSchema = import_zod.z.union([
|
|
694
736
|
ScannerWorkerSuccessMessageSchema,
|
|
695
737
|
ScannerWorkerErrorMessageSchema
|
|
696
738
|
]);
|
|
@@ -700,14 +742,15 @@ var parseScannerWorkerMessage = (message) => parseWithSchema(ScannerWorkerMessag
|
|
|
700
742
|
|
|
701
743
|
// packages/domain/scanner/src/index.ts
|
|
702
744
|
init_native_bridge();
|
|
745
|
+
var import_meta2 = {};
|
|
703
746
|
var log2 = createLogger("scanner");
|
|
704
747
|
var SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
705
748
|
function getRuntimeDir() {
|
|
706
749
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
707
750
|
return __dirname;
|
|
708
751
|
}
|
|
709
|
-
if (typeof
|
|
710
|
-
return
|
|
752
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
753
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
711
754
|
}
|
|
712
755
|
return process.cwd();
|
|
713
756
|
}
|
|
@@ -722,7 +765,7 @@ var createNativeParserLoader = () => {
|
|
|
722
765
|
const loadNativeParserBinding = () => {
|
|
723
766
|
if (_state.binding !== void 0) return _state.binding;
|
|
724
767
|
const runtimeDir = getRuntimeDir();
|
|
725
|
-
const req =
|
|
768
|
+
const req = (0, import_node_module2.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
726
769
|
const _platform = process.platform;
|
|
727
770
|
const _arch = process.arch;
|
|
728
771
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -730,27 +773,27 @@ var createNativeParserLoader = () => {
|
|
|
730
773
|
const candidates = [
|
|
731
774
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
732
775
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
776
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
777
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
778
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
736
779
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
737
780
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
781
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
782
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
783
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
741
784
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
742
|
-
|
|
743
|
-
|
|
785
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
786
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
744
787
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
745
|
-
|
|
746
|
-
|
|
788
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
789
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
747
790
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
791
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
792
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
793
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
794
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
795
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
796
|
+
import_node_path5.default.resolve(
|
|
754
797
|
runtimeDir,
|
|
755
798
|
"..",
|
|
756
799
|
"..",
|
|
@@ -762,7 +805,7 @@ var createNativeParserLoader = () => {
|
|
|
762
805
|
)
|
|
763
806
|
];
|
|
764
807
|
for (const fullPath of candidates) {
|
|
765
|
-
if (!
|
|
808
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
766
809
|
try {
|
|
767
810
|
const required = req(fullPath);
|
|
768
811
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -797,18 +840,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
797
840
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
798
841
|
return __dirname;
|
|
799
842
|
}
|
|
800
|
-
if (typeof
|
|
801
|
-
return
|
|
843
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
844
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
802
845
|
}
|
|
803
846
|
return process.cwd();
|
|
804
847
|
})();
|
|
805
848
|
const candidates = [
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
849
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
850
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
851
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
809
852
|
];
|
|
810
853
|
for (const candidate of candidates) {
|
|
811
|
-
if (
|
|
854
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
812
855
|
}
|
|
813
856
|
return null;
|
|
814
857
|
}
|
|
@@ -820,7 +863,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
820
863
|
}
|
|
821
864
|
return new Promise((resolve, reject) => {
|
|
822
865
|
const settleState = { settled: false };
|
|
823
|
-
const worker = new
|
|
866
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
824
867
|
const timeout = setTimeout(() => {
|
|
825
868
|
if (!settleState.settled) {
|
|
826
869
|
settleState.settled = true;
|
|
@@ -865,19 +908,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
865
908
|
if (!currentDir) continue;
|
|
866
909
|
const entries = (() => {
|
|
867
910
|
try {
|
|
868
|
-
return
|
|
911
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
869
912
|
} catch {
|
|
870
913
|
return [];
|
|
871
914
|
}
|
|
872
915
|
})();
|
|
873
916
|
for (const entry of entries) {
|
|
874
|
-
const fullPath =
|
|
917
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
875
918
|
if (entry.isDirectory()) {
|
|
876
919
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
877
920
|
continue;
|
|
878
921
|
}
|
|
879
922
|
if (!entry.isFile()) continue;
|
|
880
|
-
if (!extensionSet.has(
|
|
923
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
881
924
|
candidates.push(fullPath);
|
|
882
925
|
}
|
|
883
926
|
}
|
|
@@ -904,7 +947,7 @@ function scanSource(source) {
|
|
|
904
947
|
);
|
|
905
948
|
}
|
|
906
949
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
907
|
-
return includeExtensions.includes(
|
|
950
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
908
951
|
}
|
|
909
952
|
function scanFile(filePath) {
|
|
910
953
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -924,7 +967,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
924
967
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
925
968
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
926
969
|
const useCache = normalizedOptions.useCache ?? true;
|
|
927
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
970
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
928
971
|
const files = [];
|
|
929
972
|
const unique = /* @__PURE__ */ new Set();
|
|
930
973
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -964,7 +1007,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
964
1007
|
for (const filePath of candidates) {
|
|
965
1008
|
const stat = (() => {
|
|
966
1009
|
try {
|
|
967
|
-
return
|
|
1010
|
+
return import_node_fs3.default.statSync(filePath);
|
|
968
1011
|
} catch {
|
|
969
1012
|
return null;
|
|
970
1013
|
}
|
|
@@ -990,7 +1033,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
990
1033
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
991
1034
|
const content = (() => {
|
|
992
1035
|
try {
|
|
993
|
-
return
|
|
1036
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
994
1037
|
} catch {
|
|
995
1038
|
return null;
|
|
996
1039
|
}
|
|
@@ -1071,18 +1114,19 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
1071
1114
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
1072
1115
|
}
|
|
1073
1116
|
}
|
|
1074
|
-
|
|
1075
|
-
exports
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1118
|
+
0 && (module.exports = {
|
|
1119
|
+
DEFAULT_EXTENSIONS,
|
|
1120
|
+
DEFAULT_IGNORES,
|
|
1121
|
+
batchExtractClassesNative,
|
|
1122
|
+
extractClassesNative,
|
|
1123
|
+
isScannableFile,
|
|
1124
|
+
parseScanWorkspaceOptions,
|
|
1125
|
+
parseScanWorkspaceResult,
|
|
1126
|
+
parseScannerWorkerMessage,
|
|
1127
|
+
scanFile,
|
|
1128
|
+
scanSource,
|
|
1129
|
+
scanWorkspace,
|
|
1130
|
+
scanWorkspaceAsync
|
|
1131
|
+
});
|
|
1088
1132
|
//# sourceMappingURL=scanner.js.map
|