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/tw.js
CHANGED
|
@@ -1,61 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var module$1 = require('module');
|
|
5
|
-
var fs11 = require('fs');
|
|
6
|
-
var path6 = require('path');
|
|
7
|
-
require('crypto');
|
|
8
|
-
var url = require('url');
|
|
9
|
-
var worker_threads = require('worker_threads');
|
|
10
|
-
var os = require('os');
|
|
11
|
-
var zod = require('zod');
|
|
12
|
-
var fs7 = require('fs/promises');
|
|
13
|
-
var prompts = require('@clack/prompts');
|
|
14
|
-
var util = require('util');
|
|
15
|
-
var child_process = require('child_process');
|
|
16
|
-
|
|
17
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
22
|
-
var n = Object.create(null);
|
|
23
|
-
if (e) {
|
|
24
|
-
Object.keys(e).forEach(function (k) {
|
|
25
|
-
if (k !== 'default') {
|
|
26
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () { return e[k]; }
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
n.default = e;
|
|
35
|
-
return Object.freeze(n);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
|
|
39
|
-
var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
|
|
40
|
-
var fs7__default = /*#__PURE__*/_interopDefault(fs7);
|
|
41
|
-
|
|
2
|
+
const __importMetaUrl = typeof __filename !== "undefined" ? require("node:url").pathToFileURL(__filename).href : "file://unknown";
|
|
42
3
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
4
|
+
"use strict";
|
|
43
5
|
var __create = Object.create;
|
|
44
6
|
var __defProp = Object.defineProperty;
|
|
45
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
46
8
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
47
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
48
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
49
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
50
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
51
|
-
}) : x)(function(x) {
|
|
52
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
53
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
54
|
-
});
|
|
55
11
|
var __esm = (fn, res) => function __init() {
|
|
56
12
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
57
13
|
};
|
|
58
|
-
var __commonJS = (cb, mod) => function
|
|
14
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
59
15
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
60
16
|
};
|
|
61
17
|
var __export = (target, all) => {
|
|
@@ -75,14 +31,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
75
31
|
// file that has been converted to a CommonJS file using a Babel-
|
|
76
32
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
77
33
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
78
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
79
35
|
mod
|
|
80
36
|
));
|
|
81
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
82
38
|
|
|
83
39
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
84
40
|
var require_error = __commonJS({
|
|
85
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(
|
|
41
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports2) {
|
|
42
|
+
"use strict";
|
|
86
43
|
var CommanderError2 = class extends Error {
|
|
87
44
|
/**
|
|
88
45
|
* Constructs the CommanderError class
|
|
@@ -110,14 +67,15 @@ var require_error = __commonJS({
|
|
|
110
67
|
this.name = this.constructor.name;
|
|
111
68
|
}
|
|
112
69
|
};
|
|
113
|
-
|
|
114
|
-
|
|
70
|
+
exports2.CommanderError = CommanderError2;
|
|
71
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
115
72
|
}
|
|
116
73
|
});
|
|
117
74
|
|
|
118
75
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
119
76
|
var require_argument = __commonJS({
|
|
120
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(
|
|
77
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports2) {
|
|
78
|
+
"use strict";
|
|
121
79
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
122
80
|
var Argument2 = class {
|
|
123
81
|
/**
|
|
@@ -237,14 +195,15 @@ var require_argument = __commonJS({
|
|
|
237
195
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
238
196
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
239
197
|
}
|
|
240
|
-
|
|
241
|
-
|
|
198
|
+
exports2.Argument = Argument2;
|
|
199
|
+
exports2.humanReadableArgName = humanReadableArgName;
|
|
242
200
|
}
|
|
243
201
|
});
|
|
244
202
|
|
|
245
203
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
246
204
|
var require_help = __commonJS({
|
|
247
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(
|
|
205
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports2) {
|
|
206
|
+
"use strict";
|
|
248
207
|
var { humanReadableArgName } = require_argument();
|
|
249
208
|
var Help2 = class {
|
|
250
209
|
constructor() {
|
|
@@ -652,13 +611,14 @@ var require_help = __commonJS({
|
|
|
652
611
|
}).join("\n");
|
|
653
612
|
}
|
|
654
613
|
};
|
|
655
|
-
|
|
614
|
+
exports2.Help = Help2;
|
|
656
615
|
}
|
|
657
616
|
});
|
|
658
617
|
|
|
659
618
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
660
619
|
var require_option = __commonJS({
|
|
661
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(
|
|
620
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports2) {
|
|
621
|
+
"use strict";
|
|
662
622
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
663
623
|
var Option2 = class {
|
|
664
624
|
/**
|
|
@@ -923,14 +883,15 @@ var require_option = __commonJS({
|
|
|
923
883
|
}
|
|
924
884
|
return { shortFlag, longFlag };
|
|
925
885
|
}
|
|
926
|
-
|
|
927
|
-
|
|
886
|
+
exports2.Option = Option2;
|
|
887
|
+
exports2.DualOptions = DualOptions;
|
|
928
888
|
}
|
|
929
889
|
});
|
|
930
890
|
|
|
931
891
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
932
892
|
var require_suggestSimilar = __commonJS({
|
|
933
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(
|
|
893
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
894
|
+
"use strict";
|
|
934
895
|
var maxDistance = 3;
|
|
935
896
|
function editDistance(a, b) {
|
|
936
897
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -1004,18 +965,19 @@ var require_suggestSimilar = __commonJS({
|
|
|
1004
965
|
}
|
|
1005
966
|
return "";
|
|
1006
967
|
}
|
|
1007
|
-
|
|
968
|
+
exports2.suggestSimilar = suggestSimilar;
|
|
1008
969
|
}
|
|
1009
970
|
});
|
|
1010
971
|
|
|
1011
972
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
1012
973
|
var require_command = __commonJS({
|
|
1013
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(
|
|
1014
|
-
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
1018
|
-
var
|
|
974
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports2) {
|
|
975
|
+
"use strict";
|
|
976
|
+
var EventEmitter = require("events").EventEmitter;
|
|
977
|
+
var childProcess = require("child_process");
|
|
978
|
+
var path30 = require("path");
|
|
979
|
+
var fs16 = require("fs");
|
|
980
|
+
var process2 = require("process");
|
|
1019
981
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1020
982
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1021
983
|
var { Help: Help2 } = require_help();
|
|
@@ -1424,6 +1386,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1424
1386
|
this._exitCallback = (err) => {
|
|
1425
1387
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1426
1388
|
throw err;
|
|
1389
|
+
} else {
|
|
1427
1390
|
}
|
|
1428
1391
|
};
|
|
1429
1392
|
}
|
|
@@ -3046,29 +3009,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3046
3009
|
return arg;
|
|
3047
3010
|
});
|
|
3048
3011
|
}
|
|
3049
|
-
|
|
3012
|
+
exports2.Command = Command2;
|
|
3050
3013
|
}
|
|
3051
3014
|
});
|
|
3052
3015
|
|
|
3053
3016
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3054
3017
|
var require_commander = __commonJS({
|
|
3055
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(
|
|
3018
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports2) {
|
|
3019
|
+
"use strict";
|
|
3056
3020
|
var { Argument: Argument2 } = require_argument();
|
|
3057
3021
|
var { Command: Command2 } = require_command();
|
|
3058
3022
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3059
3023
|
var { Help: Help2 } = require_help();
|
|
3060
3024
|
var { Option: Option2 } = require_option();
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3025
|
+
exports2.program = new Command2();
|
|
3026
|
+
exports2.createCommand = (name) => new Command2(name);
|
|
3027
|
+
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3028
|
+
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3029
|
+
exports2.Command = Command2;
|
|
3030
|
+
exports2.Option = Option2;
|
|
3031
|
+
exports2.Argument = Argument2;
|
|
3032
|
+
exports2.Help = Help2;
|
|
3033
|
+
exports2.CommanderError = CommanderError2;
|
|
3034
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
3035
|
+
exports2.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3072
3036
|
}
|
|
3073
3037
|
});
|
|
3074
3038
|
|
|
@@ -3076,7 +3040,8 @@ var require_commander = __commonJS({
|
|
|
3076
3040
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3077
3041
|
var init_esm = __esm({
|
|
3078
3042
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3079
|
-
|
|
3043
|
+
"use strict";
|
|
3044
|
+
import_index = __toESM(require_commander(), 1);
|
|
3080
3045
|
({
|
|
3081
3046
|
program,
|
|
3082
3047
|
createCommand,
|
|
@@ -3121,6 +3086,7 @@ function errorExitCode(error) {
|
|
|
3121
3086
|
var CliError, CliUsageError;
|
|
3122
3087
|
var init_errors = __esm({
|
|
3123
3088
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3089
|
+
"use strict";
|
|
3124
3090
|
CliError = class extends Error {
|
|
3125
3091
|
exitCode;
|
|
3126
3092
|
code;
|
|
@@ -3145,7 +3111,7 @@ function getNodeModuleRef() {
|
|
|
3145
3111
|
if (isBrowser) return null;
|
|
3146
3112
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
3147
3113
|
try {
|
|
3148
|
-
const test = typeof
|
|
3114
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
3149
3115
|
nodeModuleRef = test;
|
|
3150
3116
|
return test;
|
|
3151
3117
|
} catch {
|
|
@@ -3153,22 +3119,44 @@ function getNodeModuleRef() {
|
|
|
3153
3119
|
return null;
|
|
3154
3120
|
}
|
|
3155
3121
|
}
|
|
3122
|
+
function getCurrentFileUrl() {
|
|
3123
|
+
if (__importMetaUrl) {
|
|
3124
|
+
return __importMetaUrl;
|
|
3125
|
+
}
|
|
3126
|
+
if (typeof __filename !== "undefined") {
|
|
3127
|
+
return `file://${__filename.replace(/\\/g, "/")}`;
|
|
3128
|
+
}
|
|
3129
|
+
return "file://unknown";
|
|
3130
|
+
}
|
|
3156
3131
|
function getNodePath() {
|
|
3157
3132
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3133
|
+
if (!_nodePath) {
|
|
3134
|
+
if (typeof require === "function") {
|
|
3135
|
+
_nodePath = require("path");
|
|
3136
|
+
} else {
|
|
3137
|
+
const nodeRequire = getNodeModuleRef();
|
|
3138
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3139
|
+
_nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3161
3142
|
return _nodePath;
|
|
3162
3143
|
}
|
|
3163
3144
|
function getNodeUrl() {
|
|
3164
3145
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3146
|
+
if (!_nodeUrl) {
|
|
3147
|
+
if (typeof require === "function") {
|
|
3148
|
+
_nodeUrl = require("url");
|
|
3149
|
+
} else {
|
|
3150
|
+
const nodeRequire = getNodeModuleRef();
|
|
3151
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3152
|
+
_nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3168
3155
|
return _nodeUrl;
|
|
3169
3156
|
}
|
|
3170
3157
|
function getDirname(importMetaUrl) {
|
|
3171
3158
|
if (isBrowser) return "";
|
|
3159
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
3172
3160
|
const nodePath = getNodePath();
|
|
3173
3161
|
const nodeUrl = getNodeUrl();
|
|
3174
3162
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
@@ -3176,12 +3164,15 @@ function getDirname(importMetaUrl) {
|
|
|
3176
3164
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3177
3165
|
var init_esmHelpers = __esm({
|
|
3178
3166
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3167
|
+
"use strict";
|
|
3179
3168
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3180
3169
|
nodeModuleRef = null;
|
|
3181
3170
|
_nodePath = null;
|
|
3182
3171
|
_nodeUrl = null;
|
|
3183
3172
|
}
|
|
3184
3173
|
});
|
|
3174
|
+
|
|
3175
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3185
3176
|
function platformKey() {
|
|
3186
3177
|
if (isBrowser2) return "browser";
|
|
3187
3178
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3197,7 +3188,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3197
3188
|
}
|
|
3198
3189
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3199
3190
|
if (envPath) {
|
|
3200
|
-
if (
|
|
3191
|
+
if (fs.existsSync(envPath)) {
|
|
3201
3192
|
return { path: envPath, source: "env", platform, tried };
|
|
3202
3193
|
}
|
|
3203
3194
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3206,7 +3197,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3206
3197
|
for (const pkg of prebuiltPkgs) {
|
|
3207
3198
|
try {
|
|
3208
3199
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3209
|
-
if (
|
|
3200
|
+
if (fs.existsSync(candidate)) {
|
|
3210
3201
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3211
3202
|
}
|
|
3212
3203
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3217,13 +3208,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3217
3208
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3218
3209
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3219
3210
|
if (runtimeDir) {
|
|
3220
|
-
for (const depth of ["..",
|
|
3221
|
-
const pkgRoot =
|
|
3211
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3212
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3222
3213
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3223
3214
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3224
|
-
const candidate =
|
|
3215
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3225
3216
|
tried.push(`self-bundled:${candidate}`);
|
|
3226
|
-
if (
|
|
3217
|
+
if (fs.existsSync(candidate)) {
|
|
3227
3218
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3228
3219
|
}
|
|
3229
3220
|
}
|
|
@@ -3235,39 +3226,45 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3235
3226
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3236
3227
|
const localCandidates = [];
|
|
3237
3228
|
for (const bin of BINARY_NAMES) {
|
|
3238
|
-
localCandidates.push(
|
|
3239
|
-
localCandidates.push(
|
|
3240
|
-
localCandidates.push(
|
|
3241
|
-
localCandidates.push(
|
|
3229
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3230
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3231
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3232
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3242
3233
|
}
|
|
3243
3234
|
for (const startDir of [cwd2, base]) {
|
|
3244
3235
|
let dir = startDir;
|
|
3245
3236
|
for (let i = 0; i < 6; i++) {
|
|
3246
|
-
const nativeDir =
|
|
3237
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3247
3238
|
for (const bin of BINARY_NAMES) {
|
|
3248
|
-
localCandidates.push(
|
|
3249
|
-
localCandidates.push(
|
|
3250
|
-
localCandidates.push(
|
|
3251
|
-
localCandidates.push(
|
|
3239
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3240
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3241
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3242
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3252
3243
|
}
|
|
3253
|
-
const parent =
|
|
3244
|
+
const parent = path.resolve(dir, "..");
|
|
3254
3245
|
if (parent === dir) break;
|
|
3255
3246
|
dir = parent;
|
|
3256
3247
|
}
|
|
3257
3248
|
}
|
|
3258
3249
|
for (const candidate of localCandidates) {
|
|
3259
3250
|
tried.push(`local:${candidate}`);
|
|
3260
|
-
if (
|
|
3251
|
+
if (fs.existsSync(candidate)) {
|
|
3261
3252
|
return { path: candidate, source: "local", platform, tried };
|
|
3262
3253
|
}
|
|
3263
3254
|
}
|
|
3264
3255
|
return { path: null, source: "not-found", platform, tried };
|
|
3265
3256
|
}
|
|
3266
|
-
var isBrowser2, _require, PLATFORM_MAP;
|
|
3257
|
+
var import_node_module, fs, path, isBrowser2, _require, PLATFORM_MAP;
|
|
3267
3258
|
var init_native_resolution = __esm({
|
|
3268
3259
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3260
|
+
"use strict";
|
|
3261
|
+
import_node_module = require("module");
|
|
3262
|
+
fs = __toESM(require("fs"));
|
|
3263
|
+
path = __toESM(require("path"));
|
|
3269
3264
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3270
|
-
_require =
|
|
3265
|
+
_require = (0, import_node_module.createRequire)(
|
|
3266
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
3267
|
+
);
|
|
3271
3268
|
PLATFORM_MAP = {
|
|
3272
3269
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
3273
3270
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -3278,6 +3275,8 @@ var init_native_resolution = __esm({
|
|
|
3278
3275
|
};
|
|
3279
3276
|
}
|
|
3280
3277
|
});
|
|
3278
|
+
|
|
3279
|
+
// packages/domain/shared/src/index.ts
|
|
3281
3280
|
function createLogger(namespace) {
|
|
3282
3281
|
const prefix = `[${namespace}]`;
|
|
3283
3282
|
return {
|
|
@@ -3320,9 +3319,9 @@ function loadNativeBinding(options) {
|
|
|
3320
3319
|
const { runtimeDir, candidates, isValid } = options;
|
|
3321
3320
|
const loadErrors = [];
|
|
3322
3321
|
for (const candidate of candidates) {
|
|
3323
|
-
const candidatePath =
|
|
3322
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
3324
3323
|
try {
|
|
3325
|
-
if (!
|
|
3324
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
3326
3325
|
continue;
|
|
3327
3326
|
}
|
|
3328
3327
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3354,9 +3353,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3354
3353
|
}
|
|
3355
3354
|
}
|
|
3356
3355
|
if (!includeDefaultCandidates) return candidates;
|
|
3357
|
-
if (
|
|
3356
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
3358
3357
|
try {
|
|
3359
|
-
for (const entry of
|
|
3358
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
3360
3359
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3361
3360
|
}
|
|
3362
3361
|
} catch {
|
|
@@ -3365,29 +3364,35 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3365
3364
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3366
3365
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3367
3366
|
for (const bin of BINARY_NAMES) {
|
|
3368
|
-
candidates.push(
|
|
3369
|
-
candidates.push(
|
|
3370
|
-
candidates.push(
|
|
3371
|
-
candidates.push(
|
|
3372
|
-
candidates.push(
|
|
3373
|
-
candidates.push(
|
|
3374
|
-
candidates.push(
|
|
3375
|
-
candidates.push(
|
|
3376
|
-
candidates.push(
|
|
3367
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
3368
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3369
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3370
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3371
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3372
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3373
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3374
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3375
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3377
3376
|
}
|
|
3378
3377
|
return Array.from(new Set(candidates));
|
|
3379
3378
|
}
|
|
3380
3379
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3381
|
-
if (dir) return
|
|
3380
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
3382
3381
|
try {
|
|
3383
|
-
return
|
|
3382
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3384
3383
|
} catch {
|
|
3385
3384
|
return process.cwd();
|
|
3386
3385
|
}
|
|
3387
3386
|
}
|
|
3388
|
-
var TwError, _require2;
|
|
3387
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module2, TwError, _require2;
|
|
3389
3388
|
var init_src = __esm({
|
|
3390
3389
|
"packages/domain/shared/src/index.ts"() {
|
|
3390
|
+
"use strict";
|
|
3391
|
+
import_node_crypto = require("crypto");
|
|
3392
|
+
import_node_fs = __toESM(require("fs"));
|
|
3393
|
+
import_node_path = __toESM(require("path"));
|
|
3394
|
+
import_node_url = require("url");
|
|
3395
|
+
import_node_module2 = require("module");
|
|
3391
3396
|
init_esmHelpers();
|
|
3392
3397
|
init_native_resolution();
|
|
3393
3398
|
TwError = class _TwError extends Error {
|
|
@@ -3442,7 +3447,9 @@ var init_src = __esm({
|
|
|
3442
3447
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3443
3448
|
}
|
|
3444
3449
|
};
|
|
3445
|
-
_require2 =
|
|
3450
|
+
_require2 = (0, import_node_module2.createRequire)(
|
|
3451
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : __importMetaUrl ?? "file://unknown"
|
|
3452
|
+
);
|
|
3446
3453
|
}
|
|
3447
3454
|
});
|
|
3448
3455
|
|
|
@@ -3479,8 +3486,8 @@ function getDirname2() {
|
|
|
3479
3486
|
if (typeof __dirname !== "undefined") {
|
|
3480
3487
|
return __dirname;
|
|
3481
3488
|
}
|
|
3482
|
-
if (typeof
|
|
3483
|
-
return
|
|
3489
|
+
if (typeof import_meta !== "undefined" && __importMetaUrl) {
|
|
3490
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
|
|
3484
3491
|
}
|
|
3485
3492
|
return process.cwd();
|
|
3486
3493
|
}
|
|
@@ -3685,13 +3692,17 @@ function hasNativeWatchBinding() {
|
|
|
3685
3692
|
return false;
|
|
3686
3693
|
}
|
|
3687
3694
|
}
|
|
3688
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3695
|
+
var import_node_path2, import_node_url2, import_meta, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3689
3696
|
var init_native_bridge = __esm({
|
|
3690
3697
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3698
|
+
"use strict";
|
|
3699
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
3700
|
+
import_node_url2 = require("url");
|
|
3691
3701
|
init_src();
|
|
3702
|
+
import_meta = {};
|
|
3692
3703
|
log = createDebugLogger("scanner:native");
|
|
3693
|
-
isValidScannerBinding = (
|
|
3694
|
-
const candidate =
|
|
3704
|
+
isValidScannerBinding = (module2) => {
|
|
3705
|
+
const candidate = module2;
|
|
3695
3706
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
3696
3707
|
};
|
|
3697
3708
|
createScannerBridgeLoader = () => {
|
|
@@ -3768,13 +3779,15 @@ var init_native_bridge = __esm({
|
|
|
3768
3779
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3769
3780
|
}
|
|
3770
3781
|
});
|
|
3782
|
+
|
|
3783
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3771
3784
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3772
|
-
const dir = cacheDir ?
|
|
3773
|
-
return
|
|
3785
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3786
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
3774
3787
|
}
|
|
3775
3788
|
function readCache(rootDir, cacheDir) {
|
|
3776
3789
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3777
|
-
|
|
3790
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3778
3791
|
const result = cacheReadNative(cachePath);
|
|
3779
3792
|
if (!result) return [];
|
|
3780
3793
|
return result.entries.map((e) => ({
|
|
@@ -3789,7 +3802,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3789
3802
|
}
|
|
3790
3803
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3791
3804
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3792
|
-
|
|
3805
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3793
3806
|
const success = cacheWriteNative(cachePath, entries);
|
|
3794
3807
|
if (!success) {
|
|
3795
3808
|
throw new Error(
|
|
@@ -3808,11 +3821,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3808
3821
|
nowMs
|
|
3809
3822
|
);
|
|
3810
3823
|
}
|
|
3824
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
3811
3825
|
var init_cache_native = __esm({
|
|
3812
3826
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3827
|
+
"use strict";
|
|
3828
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
3829
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
3813
3830
|
init_native_bridge();
|
|
3831
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3814
3832
|
}
|
|
3815
3833
|
});
|
|
3834
|
+
|
|
3835
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3816
3836
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3817
3837
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3818
3838
|
if (native !== null) return native;
|
|
@@ -3830,7 +3850,7 @@ function mergeResults(batchResults) {
|
|
|
3830
3850
|
}
|
|
3831
3851
|
function runChunkInWorker(filePaths) {
|
|
3832
3852
|
return new Promise((resolve2, reject) => {
|
|
3833
|
-
const worker = new
|
|
3853
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
3834
3854
|
workerData: { filePaths }
|
|
3835
3855
|
});
|
|
3836
3856
|
worker.once("message", (payload) => {
|
|
@@ -3850,10 +3870,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3850
3870
|
const {
|
|
3851
3871
|
extensions = DEFAULT_EXTENSIONS,
|
|
3852
3872
|
ignoreDirs = DEFAULT_IGNORES,
|
|
3853
|
-
maxWorkers = Math.max(1,
|
|
3873
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
3854
3874
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3855
3875
|
} = options;
|
|
3856
|
-
const files = collectFiles(
|
|
3876
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
3857
3877
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3858
3878
|
return mergeResults(batchExtractClassesNative(files));
|
|
3859
3879
|
}
|
|
@@ -3869,33 +3889,42 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3869
3889
|
}
|
|
3870
3890
|
return mergeResults(allResults);
|
|
3871
3891
|
}
|
|
3872
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3892
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3873
3893
|
var init_parallel_scanner = __esm({
|
|
3874
3894
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3895
|
+
"use strict";
|
|
3896
|
+
import_node_worker_threads = require("worker_threads");
|
|
3897
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3898
|
+
import_node_os = require("os");
|
|
3899
|
+
import_node_url3 = require("url");
|
|
3875
3900
|
init_src2();
|
|
3876
3901
|
init_native_bridge();
|
|
3877
3902
|
PARALLEL_THRESHOLD = 50;
|
|
3878
3903
|
DEFAULT_CHUNK_SIZE = 150;
|
|
3879
|
-
if (!
|
|
3880
|
-
const { filePaths } =
|
|
3904
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
3905
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
3881
3906
|
try {
|
|
3882
3907
|
const results = batchExtractClassesNative(filePaths);
|
|
3883
3908
|
const msg = { ok: true, results };
|
|
3884
|
-
|
|
3909
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3885
3910
|
} catch (error) {
|
|
3886
3911
|
const msg = {
|
|
3887
3912
|
ok: false,
|
|
3888
3913
|
error: error instanceof Error ? error.message : String(error)
|
|
3889
3914
|
};
|
|
3890
|
-
|
|
3915
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3891
3916
|
}
|
|
3892
3917
|
}
|
|
3893
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3918
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(__importMetaUrl);
|
|
3894
3919
|
}
|
|
3895
3920
|
});
|
|
3896
|
-
|
|
3921
|
+
|
|
3922
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3923
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3897
3924
|
var init_schemas = __esm({
|
|
3898
3925
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3926
|
+
"use strict";
|
|
3927
|
+
import_zod = require("zod");
|
|
3899
3928
|
init_src();
|
|
3900
3929
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3901
3930
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3915,40 +3944,40 @@ var init_schemas = __esm({
|
|
|
3915
3944
|
parsed.error
|
|
3916
3945
|
);
|
|
3917
3946
|
};
|
|
3918
|
-
NonNegativeIntegerSchema =
|
|
3919
|
-
ScanWorkspaceOptionsSchema =
|
|
3920
|
-
includeExtensions:
|
|
3921
|
-
ignoreDirectories:
|
|
3922
|
-
useCache:
|
|
3923
|
-
cacheDir:
|
|
3924
|
-
smartInvalidation:
|
|
3947
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
3948
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
3949
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3950
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3951
|
+
useCache: import_zod.z.boolean().optional(),
|
|
3952
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
3953
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
3925
3954
|
});
|
|
3926
|
-
ScanFileResultSchema =
|
|
3927
|
-
file:
|
|
3928
|
-
classes:
|
|
3929
|
-
hash:
|
|
3955
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
3956
|
+
file: import_zod.z.string(),
|
|
3957
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
3958
|
+
hash: import_zod.z.string().optional()
|
|
3930
3959
|
});
|
|
3931
|
-
ScanWorkspaceResultSchema =
|
|
3932
|
-
files:
|
|
3960
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
3961
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
3933
3962
|
totalFiles: NonNegativeIntegerSchema,
|
|
3934
|
-
uniqueClasses:
|
|
3963
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
3935
3964
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3936
3965
|
message: "scan result totalFiles must match files.length",
|
|
3937
3966
|
path: ["totalFiles"]
|
|
3938
3967
|
});
|
|
3939
|
-
|
|
3940
|
-
rootDir:
|
|
3968
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
3969
|
+
rootDir: import_zod.z.string().min(1),
|
|
3941
3970
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3942
3971
|
});
|
|
3943
|
-
ScannerWorkerSuccessMessageSchema =
|
|
3944
|
-
ok:
|
|
3972
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
3973
|
+
ok: import_zod.z.literal(true),
|
|
3945
3974
|
result: ScanWorkspaceResultSchema
|
|
3946
3975
|
});
|
|
3947
|
-
ScannerWorkerErrorMessageSchema =
|
|
3948
|
-
ok:
|
|
3949
|
-
error:
|
|
3976
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
3977
|
+
ok: import_zod.z.literal(false),
|
|
3978
|
+
error: import_zod.z.string().optional()
|
|
3950
3979
|
});
|
|
3951
|
-
ScannerWorkerMessageSchema =
|
|
3980
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
3952
3981
|
ScannerWorkerSuccessMessageSchema,
|
|
3953
3982
|
ScannerWorkerErrorMessageSchema
|
|
3954
3983
|
]);
|
|
@@ -3978,8 +4007,8 @@ function getRuntimeDir() {
|
|
|
3978
4007
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3979
4008
|
return __dirname;
|
|
3980
4009
|
}
|
|
3981
|
-
if (typeof
|
|
3982
|
-
return
|
|
4010
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
4011
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
3983
4012
|
}
|
|
3984
4013
|
return process.cwd();
|
|
3985
4014
|
}
|
|
@@ -3988,18 +4017,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
3988
4017
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3989
4018
|
return __dirname;
|
|
3990
4019
|
}
|
|
3991
|
-
if (typeof
|
|
3992
|
-
return
|
|
4020
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
4021
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
3993
4022
|
}
|
|
3994
4023
|
return process.cwd();
|
|
3995
4024
|
})();
|
|
3996
4025
|
const candidates = [
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4026
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
4027
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
4028
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
4000
4029
|
];
|
|
4001
4030
|
for (const candidate of candidates) {
|
|
4002
|
-
if (
|
|
4031
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
4003
4032
|
}
|
|
4004
4033
|
return null;
|
|
4005
4034
|
}
|
|
@@ -4011,7 +4040,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4011
4040
|
}
|
|
4012
4041
|
return new Promise((resolve2, reject) => {
|
|
4013
4042
|
const settleState = { settled: false };
|
|
4014
|
-
const worker = new
|
|
4043
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4015
4044
|
const timeout = setTimeout(() => {
|
|
4016
4045
|
if (!settleState.settled) {
|
|
4017
4046
|
settleState.settled = true;
|
|
@@ -4056,19 +4085,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4056
4085
|
if (!currentDir) continue;
|
|
4057
4086
|
const entries = (() => {
|
|
4058
4087
|
try {
|
|
4059
|
-
return
|
|
4088
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4060
4089
|
} catch {
|
|
4061
4090
|
return [];
|
|
4062
4091
|
}
|
|
4063
4092
|
})();
|
|
4064
4093
|
for (const entry of entries) {
|
|
4065
|
-
const fullPath =
|
|
4094
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
4066
4095
|
if (entry.isDirectory()) {
|
|
4067
4096
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4068
4097
|
continue;
|
|
4069
4098
|
}
|
|
4070
4099
|
if (!entry.isFile()) continue;
|
|
4071
|
-
if (!extensionSet.has(
|
|
4100
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
4072
4101
|
candidates.push(fullPath);
|
|
4073
4102
|
}
|
|
4074
4103
|
}
|
|
@@ -4095,7 +4124,7 @@ function scanSource(source) {
|
|
|
4095
4124
|
);
|
|
4096
4125
|
}
|
|
4097
4126
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4098
|
-
return includeExtensions.includes(
|
|
4127
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
4099
4128
|
}
|
|
4100
4129
|
function scanFile(filePath) {
|
|
4101
4130
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4115,7 +4144,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4115
4144
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4116
4145
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4117
4146
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4118
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4147
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4119
4148
|
const files = [];
|
|
4120
4149
|
const unique = /* @__PURE__ */ new Set();
|
|
4121
4150
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4155,7 +4184,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4155
4184
|
for (const filePath of candidates) {
|
|
4156
4185
|
const stat = (() => {
|
|
4157
4186
|
try {
|
|
4158
|
-
return
|
|
4187
|
+
return import_node_fs3.default.statSync(filePath);
|
|
4159
4188
|
} catch {
|
|
4160
4189
|
return null;
|
|
4161
4190
|
}
|
|
@@ -4181,7 +4210,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4181
4210
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4182
4211
|
const content = (() => {
|
|
4183
4212
|
try {
|
|
4184
|
-
return
|
|
4213
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
4185
4214
|
} catch {
|
|
4186
4215
|
return null;
|
|
4187
4216
|
}
|
|
@@ -4262,9 +4291,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4262
4291
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
4263
4292
|
}
|
|
4264
4293
|
}
|
|
4265
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4294
|
+
var import_node_fs3, import_node_module3, import_node_path5, import_node_url4, import_node_worker_threads2, import_meta2, log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4266
4295
|
var init_src2 = __esm({
|
|
4267
4296
|
"packages/domain/scanner/src/index.ts"() {
|
|
4297
|
+
"use strict";
|
|
4298
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
4299
|
+
import_node_module3 = require("module");
|
|
4300
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4301
|
+
import_node_url4 = require("url");
|
|
4302
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4268
4303
|
init_src();
|
|
4269
4304
|
init_cache_native();
|
|
4270
4305
|
init_native_bridge();
|
|
@@ -4272,6 +4307,7 @@ var init_src2 = __esm({
|
|
|
4272
4307
|
init_schemas();
|
|
4273
4308
|
init_schemas();
|
|
4274
4309
|
init_native_bridge();
|
|
4310
|
+
import_meta2 = {};
|
|
4275
4311
|
log2 = createLogger("scanner");
|
|
4276
4312
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4277
4313
|
createNativeParserLoader = () => {
|
|
@@ -4285,7 +4321,7 @@ var init_src2 = __esm({
|
|
|
4285
4321
|
const loadNativeParserBinding = () => {
|
|
4286
4322
|
if (_state.binding !== void 0) return _state.binding;
|
|
4287
4323
|
const runtimeDir = getRuntimeDir();
|
|
4288
|
-
const req =
|
|
4324
|
+
const req = (0, import_node_module3.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
4289
4325
|
const _platform = process.platform;
|
|
4290
4326
|
const _arch = process.arch;
|
|
4291
4327
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4293,27 +4329,27 @@ var init_src2 = __esm({
|
|
|
4293
4329
|
const candidates = [
|
|
4294
4330
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4295
4331
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4332
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4333
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4334
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4299
4335
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4300
4336
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4337
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4338
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4339
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4304
4340
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4305
|
-
|
|
4306
|
-
|
|
4341
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4342
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4307
4343
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4308
|
-
|
|
4309
|
-
|
|
4344
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4345
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4310
4346
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4347
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4348
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4349
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4350
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4351
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4352
|
+
import_node_path5.default.resolve(
|
|
4317
4353
|
runtimeDir,
|
|
4318
4354
|
"..",
|
|
4319
4355
|
"..",
|
|
@@ -4325,7 +4361,7 @@ var init_src2 = __esm({
|
|
|
4325
4361
|
)
|
|
4326
4362
|
];
|
|
4327
4363
|
for (const fullPath of candidates) {
|
|
4328
|
-
if (!
|
|
4364
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
4329
4365
|
try {
|
|
4330
4366
|
const required = req(fullPath);
|
|
4331
4367
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4357,6 +4393,8 @@ var init_src2 = __esm({
|
|
|
4357
4393
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4358
4394
|
}
|
|
4359
4395
|
});
|
|
4396
|
+
|
|
4397
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4360
4398
|
function formatErrorMessage(error) {
|
|
4361
4399
|
return error instanceof Error ? error.message : String(error);
|
|
4362
4400
|
}
|
|
@@ -4367,7 +4405,7 @@ function isRecord(value) {
|
|
|
4367
4405
|
}
|
|
4368
4406
|
async function pathExists(filePath) {
|
|
4369
4407
|
try {
|
|
4370
|
-
await
|
|
4408
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
4371
4409
|
return true;
|
|
4372
4410
|
} catch {
|
|
4373
4411
|
return false;
|
|
@@ -4381,9 +4419,11 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4381
4419
|
if (!Number.isFinite(value)) return DEFAULT_FREQUENT_THRESHOLD;
|
|
4382
4420
|
return Math.max(1, Math.trunc(value));
|
|
4383
4421
|
}
|
|
4384
|
-
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4422
|
+
var import_node_fs4, DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4385
4423
|
var init_utils = __esm({
|
|
4386
4424
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4425
|
+
"use strict";
|
|
4426
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
4387
4427
|
init_src();
|
|
4388
4428
|
DEFAULT_TOP_LIMIT = 10;
|
|
4389
4429
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4401,7 +4441,7 @@ async function requireNativeBinding() {
|
|
|
4401
4441
|
if (binding?.analyzeClasses) return binding;
|
|
4402
4442
|
const runtimeDir = resolveRuntimeDir(
|
|
4403
4443
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4404
|
-
|
|
4444
|
+
__importMetaUrl
|
|
4405
4445
|
);
|
|
4406
4446
|
const candidates = resolveNativeBindingCandidates({
|
|
4407
4447
|
runtimeDir,
|
|
@@ -4434,10 +4474,11 @@ async function requireNativeCssCompiler() {
|
|
|
4434
4474
|
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4435
4475
|
var init_binding = __esm({
|
|
4436
4476
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4477
|
+
"use strict";
|
|
4437
4478
|
init_src();
|
|
4438
4479
|
init_utils();
|
|
4439
|
-
isAnalyzerModule = (
|
|
4440
|
-
const candidate =
|
|
4480
|
+
isAnalyzerModule = (module2) => {
|
|
4481
|
+
const candidate = module2;
|
|
4441
4482
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
4442
4483
|
};
|
|
4443
4484
|
createAnalyzerBindingLoader = () => {
|
|
@@ -4447,7 +4488,7 @@ var init_binding = __esm({
|
|
|
4447
4488
|
_state.bindingPromise = (async () => {
|
|
4448
4489
|
const runtimeDir = resolveRuntimeDir(
|
|
4449
4490
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4450
|
-
|
|
4491
|
+
__importMetaUrl
|
|
4451
4492
|
);
|
|
4452
4493
|
const candidates = resolveNativeBindingCandidates({
|
|
4453
4494
|
runtimeDir,
|
|
@@ -4484,10 +4525,14 @@ var init_binding = __esm({
|
|
|
4484
4525
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4485
4526
|
}
|
|
4486
4527
|
});
|
|
4487
|
-
|
|
4528
|
+
|
|
4529
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4530
|
+
var import_zod2, formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4488
4531
|
var init_schemas2 = __esm({
|
|
4489
4532
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4533
|
+
"use strict";
|
|
4490
4534
|
init_src();
|
|
4535
|
+
import_zod2 = require("zod");
|
|
4491
4536
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4492
4537
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4493
4538
|
).join(".") : "<root>";
|
|
@@ -4511,76 +4556,76 @@ var init_schemas2 = __esm({
|
|
|
4511
4556
|
parsed.error
|
|
4512
4557
|
);
|
|
4513
4558
|
};
|
|
4514
|
-
CountSchema =
|
|
4515
|
-
|
|
4516
|
-
name:
|
|
4559
|
+
CountSchema = import_zod2.z.number().int().min(0);
|
|
4560
|
+
ClassUsageSchema = import_zod2.z.object({
|
|
4561
|
+
name: import_zod2.z.string(),
|
|
4517
4562
|
count: CountSchema,
|
|
4518
|
-
isUnused:
|
|
4519
|
-
isConflict:
|
|
4563
|
+
isUnused: import_zod2.z.boolean().optional(),
|
|
4564
|
+
isConflict: import_zod2.z.boolean().optional()
|
|
4520
4565
|
});
|
|
4521
|
-
|
|
4522
|
-
className:
|
|
4523
|
-
variants:
|
|
4524
|
-
classes:
|
|
4525
|
-
message:
|
|
4566
|
+
ClassConflictSchema = import_zod2.z.object({
|
|
4567
|
+
className: import_zod2.z.string(),
|
|
4568
|
+
variants: import_zod2.z.array(import_zod2.z.string()),
|
|
4569
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
4570
|
+
message: import_zod2.z.string()
|
|
4526
4571
|
});
|
|
4527
|
-
ClassCountSchema =
|
|
4528
|
-
name:
|
|
4572
|
+
ClassCountSchema = import_zod2.z.object({
|
|
4573
|
+
name: import_zod2.z.string(),
|
|
4529
4574
|
count: CountSchema
|
|
4530
4575
|
});
|
|
4531
|
-
NativeReportSchema =
|
|
4532
|
-
root:
|
|
4576
|
+
NativeReportSchema = import_zod2.z.object({
|
|
4577
|
+
root: import_zod2.z.string(),
|
|
4533
4578
|
totalFiles: CountSchema,
|
|
4534
4579
|
uniqueClassCount: CountSchema,
|
|
4535
4580
|
totalClassOccurrences: CountSchema,
|
|
4536
|
-
topClasses:
|
|
4537
|
-
duplicateCandidates:
|
|
4538
|
-
safelist:
|
|
4581
|
+
topClasses: import_zod2.z.array(ClassCountSchema),
|
|
4582
|
+
duplicateCandidates: import_zod2.z.array(ClassCountSchema),
|
|
4583
|
+
safelist: import_zod2.z.array(import_zod2.z.string())
|
|
4539
4584
|
});
|
|
4540
|
-
NativeCssCompileResultSchema =
|
|
4541
|
-
css:
|
|
4542
|
-
resolvedClasses:
|
|
4543
|
-
unknownClasses:
|
|
4585
|
+
NativeCssCompileResultSchema = import_zod2.z.object({
|
|
4586
|
+
css: import_zod2.z.string(),
|
|
4587
|
+
resolvedClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4588
|
+
unknownClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4544
4589
|
sizeBytes: CountSchema
|
|
4545
4590
|
});
|
|
4546
|
-
AnalyzerClassStatsSchema =
|
|
4547
|
-
top:
|
|
4591
|
+
AnalyzerClassStatsSchema = import_zod2.z.object({
|
|
4592
|
+
top: import_zod2.z.number({
|
|
4548
4593
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4549
4594
|
}).finite().optional(),
|
|
4550
|
-
frequentThreshold:
|
|
4595
|
+
frequentThreshold: import_zod2.z.number({
|
|
4551
4596
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4552
4597
|
}).finite().optional()
|
|
4553
4598
|
});
|
|
4554
|
-
AnalyzerSemanticOptionsSchema =
|
|
4555
|
-
tailwindConfigPath:
|
|
4599
|
+
AnalyzerSemanticOptionsSchema = import_zod2.z.object({
|
|
4600
|
+
tailwindConfigPath: import_zod2.z.string({
|
|
4556
4601
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4557
4602
|
}).min(
|
|
4558
4603
|
1,
|
|
4559
4604
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4560
4605
|
).optional()
|
|
4561
4606
|
});
|
|
4562
|
-
AnalyzerOptionsSchema =
|
|
4563
|
-
scanner:
|
|
4607
|
+
AnalyzerOptionsSchema = import_zod2.z.object({
|
|
4608
|
+
scanner: import_zod2.z.custom(
|
|
4564
4609
|
(value) => isPlainObject(value),
|
|
4565
4610
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4566
4611
|
).optional(),
|
|
4567
4612
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4568
|
-
semantic:
|
|
4569
|
-
|
|
4613
|
+
semantic: import_zod2.z.union([
|
|
4614
|
+
import_zod2.z.boolean({
|
|
4570
4615
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4571
4616
|
}),
|
|
4572
4617
|
AnalyzerSemanticOptionsSchema
|
|
4573
4618
|
]).optional(),
|
|
4574
|
-
includeClass:
|
|
4619
|
+
includeClass: import_zod2.z.custom(
|
|
4575
4620
|
(value) => typeof value === "function",
|
|
4576
4621
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4577
4622
|
).optional()
|
|
4578
4623
|
});
|
|
4579
|
-
ClassToCssOptionsSchema =
|
|
4580
|
-
prefix:
|
|
4624
|
+
ClassToCssOptionsSchema = import_zod2.z.object({
|
|
4625
|
+
prefix: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.null()], {
|
|
4581
4626
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4582
4627
|
}).optional(),
|
|
4583
|
-
strict:
|
|
4628
|
+
strict: import_zod2.z.boolean({
|
|
4584
4629
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4585
4630
|
}).optional()
|
|
4586
4631
|
});
|
|
@@ -4594,9 +4639,15 @@ var init_schemas2 = __esm({
|
|
|
4594
4639
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4595
4640
|
}
|
|
4596
4641
|
});
|
|
4597
|
-
|
|
4642
|
+
|
|
4643
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4644
|
+
var import_node_fs5, import_node_path6, import_node_url5, SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
|
|
4598
4645
|
var init_semantic = __esm({
|
|
4599
4646
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4647
|
+
"use strict";
|
|
4648
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4649
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4650
|
+
import_node_url5 = require("url");
|
|
4600
4651
|
init_binding();
|
|
4601
4652
|
init_utils();
|
|
4602
4653
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4632,11 +4683,11 @@ var init_semantic = __esm({
|
|
|
4632
4683
|
};
|
|
4633
4684
|
};
|
|
4634
4685
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4635
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4686
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path6.default.extname(configPath).toLowerCase());
|
|
4636
4687
|
};
|
|
4637
4688
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4638
4689
|
if (explicitPath) {
|
|
4639
|
-
const resolved =
|
|
4690
|
+
const resolved = import_node_path6.default.resolve(root, explicitPath);
|
|
4640
4691
|
if (!await pathExists(resolved)) return null;
|
|
4641
4692
|
return resolved;
|
|
4642
4693
|
}
|
|
@@ -4647,7 +4698,7 @@ var init_semantic = __esm({
|
|
|
4647
4698
|
"tailwind.config.mjs"
|
|
4648
4699
|
];
|
|
4649
4700
|
for (const candidate of candidates) {
|
|
4650
|
-
const fullPath =
|
|
4701
|
+
const fullPath = import_node_path6.default.resolve(root, candidate);
|
|
4651
4702
|
if (await pathExists(fullPath)) return fullPath;
|
|
4652
4703
|
}
|
|
4653
4704
|
return null;
|
|
@@ -4701,7 +4752,7 @@ var init_semantic = __esm({
|
|
|
4701
4752
|
return out;
|
|
4702
4753
|
};
|
|
4703
4754
|
collectSafelistFromSource = async (configPath) => {
|
|
4704
|
-
const source = await
|
|
4755
|
+
const source = await import_node_fs5.default.promises.readFile(configPath, "utf8");
|
|
4705
4756
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4706
4757
|
const allTokens = extractClassesNative2(source);
|
|
4707
4758
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4728,7 +4779,7 @@ var init_semantic = __esm({
|
|
|
4728
4779
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4729
4780
|
};
|
|
4730
4781
|
}
|
|
4731
|
-
const configStat = await
|
|
4782
|
+
const configStat = await import_node_fs5.default.promises.stat(configPath).catch(() => null);
|
|
4732
4783
|
if (configStat) {
|
|
4733
4784
|
const cached = tailwindConfigCache.get(configPath);
|
|
4734
4785
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4741,7 +4792,7 @@ var init_semantic = __esm({
|
|
|
4741
4792
|
const result = await (async () => {
|
|
4742
4793
|
try {
|
|
4743
4794
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
4744
|
-
const imported = await import(`${
|
|
4795
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
4745
4796
|
const candidate = imported.default ?? imported;
|
|
4746
4797
|
if (isRecord(candidate)) {
|
|
4747
4798
|
return { config: candidate, warning: void 0 };
|
|
@@ -4852,6 +4903,8 @@ var init_semantic = __esm({
|
|
|
4852
4903
|
};
|
|
4853
4904
|
}
|
|
4854
4905
|
});
|
|
4906
|
+
|
|
4907
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4855
4908
|
function normalizeScan(scan, includeClass) {
|
|
4856
4909
|
if (!includeClass) return scan;
|
|
4857
4910
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4906,7 +4959,7 @@ async function buildDistribution(usages, native) {
|
|
|
4906
4959
|
}
|
|
4907
4960
|
async function analyzeWorkspace(root, options = {}) {
|
|
4908
4961
|
const startedAtMs = Date.now();
|
|
4909
|
-
const resolvedRoot =
|
|
4962
|
+
const resolvedRoot = import_node_path7.default.resolve(root);
|
|
4910
4963
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4911
4964
|
const scan = await (async () => {
|
|
4912
4965
|
const scanStartedAtMs = Date.now();
|
|
@@ -5008,8 +5061,11 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
5008
5061
|
...semanticReport ? { semantic: semanticReport } : {}
|
|
5009
5062
|
};
|
|
5010
5063
|
}
|
|
5064
|
+
var import_node_path7;
|
|
5011
5065
|
var init_analyzeWorkspace = __esm({
|
|
5012
5066
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5067
|
+
"use strict";
|
|
5068
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
5013
5069
|
init_src2();
|
|
5014
5070
|
init_binding();
|
|
5015
5071
|
init_schemas2();
|
|
@@ -5022,6 +5078,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
5022
5078
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
5023
5079
|
var init_classToCss = __esm({
|
|
5024
5080
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5081
|
+
"use strict";
|
|
5025
5082
|
init_binding();
|
|
5026
5083
|
init_schemas2();
|
|
5027
5084
|
init_utils();
|
|
@@ -5142,6 +5199,7 @@ __export(src_exports2, {
|
|
|
5142
5199
|
var __internal;
|
|
5143
5200
|
var init_src3 = __esm({
|
|
5144
5201
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5202
|
+
"use strict";
|
|
5145
5203
|
init_analyzeWorkspace();
|
|
5146
5204
|
init_classToCss();
|
|
5147
5205
|
init_schemas2();
|
|
@@ -5160,9 +5218,11 @@ var init_src3 = __esm({
|
|
|
5160
5218
|
};
|
|
5161
5219
|
}
|
|
5162
5220
|
});
|
|
5221
|
+
|
|
5222
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5163
5223
|
async function pathExists2(filePath) {
|
|
5164
5224
|
try {
|
|
5165
|
-
await
|
|
5225
|
+
await import_promises.default.access(filePath);
|
|
5166
5226
|
return true;
|
|
5167
5227
|
} catch {
|
|
5168
5228
|
return false;
|
|
@@ -5170,7 +5230,7 @@ async function pathExists2(filePath) {
|
|
|
5170
5230
|
}
|
|
5171
5231
|
async function readFileSafe(filePath) {
|
|
5172
5232
|
try {
|
|
5173
|
-
return await
|
|
5233
|
+
return await import_promises.default.readFile(filePath, "utf8");
|
|
5174
5234
|
} catch {
|
|
5175
5235
|
return null;
|
|
5176
5236
|
}
|
|
@@ -5189,22 +5249,27 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5189
5249
|
options.onDryRun?.(`write ${filePath}`);
|
|
5190
5250
|
return;
|
|
5191
5251
|
}
|
|
5192
|
-
await
|
|
5193
|
-
await
|
|
5252
|
+
await import_promises.default.mkdir(import_node_path8.default.dirname(filePath), { recursive: true });
|
|
5253
|
+
await import_promises.default.writeFile(filePath, content, "utf8");
|
|
5194
5254
|
}
|
|
5195
5255
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
5196
5256
|
if (await pathExists2(filePath)) return "skipped";
|
|
5197
5257
|
await writeFileSafe(filePath, content, options);
|
|
5198
5258
|
return "created";
|
|
5199
5259
|
}
|
|
5260
|
+
var import_promises, import_node_path8;
|
|
5200
5261
|
var init_fs = __esm({
|
|
5201
5262
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5263
|
+
"use strict";
|
|
5264
|
+
import_promises = __toESM(require("fs/promises"), 1);
|
|
5265
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
5202
5266
|
}
|
|
5203
5267
|
});
|
|
5204
5268
|
|
|
5205
5269
|
// node_modules/picocolors/picocolors.js
|
|
5206
5270
|
var require_picocolors = __commonJS({
|
|
5207
|
-
"node_modules/picocolors/picocolors.js"(
|
|
5271
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
5272
|
+
"use strict";
|
|
5208
5273
|
var p = process || {};
|
|
5209
5274
|
var argv = p.argv || [];
|
|
5210
5275
|
var env = p.env || {};
|
|
@@ -5269,8 +5334,8 @@ var require_picocolors = __commonJS({
|
|
|
5269
5334
|
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
5270
5335
|
};
|
|
5271
5336
|
};
|
|
5272
|
-
|
|
5273
|
-
|
|
5337
|
+
module2.exports = createColors();
|
|
5338
|
+
module2.exports.createColors = createColors;
|
|
5274
5339
|
}
|
|
5275
5340
|
});
|
|
5276
5341
|
|
|
@@ -5291,8 +5356,11 @@ function writeJsonSuccess(command, data) {
|
|
|
5291
5356
|
}
|
|
5292
5357
|
var init_json = __esm({
|
|
5293
5358
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5359
|
+
"use strict";
|
|
5294
5360
|
}
|
|
5295
5361
|
});
|
|
5362
|
+
|
|
5363
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5296
5364
|
function writeLine(stream, message = "") {
|
|
5297
5365
|
stream.write(`${message}
|
|
5298
5366
|
`);
|
|
@@ -5322,7 +5390,7 @@ function createCliOutput(options = {}) {
|
|
|
5322
5390
|
const json = Boolean(options.json);
|
|
5323
5391
|
const debug = Boolean(options.debug);
|
|
5324
5392
|
const verboseEnabled = Boolean(options.verbose);
|
|
5325
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5393
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && (0, import_prompts.isTTY)(stdout);
|
|
5326
5394
|
function writeText(message = "", writeOptions = {}) {
|
|
5327
5395
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5328
5396
|
}
|
|
@@ -5356,7 +5424,7 @@ function createCliOutput(options = {}) {
|
|
|
5356
5424
|
},
|
|
5357
5425
|
note(message, title) {
|
|
5358
5426
|
if (interactive) {
|
|
5359
|
-
|
|
5427
|
+
(0, import_prompts.note)(message, title);
|
|
5360
5428
|
return;
|
|
5361
5429
|
}
|
|
5362
5430
|
if (title) {
|
|
@@ -5367,17 +5435,17 @@ ${message}`);
|
|
|
5367
5435
|
writeText(message);
|
|
5368
5436
|
},
|
|
5369
5437
|
intro(message) {
|
|
5370
|
-
showClackMessage(
|
|
5438
|
+
showClackMessage(import_prompts.intro, message);
|
|
5371
5439
|
},
|
|
5372
5440
|
outro(message) {
|
|
5373
|
-
showClackMessage(
|
|
5441
|
+
showClackMessage(import_prompts.outro, message);
|
|
5374
5442
|
},
|
|
5375
5443
|
table(rows) {
|
|
5376
5444
|
writeText(JSON.stringify(rows, null, 2));
|
|
5377
5445
|
},
|
|
5378
5446
|
spinner() {
|
|
5379
5447
|
if (!interactive) return createNoopSpinner();
|
|
5380
|
-
const instance =
|
|
5448
|
+
const instance = (0, import_prompts.spinner)({ output: stdout });
|
|
5381
5449
|
return {
|
|
5382
5450
|
start(message) {
|
|
5383
5451
|
instance.start(message);
|
|
@@ -5427,14 +5495,18 @@ ${import_picocolors.default.dim(message)}
|
|
|
5427
5495
|
}
|
|
5428
5496
|
};
|
|
5429
5497
|
}
|
|
5430
|
-
var import_picocolors;
|
|
5498
|
+
var import_prompts, import_picocolors;
|
|
5431
5499
|
var init_output = __esm({
|
|
5432
5500
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5433
|
-
|
|
5501
|
+
"use strict";
|
|
5502
|
+
import_prompts = require("@clack/prompts");
|
|
5503
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5434
5504
|
init_errors();
|
|
5435
5505
|
init_json();
|
|
5436
5506
|
}
|
|
5437
5507
|
});
|
|
5508
|
+
|
|
5509
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5438
5510
|
function hasFlag(name, argv) {
|
|
5439
5511
|
return argv.includes(`--${name}`);
|
|
5440
5512
|
}
|
|
@@ -5445,7 +5517,7 @@ function firstPositional(argv) {
|
|
|
5445
5517
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5446
5518
|
}
|
|
5447
5519
|
function parseCliInput(argv) {
|
|
5448
|
-
const parsed =
|
|
5520
|
+
const parsed = (0, import_node_util3.parseArgs)({
|
|
5449
5521
|
args: argv,
|
|
5450
5522
|
allowPositionals: true,
|
|
5451
5523
|
strict: false,
|
|
@@ -5472,17 +5544,22 @@ function parseCliInput(argv) {
|
|
|
5472
5544
|
helpCommand
|
|
5473
5545
|
};
|
|
5474
5546
|
}
|
|
5547
|
+
var import_node_util3;
|
|
5475
5548
|
var init_args = __esm({
|
|
5476
5549
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5550
|
+
"use strict";
|
|
5551
|
+
import_node_util3 = require("util");
|
|
5477
5552
|
}
|
|
5478
5553
|
});
|
|
5554
|
+
|
|
5555
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5479
5556
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5480
|
-
const filename =
|
|
5481
|
-
return
|
|
5557
|
+
const filename = (0, import_node_url6.fileURLToPath)(importMetaUrl);
|
|
5558
|
+
return import_node_path17.default.dirname(filename);
|
|
5482
5559
|
}
|
|
5483
5560
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5484
|
-
const fromRuntime =
|
|
5485
|
-
const fromCwd =
|
|
5561
|
+
const fromRuntime = import_node_path17.default.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5562
|
+
const fromCwd = import_node_path17.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
5486
5563
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5487
5564
|
}
|
|
5488
5565
|
async function firstExistingPath(paths) {
|
|
@@ -5491,8 +5568,12 @@ async function firstExistingPath(paths) {
|
|
|
5491
5568
|
}
|
|
5492
5569
|
return null;
|
|
5493
5570
|
}
|
|
5571
|
+
var import_node_path17, import_node_url6;
|
|
5494
5572
|
var init_paths = __esm({
|
|
5495
5573
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5574
|
+
"use strict";
|
|
5575
|
+
import_node_path17 = __toESM(require("path"), 1);
|
|
5576
|
+
import_node_url6 = require("url");
|
|
5496
5577
|
init_errors();
|
|
5497
5578
|
init_fs();
|
|
5498
5579
|
}
|
|
@@ -5577,6 +5658,7 @@ async function runCliMain(options) {
|
|
|
5577
5658
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5578
5659
|
var init_runtime = __esm({
|
|
5579
5660
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5661
|
+
"use strict";
|
|
5580
5662
|
init_args();
|
|
5581
5663
|
init_errors();
|
|
5582
5664
|
init_output();
|
|
@@ -5642,15 +5724,15 @@ function isInteractiveSession() {
|
|
|
5642
5724
|
}
|
|
5643
5725
|
async function resolveCreateInput(options) {
|
|
5644
5726
|
const interactive = isInteractiveSession();
|
|
5645
|
-
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await
|
|
5727
|
+
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await (0, import_prompts4.text)({
|
|
5646
5728
|
message: "Project name",
|
|
5647
5729
|
defaultValue: "my-app",
|
|
5648
5730
|
placeholder: "my-app"
|
|
5649
5731
|
});
|
|
5650
|
-
if (
|
|
5732
|
+
if ((0, import_prompts4.isCancel)(resolvedName)) {
|
|
5651
5733
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5652
5734
|
}
|
|
5653
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5735
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await (0, import_prompts4.select)({
|
|
5654
5736
|
message: "Template",
|
|
5655
5737
|
initialValue: "next-app",
|
|
5656
5738
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5658,7 +5740,7 @@ async function resolveCreateInput(options) {
|
|
|
5658
5740
|
label: template
|
|
5659
5741
|
}))
|
|
5660
5742
|
});
|
|
5661
|
-
if (
|
|
5743
|
+
if ((0, import_prompts4.isCancel)(pickedTemplate)) {
|
|
5662
5744
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5663
5745
|
}
|
|
5664
5746
|
const templateValue = pickedTemplate;
|
|
@@ -5670,7 +5752,7 @@ async function resolveCreateInput(options) {
|
|
|
5670
5752
|
return { name: resolvedName, template: templateValue };
|
|
5671
5753
|
}
|
|
5672
5754
|
async function writeProjectFile(context, relativePath, content) {
|
|
5673
|
-
const filePath =
|
|
5755
|
+
const filePath = import_node_path19.default.join(context.projectDir, relativePath);
|
|
5674
5756
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5675
5757
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5676
5758
|
}
|
|
@@ -5986,7 +6068,7 @@ async function createSimpleApp(context) {
|
|
|
5986
6068
|
}
|
|
5987
6069
|
async function createProject(options, output) {
|
|
5988
6070
|
const { name, template } = await resolveCreateInput(options);
|
|
5989
|
-
const projectDir =
|
|
6071
|
+
const projectDir = import_node_path19.default.resolve(process.cwd(), name);
|
|
5990
6072
|
if (await pathExists2(projectDir)) {
|
|
5991
6073
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5992
6074
|
}
|
|
@@ -6035,18 +6117,22 @@ function buildCreateProgram(context) {
|
|
|
6035
6117
|
async function main(rawArgs = process.argv.slice(2)) {
|
|
6036
6118
|
await runCliMain({
|
|
6037
6119
|
argv: [process.execPath, "create-tailwind-styled", ...rawArgs],
|
|
6038
|
-
importMetaUrl:
|
|
6120
|
+
importMetaUrl: typeof import_meta3 !== "undefined" && __importMetaUrl ? __importMetaUrl : `file://${process.argv[1] ?? "unknown"}`,
|
|
6039
6121
|
commandHint: "create",
|
|
6040
6122
|
buildProgram: buildCreateProgram
|
|
6041
6123
|
});
|
|
6042
6124
|
}
|
|
6043
|
-
var TEMPLATE_NAMES, TEMPLATES;
|
|
6125
|
+
var import_node_path19, import_prompts4, import_meta3, TEMPLATE_NAMES, TEMPLATES;
|
|
6044
6126
|
var init_createApp = __esm({
|
|
6045
6127
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6128
|
+
"use strict";
|
|
6129
|
+
import_node_path19 = __toESM(require("path"), 1);
|
|
6130
|
+
import_prompts4 = require("@clack/prompts");
|
|
6046
6131
|
init_esm();
|
|
6047
6132
|
init_errors();
|
|
6048
6133
|
init_fs();
|
|
6049
6134
|
init_runtime();
|
|
6135
|
+
import_meta3 = {};
|
|
6050
6136
|
TEMPLATE_NAMES = ["next-app", "vite-react", "vite-vue", "vite-svelte", "simple"];
|
|
6051
6137
|
TEMPLATES = {
|
|
6052
6138
|
"next-app": createNextApp,
|
|
@@ -6062,8 +6148,9 @@ var init_createApp = __esm({
|
|
|
6062
6148
|
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6063
6149
|
var init_nativeBridge = __esm({
|
|
6064
6150
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6151
|
+
"use strict";
|
|
6065
6152
|
init_src();
|
|
6066
|
-
_loadNative = (path30) =>
|
|
6153
|
+
_loadNative = (path30) => require(path30);
|
|
6067
6154
|
log3 = (...args) => {
|
|
6068
6155
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6069
6156
|
console.log("[compiler:native]", ...args);
|
|
@@ -6089,7 +6176,7 @@ var init_nativeBridge = __esm({
|
|
|
6089
6176
|
}
|
|
6090
6177
|
bridgeLoadAttempted = true;
|
|
6091
6178
|
try {
|
|
6092
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
6179
|
+
const runtimeDir = resolveRuntimeDir(void 0, __importMetaUrl);
|
|
6093
6180
|
const result = resolveNativeBinary(runtimeDir);
|
|
6094
6181
|
if (result.path && result.path.endsWith(".node")) {
|
|
6095
6182
|
try {
|
|
@@ -6160,41 +6247,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6160
6247
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6161
6248
|
var init_compiler = __esm({
|
|
6162
6249
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6250
|
+
"use strict";
|
|
6163
6251
|
}
|
|
6164
6252
|
});
|
|
6165
6253
|
|
|
6166
6254
|
// packages/domain/compiler/src/parser/index.ts
|
|
6167
6255
|
var init_parser = __esm({
|
|
6168
6256
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6257
|
+
"use strict";
|
|
6169
6258
|
}
|
|
6170
6259
|
});
|
|
6171
6260
|
|
|
6172
6261
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6173
6262
|
var init_analyzer = __esm({
|
|
6174
6263
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6264
|
+
"use strict";
|
|
6175
6265
|
}
|
|
6176
6266
|
});
|
|
6177
6267
|
|
|
6178
6268
|
// packages/domain/compiler/src/cache/index.ts
|
|
6179
6269
|
var init_cache = __esm({
|
|
6180
6270
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6271
|
+
"use strict";
|
|
6181
6272
|
}
|
|
6182
6273
|
});
|
|
6183
6274
|
|
|
6184
6275
|
// packages/domain/compiler/src/redis/index.ts
|
|
6185
6276
|
var init_redis = __esm({
|
|
6186
6277
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6278
|
+
"use strict";
|
|
6187
6279
|
}
|
|
6188
6280
|
});
|
|
6189
6281
|
|
|
6190
6282
|
// packages/domain/compiler/src/watch/index.ts
|
|
6191
6283
|
var init_watch = __esm({
|
|
6192
6284
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6285
|
+
"use strict";
|
|
6193
6286
|
}
|
|
6194
6287
|
});
|
|
6195
|
-
|
|
6288
|
+
|
|
6289
|
+
// packages/domain/compiler/src/index.ts
|
|
6290
|
+
var import_node_fs9, import_node_path24, import_node_module4, _require3, compileCssFromClasses;
|
|
6196
6291
|
var init_src4 = __esm({
|
|
6197
6292
|
"packages/domain/compiler/src/index.ts"() {
|
|
6293
|
+
"use strict";
|
|
6294
|
+
import_node_fs9 = __toESM(require("fs"), 1);
|
|
6295
|
+
import_node_path24 = __toESM(require("path"), 1);
|
|
6296
|
+
import_node_module4 = require("module");
|
|
6198
6297
|
init_nativeBridge();
|
|
6199
6298
|
init_compiler();
|
|
6200
6299
|
init_parser();
|
|
@@ -6202,7 +6301,9 @@ var init_src4 = __esm({
|
|
|
6202
6301
|
init_cache();
|
|
6203
6302
|
init_redis();
|
|
6204
6303
|
init_watch();
|
|
6205
|
-
|
|
6304
|
+
_require3 = (0, import_node_module4.createRequire)(
|
|
6305
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
6306
|
+
);
|
|
6206
6307
|
compileCssFromClasses = (classes, prefix) => {
|
|
6207
6308
|
const native = getNativeBridge();
|
|
6208
6309
|
if (!native?.transformSource) {
|
|
@@ -6220,6 +6321,7 @@ var init_src4 = __esm({
|
|
|
6220
6321
|
// packages/domain/compiler/src/internal.ts
|
|
6221
6322
|
var init_internal = __esm({
|
|
6222
6323
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6324
|
+
"use strict";
|
|
6223
6325
|
init_src4();
|
|
6224
6326
|
init_compiler();
|
|
6225
6327
|
init_parser();
|
|
@@ -6230,9 +6332,16 @@ var init_internal = __esm({
|
|
|
6230
6332
|
}
|
|
6231
6333
|
});
|
|
6232
6334
|
|
|
6335
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6336
|
+
var import_node_url8 = require("url");
|
|
6337
|
+
|
|
6233
6338
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6234
6339
|
init_esm();
|
|
6235
6340
|
|
|
6341
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6342
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
6343
|
+
var import_node_util = require("util");
|
|
6344
|
+
|
|
6236
6345
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6237
6346
|
init_errors();
|
|
6238
6347
|
async function loadAnalyzerModule() {
|
|
@@ -6289,7 +6398,7 @@ function printAnalysisReport(report, output) {
|
|
|
6289
6398
|
output.writeText("");
|
|
6290
6399
|
}
|
|
6291
6400
|
async function runAnalyzeCli(args) {
|
|
6292
|
-
const parsed =
|
|
6401
|
+
const parsed = (0, import_node_util.parseArgs)({
|
|
6293
6402
|
args,
|
|
6294
6403
|
allowPositionals: true,
|
|
6295
6404
|
strict: false,
|
|
@@ -6304,7 +6413,7 @@ async function runAnalyzeCli(args) {
|
|
|
6304
6413
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6305
6414
|
});
|
|
6306
6415
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6307
|
-
const dir =
|
|
6416
|
+
const dir = import_node_path9.default.resolve(process.cwd(), dirArg);
|
|
6308
6417
|
if (!await pathExists2(dir)) {
|
|
6309
6418
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6310
6419
|
}
|
|
@@ -6321,6 +6430,10 @@ async function runAnalyzeCli(args) {
|
|
|
6321
6430
|
}
|
|
6322
6431
|
printAnalysisReport(report, output);
|
|
6323
6432
|
}
|
|
6433
|
+
|
|
6434
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6435
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
6436
|
+
var import_node_util2 = require("util");
|
|
6324
6437
|
init_errors();
|
|
6325
6438
|
init_fs();
|
|
6326
6439
|
init_output();
|
|
@@ -6341,7 +6454,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6341
6454
|
return "div";
|
|
6342
6455
|
}
|
|
6343
6456
|
async function runExtractCli(args) {
|
|
6344
|
-
const parsed =
|
|
6457
|
+
const parsed = (0, import_node_util2.parseArgs)({
|
|
6345
6458
|
args,
|
|
6346
6459
|
allowPositionals: true,
|
|
6347
6460
|
strict: false,
|
|
@@ -6360,7 +6473,7 @@ async function runExtractCli(args) {
|
|
|
6360
6473
|
const parsedMin = parseInt(minRaw, 10);
|
|
6361
6474
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6362
6475
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6363
|
-
const dir =
|
|
6476
|
+
const dir = import_node_path10.default.resolve(process.cwd(), dirArg);
|
|
6364
6477
|
if (!await pathExists2(dir)) {
|
|
6365
6478
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6366
6479
|
}
|
|
@@ -6415,6 +6528,7 @@ async function runExtractCli(args) {
|
|
|
6415
6528
|
}
|
|
6416
6529
|
|
|
6417
6530
|
// packages/infrastructure/cli/src/init.ts
|
|
6531
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
6418
6532
|
init_fs();
|
|
6419
6533
|
init_output();
|
|
6420
6534
|
async function ensureFile(filePath, content, report) {
|
|
@@ -6433,15 +6547,15 @@ async function runInitCli(rawArgs) {
|
|
|
6433
6547
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6434
6548
|
});
|
|
6435
6549
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6436
|
-
const root =
|
|
6550
|
+
const root = import_node_path11.default.resolve(process.cwd(), target);
|
|
6437
6551
|
const report = { created: [], skipped: [] };
|
|
6438
6552
|
await ensureFile(
|
|
6439
|
-
|
|
6553
|
+
import_node_path11.default.join(root, "src", "tailwind.css"),
|
|
6440
6554
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6441
6555
|
report
|
|
6442
6556
|
);
|
|
6443
6557
|
await ensureFile(
|
|
6444
|
-
|
|
6558
|
+
import_node_path11.default.join(root, "tailwind-styled.config.json"),
|
|
6445
6559
|
`${JSON.stringify(
|
|
6446
6560
|
{
|
|
6447
6561
|
version: 1,
|
|
@@ -6461,17 +6575,22 @@ async function runInitCli(rawArgs) {
|
|
|
6461
6575
|
output.writeText("\nInit complete");
|
|
6462
6576
|
output.writeText(`Created: ${report.created.length}`);
|
|
6463
6577
|
for (const filePath of report.created) {
|
|
6464
|
-
output.writeText(` + ${
|
|
6578
|
+
output.writeText(` + ${import_node_path11.default.relative(root, filePath)}`);
|
|
6465
6579
|
}
|
|
6466
6580
|
if (report.skipped.length > 0) {
|
|
6467
6581
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6468
6582
|
for (const filePath of report.skipped) {
|
|
6469
|
-
output.writeText(` - ${
|
|
6583
|
+
output.writeText(` - ${import_node_path11.default.relative(root, filePath)} (exists)`);
|
|
6470
6584
|
}
|
|
6471
6585
|
}
|
|
6472
6586
|
}
|
|
6473
6587
|
|
|
6588
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6589
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
6590
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
6591
|
+
|
|
6474
6592
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6593
|
+
var import_prompts2 = require("@clack/prompts");
|
|
6475
6594
|
init_errors();
|
|
6476
6595
|
async function runMigrationWizard() {
|
|
6477
6596
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -6482,24 +6601,24 @@ async function runMigrationWizard() {
|
|
|
6482
6601
|
includeImports: true
|
|
6483
6602
|
};
|
|
6484
6603
|
}
|
|
6485
|
-
|
|
6486
|
-
const dryRun = await
|
|
6604
|
+
(0, import_prompts2.intro)("Tailwind Styled v4 Migration Wizard");
|
|
6605
|
+
const dryRun = await (0, import_prompts2.confirm)({
|
|
6487
6606
|
message: "Gunakan dry-run?",
|
|
6488
6607
|
initialValue: true
|
|
6489
6608
|
});
|
|
6490
|
-
const includeConfig = await
|
|
6609
|
+
const includeConfig = await (0, import_prompts2.confirm)({
|
|
6491
6610
|
message: "Migrasi file config dasar?",
|
|
6492
6611
|
initialValue: true
|
|
6493
6612
|
});
|
|
6494
|
-
const includeClasses = await
|
|
6613
|
+
const includeClasses = await (0, import_prompts2.confirm)({
|
|
6495
6614
|
message: "Migrasi class lama (flex-grow/shrink)?",
|
|
6496
6615
|
initialValue: true
|
|
6497
6616
|
});
|
|
6498
|
-
const includeImports = await
|
|
6617
|
+
const includeImports = await (0, import_prompts2.confirm)({
|
|
6499
6618
|
message: "Migrasi import tailwind-styled-components -> tailwind-styled-v4?",
|
|
6500
6619
|
initialValue: true
|
|
6501
6620
|
});
|
|
6502
|
-
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) =>
|
|
6621
|
+
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) => (0, import_prompts2.isCancel)(value))) {
|
|
6503
6622
|
throw new CliUsageError("Migration wizard dibatalkan oleh pengguna");
|
|
6504
6623
|
}
|
|
6505
6624
|
return {
|
|
@@ -6527,15 +6646,15 @@ async function findSourceFiles(dir) {
|
|
|
6527
6646
|
const out = [];
|
|
6528
6647
|
async function walk(currentDir) {
|
|
6529
6648
|
if (!await pathExists2(currentDir)) return;
|
|
6530
|
-
const entries = await
|
|
6649
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
6531
6650
|
for (const entry of entries) {
|
|
6532
|
-
const fullPath =
|
|
6651
|
+
const fullPath = import_node_path12.default.join(currentDir, entry.name);
|
|
6533
6652
|
if (entry.isDirectory()) {
|
|
6534
6653
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6535
6654
|
await walk(fullPath);
|
|
6536
6655
|
continue;
|
|
6537
6656
|
}
|
|
6538
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6657
|
+
if (SOURCE_EXTENSIONS.has(import_node_path12.default.extname(entry.name))) {
|
|
6539
6658
|
out.push(fullPath);
|
|
6540
6659
|
}
|
|
6541
6660
|
}
|
|
@@ -6556,7 +6675,7 @@ function migrateSource(source, options) {
|
|
|
6556
6675
|
return { output, classRenames: 0, importRenames };
|
|
6557
6676
|
}
|
|
6558
6677
|
async function migrateConfig(root, dryRun) {
|
|
6559
|
-
const cssPath =
|
|
6678
|
+
const cssPath = import_node_path12.default.join(root, "src", "tailwind.css");
|
|
6560
6679
|
if (await pathExists2(cssPath)) return 0;
|
|
6561
6680
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6562
6681
|
return 1;
|
|
@@ -6569,7 +6688,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6569
6688
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6570
6689
|
});
|
|
6571
6690
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6572
|
-
const root =
|
|
6691
|
+
const root = import_node_path12.default.resolve(process.cwd(), target);
|
|
6573
6692
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6574
6693
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6575
6694
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6593,12 +6712,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6593
6712
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6594
6713
|
}
|
|
6595
6714
|
for (const filePath of files) {
|
|
6596
|
-
const source = await
|
|
6715
|
+
const source = await import_promises2.default.readFile(filePath, "utf8");
|
|
6597
6716
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6598
6717
|
if (migrated.output !== source) {
|
|
6599
6718
|
report.updatedFiles++;
|
|
6600
6719
|
if (!dryRun) {
|
|
6601
|
-
await
|
|
6720
|
+
await import_promises2.default.writeFile(filePath, migrated.output, "utf8");
|
|
6602
6721
|
}
|
|
6603
6722
|
}
|
|
6604
6723
|
report.classRenames += migrated.classRenames;
|
|
@@ -6618,6 +6737,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6618
6737
|
}
|
|
6619
6738
|
|
|
6620
6739
|
// packages/infrastructure/cli/src/scan.ts
|
|
6740
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
6741
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6621
6742
|
init_src2();
|
|
6622
6743
|
init_output();
|
|
6623
6744
|
function buildTopClasses(files) {
|
|
@@ -6662,10 +6783,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6662
6783
|
});
|
|
6663
6784
|
}
|
|
6664
6785
|
function writeScanCache(root, cacheData) {
|
|
6665
|
-
const cacheDir =
|
|
6666
|
-
const cachePath =
|
|
6667
|
-
|
|
6668
|
-
|
|
6786
|
+
const cacheDir = import_node_path13.default.join(root, ".tailwind-styled");
|
|
6787
|
+
const cachePath = import_node_path13.default.join(cacheDir, "scan-cache.json");
|
|
6788
|
+
import_node_fs6.default.mkdirSync(cacheDir, { recursive: true });
|
|
6789
|
+
import_node_fs6.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6669
6790
|
return cachePath;
|
|
6670
6791
|
}
|
|
6671
6792
|
async function runScanCli(rawArgs) {
|
|
@@ -6677,7 +6798,7 @@ async function runScanCli(rawArgs) {
|
|
|
6677
6798
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6678
6799
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6679
6800
|
});
|
|
6680
|
-
const root =
|
|
6801
|
+
const root = import_node_path13.default.resolve(process.cwd(), target);
|
|
6681
6802
|
const spinner = output.spinner();
|
|
6682
6803
|
spinner.start(`Scanning ${root}`);
|
|
6683
6804
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6727,7 +6848,8 @@ Scan root : ${result.root}`);
|
|
|
6727
6848
|
}
|
|
6728
6849
|
|
|
6729
6850
|
// packages/infrastructure/cli/src/setup.ts
|
|
6730
|
-
var
|
|
6851
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
6852
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6731
6853
|
|
|
6732
6854
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6733
6855
|
function patchNextConfigImpl(src) {
|
|
@@ -6826,7 +6948,7 @@ ${close}`
|
|
|
6826
6948
|
}
|
|
6827
6949
|
function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
6828
6950
|
try {
|
|
6829
|
-
const nodePath =
|
|
6951
|
+
const nodePath = require("path");
|
|
6830
6952
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6831
6953
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6832
6954
|
const safelistAbs = nodePath.resolve(cwd2, ".next", "tw-classes");
|
|
@@ -6841,7 +6963,7 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
|
6841
6963
|
}
|
|
6842
6964
|
function computeStateStaticImportPath(cssFilePath, cwd2) {
|
|
6843
6965
|
try {
|
|
6844
|
-
const nodePath =
|
|
6966
|
+
const nodePath = require("path");
|
|
6845
6967
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6846
6968
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6847
6969
|
const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
|
|
@@ -6922,6 +7044,7 @@ function patchTsConfigImpl(src) {
|
|
|
6922
7044
|
}
|
|
6923
7045
|
|
|
6924
7046
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
7047
|
+
var import_prompts3 = require("@clack/prompts");
|
|
6925
7048
|
init_errors();
|
|
6926
7049
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6927
7050
|
const log5 = options.log ?? console.log;
|
|
@@ -6952,7 +7075,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6952
7075
|
});
|
|
6953
7076
|
log5("");
|
|
6954
7077
|
const defaultIdx = detected ? projectOptions.findIndex((option) => option.value === detected) : 0;
|
|
6955
|
-
const selected = await
|
|
7078
|
+
const selected = await (0, import_prompts3.select)({
|
|
6956
7079
|
message: "Project type",
|
|
6957
7080
|
initialValue: projectOptions[defaultIdx].value,
|
|
6958
7081
|
options: projectOptions.map((option) => ({
|
|
@@ -6961,7 +7084,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6961
7084
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6962
7085
|
}))
|
|
6963
7086
|
});
|
|
6964
|
-
if (
|
|
7087
|
+
if ((0, import_prompts3.isCancel)(selected)) {
|
|
6965
7088
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6966
7089
|
}
|
|
6967
7090
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6972,9 +7095,11 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6972
7095
|
}
|
|
6973
7096
|
|
|
6974
7097
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
7098
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
6975
7099
|
init_fs();
|
|
6976
7100
|
|
|
6977
7101
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
7102
|
+
var import_node_child_process = require("child_process");
|
|
6978
7103
|
init_errors();
|
|
6979
7104
|
init_json();
|
|
6980
7105
|
var npmCommandName = () => {
|
|
@@ -7007,7 +7132,7 @@ var runCommand = async (binary, args, options = {}) => {
|
|
|
7007
7132
|
if (isVerboseEnabled(options)) {
|
|
7008
7133
|
writeVerboseLine(binary, args);
|
|
7009
7134
|
}
|
|
7010
|
-
const child =
|
|
7135
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7011
7136
|
stdio: options.stdio ?? "inherit",
|
|
7012
7137
|
cwd: options.cwd ?? process.cwd(),
|
|
7013
7138
|
env: options.env ?? process.env
|
|
@@ -7063,7 +7188,7 @@ var runCommandCapture = async (binary, args, options = {}) => {
|
|
|
7063
7188
|
if (isVerboseEnabled(options)) {
|
|
7064
7189
|
writeVerboseLine(binary, args);
|
|
7065
7190
|
}
|
|
7066
|
-
const child =
|
|
7191
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7067
7192
|
stdio: "pipe",
|
|
7068
7193
|
cwd: options.cwd ?? process.cwd(),
|
|
7069
7194
|
env: options.env ?? process.env
|
|
@@ -7140,12 +7265,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7140
7265
|
};
|
|
7141
7266
|
}
|
|
7142
7267
|
async function readPackageJson(cwd2) {
|
|
7143
|
-
return readJsonSafe(
|
|
7268
|
+
return readJsonSafe(import_node_path14.default.join(cwd2, "package.json"));
|
|
7144
7269
|
}
|
|
7145
7270
|
async function detectPm(cwd2) {
|
|
7146
|
-
if (await pathExists2(
|
|
7147
|
-
if (await pathExists2(
|
|
7148
|
-
if (await pathExists2(
|
|
7271
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "bun.lockb"))) return "bun";
|
|
7272
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7273
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7149
7274
|
return "npm";
|
|
7150
7275
|
}
|
|
7151
7276
|
async function detectBundler(cwd2) {
|
|
@@ -7166,7 +7291,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7166
7291
|
}
|
|
7167
7292
|
async function findExisting(cwd2, names) {
|
|
7168
7293
|
for (const name of names) {
|
|
7169
|
-
const resolved =
|
|
7294
|
+
const resolved = import_node_path14.default.join(cwd2, name);
|
|
7170
7295
|
if (await pathExists2(resolved)) return resolved;
|
|
7171
7296
|
}
|
|
7172
7297
|
return null;
|
|
@@ -7177,7 +7302,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7177
7302
|
return;
|
|
7178
7303
|
}
|
|
7179
7304
|
await writeFileSafe(filePath, content);
|
|
7180
|
-
logger.ok(
|
|
7305
|
+
logger.ok(import_node_path14.default.relative(cwd2, filePath) || label);
|
|
7181
7306
|
}
|
|
7182
7307
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7183
7308
|
const source = await readFileSafe(filePath);
|
|
@@ -7204,7 +7329,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7204
7329
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7205
7330
|
return;
|
|
7206
7331
|
}
|
|
7207
|
-
const flag = "--save";
|
|
7332
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7208
7333
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7209
7334
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7210
7335
|
try {
|
|
@@ -7222,7 +7347,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7222
7347
|
}
|
|
7223
7348
|
|
|
7224
7349
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7225
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7350
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7226
7351
|
function createCliLogger(options = {}) {
|
|
7227
7352
|
function emit(level, icon, colorize, message) {
|
|
7228
7353
|
options.onEvent?.({ level, message });
|
|
@@ -7340,7 +7465,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7340
7465
|
if (bundlerConfig) {
|
|
7341
7466
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7342
7467
|
if (cfg)
|
|
7343
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7468
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, import_node_path15.default.basename(cfg), setupFlags, logger);
|
|
7344
7469
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7345
7470
|
} else {
|
|
7346
7471
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7359,13 +7484,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7359
7484
|
if (cssFile) {
|
|
7360
7485
|
await patchFileWithDryRun(
|
|
7361
7486
|
cssFile,
|
|
7362
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7363
|
-
|
|
7487
|
+
(src) => patchTailwindCss(src, bundler, import_node_path15.default.relative(cwd, cssFile), cwd),
|
|
7488
|
+
import_node_path15.default.relative(cwd, cssFile),
|
|
7364
7489
|
setupFlags,
|
|
7365
7490
|
logger
|
|
7366
7491
|
);
|
|
7367
|
-
const detectedCssEntry =
|
|
7368
|
-
const twConfigPath =
|
|
7492
|
+
const detectedCssEntry = import_node_path15.default.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7493
|
+
const twConfigPath = import_node_path15.default.join(cwd, "tailwind-styled.config.json");
|
|
7369
7494
|
const twConfig = {
|
|
7370
7495
|
version: 1,
|
|
7371
7496
|
compiler: { engine: "rust" },
|
|
@@ -7383,7 +7508,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7383
7508
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7384
7509
|
}
|
|
7385
7510
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7386
|
-
const tsCfg =
|
|
7511
|
+
const tsCfg = import_node_path15.default.join(cwd, "tsconfig.json");
|
|
7387
7512
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7388
7513
|
if (hasTsConfig) {
|
|
7389
7514
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7428,6 +7553,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7428
7553
|
output.jsonSuccess("setup", report);
|
|
7429
7554
|
}
|
|
7430
7555
|
};
|
|
7556
|
+
|
|
7557
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7558
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
7559
|
+
var import_node_util4 = require("util");
|
|
7431
7560
|
init_errors();
|
|
7432
7561
|
init_fs();
|
|
7433
7562
|
init_output();
|
|
@@ -7449,7 +7578,7 @@ function estimateClassBytes(className) {
|
|
|
7449
7578
|
return base + 15;
|
|
7450
7579
|
}
|
|
7451
7580
|
async function runStatsCli(args) {
|
|
7452
|
-
const parsed =
|
|
7581
|
+
const parsed = (0, import_node_util4.parseArgs)({
|
|
7453
7582
|
args,
|
|
7454
7583
|
allowPositionals: true,
|
|
7455
7584
|
strict: false,
|
|
@@ -7464,7 +7593,7 @@ async function runStatsCli(args) {
|
|
|
7464
7593
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7465
7594
|
});
|
|
7466
7595
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7467
|
-
const dir =
|
|
7596
|
+
const dir = import_node_path16.default.resolve(process.cwd(), dirArg);
|
|
7468
7597
|
if (!await pathExists2(dir)) {
|
|
7469
7598
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7470
7599
|
}
|
|
@@ -7516,15 +7645,20 @@ async function runStatsCli(args) {
|
|
|
7516
7645
|
|
|
7517
7646
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7518
7647
|
init_runtime();
|
|
7648
|
+
|
|
7649
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7650
|
+
var import_node_fs7 = require("fs");
|
|
7651
|
+
var import_node_path18 = require("path");
|
|
7652
|
+
var import_node_util5 = require("util");
|
|
7519
7653
|
function collectTsFiles(dir, extensions) {
|
|
7520
7654
|
const files = [];
|
|
7521
|
-
const entries =
|
|
7655
|
+
const entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
7522
7656
|
for (const entry of entries) {
|
|
7523
|
-
const full =
|
|
7657
|
+
const full = (0, import_node_path18.join)(dir, entry.name);
|
|
7524
7658
|
if (entry.isDirectory()) {
|
|
7525
7659
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7526
7660
|
files.push(...collectTsFiles(full, extensions));
|
|
7527
|
-
} else if (extensions.has(
|
|
7661
|
+
} else if (extensions.has((0, import_node_path18.extname)(entry.name))) {
|
|
7528
7662
|
files.push(full);
|
|
7529
7663
|
}
|
|
7530
7664
|
}
|
|
@@ -7583,7 +7717,7 @@ function printBoundaryReport(report, output) {
|
|
|
7583
7717
|
}
|
|
7584
7718
|
}
|
|
7585
7719
|
async function runBoundaryCli(args, context) {
|
|
7586
|
-
const parsed =
|
|
7720
|
+
const parsed = (0, import_node_util5.parseArgs)({
|
|
7587
7721
|
args,
|
|
7588
7722
|
allowPositionals: true,
|
|
7589
7723
|
strict: false,
|
|
@@ -7601,7 +7735,7 @@ async function runBoundaryCli(args, context) {
|
|
|
7601
7735
|
for (const file of files) {
|
|
7602
7736
|
let source;
|
|
7603
7737
|
try {
|
|
7604
|
-
source =
|
|
7738
|
+
source = (0, import_node_fs7.readFileSync)(file, "utf8");
|
|
7605
7739
|
} catch {
|
|
7606
7740
|
continue;
|
|
7607
7741
|
}
|
|
@@ -7649,10 +7783,13 @@ var createCommand2 = {
|
|
|
7649
7783
|
};
|
|
7650
7784
|
|
|
7651
7785
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7786
|
+
var import_node_util6 = require("util");
|
|
7652
7787
|
init_errors();
|
|
7653
7788
|
init_fs();
|
|
7654
7789
|
|
|
7655
7790
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7791
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
7792
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
7656
7793
|
init_errors();
|
|
7657
7794
|
init_paths();
|
|
7658
7795
|
function enumerateVariantProps(matrix) {
|
|
@@ -7676,7 +7813,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7676
7813
|
}
|
|
7677
7814
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7678
7815
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7679
|
-
const fromCwd =
|
|
7816
|
+
const fromCwd = import_node_path20.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
7680
7817
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7681
7818
|
if (!resolved) {
|
|
7682
7819
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7690,13 +7827,13 @@ async function loadRegistry(context) {
|
|
|
7690
7827
|
);
|
|
7691
7828
|
const candidates = [
|
|
7692
7829
|
runtimeRegistryPath,
|
|
7693
|
-
|
|
7830
|
+
import_node_path20.default.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7694
7831
|
];
|
|
7695
7832
|
const registryPath = await firstExistingPath(candidates);
|
|
7696
7833
|
if (!registryPath) {
|
|
7697
7834
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7698
7835
|
}
|
|
7699
|
-
const raw = await
|
|
7836
|
+
const raw = await import_promises3.default.readFile(registryPath, "utf8");
|
|
7700
7837
|
const data = JSON.parse(raw);
|
|
7701
7838
|
return [
|
|
7702
7839
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7716,7 +7853,7 @@ var dashboardCommand = {
|
|
|
7716
7853
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7717
7854
|
);
|
|
7718
7855
|
}
|
|
7719
|
-
const parsed =
|
|
7856
|
+
const parsed = (0, import_node_util6.parseArgs)({
|
|
7720
7857
|
args,
|
|
7721
7858
|
allowPositionals: true,
|
|
7722
7859
|
strict: false,
|
|
@@ -7740,12 +7877,15 @@ var dashboardCommand = {
|
|
|
7740
7877
|
};
|
|
7741
7878
|
|
|
7742
7879
|
// packages/infrastructure/cli/src/commands/deploy.ts
|
|
7880
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
7881
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
7882
|
+
var import_node_util7 = require("util");
|
|
7743
7883
|
init_errors();
|
|
7744
7884
|
init_fs();
|
|
7745
7885
|
init_json();
|
|
7746
7886
|
var postJson = async (url, body, token) => {
|
|
7747
|
-
const { default: https } = await import(
|
|
7748
|
-
const { default: http } = await import(
|
|
7887
|
+
const { default: https } = await import("https");
|
|
7888
|
+
const { default: http } = await import("http");
|
|
7749
7889
|
return new Promise((resolve2, reject) => {
|
|
7750
7890
|
const client = url.protocol === "https:" ? https : http;
|
|
7751
7891
|
const req = client.request(
|
|
@@ -7779,7 +7919,7 @@ var postJson = async (url, body, token) => {
|
|
|
7779
7919
|
var deployCommand = {
|
|
7780
7920
|
name: "deploy",
|
|
7781
7921
|
async run(args, context) {
|
|
7782
|
-
const parsed =
|
|
7922
|
+
const parsed = (0, import_node_util7.parseArgs)({
|
|
7783
7923
|
args,
|
|
7784
7924
|
allowPositionals: true,
|
|
7785
7925
|
strict: false,
|
|
@@ -7795,7 +7935,7 @@ var deployCommand = {
|
|
|
7795
7935
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7796
7936
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7797
7937
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7798
|
-
const pkgPath =
|
|
7938
|
+
const pkgPath = import_node_path21.default.join(process.cwd(), "package.json");
|
|
7799
7939
|
if (!await pathExists2(pkgPath)) {
|
|
7800
7940
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7801
7941
|
}
|
|
@@ -7830,10 +7970,10 @@ var deployCommand = {
|
|
|
7830
7970
|
}
|
|
7831
7971
|
return;
|
|
7832
7972
|
}
|
|
7833
|
-
const cacheDir =
|
|
7834
|
-
await
|
|
7835
|
-
await
|
|
7836
|
-
|
|
7973
|
+
const cacheDir = import_node_path21.default.join(process.cwd(), ".tw-cache");
|
|
7974
|
+
await import_promises4.default.mkdir(cacheDir, { recursive: true });
|
|
7975
|
+
await import_promises4.default.writeFile(
|
|
7976
|
+
import_node_path21.default.join(cacheDir, "deploy-manifest.json"),
|
|
7837
7977
|
JSON.stringify(manifest, null, 2)
|
|
7838
7978
|
);
|
|
7839
7979
|
if (!registryUrl) {
|
|
@@ -7896,9 +8036,12 @@ var deployCommand = {
|
|
|
7896
8036
|
};
|
|
7897
8037
|
|
|
7898
8038
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7899
|
-
var
|
|
8039
|
+
var import_node_util8 = require("util");
|
|
8040
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
7900
8041
|
|
|
7901
8042
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
8043
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
8044
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
7902
8045
|
init_src3();
|
|
7903
8046
|
init_src2();
|
|
7904
8047
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
@@ -7933,9 +8076,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7933
8076
|
issues.push({ severity, type, message, suggestion, location });
|
|
7934
8077
|
}
|
|
7935
8078
|
function readJsonFile(filePath) {
|
|
7936
|
-
if (!
|
|
8079
|
+
if (!import_node_fs8.default.existsSync(filePath)) return null;
|
|
7937
8080
|
try {
|
|
7938
|
-
return JSON.parse(
|
|
8081
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
7939
8082
|
} catch (parseErr) {
|
|
7940
8083
|
if (process.env.TWS_DEBUG === "1") {
|
|
7941
8084
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7946,16 +8089,16 @@ function readJsonFile(filePath) {
|
|
|
7946
8089
|
}
|
|
7947
8090
|
}
|
|
7948
8091
|
function findWorkspacePackageJsonFiles(root) {
|
|
7949
|
-
const packagesDir =
|
|
7950
|
-
if (!
|
|
7951
|
-
return
|
|
8092
|
+
const packagesDir = import_node_path22.default.join(root, "packages");
|
|
8093
|
+
if (!import_node_fs8.default.existsSync(packagesDir)) return [];
|
|
8094
|
+
return import_node_fs8.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => import_node_path22.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => import_node_fs8.default.existsSync(filePath));
|
|
7952
8095
|
}
|
|
7953
8096
|
function findFiles(dir, ext) {
|
|
7954
8097
|
const files = [];
|
|
7955
8098
|
try {
|
|
7956
|
-
const entries =
|
|
8099
|
+
const entries = import_node_fs8.default.readdirSync(dir, { withFileTypes: true });
|
|
7957
8100
|
for (const entry of entries) {
|
|
7958
|
-
const fullPath =
|
|
8101
|
+
const fullPath = import_node_path22.default.join(dir, entry.name);
|
|
7959
8102
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7960
8103
|
files.push(...findFiles(fullPath, ext));
|
|
7961
8104
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7973,7 +8116,7 @@ function findFiles(dir, ext) {
|
|
|
7973
8116
|
return files;
|
|
7974
8117
|
}
|
|
7975
8118
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7976
|
-
const rootPackageJsonPath =
|
|
8119
|
+
const rootPackageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
7977
8120
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7978
8121
|
if (!rootPackageJson) {
|
|
7979
8122
|
addCheck(
|
|
@@ -8026,7 +8169,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8026
8169
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8027
8170
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8028
8171
|
if (missing.length === 0) return [];
|
|
8029
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8172
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : import_node_path22.default.basename(import_node_path22.default.dirname(filePath));
|
|
8030
8173
|
return [{ packageName, missing }];
|
|
8031
8174
|
});
|
|
8032
8175
|
if (missingScripts.length === 0) {
|
|
@@ -8061,7 +8204,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8061
8204
|
);
|
|
8062
8205
|
}
|
|
8063
8206
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8064
|
-
const packageJsonPath =
|
|
8207
|
+
const packageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
8065
8208
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8066
8209
|
if (!packageJson) {
|
|
8067
8210
|
addCheck(
|
|
@@ -8120,7 +8263,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8120
8263
|
const cssFiles = findFiles(root, ".css");
|
|
8121
8264
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8122
8265
|
try {
|
|
8123
|
-
const content =
|
|
8266
|
+
const content = import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
8124
8267
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8125
8268
|
} catch {
|
|
8126
8269
|
return false;
|
|
@@ -8144,7 +8287,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8144
8287
|
);
|
|
8145
8288
|
}
|
|
8146
8289
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8147
|
-
const hasConfig = configFiles.some((name) =>
|
|
8290
|
+
const hasConfig = configFiles.some((name) => import_node_fs8.default.existsSync(import_node_path22.default.join(root, name)));
|
|
8148
8291
|
addCheck(
|
|
8149
8292
|
checks,
|
|
8150
8293
|
"tailwind",
|
|
@@ -8153,7 +8296,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8153
8296
|
"info",
|
|
8154
8297
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8155
8298
|
);
|
|
8156
|
-
const tsconfig = readJsonFile(
|
|
8299
|
+
const tsconfig = readJsonFile(import_node_path22.default.join(root, "tsconfig.json"));
|
|
8157
8300
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8158
8301
|
addCheck(
|
|
8159
8302
|
checks,
|
|
@@ -8319,7 +8462,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8319
8462
|
}
|
|
8320
8463
|
}
|
|
8321
8464
|
var runDiagnostics = async (options = {}) => {
|
|
8322
|
-
const root =
|
|
8465
|
+
const root = import_node_path22.default.resolve(options.root ?? process.cwd());
|
|
8323
8466
|
const includes = parseIncludes(options.include);
|
|
8324
8467
|
const issues = [];
|
|
8325
8468
|
const checks = [];
|
|
@@ -8365,7 +8508,7 @@ function parseIncludeOption(value) {
|
|
|
8365
8508
|
return includes;
|
|
8366
8509
|
}
|
|
8367
8510
|
async function runDoctorCli(args, context) {
|
|
8368
|
-
const parsed =
|
|
8511
|
+
const parsed = (0, import_node_util8.parseArgs)({
|
|
8369
8512
|
args,
|
|
8370
8513
|
allowPositionals: true,
|
|
8371
8514
|
strict: false,
|
|
@@ -8438,13 +8581,15 @@ function printDoctorOutput(result, output) {
|
|
|
8438
8581
|
}
|
|
8439
8582
|
|
|
8440
8583
|
// packages/infrastructure/cli/src/commands/misc.ts
|
|
8584
|
+
var import_node_path23 = __toESM(require("path"), 1);
|
|
8585
|
+
var import_node_util9 = require("util");
|
|
8441
8586
|
init_errors();
|
|
8442
8587
|
init_fs();
|
|
8443
8588
|
init_json();
|
|
8444
8589
|
var testCommand = {
|
|
8445
8590
|
name: "test",
|
|
8446
8591
|
async run(args) {
|
|
8447
|
-
const parsed =
|
|
8592
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8448
8593
|
args,
|
|
8449
8594
|
allowPositionals: true,
|
|
8450
8595
|
strict: false,
|
|
@@ -8469,7 +8614,7 @@ var shareCommand = {
|
|
|
8469
8614
|
name: "share",
|
|
8470
8615
|
async run(args, context) {
|
|
8471
8616
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8472
|
-
const manifestPath =
|
|
8617
|
+
const manifestPath = import_node_path23.default.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8473
8618
|
const defaultManifest = {
|
|
8474
8619
|
name,
|
|
8475
8620
|
version: "0.1.0"
|
|
@@ -8506,7 +8651,7 @@ var codeCommand = {
|
|
|
8506
8651
|
async run(args, context) {
|
|
8507
8652
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8508
8653
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8509
|
-
const parsed =
|
|
8654
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8510
8655
|
args,
|
|
8511
8656
|
allowPositionals: true,
|
|
8512
8657
|
strict: false,
|
|
@@ -8555,14 +8700,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8555
8700
|
};
|
|
8556
8701
|
var resolveCurrentCliVersion = async (context) => {
|
|
8557
8702
|
const candidates = [
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8703
|
+
import_node_path23.default.resolve(context.runtimeDir, "..", "package.json"),
|
|
8704
|
+
import_node_path23.default.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8705
|
+
import_node_path23.default.resolve(process.cwd(), "package.json")
|
|
8561
8706
|
];
|
|
8562
8707
|
for (const candidate of candidates) {
|
|
8563
8708
|
if (!await pathExists2(candidate)) continue;
|
|
8564
8709
|
const pkg = await readJsonSafe(candidate);
|
|
8565
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8710
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${import_node_path23.default.sep}packages${import_node_path23.default.sep}cli${import_node_path23.default.sep}`));
|
|
8566
8711
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8567
8712
|
}
|
|
8568
8713
|
return "0.0.0";
|
|
@@ -8612,7 +8757,7 @@ var versionCommand = {
|
|
|
8612
8757
|
name: "version",
|
|
8613
8758
|
aliases: ["v"],
|
|
8614
8759
|
async run(args, context) {
|
|
8615
|
-
const parsed =
|
|
8760
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8616
8761
|
args,
|
|
8617
8762
|
allowPositionals: true,
|
|
8618
8763
|
strict: false,
|
|
@@ -8646,7 +8791,7 @@ var upgradeCommand = {
|
|
|
8646
8791
|
name: "upgrade",
|
|
8647
8792
|
aliases: ["update"],
|
|
8648
8793
|
async run(args, context) {
|
|
8649
|
-
const parsed =
|
|
8794
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8650
8795
|
args,
|
|
8651
8796
|
allowPositionals: true,
|
|
8652
8797
|
strict: false,
|
|
@@ -8800,11 +8945,14 @@ var pluginCommand = {
|
|
|
8800
8945
|
};
|
|
8801
8946
|
|
|
8802
8947
|
// packages/infrastructure/cli/src/preflight.ts
|
|
8948
|
+
var import_node_path25 = __toESM(require("path"), 1);
|
|
8949
|
+
var import_node_url7 = require("url");
|
|
8803
8950
|
init_args();
|
|
8804
8951
|
init_errors();
|
|
8805
8952
|
init_fs();
|
|
8806
8953
|
init_json();
|
|
8807
8954
|
init_src4();
|
|
8955
|
+
var import_meta4 = {};
|
|
8808
8956
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8809
8957
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8810
8958
|
{
|
|
@@ -8830,8 +8978,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8830
8978
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8831
8979
|
let configPath = null;
|
|
8832
8980
|
for (const file of twConfigFiles) {
|
|
8833
|
-
if (await pathExists2(
|
|
8834
|
-
configPath =
|
|
8981
|
+
if (await pathExists2(import_node_path25.default.join(cwd2, file))) {
|
|
8982
|
+
configPath = import_node_path25.default.join(cwd2, file);
|
|
8835
8983
|
break;
|
|
8836
8984
|
}
|
|
8837
8985
|
}
|
|
@@ -8840,7 +8988,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8840
8988
|
return results;
|
|
8841
8989
|
}
|
|
8842
8990
|
try {
|
|
8843
|
-
const configUrl =
|
|
8991
|
+
const configUrl = (0, import_node_url7.pathToFileURL)(configPath);
|
|
8844
8992
|
const configModule = await import(configUrl.href);
|
|
8845
8993
|
const config = configModule.default || configModule;
|
|
8846
8994
|
const theme = config.theme || {};
|
|
@@ -8922,7 +9070,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8922
9070
|
async function hasTailwindCssImport(cwd2) {
|
|
8923
9071
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8924
9072
|
for (const file of cssFiles) {
|
|
8925
|
-
const raw = await readFileSafe(
|
|
9073
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8926
9074
|
if (raw?.includes("tailwindcss")) return true;
|
|
8927
9075
|
}
|
|
8928
9076
|
return false;
|
|
@@ -8938,7 +9086,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8938
9086
|
"app/globals.css"
|
|
8939
9087
|
];
|
|
8940
9088
|
for (const file of cssFiles) {
|
|
8941
|
-
const raw = await readFileSafe(
|
|
9089
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8942
9090
|
if (raw === null) continue;
|
|
8943
9091
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8944
9092
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8946,8 +9094,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8946
9094
|
return { found: false, cssFile: null };
|
|
8947
9095
|
}
|
|
8948
9096
|
async function applyTailwindInit(cwd2) {
|
|
8949
|
-
await ensureFileSafe(
|
|
8950
|
-
await ensureFileSafe(
|
|
9097
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9098
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8951
9099
|
}
|
|
8952
9100
|
function check(results, id, label, pass, message, fix) {
|
|
8953
9101
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8969,7 +9117,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8969
9117
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8970
9118
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8971
9119
|
);
|
|
8972
|
-
const pkg = await readJsonSafe(
|
|
9120
|
+
const pkg = await readJsonSafe(import_node_path25.default.join(cwd2, "package.json"));
|
|
8973
9121
|
check(
|
|
8974
9122
|
results,
|
|
8975
9123
|
"package-json",
|
|
@@ -9003,7 +9151,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9003
9151
|
}
|
|
9004
9152
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9005
9153
|
const twConfigChecks = await Promise.all(
|
|
9006
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9154
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path25.default.join(cwd2, file)) }))
|
|
9007
9155
|
);
|
|
9008
9156
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9009
9157
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9015,7 +9163,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9015
9163
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9016
9164
|
"tw init"
|
|
9017
9165
|
);
|
|
9018
|
-
const oldConfig = await readJsonSafe(
|
|
9166
|
+
const oldConfig = await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.ts"));
|
|
9019
9167
|
if (oldConfig) {
|
|
9020
9168
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9021
9169
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9039,7 +9187,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9039
9187
|
validation.message
|
|
9040
9188
|
);
|
|
9041
9189
|
}
|
|
9042
|
-
const hasTsConfig = await pathExists2(
|
|
9190
|
+
const hasTsConfig = await pathExists2(import_node_path25.default.join(cwd2, "tsconfig.json"));
|
|
9043
9191
|
check(
|
|
9044
9192
|
results,
|
|
9045
9193
|
"typescript",
|
|
@@ -9115,7 +9263,8 @@ async function runPreflightCli(rawArgs) {
|
|
|
9115
9263
|
function isDirectExecution() {
|
|
9116
9264
|
const scriptPath = process.argv[1];
|
|
9117
9265
|
if (!scriptPath) return false;
|
|
9118
|
-
|
|
9266
|
+
const currentUrl = typeof import_meta4 !== "undefined" && __importMetaUrl ? __importMetaUrl : `file://${scriptPath}`;
|
|
9267
|
+
return currentUrl === (0, import_node_url7.pathToFileURL)(scriptPath).href;
|
|
9119
9268
|
}
|
|
9120
9269
|
if (isDirectExecution()) {
|
|
9121
9270
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9183,6 +9332,7 @@ var installRegistryCommand = {
|
|
|
9183
9332
|
};
|
|
9184
9333
|
|
|
9185
9334
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9335
|
+
var import_node_util10 = require("util");
|
|
9186
9336
|
init_errors();
|
|
9187
9337
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9188
9338
|
if (context.json && options.jsonUnsupported) {
|
|
@@ -9212,7 +9362,7 @@ var parseCommand = {
|
|
|
9212
9362
|
var transformCommand = {
|
|
9213
9363
|
name: "transform",
|
|
9214
9364
|
async run(args, context) {
|
|
9215
|
-
const parsed =
|
|
9365
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9216
9366
|
args,
|
|
9217
9367
|
allowPositionals: true,
|
|
9218
9368
|
strict: false,
|
|
@@ -9255,7 +9405,7 @@ var lintCommand = {
|
|
|
9255
9405
|
var formatCommand2 = {
|
|
9256
9406
|
name: "format",
|
|
9257
9407
|
async run(args, context) {
|
|
9258
|
-
const parsed =
|
|
9408
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9259
9409
|
args,
|
|
9260
9410
|
allowPositionals: true,
|
|
9261
9411
|
strict: false,
|
|
@@ -9297,7 +9447,7 @@ var optimizeCommand = {
|
|
|
9297
9447
|
var splitCommand = {
|
|
9298
9448
|
name: "split",
|
|
9299
9449
|
async run(args, context) {
|
|
9300
|
-
const parsed =
|
|
9450
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9301
9451
|
args,
|
|
9302
9452
|
allowPositionals: true,
|
|
9303
9453
|
strict: false,
|
|
@@ -9393,13 +9543,15 @@ var scriptCommands = [
|
|
|
9393
9543
|
];
|
|
9394
9544
|
|
|
9395
9545
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9546
|
+
var import_node_path26 = __toESM(require("path"), 1);
|
|
9547
|
+
var import_node_util11 = require("util");
|
|
9396
9548
|
init_errors();
|
|
9397
9549
|
init_fs();
|
|
9398
9550
|
init_json();
|
|
9399
9551
|
var storybookCommand = {
|
|
9400
9552
|
name: "storybook",
|
|
9401
9553
|
async run(args, context) {
|
|
9402
|
-
const parsed =
|
|
9554
|
+
const parsed = (0, import_node_util11.parseArgs)({
|
|
9403
9555
|
args,
|
|
9404
9556
|
allowPositionals: true,
|
|
9405
9557
|
strict: false,
|
|
@@ -9433,7 +9585,7 @@ var storybookCommand = {
|
|
|
9433
9585
|
context.output.writeText(
|
|
9434
9586
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9435
9587
|
);
|
|
9436
|
-
const localBin =
|
|
9588
|
+
const localBin = import_node_path26.default.join(
|
|
9437
9589
|
process.cwd(),
|
|
9438
9590
|
"node_modules",
|
|
9439
9591
|
".bin",
|
|
@@ -9450,6 +9602,7 @@ var storybookCommand = {
|
|
|
9450
9602
|
};
|
|
9451
9603
|
|
|
9452
9604
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9605
|
+
var import_node_util12 = require("util");
|
|
9453
9606
|
init_errors();
|
|
9454
9607
|
var studioCommand = {
|
|
9455
9608
|
name: "studio",
|
|
@@ -9457,7 +9610,7 @@ var studioCommand = {
|
|
|
9457
9610
|
if (context.json) {
|
|
9458
9611
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9459
9612
|
}
|
|
9460
|
-
const parsed =
|
|
9613
|
+
const parsed = (0, import_node_util12.parseArgs)({
|
|
9461
9614
|
args,
|
|
9462
9615
|
allowPositionals: true,
|
|
9463
9616
|
strict: false,
|
|
@@ -9523,7 +9676,8 @@ var syncCommand = {
|
|
|
9523
9676
|
};
|
|
9524
9677
|
|
|
9525
9678
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9526
|
-
var
|
|
9679
|
+
var import_node_util13 = require("util");
|
|
9680
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9527
9681
|
init_errors();
|
|
9528
9682
|
|
|
9529
9683
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
@@ -9531,16 +9685,17 @@ init_internal();
|
|
|
9531
9685
|
|
|
9532
9686
|
// packages/domain/engine/src/native-bridge.ts
|
|
9533
9687
|
init_src();
|
|
9688
|
+
var import_meta5 = {};
|
|
9534
9689
|
var log4 = createDebugLogger("engine:native");
|
|
9535
9690
|
function getDirname3() {
|
|
9536
9691
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
9537
|
-
if (typeof
|
|
9538
|
-
return getDirname(
|
|
9692
|
+
if (typeof import_meta5 !== "undefined" && __importMetaUrl) {
|
|
9693
|
+
return getDirname(__importMetaUrl);
|
|
9539
9694
|
}
|
|
9540
9695
|
return process.cwd();
|
|
9541
9696
|
}
|
|
9542
|
-
var isValidEngineBinding = (
|
|
9543
|
-
const candidate =
|
|
9697
|
+
var isValidEngineBinding = (module2) => {
|
|
9698
|
+
const candidate = module2;
|
|
9544
9699
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
9545
9700
|
};
|
|
9546
9701
|
var createEngineBindingLoader = () => {
|
|
@@ -10348,7 +10503,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10348
10503
|
const parsed = native.parseCssRules(css);
|
|
10349
10504
|
for (const r of parsed) {
|
|
10350
10505
|
const className = prefix + r.className;
|
|
10351
|
-
r.variants.length > 0;
|
|
10506
|
+
const hasVariants = r.variants.length > 0;
|
|
10352
10507
|
const layerName = detectLayerFromClassName(className);
|
|
10353
10508
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10354
10509
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10598,10 +10753,12 @@ async function traceClass(className, options) {
|
|
|
10598
10753
|
}
|
|
10599
10754
|
|
|
10600
10755
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10756
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
10757
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
|
10601
10758
|
init_internal();
|
|
10602
10759
|
init_src2();
|
|
10603
10760
|
function toRelativePath(root, value) {
|
|
10604
|
-
const relative =
|
|
10761
|
+
const relative = import_node_path27.default.relative(root, value);
|
|
10605
10762
|
return relative.length > 0 ? relative : ".";
|
|
10606
10763
|
}
|
|
10607
10764
|
function uniqueSorted(values) {
|
|
@@ -10670,7 +10827,7 @@ function tryCompileClasses(classes) {
|
|
|
10670
10827
|
}
|
|
10671
10828
|
}
|
|
10672
10829
|
function traceSingleFile(filePath, root) {
|
|
10673
|
-
const source =
|
|
10830
|
+
const source = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
10674
10831
|
const classes = uniqueSorted(scanSource(source));
|
|
10675
10832
|
const imports = extractImports(source);
|
|
10676
10833
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10701,7 +10858,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10701
10858
|
const imports = [];
|
|
10702
10859
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10703
10860
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10704
|
-
const source =
|
|
10861
|
+
const source = import_node_fs10.default.readFileSync(entry.file, "utf8");
|
|
10705
10862
|
const fileImports = extractImports(source);
|
|
10706
10863
|
for (const fileImport of fileImports) {
|
|
10707
10864
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10732,12 +10889,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10732
10889
|
};
|
|
10733
10890
|
}
|
|
10734
10891
|
async function traceTarget(target, options = {}) {
|
|
10735
|
-
const root =
|
|
10736
|
-
const resolvedTarget =
|
|
10737
|
-
if (!
|
|
10892
|
+
const root = import_node_path27.default.resolve(options.root ?? process.cwd());
|
|
10893
|
+
const resolvedTarget = import_node_path27.default.resolve(root, target);
|
|
10894
|
+
if (!import_node_fs10.default.existsSync(resolvedTarget)) {
|
|
10738
10895
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10739
10896
|
}
|
|
10740
|
-
const stat =
|
|
10897
|
+
const stat = import_node_fs10.default.statSync(resolvedTarget);
|
|
10741
10898
|
if (stat.isDirectory()) {
|
|
10742
10899
|
return traceDirectory(resolvedTarget, root);
|
|
10743
10900
|
}
|
|
@@ -10755,7 +10912,7 @@ function parseTraceFormat(value, context) {
|
|
|
10755
10912
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10756
10913
|
}
|
|
10757
10914
|
async function runTraceCli(args, context) {
|
|
10758
|
-
const parsed =
|
|
10915
|
+
const parsed = (0, import_node_util13.parseArgs)({
|
|
10759
10916
|
args,
|
|
10760
10917
|
allowPositionals: true,
|
|
10761
10918
|
strict: false,
|
|
@@ -10899,14 +11056,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10899
11056
|
}
|
|
10900
11057
|
|
|
10901
11058
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10902
|
-
var
|
|
11059
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
11060
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
11061
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10903
11062
|
init_output();
|
|
10904
11063
|
async function runGenerateTypesCli(rawArgs) {
|
|
10905
11064
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10906
11065
|
const logger = createCliLogger({ output });
|
|
10907
11066
|
const cwd2 = process.cwd();
|
|
10908
11067
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10909
|
-
const outPath =
|
|
11068
|
+
const outPath = import_node_path28.default.resolve(cwd2, outFile);
|
|
10910
11069
|
output.writeText("");
|
|
10911
11070
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10912
11071
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -10942,12 +11101,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10942
11101
|
}
|
|
10943
11102
|
output.writeText("");
|
|
10944
11103
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10945
|
-
const outDir =
|
|
10946
|
-
if (!
|
|
10947
|
-
|
|
11104
|
+
const outDir = import_node_path28.default.dirname(outPath);
|
|
11105
|
+
if (!import_node_fs11.default.existsSync(outDir)) {
|
|
11106
|
+
import_node_fs11.default.mkdirSync(outDir, { recursive: true });
|
|
10948
11107
|
}
|
|
10949
|
-
|
|
10950
|
-
logger.ok(
|
|
11108
|
+
import_node_fs11.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11109
|
+
logger.ok(import_node_path28.default.relative(cwd2, outPath));
|
|
10951
11110
|
output.writeText("");
|
|
10952
11111
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
10953
11112
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10958,13 +11117,13 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10958
11117
|
}
|
|
10959
11118
|
async function loadNativeBinding2(cwd2) {
|
|
10960
11119
|
const candidates = [
|
|
10961
|
-
|
|
10962
|
-
|
|
11120
|
+
import_node_path28.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11121
|
+
import_node_path28.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10963
11122
|
];
|
|
10964
11123
|
for (const candidate of candidates) {
|
|
10965
|
-
if (
|
|
11124
|
+
if (import_node_fs11.default.existsSync(candidate)) {
|
|
10966
11125
|
try {
|
|
10967
|
-
return
|
|
11126
|
+
return require(candidate);
|
|
10968
11127
|
} catch {
|
|
10969
11128
|
}
|
|
10970
11129
|
}
|
|
@@ -10973,9 +11132,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10973
11132
|
}
|
|
10974
11133
|
|
|
10975
11134
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
11135
|
+
var import_node_util14 = require("util");
|
|
10976
11136
|
init_errors();
|
|
10977
11137
|
|
|
10978
11138
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11139
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
11140
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
10979
11141
|
init_internal();
|
|
10980
11142
|
init_src2();
|
|
10981
11143
|
function extractVariantChain(usage) {
|
|
@@ -11024,7 +11186,7 @@ async function whyClass(className, options) {
|
|
|
11024
11186
|
for (const file of scanResult.files) {
|
|
11025
11187
|
const source = (() => {
|
|
11026
11188
|
try {
|
|
11027
|
-
return
|
|
11189
|
+
return import_node_fs12.default.readFileSync(file.file, "utf8");
|
|
11028
11190
|
} catch {
|
|
11029
11191
|
return "";
|
|
11030
11192
|
}
|
|
@@ -11038,7 +11200,7 @@ async function whyClass(className, options) {
|
|
|
11038
11200
|
className
|
|
11039
11201
|
]);
|
|
11040
11202
|
usedIn.push({
|
|
11041
|
-
file:
|
|
11203
|
+
file: import_node_path29.default.relative(root, file.file) || import_node_path29.default.basename(file.file),
|
|
11042
11204
|
line: location.line,
|
|
11043
11205
|
column: location.column,
|
|
11044
11206
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11159,7 +11321,7 @@ function printWhyOutput(result, output) {
|
|
|
11159
11321
|
output.writeText("");
|
|
11160
11322
|
}
|
|
11161
11323
|
async function runWhyCli(args, context) {
|
|
11162
|
-
const parsed =
|
|
11324
|
+
const parsed = (0, import_node_util14.parseArgs)({
|
|
11163
11325
|
args,
|
|
11164
11326
|
allowPositionals: true,
|
|
11165
11327
|
strict: false,
|
|
@@ -11201,7 +11363,7 @@ function toVariadic(value) {
|
|
|
11201
11363
|
return Array.isArray(value) ? value : [value];
|
|
11202
11364
|
}
|
|
11203
11365
|
function buildMainProgram(context) {
|
|
11204
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11366
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11205
11367
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11206
11368
|
const program2 = new Command("tw");
|
|
11207
11369
|
program2.name("tw").description("tailwind-styled-v4 CLI").version("5.0.4", "--version", "Output the current version").option("--json", "Output strict JSON envelope").option("--debug", "Include stack traces for errors").option("--verbose", "Verbose runtime logs");
|
|
@@ -11498,13 +11660,12 @@ init_args();
|
|
|
11498
11660
|
init_output();
|
|
11499
11661
|
async function main2() {
|
|
11500
11662
|
await runCliMain({
|
|
11501
|
-
importMetaUrl:
|
|
11663
|
+
importMetaUrl: __importMetaUrl,
|
|
11502
11664
|
buildProgram: buildMainProgram
|
|
11503
11665
|
});
|
|
11504
11666
|
}
|
|
11505
|
-
var
|
|
11506
|
-
if (process.argv[1] ===
|
|
11667
|
+
var __currentFile = (0, import_node_url8.fileURLToPath)(__importMetaUrl);
|
|
11668
|
+
if (process.argv[1] === __currentFile) {
|
|
11507
11669
|
main2();
|
|
11508
11670
|
}
|
|
11509
|
-
//# sourceMappingURL=tw.js.map
|
|
11510
11671
|
//# sourceMappingURL=tw.js.map
|